Subversion Repositories cheapmusic

Rev

Rev 104 | Rev 107 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
<?php
65 - 2
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/dnsexit.php");
3
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/sessions_db.php");
4
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/cryptor.php");
5
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/vendors.php");
6
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/tools.php");
7
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/wishlist.php");
7 - 8
 
9 - 9
error_reporting(E_ALL);
10
 
35 - 11
$userData = [];
57 - 12
$userTheme = 'default';
70 - 13
$configFile = parse_ini_file($_SERVER['DOCUMENT_ROOT'] . FCM_CONFIGFILE, true);
7 - 14
$crypt = Cryptor::getInstance($configFile['cryptor']);
15
$tmpSessionTab = (isset($_POST["sessionTab"]) && $_POST["sessionTab"] > 0 ? $_POST["sessionTab"] : null);
16
$handler = MySessionHandler::getInstance($tmpSessionTab, $configFile['mysqli']);
9 - 17
$vendors = Vendors::getInstance();
83 - 18
Vendors::setAllVendors($configFile, $vendors);
7 - 19
unset($configFile);
20
 
2 - 21
ini_set("session.cookie_httponly", 1);
22
ini_set("session.cookie_secure", 1);
7 - 23
session_set_save_handler($handler, true);
35 - 24
if (!empty($_COOKIE['PHPSESSID'])) {
25
    session_id($_COOKIE['PHPSESSID']);
26
}
2 - 27
session_start();
35 - 28
 
29
// Check whether user ID is available in cookie
65 - 30
if (!empty($_COOKIE['rememberUserId']) && !empty($_COOKIE['hash']) && empty($_SESSION['sessData']['loginType'])) {
35 - 31
    require_once 'login/includes/config.php';
32
    require_once 'login/includes/User.class.php';
33
    require_once 'login/includes/password.php';
34
    $user = new User();
35
    $conditions['where'] = array(
36
        'id' => $_COOKIE['rememberUserId']
37
    );
38
    $conditions['return_type'] = 'single';
39
    $userData = $user->getRows($conditions);
40
    if (!empty($userData) && password_verify($userData['password'] . $userData['id'], $_COOKIE['hash'])) {
65 - 41
        $_SESSION['sessData']['userLoggedIn'] = true;
35 - 42
        $_SESSION['sessData']['userID'] = $_COOKIE['rememberUserId'];
36 - 43
        $userPicture = getUserImage($userData);
57 - 44
        $userTheme = $userData['theme'];
59 - 45
        $_SESSION["currentLayout"] = ($userData['cardView'] == '1' ? 'CardView' : 'TableView');
57 - 46
        if (empty($_SESSION["manualFilter"])) {
47
            $_SESSION['buyer']['Zip'] = $userData['zip'];
48
            $_SESSION['buyer']['Country'] = 'United States';
49
            $_SESSION['buyer']['Currency'] = 'USD';
65 - 50
            $_SESSION["filterCondition"]["New"] = $userData['conditionNew'];
51
            $_SESSION["filterCondition"]["Used"] = $userData['conditionUsed'];
52
            $_SESSION["filterMediaType"]["CD"] = $userData['mediaCD'];
53
            $_SESSION["filterMediaType"]["Record"] = $userData['mediaRecord'];
54
            $_SESSION["filterMediaType"]["Digital"] = $userData['mediaDigital'];
55
            $_SESSION["filterMediaType"]["Book"] = $userData['mediaBook'];
56
        }
57
    }
58
    else {
35 - 59
        unsetSessData();
60
    }
65 - 61
    // or if the user has already logged in
62
 
63
}
64
else if (isLoggedIn()) {
35 - 65
    require_once 'login/includes/config.php';
66
    require_once 'login/includes/User.class.php';
67
    require_once 'login/includes/password.php';
68
    $user = new User();
69
    $conditions['where'] = array(
70
        'id' => $_SESSION['sessData']['userID']
71
    );
72
    $conditions['return_type'] = 'single';
73
    $userData = $user->getRows($conditions);
57 - 74
 
35 - 75
    if (!empty($userData)) {
36 - 76
        $userPicture = getUserImage($userData);
57 - 77
        $userTheme = $userData['theme'];
59 - 78
        $_SESSION["currentLayout"] = ($userData['cardView'] == '1' ? 'CardView' : 'TableView');
57 - 79
        if (empty($_SESSION["manualFilter"])) {
35 - 80
            $_SESSION['buyer']['Zip'] = $userData['zip'];
81
            $_SESSION['buyer']['Country'] = 'United States';
82
            $_SESSION['buyer']['Currency'] = 'USD';
65 - 83
            $_SESSION["filterCondition"]["New"] = $userData['conditionNew'];
84
            $_SESSION["filterCondition"]["Used"] = $userData['conditionUsed'];
85
            $_SESSION["filterMediaType"]["CD"] = $userData['mediaCD'];
86
            $_SESSION["filterMediaType"]["Record"] = $userData['mediaRecord'];
87
            $_SESSION["filterMediaType"]["Digital"] = $userData['mediaDigital'];
88
            $_SESSION["filterMediaType"]["Book"] = $userData['mediaBook'];
35 - 89
        }
65 - 90
    }
91
    else {
35 - 92
        unsetSessData();
93
    }
65 - 94
    // not logged in
95
 
96
}
97
else {
35 - 98
    unsetSessData();
99
}
57 - 100
 
