Subversion Repositories cheapmusic

Rev

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

Rev Author Line No. Line
2 - 1
<?php
65 - 2
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/dnsexit.php");
3
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/sessions_db.php");
4
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/cryptor.php");
5
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/vendors.php");
6
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/tools.php");
7
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/wishlist.php");
7 - 8
 
9 - 9
error_reporting(E_ALL);
10
 
35 - 11
$userData = [];
57 - 12
$userTheme = 'default';
25 - 13
$configFile = parse_ini_file($_SERVER['DOCUMENT_ROOT'] . "/../MyFiles/config/cheapmusic.ini", true);
7 - 14
$crypt = Cryptor::getInstance($configFile['cryptor']);
15
$tmpSessionTab = (isset($_POST["sessionTab"]) && $_POST["sessionTab"] > 0 ? $_POST["sessionTab"] : null);
16
$handler = MySessionHandler::getInstance($tmpSessionTab, $configFile['mysqli']);
9 - 17
$vendors = Vendors::getInstance();
18
$vendors->setVendor($configFile['ebay'], Vendors::EBAY);
19
$vendors->setVendor($configFile['discogs'], Vendors::DISCOGS);
20 - 20
$vendors->setVendor($configFile['linkshare'], Vendors::LINKSHARE);
21
$vendors->setVendor($configFile['cjaffiliate'], Vendors::CJAFFILIATE);
22
$vendors->setVendor($configFile['walmart'], Vendors::WALMART);
54 - 23
$vendors->setVendor($configFile['itunes'], Vendors::ITUNES);
7 - 24
unset($configFile);
25
 
2 - 26
ini_set("session.cookie_httponly", 1);
27
ini_set("session.cookie_secure", 1);
7 - 28
session_set_save_handler($handler, true);
35 - 29
if (!empty($_COOKIE['PHPSESSID'])) {
30
    session_id($_COOKIE['PHPSESSID']);
31
}
2 - 32
session_start();
35 - 33
 
34
// Check whether user ID is available in cookie
65 - 35
if (!empty($_COOKIE['rememberUserId']) && !empty($_COOKIE['hash']) && empty($_SESSION['sessData']['loginType'])) {
35 - 36
    require_once 'login/includes/config.php';
37
    require_once 'login/includes/User.class.php';
38
    require_once 'login/includes/password.php';
39
    $user = new User();
40
    $conditions['where'] = array(
41
        'id' => $_COOKIE['rememberUserId']
42
    );
43
    $conditions['return_type'] = 'single';
44
    $userData = $user->getRows($conditions);
45
    if (!empty($userData) && password_verify($userData['password'] . $userData['id'], $_COOKIE['hash'])) {
65 - 46
        $_SESSION['sessData']['userLoggedIn'] = true;
35 - 47
        $_SESSION['sessData']['userID'] = $_COOKIE['rememberUserId'];
36 - 48
        $userPicture = getUserImage($userData);
57 - 49
        $userTheme = $userData['theme'];
59 - 50
        $_SESSION["currentLayout"] = ($userData['cardView'] == '1' ? 'CardView' : 'TableView');
57 - 51
        if (empty($_SESSION["manualFilter"])) {
52
            $_SESSION['buyer']['Zip'] = $userData['zip'];
53
            $_SESSION['buyer']['Country'] = 'United States';
54
            $_SESSION['buyer']['Currency'] = 'USD';
65 - 55
            $_SESSION["filterCondition"]["New"] = $userData['conditionNew'];
56
            $_SESSION["filterCondition"]["Used"] = $userData['conditionUsed'];
57
            $_SESSION["filterMediaType"]["CD"] = $userData['mediaCD'];
58
            $_SESSION["filterMediaType"]["Record"] = $userData['mediaRecord'];
59
            $_SESSION["filterMediaType"]["Digital"] = $userData['mediaDigital'];
60
            $_SESSION["filterMediaType"]["Book"] = $userData['mediaBook'];
61
        }
62
    }
63
    else {
35 - 64
        unsetSessData();
65
    }
65 - 66
    // or if the user has already logged in
67
 
68
}
69
else if (isLoggedIn()) {
35 - 70
    require_once 'login/includes/config.php';
71
    require_once 'login/includes/User.class.php';
72
    require_once 'login/includes/password.php';
73
    $user = new User();
74
    $conditions['where'] = array(
75
        'id' => $_SESSION['sessData']['userID']
76
    );
77
    $conditions['return_type'] = 'single';
78
    $userData = $user->getRows($conditions);
57 - 79
 
35 - 80
    if (!empty($userData)) {
36 - 81
        $userPicture = getUserImage($userData);
57 - 82
        $userTheme = $userData['theme'];
59 - 83
        $_SESSION["currentLayout"] = ($userData['cardView'] == '1' ? 'CardView' : 'TableView');
57 - 84
        if (empty($_SESSION["manualFilter"])) {
35 - 85
            $_SESSION['buyer']['Zip'] = $userData['zip'];
86
            $_SESSION['buyer']['Country'] = 'United States';
87
            $_SESSION['buyer']['Currency'] = 'USD';
65 - 88
            $_SESSION["filterCondition"]["New"] = $userData['conditionNew'];
89
            $_SESSION["filterCondition"]["Used"] = $userData['conditionUsed'];
90
            $_SESSION["filterMediaType"]["CD"] = $userData['mediaCD'];
91
            $_SESSION["filterMediaType"]["Record"] = $userData['mediaRecord'];
92
            $_SESSION["filterMediaType"]["Digital"] = $userData['mediaDigital'];
93
            $_SESSION["filterMediaType"]["Book"] = $userData['mediaBook'];
35 - 94
        }
65 - 95
    }
96
    else {
35 - 97
        unsetSessData();
98
    }
65 - 99
    // not logged in
100
 
101
}
102
else {
35 - 103
    unsetSessData();
104
}
57 - 105
 
