Subversion Repositories cheapmusic

Rev

Rev 114 | Rev 119 | 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
114 - 63
 
65 - 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
114 - 96
 
65 - 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 - 107
    <title>Find Cheap Music | CDs, Records, Digital, Books and Sheets</title>
114 - 108
    <meta name="keywords" content="Cheap,Music,Album,Single,Promo,CD,Compact Disc,Vinyl,Record,Digital,Download,Sheet,Book">
109
    <?php echo metaDescription(getPGV('submit')); ?>
70 - 110
    <?php include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/header.php"); ?>
114 - 111
 
107 - 112
    <?php echo file_get_contents('snippets/fb_tw.txt'); ?>
2 - 113
</head>
114
<body>
115
 
116
<?php
5 - 117
initSessionVariables();
2 - 118
 
119
if ($_SERVER["REQUEST_METHOD"] == "POST") {
65 - 120
    if ($_POST["submit"] == "Search") {
35 - 121
        if (empty($_SESSION['buyer']['Zip'])) {
65 - 122
            $zip = (empty($_POST['buyerZip']) ? "" : sanitizeInput($_POST['buyerZip']));
123
            if (strlen($zip) == 5 && preg_match("/^[0-9 ]*$/", $zip)) {
57 - 124
                if ($_SESSION["buyer"]["Zip"] != $zip) {
65 - 125
                    $_SESSION["manualFilter"] = true;
126
                    $_SESSION["buyer"]["Zip"] = $zip;
127
                }
128
            }
129
            else if (strlen($zip) == 0) {
130
                $_SESSION["buyer"]["Zip"] = "";
131
            }
132
        }
2 - 133
 
46 - 134
        $_SESSION["discogsTitle"] = "";
135
        $_SESSION["discogsArtist"] = "";
65 - 136
        $searchTerm = (empty($_POST['searchTerm']) ? "" : searchFriendlyString($_POST['searchTerm']));
137
        if (empty($searchTerm)) {
138
            resetSessionVars();
139
        }
140
        else {
141
            $_SESSION["searchTerm"] = $searchTerm;
116 - 142
            performSearch();
65 - 143
        }
144
    }
145
    else if ($_POST["submit"] == "Save") {
146
        $_SESSION["manualFilter"] = true;
66 - 147
        if (!isset($_POST["filterCondition"])) {$_POST["filterCondition"] = []; }
148
        if (!is_array($_POST["filterCondition"])) { $_POST["filterCondition"] = [ $_POST["filterCondition"] ];}
149
        $_SESSION["filterCondition"]["New"] = in_array("New", $_POST["filterCondition"]);
150
        $_SESSION["filterCondition"]["Used"] = in_array("Used", $_POST["filterCondition"]);
151
        if (!isset($_POST["filterMediaType"])) {$_POST["filterMediaType"] = []; }
152
        if (!is_array($_POST["filterMediaType"])) { $_POST["filterMediaType"] = [ $_POST["filterMediaType"] ];}
153
        $_SESSION["filterMediaType"]["CD"] = in_array("CD", $_POST["filterMediaType"]);
154
        $_SESSION["filterMediaType"]["Record"] = in_array("Record", $_POST["filterMediaType"]);
155
        $_SESSION["filterMediaType"]["Digital"] = in_array("Digital", $_POST["filterMediaType"]);
156
        $_SESSION["filterMediaType"]["Book"] = in_array("Book", $_POST["filterMediaType"]);
2 - 157
 
46 - 158
        $_SESSION["discogsTitle"] = "";
159
        $_SESSION["discogsArtist"] = "";
65 - 160
        $searchTerm = searchFriendlyString($_POST['searchTerm']);
161
        if (empty($searchTerm)) {
162
            resetSessionVars();
163
        }
164
        else {
165
            $_SESSION["searchTerm"] = $searchTerm;
116 - 166
            performSearch();
65 - 167
        }
168
    }
169
    else if ($_POST["submit"] == "discogsSearch") {
50 - 170
        $searchTerm = "";
171
        if (!empty($_POST['discogsBarcode'])) {
65 - 172
            $searchTerm = searchFriendlyString($_POST['discogsBarcode']);
173
        }
174
        else {
50 - 175
            if (!empty($_POST['discogsTitle'])) {
176
                $searchTerm = $_POST['discogsTitle'];
177
            }
58 - 178
 
50 - 179
            if (!empty($_POST['discogsArtist'])) {
180
                $searchTerm .= " " . $_POST['discogsArtist'];
181
            }
58 - 182
 
50 - 183
            $searchTerm = trim($searchTerm);
184
        }
185
 
65 - 186
        if (empty($searchTerm)) {
187
            resetSessionVars();
188
        }
189
        else {
190
            $_SESSION["searchTerm"] = $searchTerm;
46 - 191
            if (isset($_POST['discogsTitle'])) {
192
                $_SESSION["discogsTitle"] = searchFriendlyString($_POST['discogsTitle']);
193
            }
194
            if (isset($_POST['discogsArtist'])) {
195
                $_SESSION["discogsArtist"] = searchFriendlyString($_POST['discogsArtist']);
196
            }
14 - 197
 
116 - 198
            performSearch();
65 - 199
        }
200
    }
73 - 201
    else if ($_POST["submit"] == "unsubscribe") {
202
// bugbug
203
    }
65 - 204
}
205
else if ($_SERVER["REQUEST_METHOD"] == "GET") {
206
    if (isset($_GET['z'])) {
207
        $_SESSION["buyer"]["Zip"] = "";
208
        $zip = sanitizeInput($_GET['z']);
209
        if (strlen($zip) == 5 && preg_match("/^[0-9 ]*$/", $zip)) {
210
            $_SESSION["buyer"]["Zip"] = $zip;
211
        }
212
    }
2 - 213
 
9 - 214
    $_SESSION["searchTerm"] = "";
65 - 215
    if (isset($_GET['q'])) {
216
        $_SESSION["searchTerm"] = searchFriendlyString($_GET["q"]);
116 - 217
        performSearch();
65 - 218
    }
2 - 219
}
220
?>
14 - 221
    <form method="post" action="/index.php">