78 - 101
checkPriceMonitor();
2 - 102
?>
103
<!DOCTYPE html>
104
<html lang="en-US">
105
<head>
106
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
57 - 107
    <title>Find Cheap Music... CDs, Records, Digital, Books and Sheets</title>
2 - 108
    <meta name="viewport" content="width=device-width, initial-scale=1">
70 - 109
    <?php include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/header.php"); ?>
66 - 110
    <link rel="stylesheet" href="/css/jquery.flexdatalist.min.css" integrity="sha384-IUkltzhO8hiEuEm0UJQvWrrtE1xqVHA0NbUeIY7a+zCokg7LqiDf5HSt69ru8a7R" crossorigin="anonymous">
111
    <script src="/js/jquery.flexdatalist.min.js" integrity="sha384-JKZ5fd3wxuyCR/AhbpbYALE2xwlYMGYu0XpsXixX7YOni1G0is+vwTuSMuGGYhnl" crossorigin="anonymous"></script>
112
    <script src="/js/input-clearer.min.js" integrity="sha384-PPIpFAWvzKO0l06o6zNV8tPFHNistosIDKHylKx5kJIM9zceSlJxAScUWQpt02xy" crossorigin="anonymous"></script>
113
    <script src="/js/paginate.min.js" integrity="sha384-sN78hrw/H8RzeS4ete92bJj3Y0lEBeiryHisgrRm/pvsPyGLf0M14Vnm+cRxVchm" crossorigin="anonymous"></script>
106 - 114
    <script src="/js/email.min.js" integrity="sha384-8+kvQx3NZ4k35zNvk9s6pJw11/G3qcsfIe29UO0uTKmpQKH9bf+Fv+ah3jHb1RCV" crossorigin="anonymous"></script>
57 - 115
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
116
    <link rel="icon" href="/favicon.ico" type="image/x-icon">
2 - 117
</head>
118
<body>
119
 
120
<?php
5 - 121
initSessionVariables();
2 - 122
 
