Subversion Repositories cheapmusic

Rev

Rev 111 | Rev 113 | 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
}
224
else if ($_SERVER["REQUEST_METHOD"] == "GET") {
225
    if (isset($_GET['z'])) {
226
        $_SESSION["buyer"]["Zip"] = "";
227
        $zip = sanitizeInput($_GET['z']);
228
        if (strlen($zip) == 5 && preg_match("/^[0-9 ]*$/", $zip)) {
229
            $_SESSION["buyer"]["Zip"] = $zip;
230
        }
231
    }
2 - 232
 
9 - 233
    $_SESSION["searchTerm"] = "";
65 - 234
    if (isset($_GET['q'])) {
235
        $_SESSION["searchTerm"] = searchFriendlyString($_GET["q"]);
5 - 236
        if (checkSearchFilters()) {
65 - 237
            performSearch();
238
        }
239
    }
2 - 240
}
241
?>
14 - 242
    <form method="post" action="/index.php">
20 - 243
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
14 - 244
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
81 - 245
        <nav class="navbar navbar-expand-sm bg-black navbar-dark fixed-top">
35 - 246
            <div class="navbar-header">
107 - 247
                <button type="submit" name="submit" value="Search" class="btn text-white" aria-label="Go to home page">Find Cheap Music</button>
35 - 248
            </div>
107 - 249
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar" aria-label="Open Menu">
14 - 250
                <span class="navbar-toggler-icon"></span>
251
            </button>
252
            <div class="collapse navbar-collapse" id="collapsibleNavbar">
35 - 253
                <ul class="navbar-nav mr-auto">
14 - 254
                    <li class="nav-item">
107 - 255
                        <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 - 256
                    </li>
257
                    <?php if (isLoggedIn()) { ?>
258
                        <li class="nav-item">
259
                            <button type="submit" name="submit" value="coupons" class="nav-link btn">Coupons</button>
260
                        </li>
45 - 261
                        <li class="nav-item">
79 - 262
                            <button type="submit" name="submit" value="wishlist" class="nav-link btn">Wishlist
263
                            <?php if (!empty($_SESSION['priceMonitor']['newFlag']) && $_SESSION['priceMonitor']['newFlag'] === true) { echo '<scan class="badge badge-pill badge-light">New</scan>'; } ?>
264
                            </button>
45 - 265
                        </li>
65 - 266
                    <?php
267
} ?>
35 - 268
                    <li class="nav-item">
15 - 269
                        <button type="submit" name="submit" value="terms" class="nav-link btn">Terms of Service</button>
14 - 270
                    </li>
271
                    <li class="nav-item">
15 - 272
                        <button type="submit" name="submit" value="privacy" class="nav-link btn">Privacy Policy</button>
14 - 273
                    </li>
57 - 274
                    <li class="nav-item">
107 - 275
                        <a href="https://blog.findcheapmusic.com" target="_blank" rel="noreferrer noopener" class="nav-link btn" role="button">Blog</a>
57 - 276
                    </li>
107 - 277
                    <li class="nav-item">
278
                        <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>
279
                    </li>
14 - 280
                </ul>
35 - 281
                <ul class="navbar-nav">
282
                    <?php if (!isLoggedIn()) { ?>
283
                    <li class="nav-item">
47 - 284
                        <a href="/login/index.php" class="nav-link btn"><i class='fas fa-sign-in-alt'></i> Login</a>
35 - 285
                    </li>
65 - 286
                    <?php
287
}
288
else { ?>
36 - 289
                        <li class="nav-item">
108 - 290
                            <img class="img-fluid hide-extra-small hide-small user-img" src="<?php echo timeStampUrl($userPicture); ?>" alt="User Image">
36 - 291
                        </li>
35 - 292
                        <li class="nav-item dropdown">
47 - 293
                          <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown"><i class="fas fa-user-cog"></i> Account</a>
35 - 294
                          <div class="dropdown-menu dropdown-menu-right">
47 - 295
                              <button formaction="/login/account.php" type="submit" name="submit" value="account" class="dropdown-item btn"><i class="fas fa-info-circle"></i> Information</button>
296
                              <button formaction="/login/editAccount.php" type="submit" name="submit" value="editAccount" class="dropdown-item btn"><i class="fas fa-edit"></i> Edit Account</button>
36 - 297
                              <?php if (empty($_SESSION['sessData']['loginType']) || $_SESSION['sessData']['loginType'] != 'social') { ?>
47 - 298
                                  <button formaction="/login/changePassword.php" type="submit" name="submit" value="changePassword" class="dropdown-item btn"><i class="fas fa-key"></i> Change Password</button>
65 - 299
                              <?php
300
    } ?>
47 - 301
                              <button formaction="/login/userAccount.php?logoutSubmit=1" type="submit" name="submit" value="logout" class="dropdown-item btn"><i class='fas fa-sign-out-alt'></i> Logout</button>
35 - 302
                          </div>
303
                        </li>
65 - 304
                    <?php
305
} ?>
35 - 306
                </ul>