2 - 106
?>
107
<!DOCTYPE html>
108
<html lang="en-US">
109
<head>
110
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
57 - 111
    <title>Find Cheap Music... CDs, Records, Digital, Books and Sheets</title>
2 - 112
    <meta name="viewport" content="width=device-width, initial-scale=1">
57 - 113
    <meta name="description" content="Find Cheap Music searches dozens of trusted online stores for low-priced Compact Discs, Vinyl Records, Digital Downloads, Music Sheets and Music related books. Maintain a wishlist and get coupons / special offers with free registration.">
114
    <meta name="keywords" content="Cheap,Music,Album,Single,Promo,CD,Compact Disc,Vinyl,Record,Digital,Download,Sheet,Book">
2 - 115
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
62 - 116
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh" crossorigin="anonymous"></script>
2 - 117
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
118
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
62 - 119
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.10.1/css/all.css" integrity="sha384-wxqG4glGB3nlqX0bi23nmgwCSjWIW13BdLUEYC4VIMehfbcro/ATkyDsF/AbIOVe" crossorigin="anonymous">
57 - 120
    <link rel="stylesheet" href="css/theme-<?php echo (!empty($userTheme) ? $userTheme : "default"); ?>.css">
65 - 121
    <link rel="stylesheet" href="css/style.min.css" integrity="sha384-LDBFBlcpKs0PvmtYaURA3UX8VIx8Q2u6TLqCPOSwEPwThoKvFbwzdBAuL3slsV8R" crossorigin="anonymous">
17 - 122
    <link rel="stylesheet" href="css/jquery.flexdatalist.min.css" integrity="sha384-IUkltzhO8hiEuEm0UJQvWrrtE1xqVHA0NbUeIY7a+zCokg7LqiDf5HSt69ru8a7R" crossorigin="anonymous">
123
    <script src="js/jquery.flexdatalist.min.js" integrity="sha384-JKZ5fd3wxuyCR/AhbpbYALE2xwlYMGYu0XpsXixX7YOni1G0is+vwTuSMuGGYhnl" crossorigin="anonymous"></script>
20 - 124
    <script src="js/input-clearer.min.js" integrity="sha384-PPIpFAWvzKO0l06o6zNV8tPFHNistosIDKHylKx5kJIM9zceSlJxAScUWQpt02xy" crossorigin="anonymous"></script>
43 - 125
    <script src="js/paginate.min.js" integrity="sha384-sN78hrw/H8RzeS4ete92bJj3Y0lEBeiryHisgrRm/pvsPyGLf0M14Vnm+cRxVchm" crossorigin="anonymous"></script>
57 - 126
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
127
    <link rel="icon" href="/favicon.ico" type="image/x-icon">
2 - 128
</head>
129
<body>
130
 
131
<?php
5 - 132
initSessionVariables();
2 - 133
 