123
if ($_SERVER["REQUEST_METHOD"] == "POST") {
65 - 124
    if ($_POST["submit"] == "Search") {
35 - 125
        if (empty($_SESSION['buyer']['Zip'])) {
65 - 126
            $zip = (empty($_POST['buyerZip']) ? "" : sanitizeInput($_POST['buyerZip']));
127
            if (strlen($zip) == 5 && preg_match("/^[0-9 ]*$/", $zip)) {
57 - 128
                if ($_SESSION["buyer"]["Zip"] != $zip) {
65 - 129
                    $_SESSION["manualFilter"] = true;
130
                    $_SESSION["buyer"]["Zip"] = $zip;
131
                }
132
            }
133
            else if (strlen($zip) == 0) {
134
                $_SESSION["buyer"]["Zip"] = "";
135
            }
136
        }
2 - 137
 
46 - 138
        $_SESSION["discogsTitle"] = "";
139
        $_SESSION["discogsArtist"] = "";
65 - 140
        $searchTerm = (empty($_POST['searchTerm']) ? "" : searchFriendlyString($_POST['searchTerm']));
141
        if (empty($searchTerm)) {
142
            resetSessionVars();
143
        }
144
        else {
145
            $_SESSION["searchTerm"] = $searchTerm;
2 - 146
 
5 - 147
            if (checkSearchFilters()) {
65 - 148
                performSearch();
149
            }
150
        }
151
    }
152
    else if ($_POST["submit"] == "Save") {
153
        $_SESSION["manualFilter"] = true;
66 - 154
        if (!isset($_POST["filterCondition"])) {$_POST["filterCondition"] = []; }
155
        if (!is_array($_POST["filterCondition"])) { $_POST["filterCondition"] = [ $_POST["filterCondition"] ];}
156
        $_SESSION["filterCondition"]["New"] = in_array("New", $_POST["filterCondition"]);
157
        $_SESSION["filterCondition"]["Used"] = in_array("Used", $_POST["filterCondition"]);
158
        if (!isset($_POST["filterMediaType"])) {$_POST["filterMediaType"] = []; }
159
        if (!is_array($_POST["filterMediaType"])) { $_POST["filterMediaType"] = [ $_POST["filterMediaType"] ];}
160
        $_SESSION["filterMediaType"]["CD"] = in_array("CD", $_POST["filterMediaType"]);
161
        $_SESSION["filterMediaType"]["Record"] = in_array("Record", $_POST["filterMediaType"]);
162
        $_SESSION["filterMediaType"]["Digital"] = in_array("Digital", $_POST["filterMediaType"]);
163
        $_SESSION["filterMediaType"]["Book"] = in_array("Book", $_POST["filterMediaType"]);
2 - 164
 
46 - 165
        $_SESSION["discogsTitle"] = "";
166
        $_SESSION["discogsArtist"] = "";
65 - 167
        $searchTerm = searchFriendlyString($_POST['searchTerm']);
168
        if (empty($searchTerm)) {
169
            resetSessionVars();
170
        }
171
        else {
172
            $_SESSION["searchTerm"] = $searchTerm;
27 - 173
 
174
            if (checkSearchFilters()) {
65 - 175
                performSearch();
176
            }
177
        }
178
    }
179
    else if ($_POST["submit"] == "discogsSearch") {
50 - 180
        $searchTerm = "";
181
        if (!empty($_POST['discogsBarcode'])) {
65 - 182
            $searchTerm = searchFriendlyString($_POST['discogsBarcode']);
183
        }
184
        else {
50 - 185
            if (!empty($_POST['discogsTitle'])) {
186
                $searchTerm = $_POST['discogsTitle'];
187
            }
58 - 188
 
50 - 189
            if (!empty($_POST['discogsArtist'])) {
190
                $searchTerm .= " " . $_POST['discogsArtist'];
191
            }
58 - 192
 
50 - 193
            $searchTerm = trim($searchTerm);
194
        }
195
 
65 - 196
        if (empty($searchTerm)) {
197
            resetSessionVars();
198
        }
199
        else {
200
            $_SESSION["searchTerm"] = $searchTerm;
46 - 201
            if (isset($_POST['discogsTitle'])) {
202
                $_SESSION["discogsTitle"] = searchFriendlyString($_POST['discogsTitle']);
203
            }
204
            if (isset($_POST['discogsArtist'])) {
205
                $_SESSION["discogsArtist"] = searchFriendlyString($_POST['discogsArtist']);
206
            }
14 - 207
 
208
            if (checkSearchFilters()) {
65 - 209
                performSearch();
210
            }
211
        }
212
    }
73 - 213
    else if ($_POST["submit"] == "unsubscribe") {
214
// bugbug
215
    }
65 - 216
    else if (in_array($_POST["submit"], $buttonArr)) {
217
        $_SESSION["currentView"] = $_POST["submit"];
218
        filterResults();
219
    }
220
}
221
else if ($_SERVER["REQUEST_METHOD"] == "GET") {
222
    if (isset($_GET['z'])) {
223
        $_SESSION["buyer"]["Zip"] = "";
224
        $zip = sanitizeInput($_GET['z']);
225
        if (strlen($zip) == 5 && preg_match("/^[0-9 ]*$/", $zip)) {
226
            $_SESSION["buyer"]["Zip"] = $zip;
227
        }
228
    }
2 - 229
 
9 - 230
    $_SESSION["searchTerm"] = "";
65 - 231
    if (isset($_GET['q'])) {
232
        $_SESSION["searchTerm"] = searchFriendlyString($_GET["q"]);
5 - 233
        if (checkSearchFilters()) {
65 - 234
            performSearch();
235
        }
236
    }
2 - 237
}
238
?>
239
 