116 - 222
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>" />
223
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>" />
81 - 224
        <nav class="navbar navbar-expand-sm bg-black navbar-dark fixed-top">
35 - 225
            <div class="navbar-header">
107 - 226
                <button type="submit" name="submit" value="Search" class="btn text-white" aria-label="Go to home page">Find Cheap Music</button>
35 - 227
            </div>
107 - 228
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar" aria-label="Open Menu">
14 - 229
                <span class="navbar-toggler-icon"></span>
230
            </button>
231
            <div class="collapse navbar-collapse" id="collapsibleNavbar">
35 - 232
                <ul class="navbar-nav mr-auto">
14 - 233
                    <li class="nav-item">
116 - 234
                        <button type="submit" name="submit" value="Search" class="nav-link btn" aria-label="Go to home page"><i class="material-icons">home</i></button>
35 - 235
                    </li>
236
                    <?php if (isLoggedIn()) { ?>
237
                        <li class="nav-item">
238
                            <button type="submit" name="submit" value="coupons" class="nav-link btn">Coupons</button>
239
                        </li>
45 - 240
                        <li class="nav-item">
79 - 241
                            <button type="submit" name="submit" value="wishlist" class="nav-link btn">Wishlist
242
                            <?php if (!empty($_SESSION['priceMonitor']['newFlag']) && $_SESSION['priceMonitor']['newFlag'] === true) { echo '<scan class="badge badge-pill badge-light">New</scan>'; } ?>
243
                            </button>
45 - 244
                        </li>
65 - 245
                    <?php
246
} ?>
35 - 247
                    <li class="nav-item">
15 - 248
                        <button type="submit" name="submit" value="terms" class="nav-link btn">Terms of Service</button>