134
if ($_SERVER["REQUEST_METHOD"] == "POST") {
65 - 135
    if ($_POST["submit"] == "Search") {
35 - 136
        if (empty($_SESSION['buyer']['Zip'])) {
65 - 137
            $zip = (empty($_POST['buyerZip']) ? "" : sanitizeInput($_POST['buyerZip']));
138
            if (strlen($zip) == 5 && preg_match("/^[0-9 ]*$/", $zip)) {
57 - 139
                if ($_SESSION["buyer"]["Zip"] != $zip) {
65 - 140
                    $_SESSION["manualFilter"] = true;
141
                    $_SESSION["buyer"]["Zip"] = $zip;
142
                }
143
            }
144
            else if (strlen($zip) == 0) {
145
                $_SESSION["buyer"]["Zip"] = "";
146
            }
147
        }
2 - 148
 
46 - 149
        $_SESSION["discogsTitle"] = "";
150
        $_SESSION["discogsArtist"] = "";
65 - 151
        $searchTerm = (empty($_POST['searchTerm']) ? "" : searchFriendlyString($_POST['searchTerm']));
152
        if (empty($searchTerm)) {
153
            resetSessionVars();
154
        }
155
        else {
156
            $_SESSION["searchTerm"] = $searchTerm;
2 - 157
 
5 - 158
            if (checkSearchFilters()) {
65 - 159
                performSearch();
160
            }
161
        }
162
    }
163
    else if ($_POST["submit"] == "Save") {
164
        $_SESSION["manualFilter"] = true;
165
        $_SESSION["filterCondition"]["New"] = checkPV("filterConditionNew");
166
        $_SESSION["filterCondition"]["Used"] = checkPV("filterConditionUsed");
167
        $_SESSION["filterMediaType"]["CD"] = checkPV("filterMediaTypeCD");
168
        $_SESSION["filterMediaType"]["Record"] = checkPV("filterMediaTypeRecord");
169
        $_SESSION["filterMediaType"]["Digital"] = checkPV("filterMediaTypeDigital");
170
        $_SESSION["filterMediaType"]["Book"] = checkPV("filterMediaTypeBook");
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
    }
220
    else if (in_array($_POST["submit"], $buttonArr)) {
221
        $_SESSION["currentView"] = $_POST["submit"];
222
        filterResults();
223
    }
224
}
225
else if ($_SERVER["REQUEST_METHOD"] == "GET") {
226
    if (isset($_GET['z'])) {
227
        $_SESSION["buyer"]["Zip"] = "";
228
        $zip = sanitizeInput($_GET['z']);
229
        if (strlen($zip) == 5 && preg_match("/^[0-9 ]*$/", $zip)) {
230
            $_SESSION["buyer"]["Zip"] = $zip;
231
        }
232
    }
2 - 233
 
9 - 234
    $_SESSION["searchTerm"] = "";
65 - 235
    if (isset($_GET['q'])) {
236
        $_SESSION["searchTerm"] = searchFriendlyString($_GET["q"]);
5 - 237
        if (checkSearchFilters()) {
65 - 238
            performSearch();
239
        }
240
    }
2 - 241
}
242
?>
243
 
14 - 244
    <form method="post" action="/index.php">
20 - 245
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
14 - 246
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
65 - 247
       	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
62 - 248
        <nav class="navbar navbar-expand-sm bg-black navbar-dark">
35 - 249
            <div class="navbar-header">
62 - 250
                <button type="submit" name="submit" value="Search" class="btn text-white">Find Cheap Music</button>
35 - 251
            </div>
14 - 252
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
253
                <span class="navbar-toggler-icon"></span>
254
            </button>
255
            <div class="collapse navbar-collapse" id="collapsibleNavbar">
35 - 256
                <ul class="navbar-nav mr-auto">
14 - 257
                    <li class="nav-item">
47 - 258
                        <button type="submit" name="submit" value="Search" class="nav-link btn"><i class="fas fa-home"></i></button>
35 - 259
                    </li>
260
                    <?php if (isLoggedIn()) { ?>
261
                        <li class="nav-item">
262
                            <button type="submit" name="submit" value="coupons" class="nav-link btn">Coupons</button>
263
                        </li>
45 - 264
                        <li class="nav-item">
265
                            <button type="submit" name="submit" value="wishlist" class="nav-link btn">Wishlist</button>
266
                        </li>
65 - 267
                    <?php
268
} ?>
35 - 269
                    <li class="nav-item">
15 - 270
                        <button type="submit" name="submit" value="terms" class="nav-link btn">Terms of Service</button>
14 - 271
                    </li>
272
                    <li class="nav-item">
15 - 273
                        <button type="submit" name="submit" value="privacy" class="nav-link btn">Privacy Policy</button>
14 - 274
                    </li>
57 - 275
                    <li class="nav-item">