14 - 240
    <form method="post" action="/index.php">
20 - 241
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
14 - 242
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
65 - 243
       	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
81 - 244
        <nav class="navbar navbar-expand-sm bg-black navbar-dark fixed-top">
35 - 245
            <div class="navbar-header">
62 - 246
                <button type="submit" name="submit" value="Search" class="btn text-white">Find Cheap Music</button>
35 - 247
            </div>
14 - 248
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
249
                <span class="navbar-toggler-icon"></span>
250
            </button>
251
            <div class="collapse navbar-collapse" id="collapsibleNavbar">
35 - 252
                <ul class="navbar-nav mr-auto">
14 - 253
                    <li class="nav-item">
47 - 254
                        <button type="submit" name="submit" value="Search" class="nav-link btn"><i class="fas fa-home"></i></button>
35 - 255
                    </li>
256
                    <?php if (isLoggedIn()) { ?>
257
                        <li class="nav-item">
258
                            <button type="submit" name="submit" value="coupons" class="nav-link btn">Coupons</button>
259
                        </li>
45 - 260
                        <li class="nav-item">
79 - 261
                            <button type="submit" name="submit" value="wishlist" class="nav-link btn">Wishlist
262
                            <?php if (!empty($_SESSION['priceMonitor']['newFlag']) && $_SESSION['priceMonitor']['newFlag'] === true) { echo '<scan class="badge badge-pill badge-light">New</scan>'; } ?>
263
                            </button>
45 - 264
                        </li>
65 - 265
                    <?php
266
} ?>
35 - 267
                    <li class="nav-item">
15 - 268
                        <button type="submit" name="submit" value="terms" class="nav-link btn">Terms of Service</button>
14 - 269
                    </li>
270
                    <li class="nav-item">
15 - 271
                        <button type="submit" name="submit" value="privacy" class="nav-link btn">Privacy Policy</button>
14 - 272
                    </li>
57 - 273
                    <li class="nav-item">
274
                        <button type="submit" name="submit" value="help" class="nav-link btn"><i class="far fa-question-circle"></i></button>
275
                    </li>
14 - 276
                </ul>
35 - 277
                <ul class="navbar-nav">