14 - 249
                    </li>
250
                    <li class="nav-item">
15 - 251
                        <button type="submit" name="submit" value="privacy" class="nav-link btn">Privacy Policy</button>
14 - 252
                    </li>
57 - 253
                    <li class="nav-item">
114 - 254
                        <a href="https://blog.findcheapmusic.com" target="_blank" rel="noreferrer noopener" class="nav-link" role="button">Blog</a>
57 - 255
                    </li>
107 - 256
                    <li class="nav-item">
116 - 257
                        <button type="submit" name="submit" value="help" class="nav-link btn" aria-label="Go to Help Page"><i class="material-icons">help_outline</i></button>
107 - 258
                    </li>
14 - 259
                </ul>
35 - 260
                <ul class="navbar-nav">
261
                    <?php if (!isLoggedIn()) { ?>
262
                    <li class="nav-item">
116 - 263
                        <a href="/login/index.php" class="nav-link"><svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M10,17V14H3V10H10V7L15,12L10,17M10,2H19A2,2 0 0,1 21,4V20A2,2 0 0,1 19,22H10A2,2 0 0,1 8,20V18H10V20H19V4H10V6H8V4A2,2 0 0,1 10,2Z" /></svg> Login</a>
35 - 264
                    </li>
65 - 265
                    <?php
266
}
267
else { ?>
36 - 268
                        <li class="nav-item">
108 - 269
                            <img class="img-fluid hide-extra-small hide-small user-img" src="<?php echo timeStampUrl($userPicture); ?>" alt="User Image">
36 - 270
                        </li>
35 - 271
                        <li class="nav-item dropdown">
116 - 272
                          <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown"><i class="material-icons material-text">account_box</i> Account</a>
35 - 273
                          <div class="dropdown-menu dropdown-menu-right">
116 - 274
                              <button formaction="/login/account.php" type="submit" name="submit" value="account" class="dropdown-item btn"><svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z" /></svg> Information</button>
275
                              <button formaction="/login/editAccount.php" type="submit" name="submit" value="editAccount" class="dropdown-item btn"><svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M21.7,13.35L20.7,14.35L18.65,12.3L19.65,11.3C19.86,11.09 20.21,11.09 20.42,11.3L21.7,12.58C21.91,12.79 21.91,13.14 21.7,13.35M12,18.94L18.06,12.88L20.11,14.93L14.06,21H12V18.94M12,14C7.58,14 4,15.79 4,18V20H10V18.11L14,14.11C13.34,14.03 12.67,14 12,14M12,4A4,4 0 0,0 8,8A4,4 0 0,0 12,12A4,4 0 0,0 16,8A4,4 0 0,0 12,4Z" /></svg> Edit Account</button>
36 - 276
                              <?php if (empty($_SESSION['sessData']['loginType']) || $_SESSION['sessData']['loginType'] != 'social') { ?>
116 - 277
                                  <button formaction="/login/changePassword.php" type="submit" name="submit" value="changePassword" class="dropdown-item btn"><svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M12.63,2C18.16,2 22.64,6.5 22.64,12C22.64,17.5 18.16,22 12.63,22C9.12,22 6.05,20.18 4.26,17.43L5.84,16.18C7.25,18.47 9.76,20 12.64,20A8,8 0 0,0 20.64,12A8,8 0 0,0 12.64,4C8.56,4 5.2,7.06 4.71,11H7.47L3.73,14.73L0,11H2.69C3.19,5.95 7.45,2 12.63,2M15.59,10.24C16.09,10.25 16.5,10.65 16.5,11.16V15.77C16.5,16.27 16.09,16.69 15.58,16.69H10.05C9.54,16.69 9.13,16.27 9.13,15.77V11.16C9.13,10.65 9.54,10.25 10.04,10.24V9.23C10.04,7.7 11.29,6.46 12.81,6.46C14.34,6.46 15.59,7.7 15.59,9.23V10.24M12.81,7.86C12.06,7.86 11.44,8.47 11.44,9.23V10.24H14.19V9.23C14.19,8.47 13.57,7.86 12.81,7.86Z" /></svg> Change Password</button>
65 - 278
                              <?php
279
    } ?>
116 - 280
                              <button formaction="/login/userAccount.php?logoutSubmit=1" type="submit" name="submit" value="logout" class="dropdown-item btn"><svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M16,17V14H9V10H16V7L21,12L16,17M14,2A2,2 0 0,1 16,4V6H14V4H5V20H14V18H16V20A2,2 0 0,1 14,22H5A2,2 0 0,1 3,20V4A2,2 0 0,1 5,2H14Z" /></svg> Logout</button>
35 - 281
                          </div>
282
                        </li>
65 - 283
                    <?php
284
} ?>
35 - 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
65 - 293
if (getPGV('submit') == "terms") {
294
    echo file_get_contents('snippets/headerTerms.txt');
295
}
296
else if (getPGV('submit') == "privacy") {
297
    echo file_get_contents('snippets/headerPrivacy.txt');
298
}
299
else if (getPGV('submit') == "coupons") {
300
    echo file_get_contents('snippets/headerCoupons.txt');
301
}
302
else if (getPGV('submit') == "wishlist") {
303
    echo file_get_contents('snippets/headerWishlist.txt');
78 - 304
    if (!empty($_SESSION['priceMonitor'])) {
305
    ?>
306
    <form method="post" action="/index.php">
116 - 307
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>" />
79 - 308
        <button id="priceMonitor" type="submit" class="btn btn-success rounded" name="submit" value="priceMonitor">Price Monitor Results
309
        <?php if (!empty($_SESSION['priceMonitor']['newFlag']) && $_SESSION['priceMonitor']['newFlag'] === true) { echo '<scan class="badge badge-pill badge-dark">New</scan>'; } ?>
310
        </button>
78 - 311
    </form>
312
    <?php
313
    }
65 - 314
}
78 - 315
else if (getPGV('submit') == "priceMonitor") {
316
    echo file_get_contents('snippets/headerPriceMonitor.txt');
317
}
65 - 318
else if (getPGV('submit') == "help") {
319
    echo file_get_contents('snippets/headerHelp.txt');
320
}
113 - 321
else if (getPGV('submit') == "barcode") {
322
    echo file_get_contents('snippets/headerBarcode.txt');
323
}
73 - 324
else if (getPGV('submit') == "unsubscribe") {
325
    echo file_get_contents('snippets/unsubscribeWishlist.txt');
326
}
65 - 327
else {
114 - 328
    echo '<h1>Find Cheap CDs, Records, Digital, Books and Sheets</h1>';
107 - 329
    echo '<p id="textslide" class="d-none d-sm-block">Bookmark FindCheapMusic.com</p>';
65 - 330
}
331
?>
2 - 332
        </div>
