Subversion Repositories cheapmusic

Rev

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