278
                    <?php if (!isLoggedIn()) { ?>
279
                    <li class="nav-item">
47 - 280
                        <a href="/login/index.php" class="nav-link btn"><i class='fas fa-sign-in-alt'></i> Login</a>
35 - 281
                    </li>
65 - 282
                    <?php
283
}
284
else { ?>
36 - 285
                        <li class="nav-item">
47 - 286
                            <img class="img-fluid hide-extra-small hide-small user-img" src="<?php echo $userPicture ?>" alt="User Image">
36 - 287
                        </li>
35 - 288
                        <li class="nav-item dropdown">
47 - 289
                          <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown"><i class="fas fa-user-cog"></i> Account</a>
35 - 290
                          <div class="dropdown-menu dropdown-menu-right">
47 - 291
                              <button formaction="/login/account.php" type="submit" name="submit" value="account" class="dropdown-item btn"><i class="fas fa-info-circle"></i> Information</button>
292
                              <button formaction="/login/editAccount.php" type="submit" name="submit" value="editAccount" class="dropdown-item btn"><i class="fas fa-edit"></i> Edit Account</button>
36 - 293
                              <?php if (empty($_SESSION['sessData']['loginType']) || $_SESSION['sessData']['loginType'] != 'social') { ?>
47 - 294
                                  <button formaction="/login/changePassword.php" type="submit" name="submit" value="changePassword" class="dropdown-item btn"><i class="fas fa-key"></i> Change Password</button>
65 - 295
                              <?php
296
    } ?>
47 - 297
                              <button formaction="/login/userAccount.php?logoutSubmit=1" type="submit" name="submit" value="logout" class="dropdown-item btn"><i class='fas fa-sign-out-alt'></i> Logout</button>
35 - 298
                          </div>
299
                        </li>
65 - 300
                    <?php
301
} ?>
35 - 302
                </ul>
14 - 303
            </div>
304
        </nav>
305
    </form>
2 - 306
 
3 - 307
    <div class="page-header bg-primary">
308
        <div class="container text-center py-3">
14 - 309
        <?php
65 - 310
if (getPGV('submit') == "terms") {
311
    echo file_get_contents('snippets/headerTerms.txt');
312
}
313
else if (getPGV('submit') == "privacy") {
314
    echo file_get_contents('snippets/headerPrivacy.txt');
315
}
316
else if (getPGV('submit') == "coupons") {
317
    echo file_get_contents('snippets/headerCoupons.txt');
318
}
319
else if (getPGV('submit') == "wishlist") {
320
    echo file_get_contents('snippets/headerWishlist.txt');
78 - 321
    if (!empty($_SESSION['priceMonitor'])) {
322
    ?>
323
    <form method="post" action="/index.php">
324
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
79 - 325
        <button id="priceMonitor" type="submit" class="btn btn-success rounded" name="submit" value="priceMonitor">Price Monitor Results
326
        <?php if (!empty($_SESSION['priceMonitor']['newFlag']) && $_SESSION['priceMonitor']['newFlag'] === true) { echo '<scan class="badge badge-pill badge-dark">New</scan>'; } ?>
327
        </button>
78 - 328
    </form>
329
    <?php
330
    }
65 - 331
}
78 - 332
else if (getPGV('submit') == "priceMonitor") {
333
    echo file_get_contents('snippets/headerPriceMonitor.txt');
334
}
65 - 335
else if (getPGV('submit') == "help") {
336
    echo file_get_contents('snippets/headerHelp.txt');
337
}
73 - 338
else if (getPGV('submit') == "unsubscribe") {
339
    echo file_get_contents('snippets/unsubscribeWishlist.txt');
340
}
65 - 341
else {
342
    echo '<p id="textslide" class="d-none d-sm-block">FindCheapMusic.com</p>';
343
}
344
?>
2 - 345
        </div>
346
    </div>
347
 
3 - 348
	<div class="container-fluid bg-primary py-3">
5 - 349
        <?php
65 - 350
if (!in_array(getPGV('submit') , array(
351
    "terms",
352
    "privacy",
353
    "coupons",
354
    "wishlist",
78 - 355
    "priceMonitor",
73 - 356
    "help",
357
    "unsubscribe"
65 - 358
))) {
359
    echo $_SESSION["filterWarnings"];
360
}
361
?>
362
        <form <?php if (in_array(getPGV('submit') , array(
363
    "terms",
364
    "privacy",
365
    "coupons",
366
    "wishlist",
78 - 367
    "priceMonitor",
73 - 368
    "help",
369
    "unsubscribe"
370
 
65 - 371
))) {
372
    echo "hidden";
373
} ?> method="post" action="/index.php" class="form-inline"
58 - 374
            onsubmit="if (document.getElementById('searchTerm').value != '') { progressBar('Searching for:<br><br><strong>' + document.getElementById('searchTerm').value.toLowerCase().replace(/(?:(^.{1})|\ [a-z]{1})/g, function(a){return a.toUpperCase();}) + '</strong>');document.getElementById('searchBtn').innerHTML = '&lt;span class=\'spinner-border spinner-border-sm\'&gt;&lt;/span&gt; Searching, please wait...'; }">