333
    </div>
334
 
3 - 335
	<div class="container-fluid bg-primary py-3">
65 - 336
        <form <?php if (in_array(getPGV('submit') , array(
337
    "terms",
338
    "privacy",
339
    "coupons",
340
    "wishlist",
78 - 341
    "priceMonitor",
73 - 342
    "help",
113 - 343
    "barcode",
73 - 344
    "unsubscribe"
345
 
65 - 346
))) {
107 - 347
    echo "hidden=\"hidden\"";
348
} ?> id="searchForm" method="post" action="/index.php" class="form-inline"
58 - 349
            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...'; }">
116 - 350
            <input id="sessionId" type="hidden" name="sessionId" value="<?php echo session_id(); ?>" />
351
            <input id="sessionTab" type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>" />
113 - 352
            <div style="width: 0; height: 0; overflow: hidden;">
116 - 353
                <button type="submit" name="submit" value="Search">Hidden Sumit Button</button>
113 - 354
            </div>
355
            <div class="form-group">
17 - 356
                <div class="btn-group">
116 - 357
                    <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="material-icons">info_outline</i></button>
358
                    <button class="btn input-group-text mx-1 rounded py-0" type="submit" name="submit" value="barcode" data-toggle="tooltip" title="Barcode Checker" aria-label="Barcode Checker" onclick="document.getElementById('searchTerm').value='';"><svg width="30" height="30" viewbox="0 0 24 24"><path fill="currentColor" d="M2,6H4V18H2V6M5,6H6V18H5V6M7,6H10V18H7V6M11,6H12V18H11V6M14,6H16V18H14V6M17,6H20V18H17V6M21,6H22V18H21V6Z" /></svg></button>
