Subversion Repositories cheapmusic

Rev

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

Rev Author Line No. Line
2 - 1
<?php
25 - 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");
35 - 6
include_once($_SERVER['DOCUMENT_ROOT'] . "/php/tools.php");
45 - 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
57 - 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'])) {
46
        $_SESSION['sessData']['userLoggedIn'] = TRUE;
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';
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
	    }
35 - 62
    } else {
63
        unsetSessData();
64
    }
65
// or if the user has already logged in
66
} else if (isLoggedIn()) {
67
    require_once 'login/includes/config.php';
68
    require_once 'login/includes/User.class.php';
69
    require_once 'login/includes/password.php';
70
    $user = new User();
71
    $conditions['where'] = array(
72
        'id' => $_SESSION['sessData']['userID']
73
    );
74
    $conditions['return_type'] = 'single';
75
    $userData = $user->getRows($conditions);
57 - 76
 
35 - 77
    if (!empty($userData)) {
36 - 78
        $userPicture = getUserImage($userData);
57 - 79
        $userTheme = $userData['theme'];
59 - 80
        $_SESSION["currentLayout"] = ($userData['cardView'] == '1' ? 'CardView' : 'TableView');
57 - 81
        if (empty($_SESSION["manualFilter"])) {
35 - 82
            $_SESSION['buyer']['Zip'] = $userData['zip'];
83
            $_SESSION['buyer']['Country'] = 'United States';
84
            $_SESSION['buyer']['Currency'] = 'USD';
57 - 85
    		$_SESSION["filterCondition"]["New"] = $userData['conditionNew'];
86
	    	$_SESSION["filterCondition"]["Used"] = $userData['conditionUsed'];
87
    		$_SESSION["filterMediaType"]["CD"] = $userData['mediaCD'];
88
	    	$_SESSION["filterMediaType"]["Record"] = $userData['mediaRecord'];
89
		    $_SESSION["filterMediaType"]["Digital"] = $userData['mediaDigital'];
90
    		$_SESSION["filterMediaType"]["Book"] = $userData['mediaBook'];
35 - 91
        }
92
    } else {
93
        unsetSessData();
94
    }
95
// not logged in
96
} else {
97
    unsetSessData();
98
}
57 - 99
 
100
 
2 - 101
?>
102
<!DOCTYPE html>
103
<html lang="en-US">
104
<head>
105
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
57 - 106
    <title>Find Cheap Music... CDs, Records, Digital, Books and Sheets</title>
2 - 107
    <meta name="viewport" content="width=device-width, initial-scale=1">
57 - 108
    <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.">
109
    <meta name="keywords" content="Cheap,Music,Album,Single,Promo,CD,Compact Disc,Vinyl,Record,Digital,Download,Sheet,Book">
2 - 110
    <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">
111
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js" integrity="sha384-JUMjoW8OzDJw4oFpWIB2Bu/c6768ObEthBMVSiIx4ruBIEdyNSUQAjJNFqT5pnJ6" crossorigin="anonymous"></script>
112
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
113
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
3 - 114
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
57 - 115
    <link rel="stylesheet" href="css/theme-<?php echo (!empty($userTheme) ? $userTheme : "default"); ?>.css">
61 - 116
    <link rel="stylesheet" href="css/style.min.css" integrity="sha384-myJ4hUM9qYUQPd4thWYPEj3t2HTxy6XkJXvuGKseoOlk8ojtKTE+f2Isj/7kuMgA" crossorigin="anonymous">
17 - 117
    <link rel="stylesheet" href="css/jquery.flexdatalist.min.css" integrity="sha384-IUkltzhO8hiEuEm0UJQvWrrtE1xqVHA0NbUeIY7a+zCokg7LqiDf5HSt69ru8a7R" crossorigin="anonymous">
118
    <script src="js/jquery.flexdatalist.min.js" integrity="sha384-JKZ5fd3wxuyCR/AhbpbYALE2xwlYMGYu0XpsXixX7YOni1G0is+vwTuSMuGGYhnl" crossorigin="anonymous"></script>
