2 |
- |
1 |
<?php
|
|
|
2 |
if ($_SERVER["SERVER_NAME"] == "www.findcheapmusic.com") {
|
|
|
3 |
header("Strict-Transport-Security: max-age=31536000; includeSubDomains; preload");
|
|
|
4 |
header("X-Content-Type-Options: nosniff");
|
|
|
5 |
header("X-XSS-Protection: 1; mode=block");
|
|
|
6 |
header("Access-Control-Allow-Origin: *");
|
|
|
7 |
header("Referrer-Policy: no-referrer");
|
|
|
8 |
header("X-Frame-Options: SAMEORIGIN");
|
|
|
9 |
header("Set-Cookie: ^(.*)$ $1;HttpOnly;Secure");
|
|
|
10 |
header("Content-Security-Policy: default-src 'none'; form-action 'self'; img-src 'self' data: https://thumbs1.ebaystatic.com https://thumbs2.ebaystatic.com https://thumbs3.ebaystatic.com https://thumbs4.ebaystatic.com; script-src 'self' 'unsafe-inline' https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js; style-src 'self' 'unsafe-inline' https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/;frame-ancestors 'self'");
|
|
|
11 |
}
|
|
|
12 |
|
|
|
13 |
ini_set("session.cookie_httponly", 1);
|
|
|
14 |
ini_set("session.cookie_secure", 1);
|
|
|
15 |
session_start();
|
|
|
16 |
?>
|
|
|
17 |
<!DOCTYPE html>
|
|
|
18 |
<html lang="en-US">
|
|
|
19 |
<head>
|
|
|
20 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
21 |
<title>Find Cheap Music...</title>
|
|
|
22 |
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
23 |
<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">
|
|
|
24 |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js" integrity="sha384-JUMjoW8OzDJw4oFpWIB2Bu/c6768ObEthBMVSiIx4ruBIEdyNSUQAjJNFqT5pnJ6" crossorigin="anonymous"></script>
|
|
|
25 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
|
|
26 |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
|
|
27 |
<link rel="stylesheet" href="css/style.css" integrity="sha384-khCExHaxRuG3tuk6qjjM4ZLqC5yP1Tn/TbpDK8SVBBjb1DEwrMX9VVH5a3SEeC3W" crossorigin="anonymous">
|
|
|
28 |
<!-- Global site tag (gtag.js) - Google Analytics -->
|
|
|
29 |
<!--script async src="https://www.googletagmanager.com/gtag/js?id=UA-138428761-2"></script-->
|
|
|
30 |
<!--script src="/js/gtag.js" integrity="sha384-ZoAmOe9K3AXr6ONEK6njtE/HMsMvyjck9EfsgXdZLG7rEiz5GqXEk3RQc2cFIRNY" crossorigin="anonymous"></script-->
|
|
|
31 |
</head>
|
|
|
32 |
<body>
|
|
|
33 |
|
|
|
34 |
<?php
|
|
|
35 |
include_once('php/clsLibGTIN.php');
|
|
|
36 |
include_once('php/tools.php');
|
|
|
37 |
|
|
|
38 |
$searchKeywords = file_get_contents('snippets/searchKeywordTooltip.html');
|
|
|
39 |
$filterWarnings = '';
|
|
|
40 |
|
|
|
41 |
initSV("buyerCountry", "United States");
|
|
|
42 |
initSV("buyerCurrency", "USD");
|
|
|
43 |
initSV("filterConditionNew", true);
|
|
|
44 |
initSV("filterConditionUsed", true);
|
|
|
45 |
initSV("filterMediaTypeCD", true);
|
|
|
46 |
initSV("filterMediaTypeRecord", false);
|
|
|
47 |
initSV("filterMediaTypeDigital", false);
|
|
|
48 |
|
|
|
49 |
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
|
50 |
////echo "<pre>"; print_r($_POST); print_r($_SESSION); echo "</pre>";
|
|
|
51 |
if ($_POST["submit"] == "Search") {
|
|
|
52 |
$zip = test_input($_POST['buyerZip']);
|
|
|
53 |
if (strlen($zip) == 5 && preg_match("/^[0-9 ]*$/",$zip)) {
|
|
|
54 |
$_SESSION["buyerZip"] = $zip;
|
|
|
55 |
} else if (strlen($zip) == 0) {
|
|
|
56 |
unset($_SESSION["buyerZip"]);
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
if (empty($_POST["upc"])) {
|
|
|
60 |
// ???
|
|
|
61 |
} else {
|
|
|
62 |
$_SESSION["searchTerm"] = test_input($_POST["upc"]);
|
|
|
63 |
|
|
|
64 |
$barcodeType = clsLibGTIN::GTINCheck($_SESSION["searchTerm"], false, 1);
|
|
|
65 |
$barcodeValue = clsLibGTIN::GTINCheck($_SESSION["searchTerm"]);
|
|
|
66 |
|
|
|
67 |
$arr = [];
|
|
|
68 |
$arr = searchAll($_SESSION["searchTerm"]);
|
|
|
69 |
|
|
|
70 |
// $arr2 = filterTable($arr);
|
|
|
71 |
$_SESSION["lowUsed"] = findLowest($arr, "Used");
|
|
|
72 |
$_SESSION["lowNew"] = findLowest($arr, "New");
|
|
|
73 |
$_SESSION["lowDigital"] = findLowest($arr, "Digital");
|
|
|
74 |
$_SESSION["itemTable"] = buildTable($arr);
|
|
|
75 |
}
|
|
|
76 |
} else if ($_POST["submit"] == "Save") {
|
|
|
77 |
$_SESSION["filterConditionNew"] = checkPV("filterConditionNew");
|
|
|
78 |
$_SESSION["filterConditionUsed"] = checkPV("filterConditionUsed");
|
|
|
79 |
$_SESSION["filterMediaTypeCD"] = checkPV("filterMediaTypeCD");
|
|
|
80 |
$_SESSION["filterMediaTypeRecord"] = checkPV("filterMediaTypeRecord");
|
|
|
81 |
$_SESSION["filterMediaTypeDigital"] = checkPV("filterMediaTypeDigital");
|
|
|
82 |
|
|
|
83 |
$filterError = false;
|
|
|
84 |
if (!$_SESSION["filterConditionNew"] && !$_SESSION["filterConditionUsed"]) {
|
|
|
85 |
$filterWarnings .= '<div class="alert alert-danger">Please select at least one Condition (New or Used)</div>';
|
|
|
86 |
$filterError = true;
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
if (!$_SESSION["filterMediaTypeCD"] && !$_SESSION["filterMediaTypeRecord"] && !$_SESSION["filterMediaTypeDigital"]) {
|
|
|
90 |
$filterWarnings .= '<div class="alert alert-danger">Please select at least one Media Type (CD, Record or Digital)</div>';
|
|
|
91 |
$filterError = true;
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
if (!$filterError) {
|
|
|
95 |
// BUGBUG avoid re-search
|
|
|
96 |
$arr = [];
|
|
|
97 |
$arr = searchAll($_SESSION["searchTerm"]);
|
|
|
98 |
$_SESSION["lowUsed"] = findLowest($arr, "Used");
|
|
|
99 |
$_SESSION["lowNew"] = findLowest($arr, "New");
|
|
|
100 |
$_SESSION["lowDigital"] = findLowest($arr, "Digital");
|
|
|
101 |
$_SESSION["itemTable"] = buildTable($arr);
|
|
|
102 |
|
|
|
103 |
// $arr2 = filterTable($arr);
|
|
|
104 |
// $_SESSION["lowUsed"] = findLowest($arr2, "Used");
|
|
|
105 |
// $_SESSION["lowNew"] = findLowest($arr2, "New");
|
|
|
106 |
// $_SESSION["lowDigital"] = findLowest($arr2, "Digital");
|
|
|
107 |
// $_SESSION["itemTable"] = buildTable($arr2);
|
|
|
108 |
}
|
|
|
109 |
}
|
|
|
110 |
}
|
|
|
111 |
?>
|
|
|
112 |
|
|
|
113 |
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
|
|
|
114 |
<a class="navbar-brand" href="#">Home</a>
|
|
|
115 |
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
|
|
|
116 |
<span class="navbar-toggler-icon"></span>
|
|
|
117 |
</button>
|
|
|
118 |
<div class="collapse navbar-collapse" id="collapsibleNavbar">
|
|
|
119 |
<ul class="navbar-nav">
|
|
|
120 |
<li class="nav-item">
|
|
|
121 |
<a class="nav-link" href="terms.html">Terms of Service</a>
|
|
|
122 |
</li>
|
|
|
123 |
<li class="nav-item">
|
|
|
124 |
<a class="nav-link" href="privacy.html">Privacy Policy</a>
|
|
|
125 |
</li>
|
|
|
126 |
</ul>
|
|
|
127 |
</div>
|
|
|
128 |
</nav>
|
|
|
129 |
|
|
|
130 |
<div class="page-header bg-secondary">
|
|
|
131 |
<div class="container text-center">
|
|
|
132 |
<h1>Find Cheap Music...</h1>
|
|
|
133 |
<p class="hide-small">Find the cheapest music online. Advertisement free website.</p>
|
|
|
134 |
</div>
|
|
|
135 |
</div>
|
|
|
136 |
|
|
|
137 |
<div class="container-fluid">
|
|
|
138 |
<?php echo $filterWarnings; ?>
|
|
|
139 |
<form method="post" action="/index.php"
|
|
|
140 |
onsubmit="document.getElementById('search').innerHTML = '<span class=\'spinner-border spinner-border-sm\'></span> Searching, please wait...';">
|
|
|
141 |
<div class="input-group mb-3">
|
|
|
142 |
<div class="input-group-prepend">
|
|
|
143 |
<img class="input-group-text img-fluid" style="max-height:38px" title="<?php echo $searchKeywords; ?>" data-toggle="tooltip" data-html="true" data-placement="auto" data-delay="100" src="/images/info.png">
|
|
|
144 |
<a class="input-group-text" data-toggle="modal" href="#filterModal" data-keyboard="false"><img class="img-fluid" style="max-height:25px" src="/images/filter.png" alt="Search Filter"></a>
|
|
|
145 |
</div>
|
|
|
146 |
<input name="upc" type="text" class="form-control" placeholder="Search by Barcode, Label, Artist, Title, ..." value="<?php echo getSV("searchTerm") ?>">
|
|
|
147 |
<div class="input-group-append">
|
|
|
148 |
<button id="search" type="submit" class="btn btn-success" name="submit" value="Search">Go</button>
|
|
|
149 |
</div>
|
|
|
150 |
</div>
|
|
|
151 |
<div class="input-group input-group-sm mb-3">
|
|
|
152 |
<div class="input-group-prepend input-group-sm">
|
|
|
153 |
<input type="text" class="form-control border-0" maxlength="12" size="12" placeholder="Shipping to:">
|
|
|
154 |
<input type="text" class="form-control" maxlength="20" size="20" id="buyerCountry" name="buyerCountry" value="United States" readonly>
|
|
|
155 |
<input type="text" class="form-control" maxlength="3" size="3" id="buyerCurrency" name="buyerCurrency" value="USD" readonly>
|
|
|
156 |
<input type="text" class="form-control" maxlength="5" size="5" id="buyerZip" name="buyerZip" placeholder="Zip Code" value="<?php echo getSV('buyerZip'); ?>">
|
|
|
157 |
</div>
|
|
|
158 |
<?php
|
|
|
159 |
if (getSV('buyerZip') == '') {
|
|
|
160 |
echo '<div class="input-group-append input-group-sm">';
|
|
|
161 |
echo ' <img class="input-group-text img-fluid" style="max-height:31px" title="Please enter your postal code to get the accurate shipping cost for items listed using a rate table" data-toggle="tooltip" data-placement="auto" data-delay="100" src="/images/warning.png">';
|
|
|
162 |
echo '</div>'; }
|
|
|
163 |
?>
|
|
|
164 |
</div>
|
|
|
165 |
<div class="input-group mb-3">
|
|
|
166 |
</div>
|
|
|
167 |
</form>
|
|
|
168 |
</div>
|
|
|
169 |
|
|
|
170 |
<hr>
|
|
|
171 |
|
|
|
172 |
<?php
|
|
|
173 |
|
|
|
174 |
echo printTableHeader();
|
|
|
175 |
echo getSV("itemTable");
|
|
|
176 |
echo printSearchFilterModal();
|
|
|
177 |
?>
|
|
|
178 |
|
|
|
179 |
<footer class="container-fluid text-center">
|
|
|
180 |
<p>Disclaimer: As an Associate we earn from qualifying purchases.</p>
|
|
|
181 |
<p>Copyright © 2019 FindCheapMusic.com. All rights reserved.</p>
|
|
|
182 |
</footer>
|
|
|
183 |
|
|
|
184 |
<script src="/js/tooltip.js" integrity="sha384-RySBj8L2blcDPtmumEPwxSRsRne8Rb6+H1mTTeCZ6/Zo3VJR1FRHn3XG1NgYqYx+" crossorigin="anonymous"></script>
|
|
|
185 |
<script src="/js/disableSubmit.js" integrity="sha384-bWbxxiPngRC4S0dntyF76TZxF3MQ9rc7ebUKhHzn7UnyTpED8UmWRMpDPwceXtWV" crossorigin="anonymous"></script>
|
|
|
186 |
</body>
|
|
|
187 |
</html>
|