14 - 307
            </div>
308
        </nav>
309
    </form>
2 - 310
 
3 - 311
    <div class="page-header bg-primary">
312
        <div class="container text-center py-3">
14 - 313
        <?php
65 - 314
if (getPGV('submit') == "terms") {
315
    echo file_get_contents('snippets/headerTerms.txt');
316
}
317
else if (getPGV('submit') == "privacy") {
318
    echo file_get_contents('snippets/headerPrivacy.txt');
319
}
320
else if (getPGV('submit') == "coupons") {
321
    echo file_get_contents('snippets/headerCoupons.txt');
322
}
323
else if (getPGV('submit') == "wishlist") {
324
    echo file_get_contents('snippets/headerWishlist.txt');
78 - 325
    if (!empty($_SESSION['priceMonitor'])) {
326
    ?>
327
    <form method="post" action="/index.php">
328
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
79 - 329
        <button id="priceMonitor" type="submit" class="btn btn-success rounded" name="submit" value="priceMonitor">Price Monitor Results
330
        <?php if (!empty($_SESSION['priceMonitor']['newFlag']) && $_SESSION['priceMonitor']['newFlag'] === true) { echo '<scan class="badge badge-pill badge-dark">New</scan>'; } ?>
331
        </button>
78 - 332
    </form>
333
    <?php
334
    }
65 - 335
}
78 - 336
else if (getPGV('submit') == "priceMonitor") {
337
    echo file_get_contents('snippets/headerPriceMonitor.txt');
338
}
65 - 339
else if (getPGV('submit') == "help") {
340
    echo file_get_contents('snippets/headerHelp.txt');
341
}
73 - 342
else if (getPGV('submit') == "unsubscribe") {
343
    echo file_get_contents('snippets/unsubscribeWishlist.txt');
344
}
65 - 345
else {
107 - 346
    echo '<h1>Find Cheap Music</h1>';
347
    echo '<p id="textslide" class="d-none d-sm-block">Bookmark FindCheapMusic.com</p>';
65 - 348
}
349
?>
2 - 350
        </div>
351
    </div>
352
 
3 - 353
	<div class="container-fluid bg-primary py-3">
5 - 354
        <?php
65 - 355
if (!in_array(getPGV('submit') , array(
356
    "terms",
357
    "privacy",
358
    "coupons",
359
    "wishlist",
78 - 360
    "priceMonitor",
73 - 361
    "help",
362
    "unsubscribe"
65 - 363
))) {
364
    echo $_SESSION["filterWarnings"];
365
}
366
?>
367
        <form <?php if (in_array(getPGV('submit') , array(
368
    "terms",
369
    "privacy",
370
    "coupons",
371
    "wishlist",
78 - 372
    "priceMonitor",
73 - 373
    "help",
374
    "unsubscribe"
375
 
65 - 376
))) {
107 - 377
    echo "hidden=\"hidden\"";
378
} ?> id="searchForm" method="post" action="/index.php" class="form-inline"
58 - 379
            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 - 380
            <input id="sessionId" type="hidden" name="sessionId" value="<?php echo session_id(); ?>">
20 - 381
            <input id="sessionTab" type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
17 - 382
        	<div class="form-group">
383
                <div class="btn-group">
107 - 384
                    <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>
385
<!--
47 - 386
                    <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 - 387
                    <div class="btn-group">
62 - 388
                        <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 - 389
                        <div class="dropdown-menu">
390
                            <div class="form-inline">
391
                                <label class="m-2">Shipping to:</label>
392
                                <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>
393
                                <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 - 394
                                <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 - 395
                            </div>
396
                        </div>
397
                    </div>
107 - 398
-->
2 - 399
                </div>
400
        	</div>
20 - 401
        	<div class="form-group mx-1">
107 - 402
        	    <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 - 403
        	    <datalist id="searchHistory">
404
            	    <?php echo getSearchHistory(); ?>
405
            	</datalist>
406
            </div>
407
        	<div class="form-group">
408
                <button id="searchBtn" type="submit" class="btn btn-success mx-1 rounded" name="submit" value="Search">Go</button>
409
            </div>
2 - 410
        </form>
411
    </div>
412
 
5 - 413
    <?php