20 - 119
    <script src="js/input-clearer.min.js" integrity="sha384-PPIpFAWvzKO0l06o6zNV8tPFHNistosIDKHylKx5kJIM9zceSlJxAScUWQpt02xy" crossorigin="anonymous"></script>
43 - 120
    <script src="js/paginate.min.js" integrity="sha384-sN78hrw/H8RzeS4ete92bJj3Y0lEBeiryHisgrRm/pvsPyGLf0M14Vnm+cRxVchm" crossorigin="anonymous"></script>
57 - 121
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
122
    <link rel="icon" href="/favicon.ico" type="image/x-icon">
2 - 123
</head>
124
<body>
125
 
126
<?php
5 - 127
initSessionVariables();
2 - 128
 
129
if ($_SERVER["REQUEST_METHOD"] == "POST") {
5 - 130
	if ($_POST["submit"] == "Search") {
35 - 131
        if (empty($_SESSION['buyer']['Zip'])) {
132
    		$zip = (empty($_POST['buyerZip']) ? "" : sanitizeInput($_POST['buyerZip']));
133
        	if (strlen($zip) == 5 && preg_match("/^[0-9 ]*$/", $zip)) {
57 - 134
                if ($_SESSION["buyer"]["Zip"] != $zip) {
135
            	    $_SESSION["manualFilter"] = true;
136
	            	$_SESSION["buyer"]["Zip"] = $zip;
137
    	        }
35 - 138
   		    } else if (strlen($zip) == 0) {
139
        		$_SESSION["buyer"]["Zip"] = "";
140
	        }
141
	    }
2 - 142
 
46 - 143
        $_SESSION["discogsTitle"] = "";
144
        $_SESSION["discogsArtist"] = "";
35 - 145
		$searchTerm = (empty($_POST['searchTerm']) ? "" : searchFriendlyString($_POST['searchTerm']));
9 - 146
		if (empty($searchTerm)) {
147
			resetSessionVars();
5 - 148
		} else {
9 - 149
			$_SESSION["searchTerm"] = $searchTerm;
2 - 150
 
5 - 151
            if (checkSearchFilters()) {
152
    			performSearch();
153
    		}
154
		}
155
	} else if ($_POST["submit"] == "Save") {
57 - 156
	    $_SESSION["manualFilter"] = true;
5 - 157
		$_SESSION["filterCondition"]["New"] = checkPV("filterConditionNew");
158
		$_SESSION["filterCondition"]["Used"] = checkPV("filterConditionUsed");
159
		$_SESSION["filterMediaType"]["CD"] = checkPV("filterMediaTypeCD");
160
		$_SESSION["filterMediaType"]["Record"] = checkPV("filterMediaTypeRecord");
161
		$_SESSION["filterMediaType"]["Digital"] = checkPV("filterMediaTypeDigital");
20 - 162
		$_SESSION["filterMediaType"]["Book"] = checkPV("filterMediaTypeBook");
2 - 163
 
46 - 164
        $_SESSION["discogsTitle"] = "";
165
        $_SESSION["discogsArtist"] = "";
27 - 166
		$searchTerm = searchFriendlyString($_POST['searchTerm']);
167
		if (empty($searchTerm)) {
168
			resetSessionVars();
169
		} else {
170
			$_SESSION["searchTerm"] = $searchTerm;
171
 
172
            if (checkSearchFilters()) {
173
    			performSearch();
174
    		}
5 - 175
		}
14 - 176
	} else if ($_POST["submit"] == "discogsSearch") {
50 - 177
        $searchTerm = "";
178
        if (!empty($_POST['discogsBarcode'])) {
179
    		$searchTerm = searchFriendlyString($_POST['discogsBarcode']);
180
        } else {
181
            if (!empty($_POST['discogsTitle'])) {
182
                $searchTerm = $_POST['discogsTitle'];
183
            }
58 - 184
 
50 - 185
            if (!empty($_POST['discogsArtist'])) {
186
                $searchTerm .= " " . $_POST['discogsArtist'];
187
            }
58 - 188
 
50 - 189
            $searchTerm = trim($searchTerm);
190
        }
191
 
14 - 192
		if (empty($searchTerm)) {
193
			resetSessionVars();
194
		} else {
195
			$_SESSION["searchTerm"] = $searchTerm;
46 - 196
            if (isset($_POST['discogsTitle'])) {
197
                $_SESSION["discogsTitle"] = searchFriendlyString($_POST['discogsTitle']);
198
            }
199
            if (isset($_POST['discogsArtist'])) {
200
                $_SESSION["discogsArtist"] = searchFriendlyString($_POST['discogsArtist']);
201
            }
14 - 202
 
203
            if (checkSearchFilters()) {
204
    			performSearch();
205
    		}
206
		}
5 - 207
	} else if (in_array($_POST["submit"], $buttonArr)) {
208
		$_SESSION["currentView"] = $_POST["submit"];
209
		filterResults();
210
	}
211
} else if ($_SERVER["REQUEST_METHOD"] == "GET") {
212
	if (isset($_GET['z'])) {
9 - 213
    	$_SESSION["buyer"]["Zip"] = "";
5 - 214
		$zip = sanitizeInput($_GET['z']);
215
		if (strlen($zip) == 5 && preg_match("/^[0-9 ]*$/", $zip)) {
216
			$_SESSION["buyer"]["Zip"] = $zip;
217
		}
218
	}
2 - 219
 
9 - 220
    $_SESSION["searchTerm"] = "";
5 - 221
	if (isset($_GET['q'])) {
14 - 222
		$_SESSION["searchTerm"] = searchFriendlyString($_GET["q"]);
5 - 223
        if (checkSearchFilters()) {
224
    		performSearch();
225
    	}
226
	}
2 - 227
}
228
?>
229
 
