Subversion Repositories cheapmusic

Rev

Rev 65 | Rev 68 | 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">
66 - 120
    <link rel="stylesheet" href="/css/theme-<?php echo (!empty($userTheme) ? $userTheme : "default"); ?>.css">
121
    <link rel="stylesheet" href="/css/style.min.css" integrity="sha384-gtEHcKTcfu/sM5utp8wrt6VfrSTJmrT4QVCfpHzbhmZZ+gd9WJdcl8TpQAPfI7/A" crossorigin="anonymous">
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>
124
    <script src="/js/input-clearer.min.js" integrity="sha384-PPIpFAWvzKO0l06o6zNV8tPFHNistosIDKHylKx5kJIM9zceSlJxAScUWQpt02xy" crossorigin="anonymous"></script>
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;
66 - 165
        if (!isset($_POST["filterCondition"])) {$_POST["filterCondition"] = []; }
166
        if (!is_array($_POST["filterCondition"])) { $_POST["filterCondition"] = [ $_POST["filterCondition"] ];}
167
        $_SESSION["filterCondition"]["New"] = in_array("New", $_POST["filterCondition"]);
168
        $_SESSION["filterCondition"]["Used"] = in_array("Used", $_POST["filterCondition"]);
169
        if (!isset($_POST["filterMediaType"])) {$_POST["filterMediaType"] = []; }
170
        if (!is_array($_POST["filterMediaType"])) { $_POST["filterMediaType"] = [ $_POST["filterMediaType"] ];}
171
        $_SESSION["filterMediaType"]["CD"] = in_array("CD", $_POST["filterMediaType"]);
172
        $_SESSION["filterMediaType"]["Record"] = in_array("Record", $_POST["filterMediaType"]);
173
        $_SESSION["filterMediaType"]["Digital"] = in_array("Digital", $_POST["filterMediaType"]);
174
        $_SESSION["filterMediaType"]["Book"] = in_array("Book", $_POST["filterMediaType"]);
2 - 175
 
46 - 176
        $_SESSION["discogsTitle"] = "";
177
        $_SESSION["discogsArtist"] = "";
65 - 178
        $searchTerm = searchFriendlyString($_POST['searchTerm']);
179
        if (empty($searchTerm)) {
180
            resetSessionVars();
181
        }
182
        else {
183
            $_SESSION["searchTerm"] = $searchTerm;
27 - 184
 
185
            if (checkSearchFilters()) {
65 - 186
                performSearch();
187
            }
188
        }
189
    }
190
    else if ($_POST["submit"] == "discogsSearch") {
50 - 191
        $searchTerm = "";
192
        if (!empty($_POST['discogsBarcode'])) {
65 - 193
            $searchTerm = searchFriendlyString($_POST['discogsBarcode']);
194
        }
195
        else {
50 - 196
            if (!empty($_POST['discogsTitle'])) {
197
                $searchTerm = $_POST['discogsTitle'];
198
            }
58 - 199
 
50 - 200
            if (!empty($_POST['discogsArtist'])) {
201
                $searchTerm .= " " . $_POST['discogsArtist'];
202
            }
58 - 203
 
50 - 204
            $searchTerm = trim($searchTerm);
205
        }
206
 
65 - 207
        if (empty($searchTerm)) {
208
            resetSessionVars();
209
        }
210
        else {
211
            $_SESSION["searchTerm"] = $searchTerm;
46 - 212
            if (isset($_POST['discogsTitle'])) {
213
                $_SESSION["discogsTitle"] = searchFriendlyString($_POST['discogsTitle']);
214
            }
215
            if (isset($_POST['discogsArtist'])) {
216
                $_SESSION["discogsArtist"] = searchFriendlyString($_POST['discogsArtist']);
217
            }
14 - 218
 
219
            if (checkSearchFilters()) {
65 - 220
                performSearch();
221
            }
222
        }
223
    }
224
    else if (in_array($_POST["submit"], $buttonArr)) {
225
        $_SESSION["currentView"] = $_POST["submit"];
226
        filterResults();
227
    }
228
}
229
else if ($_SERVER["REQUEST_METHOD"] == "GET") {
230
    if (isset($_GET['z'])) {
231
        $_SESSION["buyer"]["Zip"] = "";
232
        $zip = sanitizeInput($_GET['z']);
233
        if (strlen($zip) == 5 && preg_match("/^[0-9 ]*$/", $zip)) {
234
            $_SESSION["buyer"]["Zip"] = $zip;
235
        }
236
    }
2 - 237
 
9 - 238
    $_SESSION["searchTerm"] = "";
65 - 239
    if (isset($_GET['q'])) {
240
        $_SESSION["searchTerm"] = searchFriendlyString($_GET["q"]);
5 - 241
        if (checkSearchFilters()) {
65 - 242
            performSearch();
243
        }
244
    }
2 - 245
}
246
?>
247
 
14 - 248
    <form method="post" action="/index.php">