15 - 375
            <input id="sessionId" type="hidden" name="sessionId" value="<?php echo session_id(); ?>">
20 - 376
            <input id="sessionTab" type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
17 - 377
        	<div class="form-group">
378
                <div class="btn-group">
47 - 379
                    <button class="btn input-group-text mx-1 rounded" type="button" data-toggle="modal" data-target="#searchInfoModal" data-toggle2="tooltip" title="Search Tips"><i class="fas fa-info-circle btn-search"></i></button>
380
                    <button class="btn input-group-text mx-1 rounded" type="button" data-toggle="modal" data-target="#filterModal" data-keyboard="false" data-toggle2="tooltip" title="Search Filter"><i class="fas fa-filter btn-search"></i></button>
17 - 381
                    <div class="btn-group">
62 - 382
                        <button class="btn dropdown-toggle <?php echo ($_SESSION["buyer"]["Zip"] == '' ? "btn-warning" : "input-group-text"); ?> mx-1 rounded" type="button" data-toggle="dropdown" data-toggle2="tooltip" title="<?php echo ($_SESSION["buyer"]["Zip"] == '' ? "Please enter your postal code to get the accurate shipping cost for items listed using a shipping rate table." : "Shipping to"); ?>"><i class="fas fa-shipping-fast btn-search"></i></button>
17 - 383
                        <div class="dropdown-menu">
384
                            <div class="form-inline">
385
                                <label class="m-2">Shipping to:</label>
386
                                <input type="text" class="form-control form-control-sm m-2" maxlength="20" style="width:12em!important" id="buyerCountry" name="buyerCountry" value="United States" readonly>
387
                                <input type="text" class="form-control form-control-sm m-2" maxlength="3" style="width:3.5em!important" id="buyerCurrency" name="buyerCurrency" value="USD" readonly>
65 - 388
                                <input type="text" class="form-control form-control-sm m-2" maxlength="5" style="width:5.5em!important" id="buyerZip" name="buyerZip" placeholder="Zip Code" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
17 - 389
                            </div>
390
                        </div>
391
                    </div>
2 - 392
                </div>
393
        	</div>
20 - 394
        	<div class="form-group mx-1">
395
        	    <input id="searchTerm" list="searchHistory" name="searchTerm" type="text" class="form-control flexdatalist searchTerm-width" placeholder="Search by Barcode, Artist, Title, ..." value="<?php echo getSV("searchTerm") ?>">
17 - 396
        	    <datalist id="searchHistory">
397
            	    <?php echo getSearchHistory(); ?>
398
            	</datalist>
399
            </div>
400
        	<div class="form-group">
401
                <button id="searchBtn" type="submit" class="btn btn-success mx-1 rounded" name="submit" value="Search">Go</button>
402
            </div>
2 - 403
        </form>
404
    </div>
405
 
5 - 406
    <?php