14 - 230
    <form method="post" action="/index.php">
20 - 231
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
14 - 232
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
233
       	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"];?>">
57 - 234
        <nav class="navbar navbar-expand-sm bg-dark text-light navbar-dark">
35 - 235
            <div class="navbar-header">
57 - 236
                <span class="navbar-brand"><button type="submit" name="submit" value="Search" class="nav-item btn text-light">Find Cheap Music</button></span>
35 - 237
            </div>
14 - 238
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
239
                <span class="navbar-toggler-icon"></span>
240
            </button>
241
            <div class="collapse navbar-collapse" id="collapsibleNavbar">
35 - 242
                <ul class="navbar-nav mr-auto">
14 - 243
                    <li class="nav-item">
47 - 244
                        <button type="submit" name="submit" value="Search" class="nav-link btn"><i class="fas fa-home"></i></button>
35 - 245
                    </li>
246
                    <?php if (isLoggedIn()) { ?>
247
                        <li class="nav-item">
248
                            <button type="submit" name="submit" value="coupons" class="nav-link btn">Coupons</button>
249
                        </li>
45 - 250
                        <li class="nav-item">
251
                            <button type="submit" name="submit" value="wishlist" class="nav-link btn">Wishlist</button>
252
                        </li>
35 - 253
                    <?php } ?>
254
                    <li class="nav-item">
15 - 255
                        <button type="submit" name="submit" value="terms" class="nav-link btn">Terms of Service</button>
14 - 256
                    </li>
257
                    <li class="nav-item">
15 - 258
                        <button type="submit" name="submit" value="privacy" class="nav-link btn">Privacy Policy</button>
14 - 259
                    </li>
57 - 260
                    <li class="nav-item">
261
                        <button type="submit" name="submit" value="help" class="nav-link btn"><i class="far fa-question-circle"></i></button>
262
                    </li>
14 - 263
                </ul>
35 - 264
                <ul class="navbar-nav">