20 - 249
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
14 - 250
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
65 - 251
       	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
62 - 252
        <nav class="navbar navbar-expand-sm bg-black navbar-dark">
35 - 253
            <div class="navbar-header">
62 - 254
                <button type="submit" name="submit" value="Search" class="btn text-white">Find Cheap Music</button>
35 - 255
            </div>
14 - 256
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
257
                <span class="navbar-toggler-icon"></span>
258
            </button>
259
            <div class="collapse navbar-collapse" id="collapsibleNavbar">
35 - 260
                <ul class="navbar-nav mr-auto">
14 - 261
                    <li class="nav-item">
47 - 262
                        <button type="submit" name="submit" value="Search" class="nav-link btn"><i class="fas fa-home"></i></button>
35 - 263
                    </li>
264
                    <?php if (isLoggedIn()) { ?>
265
                        <li class="nav-item">
266
                            <button type="submit" name="submit" value="coupons" class="nav-link btn">Coupons</button>
267
                        </li>
45 - 268
                        <li class="nav-item">
269
                            <button type="submit" name="submit" value="wishlist" class="nav-link btn">Wishlist</button>
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">
280
                        <button type="submit" name="submit" value="help" class="nav-link btn"><i class="far fa-question-circle"></i></button>
281
                    </li>
14 - 282
                </ul>
35 - 283
                <ul class="navbar-nav">
284
                    <?php if (!isLoggedIn()) { ?>
285
                    <li class="nav-item">
47 - 286
                        <a href="/login/index.php" class="nav-link btn"><i class='fas fa-sign-in-alt'></i> Login</a>
35 - 287
                    </li>
65 - 288
                    <?php
289
}
290
else { ?>
36 - 291
                        <li class="nav-item">
47 - 292
                            <img class="img-fluid hide-extra-small hide-small user-img" src="<?php echo $userPicture ?>" alt="User Image">
36 - 293
                        </li>
35 - 294
                        <li class="nav-item dropdown">
47 - 295
                          <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown"><i class="fas fa-user-cog"></i> Account</a>
35 - 296
                          <div class="dropdown-menu dropdown-menu-right">
47 - 297
                              <button formaction="/login/account.php" type="submit" name="submit" value="account" class="dropdown-item btn"><i class="fas fa-info-circle"></i> Information</button>
298
                              <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 - 299
                              <?php if (empty($_SESSION['sessData']['loginType']) || $_SESSION['sessData']['loginType'] != 'social') { ?>
47 - 300
                                  <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 - 301
                              <?php
302
    } ?>
47 - 303
                              <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 - 304
                          </div>
305
                        </li>
65 - 306
                    <?php
307
} ?>
35 - 308
                </ul>
14 - 309
            </div>
310
        </nav>
311
    </form>
2 - 312
 
3 - 313
    <div class="page-header bg-primary">
314
        <div class="container text-center py-3">
14 - 315
        <?php
65 - 316
if (getPGV('submit') == "terms") {
317
    echo file_get_contents('snippets/headerTerms.txt');
318
}
319
else if (getPGV('submit') == "privacy") {
320
    echo file_get_contents('snippets/headerPrivacy.txt');
321
}
322
else if (getPGV('submit') == "coupons") {
323
    echo file_get_contents('snippets/headerCoupons.txt');
324
}
325
else if (getPGV('submit') == "wishlist") {
326
    echo file_get_contents('snippets/headerWishlist.txt');
327
}
328
else if (getPGV('submit') == "help") {
329
    echo file_get_contents('snippets/headerHelp.txt');
330
}
331
else {
332
    echo '<p id="textslide" class="d-none d-sm-block">FindCheapMusic.com</p>';
333
}
334
?>
2 - 335
        </div>
336
    </div>
337
 
3 - 338
	<div class="container-fluid bg-primary py-3">
5 - 339
        <?php
65 - 340
if (!in_array(getPGV('submit') , array(
341
    "terms",
342
    "privacy",
343
    "coupons",
344
    "wishlist",
345
    "help"
346
))) {
347
    echo $_SESSION["filterWarnings"];
348
}
349
?>
350
        <form <?php if (in_array(getPGV('submit') , array(
351
    "terms",
352
    "privacy",
353
    "coupons",
354
    "wishlist",
355
    "help"
356
))) {
357
    echo "hidden";
358
} ?> method="post" action="/index.php" class="form-inline"
58 - 359
            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 - 360
            <input id="sessionId" type="hidden" name="sessionId" value="<?php echo session_id(); ?>">
20 - 361
            <input id="sessionTab" type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
17 - 362
        	<div class="form-group">
363
                <div class="btn-group">
47 - 364
                    <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>
365
                    <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 - 366
                    <div class="btn-group">
62 - 367
                        <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 - 368
                        <div class="dropdown-menu">
369
                            <div class="form-inline">
370
                                <label class="m-2">Shipping to:</label>
371
                                <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>
372
                                <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 - 373
                                <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 - 374
                            </div>
375
                        </div>
376
                    </div>
2 - 377
                </div>
378
        	</div>
20 - 379
        	<div class="form-group mx-1">
380
        	    <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 - 381
        	    <datalist id="searchHistory">
382
            	    <?php echo getSearchHistory(); ?>
383
            	</datalist>
384
            </div>
385
        	<div class="form-group">
386
                <button id="searchBtn" type="submit" class="btn btn-success mx-1 rounded" name="submit" value="Search">Go</button>
387
            </div>
2 - 388
        </form>
389
    </div>
390
 
5 - 391
    <?php
65 - 392
if (getPGV('submit') == "terms") {
393
    echo file_get_contents('snippets/terms.txt');
394
}
395
else if (getPGV('submit') == "privacy") {
396
    echo file_get_contents('snippets/privacy.txt');
397
}
398
else if (getPGV('submit') == "help") {
399
    echo file_get_contents('snippets/help.txt');
400
}
401
else if (getPGV('submit') == "coupons") {
402
    //get_linkshareCoupons(); // bugbug
403
    echo getCouponCodes();
404
}
405
else if (getPGV('submit') == "wishlist") {
406
    echo getWishlist();
407
}
408
else if (getPGV('submit') == "random") {
409
    findDiscogsMaster("***RANDOM***");
410
    echo $_SESSION["discogs"];
411
}
412
else {
413
    if ($_SESSION["lowestPrice"]["All"] > 0.00 || !empty($_SESSION["searchTerm"])) {
38 - 414
        echo $_SESSION["discogs"];
66 - 415
        echo "<div id=\"productTable\" class=\"container bg-info pt-2\">";
65 - 416
        echo printResultHeader();
417
        echo printResult();
418
        echo "</div>";
419
    }
420
    else if (!empty($_SESSION["discogs"])) {
421
        echo $_SESSION["discogs"];
422
    }
423
    else {
424
?>
38 - 425
    <div class="container-fluid text-center">
426
    <form method="post" action="/index.php">
427
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
428
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
65 - 429
       	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
43 - 430
        <button id="randomBtn" type="submit" class="btn btn-success mt-5 rounded" name="submit" value="random">Random Album Suggestions</button>
38 - 431
    </form>
432
    </div>
65 - 433
        <?php
14 - 434
    }
65 - 435
    echo printSearchFilterModal();
436
    echo printSearchInfoModal();
437
}
438
?>
2 - 439
 
14 - 440
    <div class="modal" id="progressBarDiv">
17 - 441
        <div class="modal-dialog modal-dialog-centered">
14 - 442
            <div class="modal-content">
443
                <div class="modal-header">
15 - 444
                    <h4 id="progressBarHeader">Searching</h4>
14 - 445
                </div>
446
                <div class="modal-body">
447
                    <div class="progress">
448
                        <div id="progressBar" class="progress-bar" style="width:0%">0%</div>
449
                    </div>
450
                </div>
15 - 451
                <div class="modal-footer">
452
                    <span id="progressBarMessage"></span>
453
                </div>
14 - 454
            </div>
455
        </div>
456
    </div>
457
 
64 - 458
    <footer class="container-fluid text-center bg-primary py-5">
20 - 459
        <?php if (!empty($_SESSION["searchTerm"])) {
65 - 460
    echo "<p>Disclaimer: As an Associate we earn from qualifying purchases.</p>";
461
}
462
?>
20 - 463
        <form method="post" action="/index.php">
464
            <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
465
       	    <input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
65 - 466
           	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"]; ?>">
20 - 467
            <ul class="list-inline text-center">
468
                <li class="list-inline-item">
62 - 469
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="terms">Terms of Service</button>
20 - 470
                </li>
471
                <li class="list-inline-item">
62 - 472
                    <button class="btn btn-sm btn-light" type="submit" name="submit" value="privacy">Privacy Policy</button>
20 - 473
                </li>
474
            </ul>
475
        </form>
17 - 476
        <p>Copyright &#169; <?php echo @date("Y"); ?> FindCheapMusic.com. All rights reserved.</p>
2 - 477
    </footer>
478
 
66 - 479
    <script src="js/dr.min.js" integrity="sha384-u7ftuSKEbHEaBPv2RDCPMshK7RJcPLqIG7g+M6Z1pid7ABVC1zarLMQwBzqU4SNX" crossorigin="anonymous"></script>
36 - 480
    <script>var quotes = [
38 - 481
    <?php
65 - 482
if ($file = fopen("snippets/header.txt", "r")) {
483
    while (($line = fgets($file)) !== false) {
484
        echo "\"" . trim($line) . "\",";
485
    }
486
    fclose($file);
487
}
488
?>
36 - 489
    ]; var i = 0; setInterval(function() { $("#textslide").html(quotes[i]); if (i == quotes.length) i=0; else i++; }, 5 * 1000);</script>
2 - 490
</body>
491
</html>
21 - 492
<?php MySessionHandler::commit(session_id()); ?>