diff --git a/ajax/getfoldercontents.php b/ajax/getfoldercontents.php index 84d94e6..5cac934 100644 --- a/ajax/getfoldercontents.php +++ b/ajax/getfoldercontents.php @@ -39,10 +39,9 @@ $fullcompath = COMICSDIR . (($compath == "/") ? "" : $compath) . "/"; // Build up a list of comics and issues which have been read in descending order by lastupdate $query = "SELECT comic, issue FROM pagetracker WHERE username=:username"; //$query = "SELECT comic, issue FROM pagetracker WHERE username=:username ORDER BY lastupdate DESC"; -$fields = array(); -$fields[":username"] = $_SESSION['username']; $sth = $globaldbh->prepare($query); -$sth->execute($fields); +$sth->bindValue(":username", $_SESSION['username'], PDO::PARAM_STR); +$sth->execute(); $comics_read = array(); $issues_read = array(); while ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) { diff --git a/ajax/setpage.php b/ajax/setpage.php index dc8956d..06e095c 100644 --- a/ajax/setpage.php +++ b/ajax/setpage.php @@ -24,13 +24,12 @@ $page = intval($_REQUEST['page']); $query = "INSERT INTO pagetracker (username, comic, issue, currentpage, lastupdate) "; $query .= "VALUES(:username, :comic, :issue, :currentpage, NOW()) "; $query .= "ON DUPLICATE KEY UPDATE currentpage=:currentpage, lastupdate=NOW()"; -$fields = array(); -$fields[':username'] = $_SESSION['username']; -$fields[':comic'] = str_replace("/", "", $_SESSION['compath']); -$fields[':issue'] = $_SESSION['comfile']; -$fields[':currentpage'] = $page; $sth = $globaldbh->prepare($query); -$sth->execute($fields); +$sth->bindValue(":username", $_SESSION['username'], PDO::PARAM_STR); +$sth->bindValue(":comic", str_replace("/", "", $_SESSION['compath']), PDO::PARAM_STR); +$sth->bindValue(":issue", $_SESSION['comfile'], PDO::PARAM_STR); +$sth->bindValue(":currentpage", $page, PDO::PARAM_INT); +$sth->execute(); $data['message'] = "Page set to $page for {$_SESSION['username']} reading {$_SESSION['comfile']}"; diff --git a/ajax/showcomic.php b/ajax/showcomic.php index 30d8ec6..26aea1a 100644 --- a/ajax/showcomic.php +++ b/ajax/showcomic.php @@ -35,11 +35,10 @@ $_SESSION['comfile'] = basename($comicfull); // Get the current page for this comic or 0 (zero) if never opened $query = "SELECT currentpage FROM pagetracker WHERE username=:username AND issue=:issue"; -$fields = array(); -$fields[':username'] = $_SESSION['username']; -$fields[':issue'] = $_SESSION['comfile']; $sth = $globaldbh->prepare($query); -$sth->execute($fields); +$sth->bindValue(":username", $_SESSION['username'], PDO::PARAM_STR); +$sth->bindValue(":issue", $_SESSION['comfile'], PDO::PARAM_STR); +$sth->execute(); if ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) { $currentpage = intval($row['currentpage']); } else {