265
                    <?php if (!isLoggedIn()) { ?>
266
                    <li class="nav-item">
47 - 267
                        <a href="/login/index.php" class="nav-link btn"><i class='fas fa-sign-in-alt'></i> Login</a>
35 - 268
                    </li>
269
                    <?php } else { ?>
36 - 270
                        <li class="nav-item">
47 - 271
                            <img class="img-fluid hide-extra-small hide-small user-img" src="<?php echo $userPicture ?>" alt="User Image">
36 - 272
                        </li>
35 - 273
                        <li class="nav-item dropdown">
47 - 274
                          <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown"><i class="fas fa-user-cog"></i> Account</a>
35 - 275
                          <div class="dropdown-menu dropdown-menu-right">
47 - 276
                              <button formaction="/login/account.php" type="submit" name="submit" value="account" class="dropdown-item btn"><i class="fas fa-info-circle"></i> Information</button>
277
                              <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 - 278
                              <?php if (empty($_SESSION['sessData']['loginType']) || $_SESSION['sessData']['loginType'] != 'social') { ?>
47 - 279
                                  <button formaction="/login/changePassword.php" type="submit" name="submit" value="changePassword" class="dropdown-item btn"><i class="fas fa-key"></i> Change Password</button>
36 - 280
                              <?php } ?>
47 - 281
                              <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 - 282
                          </div>
283
                        </li>
284
                    <?php } ?>
285
                </ul>
14 - 286
            </div>
287
        </nav>
288
    </form>
2 - 289
 
3 - 290
    <div class="page-header bg-primary">
291
        <div class="container text-center py-3">
14 - 292
        <?php
20 - 293
            if (getPGV('submit') == "terms") {
14 - 294
                echo file_get_contents('snippets/headerTerms.txt');
20 - 295
            } else if (getPGV('submit') == "privacy") {
14 - 296
                echo file_get_contents('snippets/headerPrivacy.txt');
46 - 297
            } else if (getPGV('submit') == "coupons") {
298
                echo file_get_contents('snippets/headerCoupons.txt');
299
            } else if (getPGV('submit') == "wishlist") {
300
                echo file_get_contents('snippets/headerWishlist.txt');
57 - 301
            } else if (getPGV('submit') == "help") {
302
                echo file_get_contents('snippets/headerHelp.txt');
14 - 303
            } else {
36 - 304
                echo '<p id="textslide" class="d-none d-sm-block">FindCheapMusic.com</p>';
14 - 305
            }
306
        ?>
2 - 307
        </div>
308
    </div>
309
 
3 - 310
	<div class="container-fluid bg-primary py-3">
5 - 311
        <?php
57 - 312
        if (!in_array(getPGV('submit'), array("terms", "privacy", "coupons", "wishlist", "help"))) {
5 - 313
            echo $_SESSION["filterWarnings"];
14 - 314
        }
5 - 315
        ?>
57 - 316
        <form <?php if (in_array(getPGV('submit'), array("terms", "privacy", "coupons", "wishlist", "help"))) {echo "hidden";} ?> method="post" action="/index.php" class="form-inline"
58 - 317
            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 - 318
            <input id="sessionId" type="hidden" name="sessionId" value="<?php echo session_id(); ?>">
20 - 319
            <input id="sessionTab" type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
17 - 320
        	<div class="form-group">
321
                <div class="btn-group">
47 - 322
                    <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>
323
                    <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 - 324
                    <div class="btn-group">
47 - 325
                        <button class="btn dropdown-toggle <?php echo ($_SESSION["buyer"]["Zip"] == '' ? "bg-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 - 326
                        <div class="dropdown-menu">
327
                            <div class="form-inline">
328
                                <label class="m-2">Shipping to:</label>
329
                                <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>
330
                                <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>
331
                                <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"];?>">
332
                            </div>
333
                        </div>
334
                    </div>
2 - 335
                </div>
336
        	</div>
20 - 337
        	<div class="form-group mx-1">
338
        	    <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 - 339
        	    <datalist id="searchHistory">
340
            	    <?php echo getSearchHistory(); ?>
341
            	</datalist>
342
            </div>
343
        	<div class="form-group">
344
                <button id="searchBtn" type="submit" class="btn btn-success mx-1 rounded" name="submit" value="Search">Go</button>
345
            </div>
2 - 346
        </form>
347
    </div>
348
 
5 - 349
    <?php