276
                        <button type="submit" name="submit" value="help" class="nav-link btn"><i class="far fa-question-circle"></i></button>
277
                    </li>
14 - 278
                </ul>
35 - 279
                <ul class="navbar-nav">
280
                    <?php if (!isLoggedIn()) { ?>
281
                    <li class="nav-item">
47 - 282
                        <a href="/login/index.php" class="nav-link btn"><i class='fas fa-sign-in-alt'></i> Login</a>
35 - 283
                    </li>
65 - 284
                    <?php
285
}
286
else { ?>
36 - 287
                        <li class="nav-item">
47 - 288
                            <img class="img-fluid hide-extra-small hide-small user-img" src="<?php echo $userPicture ?>" alt="User Image">
36 - 289
                        </li>
35 - 290
                        <li class="nav-item dropdown">
47 - 291
                          <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown"><i class="fas fa-user-cog"></i> Account</a>
35 - 292
                          <div class="dropdown-menu dropdown-menu-right">
47 - 293
                              <button formaction="/login/account.php" type="submit" name="submit" value="account" class="dropdown-item btn"><i class="fas fa-info-circle"></i> Information</button>
294
                              <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 - 295
                              <?php if (empty($_SESSION['sessData']['loginType']) || $_SESSION['sessData']['loginType'] != 'social') { ?>
47 - 296
                                  <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 - 297
                              <?php
298
    } ?>
47 - 299
                              <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 - 300
                          </div>
301
                        </li>
65 - 302
                    <?php
303
} ?>
35 - 304
                </ul>
14 - 305
            </div>
306
        </nav>
307
    </form>
2 - 308
 
3 - 309
    <div class="page-header bg-primary">
310
        <div class="container text-center py-3">
14 - 311
        <?php
65 - 312
if (getPGV('submit') == "terms") {
313
    echo file_get_contents('snippets/headerTerms.txt');
314
}
315
else if (getPGV('submit') == "privacy") {
316
    echo file_get_contents('snippets/headerPrivacy.txt');
317
}
318
else if (getPGV('submit') == "coupons") {
319
    echo file_get_contents('snippets/headerCoupons.txt');
320
}
321
else if (getPGV('submit') == "wishlist") {
322
    echo file_get_contents('snippets/headerWishlist.txt');
323
}
324
else if (getPGV('submit') == "help") {
325
    echo file_get_contents('snippets/headerHelp.txt');
326
}
327
else {
328
    echo '<p id="textslide" class="d-none d-sm-block">FindCheapMusic.com</p>';
329
}
330
?>
2 - 331
        </div>
332
    </div>
333
 
3 - 334
	<div class="container-fluid bg-primary py-3">
5 - 335
        <?php
65 - 336
if (!in_array(getPGV('submit') , array(
337
    "terms",
338
    "privacy",
339
    "coupons",
340
    "wishlist",
341
    "help"
342
))) {
343
    echo $_SESSION["filterWarnings"];
344
}
345
?>
346
        <form <?php if (in_array(getPGV('submit') , array(
347
    "terms",
348
    "privacy",
349
    "coupons",
350
    "wishlist",
351
    "help"
352
))) {
353
    echo "hidden";
354
} ?> method="post" action="/index.php" class="form-inline"
58 - 355
            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 - 356
            <input id="sessionId" type="hidden" name="sessionId" value="<?php echo session_id(); ?>">
20 - 357
            <input id="sessionTab" type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
17 - 358
        	<div class="form-group">
359
                <div class="btn-group">
47 - 360
                    <button class="btn input-group-text mx-1 rounded" type="button" data-toggle="modal" data-target="#searchInfoModal" data-toggle2="tooltip" title="Search Tips"><i class="fas fa-info-circle btn-search"></i></button>
361
                    <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 - 362
                    <div class="btn-group">
62 - 363
                        <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 - 364
                        <div class="dropdown-menu">
365
                            <div class="form-inline">
366
                                <label class="m-2">Shipping to:</label>
367
                                <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>
368
                                <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 - 369
                                <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 - 370
                            </div>
371
                        </div>
372
                    </div>
2 - 373
                </div>
374
        	</div>
20 - 375
        	<div class="form-group mx-1">
376
        	    <input id="searchTerm" list="searchHistory" name="searchTerm" type="text" class="form-control flexdatalist searchTerm-width" placeholder="Search by Barcode, Artist, Title, ..." value="<?php echo getSV("searchTerm") ?>">
17 - 377
        	    <datalist id="searchHistory">
378
            	    <?php echo getSearchHistory(); ?>
