summary refs log tree commit diff stats
path: root/includes/update.php
blob: 6c8d9ffd71d52c68e1d0fd60b26cc6331464524f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

$getlast = "SELECT * FROM config WHERE name = \"lastUpdated\"";
$getlast2 = mysql_query($getlast);
$getlast3 = mysql_fetch_array($getlast2);

$last = $getlast3['value'];
if ($last != date('md'))
{
	$getpending = "SELECT * FROM comics WHERE status = \"pending\" ORDER BY id ASC LIMIT 0,1";
	$getpending2 = mysql_query($getpending);
	$getpending3 = mysql_fetch_array($getpending2);
	if (!empty($getpending3))
	{
		$id = next_comic_id();

		$setcomic = "UPDATE comics SET status = \"publish\", comic_id = " . $id . " WHERE id = " . $getpending3['id'];
	        $setcomic2 = mysql_query($setcomic) or die($setcomic);

		$insmeta = "INSERT INTO meta (comic_id,name,value) VALUES (" . $getpending3['id'] . ",\"pubDate\",\"" . date('Y-m-d H:i:s') . "\")";
		$insmeta2 = mysql_query($insmeta) or die($insmeta);

		$setconfig = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdated\"";
		$setconfig2 = mysql_query($setconfig);
	}
}

?>