20 - 350
    if (getPGV('submit') == "terms") {
14 - 351
        echo file_get_contents('snippets/terms.txt');
20 - 352
    } else if (getPGV('submit') == "privacy") {
14 - 353
        echo file_get_contents('snippets/privacy.txt');
57 - 354
    } else if (getPGV('submit') == "help") {
355
        echo file_get_contents('snippets/help.txt');
35 - 356
    } else if (getPGV('submit') == "coupons") {
41 - 357
        //get_linkshareCoupons(); // bugbug
358
        echo getCouponCodes();
46 - 359
    } else if (getPGV('submit') == "wishlist") {
360
        echo getWishlist();
38 - 361
    } else if (getPGV('submit') == "random") {
362
        findDiscogsMaster("***RANDOM***");
363
        echo $_SESSION["discogs"];
14 - 364
    } else {
9 - 365
        if ($_SESSION["lowestPrice"]["All"] > 0.00 || !empty($_SESSION["searchTerm"])) {
12 - 366
            echo $_SESSION["discogs"];
58 - 367
	        echo "<div id=\"productTable\" class=\"container\">";
59 - 368
            echo printResultHeader();
369
	    	echo printResult();
11 - 370
            echo "</div>";
46 - 371
        } else if (!empty($_SESSION["discogs"])) {
372
            echo $_SESSION["discogs"];
373
        } else {
374
             ?>
38 - 375
    <div class="container-fluid text-center">
376
    <form method="post" action="/index.php">
377
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
378
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
379
       	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"];?>">
43 - 380
        <button id="randomBtn" type="submit" class="btn btn-success mt-5 rounded" name="submit" value="random">Random Album Suggestions</button>
38 - 381
    </form>
382
    </div>
383
        <?php }
5 - 384
        echo printSearchFilterModal();
385
        echo printSearchInfoModal();
14 - 386
    }
5 - 387
    ?>
2 - 388
 
14 - 389
    <div class="modal" id="progressBarDiv">
17 - 390
        <div class="modal-dialog modal-dialog-centered">
14 - 391
            <div class="modal-content">
392
                <div class="modal-header">
15 - 393
                    <h4 id="progressBarHeader">Searching</h4>
14 - 394
                </div>
395
                <div class="modal-body">
396
                    <div class="progress">
397
                        <div id="progressBar" class="progress-bar" style="width:0%">0%</div>
398
                    </div>
399
                </div>
15 - 400
                <div class="modal-footer">
401
                    <span id="progressBarMessage"></span>
402
                </div>
14 - 403
            </div>
404
        </div>
405
    </div>
406
 
43 - 407
    <footer class="container-fluid text-center bg-primary py-5 mt-5">
20 - 408
        <?php if (!empty($_SESSION["searchTerm"])) {
409
            echo "<p>Disclaimer: As an Associate we earn from qualifying purchases.</p>";
410
        }
411
        ?>
412
        <form method="post" action="/index.php">
413
            <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>">
414
       	    <input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>">
415
           	<input type="hidden" name="buyerZip" value="<?php echo $_SESSION["buyer"]["Zip"];?>">
416
            <ul class="list-inline text-center">
417
                <li class="list-inline-item">
57 - 418
                    <button class="btn btn-sm bg-light text-dark" type="submit" name="submit" value="terms">Terms of Service</button>
20 - 419
                </li>
420
                <li class="list-inline-item">
57 - 421
                    <button class="btn btn-sm bg-light text-dark" type="submit" name="submit" value="privacy">Privacy Policy</button>
20 - 422
                </li>
423
            </ul>
424
        </form>
17 - 425
        <p>Copyright &#169; <?php echo @date("Y"); ?> FindCheapMusic.com. All rights reserved.</p>
2 - 426
    </footer>
427
 
61 - 428
    <script src="js/dr.min.js" integrity="sha384-1Jc5GQ0I0nyL+L6xYErrSs1Mewm51HEgmUBysBD0fP5gzcfur1HHH0wUECWp/NU/" crossorigin="anonymous"></script>
36 - 429
    <script>var quotes = [
38 - 430
    <?php
36 - 431
        if ($file = fopen("snippets/header.txt", "r")) {
432
            while (($line = fgets($file)) !== false) {
433
                echo "\"" . trim($line) . "\",";
434
            }
435
            fclose($file);
436
        }
437
     ?>
438
    ]; var i = 0; setInterval(function() { $("#textslide").html(quotes[i]); if (i == quotes.length) i=0; else i++; }, 5 * 1000);</script>
2 - 439
</body>
440
</html>
21 - 441
<?php MySessionHandler::commit(session_id()); ?>