379
            	</datalist>
380
            </div>
381
        	<div class="form-group">
382
                <button id="searchBtn" type="submit" class="btn btn-success mx-1 rounded" name="submit" value="Search">Go</button>
383
            </div>
2 - 384
        </form>
385
    </div>
386
 
5 - 387
    <?php
65 - 388
if (getPGV('submit') == "terms") {
389
    echo file_get_contents('snippets/terms.txt');
390
}
391
else if (getPGV('submit') == "privacy") {
392
    echo file_get_contents('snippets/privacy.txt');
393
}
394
else if (getPGV('submit') == "help") {
395
    echo file_get_contents('snippets/help.txt');
396
}
397
else if (getPGV('submit') == "coupons") {
398
    //get_linkshareCoupons(); // bugbug
399
    echo getCouponCodes();
400
}
401
else if (getPGV('submit') == "wishlist") {
402
    echo getWishlist();
403
}
404
else if (getPGV('submit') == "random") {
405
    findDiscogsMaster("***RANDOM***");
406
    echo $_SESSION["discogs"];
407
}
408
else {
409
    if ($_SESSION["lowestPrice"]["All"] > 0.00 || !empty($_SESSION["searchTerm"])) {
38 - 410
        echo $_SESSION["discogs"];
65 - 411
        echo "<div id=\"productTable\" class=\"container bg-info\">";
412
        echo printResultHeader();
413
        echo printResult();
414
        echo "</div>";
415
    }
416
    else if (!empty($_SESSION["discogs"])) {
417
        echo $_SESSION["discogs"];
418
    }
419
    else {
420
?>
38 - 421
    <div class="container-fluid text-center">
422
    <form method="post" action="/index.php">
423
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
424
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
65 - 425
       	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
43 - 426
        <button id="randomBtn" type="submit" class="btn btn-success mt-5 rounded" name="submit" value="random">Random Album Suggestions</button>
38 - 427
    </form>
428
    </div>
65 - 429
        <?php
14 - 430
    }
65 - 431
    echo printSearchFilterModal();
432
    echo printSearchInfoModal();
433
}
434
?>
2 - 435
 
14 - 436
    <div class="modal" id="progressBarDiv">
17 - 437
        <div class="modal-dialog modal-dialog-centered">
14 - 438
            <div class="modal-content">
439
                <div class="modal-header">
15 - 440
                    <h4 id="progressBarHeader">Searching</h4>
14 - 441
                </div>
442
                <div class="modal-body">
443
                    <div class="progress">
444
                        <div id="progressBar" class="progress-bar" style="width:0%">0%</div>
445
                    </div>
446
                </div>
15 - 447
                <div class="modal-footer">
448
                    <span id="progressBarMessage"></span>
449
                </div>
14 - 450
            </div>
451
        </div>
452
    </div>
453
 
64 - 454
    <footer class="container-fluid text-center bg-primary py-5">
20 - 455
        <?php if (!empty($_SESSION["searchTerm"])) {
65 - 456
    echo "<p>Disclaimer: As an Associate we earn from qualifying purchases.</p>";
457
}
458
?>
20 - 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") ?>">
65 - 462
           	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
20 - 463
            <ul class="list-inline text-center">
464
                <li class="list-inline-item">
62 - 465
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="terms">Terms of Service</button>
20 - 466
                </li>
467
                <li class="list-inline-item">
62 - 468
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="privacy">Privacy Policy</button>
20 - 469
                </li>
470
            </ul>
471
        </form>
17 - 472
        <p>Copyright &#169; <?php echo @date("Y"); ?> FindCheapMusic.com. All rights reserved.</p>
2 - 473
    </footer>
474
 
64 - 475
    <script src="js/dr.min.js" integrity="sha384-dzUXoixB0NZMraFbaWqEvdR3Ya6hVAL0VTsa82FXqOLUu07EZEwXLO1kSAV28m+X" crossorigin="anonymous"></script>
36 - 476
    <script>var quotes = [
38 - 477
    <?php
65 - 478
if ($file = fopen("snippets/header.txt", "r")) {
479
    while (($line = fgets($file)) !== false) {
480
        echo "\"" . trim($line) . "\",";
481
    }
482
    fclose($file);
483
}
484
?>
36 - 485
    ]; var i = 0; setInterval(function() { $("#textslide").html(quotes[i]); if (i == quotes.length) i=0; else i++; }, 5 * 1000);</script>
2 - 486
</body>
487
</html>
21 - 488
<?php MySessionHandler::commit(session_id()); ?>