Subversion Repositories cheapmusic

Rev

Rev 73 | Rev 79 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 73 Rev 78
Line 262... Line 262...
262
 
262
 
263
    return -1;
263
    return -1;
264
}
264
}
265
 
265
 
266
function unsubscribeWishlist($arr) {
266
function unsubscribeWishlist($arr) {
267
// bugbug    update users set wlEmailFlag = '0' where id = 2 and email = 'findcheapmusic@uwejacobs.com';
-
 
268
    $conn = MySessionHandler::getDBSessionId();
267
    $conn = MySessionHandler::getDBSessionId();
269
 
268
 
270
    $modified = mysqli_real_escape_string($conn, time());
269
    $modified = mysqli_real_escape_string($conn, time());
271
 
270
 
272
    $id = mysqli_real_escape_string($conn, $arr['id']);
271
    $id = mysqli_real_escape_string($conn, $arr['id']);
Line 285... Line 284...
285
    $str .= "<p class=\"display-6 font-weight-bold\">The wishlist price check emails for " . $email . " have been turned off</p>";
284
    $str .= "<p class=\"display-6 font-weight-bold\">The wishlist price check emails for " . $email . " have been turned off</p>";
286
    $str .= "<p>You can reinstate the emails at any time by setting the option 'Email Price Checks' for your account back to 'Yes'.</p>";
285
    $str .= "<p>You can reinstate the emails at any time by setting the option 'Email Price Checks' for your account back to 'Yes'.</p>";
287
    $str .= "</div>";
286
    $str .= "</div>";
288
 
287
 
289
    return $str;
288
    return $str;
-
 
289
}
-
 
290
 
-
 
291
function checkPriceMonitor() {
-
 
292
    if (empty($_SESSION['sessData']['userID'])) {
-
 
293
        unset($_SESSION['priceMonitor']);
-
 
294
        return -1;
-
 
295
    }
-
 
296
 
-
 
297
    $conn = MySessionHandler::getDBSessionId();
-
 
298
 
-
 
299
    $uid = $_SESSION['sessData']['userID'];
-
 
300
 
-
 
301
    $sql = "SELECT created, access
-
 
302
            FROM pricemonitor
-
 
303
            WHERE userId = '$uid'";
-
 
304
 
-
 
305
    if ($result = mysqli_query($conn, $sql)) {
-
 
306
        if (mysqli_num_rows($result) > 0) {
-
 
307
            if ($row = mysqli_fetch_assoc($result)) {
-
 
308
                $_SESSION['priceMonitor']['created'] = $row['created'];
-
 
309
                $_SESSION['priceMonitor']['access'] = $row['access'];
-
 
310
 
-
 
311
                return 0;
-
 
312
            }
-
 
313
        }
-
 
314
    }
-
 
315
    else if (mysqli_errno($conn)) {
-
 
316
        error_log("MySQL Read Price Monitor SQL: " . $sql);
-
 
317
        error_log("MySQL Read Price Monitor Error: " . mysqli_error($conn) . " (" . mysqli_errno($conn) . ")");
-
 
318
    }
-
 
319
 
-
 
320
    return -1;
-
 
321
}
-
 
322
 
-
 
323
 
-
 
324
function getPriceMonitor() {
-
 
325
    $conn = MySessionHandler::getDBSessionId();
-
 
326
 
-
 
327
    $uid = $_SESSION['sessData']['userID'];
-
 
328
 
-
 
329
    $sql = "SELECT data
-
 
330
            FROM pricemonitor
-
 
331
            WHERE userId = '$uid'";
-
 
332
 
-
 
333
    if ($result = mysqli_query($conn, $sql)) {
-
 
334
        if (mysqli_num_rows($result) > 0) {
-
 
335
            if ($row = mysqli_fetch_assoc($result)) {
-
 
336
                $access = mysqli_real_escape_string($conn, time());
-
 
337
                $sql = "UPDATE pricemonitor
-
 
338
                        SET access = $access
-
 
339
                        WHERE userId = '$uid'";                
-
 
340
                if (!($result = mysqli_query($conn, $sql))) {
-
 
341
                    error_log("MySQL Update Price Monitor SQL: " . $sql);
-
 
342
                    error_log("MySQL Update Price Monitor Error: " . mysqli_error($conn) . " (" . $error . ")");
-
 
343
                }
-
 
344
                
-
 
345
                return($row['data']);
-
 
346
            }
-
 
347
        }
-
 
348
    }
-
 
349
    else if (mysqli_errno($conn)) {
-
 
350
        error_log("MySQL Read Price Monitor SQL: " . $sql);
-
 
351
        error_log("MySQL Read Price Monitor Error: " . mysqli_error($conn) . " (" . mysqli_errno($conn) . ")");
-
 
352
    }
-
 
353
 
-
 
354
    return "";
290
}
355
}