65 - 414
if (getPGV('submit') == "terms") {
415
    echo file_get_contents('snippets/terms.txt');
416
}
417
else if (getPGV('submit') == "privacy") {
418
    echo file_get_contents('snippets/privacy.txt');
419
}
420
else if (getPGV('submit') == "help") {
108 - 421
    include 'php/help.php';
65 - 422
}
423
else if (getPGV('submit') == "coupons") {
424
    //get_linkshareCoupons(); // bugbug
425
    echo getCouponCodes();
426
}
427
else if (getPGV('submit') == "wishlist") {
428
    echo getWishlist();
429
}
78 - 430
else if (getPGV('submit') == "priceMonitor") {
431
    echo "<div id=\"productTable\" class=\"container bg-secondary border pt-2\">";
432
    echo getPriceMonitor(); // bugbug
433
    echo "</div>";
434
}
73 - 435
else if (getPGV('submit') == "unsubscribe") {
436
    echo unsubscribeWishlist($_GET);
437
}
65 - 438
else if (getPGV('submit') == "random") {
439
    findDiscogsMaster("***RANDOM***");
440
    echo $_SESSION["discogs"];
441
}
442
else {
443
    if ($_SESSION["lowestPrice"]["All"] > 0.00 || !empty($_SESSION["searchTerm"])) {
38 - 444
        echo $_SESSION["discogs"];
104 - 445
        echo "<div id=\"productTable\" class=\"container bg-secondary border py-2\">";
107 - 446
        echo "<h2 class=\"text-center py-2\">Store Offers</h2>";
104 - 447
        if ($_SESSION["lowestPrice"]["All"] > 0.00) {
448
            echo printResultHeader();
449
        }
65 - 450
        echo printResult();
451
        echo "</div>";
452
    }
453
    else if (!empty($_SESSION["discogs"])) {
454
        echo $_SESSION["discogs"];
455
    }
456
    else {
457
?>
110 - 458
    <div class="container-fluid text-center mb-2">
38 - 459
    <form method="post" action="/index.php">
460
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
461
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
43 - 462
        <button id="randomBtn" type="submit" class="btn btn-success mt-5 rounded" name="submit" value="random">Random Album Suggestions</button>
38 - 463
    </form>
464
    </div>
110 - 465
    <div class="container bg-secondary border py-2 mt-4">
466
    <h2 class="text-center py-2">Getting Started</h2>
467
    <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>
468
    <hr>
108 - 469
    <?php include 'php/help.php'; ?>
110 - 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") ?>">
506
            <ul class="list-inline text-center">
507
                <li class="list-inline-item">
62 - 508
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="terms">Terms of Service</button>
20 - 509
                </li>
510
                <li class="list-inline-item">
62 - 511
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="privacy">Privacy Policy</button>
20 - 512
                </li>
513
            </ul>
514
        </form>
17 - 515
        <p>Copyright &#169; <?php echo @date("Y"); ?> FindCheapMusic.com. All rights reserved.</p>
2 - 516
    </footer>
517
 
36 - 518
    <script>var quotes = [
38 - 519
    <?php
65 - 520
if ($file = fopen("snippets/header.txt", "r")) {
521
    while (($line = fgets($file)) !== false) {
522
        echo "\"" . trim($line) . "\",";
523
    }
524
    fclose($file);
525
}
526
?>
83 - 527
    ]; setInterval(function() { $("#textslide").html(quotes[Math.floor(Math.random() * (quotes.length + 1))]); }, 5 * 1000);
528
    </script>
107 - 529
    <script>
530
        function downloadJSAtOnload() {
531
        var scriptArr = [ /* "js/fb_pixel.min.js", */
108 - 532
                          "<?php echo timeStampUrl("js/dr.min.js") ?>",
533
<?php if ($_SERVER["SERVER_NAME"] == "www.findcheapmusic.com") {
111 - 534
                          echo '"' . timeStampUrl("js/gtag.min.js") . '",';
108 - 535
 } ?>
536
                          "<?php echo timeStampUrl("js/lazysizes.min.js") ?>"
107 - 537
                        ];
538
 
539
        scriptArr.forEach(function(jsFile){
540
            var element = document.createElement("script");
541
            element.src = jsFile;
542
            document.body.appendChild(element);
543
            })
544
        }
545
 
546
        if (window.addEventListener)
547
            window.addEventListener("load", downloadJSAtOnload, {passive: true});
548
        else if (window.attachEvent)
549
            window.attachEvent("onload", downloadJSAtOnload);
550
        else
551
            window.onload = downloadJSAtOnload;
552
    </script>
2 - 553
</body>
554
</html>
21 - 555
<?php MySessionHandler::commit(session_id()); ?>