65 - 407
if (getPGV('submit') == "terms") {
408
    echo file_get_contents('snippets/terms.txt');
409
}
410
else if (getPGV('submit') == "privacy") {
411
    echo file_get_contents('snippets/privacy.txt');
412
}
413
else if (getPGV('submit') == "help") {
414
    echo file_get_contents('snippets/help.txt');
415
}
416
else if (getPGV('submit') == "coupons") {
417
    //get_linkshareCoupons(); // bugbug
418
    echo getCouponCodes();
419
}
420
else if (getPGV('submit') == "wishlist") {
421
    echo getWishlist();
422
}
78 - 423
else if (getPGV('submit') == "priceMonitor") {
424
    echo "<div id=\"productTable\" class=\"container bg-secondary border pt-2\">";
425
    echo getPriceMonitor(); // bugbug
426
    echo "</div>";
427
}
73 - 428
else if (getPGV('submit') == "unsubscribe") {
429
    echo unsubscribeWishlist($_GET);
430
}
65 - 431
else if (getPGV('submit') == "random") {
432
    findDiscogsMaster("***RANDOM***");
433
    echo $_SESSION["discogs"];
434
}
435
else {
436
    if ($_SESSION["lowestPrice"]["All"] > 0.00 || !empty($_SESSION["searchTerm"])) {
38 - 437
        echo $_SESSION["discogs"];
104 - 438
        echo "<div id=\"productTable\" class=\"container bg-secondary border py-2\">";
86 - 439
        echo "<h4 class=\"text-center py-2\">Store Offers</h4>";
104 - 440
        if ($_SESSION["lowestPrice"]["All"] > 0.00) {
441
            echo printResultHeader();
442
        }
65 - 443
        echo printResult();
444
        echo "</div>";
445
    }
446
    else if (!empty($_SESSION["discogs"])) {
447
        echo $_SESSION["discogs"];
448
    }
449
    else {
450
?>
38 - 451
    <div class="container-fluid text-center">
452
    <form method="post" action="/index.php">
453
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
454
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
65 - 455
       	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
43 - 456
        <button id="randomBtn" type="submit" class="btn btn-success mt-5 rounded" name="submit" value="random">Random Album Suggestions</button>
38 - 457
    </form>
458
    </div>
65 - 459
        <?php
14 - 460
    }
65 - 461
    echo printSearchFilterModal();
462
    echo printSearchInfoModal();
463
}
464
?>
2 - 465
 
14 - 466
    <div class="modal" id="progressBarDiv">
17 - 467
        <div class="modal-dialog modal-dialog-centered">
14 - 468
            <div class="modal-content">
469
                <div class="modal-header">
15 - 470
                    <h4 id="progressBarHeader">Searching</h4>
14 - 471
                </div>
472
                <div class="modal-body">
473
                    <div class="progress">
474
                        <div id="progressBar" class="progress-bar" style="width:0%">0%</div>
475
                    </div>
476
                </div>
15 - 477
                <div class="modal-footer">
478
                    <span id="progressBarMessage"></span>
479
                </div>
14 - 480
            </div>
481
        </div>
482
    </div>
483
 
81 - 484
    <button onclick="topFunction()" id="topBtn" title="Go to top">Top</button>
485
 
64 - 486
    <footer class="container-fluid text-center bg-primary py-5">
78 - 487
        <?php if (!empty($_SESSION["searchTerm"]) || getPGV('submit') == "priceMonitor") {
65 - 488
    echo "<p>Disclaimer: As an Associate we earn from qualifying purchases.</p>";
489
}
490
?>
20 - 491
        <form method="post" action="/index.php">
492
            <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
493
       	    <input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
65 - 494
           	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
20 - 495
            <ul class="list-inline text-center">
496
                <li class="list-inline-item">
62 - 497
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="terms">Terms of Service</button>
20 - 498
                </li>
499
                <li class="list-inline-item">
62 - 500
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="privacy">Privacy Policy</button>
20 - 501
                </li>
502
            </ul>
503
        </form>
17 - 504
        <p>Copyright &#169; <?php echo @date("Y"); ?> FindCheapMusic.com. All rights reserved.</p>
2 - 505
    </footer>
506
 
87 - 507
    <script src="js/dr.min.js" defer integrity="sha384-X0Mk9TxrJE6sBB+QYyhf98BYJoaQ1lrD5Qyf9qWDXn1nmdgICFL45QzblqlepIcs" crossorigin="anonymous"></script>
36 - 508
    <script>var quotes = [
38 - 509
    <?php
65 - 510
if ($file = fopen("snippets/header.txt", "r")) {
511
    while (($line = fgets($file)) !== false) {
512
        echo "\"" . trim($line) . "\",";
513
    }
514
    fclose($file);
515
}
516
?>
83 - 517
    ]; setInterval(function() { $("#textslide").html(quotes[Math.floor(Math.random() * (quotes.length + 1))]); }, 5 * 1000);
518
    </script>
2 - 519
</body>
520
</html>
21 - 521
<?php MySessionHandler::commit(session_id()); ?>