Subversion Repositories cheapmusic

Rev

Rev 108 | Rev 111 | 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"/>
110 - 114
        <script src=<?php echo timeStampUrl("js/jquery.flexdatalist.min.js") ?> integrity="sha384-ZA4Y1tWCkaHcYC9ru6ItTA6sRWPQ44pePoyYLiBB/ZJw9aQt4LnpzCibYTVGETdw" crossorigin="anonymous"></script>
108 - 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
?>
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">
108 - 295
                            <img class="img-fluid hide-extra-small hide-small user-img" src="<?php echo timeStampUrl($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") {
108 - 426
    include 'php/help.php';
65 - 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
?>
110 - 463
    <div class="container-fluid text-center mb-2">
38 - 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>
110 - 471
    <div class="container bg-secondary border py-2 mt-4">
472
    <h2 class="text-center py-2">Getting Started</h2>
473
    <p>Welcome to Find Cheap Music. Here you can search dozens of trusted online stores at once. The below information details the major website features and is also available via the link to the help page (<i class="far fa-question-circle"></i>) up top.</p>
474
    <hr>
108 - 475
    <?php include 'php/help.php'; ?>
110 - 476
    </div>
65 - 477
        <?php
14 - 478
    }
65 - 479
    echo printSearchFilterModal();
480
    echo printSearchInfoModal();
481
}
482
?>
2 - 483
 
14 - 484
    <div class="modal" id="progressBarDiv">
17 - 485
        <div class="modal-dialog modal-dialog-centered">
14 - 486
            <div class="modal-content">
487
                <div class="modal-header">
107 - 488
                    <p id="progressBarHeader" class="display-6">Searching</p>
14 - 489
                </div>
490
                <div class="modal-body">
491
                    <div class="progress">
492
                        <div id="progressBar" class="progress-bar" style="width:0%">0%</div>
493
                    </div>
494
                </div>
15 - 495
                <div class="modal-footer">
496
                    <span id="progressBarMessage"></span>
497
                </div>
14 - 498
            </div>
499
        </div>
500
    </div>
501
 
81 - 502
    <button onclick="topFunction()" id="topBtn" title="Go to top">Top</button>
503
 
64 - 504
    <footer class="container-fluid text-center bg-primary py-5">
78 - 505
        <?php if (!empty($_SESSION["searchTerm"]) || getPGV('submit') == "priceMonitor") {
65 - 506
    echo "<p>Disclaimer: As an Associate we earn from qualifying purchases.</p>";
507
}
508
?>
20 - 509
        <form method="post" action="/index.php">
510
            <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
511
       	    <input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
65 - 512
           	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
20 - 513
            <ul class="list-inline text-center">
514
                <li class="list-inline-item">
62 - 515
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="terms">Terms of Service</button>
20 - 516
                </li>
517
                <li class="list-inline-item">
62 - 518
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="privacy">Privacy Policy</button>
20 - 519
                </li>
520
            </ul>
521
        </form>
17 - 522
        <p>Copyright &#169; <?php echo @date("Y"); ?> FindCheapMusic.com. All rights reserved.</p>
2 - 523
    </footer>
524
 
36 - 525
    <script>var quotes = [
38 - 526
    <?php
65 - 527
if ($file = fopen("snippets/header.txt", "r")) {
528
    while (($line = fgets($file)) !== false) {
529
        echo "\"" . trim($line) . "\",";
530
    }
531
    fclose($file);
532
}
533
?>
83 - 534
    ]; setInterval(function() { $("#textslide").html(quotes[Math.floor(Math.random() * (quotes.length + 1))]); }, 5 * 1000);
535
    </script>
107 - 536
    <script>
537
        function downloadJSAtOnload() {
538
        var scriptArr = [ /* "js/fb_pixel.min.js", */
108 - 539
                          "<?php echo timeStampUrl("js/dr.min.js") ?>",
540
<?php if ($_SERVER["SERVER_NAME"] == "www.findcheapmusic.com") {
541
                          echo timeStampUrl("js/gtag.min.js") . ",";
542
 } ?>
543
                          "<?php echo timeStampUrl("js/lazysizes.min.js") ?>"
107 - 544
                        ];
545
 
546
        scriptArr.forEach(function(jsFile){
547
            var element = document.createElement("script");
548
            element.src = jsFile;
549
            document.body.appendChild(element);
550
            })
551
        }
552
 
553
        if (window.addEventListener)
554
            window.addEventListener("load", downloadJSAtOnload, {passive: true});
555
        else if (window.attachEvent)
556
            window.attachEvent("onload", downloadJSAtOnload);
557
        else
558
            window.onload = downloadJSAtOnload;
559
    </script>
2 - 560
</body>
561
</html>
21 - 562
<?php MySessionHandler::commit(session_id()); ?>