Subversion Repositories cheapmusic

Rev

Rev 73 | Rev 79 | 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">
265
                            <button type="submit" name="submit" value="wishlist" class="nav-link btn">Wishlist</button>
266
                        </li>
65 - 267
                    <?php
268
} ?>
35 - 269
                    <li class="nav-item">
15 - 270
                        <button type="submit" name="submit" value="terms" class="nav-link btn">Terms of Service</button>
14 - 271
                    </li>
272
                    <li class="nav-item">
15 - 273
                        <button type="submit" name="submit" value="privacy" class="nav-link btn">Privacy Policy</button>
14 - 274
                    </li>
57 - 275
                    <li class="nav-item">
276
                        <button type="submit" name="submit" value="help" class="nav-link btn"><i class="far fa-question-circle"></i></button>
277
                    </li>
14 - 278
                </ul>
35 - 279
                <ul class="navbar-nav">
280
                    <?php if (!isLoggedIn()) { ?>
281
                    <li class="nav-item">
47 - 282
                        <a href="/login/index.php" class="nav-link btn"><i class='fas fa-sign-in-alt'></i> Login</a>
35 - 283
                    </li>
65 - 284
                    <?php
285
}
286
else { ?>
36 - 287
                        <li class="nav-item">
47 - 288
                            <img class="img-fluid hide-extra-small hide-small user-img" src="<?php echo $userPicture ?>" alt="User Image">
36 - 289
                        </li>
35 - 290
                        <li class="nav-item dropdown">
47 - 291
                          <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown"><i class="fas fa-user-cog"></i> Account</a>
35 - 292
                          <div class="dropdown-menu dropdown-menu-right">
47 - 293
                              <button formaction="/login/account.php" type="submit" name="submit" value="account" class="dropdown-item btn"><i class="fas fa-info-circle"></i> Information</button>
294
                              <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 - 295
                              <?php if (empty($_SESSION['sessData']['loginType']) || $_SESSION['sessData']['loginType'] != 'social') { ?>
47 - 296
                                  <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 - 297
                              <?php
298
    } ?>
47 - 299
                              <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 - 300
                          </div>
301
                        </li>
65 - 302
                    <?php
303
} ?>
35 - 304
                </ul>
14 - 305
            </div>
306
        </nav>
307
    </form>
2 - 308
 
3 - 309
    <div class="page-header bg-primary">
310
        <div class="container text-center py-3">
14 - 311
        <?php
65 - 312
if (getPGV('submit') == "terms") {
313
    echo file_get_contents('snippets/headerTerms.txt');
314
}
315
else if (getPGV('submit') == "privacy") {
316
    echo file_get_contents('snippets/headerPrivacy.txt');
317
}
318
else if (getPGV('submit') == "coupons") {
319
    echo file_get_contents('snippets/headerCoupons.txt');
320
}
321
else if (getPGV('submit') == "wishlist") {
322
    echo file_get_contents('snippets/headerWishlist.txt');
78 - 323
    if (!empty($_SESSION['priceMonitor'])) {
324
    ?>
325
    <form method="post" action="/index.php">
326
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
327
        <button id="priceMonitor" type="submit" class="btn btn-success rounded" name="submit" value="priceMonitor">Price Monitor Results</button>
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"];
68 - 438
        echo "<div id=\"productTable\" class=\"container bg-secondary border pt-2\">";
65 - 439
        echo printResultHeader();
440
        echo printResult();
441
        echo "</div>";
442
    }
443
    else if (!empty($_SESSION["discogs"])) {
444
        echo $_SESSION["discogs"];
445
    }
446
    else {
447
?>
38 - 448
    <div class="container-fluid text-center">
449
    <form method="post" action="/index.php">
450
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
451
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
65 - 452
       	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
43 - 453
        <button id="randomBtn" type="submit" class="btn btn-success mt-5 rounded" name="submit" value="random">Random Album Suggestions</button>
38 - 454
    </form>
455
    </div>
65 - 456
        <?php
14 - 457
    }
65 - 458
    echo printSearchFilterModal();
459
    echo printSearchInfoModal();
460
}
461
?>
2 - 462
 
14 - 463
    <div class="modal" id="progressBarDiv">
17 - 464
        <div class="modal-dialog modal-dialog-centered">
14 - 465
            <div class="modal-content">
466
                <div class="modal-header">
15 - 467
                    <h4 id="progressBarHeader">Searching</h4>
14 - 468
                </div>
469
                <div class="modal-body">
470
                    <div class="progress">
471
                        <div id="progressBar" class="progress-bar" style="width:0%">0%</div>
472
                    </div>
473
                </div>
15 - 474
                <div class="modal-footer">
475
                    <span id="progressBarMessage"></span>
476
                </div>
14 - 477
            </div>
478
        </div>
479
    </div>
480
 
64 - 481
    <footer class="container-fluid text-center bg-primary py-5">
78 - 482
        <?php if (!empty($_SESSION["searchTerm"]) || getPGV('submit') == "priceMonitor") {
65 - 483
    echo "<p>Disclaimer: As an Associate we earn from qualifying purchases.</p>";
484
}
485
?>
20 - 486
        <form method="post" action="/index.php">
487
            <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
488
       	    <input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
65 - 489
           	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
20 - 490
            <ul class="list-inline text-center">
491
                <li class="list-inline-item">
62 - 492
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="terms">Terms of Service</button>
20 - 493
                </li>
494
                <li class="list-inline-item">
62 - 495
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="privacy">Privacy Policy</button>
20 - 496
                </li>
497
            </ul>
498
        </form>
17 - 499
        <p>Copyright &#169; <?php echo @date("Y"); ?> FindCheapMusic.com. All rights reserved.</p>
2 - 500
    </footer>
501
 
73 - 502
    <script src="js/dr.min.js" defer integrity="sha384-JpO6gNp2mtwEpWN82pA941hGlK0jnLw7JeZ1ocMXJTju3erOErOIGNI0hGwSjN8z" crossorigin="anonymous"></script>
36 - 503
    <script>var quotes = [
38 - 504
    <?php
65 - 505
if ($file = fopen("snippets/header.txt", "r")) {
506
    while (($line = fgets($file)) !== false) {
507
        echo "\"" . trim($line) . "\",";
508
    }
509
    fclose($file);
510
}
511
?>
68 - 512
    ]; setInterval(function() { $("#textslide").html(quotes[Math.floor(Math.random() * (quotes.length + 1))]); }, 5 * 1000);</script>
2 - 513
</body>
514
</html>
21 - 515
<?php MySessionHandler::commit(session_id()); ?>