diff options
Diffstat (limited to 'includes/update.php')
-rwxr-xr-x | includes/update.php | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/includes/update.php b/includes/update.php index 6c8d9ff..3f2fae1 100755 --- a/includes/update.php +++ b/includes/update.php | |||
@@ -1,27 +1,29 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | $getlast = "SELECT * FROM config WHERE name = \"lastUpdated\""; | 3 | $getlast = $mysql_conn->query("SELECT * FROM config WHERE name = \"lastUpdated\""); |
4 | $getlast2 = mysql_query($getlast); | 4 | $getlast3 = $getlast->fetch_assoc(); |
5 | $getlast3 = mysql_fetch_array($getlast2); | ||
6 | 5 | ||
7 | $last = $getlast3['value']; | 6 | $last = $getlast3['value']; |
8 | if ($last != date('md')) | 7 | if ($last != date('md')) |
9 | { | 8 | { |
10 | $getpending = "SELECT * FROM comics WHERE status = \"pending\" ORDER BY id ASC LIMIT 0,1"; | 9 | $getpending = $mysql_conn->query("SELECT * FROM comics WHERE status = \"pending\" ORDER BY id ASC LIMIT 0,1"); |
11 | $getpending2 = mysql_query($getpending); | 10 | $getpending3 = $getpending->fetch_assoc(); |
12 | $getpending3 = mysql_fetch_array($getpending2); | ||
13 | if (!empty($getpending3)) | 11 | if (!empty($getpending3)) |
14 | { | 12 | { |
15 | $id = next_comic_id(); | 13 | $id = next_comic_id(); |
16 | 14 | ||
17 | $setcomic = "UPDATE comics SET status = \"publish\", comic_id = " . $id . " WHERE id = " . $getpending3['id']; | 15 | $setcomic = $mysql_conn->prepare("UPDATE comics SET status = \"publish\", comic_id = ? WHERE id = ?"); |
18 | $setcomic2 = mysql_query($setcomic) or die($setcomic); | 16 | $setcomic->bind_param("ii", $id, $getpending3['id']); |
17 | $setcomic->execute() or die($setcomic); | ||
19 | 18 | ||
20 | $insmeta = "INSERT INTO meta (comic_id,name,value) VALUES (" . $getpending3['id'] . ",\"pubDate\",\"" . date('Y-m-d H:i:s') . "\")"; | 19 | $insmeta = $mysql_conn->prepare("INSERT INTO meta (comic_id,name,value) VALUES (?,\"pubDate\",\"" . date('Y-m-d H:i:s') . "\")"); |
21 | $insmeta2 = mysql_query($insmeta) or die($insmeta); | 20 | $insmeta->bind_param("i", $getpending3['id']); |
21 | $insmeta->execute() or die($insmeta); | ||
22 | 22 | ||
23 | $setconfig = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdated\""; | 23 | $setconfig = $mysql_conn->prepare("UPDATE config SET value = ? WHERE name = \"lastUpdated\""); |
24 | $setconfig2 = mysql_query($setconfig); | 24 | $newdate = date('md'); |
25 | $setconfig->bind_param("s", $newdate); | ||
26 | $setconfig->execute(); | ||
25 | } | 27 | } |
26 | } | 28 | } |
27 | 29 | ||