diff options
Diffstat (limited to 'includes')
-rwxr-xr-x | includes/db.php | 8 | ||||
-rw-r--r-- | includes/footer.php | 14 | ||||
-rw-r--r-- | includes/functions.php | 35 | ||||
-rw-r--r-- | includes/header.php | 52 |
4 files changed, 109 insertions, 0 deletions
diff --git a/includes/db.php b/includes/db.php new file mode 100755 index 0000000..a763283 --- /dev/null +++ b/includes/db.php | |||
@@ -0,0 +1,8 @@ | |||
1 | <?php | ||
2 | |||
3 | include($_SERVER['DOCUMENT_ROOT'] . '/../security/pillowcase.php'); | ||
4 | |||
5 | mysql_connect($dbhost, $dbuser, $dbpasswd); | ||
6 | mysql_select_db($dbname); | ||
7 | |||
8 | ?> | ||
diff --git a/includes/footer.php b/includes/footer.php new file mode 100644 index 0000000..da2d072 --- /dev/null +++ b/includes/footer.php | |||
@@ -0,0 +1,14 @@ | |||
1 | |||
2 | <UL CLASS="navbar"> | ||
3 | <LI><A HREF="/about.htm">About</A></LI> | ||
4 | <LI><A HREF="/archive.htm">Archive</A></LI> | ||
5 | <LI><A HREF="/contribute.htm">Contribute</A></LI> | ||
6 | <LI><A HREF="http://fourisland.com/fourm/viewforum.php?f=55">Fourm</A></LI> | ||
7 | </UL> | ||
8 | </DIV> | ||
9 | |||
10 | <DIV ID="footer"> | ||
11 | Pillowcase is a <A HREF="http://fourisland.com/">Four Island</A> project. It is owned by Starla Insigna.</A> | ||
12 | </DIV> | ||
13 | </BODY> | ||
14 | </HTML> | ||
diff --git a/includes/functions.php b/includes/functions.php new file mode 100644 index 0000000..edb666b --- /dev/null +++ b/includes/functions.php | |||
@@ -0,0 +1,35 @@ | |||
1 | <?php | ||
2 | |||
3 | function has_meta($id, $name) | ||
4 | { | ||
5 | $getmeta = "SELECT * FROM meta WHERE comic_id = " . $id . " AND name = \"" . $name . "\""; | ||
6 | $getmeta2 = mysql_query($getmeta); | ||
7 | $getmeta3 = mysql_fetch_array($getmeta2); | ||
8 | |||
9 | if ($getmeta3['name'] == $name) | ||
10 | { | ||
11 | return true; | ||
12 | } | ||
13 | |||
14 | return false; | ||
15 | } | ||
16 | |||
17 | function get_meta($id, $name) | ||
18 | { | ||
19 | $getmeta = "SELECT * FROM meta WHERE comic_id = " . $id . " AND name = \"" . $name . "\""; | ||
20 | $getmeta2 = mysql_query($getmeta); | ||
21 | $getmeta3 = mysql_fetch_array($getmeta2); | ||
22 | |||
23 | return $getmeta3['value']; | ||
24 | } | ||
25 | |||
26 | function next_comic_id() | ||
27 | { | ||
28 | $getcomic = "SELECT * FROM comics WHERE status = \"publish\" ORDER BY comic_id DESC LIMIT 0,1"; | ||
29 | $getcomic2 = mysql_query($getcomic); | ||
30 | $getcomic3 = mysql_fetch_array($getcomic2); | ||
31 | |||
32 | return ($getcomic3['comic_id']+1); | ||
33 | } | ||
34 | |||
35 | ?> | ||
diff --git a/includes/header.php b/includes/header.php new file mode 100644 index 0000000..0f5b075 --- /dev/null +++ b/includes/header.php | |||
@@ -0,0 +1,52 @@ | |||
1 | <?php | ||
2 | |||
3 | if (isset($title)) | ||
4 | { | ||
5 | $rtitle = 'Pillowcase - ' . $title; | ||
6 | } else { | ||
7 | $rtitle = 'Pillowcase'; | ||
8 | } | ||
9 | |||
10 | ?><HTML> | ||
11 | <HEAD> | ||
12 | <TITLE><?php echo($rtitle); ?></TITLE> | ||
13 | <LINK REL="stylesheet" HREF="/style.css"> | ||
14 | </HEAD> | ||
15 | |||
16 | <BODY> | ||
17 | <DIV ID="wrap"> | ||
18 | <DIV ID="header"> | ||
19 | <A HREF="/"><H1>Pillowcase</H1></A> | ||
20 | </DIV> | ||
21 | |||
22 | <?php | ||
23 | |||
24 | include_once($_SERVER['DOCUMENT_ROOT'] . '/db.php'); | ||
25 | include_once($_SERVER['DOCUMENT_ROOT'] . '/functions.php'); | ||
26 | |||
27 | $getlast = "SELECT * FROM config WHERE name = \"lastUpdated\""; | ||
28 | $getlast2 = mysql_query($getlast); | ||
29 | $getlast3 = mysql_fetch_array($getlast2); | ||
30 | |||
31 | $last = $getlast3['value']; | ||
32 | if ($last != date('md')) | ||
33 | { | ||
34 | $getpending = "SELECT * FROM comics WHERE status = \"pending\" ORDER BY id ASC LIMIT 0,1"; | ||
35 | $getpending2 = mysql_query($getpending); | ||
36 | $getpending3 = mysql_fetch_array($getpending2); | ||
37 | if (!empty($getpending3)) | ||
38 | { | ||
39 | $id = next_comic_id(); | ||
40 | |||
41 | $setcomic = "UPDATE comics SET status = \"publish\", comic_id = " . $id . " WHERE id = " . $getpending3['id']; | ||
42 | $setcomic2 = mysql_query($setcomic) or die($setcomic); | ||
43 | |||
44 | $insmeta = "INSERT INTO meta (comic_id,name,value) VALUES (" . $getpending3['id'] . ",\"pubDate\",\"" . date('Y-m-d H:i:s') . "\")"; | ||
45 | $insmeta2 = mysql_query($insmeta) or die($insmeta); | ||
46 | |||
47 | $setconfig = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdated\""; | ||
48 | $setconfig2 = mysql_query($setconfig); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | ?> | ||