Subversion Repositories cheapmusic

Rev

Rev 112 | Rev 114 | 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
}
113 - 342
else if (getPGV('submit') == "barcode") {
343
    echo file_get_contents('snippets/headerBarcode.txt');
344
}
73 - 345
else if (getPGV('submit') == "unsubscribe") {
346
    echo file_get_contents('snippets/unsubscribeWishlist.txt');
347
}
65 - 348
else {
107 - 349
    echo '<h1>Find Cheap Music</h1>';
350
    echo '<p id="textslide" class="d-none d-sm-block">Bookmark FindCheapMusic.com</p>';
65 - 351
}
352
?>
2 - 353
        </div>
354
    </div>
355
 
3 - 356
	<div class="container-fluid bg-primary py-3">
5 - 357
        <?php
65 - 358
if (!in_array(getPGV('submit') , array(
359
    "terms",
360
    "privacy",
361
    "coupons",
362
    "wishlist",
78 - 363
    "priceMonitor",
73 - 364
    "help",
113 - 365
    "barcode",
73 - 366
    "unsubscribe"
65 - 367
))) {
368
    echo $_SESSION["filterWarnings"];
369
}
370
?>
371
        <form <?php if (in_array(getPGV('submit') , array(
372
    "terms",
373
    "privacy",
374
    "coupons",
375
    "wishlist",
78 - 376
    "priceMonitor",
73 - 377
    "help",
113 - 378
    "barcode",
73 - 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(); ?>">
113 - 387
            <div style="width: 0; height: 0; overflow: hidden;">
388
                <button type="submit"name="submit" value="Search">Hidden Sumit Button</button>
389
            </div>
390
            <div class="form-group">
17 - 391
                <div class="btn-group">
107 - 392
                    <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>
113 - 393
                    <button class="btn input-group-text mx-1 rounded" type="submit" name="submit" value="barcode" data-toggle="tooltip" title="Barcode Checker" aria-label="Barcode Checker"><i class="fas fa-barcode btn-search"></i></button>
2 - 394
                </div>
395
        	</div>
20 - 396
        	<div class="form-group mx-1">
107 - 397
        	    <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 - 398
        	    <datalist id="searchHistory">
399
            	    <?php echo getSearchHistory(); ?>
400
            	</datalist>
401
            </div>
402
        	<div class="form-group">
403
                <button id="searchBtn" type="submit" class="btn btn-success mx-1 rounded" name="submit" value="Search">Go</button>
404
            </div>
2 - 405
        </form>
406
    </div>
407
 
5 - 408
    <?php
65 - 409
if (getPGV('submit') == "terms") {
410
    echo file_get_contents('snippets/terms.txt');
411
}
412
else if (getPGV('submit') == "privacy") {
413
    echo file_get_contents('snippets/privacy.txt');
414
}
415
else if (getPGV('submit') == "help") {
108 - 416
    include 'php/help.php';
65 - 417
}
113 - 418
else if (getPGV('submit') == "barcode") {
419
    echo '
420
<div class=container py-4 bg-secondary border>
421
    <div class="my-3">
422
    <p>This tool verifies Music CD barcodes or calculates the check digit.<br>See our <a href="https://blog.findcheapmusic.com/2020/03/music-cd-barcodes-and-identifiers.html" target="_blank" rel="noopener noreferrer">blog post</a> for more information about music barcodes.</p>
423
        <form id="barcodeForm">
424
    	    <input type="hidden" name="sessionTab" value="' . MySessionHandler::getSessionTab() . '">
425
            <input type="hidden" name="searchTerm" value="' . getSV("searchTerm") . '">
426
            <div class="input-group mb-3">
427
        	    <input id="barcode" name="barcode" type="text" class="" placeholder="Enter Barcode..." aria-label="Barcode Input">
428
                    <div class="input-group-append">
429
                        <button type="submit" class="btn btn-success barcodeButton" name="submit" value="check">Verify</button>
430
                        <button type="submit" class="btn btn-info barcodeButton" name="submit" value="calc">Calculate</button>
431
                    </div>
432
            </div>
433
        </form>
434
        <div id="barcodeResult"></div>
435
    </div>
436
</div>
437
';
438
}
65 - 439
else if (getPGV('submit') == "coupons") {
440
    //get_linkshareCoupons(); // bugbug
441
    echo getCouponCodes();
442
}
443
else if (getPGV('submit') == "wishlist") {
444
    echo getWishlist();
445
}
78 - 446
else if (getPGV('submit') == "priceMonitor") {
447
    echo "<div id=\"productTable\" class=\"container bg-secondary border pt-2\">";
448
    echo getPriceMonitor(); // bugbug
449
    echo "</div>";
450
}
73 - 451
else if (getPGV('submit') == "unsubscribe") {
452
    echo unsubscribeWishlist($_GET);
453
}
65 - 454
else if (getPGV('submit') == "random") {
455
    findDiscogsMaster("***RANDOM***");
456
    echo $_SESSION["discogs"];
457
}
458
else {
459
    if ($_SESSION["lowestPrice"]["All"] > 0.00 || !empty($_SESSION["searchTerm"])) {
38 - 460
        echo $_SESSION["discogs"];
104 - 461
        echo "<div id=\"productTable\" class=\"container bg-secondary border py-2\">";
107 - 462
        echo "<h2 class=\"text-center py-2\">Store Offers</h2>";
104 - 463
        if ($_SESSION["lowestPrice"]["All"] > 0.00) {
464
            echo printResultHeader();
465
        }
65 - 466
        echo printResult();
467
        echo "</div>";
468
    }
469
    else if (!empty($_SESSION["discogs"])) {
470
        echo $_SESSION["discogs"];
471
    }
472
    else {
473
?>
110 - 474
    <div class="container-fluid text-center mb-2">
38 - 475
    <form method="post" action="/index.php">
476
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
477
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
43 - 478
        <button id="randomBtn" type="submit" class="btn btn-success mt-5 rounded" name="submit" value="random">Random Album Suggestions</button>
38 - 479
    </form>
480
    </div>
110 - 481
    <div class="container bg-secondary border py-2 mt-4">
482
    <h2 class="text-center py-2">Getting Started</h2>
483
    <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>
484
    <hr>
108 - 485
    <?php include 'php/help.php'; ?>
110 - 486
    </div>
65 - 487
        <?php
14 - 488
    }
65 - 489
    echo printSearchFilterModal();
490
    echo printSearchInfoModal();
491
}
492
?>
2 - 493
 
14 - 494
    <div class="modal" id="progressBarDiv">
17 - 495
        <div class="modal-dialog modal-dialog-centered">
14 - 496
            <div class="modal-content">
497
                <div class="modal-header">
107 - 498
                    <p id="progressBarHeader" class="display-6">Searching</p>
14 - 499
                </div>
500
                <div class="modal-body">
501
                    <div class="progress">
502
                        <div id="progressBar" class="progress-bar" style="width:0%">0%</div>
503
                    </div>
504
                </div>
15 - 505
                <div class="modal-footer">
506
                    <span id="progressBarMessage"></span>
507
                </div>
14 - 508
            </div>
509
        </div>
510
    </div>
511
 
81 - 512
    <button onclick="topFunction()" id="topBtn" title="Go to top">Top</button>
513
 
64 - 514
    <footer class="container-fluid text-center bg-primary py-5">
78 - 515
        <?php if (!empty($_SESSION["searchTerm"]) || getPGV('submit') == "priceMonitor") {
65 - 516
    echo "<p>Disclaimer: As an Associate we earn from qualifying purchases.</p>";
517
}
518
?>
20 - 519
        <form method="post" action="/index.php">
520
            <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
521
       	    <input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
522
            <ul class="list-inline text-center">
523
                <li class="list-inline-item">
62 - 524
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="terms">Terms of Service</button>
20 - 525
                </li>
526
                <li class="list-inline-item">
62 - 527
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="privacy">Privacy Policy</button>
20 - 528
                </li>
529
            </ul>
530
        </form>
17 - 531
        <p>Copyright &#169; <?php echo @date("Y"); ?> FindCheapMusic.com. All rights reserved.</p>
2 - 532
    </footer>
533
 
36 - 534
    <script>var quotes = [
38 - 535
    <?php
65 - 536
if ($file = fopen("snippets/header.txt", "r")) {
537
    while (($line = fgets($file)) !== false) {
538
        echo "\"" . trim($line) . "\",";
539
    }
540
    fclose($file);
541
}
542
?>
83 - 543
    ]; setInterval(function() { $("#textslide").html(quotes[Math.floor(Math.random() * (quotes.length + 1))]); }, 5 * 1000);
544
    </script>
107 - 545
    <script>
546
        function downloadJSAtOnload() {
547
        var scriptArr = [ /* "js/fb_pixel.min.js", */
113 - 548
                          "<?php echo timeStampUrl("js/dr.min.js") ?>", // BUGBUG
108 - 549
<?php if ($_SERVER["SERVER_NAME"] == "www.findcheapmusic.com") {
111 - 550
                          echo '"' . timeStampUrl("js/gtag.min.js") . '",';
108 - 551
 } ?>
552
                          "<?php echo timeStampUrl("js/lazysizes.min.js") ?>"
107 - 553
                        ];
554
 
555
        scriptArr.forEach(function(jsFile){
556
            var element = document.createElement("script");
557
            element.src = jsFile;
558
            document.body.appendChild(element);
559
            })
560
        }
561
 
562
        if (window.addEventListener)
563
            window.addEventListener("load", downloadJSAtOnload, {passive: true});
564
        else if (window.attachEvent)
565
            window.attachEvent("onload", downloadJSAtOnload);
566
        else
567
            window.onload = downloadJSAtOnload;
568
    </script>
2 - 569
</body>
570
</html>
21 - 571
<?php MySessionHandler::commit(session_id()); ?>