2 - 359
                </div>
360
        	</div>
20 - 361
        	<div class="form-group mx-1">
116 - 362
        	    <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 - 363
        	    <datalist id="searchHistory">
364
            	    <?php echo getSearchHistory(); ?>
365
            	</datalist>
366
            </div>
367
        	<div class="form-group">
368
                <button id="searchBtn" type="submit" class="btn btn-success mx-1 rounded" name="submit" value="Search">Go</button>
369
            </div>
2 - 370
        </form>
371
    </div>
372
 
5 - 373
    <?php
65 - 374
if (getPGV('submit') == "terms") {
375
    echo file_get_contents('snippets/terms.txt');
376
}
377
else if (getPGV('submit') == "privacy") {
378
    echo file_get_contents('snippets/privacy.txt');
379
}
380
else if (getPGV('submit') == "help") {
108 - 381
    include 'php/help.php';
65 - 382
}
113 - 383
else if (getPGV('submit') == "barcode") {
384
    echo '
114 - 385
<div class="container py-4 bg-light border">
113 - 386
    <div class="my-3">
387
    <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>
388
        <form id="barcodeForm">
116 - 389
    	    <input type="hidden" name="sessionTab" value="' . MySessionHandler::getSessionTab() . '" />
390
            <input type="hidden" name="searchTerm" value="' . getSV("searchTerm") . '" />
113 - 391
            <div class="input-group mb-3">
116 - 392
        	    <input id="barcode" name="barcode" type="text" class="" placeholder="Enter Barcode..." aria-label="Barcode Input" />
113 - 393
                    <div class="input-group-append">
394
                        <button type="submit" class="btn btn-success barcodeButton" name="submit" value="check">Verify</button>
395
                        <button type="submit" class="btn btn-info barcodeButton" name="submit" value="calc">Calculate</button>
396
                    </div>
397
            </div>
398
        </form>
399
        <div id="barcodeResult"></div>
400
    </div>
401
</div>
402
';
403
}
65 - 404
else if (getPGV('submit') == "coupons") {
405
    //get_linkshareCoupons(); // bugbug
406
    echo getCouponCodes();
407
}
408
else if (getPGV('submit') == "wishlist") {
409
    echo getWishlist();
410
}
78 - 411
else if (getPGV('submit') == "priceMonitor") {
412
    echo "<div id=\"productTable\" class=\"container bg-secondary border pt-2\">";
413
    echo getPriceMonitor(); // bugbug
414
    echo "</div>";
415
}
73 - 416
else if (getPGV('submit') == "unsubscribe") {
417
    echo unsubscribeWishlist($_GET);
418
}
65 - 419
else if (getPGV('submit') == "random") {
420
    findDiscogsMaster("***RANDOM***");
421
    echo $_SESSION["discogs"];
422
}
423
else {
424
    if ($_SESSION["lowestPrice"]["All"] > 0.00 || !empty($_SESSION["searchTerm"])) {
38 - 425
        echo $_SESSION["discogs"];
104 - 426
        echo "<div id=\"productTable\" class=\"container bg-secondary border py-2\">";
107 - 427
        echo "<h2 class=\"text-center py-2\">Store Offers</h2>";
104 - 428
        if ($_SESSION["lowestPrice"]["All"] > 0.00) {
429
            echo printResultHeader();
430
        }
65 - 431
        echo printResult();
432
        echo "</div>";
433
    }
434
    else if (!empty($_SESSION["discogs"])) {
435
        echo $_SESSION["discogs"];
436
    }
437
    else {
438
?>
110 - 439
    <div class="container-fluid text-center mb-2">
38 - 440
    <form method="post" action="/index.php">
116 - 441
        <input type="hidden" name="sessionTab" value="<?php echo MySessionHandler::getSessionTab(); ?>" />
442
       	<input type="hidden" name="searchTerm" value="<?php echo getSV("searchTerm") ?>" />
43 - 443
        <button id="randomBtn" type="submit" class="btn btn-success mt-5 rounded" name="submit" value="random">Random Album Suggestions</button>
38 - 444
    </form>
445
    </div>
110 - 446
    <div class="container bg-secondary border py-2 mt-4">
447
    <h2 class="text-center py-2">Getting Started</h2>
116 - 448
    <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="material-icons material-text">help_outline</i>) up top.</p>
110 - 449
    <hr>
108 - 450
    <?php include 'php/help.php'; ?>
110 - 451
    </div>
65 - 452
        <?php
14 - 453
    }
