Subversion Repositories cheapmusic

Rev

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

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