summary refs log tree commit diff stats
path: root/includes/header.php
blob: 0f5b075ed5162ee46a0e3715b17e81e0746f586a (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php

if (isset($title))
{
	$rtitle = 'Pillowcase - ' . $title;
} else {
	$rtitle = 'Pillowcase';
}

?><HTML>
	<HEAD>
		<TITLE><?php echo($rtitle); ?></TITLE>
		<LINK REL="stylesheet" HREF="/style.css">
	</HEAD>

	<BODY>
		<DIV ID="wrap">
			<DIV ID="header">
				<A HREF="/"><H1>Pillowcase</H1></A>
			</DIV>

<?php

include_once($_SERVER['DOCUMENT_ROOT'] . '/db.php');
include_once($_SERVER['DOCUMENT_ROOT'] . '/functions.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);
	}
}

?>