65 - 454
    echo printSearchFilterModal();
455
    echo printSearchInfoModal();
456
}
457
?>
2 - 458
 
14 - 459
    <div class="modal" id="progressBarDiv">
17 - 460
        <div class="modal-dialog modal-dialog-centered">
14 - 461
            <div class="modal-content">
462
                <div class="modal-header">
107 - 463
                    <p id="progressBarHeader" class="display-6">Searching</p>
14 - 464
                </div>
465
                <div class="modal-body">
466
                    <div class="progress">
467
                        <div id="progressBar" class="progress-bar" style="width:0%">0%</div>
468
                    </div>
469
                </div>
15 - 470
                <div class="modal-footer">
471
                    <span id="progressBarMessage"></span>
472
                </div>
14 - 473
            </div>
474
        </div>
475
    </div>
476
 
81 - 477
    <button onclick="topFunction()" id="topBtn" title="Go to top">Top</button>
478
 
64 - 479
    <footer class="container-fluid text-center bg-primary py-5">
78 - 480
        <?php if (!empty($_SESSION["searchTerm"]) || getPGV('submit') == "priceMonitor") {
114 - 481
            echo "<p>Disclaimer: As an Associate we earn from qualifying purchases.</p>";
482
        } ?>
483
        <p>
484
            <a href="https://www.facebook.com/FindCheapMusic" target="_blank" rel="noopener noreferrer"><img class="socialBtn lazyload" src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="images/f_logo_RGB-Blue_58.png" alt="Facebook Logo" /></a>
485
            <a href="https://twitter.com/findcheapmusic" target="_blank" rel="noopener noreferrer"><img class="socialBtn lazyload" src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="images/Twitter_Social_Icon_Circle_Color.png" alt="Twitter Logo" /></a>
486
        </p>
17 - 487
        <p>Copyright &#169; <?php echo @date("Y"); ?> FindCheapMusic.com. All rights reserved.</p>
2 - 488
    </footer>
489
 
36 - 490
    <script>var quotes = [
38 - 491
    <?php
65 - 492
if ($file = fopen("snippets/header.txt", "r")) {
493
    while (($line = fgets($file)) !== false) {
494
        echo "\"" . trim($line) . "\",";
495
    }
496
    fclose($file);
497
}
498
?>
83 - 499
    ]; setInterval(function() { $("#textslide").html(quotes[Math.floor(Math.random() * (quotes.length + 1))]); }, 5 * 1000);
500
    </script>
114 - 501
    <?php include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/downloadAtOnload.php"); ?>
2 - 502
</body>
503
</html>
21 - 504
<?php MySessionHandler::commit(session_id()); ?>