Subversion Repositories cheapmusic

Rev

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