maj.world

maj.world

Git

This commit has been accessed 106 times via Git panel.

commit c5a572618d334ac43a832f439bf03b914659685e
tree 955e82ee0bf4a26458f6625818169d154a6e0975
author Engels Antonio <engels@majcms.org> 1277311410 +0800
committer Engels Antonio <engels@majcms.org> 1277311410 +0800

    Initial commit

diff --git a/add.php b/add.php
new file mode 100644
index 0000000..f341c42
--- /dev/null
+++ b/add.php
@@ -0,0 +1,581 @@
+<?php
+session_start();
+header("Cache-control: private");
+
+if (isset($_REQUEST['title_input']) and isset($_REQUEST['body_input']) and !empty($_REQUEST['title_input']) and !empty($_REQUEST['body_input'])) {
+       header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']));
+}
+
+$username_file = 'data/username.txt';
+$open_username_file = fopen($username_file,"r");
+$login_username = fread($open_username_file,filesize($username_file));
+fclose($open_username_file);
+
+if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
+       exit();
+}
+
+?>
+
+<style>
+body
+{
+       color: #666666;
+       margin: 10px;
+       padding: 0px;
+       text-align: left;
+       font-family: verdana, helvetica, sans-serif;
+       background-color: #FFFFFF;
+}
+p
+{
+       font-size: 11px;
+}
+a
+{
+       font-weight: bold;
+       text-decoration: none;
+}
+a:link, a:visited
+{
+       color: #666666;
+}
+a:hover
+{
+       color: #336699;
+}
+a:active {
+       color: #336699;
+}
+.input_title {        
+       color: #666666;
+       background: #ffffff;
+       border: #999999 solid 1px;
+       width: 512px;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px;
+       font-weight: bold
+}
+.input_body {  
+       color: #666666;
+       background: #ffffff;
+       border: #999999 solid 1px;
+       width: 512px;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px
+}
+</style>
+
+<?php
+
+if (file_exists("data/offset.txt")) {
+       $offset = file_get_contents("data/offset.txt");
+}
+else {
+       $offset = 0;
+}
+
+$entry_year = date("Y", time() + $offset);
+$entry_month = date("m", time() + $offset);
+$entry_day = date("d", time() + $offset);
+$entry_hour = date("H", time() + $offset);
+$entry_min = date("i", time() + $offset);
+$entry_sec = date("s", time() + $offset);
+
+$image_path = "images/";
+$max_image_size = 2000000;
+$max_file_size = 2000000;
+
+?>
+
+<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+<p>
+<select name="select_year">
+<option selected>
+<option><?php echo $entry_year; ?>
+<option><?php $ante_year_1 = $entry_year - 1; echo $ante_year_1; ?>
+<option><?php $ante_year_2 = $entry_year - 2; echo $ante_year_2; ?>
+<option><?php $ante_year_3 = $entry_year - 3; echo $ante_year_3; ?>
+<option><?php $ante_year_4 = $entry_year - 4; echo $ante_year_4; ?>
+<option><?php $ante_year_5 = $entry_year - 5; echo $ante_year_5; ?>
+<option><?php $ante_year_6 = $entry_year - 6; echo $ante_year_6; ?>
+<option><?php $ante_year_7 = $entry_year - 7; echo $ante_year_7; ?>
+<option><?php $ante_year_8 = $entry_year - 8; echo $ante_year_8; ?>
+<option><?php $ante_year_9 = $entry_year - 9; echo $ante_year_9; ?>
+<option><?php $ante_year_10 = $entry_year - 10; echo $ante_year_10; ?>
+</select>
+
+<select name="select_month">
+<option selected>
+<option><?php echo $entry_month; ?>
+<option>01
+<option>02
+<option>03
+<option>04
+<option>05
+<option>06
+<option>07
+<option>08
+<option>09
+<option>10
+<option>11
+<option>12
+</select>
+
+<select name="select_day">
+<option selected>
+<option><?php echo $entry_day; ?>
+<option>01
+<option>02
+<option>03
+<option>04
+<option>05
+<option>06
+<option>07
+<option>08
+<option>09
+<option>10
+<option>11
+<option>12
+<option>13
+<option>14
+<option>15
+<option>16
+<option>17
+<option>18
+<option>19
+<option>20
+<option>21
+<option>22
+<option>23
+<option>24
+<option>25
+<option>26
+<option>27
+<option>28
+<option>29
+<option>30
+<option>31
+</select>
+
+<select name="select_hour">
+<option selected>
+<option><?php echo $entry_hour; ?>
+<option>00
+<option>01
+<option>02
+<option>03
+<option>04
+<option>05
+<option>06
+<option>07
+<option>08
+<option>09
+<option>10
+<option>11
+<option>12
+<option>13
+<option>14
+<option>15
+<option>16
+<option>17
+<option>18
+<option>19
+<option>20
+<option>21
+<option>22
+<option>23
+</select>
+
+<select name="select_min">
+<option selected>
+<option><?php echo $entry_min; ?>
+<option>00
+<option>01
+<option>02
+<option>03
+<option>04
+<option>05
+<option>06
+<option>07
+<option>08
+<option>09
+<option>10
+<option>11
+<option>12
+<option>13
+<option>14
+<option>15
+<option>16
+<option>17
+<option>18
+<option>19
+<option>20
+<option>21
+<option>22
+<option>23
+<option>24
+<option>25
+<option>26
+<option>27
+<option>28
+<option>29
+<option>30
+<option>31
+<option>32
+<option>33
+<option>34
+<option>35
+<option>36
+<option>37
+<option>38
+<option>39
+<option>40
+<option>41
+<option>42
+<option>43
+<option>44
+<option>45
+<option>46
+<option>47
+<option>48
+<option>49
+<option>50
+<option>51
+<option>52
+<option>53
+<option>54
+<option>55
+<option>56
+<option>57
+<option>58
+<option>59
+</select>   Enter antedate value in YYYY-MM-DD-HH-MM format.</p>
+
+<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_image_size; ?>">
+<input autocomplete=off type=file name=image_input> Select optional image.</p>
+
+<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
+<input autocomplete=off type=file name=file_input> Select optional file.</p>
+<?php
+       if (file_exists("data/categories")) {
+               if ($dh_cat = opendir("data/categories")) {
+                       while (($entry_cat = readdir($dh_cat)) !== false) {
+
+                               if ($entry_cat != "." && $entry_cat != ".." && fnmatch("*", $entry_cat)) {
+                                       $show_cat[] = $entry_cat;
+                               }
+                       }
+                       closedir($dh_cat);
+               }
+
+               sort($show_cat);
+               reset($show_cat);
+               $count_cat = count($show_cat);
+
+               if ($count_cat > 0) {
+
+                       echo "<p><select name=category><option selected>unfiled";
+
+                       foreach ($show_cat as $category) {
+                               echo "<option>";
+                               echo strtolower($category);
+                       }
+
+                       echo "</select> Select category.</p>";
+
+               }
+       }
+?>
+<p><input type=checkbox name=sticky>Put entry title in Links box.<br>
+<input type=checkbox name=display>Always display. If this is not a private entry, it will be displayed even if its category is hidden or isolated.<br>
+<input type=checkbox name=private>Private entry. This entry will unconditionally be invisible to visitors, even if always display is set.</p>
+
+<table border=0 cellspacing=0 cellpadding=0><tr><td>
+
+<table border=0 cellspacing=2 cellpadding=0>
+<tr><td><input autocomplete=off class=input_title type=text name=title_input></td></tr>
+<tr><td><textarea class=input_body name=body_input rows=15></textarea></td></tr>
+<tr><td><input class=input_body type=submit value="click here to post this new entry"></td></tr>
+</form>
+
+<form enctype="multipart/form-data" action="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); ?>" method="post">
+<tr><td><input class=input_body type=submit value="click here to go to the index page"></td></tr>
+</form>
+</table>
+
+</td><td width=10></td><td>
+
+<table border=0 cellspacing=1 cellpadding=2>
+<tr><td><img src=images/smileys/crying.png border=0></td><td><p>:((</p></td><td ><p>crying</p></td></tr>
+<tr><td><img src=images/smileys/frown.png border=0></td><td><p>:(</p></td><td><p>frown</p></td></tr>
+<tr><td><img src=images/smileys/indifferent.png border=0></td><td><p>:|</p></td><td><p>indifferent</p></td></tr>
+<tr><td><img src=images/smileys/laughing.png border=0></td><td><p>:D</p></td><td><p>laughing</p></td></tr>
+<tr><td><img src=images/smileys/lick.png border=0></td><td><p>:P</p></td><td><p>lick</p></td></tr>
+<tr><td><img src=images/smileys/ohno.png border=0></td><td><p>:O</p></td><td><p>oh no!</p></td></tr>
+<tr><td><img src=images/smileys/smile.png border=0></td><td><p>:)</p></td><td><p>smile</p></td></tr>
+<tr><td><img src=images/smileys/surprised.png border=0></td><td><p>=)</p></td><td><p>surprised</p></td></tr>
+<tr><td><img src=images/smileys/undecided.png border=0></td><td><p>:\</p></td><td><p>undecided</p></td></tr>
+<tr><td><img src=images/smileys/wink.png border=0></td><td><p>;)</p></td><td><p>wink</p></td></tr>
+</td></tr>
+</table>
+
+</td></tr></table>
+
+<?php
+
+if (!isset($_REQUEST['title_input']) or !isset($_REQUEST['body_input']) or empty($_REQUEST['title_input']) or empty($_REQUEST['body_input'])) {
+       // echo "<p>no input!</p>";
+       exit();
+}
+
+if (!isset($_REQUEST['select_year']) or !isset($_REQUEST['select_month']) or !isset($_REQUEST['select_day']) or !isset($_REQUEST['select_hour']) or !isset($_REQUEST['select_min']) or empty($_REQUEST['select_year']) or empty($_REQUEST['select_month']) or empty($_REQUEST['select_day']) or empty($_REQUEST['select_hour']) or empty($_REQUEST['select_min'])) {
+
+$entry = date("YmdHis", time() + $offset);
+
+// GNU date format
+//$timestamp = date("D M j H:i:s \P\H\T Y", time() + $offset);
+
+// Simple PHP Blog format
+$timestamp = date("l, M j, Y, g:i A", time() + $offset);
+
+echo '<p>' . $entry . '<br>' . $timestamp . '<br>' . date("l, M j, Y, g:i A") . '</p>';
+
+}
+else {
+
+$entry = $_REQUEST['select_year'] . $_REQUEST['select_month'] . $_REQUEST['select_day'] . $_REQUEST['select_hour'] . $_REQUEST['select_min'] . $entry_sec;
+
+// GNU date format
+//$timestamp = date("D M j H:i:s \P\H\T Y", mktime($_REQUEST['select_hour'], $_REQUEST['select_min'], $entry_sec, $_REQUEST['select_month'], $_REQUEST['select_day'], $_REQUEST['select_year']));
+
+// Simple PHP Blog format
+$timestamp = date("l, M j, Y, g:i A", mktime($_REQUEST['select_hour'], $_REQUEST['select_min'], $entry_sec, $_REQUEST['select_month'], $_REQUEST['select_day'], $_REQUEST['select_year']));
+
+echo '<p>' . $entry . '<br>' . $timestamp . '<br>' . date("l, M j, Y, g:i A") . '</p>';
+
+}
+
+if (!file_exists("data/items")) {
+       mkdir("data/items");
+       chmod("data/items", 0777);
+}
+
+$dir = "data/items/";
+$item_dir = $dir . $entry;
+
+if (!file_exists("images")) {
+       mkdir("images");
+       chmod("images", 0777);
+}
+
+$image_dir = 'images/' . $entry;
+$file_dir = $item_dir . '/filedrop';
+
+$body_write_content = ucfirst($_REQUEST['body_input']);
+$body_write_content = str_replace("\n", '<br />', $body_write_content);
+$body_write_content = str_replace(':((', '<img src=images/smileys/crying.png border=0>', $body_write_content);
+$body_write_content = str_replace(':(', '<img src=images/smileys/frown.png border=0>', $body_write_content);
+$body_write_content = str_replace(':|', '<img src=images/smileys/indifferent.png border=0>', $body_write_content);
+$body_write_content = str_replace(':D', '<img src=images/smileys/laughing.png border=0>', $body_write_content);
+$body_write_content = str_replace(':P', '<img src=images/smileys/lick.png border=0>', $body_write_content);
+$body_write_content = str_replace(':O', '<img src=images/smileys/ohno.png border=0>', $body_write_content);
+$body_write_content = str_replace(':)', '<img src=images/smileys/smile.png border=0>', $body_write_content);
+$body_write_content = str_replace('=)', '<img src=images/smileys/surprised.png border=0>', $body_write_content);
+$body_write_content = str_replace(':\\', '<img src=images/smileys/undecided.png border=0>', $body_write_content);
+$body_write_content = str_replace(';)', '<img src=images/smileys/wink.png border=0>', $body_write_content);
+$body_write_content = str_replace('[b]', '<b>', $body_write_content);
+$body_write_content = str_replace('[/b]', '</b>', $body_write_content);
+$body_write_content = str_replace('[i]', '<i>', $body_write_content);
+$body_write_content = str_replace('[/i]', '</i>', $body_write_content);
+$body_write_content = str_replace('[u]', '<u>', $body_write_content);
+$body_write_content = str_replace('[/u]', '</u>', $body_write_content);
+$body_write_content = str_replace('[strike]', '<strike>', $body_write_content);
+$body_write_content = str_replace('[/strike]', '</strike>', $body_write_content);
+
+mkdir($item_dir, 0777);
+chmod($item_dir, 0777);
+
+$title_write_content = ucfirst($_REQUEST['title_input']);
+$title_file = $item_dir . '/title.txt';
+$fp_title_txt = fopen($title_file,"w");
+chmod($title_file, 0666);
+fwrite($fp_title_txt,$title_write_content);
+fclose($fp_title_txt);
+
+$date_file = $item_dir . '/date.txt';
+$fp_date_txt = fopen($date_file,"w");
+chmod($date_file, 0666);
+fwrite($fp_date_txt,$timestamp);
+fclose($fp_date_txt);
+
+if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
+
+       if (is_uploaded_file($_FILES['image_input']['tmp_name'])) {
+
+               if ($_FILES['image_input']['size']<=$max_image_size) {
+
+                       if (($_FILES['image_input']['type']=="image/gif") || ($_FILES['image_input']['type']=="image/pjpeg") || ($_FILES['image_input']['type']=="image/jpeg") || ($_FILES['image_input']['type']=="image/png")) {
+
+                               if (!file_exists($image_dir)) {
+                                       mkdir($image_dir, 0777);
+                                       chmod($image_dir, 0777);
+                               }
+
+                               if (!file_exists($image_dir . '/' . $_FILES['image_input']['name'])) {
+                                       $res = copy($_FILES['image_input']['tmp_name'], $image_dir . '/' . $_FILES['image_input']['name']);
+                                       unlink($_FILES['image_input']['tmp_name']);
+
+                               }
+                               else {
+                                       unlink($_FILES['image_input']['tmp_name']);
+                               }
+                       }
+                       else {
+                               unlink($_FILES['image_input']['tmp_name']);
+                       }
+               }
+               else {
+                       unlink($_FILES['image_input']['tmp_name']);
+               }
+       }
+       else {
+               unlink($_FILES['image_input']['tmp_name']);
+       }
+}
+
+if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
+       if (is_uploaded_file($_FILES['file_input']['tmp_name'])) {
+               if ($_FILES['file_input']['size']<=$max_file_size) {
+                       $filedrop_dir = "$item_dir/filedrop";
+                       if (!file_exists($filedrop_dir)) {
+                               mkdir($filedrop_dir, 0777);
+                               chmod($filedrop_dir, 0777);
+                       }
+                       $file_dir = "$filedrop_dir/files";
+                       if (!file_exists($file_dir)) {
+                               mkdir($file_dir, 0777);
+                               chmod($file_dir, 0777);
+                       }
+                       if (!file_exists($file_dir . '/' . $_FILES['file_input']['name'])) {
+                               $res = copy($_FILES['file_input']['tmp_name'], $file_dir . '/' . $_FILES['file_input']['name']);
+                               unlink($_FILES['file_input']['tmp_name']);
+                               $file_src = $file_dir . '/' . $_FILES['file_input']['name'];
+                               $file_file = $filedrop_dir . '/' . $_FILES['file_input']['name'] . '.txt';
+                               $fp_file_txt = fopen($file_file,"w");
+                               fwrite($fp_file_txt,$file_src);
+                               fclose($fp_file_txt);
+                               chmod($file_file, 0666);
+                       }
+                       else {
+                               unlink($_FILES['file_input']['tmp_name']);
+                       }
+
+               }
+               else {
+                       unlink($_FILES['file_input']['tmp_name']);
+               }
+
+       }
+       else {
+               unlink($_FILES['file_input']['tmp_name']);
+       }
+
+}
+
+$body_file = $item_dir . '/body.txt';
+$fp_body_txt = fopen($body_file,"w");
+chmod($body_file, 0666);
+
+if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
+       if (file_exists($image_dir . '/' . $_FILES['image_input']['name'])) {
+
+               $entry_image_size = getimagesize($image_dir . '/' . $_FILES['image_input']['name']);
+               $entry_image_width = $entry_image_size[0];
+               $entry_image_height = $entry_image_size[1];
+
+               $max_entry_image_width = 513;
+
+               if ($entry_image_width > $max_entry_image_width) {  
+                       $sizefactor = (double) ($max_entry_image_width / $entry_image_width) ;
+                       $entry_image_width = (int) ($entry_image_width * $sizefactor);
+                       $entry_image_height = (int) ($entry_image_height * $sizefactor);
+               }
+      
+               $body_write_content = '<img src=' . $image_dir . '/' . $_FILES['image_input']['name'] . ' border=0 width=' . $entry_image_width . ' height=' . $entry_image_height . '><br>' . $body_write_content;
+       }
+}
+
+fwrite($fp_body_txt,$body_write_content);
+fclose($fp_body_txt);
+
+$sticky_sem = 'data/sticky/' . $entry;
+if (isset($_REQUEST['sticky']) and !empty($_REQUEST['sticky']) and ($_REQUEST['sticky'] == "on")) {
+       if (!file_exists("data/sticky")) {
+               mkdir("data/sticky", 0777);
+               chmod("data/sticky", 0777);
+       }
+       if (!file_exists($sticky_sem)) {
+               touch($sticky_sem);
+               chmod($sticky_sem, 0666);
+       }
+}
+
+$display_sem = "data/items/$entry/cat.txt";
+if (isset($_REQUEST['display']) and !empty($_REQUEST['display']) and ($_REQUEST['display'] == "on")) {
+       if (!file_exists($display_sem)) {
+               touch($display_sem);
+               chmod($display_sem, 0666);
+       }
+}
+
+$private_sem = "data/items/$entry/private.txt";
+if (isset($_REQUEST['private']) and !empty($_REQUEST['private']) and ($_REQUEST['private'] == "on")) {
+       if (!file_exists($private_sem)) {
+               touch($private_sem);
+               chmod($private_sem, 0666);
+       }
+}
+
+if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
+       if (!file_exists("data/categories")) {
+               mkdir("data/categories", 0777);
+               chmod("data/categories", 0777);
+       }
+       if (file_exists("data/categories/{$_REQUEST['category']}")) {
+               $fp_category_txt = fopen("data/items/$entry/category.txt","w");
+               fwrite($fp_category_txt, $_REQUEST['category']);
+               fclose($fp_category_txt);
+               chmod("data/items/$entry/category.txt", 0666);
+       }
+}
+
+$default_ping_urls = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
+$ping_urls_file = "data/ping.txt";
+
+if (!file_exists($ping_urls_file)) {
+       $fp_default_ping_txt = fopen($ping_urls_file,"w");
+       fwrite($fp_default_ping_txt, $default_ping_urls);
+       fclose($fp_default_ping_txt);
+       chmod($ping_urls_file, 0666);
+}
+
+$fp_ping_urls = fopen($ping_urls_file, "r");
+$ping_urls = fread($fp_ping_urls, filesize($ping_urls_file));
+fclose($fp_ping_urls);
+
+$get_ping_urls = explode("|", $ping_urls);
+
+foreach ($get_ping_urls as $ping_url) {
+       $ping = file_get_contents($ping_url);
+
+       //$ping_urls_add_file = "data/ping-add.txt";
+       //$fp_ping_urls_add_txt = fopen($ping_urls_add_file,"w");
+       //fwrite($fp_ping_urls_add_txt, $ping);
+       //fclose($fp_ping_urls_add_txt);
+       //chmod($ping_urls_add_file, 0666);
+
+       clear($ping);
+}
+
+?>
diff --git a/cat.php b/cat.php
new file mode 100644
index 0000000..ee4e268
--- /dev/null
+++ b/cat.php
@@ -0,0 +1,215 @@
+<?php
+
+session_start();
+header("Cache-control: private");
+
+$login_username = file_get_contents("data/username.txt");
+
+if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
+       exit();
+}
+
+function rmdirr($recurse_dirname)
+{
+
+    if (!file_exists($recurse_dirname)) {
+        return false;
+    }
+
+    if (is_file($recurse_dirname)) {
+        return unlink($recurse_dirname);
+    }
+
+    $recurse_dir = dir($recurse_dirname);
+    while (false !== $recurse_entry = $recurse_dir->read()) {
+
+        if ($recurse_entry == '.' || $recurse_entry == '..') {
+            continue;
+        }
+
+        rmdirr("$recurse_dirname/$recurse_entry");
+    }
+
+    $recurse_dir->close();
+    return rmdir($recurse_dirname);
+}
+
+if (isset($_REQUEST['new_id']) and !empty($_REQUEST['new_id'])) {
+
+       if (!file_exists("data/categories")) {
+               mkdir("data/categories", 0777);
+       }
+
+       $new_id = trim(strip_tags(strtolower($_REQUEST['new_id'])));
+
+       if (!file_exists("data/categories/$new_id")) {
+               mkdir("data/categories/$new_id", 0777);
+       }
+
+       if (isset($_REQUEST['new_title']) and !empty($_REQUEST['new_title'])) {
+               $new_title = ucfirst(strip_tags(trim($_REQUEST['new_title'])));
+               $open_title_file = fopen("data/categories/$new_id/title.txt","w");
+               fwrite($open_title_file,$new_title);
+               fclose($open_title_file);
+               chmod("data/categories/$new_id/title.txt", 0666);
+       }
+}
+
+if (isset($_REQUEST['cat_del']) and !empty($_REQUEST['cat_del']) and ($_REQUEST['cat_del'] == "on")) {
+       rmdirr("data/categories/{$_REQUEST['cat_id']}");
+}
+
+if ((!isset($_REQUEST['cat_hide']) or !empty($_REQUEST['cat_hide'])) and ($_REQUEST['cat_edit'] == "on")) {
+       if (file_exists("data/categories/{$_REQUEST['cat_id']}/private.txt")) {
+               unlink("data/categories/{$_REQUEST['cat_id']}/private.txt");
+       }
+}
+
+if (isset($_REQUEST['cat_hide']) and !empty($_REQUEST['cat_hide']) and ($_REQUEST['cat_hide'] == "on")) {
+       if (!file_exists("data/categories/{$_REQUEST['cat_id']}/private.txt")) {
+               touch("data/categories/{$_REQUEST['cat_id']}/private.txt");
+               chmod("data/categories/{$_REQUEST['cat_id']}/private.txt", 0666);
+       }
+}
+
+if ((!isset($_REQUEST['cat_book']) or !empty($_REQUEST['cat_book'])) and ($_REQUEST['cat_edit'] == "on")) {
+       if (file_exists("data/categories/{$_REQUEST['cat_id']}/book.txt")) {
+               unlink("data/categories/{$_REQUEST['cat_id']}/book.txt");
+       }
+}
+
+if (isset($_REQUEST['cat_book']) and !empty($_REQUEST['cat_book']) and ($_REQUEST['cat_book'] == "on")) {
+       if (!file_exists("data/categories/{$_REQUEST['cat_id']}/book.txt")) {
+               touch("data/categories/{$_REQUEST['cat_id']}/book.txt");
+               chmod("data/categories/{$_REQUEST['cat_id']}/book.txt", 0666);
+       }
+}
+
+if (isset($_REQUEST['cat_title']) and !empty($_REQUEST['cat_title'])) {
+
+       $cat_title = ucfirst(strip_tags(trim($_REQUEST['cat_title'])));
+
+       if ($cat_title != file_get_contents("data/categories/{$_REQUEST['cat_id']}/title.txt")) {
+               $edit_title_file = fopen("data/categories/{$_REQUEST['cat_id']}/title.txt","w");
+               fwrite($edit_title_file,$cat_title);
+               fclose($edit_title_file);
+               chmod("data/categories/{$_REQUEST['cat_id']}/title.txt", 0666);
+       }
+}
+
+if (empty($_REQUEST['cat_title']) and file_exists("data/categories/{$_REQUEST['cat_id']}/title.txt")) {
+       unlink("data/categories/{$_REQUEST['cat_id']}/title.txt");
+}
+
+?>
+
+<style>
+body
+{
+       color: #666666;
+       margin: 10px;
+       padding: 0px;
+       text-align: left;
+       font-family: verdana, helvetica, sans-serif;
+       background-color: #FFFFFF;
+}
+p
+{
+       font-size: 11px;
+}
+a
+{
+       font-weight: bold;
+       text-decoration: none;
+}
+a:link, a:visited
+{
+       color: #666666;
+}
+a:hover
+{
+       color: #336699;
+}
+a:active {
+       color: #336699;
+}
+.input {      
+       color: #666666;
+       background: #ffffff;
+       border: #999999 solid 1px;
+       width: 300px;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px
+}
+.submit {      
+       color: #666666;
+       background: #ffffff;
+       border: #999999 solid 1px;
+       width: 100px;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px
+}
+</style>
+
+<p><b>Add Category</b></p><p>Enter a unique category ID and optional title or description.</p>
+
+<table border=0 cellspacing=1 cellpadding=2>
+<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+<tr><td><p>category id*</p></td><td><input type=text class=input name=new_id autocomplete=off maxlength=30></td></tr>
+<tr><td><p>title or description</p></td><td><input type=text class=input name=new_title autocomplete=off maxlength=90></td></tr>
+<tr><td><p></p></td><td><input type=submit class=input value="click here to add a new category"></td></tr>
+</form>
+<form enctype="multipart/form-data" action="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); ?>" method="post">
+<tr><td><p></p></td><td><input class=input type=submit value="click here to go to the index page"></td></tr>
+</form>
+</table>
+
+<?php
+       if (file_exists("data/categories")) {
+               if ($dh_cat = opendir("data/categories")) {
+                       while (($entry_cat = readdir($dh_cat)) !== false) {
+
+                               if ($entry_cat != "." && $entry_cat != ".." && fnmatch("*", $entry_cat)) {
+                                       $show_cat[] = $entry_cat;
+                               }
+                       }
+                       closedir($dh_cat);
+               }
+
+               sort($show_cat);
+               reset($show_cat);
+               $count_cat = count($show_cat);
+
+               if ($count_cat > 0) {
+
+                       echo "<p><br><b>Category Management</b></p><p>Hiding a category will make it, and all associated entries, invisible to visitors. Override per entry if needed.<br>Booking a category, for lack of a better term, will unconditionally display all associated entries from oldest to newest.<br>Deleting a category will unfile all its associated entries.</p>";
+
+                       echo "<table border=0 cellspacing=1 cellpadding=2>";
+                       echo "<tr><td><p>category id</p></td><td><p align=center>title or description</p></td><td><p align=center>hide</p></td><td><p align=center>book</p></td><td><p align=center>delete</p></td><td><p></p></td></tr>";
+
+                       foreach ($show_cat as $category) {
+                               echo '<form enctype="multipart/form-data" action="';
+                               echo $_SERVER['PHP_SELF'];
+                               echo '" method="post">';
+                               echo "<tr><td><p><b>";
+                               echo strtolower($category);
+                               echo '</b></p></td><td><p><input type=text class=input name=cat_title value="';
+                               readfile("data/categories/$category/title.txt");
+                               echo '" autocomplete=off maxlength=90></p></td><td><p align=center><input type=checkbox name=cat_hide';
+                               if (file_exists("data/categories/$category/private.txt")) {
+                                       echo " checked";
+                               }
+                               echo "></p></td>";
+                               echo "<td><p align=center><input type=checkbox name=cat_book";
+                               if (file_exists("data/categories/$category/book.txt")) {
+                                       echo " checked";
+                               }
+                               echo "></p></td>";
+                               echo "<td><p align=center><input type=checkbox name=cat_del></p></td><td><p><input type=hidden name=cat_id value=$category><input type=hidden name=cat_edit value=on><input type=submit class=submit value=submit></p></td>";
+                               echo "</tr></form>";
+                       }
+
+                       echo "</table>";
+               }
+       }
+?>
diff --git a/del.php b/del.php
new file mode 100644
index 0000000..dc7d765
--- /dev/null
+++ b/del.php
@@ -0,0 +1,252 @@
+<?php
+session_start();
+header("Cache-control: private");
+
+$username_file = 'data/username.txt';
+$open_username_file = fopen($username_file,"r");
+$login_username = fread($open_username_file,filesize($username_file));
+fclose($open_username_file);
+
+function rmdirr($recurse_dirname)
+{
+
+    if (!file_exists($recurse_dirname)) {
+        return false;
+    }
+
+    if (is_file($recurse_dirname)) {
+        return unlink($recurse_dirname);
+    }
+
+    $recurse_dir = dir($recurse_dirname);
+    while (false !== $recurse_entry = $recurse_dir->read()) {
+
+        if ($recurse_entry == '.' || $recurse_entry == '..') {
+            continue;
+        }
+
+        rmdirr("$recurse_dirname/$recurse_entry");
+    }
+
+    $recurse_dir->close();
+    return rmdir($recurse_dirname);
+}
+
+if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+       if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['target']) and !empty($_REQUEST['target'])) {
+               if ($_REQUEST['target'] == "album") {
+                       $album_dir = 'images/' . $_REQUEST['entry'] . '/album';
+                       $album_data_dir = 'data/items/' . $_REQUEST['entry'] . '/album';
+                       $album_sem = 'data/albums/' . $_REQUEST['entry'];
+                       rmdirr($album_dir);
+                       rmdirr($album_data_dir);
+                       rmdirr($album_sem);
+                       header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '?entry=' . $_REQUEST['entry']);
+               }
+               if ($_REQUEST['target'] == "filedrop") {
+                       $filedrop_data_dir = 'data/items/' . $_REQUEST['entry'] . '/filedrop';
+                       rmdirr($filedrop_data_dir);
+                       header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '?entry=' . $_REQUEST['entry']);
+               }
+       }
+       if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_REQUEST['type']) and !empty($_REQUEST['type'])) {
+               $comment_dir = 'data/items/' . $_REQUEST['entry'] .'/comments/' . $_REQUEST['type'] . '/' . $_REQUEST['comment'];
+               rmdirr($comment_dir);
+               $pending_comment_flag_dir = 'data/comments/pending/' . $_REQUEST['entry'];
+               if (file_exists($pending_comment_flag_dir) and ($_REQUEST['type'] == "pending")) {
+                       $fp_comment_count_txt = fopen("$pending_comment_flag_dir/count.txt","r");
+                       $comment_count_value = fread($fp_comment_count_txt,filesize("$pending_comment_flag_dir/count.txt"));
+                       fclose($fp_comment_count_txt);
+                       if ($comment_count_value <= 1) {
+                               rmdirr($pending_comment_flag_dir);
+                       }
+                       else {
+                               $fp_comment_count_txt = fopen("$pending_comment_flag_dir/count.txt","r");
+                               $comment_count_value = fread($fp_comment_count_txt,filesize("$pending_comment_flag_dir/count.txt"));
+                               fclose($fp_comment_count_txt);
+                               $comment_count_value = $comment_count_value - 1;
+                               $fp_comment_count_txt = fopen("$pending_comment_flag_dir/count.txt","w");
+                               fwrite($fp_comment_count_txt, $comment_count_value);
+                               fclose($fp_comment_count_txt);
+                       }
+               }
+               header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '?entry=' . $_REQUEST['entry'] . '&show=comments');
+       }
+
+       if ($_REQUEST['action'] == delete) {
+               $entry_dir = 'data/items/' . $_REQUEST['entry'];
+               $image_dir = 'images/' . $_REQUEST['entry'];
+               $album_sem_dir = 'data/albums/' . $_REQUEST['entry'];
+               $sticky_sem = 'data/sticky/' . $_REQUEST['entry'];
+               $pending_comment_flag_dir = 'data/comments/pending/' . $_REQUEST['entry'];
+               if (file_exists($entry_dir)) {
+                       rmdirr($entry_dir);
+               }
+               if (file_exists($image_dir)) {
+                       rmdirr($image_dir);
+               }
+               if (file_exists($album_sem_dir)) {
+                       rmdirr($album_sem_dir);
+               }
+               if (file_exists($sticky_sem)) {
+                       unlink($sticky_sem);
+               }
+               if (file_exists($pending_comment_flag_dir)) {
+                       rmdirr($pending_comment_flag_dir);
+               }
+               header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']));
+       }
+
+       if ($_REQUEST['action'] == edit) {
+               $edit_url = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/edit.php?entry=" . $_REQUEST['entry'];
+               $edit_url = str_replace("//edit.php", "/edit.php", $edit_url);
+               header("Location: $edit_url");
+       }
+
+       if ($_REQUEST['action'] == home) {
+               header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']));
+       }
+}
+
+if (!isset($_REQUEST['entry'])) {
+       exit();
+}
+
+if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
+       exit();
+}
+
+$entry_dir = 'data/items/' . $_REQUEST['entry'];
+$title_file = 'data/items/' . $_REQUEST['entry'] . '/title.txt';
+$body_file = 'data/items/' . $_REQUEST['entry'] . '/body.txt';
+$date_file = 'data/items/' . $_REQUEST['entry'] . '/date.txt';
+$img_file = 'data/items/' . $_REQUEST['entry'] . '/img.txt';
+
+?>
+
+<style>
+body
+{
+       color: #666666;
+       margin: 10px;
+       padding: 0px;
+       text-align: left;
+       font-family: verdana, helvetica, sans-serif;
+       background-color: #FFFFFF;
+}
+
+p
+{
+       font-size: 11px;
+}
+
+a
+{
+       font-weight: bold;
+       text-decoration: none;
+}
+
+a:link, a:visited
+{
+       color: #666666;
+}
+
+a:hover
+{
+       color: #336699;
+}
+
+a:active {
+       color: #336699;
+}
+.input_title {        
+       color: #666666;
+       background: #ffffff;
+       border: #999999 solid 1px;
+       width: 525px;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px;
+       font-weight: bold
+}
+.input_body {  
+       color: #666666;
+       background: #ffffff;
+       border: #999999 solid 1px;
+       width: 525px;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px
+}
+.input_submit {        
+       color: #666666;
+       background: #ffffff;
+       border: #999999 solid 1px;
+       width: 125px;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px
+}
+#panel_title
+{
+       font-family: verdana, helvetica, sans-serif;
+       font-size: 12px;
+       font-weight: bold;
+       color: #666666;
+       padding: 5px 5px 5px 5px;
+       background-color: #FFFFFF;
+       margin: 0px;
+       border-color: #CCCCCC;
+       border-width: 1px 1px 0px 1px;
+       border-style: solid solid none solid;
+}
+#panel_body
+{
+       font-family: verdana, helvetica, sans-serif;
+       font-size: 11px;
+       color: #666666;
+       padding: 5px 5px 5px 5px;
+       background-color: #FFFFFF;
+       margin: 0px;
+       border-color: #CCCCCC;
+       border-width: 1px 1px 1px 1px;
+       border-style: solid solid solid solid;
+}
+#panel_footer
+{
+       font-family: verdana, helvetica, sans-serif;
+       font-size: 11px;
+       color: #666666;
+       padding: 5px 5px 5px 5px;
+       background-color: #FFFFFF;
+       margin: 0px;
+       border-color: #CCCCCC;
+       border-width: 0px 1px 1px 1px;
+       border-style: none solid solid solid;
+}
+</style>
+
+<p><table border=0 cellspacing=0 cellpadding=0 bgcolor=#CCCCCC><tr><td width=525>
+<div id=panel_title><?php readfile($title_file); ?></div>
+<div id=panel_body><?php readfile($body_file); ?></div>
+<div id=panel_footer><font style="font-size: 10px; color: #999999;"><?php readfile($date_file); ?></font></div>
+</td></tr></table></p>
+
+<p><table border=0 cellspacing=2 cellpadding=0>
+<tr><td>
+<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+<input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
+<input type=hidden name=action value=delete>
+<input class=input_submit type=submit value=delete>
+</form>
+</td><td>
+<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+<input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
+<input type=hidden name=action value=edit>
+<input class=input_submit type=submit value=edit>
+</form>
+</td><td>
+<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+<input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
+<input type=hidden name=action value=home>
+<input class=input_submit type=submit value=home>
+</form>
+</td></tr>
+</table>
diff --git a/dig.php b/dig.php
new file mode 100644
index 0000000..c20075f
--- /dev/null
+++ b/dig.php
@@ -0,0 +1,173 @@
+<?php
+
+session_start();
+header("Cache-control: private");
+
+?>
+
+<title>Dig!</title>
+
+<style>
+body
+{
+       color: #666666;
+       margin: 10px;
+       padding: 0px;
+       text-align: left;
+       font-family: verdana, helvetica, sans-serif;
+       background-color: #FFFFFF;
+}
+
+p
+{
+       font-size: 11px;
+}
+
+a
+{
+       font-weight: bold;
+       text-decoration: none;
+}
+
+a:link, a:visited
+{
+       color: #666666;
+}
+
+a:hover
+{
+       color: #336699;
+}
+
+a:active {
+       color: #336699;
+}
+</style>
+
+<?php
+
+$username_file = 'data/username.txt';
+$open_username_file = fopen($username_file,"r");
+$login_username = fread($open_username_file,filesize($username_file));
+fclose($open_username_file);
+
+if (!isset($_REQUEST['search'])) {
+       exit();
+}
+
+if (empty($_REQUEST['search'])) {
+       echo "<p>Search string required. Click <a href=index.php>here</a> to go to the index page.</p>";
+       exit();
+}
+
+$search = trim(strip_tags(strtolower($_REQUEST['search'])));
+
+$google = str_replace(" ", "+", $search);
+
+if (strlen($search) < 3) {
+       echo "<p>Search string must be composed of 3 or more characters. Click <a href=index.php>here</a> to go to the index page.</p>";
+       exit();
+}
+
+$dir = "data/items";
+
+if ($dh_search_items = opendir($dir)) {
+       while (($entry_search_items = readdir($dh_search_items)) !== false) {
+
+               $cat_dir = file_get_contents("data/items/$entry_search_items/category.txt");
+
+               if (file_exists("data/categories/$cat_dir/private.txt") and !file_exists("data/items/$entry_search_items/cat.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                       continue;
+               }
+
+               if (file_exists("data/items/$entry_search_items/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                       continue;
+               }
+
+               if ($entry_search_items != "." && $entry_search_items != "..") {
+                       $total_entries[] = $entry_search_items;
+               }
+
+               if ($entry_search_items != "." && $entry_search_items != ".." && fnmatch("*", $entry_search_items) && (preg_match("/\b$search\b/i", file_get_contents("data/items/$entry_search_items/title.txt")) or preg_match("/\b$search\b/i", file_get_contents("data/items/$entry_search_items/body.txt")))) {
+                       $show_search_items[] = $entry_search_items;
+               }
+       }
+       closedir($dh_search_items);
+}
+
+rsort($show_search_items);
+reset($show_search_items);
+$count_search_items = count($show_search_items);
+
+reset($total_entries);
+$count_total_items = count($total_entries);
+
+if (($count_search_items > 0) and ($count_total_items > 0)) {
+
+       echo "<p>Found <b>$search</b> in $count_search_items out of $count_total_items ";
+       if ($count_total_items == 1) {
+               echo "entry";
+       }
+       if ($count_total_items > 1) {
+               echo "entries";
+       }
+       echo ".</p>";
+
+       $increment_search_entries = 0;
+
+       while ($increment_search_entries <= ($count_search_items - 1)) {
+               $link = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php?entry=$show_search_items[$increment_search_entries]";
+               $fix_link = array('//index.php', '///index.php');
+               $link = str_replace($fix_link, '/index.php', $link);
+               $link = trim($link);
+               echo "<p><a href=$link>";
+               readfile("data/items/$show_search_items[$increment_search_entries]/title.txt");
+               echo "</a><br>";
+               readfile("data/items/$show_search_items[$increment_search_entries]/date.txt");
+               echo "<br>";
+
+               $body = file_get_contents("data/items/$show_search_items[$increment_search_entries]/body.txt");
+               $body = strip_tags($body);
+               $body = trim($body);
+               // comment out next line for _long_ quote
+               $body = str_replace(".","<br />", $body);
+               $body = nl2br($body);
+               $body = explode("<br />", $body);
+               foreach ($body as $line) {
+                       if (preg_match("/\b$search\b/i", $line)) {
+                               $line = str_replace($search, "<span style=\"background-color: #ffff00;\">$search</span>", $line);
+                               $ucfirst_line = ucfirst($search);
+                               $line = str_replace($ucfirst_line, "<span style=\"background-color: #ffff00;\">$ucfirst_line</span>", $line);
+
+                               $strtoupper_line = strtoupper($search);
+                               $line = str_replace($strtoupper_line, "<span style=\"background-color: #ffff00;\">$strtoupper_line</span>", $line);
+
+                               $ucwords_line = ucwords($search);
+                               $line = str_replace($ucwords_line, "<span style=\"background-color: #ffff00;\">$ucwords_line</span>", $line);
+
+                               echo "$line ...<br>";
+                       }
+               }
+
+               echo str_replace("http://","",$link);
+
+               $size = filesize("data/items/$show_search_items[$increment_search_entries]/body.txt");
+               $size_string = ($size > 512)?(  ($size/1024 > 512)  ?sprintf("%.02f MB",($size/1024)/1024)  :sprintf("%.02f KB",$size/1024))  :sprintf("%d B",$size);
+               echo " - $size_string";
+               echo "</p>";
+               $increment_search_entries = $increment_search_entries + 1;
+       }
+echo "<p>Click <a href=http://google.com/search?q=$google rel=nofollow target=_maj>here</a> to search for <b>$search</b> with Google.<br>Click <a href=index.php>here</a> to go to the index page.</p>";
+}
+else {
+       echo "<p>Search string not found in $count_total_items ";
+       if ($count_total_items == 1) {
+               echo "entry";
+       }
+       if ($count_total_items > 1) {
+               echo "entries";
+       }
+       echo ".<br>Click <a href=http://google.com/search?q=$google rel=nofollow target=_maj>here</a> to search for <b>$search</b> with Google.<br>Click <a href=index.php>here</a> to go to the index page.</p>";
+}
+
+?>
diff --git a/edit.php b/edit.php
new file mode 100644
index 0000000..2c727f3
--- /dev/null
+++ b/edit.php
@@ -0,0 +1,687 @@
+<?php
+session_start();
+header("Cache-control: private");
+
+$username_file = 'data/username.txt';
+$open_username_file = fopen($username_file,"r");
+$login_username = fread($open_username_file,filesize($username_file));
+fclose($open_username_file);
+
+function rmdirr($recurse_dirname)
+{
+
+    if (!file_exists($recurse_dirname)) {
+        return false;
+    }
+
+    if (is_file($recurse_dirname)) {
+        return unlink($recurse_dirname);
+    }
+
+    $recurse_dir = dir($recurse_dirname);
+    while (false !== $recurse_entry = $recurse_dir->read()) {
+
+        if ($recurse_entry == '.' || $recurse_entry == '..') {
+            continue;
+        }
+
+        rmdirr("$recurse_dirname/$recurse_entry");
+    }
+
+    $recurse_dir->close();
+    return rmdir($recurse_dirname);
+}
+
+if (isset($_REQUEST['title_input']) and isset($_REQUEST['body_input'])) {
+       header("Location: http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?entry=" . $_REQUEST['entry']);
+}
+
+if (!isset($_REQUEST['entry'])) {
+       exit();
+}
+
+if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
+       exit();
+}
+
+$title_file = 'data/items/' . $_REQUEST['entry'] . '/title.txt';
+$body_file = 'data/items/' . $_REQUEST['entry'] . '/body.txt';
+$date_file = 'data/items/' . $_REQUEST['entry'] . '/date.txt';
+$img_file = 'data/items/' . $_REQUEST['entry'] . '/image.txt';
+$revisions_file = 'data/items/' . $_REQUEST['entry'] . '/revisions.txt';
+
+$image_path = "images/";
+$max_image_size = 2000000;
+$max_file_size = 2000000;
+
+if (file_exists("data/items/{$_REQUEST['entry']}/category.txt")) {
+       $category_check = 'data/categories/' . file_get_contents("data/items/{$_REQUEST['entry']}/category.txt");
+       if (!file_exists($category_check)) {
+               unlink("data/items/{$_REQUEST['entry']}/category.txt");
+       }
+}
+
+?>
+
+<style>
+body
+{
+       color: #666666;
+       margin: 10px;
+       padding: 0px;
+       text-align: left;
+       font-family: verdana, helvetica, sans-serif;
+       background-color: #FFFFFF;
+}
+
+p
+{
+       font-size: 11px;
+}
+
+a
+{
+       font-weight: bold;
+       text-decoration: none;
+}
+
+a:link, a:visited
+{
+       color: #666666;
+}
+
+a:hover
+{
+       color: #336699;
+}
+
+a:active {
+       color: #336699;
+}
+.input_title {        
+       color: #666666;
+       background: #ffffff;
+       border: #999999 solid 1px;
+       width: 525px;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px;
+       font-weight: bold
+}
+.input_body {  
+       color: #666666;
+       background: #ffffff;
+       border: #999999 solid 1px;
+       width: 525px;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px
+}
+#panel_title
+{
+       font-family: verdana, helvetica, sans-serif;
+       font-size: 12px;
+       font-weight: bold;
+       color: #666666;
+       padding: 5px 5px 5px 5px;
+       background-color: #FFFFFF;
+       margin: 0px;
+       border-color: #CCCCCC;
+       border-width: 1px 1px 0px 1px;
+       border-style: solid solid none solid;
+}
+#panel_body
+{
+       font-family: verdana, helvetica, sans-serif;
+       font-size: 11px;
+       color: #666666;
+       padding: 5px 5px 5px 5px;
+       background-color: #FFFFFF;
+       margin: 0px;
+       border-color: #CCCCCC;
+       border-width: 1px 1px 1px 1px;
+       border-style: solid solid solid solid;
+}
+#panel_footer
+{
+       font-family: verdana, helvetica, sans-serif;
+       font-size: 11px;
+       color: #666666;
+       padding: 5px 5px 5px 5px;
+       background-color: #FFFFFF;
+       margin: 0px;
+       border-color: #CCCCCC;
+       border-width: 0px 1px 1px 1px;
+       border-style: none solid solid solid;
+}
+</style>
+
+<?php
+
+if (isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_REQUEST['comment_txt']) and !empty($_REQUEST['comment_txt'])) {
+
+       $comment_txt = ucfirst($_REQUEST['comment_txt']);
+       $comment_txt = htmlentities($comment_txt, ENT_NOQUOTES);
+       // $comment_txt = str_replace('href=', 'rel=nofollow target=_blank href=', $comment_txt);
+       $comment_txt = str_replace("\n", '<br />', $comment_txt);
+       $comment_txt = str_replace(':((', '<img src=images/smileys/crying.png border=0>', $comment_txt);
+       $comment_txt = str_replace(':(', '<img src=images/smileys/frown.png border=0>', $comment_txt);
+       $comment_txt = str_replace(':|', '<img src=images/smileys/indifferent.png border=0>', $comment_txt);
+       $comment_txt = str_replace(':D', '<img src=images/smileys/laughing.png border=0>', $comment_txt);
+       $comment_txt = str_replace(':P', '<img src=images/smileys/lick.png border=0>', $comment_txt);
+       $comment_txt = str_replace(':O', '<img src=images/smileys/ohno.png border=0>', $comment_txt);
+       $comment_txt = str_replace(':)', '<img src=images/smileys/smile.png border=0>', $comment_txt);
+       $comment_txt = str_replace('=)', '<img src=images/smileys/surprised.png border=0>', $comment_txt);
+       $comment_txt = str_replace(':\\', '<img src=images/smileys/undecided.png border=0>', $comment_txt);
+       $comment_txt = str_replace(';)', '<img src=images/smileys/wink.png border=0>', $comment_txt);
+       $comment_txt_file = "data/items/{$_REQUEST['entry']}/comments/live/{$_REQUEST['comment']}/comment.txt";
+       $open_comment_txt_file = fopen($comment_txt_file,"w");
+       fwrite($open_comment_txt_file,$comment_txt);
+       fclose($open_comment_txt_file);
+       chmod($comment_txt_file, 0666);
+
+       $comment_revisions_file = "data/items/{$_REQUEST['entry']}/comments/live/{$_REQUEST['comment']}/revisions.txt";
+       $fp_comment_revisions_file = fopen($comment_revisions_file, "r");
+       $comment_revisions_count = fread($fp_comment_revisions_file, filesize($comment_revisions_file));
+       fclose($fp_comment_revisions_file);
+       $comment_revisions_count = $comment_revisions_count + 1;
+       $fp_comment_revisions_file = fopen($comment_revisions_file, "w");
+       fwrite($fp_comment_revisions_file, $comment_revisions_count);
+       fclose($fp_comment_revisions_file);
+       chmod($comment_revisions_file, 0666);
+
+}
+
+if (isset($_REQUEST['comment']) and !empty($_REQUEST['comment'])) { ?>
+       <p><table border=0 cellspacing=0 cellpadding=0 bgcolor=#CCCCCC><tr><td width=525>
+       <div id=panel_title><?php readfile("data/items/{$_REQUEST['entry']}/comments/live/{$_REQUEST['comment']}/firstname.txt"); ?>&nbsp;<?php readfile("data/items/{$_REQUEST['entry']}/comments/live/{$_REQUEST['comment']}/lastname.txt"); ?>&nbsp;&lt;<?php readfile("data/items/{$_REQUEST['entry']}/comments/live/{$_REQUEST['comment']}/email.txt"); ?>&gt;</div>
+       <div id=panel_body><?php readfile("data/items/{$_REQUEST['entry']}/comments/live/{$_REQUEST['comment']}/comment.txt"); ?></div>
+       <div id=panel_footer><font style="font-size: 10px; color: #999999;">
+       <?php
+               readfile("data/items/{$_REQUEST['entry']}/comments/live/{$_REQUEST['comment']}/timestamp.txt");
+               if (file_exists("data/items/{$_REQUEST['entry']}/comments/live/{$_REQUEST['comment']}/revisions.txt")) {
+                       echo " (Revision ";
+                       readfile("data/items/{$_REQUEST['entry']}/comments/live/{$_REQUEST['comment']}/revisions.txt");
+                       echo ")";
+               }
+       ?>
+       </font></div>
+       </td></tr></table></p>
+
+       <p><table border=0 cellspacing=2 cellpadding=0>
+       <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+       <tr><td><textarea class=input_body name=comment_txt rows=10><?php
+
+       $comment_txt_file = "data/items/{$_REQUEST['entry']}/comments/live/{$_REQUEST['comment']}/comment.txt";
+       $open_comment_txt_file = fopen($comment_txt_file,"r");
+       $read_comment_txt_file = fread($open_comment_txt_file,filesize($comment_txt_file));
+       fclose($open_comment_txt_file);
+
+       $comment_smiley2emoticon = str_replace('<br />', "\n", $read_comment_txt_file);
+
+       $comment_smiley2emoticon = str_replace('<img src=images/smileys/crying.png border=0>', ':((', $comment_smiley2emoticon);
+
+       $comment_smiley2emoticon = str_replace('<img src=images/smileys/frown.png border=0>', ':(', $comment_smiley2emoticon);
+
+       $comment_smiley2emoticon = str_replace('<img src=images/smileys/indifferent.png border=0>', ':|', $comment_smiley2emoticon);
+
+       $comment_smiley2emoticon = str_replace('<img src=images/smileys/laughing.png border=0>', ':D', $comment_smiley2emoticon);
+
+       $comment_smiley2emoticon = str_replace('<img src=images/smileys/lick.png border=0>', ':P', $comment_smiley2emoticon);
+
+       $comment_smiley2emoticon = str_replace('<img src=images/smileys/ohno.png border=0>', ':O', $comment_smiley2emoticon);
+
+       $comment_smiley2emoticon = str_replace('<img src=images/smileys/smile.png border=0>', ':)', $comment_smiley2emoticon);
+
+       $comment_smiley2emoticon = str_replace('<img src=images/smileys/surprised.png border=0>', '=)', $comment_smiley2emoticon);
+
+       $comment_smiley2emoticon = str_replace('<img src=images/smileys/undecided.png border=0>', ':\\', $comment_smiley2emoticon);
+
+       $comment_smiley2emoticon = str_replace('<img src=images/smileys/wink.png border=0>', ';)', $comment_smiley2emoticon);
+
+       echo $comment_smiley2emoticon;
+
+       ?></textarea></td></tr>
+       <tr><td><input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>"></td></tr>
+       <tr><td><input type=hidden name=comment value="<?php echo $_REQUEST['comment']; ?>"></td></tr>
+       <tr><td><input class=input_body type=submit value="click here to update this comment"></td></tr>
+       </form>
+
+       <form enctype="multipart/form-data" action="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); ?>" method="post">
+       <tr><td><input class=input_body type=submit value="click here to go to the index page"></td></tr>
+       </form>
+       </table></p>
+
+<?php
+       exit();
+}
+
+?>
+
+<p><table border=0 cellspacing=0 cellpadding=0 bgcolor=#CCCCCC><tr><td width=525>
+
+<div id=panel_title><?php readfile($title_file); ?></div>
+<div id=panel_body><?php readfile($body_file); ?></div>
+<div id=panel_footer><font style="font-size: 10px; color: #999999;"><?php readfile($date_file); ?><?php
+if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+       if (file_exists($revisions_file)) {
+                       echo ' (Revision ';
+                       readfile($revisions_file);
+                       echo ')';
+       }
+       if (file_exists("data/items/{$_REQUEST['entry']}/category.txt")) {
+               echo ' Filed under ';
+               $category_key = file_get_contents("data/items/{$_REQUEST['entry']}/category.txt");
+               $category_key = strtolower($category_key);
+               if (file_exists("data/categories/{$category_key}/title.txt")) {
+                       $category_dsp = file_get_contents("data/categories/{$category_key}/title.txt");
+                       echo "$category_key ($category_dsp)";
+               }
+               else {
+                       echo "$category_key";
+               }
+       }
+}
+?></font></div>
+</td></tr></table></p>
+
+<p>
+<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_image_size; ?>">
+<input autocomplete=off type=file name=album_image_input> Upload optional album image. Enter optional caption below.</p>
+<p><input autocomplete=off type=text name=caption class=input_body></p>
+<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
+<input autocomplete=off type=file name=entry_image_input> Upload optional entry image.</p>
+<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
+<input autocomplete=off type=file name=file_input> Upload optional file.</p>
+<?php
+       if (file_exists("data/categories")) {
+               if ($dh_cat = opendir("data/categories")) {
+                       while (($entry_cat = readdir($dh_cat)) !== false) {
+
+                               if ($entry_cat != "." && $entry_cat != ".." && fnmatch("*", $entry_cat)) {
+                                       $show_cat[] = $entry_cat;
+                               }
+                       }
+                       closedir($dh_cat);
+               }
+
+               sort($show_cat);
+               reset($show_cat);
+               $count_cat = count($show_cat);
+
+               if ($count_cat > 0) {
+
+                       echo "<p><select name=category><option selected>";
+                       if (file_exists("data/items/{$_REQUEST['entry']}/category.txt")) {
+                               readfile("data/items/{$_REQUEST['entry']}/category.txt");
+                               echo '<option>unfiled';
+                       }
+                       else {
+                               echo "unfiled";
+                       }
+
+
+                       foreach ($show_cat as $category) {
+                               echo "<option>";
+                               echo strtolower($category);
+                       }
+
+                       echo "</select> Select category.</p>";
+
+               }
+       }
+?>
+<p><input type=checkbox name=sticky <?php $sticky_sem = 'data/sticky/' . $_REQUEST['entry']; if (file_exists($sticky_sem)) { echo checked; } ?>>Put entry title in Links box.<br>
+<input type=checkbox name=display <?php $display_sem = "data/items/{$_REQUEST['entry']}/cat.txt"; if (file_exists($display_sem)) { echo checked; } ?>>Always display. If this is not a private entry, it will be displayed even if its category is hidden or isolated.<br>
+<input type=checkbox name=private <?php $private_sem = "data/items/{$_REQUEST['entry']}/private.txt"; if (file_exists($private_sem)) { echo checked; } ?>>Private entry. This entry will unconditionally be invisible to visitors, even if always display is set.</p>
+<input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
+
+<table border=0 cellspacing=0 cellpadding=0><tr><td>
+
+<table border=0 cellspacing=2 cellpadding=0>
+<tr><td><input autocomplete=off class=input_title type=text name=title_input value="<?php readfile($title_file); ?>"></td></tr>
+<tr><td><textarea class=input_body name=body_input rows=15>
+<?php
+
+$open_body_file = fopen($body_file,"r");
+$read_body_file = fread($open_body_file,filesize($body_file));
+fclose($open_body_file);
+
+$body_read_content = str_replace('<br />', "\n", $read_body_file);
+$body_read_content = str_replace('<img src=images/smileys/crying.png border=0>', ':((', $body_read_content);
+$body_read_content = str_replace('<img src=images/smileys/frown.png border=0>', ':(', $body_read_content);
+$body_read_content = str_replace('<img src=images/smileys/indifferent.png border=0>', ':|', $body_read_content);
+$body_read_content = str_replace('<img src=images/smileys/laughing.png border=0>', ':D', $body_read_content);
+$body_read_content = str_replace('<img src=images/smileys/lick.png border=0>', ':P', $body_read_content);
+$body_read_content = str_replace('<img src=images/smileys/ohno.png border=0>', ':O', $body_read_content);
+$body_read_content = str_replace('<img src=images/smileys/smile.png border=0>', ':)', $body_read_content);
+$body_read_content = str_replace('<img src=images/smileys/surprised.png border=0>', '=)', $body_read_content);
+$body_read_content = str_replace('<img src=images/smileys/undecided.png border=0>', ':\\', $body_read_content);
+$body_read_content = str_replace('<img src=images/smileys/wink.png border=0>', ';)', $body_read_content);
+
+echo $body_read_content;
+
+?>
+</textarea></td></tr>
+<tr><td><input class=input_body type=submit value="click here to update this entry"></td></tr>
+</form>
+
+<form enctype="multipart/form-data" action="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); ?>" method="post">
+<tr><td><input class=input_body type=submit value="click here to go to the index page"></td></tr>
+</form>
+
+</table>
+
+</td><td width=10></td><td>
+
+<table border=0 cellspacing=1 cellpadding=2>
+<tr><td><img src=images/smileys/crying.png border=0></td><td><p>:((</p></td><td ><p>crying</p></td></tr>
+<tr><td><img src=images/smileys/frown.png border=0></td><td><p>:(</p></td><td><p>frown</p></td></tr>
+<tr><td><img src=images/smileys/indifferent.png border=0></td><td><p>:|</p></td><td><p>indifferent</p></td></tr>
+<tr><td><img src=images/smileys/laughing.png border=0></td><td><p>:D</p></td><td><p>laughing</p></td></tr>
+<tr><td><img src=images/smileys/lick.png border=0></td><td><p>:P</p></td><td><p>lick</p></td></tr>
+<tr><td><img src=images/smileys/ohno.png border=0></td><td><p>:O</p></td><td><p>oh no!</p></td></tr>
+<tr><td><img src=images/smileys/smile.png border=0></td><td><p>:)</p></td><td><p>smile</p></td></tr>
+<tr><td><img src=images/smileys/surprised.png border=0></td><td><p>=)</p></td><td><p>surprised</p></td></tr>
+<tr><td><img src=images/smileys/undecided.png border=0></td><td><p>:\</p></td><td><p>undecided</p></td></tr>
+<tr><td><img src=images/smileys/wink.png border=0></td><td><p>;)</p></td><td><p>wink</p></td></tr>
+</td></tr>
+</table>
+
+</td></tr></table>
+
+
+<?php
+if (!isset($_REQUEST['title_input']) or !isset($_REQUEST['body_input']) or empty($_REQUEST['title_input']) or empty($_REQUEST['body_input'])) {
+       exit();
+}
+
+$title_write_content = ucfirst($_REQUEST['title_input']);
+$open_title_file = fopen($title_file,"w");
+fwrite($open_title_file,$title_write_content);
+fclose($open_title_file);
+chmod($title_file, 0666);
+
+$body_write_content = ucfirst($_REQUEST['body_input']);
+$body_write_content = str_replace( "\n", '<br />', $body_write_content);
+$body_write_content = str_replace(':((', '<img src=images/smileys/crying.png border=0>', $body_write_content);
+$body_write_content = str_replace(':(', '<img src=images/smileys/frown.png border=0>', $body_write_content);
+$body_write_content = str_replace(':|', '<img src=images/smileys/indifferent.png border=0>', $body_write_content);
+$body_write_content = str_replace(':D', '<img src=images/smileys/laughing.png border=0>', $body_write_content);
+$body_write_content = str_replace(':P', '<img src=images/smileys/lick.png border=0>', $body_write_content);
+$body_write_content = str_replace(':O', '<img src=images/smileys/ohno.png border=0>', $body_write_content);
+$body_write_content = str_replace(':)', '<img src=images/smileys/smile.png border=0>', $body_write_content);
+$body_write_content = str_replace('=)', '<img src=images/smileys/surprised.png border=0>', $body_write_content);
+$body_write_content = str_replace(':\\', '<img src=images/smileys/undecided.png border=0>', $body_write_content);
+$body_write_content = str_replace(';)', '<img src=images/smileys/wink.png border=0>', $body_write_content);
+$body_write_content = str_replace('[b]', '<b>', $body_write_content);
+$body_write_content = str_replace('[/b]', '</b>', $body_write_content);
+$body_write_content = str_replace('[i]', '<i>', $body_write_content);
+$body_write_content = str_replace('[/i]', '</i>', $body_write_content);
+$body_write_content = str_replace('[u]', '<u>', $body_write_content);
+$body_write_content = str_replace('[/u]', '</u>', $body_write_content);
+$body_write_content = str_replace('[strike]', '<strike>', $body_write_content);
+$body_write_content = str_replace('[/strike]', '</strike>', $body_write_content);
+
+$fp_revisions_file = fopen($revisions_file, "r");
+$revisions_count = fread($fp_revisions_file, filesize($revisions_file));
+fclose($fp_revisions_file);
+$revisions_count = $revisions_count + 1;
+$fp_revisions_file = fopen($revisions_file, "w");
+fwrite($fp_revisions_file, $revisions_count);
+fclose($fp_revisions_file);
+chmod($revisions_file, 0666);
+
+if (isset($_FILES['album_image_input']) and !empty($_FILES['album_image_input'])) {
+
+       if (is_uploaded_file($_FILES['album_image_input']['tmp_name'])) {
+
+               if ($_FILES['album_image_input']['size']<=$max_image_size) {
+
+                       if (($_FILES['album_image_input']['type']=="image/gif") || ($_FILES['album_image_input']['type']=="image/pjpeg") || ($_FILES['album_image_input']['type']=="image/jpeg") || ($_FILES['album_image_input']['type']=="image/png")) {
+
+                               if (!file_exists($image_path . $_REQUEST['entry'] . '/album/' . $_FILES['album_image_input']['name'])) {
+
+                                       $image_dir = $image_path . $_REQUEST['entry'];
+                                       if (!file_exists($image_dir)) {
+                                               mkdir($image_dir, 0777);
+                                               chmod($image_dir, 0777);
+                                       }
+                                       $album_dir = $image_path . $_REQUEST['entry'] . '/album';
+                                       if (!file_exists($album_dir)) {
+                                               mkdir($album_dir, 0777);
+                                               chmod($album_dir, 0777);
+                                       }
+                                       $album_sem = 'data/albums/' . $_REQUEST['entry'];
+                                       if (!file_exists("data/albums")) {
+                                               mkdir("data/albums", 0777);
+                                               chmod("data/albums", 0777);
+                                       }
+                                       if (!file_exists($album_sem)) {
+                                               mkdir($album_sem, 0777);
+                                               chmod($album_sem, 0777);
+                                       }
+                                       if (isset($_REQUEST['caption']) and !empty($_REQUEST['caption'])) {
+                                               $album_data_dir = 'data/items/' . $_REQUEST['entry'] . '/album';
+                                               if (!file_exists($album_data_dir)) {
+                                                       mkdir($album_data_dir, 0777);
+                                                       chmod($album_data_dir, 0777);
+                                               }
+                                               $caption_dir = 'data/items/' . $_REQUEST['entry'] . '/album/captions';
+                                               if (!file_exists($caption_dir)) {
+                                                       mkdir($caption_dir, 0777);
+                                                       chmod($caption_dir, 0777);
+                                               }
+                                               $caption_file = 'data/items/' . $_REQUEST['entry'] . '/album/captions/' . $_FILES['album_image_input']['name'] . '.txt';
+                                               if (!file_exists($caption_file)) {
+                                                       $fp_caption_txt = fopen($caption_file,"w");
+                                                       fwrite($fp_caption_txt,$_REQUEST['caption']);
+                                                       fclose($fp_caption_txt);
+                                                       chmod($caption_file, 0666);
+                                               }
+                                       }
+
+                                       $res = copy($_FILES['album_image_input']['tmp_name'], $album_dir . '/' . $_FILES['album_image_input']['name']);
+                                       unlink($_FILES['album_image_input']['tmp_name']);
+
+                               }
+                               else {
+                                       unlink($_FILES['album_image_input']['tmp_name']);
+                               }
+
+                       }
+                       else {
+                               unlink($_FILES['album_image_input']['tmp_name']);
+                       }
+
+               }
+               else {
+                       unlink($_FILES['album_image_input']['tmp_name']);
+               }
+
+       }
+       else {
+               unlink($_FILES['album_image_input']['tmp_name']);
+       }
+
+}
+
+if (isset($_FILES['entry_image_input']) and !empty($_FILES['entry_image_input'])) {
+
+       if (is_uploaded_file($_FILES['entry_image_input']['tmp_name'])) {
+
+               if ($_FILES['entry_image_input']['size']<=$max_image_size) {
+
+                       if (($_FILES['entry_image_input']['type']=="image/gif") || ($_FILES['entry_image_input']['type']=="image/pjpeg") || ($_FILES['entry_image_input']['type']=="image/jpeg") || ($_FILES['entry_image_input']['type']=="image/png")) {
+
+                               if (!file_exists($image_path . $_REQUEST['entry'] . '/' . $_FILES['entry_image_input']['name'])) {
+
+                                       $image_dir = $image_path . $_REQUEST['entry'];
+                                       if (!file_exists($image_dir)) {
+                                               mkdir($image_dir, 0777);
+                                               chmod($image_dir, 0777);
+                                       }
+
+                                       $res = copy($_FILES['entry_image_input']['tmp_name'], $image_path . $_REQUEST['entry'] . '/' . $_FILES['entry_image_input']['name']);
+                                       unlink($_FILES['entry_image_input']['tmp_name']);
+
+                                       $entry_image_size = getimagesize($image_path . $_REQUEST['entry'] . '/' . $_FILES['entry_image_input']['name']);
+                                       $entry_image_width = $entry_image_size[0];
+                                       $entry_image_height = $entry_image_size[1];
+
+                                       $max_entry_image_width = 513;
+
+                                       if ($entry_image_width > $max_entry_image_width) {  
+                                               $sizefactor = (double) ($max_entry_image_width / $entry_image_width) ;
+                                               $entry_image_width = (int) ($entry_image_width * $sizefactor);
+                                               $entry_image_height = (int) ($entry_image_height * $sizefactor);
+                                       }
+
+                                       $body_write_content = '<img src=' . $image_path . $_REQUEST['entry'] . '/' . $_FILES['entry_image_input']['name'] . ' border=0 width=' . $entry_image_width . ' height=' . $entry_image_height . '><br>' . $body_write_content;
+
+                               }
+                               else {
+                                       unlink($_FILES['entry_image_input']['tmp_name']);
+                               }
+                       }
+                       else {
+                               unlink($_FILES['entry_image_input']['tmp_name']);
+                       }
+               }
+               else {
+                       unlink($_FILES['entry_image_input']['tmp_name']);
+               }
+       }
+       else {
+               unlink($_FILES['entry_image_input']['tmp_name']);
+       }
+}
+
+if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
+       if (is_uploaded_file($_FILES['file_input']['tmp_name'])) {
+               if ($_FILES['file_input']['size']<=$max_file_size) {
+                       $filedrop_dir = 'data/items/' . $_REQUEST['entry'] . '/filedrop';
+                       if (!file_exists($filedrop_dir)) {
+                               mkdir($filedrop_dir, 0777);
+                               chmod($filedrop_dir, 0777);
+                       }
+                       $file_dir = 'data/items/' . $_REQUEST['entry'] . '/filedrop/files';
+                       if (!file_exists($file_dir)) {
+                               mkdir($file_dir, 0777);
+                               chmod($file_dir, 0777);
+                       }
+                       if (!file_exists($file_dir . '/' . $_FILES['file_input']['name'])) {
+                               $res = copy($_FILES['file_input']['tmp_name'], $file_dir . '/' . $_FILES['file_input']['name']);
+                               unlink($_FILES['file_input']['tmp_name']);
+                               $file_src = $file_dir . '/' . $_FILES['file_input']['name'];
+                               $file_file = $filedrop_dir . '/' . $_FILES['file_input']['name'] . '.txt';
+                               $fp_file_txt = fopen($file_file,"w");
+                               fwrite($fp_file_txt,$file_src);
+                               fclose($fp_file_txt);
+                               chmod($file_file, 0666);
+                       }
+                       else {
+                               unlink($_FILES['file_input']['tmp_name']);
+                       }
+               }
+               else {
+                       unlink($_FILES['file_input']['tmp_name']);
+               }
+       }
+       else {
+               unlink($_FILES['file_input']['tmp_name']);
+       }
+}
+
+$open_body_file = fopen($body_file,"w");
+fwrite($open_body_file,$body_write_content);
+fclose($open_body_file);
+chmod($body_file, 0666);
+
+$sticky_sem = 'data/sticky/' . $_REQUEST['entry'];
+if (isset($_REQUEST['sticky']) and !empty($_REQUEST['sticky']) and ($_REQUEST['sticky'] == "on")) {
+       if (!file_exists("data/sticky")) {
+               mkdir("data/sticky", 0777);
+               chmod("data/sticky", 0777);
+       }
+       if (!file_exists($sticky_sem)) {
+               touch($sticky_sem);
+               chmod($sticky_sem, 0666);
+       }
+}
+if (!isset($_REQUEST['sticky']) or empty($_REQUEST['sticky'])) {
+       if (file_exists($sticky_sem)) {
+               unlink($sticky_sem);
+       }
+}
+
+$display_sem = "data/items/{$_REQUEST['entry']}/cat.txt";
+if (isset($_REQUEST['display']) and !empty($_REQUEST['display']) and ($_REQUEST['display'] == "on")) {
+       if (!file_exists($display_sem)) {
+               touch($display_sem);
+               chmod($display_sem, 0666);
+       }
+}
+if (!isset($_REQUEST['display']) or empty($_REQUEST['display'])) {
+       if (file_exists($display_sem)) {
+               unlink($display_sem);
+       }
+}
+
+$private_sem = "data/items/{$_REQUEST['entry']}/private.txt";
+if (isset($_REQUEST['private']) and !empty($_REQUEST['private']) and ($_REQUEST['private'] == "on")) {
+       if (!file_exists($private_sem)) {
+               touch($private_sem);
+               chmod($private_sem, 0666);
+       }
+}
+if (!isset($_REQUEST['private']) or empty($_REQUEST['private'])) {
+       if (file_exists($private_sem)) {
+               unlink($private_sem);
+       }
+}
+
+if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
+       if (!file_exists("data/categories")) {
+               mkdir("data/categories", 0777);
+               chmod("data/categories", 0777);
+       }
+       if ($_REQUEST['category'] == "unfiled") {
+               unlink("data/items/{$_REQUEST['entry']}/category.txt");
+       }
+       if (file_exists("data/categories/{$_REQUEST['category']}")) {
+               $fp_category_txt = fopen("data/items/{$_REQUEST['entry']}/category.txt","w");
+               fwrite($fp_category_txt, $_REQUEST['category']);
+               fclose($fp_category_txt);
+               chmod("data/items/{$_REQUEST['entry']}/category.txt", 0666);
+       }
+}
+
+$default_ping_urls = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
+$ping_urls_file = "data/ping.txt";
+
+if (!file_exists($ping_urls_file)) {
+       $fp_default_ping_txt = fopen($ping_urls_file,"w");
+       fwrite($fp_default_ping_txt, $default_ping_urls);
+       fclose($fp_default_ping_txt);
+       chmod($ping_urls_file, 0666);
+}
+
+$fp_ping_urls = fopen($ping_urls_file, "r");
+$ping_urls = fread($fp_ping_urls, filesize($ping_urls_file));
+fclose($fp_ping_urls);
+
+$get_ping_urls = explode("|", $ping_urls);
+
+foreach ($get_ping_urls as $ping_url) {
+       $ping = file_get_contents($ping_url);
+
+       //$ping_urls_edit_file = "data/ping-edit.txt";
+       //$fp_ping_urls_edit_txt = fopen($ping_urls_edit_file,"w");
+       //fwrite($fp_ping_urls_edit_txt, $ping);
+       //fclose($fp_ping_urls_edit_txt);
+       //chmod($ping_urls_edit_file, 0666);
+
+       clear($ping);
+}
+
+?>
diff --git a/gpl.txt b/gpl.txt
new file mode 100644
index 0000000..3912109
--- /dev/null
+++ b/gpl.txt
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/images/button.firefox.png b/images/button.firefox.png
new file mode 100644
index 0000000..5b514e6
Binary files /dev/null and b/images/button.firefox.png differ
diff --git a/images/button.maj.png b/images/button.maj.png
new file mode 100644
index 0000000..e5f0abb
Binary files /dev/null and b/images/button.maj.png differ
diff --git a/images/button.php.png b/images/button.php.png
new file mode 100644
index 0000000..614ba69
Binary files /dev/null and b/images/button.php.png differ
diff --git a/images/button.rss-0.91.png b/images/button.rss-0.91.png
new file mode 100644
index 0000000..70b60d7
Binary files /dev/null and b/images/button.rss-0.91.png differ
diff --git a/images/button.rss-1.0.png b/images/button.rss-1.0.png
new file mode 100644
index 0000000..304064d
Binary files /dev/null and b/images/button.rss-1.0.png differ
diff --git a/images/button.rss-2.0.png b/images/button.rss-2.0.png
new file mode 100644
index 0000000..68191a1
Binary files /dev/null and b/images/button.rss-2.0.png differ
diff --git a/images/button.sitemap.png b/images/button.sitemap.png
new file mode 100644
index 0000000..dc83637
Binary files /dev/null and b/images/button.sitemap.png differ
diff --git a/images/button.w3c.aa.png b/images/button.w3c.aa.png
new file mode 100644
index 0000000..2758d20
Binary files /dev/null and b/images/button.w3c.aa.png differ
diff --git a/images/button.w3c.css.png b/images/button.w3c.css.png
new file mode 100644
index 0000000..4064895
Binary files /dev/null and b/images/button.w3c.css.png differ
diff --git a/images/button.w3c.xhtml-1.0.png b/images/button.w3c.xhtml-1.0.png
new file mode 100644
index 0000000..a1db65c
Binary files /dev/null and b/images/button.w3c.xhtml-1.0.png differ
diff --git a/images/filedrop.png b/images/filedrop.png
new file mode 100644
index 0000000..7c40208
Binary files /dev/null and b/images/filedrop.png differ
diff --git a/images/smileys/crying.png b/images/smileys/crying.png
new file mode 100644
index 0000000..d9b9fb2
Binary files /dev/null and b/images/smileys/crying.png differ
diff --git a/images/smileys/frown.png b/images/smileys/frown.png
new file mode 100644
index 0000000..1883d46
Binary files /dev/null and b/images/smileys/frown.png differ
diff --git a/images/smileys/indifferent.png b/images/smileys/indifferent.png
new file mode 100644
index 0000000..03250b0
Binary files /dev/null and b/images/smileys/indifferent.png differ
diff --git a/images/smileys/laughing.png b/images/smileys/laughing.png
new file mode 100644
index 0000000..6f69efd
Binary files /dev/null and b/images/smileys/laughing.png differ
diff --git a/images/smileys/lick.png b/images/smileys/lick.png
new file mode 100644
index 0000000..283b54a
Binary files /dev/null and b/images/smileys/lick.png differ
diff --git a/images/smileys/ohno.png b/images/smileys/ohno.png
new file mode 100644
index 0000000..e1b51a3
Binary files /dev/null and b/images/smileys/ohno.png differ
diff --git a/images/smileys/smile.png b/images/smileys/smile.png
new file mode 100644
index 0000000..f4b5f13
Binary files /dev/null and b/images/smileys/smile.png differ
diff --git a/images/smileys/surprised.png b/images/smileys/surprised.png
new file mode 100644
index 0000000..e0adfa2
Binary files /dev/null and b/images/smileys/surprised.png differ
diff --git a/images/smileys/undecided.png b/images/smileys/undecided.png
new file mode 100644
index 0000000..fa4b5f9
Binary files /dev/null and b/images/smileys/undecided.png differ
diff --git a/images/smileys/wink.png b/images/smileys/wink.png
new file mode 100644
index 0000000..2e59ae6
Binary files /dev/null and b/images/smileys/wink.png differ
diff --git a/images/widget.booked.png b/images/widget.booked.png
new file mode 100644
index 0000000..cace3d8
Binary files /dev/null and b/images/widget.booked.png differ
diff --git a/images/widget.cat.png b/images/widget.cat.png
new file mode 100644
index 0000000..e73f0ba
Binary files /dev/null and b/images/widget.cat.png differ
diff --git a/images/widget.del.png b/images/widget.del.png
new file mode 100644
index 0000000..b30e41f
Binary files /dev/null and b/images/widget.del.png differ
diff --git a/images/widget.edit.png b/images/widget.edit.png
new file mode 100644
index 0000000..34033a9
Binary files /dev/null and b/images/widget.edit.png differ
diff --git a/images/widget.filed.png b/images/widget.filed.png
new file mode 100644
index 0000000..a9a054b
Binary files /dev/null and b/images/widget.filed.png differ
diff --git a/images/widget.hidden.png b/images/widget.hidden.png
new file mode 100644
index 0000000..0410843
Binary files /dev/null and b/images/widget.hidden.png differ
diff --git a/images/widget.isolated.png b/images/widget.isolated.png
new file mode 100644
index 0000000..3b5ed73
Binary files /dev/null and b/images/widget.isolated.png differ
diff --git a/images/widget.private.png b/images/widget.private.png
new file mode 100644
index 0000000..28c0a6b
Binary files /dev/null and b/images/widget.private.png differ
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..2a4f25f
--- /dev/null
+++ b/index.php
@@ -0,0 +1,1733 @@
+<?php
+
+session_start();
+header("Cache-control: private");
+
+$dir = "data/items";
+
+$default_title = file_get_contents("data/title.txt");
+
+
+if (file_exists("data/offset.txt")) {
+       $offset = file_get_contents("data/offset.txt");
+}
+else {
+       $offset = 0;
+}
+
+if (file_exists("data/increase.txt")) {
+       $increase = file_get_contents("data/increase.txt");
+}
+else {
+       $increase = 5;
+}
+
+$default_blog_title = "My Activity Journal";
+$default_username = "maj";
+$default_password = "php";
+$default_blog_profile = "This cool site is powered by <a href=http://engels.mortega.net/index.php?entry=20050521000019 target=_blank>My Activity Journal</a>, a dead-simple, <a href=http://php.net/ target=_blank>PHP</a>-based, <a href=http://www.opensource.org/licenses/gpl-license.php target=_blank>GPL</a>'ed blog written from scratch as a spare time family project by <a href=http://engels.mortega.net/ target=_blank>Engels</a>, <a href=http://gaffud.com/ target=_blank>Magie</a>, and <a href=http://psylocke.org/ target=_blank>Psylocke</a> Antonio.";
+$default_blog_author = "My Activity Journal";
+$default_blog_email = "root@localhost";
+
+if (!file_exists("data")) {
+       mkdir("data");
+       chmod("data", 0777);
+       chmod("images/smileys", 0777);
+}
+
+if (!file_exists("data/.htaccess")) {
+       $htaccess = "Order deny,allow\nDeny from all";
+       $fp_htaccess_txt = fopen("data/.htaccess","w");
+       fwrite($fp_htaccess_txt, $htaccess);
+       fclose($fp_htaccess_txt);
+}
+
+if (!file_exists("data/title.txt")) {
+       $fp_default_title_txt = fopen("data/title.txt","w");
+       fwrite($fp_default_title_txt, $default_blog_title);
+       fclose($fp_default_title_txt);
+       chmod("data/title.txt", 0666);
+}
+
+if (!file_exists("data/username.txt")) {
+       $fp_htaccess_txt = fopen("data/username.txt","w");
+       fwrite($fp_htaccess_txt, $default_username);
+       fclose($fp_htaccess_txt);
+       chmod("data/username.txt", 0666);
+}
+
+if (!file_exists("data/password.txt")) {
+       $default_password = sha1($default_password);
+       $default_password = md5($default_password);
+       $default_password = crypt($default_password, $default_password);
+       $fp_htaccess_txt = fopen("data/password.txt","w");
+       fwrite($fp_htaccess_txt, $default_password);
+       fclose($fp_htaccess_txt);
+       chmod("data/password.txt", 0666);
+}
+
+if (!file_exists("data/profile.php")) {
+       $fp_default_profile_txt = fopen("data/profile.php","w");
+       fwrite($fp_default_profile_txt, $default_blog_profile);
+       fclose($fp_default_profile_txt);
+       chmod("data/profile.php", 0666);
+}
+
+if (!file_exists("data/author.txt")) {
+       $fp_default_author_txt = fopen("data/author.txt","w");
+       fwrite($fp_default_author_txt, $default_blog_author);
+       fclose($fp_default_author_txt);
+       chmod("data/author.txt", 0666);
+}
+
+if (!file_exists("data/email.txt")) {
+       $fp_default_email_txt = fopen("data/email.txt","w");
+       fwrite($fp_default_email_txt, $default_blog_email);
+       fclose($fp_default_email_txt);
+       chmod("data/email.txt", 0666);
+}
+
+$username_file = 'data/username.txt';
+$open_username_file = fopen($username_file,"r");
+$login_username = fread($open_username_file,filesize($username_file));
+fclose($open_username_file);
+
+if (!isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+       $global_hits_file = fopen("data/hits.txt", "r");
+       $global_hits_count = fread($global_hits_file, filesize("data/hits.txt"));
+       fclose($global_hits_file);
+       $global_hits_count = $global_hits_count + 1;
+       $global_hits_file = fopen("data/hits.txt", "w");
+       fwrite($global_hits_file, $global_hits_count);
+       fclose($global_hits_file);
+       chmod("data/hits.txt", 0666);
+}
+
+$agent = $_SERVER['HTTP_USER_AGENT'];
+
+if (@ereg("Google", $agent)) {
+       $google_hits_file = fopen("data/google.txt", "r");
+       $google_hits_count = fread($google_hits_file, filesize("data/google.txt"));
+       fclose($google_hits_file);
+       $google_hits_count = $google_hits_count + 1;
+       $google_hits_file = fopen("data/google.txt", "w");
+       fwrite($google_hits_file, $google_hits_count);
+       fclose($google_hits_file);
+       chmod("data/google.txt", 0666);
+}
+
+function str_rand($length = 8, $seeds = 'abcdefghijklmnopqrstuvwxyz0123456789')
+{
+    $str = '';
+    $seeds_count = strlen($seeds);
+
+    list($usec, $sec) = explode(' ', microtime());
+    $seed = (float) $sec + ((float) $usec * 100000);
+    mt_srand($seed);
+
+    for ($i = 0; $length > $i; $i++) {
+        $str .= $seeds{mt_rand(0, $seeds_count - 1)};
+    }
+
+    return $str;
+}
+
+function rmdirr($recurse_dirname)
+{
+
+    if (!file_exists($recurse_dirname)) {
+        return false;
+    }
+
+    if (is_file($recurse_dirname)) {
+        return unlink($recurse_dirname);
+    }
+
+    $recurse_dir = dir($recurse_dirname);
+    while (false !== $recurse_entry = $recurse_dir->read()) {
+
+        if ($recurse_entry == '.' || $recurse_entry == '..') {
+            continue;
+        }
+
+        rmdirr("$recurse_dirname/$recurse_entry");
+    }
+
+    $recurse_dir->close();
+    return rmdir($recurse_dirname);
+}
+
+if (isset($_REQUEST['download']) and !empty($_REQUEST['download'])) {
+       ini_set('zlib.output_compression','off');
+       $file = str_replace('../','', @$_REQUEST['download']);
+       go_download($file);
+       die();
+}
+
+function go_download($entry_filedrop) {
+       $d = $_REQUEST['entry'];
+       header("Cache-Control: ");
+       header("Pragma: ");
+       header("Content-type: application/octet-stream");
+       header("Content-Disposition: attachment; filename=\"" . $entry_filedrop . "\"");
+       header("Content-length: " . filesize("data/items/$d/filedrop/files/$entry_filedrop"));
+       $get_it = fopen("data/items/$d/filedrop/files/$entry_filedrop", 'rb');
+
+       while (!feof($get_it)) {
+               $buf = fread($get_it, 4096);
+               echo $buf;
+               $bytes_sent+=strlen($buf);
+       }
+
+       if ($bytes_sent==filesize("data/items/$d/filedrop/files/$entry_filedrop")) {
+
+               $filedrop_dl_count_dir = 'data/items/' . $_REQUEST['entry'] . '/filedrop/count';
+               if (!file_exists($filedrop_dl_count_dir)) {
+                       mkdir($filedrop_dl_count_dir);
+                       chmod($filedrop_dl_count_dir, 0777);
+               }
+
+               $unique_downloads = $filedrop_dl_count_dir . '/' . $entry_filedrop . '.txt';
+               $fp_unique_downloads = fopen($unique_downloads, "r");
+               $count_unique_downloads = fread($fp_unique_downloads, filesize($unique_downloads));
+               fclose($fp_unique_downloads);
+               $count_unique_downloads = $count_unique_downloads + 1;
+               $fp_unique_downloads = fopen($unique_downloads, "w");
+               fwrite($fp_unique_downloads, $count_unique_downloads);
+               fclose($fp_unique_downloads);
+               chmod($unique_downloads, 0666);
+       }
+}
+
+if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_REQUEST['key']) and !empty($_REQUEST['key']) and isset($_REQUEST['action']) and !empty($_REQUEST['action'])) {
+               $comment_dir = 'data/items/' . $_REQUEST['entry'] .'/comments/pending/' . $_REQUEST['comment'];
+               $key_file = $comment_dir . '/key.txt';
+               $open_key_file = fopen($key_file,"r");
+               $login_key = fread($open_key_file,filesize($key_file));
+               fclose($open_key_file);
+
+               if ($_REQUEST['key'] == $login_key) {
+                       if ($_REQUEST['action'] == "approve") {
+                               $live_dir = 'data/items/' . $_REQUEST['entry'] .'/comments/live/' . $_REQUEST['comment'];
+                               rename($comment_dir, $live_dir);
+                               unlink("$live_dir/key.txt");
+                       }
+                       if ($_REQUEST['action'] == "delete") {
+                               rmdirr($comment_dir);
+                       }
+                       $pending_comment_flag_dir = $_REQUEST['entry'];
+                       $fp_comment_count_txt = fopen("data/comments/pending/$pending_comment_flag_dir/count.txt","r");
+                       $comment_count_value = fread($fp_comment_count_txt,filesize("data/comments/pending/$pending_comment_flag_dir/count.txt"));
+                       fclose($fp_comment_count_txt);
+                       if ($comment_count_value <= 1) {
+                               rmdirr("data/comments/pending/$pending_comment_flag_dir");
+                       }
+                       else {
+                               $fp_comment_count_txt = fopen("data/comments/pending/$pending_comment_flag_dir/count.txt","r");
+                               $comment_count_value = fread($fp_comment_count_txt,filesize("data/comments/pending/$pending_comment_flag_dir/count.txt"));
+                               fclose($fp_comment_count_txt);
+                               $comment_count_value = $comment_count_value - 1;
+                               $fp_comment_count_txt = fopen("data/comments/pending/$pending_comment_flag_dir/count.txt","w");
+                               fwrite($fp_comment_count_txt, $comment_count_value);
+                               fclose($fp_comment_count_txt);
+                               chmod("data/comments/pending/$pending_comment_flag_dir/count.txt", 0666);
+                       }
+
+                       header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '?entry=' . $_REQUEST['entry'] . '&show=comments');
+               }
+}
+
+if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
+       $check = $dir . '/' . $_REQUEST['entry'];
+
+       if (file_exists("$check")) {
+               $filter = $_REQUEST['entry'];
+               echo '<title>';
+               $title = $check . '/title.txt';
+               readfile($title);
+               echo '</title>';
+               $views = $check . '/views.txt';
+               if (!isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                       $fp_views = fopen($views, "r");
+                       $count_views = fread($fp_views, filesize($views));
+                       fclose($fp_views);
+                       $count_views = $count_views + 1;
+                       $fp_views = fopen($views, "w");
+                       fwrite($fp_views, $count_views);
+                       fclose($fp_views);
+                       chmod($views, 0666);
+               }
+              
+               if (isset($_REQUEST['show']) and !empty($_REQUEST['show']) and isset($_REQUEST['capcha_put']) and !empty($_REQUEST['capcha_get']) and isset($_REQUEST['firstname']) and !empty($_REQUEST['firstname']) and isset($_REQUEST['lastname']) and !empty($_REQUEST['lastname']) and isset($_REQUEST['email']) and !empty($_REQUEST['email']) and isset($_REQUEST['new_comment']) and !empty($_REQUEST['new_comment']) and isset($_REQUEST['capcha_put']) and !empty($_REQUEST['capcha_put']) and ($_REQUEST['capcha_get'] == $_REQUEST['capcha_put']) and (ereg("@", $_REQUEST['email'])) and (ereg("\.", $_REQUEST['email']))) {
+              
+               if (!file_exists("$check/comments")) {
+                       mkdir("$check/comments");
+                       chmod("$check/comments", 0777);
+               }
+               if (!file_exists("$check/comments/pending")) {
+                       mkdir("$check/comments/pending");
+                       chmod("$check/comments/pending", 0777);
+               }
+
+               if (!file_exists("$check/comments/live")) {
+                       mkdir("$check/comments/live");
+                       chmod("$check/comments/live", 0777);
+               }
+
+               // GNU date format
+               //$timestamp = date("D M j H:i:s \P\H\T Y", time() + $offset);
+
+               // Simple PHP Blog format
+               $timestamp = date("l, M j, Y, g:i A", time() + $offset);
+
+               $comment_entry_dir = date("YmdHis", time() + $offset);
+
+               mkdir("$check/comments/pending/$comment_entry_dir");
+               chmod("$check/comments/pending/$comment_entry_dir", 0777);
+
+               $body_content = ucfirst($_REQUEST['new_comment']);
+               $body_content = htmlentities($body_content, ENT_NOQUOTES);
+               // $body_content = str_replace('href=', 'rel=nofollow target=_blank href=', $body_content);
+               $body_content = str_replace("\n", '<br />', $body_content);
+               $body_content = trim($body_content);
+
+               $body_content = str_replace(':((', '<img src=images/smileys/crying.png border=0>', $body_content);
+
+               $body_content = str_replace(':(', '<img src=images/smileys/frown.png border=0>', $body_content);
+
+               $body_content = str_replace(':|', '<img src=images/smileys/indifferent.png border=0>', $body_content);
+
+               $body_content = str_replace(':D', '<img src=images/smileys/laughing.png border=0>', $body_content);
+
+               $body_content = str_replace(':P', '<img src=images/smileys/lick.png border=0>', $body_content);
+
+               $body_content = str_replace(':O', '<img src=images/smileys/ohno.png border=0>', $body_content);
+
+               $body_content = str_replace(':)', '<img src=images/smileys/smile.png border=0>', $body_content);
+
+               $body_content = str_replace('=)', '<img src=images/smileys/surprised.png border=0>', $body_content);
+
+               $body_content = str_replace(':\\', '<img src=images/smileys/undecided.png border=0>', $body_content);
+
+               $body_content = str_replace(';)', '<img src=images/smileys/wink.png border=0>', $body_content);
+
+               $fp_body_txt = fopen("$check/comments/pending/$comment_entry_dir/comment.txt","w");
+               chmod($fp_body_txt, 0666);
+               fwrite($fp_body_txt,$body_content);
+               fclose($fp_body_txt);
+
+               $fp_timestamp_txt = fopen("$check/comments/pending/$comment_entry_dir/timestamp.txt","w");
+               chmod($fp_timestamp_txt, 0666);
+               fwrite($fp_timestamp_txt,$timestamp);
+               fclose($fp_timestamp_txt);
+
+               $fp_firstname_txt = fopen("$check/comments/pending/$comment_entry_dir/firstname.txt","w");
+               chmod($fp_firstname_txt, 0666);
+               $firstname = ucwords($_REQUEST['firstname']);
+               $firstname = trim($firstname);
+               $firstname = htmlentities($firstname, ENT_NOQUOTES);
+               fwrite($fp_firstname_txt,$firstname);
+               fclose($fp_firstname_txt);
+
+               $fp_lastname_txt = fopen("$check/comments/pending/$comment_entry_dir/lastname.txt","w");
+               chmod($fp_lastname_txt, 0666);
+               $lastname = ucwords($_REQUEST['lastname']);
+               $lastname = trim($lastname);
+               $lastname = htmlentities($lastname, ENT_NOQUOTES);
+               fwrite($fp_lastname_txt,$lastname);
+               fclose($fp_lastname_txt);
+
+               $fp_email_txt = fopen("$check/comments/pending/$comment_entry_dir/email.txt","w");
+               chmod($fp_email_txt, 0666);
+               $email = str_replace('@', ' at ', $_REQUEST['email']);
+               $email = strtolower($email);
+               $email = trim($email);
+               $email = htmlentities($email, ENT_NOQUOTES);
+               fwrite($fp_email_txt,$email);
+               fclose($fp_email_txt);
+
+               if (isset($_REQUEST['url']) and !empty($_REQUEST['url']) and (ereg("\.", $_REQUEST['url']))) {
+                       $fp_url_txt = fopen("$check/comments/pending/$comment_entry_dir/url.txt","w");
+                       chmod($fp_url_txt, 0666);
+                       $url = str_replace('http://', '', $_REQUEST['url']);
+                       $url = strtolower($url);
+                       $url = trim($url);
+                       $url = 'http://' . $url;
+                       $url = htmlentities($url, ENT_NOQUOTES);
+                       fwrite($fp_url_txt,$url);
+                       fclose($fp_url_txt);
+               }
+
+               $key_rand = str_rand(14);
+               $fp_key_txt = fopen("$check/comments/pending/$comment_entry_dir/key.txt","w");
+               chmod($fp_key_txt, 0666);
+               fwrite($fp_key_txt,$key_rand);
+               fclose($fp_key_txt);
+
+               $comment_quote = ucfirst($_REQUEST['new_comment']);
+               $comment_quote = htmlentities($comment_quote, ENT_NOQUOTES);
+
+               $sig_author_file = "data/author.txt";
+               $fp_sig_author = fopen($sig_author_file, "r");
+               $sig_author = fread($fp_sig_author, filesize($sig_author_file));
+               fclose($fp_sig_author);
+
+               $sig_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
+               $sig_url = str_replace('//', '/', $sig_url);
+               $sig_url = "http://" . $sig_url;
+
+               $email_to = strtolower($_REQUEST['email']);
+               $email_to = $firstname . " " . $lastname . ' <' . $email_to . '>';
+
+               $from_email_file = "data/email.txt";
+               $fp_from_email = fopen($from_email_file, "r");
+               $from_email = fread($fp_from_email, filesize($from_email_file));
+               fclose($fp_from_email);
+
+               $mailer = 'MAJ/0.14 (PHP/' . phpversion() . ')';
+
+               $commented_entry_title_file = "data/items/{$_REQUEST['entry']}/title.txt";
+               $fp_commented_entry_title = fopen($commented_entry_title_file, "r");
+               $commented_entry_title = fread($fp_commented_entry_title, filesize($commented_entry_title_file));
+               fclose($fp_commented_entry_title);
+
+               if (!file_exists("data/nak.txt")) {
+                       $comment_thanks = "Hi $firstname,\n\nThanks for submitting the following comment last $timestamp:\n\n\"$comment_quote\"\n\nIt will be e-mailed to me first for approval. Please visit the following URL to see if it has been posted:\n\n{$sig_url}index.php?entry={$_REQUEST['entry']}&show=comments\n\nThanks again! =)\n\n--\n$sig_author\n$sig_url\n";
+
+                       $comment_thanks = wordwrap($comment_thanks);
+
+                       mail($email_to, "Thanks for posting a comment on my blog!", $comment_thanks,
+                               "From: $from_email\r\n" .
+                               "Reply-To: $from_email\r\n" .
+                               "X-Mailer: $mailer");
+               }
+
+               $comment_notice = "The following comment was submitted by $email_to last $timestamp for the entry \"$commented_entry_title\":\n\n\"$comment_quote\"\n\nVisit the link below to approve and post this pending comment:\n\n{$sig_url}index.php?entry={$_REQUEST['entry']}&comment={$comment_entry_dir}&key={$key_rand}&action=approve\n\nVisit the link below to disapprove and delete this pending comment:\n\n{$sig_url}index.php?entry={$_REQUEST['entry']}&comment={$comment_entry_dir}&key={$key_rand}&action=delete\n\nYou can also approve or disapprove pending comments at a later time by logging on to your blog.";
+
+               $comment_notice = wordwrap($comment_notice);
+
+               mail($from_email, "Pending Blog Comment", $comment_notice,
+                       "From: $from_email\r\n" .
+                       "Reply-To: $from_email\r\n" .
+                       "X-Mailer: $mailer");
+
+               if (!file_exists("data/comments")) {
+                       mkdir("data/comments");
+                       chmod("data/comments", 0777);
+               }
+
+               if (!file_exists("data/comments/pending")) {
+                       mkdir("data/comments/pending");
+                       chmod("data/comments/pending", 0777);
+               }
+
+               $pending_comment_flag = $_REQUEST['entry'];
+
+               if (!file_exists("data/comments/pending/$pending_comment_flag")) {
+                       mkdir("data/comments/pending/$pending_comment_flag");
+                       chmod("data/comments/pending/$pending_comment_flag", 0777);
+               }
+
+               $fp_comment_count_txt = fopen("data/comments/pending/$pending_comment_flag/count.txt","r");
+               $comment_count_value = fread($fp_comment_count_txt,filesize("data/comments/pending/$pending_comment_flag/count.txt"));
+               fclose($fp_comment_count_txt);
+               $comment_count_value = $comment_count_value + 1;
+               $fp_comment_count_txt = fopen("data/comments/pending/$pending_comment_flag/count.txt","w");
+               fwrite($fp_comment_count_txt, $comment_count_value);
+               fclose($fp_comment_count_txt);
+               chmod("data/comments/pending/$pending_comment_flag/count.txt", 0666);
+
+               }
+
+       }
+       else {
+               echo '<title>' . $default_title . '</title>';
+               $filter = "*";
+       }
+}
+else {
+       echo '<title>' . $default_title . '</title>';
+       $filter = "*";
+}
+
+?>
+
+<style>
+
+body
+{
+       color: <?php
+if (file_exists("data/colors/font.txt")) {
+       $font_color = file_get_contents("data/colors/font.txt");
+       echo $font_color;
+}
+else {
+       echo "#666666";
+}
+?>;
+       margin: 10px;
+       padding: 0px;
+       text-align: left;
+       font-family: verdana, helvetica, sans-serif;
+       background-color: <?php
+if (file_exists("data/colors/background.txt")) {
+       $background_color = file_get_contents("data/colors/background.txt");
+       echo $background_color;
+}
+else {
+       echo "#FFFFFF";
+}
+?>;
+       <?php
+       if (file_exists("images/background.gif") and !file_exists("images/background.jpg") and !file_exists("images/background.png")) { ?>
+       background-image: url('images/background.gif');
+       background-attachment: <?php if (file_exists("data/bg-scroll.txt")) { echo scroll; } else { echo fixed; } ?>;
+       background-repeat: <?php if (file_exists("data/bg-repeat.txt")) { readfile("data/bg-repeat.txt"); } else { echo repeat; } ?>;
+       background-position: <?php if (file_exists("data/bg-position.txt")) { readfile("data/bg-position.txt"); } else { echo "top left"; } ?>;
+       <?php
+       }
+       if (!file_exists("images/background.gif") and file_exists("images/background.jpg") and !file_exists("images/background.png")) { ?>
+       background-image: url('images/background.jpg');
+       background-attachment: <?php if (file_exists("data/bg-scroll.txt")) { echo scroll; } else { echo fixed; } ?>;
+       background-repeat: <?php if (file_exists("data/bg-repeat.txt")) { readfile("data/bg-repeat.txt"); } else { echo repeat; } ?>;
+       background-position: <?php if (file_exists("data/bg-position.txt")) { readfile("data/bg-position.txt"); } else { echo "top left"; } ?>;
+       <?php
+       }
+       if (!file_exists("images/background.gif") and !file_exists("images/background.jpg") and file_exists("images/background.png")) { ?>
+       background-image: url('images/background.png');
+       background-attachment: <?php if (file_exists("data/bg-scroll.txt")) { echo scroll; } else { echo fixed; } ?>;
+       background-repeat: <?php if (file_exists("data/bg-repeat.txt")) { readfile("data/bg-repeat.txt"); } else { echo repeat; } ?>;
+       background-position: <?php if (file_exists("data/bg-position.txt")) { readfile("data/bg-position.txt"); } else { echo "top left"; } ?>;
+       <?php
+       }
+       ?>
+}
+
+p, td
+{
+       font-size: 11px;
+}
+
+a
+{
+       font-weight: bold;
+       text-decoration: none;
+}
+
+a:link
+{
+       color: <?php
+if (file_exists("data/colors/a-link.txt")) {
+       $a_link_color = file_get_contents("data/colors/a-link.txt");
+       echo $a_link_color;
+}
+else {
+       echo "#666666";
+}
+?>;
+}
+
+a:visited
+{
+       color: <?php
+if (file_exists("data/colors/a-visited.txt")) {
+       $a_visited_color = file_get_contents("data/colors/a-visited.txt");
+       echo $a_visited_color;
+}
+else {
+       echo "#666666";
+}
+?>;
+}
+
+a:hover
+{
+       color: <?php
+if (file_exists("data/colors/a-hover.txt")) {
+       $a_hover_color = file_get_contents("data/colors/a-hover.txt");
+       echo $a_hover_color;
+}
+else {
+       echo "#336699";
+}
+?>;
+}
+
+a:active {
+       color: <?php
+if (file_exists("data/colors/a-active.txt")) {
+       $a_active_color = file_get_contents("data/colors/a-active.txt");
+       echo $a_active_color;
+}
+else {
+       echo "#336699";
+}
+?>;
+}
+#panel_title
+{
+       font-family: verdana, helvetica, sans-serif;
+       font-size: 12px;
+       font-weight: bold;
+       color: <?php
+if (file_exists("data/colors/panel-title-font.txt")) {
+       $panel_title_font_color = file_get_contents("data/colors/panel-title-font.txt");
+       echo $panel_title_font_color;
+}
+else {
+       echo "#666666";
+}
+?>;
+       padding: 5px 5px 5px 5px;
+       background-color: <?php
+if (file_exists("data/colors/panel-title-background.txt")) {
+       $panel_title_background_color = file_get_contents("data/colors/panel-title-background.txt");
+       echo $panel_title_background_color;
+}
+else {
+       echo "#FFFFFF";
+}
+?>;
+       margin: 0px;
+       border-color: <?php
+if (file_exists("data/colors/border.txt")) {
+       $panel_title_border_color = file_get_contents("data/colors/border.txt");
+       echo $panel_title_border_color;
+}
+else {
+       echo "#CCCCCC";
+}
+?>;
+       border-width: 1px 1px 0px 1px;
+       border-style: solid solid none solid;
+}
+#panel_body
+{
+       font-family: verdana, helvetica, sans-serif;
+       font-size: 11px;
+       color: <?php
+if (file_exists("data/colors/panel-body-font.txt")) {
+       $panel_body_font_color = file_get_contents("data/colors/panel-body-font.txt");
+       echo $panel_body_font_color;
+}
+else {
+       echo "#666666";
+}
+?>;
+       padding: 5px 5px 5px 5px;
+       background-color: <?php
+if (file_exists("data/colors/panel-body-background.txt")) {
+       $panel_body_background_color = file_get_contents("data/colors/panel-body-background.txt");
+       echo $panel_body_background_color;
+}
+else {
+       echo "#FFFFFF";
+}
+?>;
+       margin: 0px;
+       border-color: <?php
+if (file_exists("data/colors/border.txt")) {
+       $panel_body_border_color = file_get_contents("data/colors/border.txt");
+       echo $panel_body_border_color;
+}
+else {
+       echo "#CCCCCC";
+}
+?>;
+       border-width: 1px 1px 1px 1px;
+       border-style: solid solid solid solid;
+}
+#panel_footer
+{
+       font-family: verdana, helvetica, sans-serif;
+       font-size: 11px;
+       color: <?php
+if (file_exists("data/colors/panel-footer-font.txt")) {
+       $panel_footer_font_color = file_get_contents("data/colors/panel-footer-font.txt");
+       echo $panel_footer_font_color;
+}
+else {
+       echo "#666666";
+}
+?>;
+       padding: 5px 5px 5px 5px;
+       background-color: <?php
+if (file_exists("data/colors/panel-footer-background.txt")) {
+       $panel_footer_background_color = file_get_contents("data/colors/panel-footer-background.txt");
+       echo $panel_footer_background_color;
+}
+else {
+       echo "#FFFFFF";
+}
+?>;
+       margin: 0px;
+       border-color: <?php
+if (file_exists("data/colors/border.txt")) {
+       $panel_footer_border_color = file_get_contents("data/colors/border.txt");
+       echo $panel_footer_border_color;
+}
+else {
+       echo "#CCCCCC";
+}
+?>;
+       border-width: 0px 1px 1px 1px;
+       border-style: none solid solid solid;
+}
+.input {      
+       color: <?php
+if (file_exists("data/colors/border.txt")) {
+       $input_color = file_get_contents("data/colors/border.txt");
+       echo $input_color;
+}
+else {
+       echo "#666666";
+}
+?>;
+       background: #FFFFFF;
+       border: <?php
+if (file_exists("data/colors/border.txt")) {
+       $panel_footer_border_color = file_get_contents("data/colors/border.txt");
+       echo $panel_footer_border_color;
+}
+else {
+       echo "#999999";
+}
+?> solid 1px;
+       width: 300px;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px;
+}
+.search {      
+       color: #666666;
+       background: #FFFFFF;
+       width: 100%;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px;
+}
+</style>
+
+<link rel="alternate" type="application/rss+xml" title="RSS 0.91" href="rss.php?ver=0.91">
+<link rel="alternate" type="application/rss+xml" title="RSS 1.0" href="rss.php?ver=1.0">
+<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss.php?ver=2.0">
+
+<?php
+if (file_exists("header.php")) {
+       include("header.php");
+       echo '<p></p>';
+}
+?>
+
+<table border=0 cellspacing=0 cellpadding=0>
+<tr><td width=175 valign=top>
+
+<div id=panel_title>Profile</div>
+<div id=panel_body>
+<?php
+if (file_exists("images/profile.gif")) {
+       $profile_gif_image_size = getimagesize("images/profile.gif");
+       $profile_gif_image_width = $profile_gif_image_size[0];
+       $profile_gif_image_height = $profile_gif_image_size[1];
+
+       $max_profile_gif_image_width = 163;
+
+       if ($profile_gif_image_width > $max_profile_gif_image_width) {  
+               $sizefactor = (double) ($max_profile_gif_image_width / $profile_gif_image_width) ;
+               $profile_gif_image_width = (int) ($profile_gif_image_width * $sizefactor);
+               $profile_gif_image_height = (int) ($profile_gif_image_height * $sizefactor);
+       }
+
+       echo "<img src=images/profile.gif border=0 width=";
+       echo $profile_gif_image_width;
+       echo " height=";
+       echo $profile_gif_image_height;
+       echo " align=left>";
+}
+if (file_exists("images/profile.jpg")) {
+       $profile_jpg_image_size = getimagesize("images/profile.jpg");
+       $profile_jpg_image_width = $profile_jpg_image_size[0];
+       $profile_jpg_image_height = $profile_jpg_image_size[1];
+
+       $max_profile_jpg_image_width = 163;
+
+       if ($profile_jpg_image_width > $max_profile_jpg_image_width) {  
+               $sizefactor = (double) ($max_profile_jpg_image_width / $profile_jpg_image_width) ;
+               $profile_jpg_image_width = (int) ($profile_jpg_image_width * $sizefactor);
+               $profile_jpg_image_height = (int) ($profile_jpg_image_height * $sizefactor);
+       }
+
+       echo "<img src=images/profile.jpg border=0 width=";
+       echo $profile_jpg_image_width;
+       echo " height=";
+       echo $profile_jpg_image_height;
+       echo " align=left>";
+}
+if (file_exists("images/profile.png")) {
+       $profile_png_image_size = getimagesize("images/profile.png");
+       $profile_png_image_width = $profile_png_image_size[0];
+       $profile_png_image_height = $profile_png_image_size[1];
+
+       $max_profile_png_image_width = 163;
+
+       if ($profile_png_image_width > $max_profile_png_image_width) {  
+               $sizefactor = (double) ($max_profile_png_image_width / $profile_png_image_width) ;
+               $profile_png_image_width = (int) ($profile_png_image_width * $sizefactor);
+               $profile_png_image_height = (int) ($profile_png_image_height * $sizefactor);
+       }
+
+       echo "<img src=images/profile.png border=0 width=";
+       echo $profile_png_image_width;
+       echo " height=";
+       echo $profile_png_image_height;
+       echo " align=left>";
+}
+include("data/profile.php");
+?>
+</div>
+<p></p>
+<div id=panel_title>Navigation</div>
+<div id=panel_body>
+<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Home</a><br>
+
+<?php
+if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+       echo '<a href=add.php>Add Entry</a><br>';
+       echo '<a href=settings.php>Settings</a><br>';
+       echo '<a href=cat.php>Categories</a><br>';
+       echo '<a href=login.php>Logout</a>';
+}
+else {
+       echo '<a href=login.php>Login</a>';
+}
+?>
+
+</div>
+
+
+<p></p>
+
+<?php
+if (file_exists("data/sticky")) {
+       if ($dh_sticky_list = opendir("data/sticky")) {
+               while (($entry_sticky_list = readdir($dh_sticky_list)) !== false) {
+
+                       if (file_exists("data/items/$entry_sticky_list/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                               continue;
+                       }
+
+                       $get_cat_dir = file_get_contents("data/items/$entry_sticky_list/category.txt");
+
+                       if (file_exists("data/categories/$get_cat_dir/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and !file_exists("data/items/$entry_sticky_list/cat.txt")) {
+                               continue;
+                       }
+
+                       if ($entry_sticky_list != "." && $entry_sticky_list != ".." && fnmatch("*", $entry_sticky_list)) {
+                               $show_sticky_list[] = $entry_sticky_list;
+                       }
+               }
+               closedir($dh_sticky_list);
+       }
+
+       sort($show_sticky_list);
+       reset($show_sticky_list);
+       $count_sticky_list = count($show_sticky_list);
+      
+       if ($count_sticky_list > 0) {
+               echo '<div id=panel_title>Links</div>';
+               echo '<div id=panel_body>';
+               foreach ($show_sticky_list as $sticky_list_entry) {
+                       echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=';
+                       echo $sticky_list_entry;
+                       echo '>';
+                       readfile("data/items/$sticky_list_entry/title.txt");
+                       echo '</a><br>';
+               }
+               echo '</div>';
+       }
+}
+?>
+
+<p></p>
+</td><td width=15></td><td valign=top>
+
+<?php
+
+if (is_dir($dir)) {
+       if ($dh = opendir($dir)) {
+               while (($entry_main = readdir($dh)) !== false) {
+
+                       if (file_exists("data/items/$entry_main/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                               continue;
+                       }
+
+                       $cat_dir = file_get_contents("data/items/$entry_main/category.txt");
+
+                       if (file_exists("data/categories/$cat_dir/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and !file_exists("data/items/$entry_main/cat.txt")) {
+                               continue;
+                       }
+
+                       if (file_exists("data/nocat.txt") and file_exists("data/items/$entry_main/category.txt") and !file_exists("data/items/$entry_main/cat.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and (!isset($_REQUEST['category']) or empty($_REQUEST['category'])) and (!isset($_REQUEST['entry']) or empty($_REQUEST['entry']))) {
+                               continue;
+                       }
+
+                       if ($entry_main != "." && $entry_main != ".." && fnmatch($filter, $entry_main)) {
+                               if (isset($_REQUEST['category']) and !empty($_REQUEST['category']) and file_exists(strip_tags(strtolower(str_replace(" ", "-", "data/categories/{$_REQUEST['category']}"))))) {
+                                       $category = str_replace(" ", "-", $_REQUEST['category']);
+                                       $category = strtolower($category);
+                                       $category = strip_tags($category);
+                                       if (file_exists("data/items/$entry_main/category.txt") and (file_get_contents("data/items/$entry_main/category.txt") == "$category")) {
+                                               $items[] = $entry_main;
+                                       }
+                               }
+                               else {
+                                       $items[] = $entry_main;
+                               }
+                       }
+               }
+               closedir($dh);
+       }
+}
+
+if (!file_exists("data/old.txt")) {
+       rsort($items);
+}
+
+if (file_exists("data/old.txt")) {
+       sort($items);
+}
+
+if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
+
+       $category = str_replace(" ", "-", $_REQUEST['category']);
+       $category = strtolower($category);
+       $category = strip_tags($category);
+
+       if (file_exists("data/categories/$category/book.txt")) {
+               sort($items);
+       }
+}
+
+reset($items);
+
+$start = $_REQUEST['start'];
+
+if (!isset($_REQUEST['start']) or empty($_REQUEST['start'])) {
+       $start = 0;
+}
+
+$end=$start+$increase;
+    
+$disp=array_slice($items,$start,$increase);
+
+foreach ($disp as $d) {
+
+       if (file_exists("$dir/$d/category.txt")) {
+               $category_check = 'data/categories/' . file_get_contents("$dir/$d/category.txt");
+               if (!file_exists($category_check)) {
+                       unlink("$dir/$d/category.txt");
+               }
+       }
+
+       if (file_exists("$dir/$d/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+               continue;
+       }
+
+       echo '<p><table border=0 cellspacing=0 cellpadding=0 bgcolor=#CCCCCC style="background-color: transparent;"><tr><td width=525><div id=panel_title>';
+       readfile("$dir/$d/title.txt");
+      
+       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+               echo '<a href=del.php?entry=';
+               echo $d;
+               echo '><img src=images/widget.del.png border=0 width=11 height=11 align=right alt="delete entry"></a>';
+               echo '<a href=edit.php?entry=';
+               echo $d;
+               echo '><img src=images/widget.edit.png border=0 width=11 height=11 align=right alt="edit entry"></a>';
+               if (file_exists("$dir/$d/private.txt")) {
+                       echo '<img src=images/widget.private.png border=0 width=11 height=11 align=right alt="private entry">';
+               }
+               if (file_exists("$dir/$d/cat.txt")) {
+                       echo '<img src=images/widget.cat.png border=0 width=11 height=11 align=right alt="always display">';
+               }
+               if (file_exists("$dir/$d/category.txt")) {
+
+                       $read_cat_dir = file_get_contents("$dir/$d/category.txt");
+
+                       if (file_exists("data/categories/$read_cat_dir/private.txt")) {
+                               echo '<img src=images/widget.hidden.png border=0 width=11 height=11 align=right alt="category hidden">';
+                       }
+
+                       if (file_exists("data/nocat.txt")) {
+                               echo '<img src=images/widget.isolated.png border=0 width=11 height=11 align=right alt="category isolated">';
+                       }
+
+                       if (file_exists("data/categories/$read_cat_dir/book.txt")) {
+                               echo '<img src=images/widget.booked.png border=0 width=11 height=11 align=right alt="category booked">';
+                       }
+
+                       echo '<img src=images/widget.filed.png border=0 width=11 height=11 align=right alt="filed under ';
+                       readfile("$dir/$d/category.txt");
+                       echo '">';
+               }
+
+       }
+
+       echo '</div><div id=panel_body>';
+       echo '<font style="font-size: 10px; color: #999999;">';
+       readfile("$dir/$d/date.txt");
+       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+               if (file_exists("$dir/$d/revisions.txt")) {
+                       echo ' (Revision ';
+                       readfile("$dir/$d/revisions.txt");
+                       echo ')';
+               }
+               if (file_exists("$dir/$d/category.txt")) {
+                       echo ' Filed under ';
+                       $category_key = file_get_contents("$dir/$d/category.txt");
+                       $category_key = strtolower($category_key);
+                       if (file_exists("data/categories/{$category_key}/title.txt")) {
+                               $category_dsp = file_get_contents("data/categories/{$category_key}/title.txt");
+                               echo "$category_key ($category_dsp)";
+                       }
+                       else {
+                               echo "$category_key";
+                       }
+               }
+       }
+       echo '</font><font style="font-size: 5px;"><br><br></font>';
+       readfile("$dir/$d/body.txt");
+       echo '</div><div id=panel_footer>';
+       echo '<table border=0 cellspacing=0 cellpadding=0 width=513><tr><td align=right>';
+       echo '<font style="font-size: 10px; color: #999999;">';
+
+if (!file_exists("data/nocomment.txt")) {
+
+       if (!file_exists("$dir/$d/comments/live")) {
+               echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&show=comments>add comment</a>';
+       }
+       else {
+               if ($dh_comments = opendir("$dir/$d/comments/live")) {
+                       while (($entry_comments = readdir($dh_comments)) !== false) {
+                               if ($entry_comments != "." && $entry_comments != ".." && fnmatch("*", $entry_comments)) {
+                                       $items_comments[] = $entry_comments;
+                               }
+                       }
+               closedir($dh_comments);
+               }
+               $comments = count($items_comments);
+               echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&show=comments>';
+               if ($comments == 1) {
+                       echo $comments . ' comment';
+               }
+               elseif ($comments < 1) {
+                       echo 'add comment';
+               }
+               else {
+                       echo $comments . ' comments';
+               }
+               echo '</a>';
+               unset($items_comments);
+       }
+
+}
+else {
+       echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '>permalink</a>';
+}
+
+       if (file_exists("$dir/$d/views.txt")) {
+               $fp_views_txt = fopen("$dir/$d/views.txt","r");
+               $views_value = fread($fp_views_txt,filesize("$dir/$d/views.txt"));
+               fclose($fp_views_txt);
+               if ($views_value == 1) {
+                       echo ' ( ' . $views_value . ' view ) ';
+               }
+               elseif ($views_value > 1) {
+                       echo ' ( ' . $views_value . ' views ) ';
+               }
+               else {
+                       echo ' ';
+               }
+       }
+
+       if (!file_exists("images/$d/album")) {
+               echo ' ';
+       }
+       else {
+               if ($dh_album = opendir("images/$d/album")) {
+                       while (($entry_album = readdir($dh_album)) !== false) {
+                               if ($entry_album != "." && $entry_album != ".." && fnmatch("*", $entry_album)) {
+                                       $items_album[] = $entry_album;
+                               }
+                       }
+               closedir($dh_album);
+               }
+               $album = count($items_album);
+               echo ' | <a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&show=album>';
+               if ($album == 1) {
+                       echo $album . ' image';
+               }
+               elseif ($album < 1) {
+                       echo 'album';
+               }
+               else {
+                       echo $album . ' images';
+               }
+               echo '</a>';
+               unset($items_album);
+       }
+
+       if (file_exists("images/$d/album") and isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == album)) {
+               if (!file_exists("$dir/$d/album")) {
+                       mkdir("$dir/$d/album", 0777);
+                       chmod("$dir/$d/album", 0777);
+               }
+               if (!isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                       $fp_album_views_txt = fopen("$dir/$d/album/views.txt","r");
+                       $album_views_value = fread($fp_album_views_txt,filesize("$dir/$d/album/views.txt"));
+                       fclose($fp_album_views_txt);
+                       $album_views_value = $album_views_value + 1;
+                       $fp_album_views_txt = fopen("$dir/$d/album/views.txt","w");
+                       fwrite($fp_album_views_txt, $album_views_value);
+                       fclose($fp_album_views_txt);
+                       chmod("$dir/$d/album/views.txt", 0666);
+               }
+       }
+
+       $fp_album_views_txt = fopen("$dir/$d/album/views.txt","r");
+       $album_views_value = fread($fp_album_views_txt,filesize("$dir/$d/album/views.txt"));
+       fclose($fp_album_views_txt);
+       if ($album_views_value == 1) {
+               echo ' ( ' . $album_views_value . ' view ) ';
+       }
+       elseif ($album_views_value > 1) {
+               echo ' ( ' . $album_views_value . ' views ) ';
+       }
+       else {
+               echo ' ';
+       }
+
+       if (!file_exists("data/items/$d/filedrop/files")) {
+               echo ' ';
+       }
+       else {
+               if ($dh_filedrop = opendir("data/items/$d/filedrop/files")) {
+                       while (($entry_filedrop = readdir($dh_filedrop)) !== false) {
+                               if ($entry_filedrop != "." && $entry_filedrop != ".." && fnmatch("*", $entry_filedrop)) {
+                                       $items_filedrop[] = $entry_filedrop;
+                               }
+                       }
+               closedir($dh_filedrop);
+               }
+               $filedrop = count($items_filedrop);
+               echo ' | <a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&show=filedrop>';
+               if ($filedrop == 1) {
+                       echo $filedrop . ' file';
+               }
+               elseif ($filedrop < 1) {
+                       echo 'filedrop';
+               }
+               else {
+                       echo $filedrop . ' files';
+               }
+               echo '</a> ';
+               unset($items_filedrop);
+       }
+
+       if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == filedrop)) {
+               if (!file_exists("$dir/$d/filedrop")) {
+                       mkdir("$dir/$d/filedrop", 0777);
+                       chmod("$dir/$d/filedrop", 0777);
+               }
+               if (!isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                       $fp_filedrop_views_txt = fopen("$dir/$d/filedrop/views.txt","r");
+                       $filedrop_views_value = fread($fp_filedrop_views_txt,filesize("$dir/$d/filedrop/views.txt"));
+                       fclose($fp_filedrop_views_txt);
+                       $filedrop_views_value = $filedrop_views_value + 1;
+                       $fp_filedrop_views_txt = fopen("$dir/$d/filedrop/views.txt","w");
+                       fwrite($fp_filedrop_views_txt, $filedrop_views_value);
+                       fclose($fp_filedrop_views_txt);
+                       chmod("$dir/$d/filedrop/views.txt", 0666);
+               }
+       }
+
+       $fp_filedrop_views_txt = fopen("$dir/$d/filedrop/views.txt","r");
+       $filedrop_views_value = fread($fp_filedrop_views_txt,filesize("$dir/$d/filedrop/views.txt"));
+       fclose($fp_filedrop_views_txt);
+       if ($filedrop_views_value == 1) {
+               echo ' ( ' . $filedrop_views_value . ' view ) ';
+       }
+       elseif ($filedrop_views_value > 1) {
+               echo ' ( ' . $filedrop_views_value . ' views ) ';
+       }
+       else {
+               echo ' ';
+       }
+
+       if (!file_exists("data/nocomment.txt")) {
+               echo '| <a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '>permalink</a>';
+       }
+       echo '</font></td></tr></table></div>';
+
+       echo '</td></tr></table></p>';
+
+       if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == album)) {
+               echo '<p><table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
+               echo '<div id=panel_title>Album';
+               if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+                       echo '<a href=del.php?entry=';
+                       echo $d;
+                       echo '&target=album><img src=images/widget.del.png border=0 width=11 height=11 align=right alt="delete album"></a>';
+               }
+               echo '</div><div id=panel_body>';
+
+               if ($dh_album = opendir("images/$d/album")) {
+                       while (($entry_album = readdir($dh_album)) !== false) {
+                               if ($entry_album != "." && $entry_album != ".." && fnmatch("*", $entry_album)) {
+
+                                       $current_image = 'images/' . $d . '/album/' . $entry_album;
+                                       $current_image_size = getimagesize($current_image);
+                                       $current_width = $current_image_size[0];
+                                       $current_height = $current_image_size[1];
+                                       $max_width = 98;
+                                       $max_height = 73;
+
+                                       if (($current_width > $max_width) || ($current_height > $max_height)) {  
+                                               if ($current_height > $current_width) {
+                                                       $sizefactor = (double) ($max_height / $current_height);
+                                               }
+                                               else {
+                                                       $sizefactor = (double) ($max_width / $current_width) ;
+                                               }
+                                       }
+
+                                       $new_width = (int) ($current_width * $sizefactor);
+                                       $new_height = (int) ($current_height * $sizefactor);
+
+                                       echo '<a href=images/' . $d . '/album/' . $entry_album . '>';
+                                       echo '<img src=images/' . $d . '/album/' . $entry_album . ' width=' . $new_width .  ' height=' . $new_height . ' border=0 hspace=2 vspace=2';
+                                       if (file_exists("data/items/$d/album/captions/{$entry_album}.txt")) {
+                                               echo ' alt="';
+                                               readfile("data/items/$d/album/captions/{$entry_album}.txt");
+                                               echo '"';
+                                       }
+                                       echo '></a>';
+
+                               }
+                       }
+               closedir($dh_album);
+               }
+               echo '</div></td></tr></table></p>';
+
+       }
+
+       if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == filedrop)) {
+               echo '<p><table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
+               echo '<div id=panel_title>Filedrop';
+               if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+                       echo '<a href=del.php?entry=';
+                       echo $d;
+                       echo '&target=filedrop><img src=images/widget.del.png border=0 width=11 height=11 align=right alt="delete filedrop"></a>';
+               }
+               echo '</div><div id=panel_body>';
+
+               if ($dh_filedrop = opendir("data/items/$d/filedrop/files")) {
+                       while (($entry_filedrop = readdir($dh_filedrop)) !== false) {
+                               if ($entry_filedrop != "." && $entry_filedrop != ".." && fnmatch("*", $entry_filedrop)) {
+                                       echo '<table border=0 cellspacing=0 cellpadding=4><tr><td>';
+                                       echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&download=' . $entry_filedrop. '>';
+                                       echo '<img src=images/filedrop.png width=36 height=36 border=0 alt="download file"></a></td>';
+                                       echo '<td><p><b>';
+                                       echo $entry_filedrop;
+                                       echo'</b><br>';
+                                       $size = filesize("data/items/$d/filedrop/files/$entry_filedrop");
+                                       $size_string = ($size > 512)?(  ($size/1024 > 512)  ?sprintf("%.02f MB",($size/1024)/1024)  :sprintf("%.02f KB",$size/1024))  :sprintf("%d B",$size);
+                                       echo $size_string;
+                                       $filedrop_count_file = "data/items/$d/filedrop/count/$entry_filedrop" . '.txt';
+                                       if (file_exists($filedrop_count_file)) {
+                                               $fp_filedrop_count = fopen($filedrop_count_file, "r");
+                                               $filedrop_count = fread($fp_filedrop_count, filesize($filedrop_count_file));
+                                               fclose($fp_filedrop_count);
+                                               echo '<br>';
+                                               echo $filedrop_count;
+                                               if ($filedrop_count == 1) {
+                                                       echo ' download';
+                                               }
+                                               if ($filedrop_count > 1) {
+                                                       echo ' downloads';
+                                               }
+                                       }
+                                       echo '</p></td></tr></table>';
+                               }
+                       }
+               closedir($dh_filedrop);
+               }
+               echo '</div></td></tr></table></p>';
+
+       }
+
+       if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == comments)) {
+               echo '<p><table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
+               if ($dh_comments = opendir("$dir/$d/comments/live")) {
+                       while (($entry_comments = readdir($dh_comments)) !== false) {
+                               if ($entry_comments != "." && $entry_comments != ".." && fnmatch("*", $entry_comments)) {                                       $show_comments[] = $entry_comments;
+                               }
+                       }
+               closedir($dh_comments);
+               }
+
+               asort($show_comments);
+               reset($show_comments);
+               foreach ($show_comments as $comment) {
+                       echo '<div id=panel_title>';
+
+                       if (file_exists("$dir/$d/comments/live/$comment/url.txt")) {
+                               echo '<a rel=nofollow target=_blank href=';
+                               readfile("$dir/$d/comments/live/$comment/url.txt");
+                               echo '>';
+                       }
+
+                       readfile("$dir/$d/comments/live/$comment/firstname.txt");
+                       echo ' ';
+                       readfile("$dir/$d/comments/live/$comment/lastname.txt");
+
+                       if (file_exists("$dir/$d/comments/live/$comment/url.txt")) {
+                               echo '</a>';
+                       }
+
+                       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+                               echo '  &lt;';
+                               readfile("$dir/$d/comments/live/$comment/email.txt");
+                               echo '&gt;';
+                       }
+
+                       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+                               echo '<a href=del.php?entry=' . $d . '&comment=' . $comment . '&type=live><img src=images/widget.del.png width=10 height=10 border=0 align=right alt="delete comment"></a>';
+                               echo '<a href=edit.php?entry=' . $d . '&comment=' . $comment . '><img src=images/widget.edit.png width=11 height=11 border=0 align=right alt="edit comment"></a>';
+                       }
+                       echo '</div>';
+                       echo '<div id=panel_body>';
+                       echo '<font style="font-size: 10px; color: #999999;">';
+                       readfile("$dir/$d/comments/live/$comment/timestamp.txt");
+                       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+                               if (file_exists("$dir/$d/comments/live/$comment/revisions.txt")) {
+                                       echo '  (Revision ';
+                                       readfile("$dir/$d/comments/live/$comment/revisions.txt");
+                                       echo ')';
+                               }
+                       }
+                       echo '</font><font style="font-size: 5px;"><br><br></font>';
+                       readfile("$dir/$d/comments/live/$comment/comment.txt");
+                       echo '</div><p></p>';
+               }
+               unset($show_comments);
+               echo '</td></tr></table></p>';
+
+if (!file_exists("data/nocomment.txt")) {
+
+               echo '<table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
+               echo '<p></p><p><font style="font-size: 12px;"><b>Add Comment</b></font></p>';
+
+               $capcha_rand = str_rand(7);
+
+               echo '<p>Fill out the form below and enter <b>' . $capcha_rand . '</b> in the anti-spam field to add your comment. Note that it will not be posted immediately, but will be e-mailed to me first.<br><br>';
+
+               ?>
+              
+               <table border=0 cellspacing=2 cellpadding=0 width=500>
+               <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>?entry=<?php echo $d; ?>&show=comments" method="post">
+               <input type=hidden name=capcha_get value="<?php echo $capcha_rand; ?>">
+               <tr><td width=75><p>First Name*</p></td><td width=300><input class=input type=text autocomplete=off name=firstname maxlength=30></td><td rowspan=7 valign=top width=75 align=right>
+<table border=0 cellspacing=1 cellpadding=2>
+<tr><td><img src=images/smileys/crying.png border=0></td><td><p>:((</p></td><td ><p>crying</p></td></tr>
+<tr><td><img src=images/smileys/frown.png border=0></td><td><p>:(</p></td><td><p>frown</p></td></tr>
+<tr><td><img src=images/smileys/indifferent.png border=0></td><td><p>:|</p></td><td><p>indifferent</p></td></tr>
+<tr><td><img src=images/smileys/laughing.png border=0></td><td><p>:D</p></td><td><p>laughing</p></td></tr>
+<tr><td><img src=images/smileys/lick.png border=0></td><td><p>:P</p></td><td><p>lick</p></td></tr>
+<tr><td><img src=images/smileys/ohno.png border=0></td><td><p>:O</p></td><td><p>oh no!</p></td></tr>
+<tr><td><img src=images/smileys/smile.png border=0></td><td><p>:)</p></td><td><p>smile</p></td></tr>
+<tr><td><img src=images/smileys/surprised.png border=0></td><td><p>=)</p></td><td><p>surprised</p></td></tr>
+<tr><td><img src=images/smileys/undecided.png border=0></td><td><p>:\</p></td><td><p>undecided</p></td></tr>
+<tr><td><img src=images/smileys/wink.png border=0></td><td><p>;)</p></td><td><p>wink</p></td></tr>
+</td></tr>
+</table>
+               <tr><td><p>Last Name*</p></td><td><input class=input type=text autocomplete=off name=lastname maxlength=30></td></tr>
+               <tr><td><p>E-mail*</p></td><td colspan=2><input class=input type=text autocomplete=off name=email maxlength=60></td></tr>
+               <tr><td><p>Website</p></td><td colspan=2><input class=input type=text autocomplete=off name=url maxlength=300></td></tr>
+               <tr><td ><p>Comment*</p></td><td ><textarea class=input name=new_comment rows=10></textarea></td></tr>
+               <tr><td><p>Anti-Spam*</p></td><td><input class=input type=text autocomplete=off name=capcha_put maxlength=7></td></tr>
+               <tr><td><p></p></td><td><input class=input type=submit value="click here to submit your comment"></td></tr>
+               </form>
+               </table>
+               </td></tr></table></p>
+
+<?php
+}
+
+if (!isset($_SESSION['logged_in'])) {
+       if (isset($_REQUEST['show']) and !empty($_REQUEST['show']) and isset($_REQUEST['capcha_put']) and !empty($_REQUEST['capcha_get']) and isset($_REQUEST['firstname']) and !empty($_REQUEST['firstname']) and isset($_REQUEST['lastname']) and !empty($_REQUEST['lastname']) and isset($_REQUEST['email']) and !empty($_REQUEST['email']) and isset($_REQUEST['new_comment']) and !empty($_REQUEST['new_comment']) and isset($_REQUEST['capcha_put']) and !empty($_REQUEST['capcha_put']) and ($_REQUEST['capcha_get'] == $_REQUEST['capcha_put']) and (ereg("@", $_REQUEST['email'])) and (ereg("\.", $_REQUEST['email']))) {
+               echo '<p><table border=0 cellspacing=0 cellpadding=0><tr><td><p><font style="font-size: 12px;"><b>Thanks!</b></font></p><p>Your comment has been submitted for approval.<br>Please check back soon to see if it has been posted.</p></td></tr></table>';
+       }
+}
+ ?>
+      
+
+
+               <?php
+       }
+}
+?>
+
+<?php
+if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
+       if ($dh_pending_comments = opendir("$dir/$d/comments/pending")) {
+               while (($entry_pending_comments = readdir($dh_pending_comments)) !== false) {
+                       if ($entry_pending_comments != "." && $entry_pending_comments != ".." && fnmatch("*", $entry_pending_comments)) {
+                               $show_pending_comments[] = $entry_pending_comments;
+                       }
+               }
+               closedir($dh_pending_comments);
+       }
+
+       asort($show_pending_comments);
+       reset($show_pending_comments);
+       $count_pending_comments = count($show_pending_comments);
+
+       if ($count_pending_comments > 0) {
+               if ($count_pending_comments == 1) {
+                       echo '<p><b>Pending Comment</b></p>';
+               }
+               else {
+                       echo '<p><b>Pending Comments</b></p>';
+               }
+               foreach ($show_pending_comments as $pending_comment) {
+                       echo '<p><table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
+                       echo '<div id=panel_title>';
+
+                       if (file_exists("$dir/$d/comments/pending/$pending_comment/url.txt")) {
+                               echo '<a rel=nofollow target=_blank href=';
+                               readfile("$dir/$d/comments/pending/$pending_comment/url.txt");
+                               echo '>';
+                       }
+      
+                       readfile("$dir/$d/comments/pending/$pending_comment/firstname.txt");
+                       echo ' ';
+                       readfile("$dir/$d/comments/pending/$pending_comment/lastname.txt");
+      
+                       if (file_exists("$dir/$d/comments/pending/$pending_comment/url.txt")) {
+                               echo '</a>';
+                       }
+      
+                       echo ' &lt;';
+                       readfile("$dir/$d/comments/pending/$pending_comment/email.txt");
+                       echo '&gt;';
+                       echo '<a href=del.php?entry=' . $d . '&comment=' . $pending_comment . '&type=pending><img src=images/widget.del.png width=10 height=10 border=0 align=right alt="delete comment"></a>';
+
+                       $pending_comment_key_file = "$dir/$d/comments/pending/$pending_comment/key.txt";
+                       $open_pending_comment_key_file = fopen($pending_comment_key_file,"r");
+                       $pending_comment_login_key = fread($open_pending_comment_key_file,filesize($pending_comment_key_file));
+                       fclose($open_pending_comment_key_file);
+
+                       echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&comment=' . $pending_comment . '&key=' . $pending_comment_login_key . '&action=approve><img src=images/widget.cat.png width=11 height=11 border=0 align=right alt="post comment"></a>';
+                       echo '</div>';
+                       echo '<div id=panel_body>';
+                       echo '<font style="font-size: 10px; color: #999999;">';
+                       readfile("$dir/$d/comments/pending/$pending_comment/timestamp.txt");
+                       echo '</font><font style="font-size: 5px;"><br><br></font>';
+                       readfile("$dir/$d/comments/pending/$pending_comment/comment.txt");
+                       echo '</div><p></p>';
+                       unset($show_pending_comments);
+                       echo '</td></tr></table></p>';
+               }
+       }
+}
+?>
+
+<p><table border=0 cellspacing=0 cellpadding=0 width=100%><tr>
+
+<?php
+if (($start >= $increase) and ($start != 0)) {
+       echo "<td align=left><p><a href=\"" . $_SERVER['PHP_SELF'] . "?";
+       if (isset($_REQUEST['category']) and !empty($_REQUEST['category']) and file_exists(strip_tags(strtolower(str_replace(" ", "_", "data/categories/{$_REQUEST['category']}"))))) {
+               echo "category={$_REQUEST['category']}&";
+       }
+       echo "start=" . ($start-$increase) . "\">previous</a></p></td>";
+}
+
+if ($end < sizeof($items)) {
+       echo "<td align=right><p><a href=\"" . $_SERVER['PHP_SELF'] . "?";
+       if (isset($_REQUEST['category']) and !empty($_REQUEST['category']) and file_exists(strip_tags(strtolower(str_replace(" ", "_", "data/categories/{$_REQUEST['category']}"))))) {
+               echo "category={$_REQUEST['category']}&";
+       }
+       echo "start=" . ($start+$increase) . "\">next</a></p></td>";
+}
+?>
+
+</tr></table></p>
+
+</td>
+
+<td width=15></td>
+<td width=175 valign=top>
+
+<?php
+if ($dh_latest_items = opendir($dir)) {
+       while (($entry_latest_items = readdir($dh_latest_items)) !== false) {
+
+               if (file_exists("data/items/$entry_latest_items/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                       continue;
+               }
+
+               $cat_dir = file_get_contents("data/items/$entry_latest_items/category.txt");
+
+               if (file_exists("data/categories/$cat_dir/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and !file_exists("data/items/$entry_latest_items/cat.txt")) {
+                       continue;
+               }
+
+               if (file_exists("data/nocat.txt") and file_exists("data/items/$entry_latest_items/category.txt") and !file_exists("data/items/$entry_latest_items/cat.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                       continue;
+               }
+
+               if ($entry_latest_items != "." && $entry_latest_items != ".." && fnmatch("*", $entry_latest_items)) {
+                       $show_latest_items[] = $entry_latest_items;
+               }
+       }
+       closedir($dh_latest_items);
+}
+
+rsort($show_latest_items);
+reset($show_latest_items);
+$count_latest_items = count($show_latest_items);
+
+if ($count_latest_items > 0) {
+
+       echo '<div id=panel_title>Recent Entries</div><div id=panel_body>';
+
+       $increment_recent_entries = 0;
+
+       if (($count_latest_items <= $increase) or ($count_latest_items <= $increase * 2)) {
+               $increase = $count_latest_items;
+               $show_recent_entries = $increase - 1;
+       }
+       else {
+               $show_recent_entries = $increase * 2 - 1;
+       }
+
+       while ($increment_recent_entries <= $show_recent_entries) {
+               echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $show_latest_items[$increment_recent_entries] . '>';
+               readfile("$dir/$show_latest_items[$increment_recent_entries]/title.txt");
+               echo '</a><br>';
+               $increment_recent_entries = $increment_recent_entries + 1;
+       }
+}
+
+if ($count_latest_items > 0) {
+       echo '</div>';
+?>
+
+<p></p>
+<form enctype="multipart/form-data" action="dig.php" method="post">
+<div id=panel_title>Search</div>
+<div id=panel_body>
+<input type=text class=search name=search autocomplete=off maxlength=55>
+</div>
+</form>
+
+<?php
+       if (file_exists("data/categories")) {
+               if ($dh_categories = opendir("data/categories")) {
+                       while (($entry_categories = readdir($dh_categories)) !== false) {
+
+                               if (file_exists("data/categories/$entry_categories/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                                       continue;
+                               }
+
+
+                               if ($entry_categories != "." && $entry_categories != ".." && fnmatch("*", $entry_categories)) {
+                                       $show_categories[] = $entry_categories;
+                               }
+                       }
+                       closedir($dh_categories);
+               }
+
+               sort($show_categories);
+               reset($show_categories);
+               $count_categories = count($show_categories);
+
+               if ($count_categories > 0) {
+                       echo '<p></p><div id=panel_title>Categories</div><div id=panel_body>';
+                       foreach ($show_categories as $category) {
+                               echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?category=" . $category . "\">";
+                               if (file_exists("data/categories/$category/title.txt")) {
+                                       $category_title = file_get_contents("data/categories/$category/title.txt");
+                               }
+                               else {
+                                       $category_title = ucfirst($category);
+                               }
+                               echo $category_title;
+                               echo "</a><br />";
+                       }
+                       echo '</div>';
+               }
+       }
+
+       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+               echo '<p></p><div id=panel_title>Statistics</div><div id=panel_body>';
+               echo "Total Entries: $count_latest_items";
+               if (file_exists("data/hits.txt")) {
+                       echo '<br>Site Hits: ';
+                       readfile("data/hits.txt");
+               }
+               if (file_exists("data/google.txt")) {
+                       echo '<br>Google Visits: ';
+                       readfile("data/google.txt");
+               }
+               if (file_exists("data/rss-0.91.txt")) {
+                       echo '<br>RSS 0.91 Hits: ';
+                       readfile("data/rss-0.91.txt");
+               }
+               if (file_exists("data/rss-1.0.txt")) {
+                       echo '<br>RSS 1.0 Hits: ';
+                       readfile("data/rss-1.0.txt");
+               }
+               if (file_exists("data/rss-2.0.txt")) {
+                       echo '<br>RSS 2.0 Hits: ';
+                       readfile("data/rss-2.0.txt");
+               }
+               if (file_exists("data/sitemap.txt")) {
+                       echo '<br>Sitemap Requests: ';
+                       readfile("data/sitemap.txt");
+               }
+               echo '</div>';
+       }
+}
+
+?>
+
+<p></p>
+
+<?php
+if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+       if ($dh_pending_comment_flags = opendir("data/comments/pending")) {
+               while (($entry_pending_comment_flags = readdir($dh_pending_comment_flags)) !== false) {
+                       if ($entry_pending_comment_flags != "." && $entry_pending_comment_flags != ".." && fnmatch("*", $entry_pending_comment_flags)) {
+                               $show_pending_comment_flags[] = $entry_pending_comment_flags;
+                       }
+               }
+               closedir($dh_pending_comment_flags);
+       }
+
+       rsort($show_pending_comment_flags);
+       reset($show_pending_comment_flags);
+       $count_pending_comment_flags = count($show_pending_comment_flags);
+
+       if (($count_latest_items > 0) and ($count_pending_comment_flags > 0)) {
+               echo '<div id=panel_title>Pending Comments</div>';
+               echo '<div id=panel_body>';
+               if ($dh_list_pending_comment_flags = opendir("data/comments/pending")) {
+                       while (($entry_list_pending_comment_flags = readdir($dh_list_pending_comment_flags)) !== false) {
+                               if ($entry_list_pending_comment_flags != "." && $entry_list_pending_comment_flags != ".." && fnmatch("*", $entry_list_pending_comment_flags)) {
+                                       echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' .$entry_list_pending_comment_flags . '&show=comments>';
+                                       readfile("data/items/$entry_list_pending_comment_flags/title.txt");
+                                       echo '</a><br><font style="font-size: 10px; color: #999999;">';
+                                       $fp_comment_count_txt = fopen("data/comments/pending/$entry_list_pending_comment_flags/count.txt","r");
+                                       $comment_count_value = fread($fp_comment_count_txt,filesize("data/comments/pending/$entry_list_pending_comment_flags/count.txt"));
+                                       fclose($fp_comment_count_txt);
+                                       if ($comment_count_value == 1) {
+                                               echo ' ( ' . $comment_count_value . ' comment ) ';
+                                       }
+                                       elseif ($comment_count_value > 1) {
+                                               echo ' ( ' . $comment_count_value . ' comments ) ';
+                                       }
+                                       else {
+                                               echo '';
+                                       }
+                                       echo '</font><br>';
+                               }
+                       }
+                       closedir($dh_list_pending_comment_flags);
+               }
+               echo '</div>';
+       }
+}
+?>
+
+<p></p>
+
+<?php
+if (file_exists("data/albums")) {
+       if ($dh_album_list = opendir("data/albums")) {
+               while (($entry_album_list = readdir($dh_album_list)) !== false) {
+
+                       if (file_exists("data/items/$entry_album_list/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                               continue;
+                       }
+
+                       $pull_cat_dir = file_get_contents("data/items/$entry_album_list/category.txt");
+
+                       if (file_exists("data/categories/$pull_cat_dir/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and !file_exists("data/items/$entry_album_list/cat.txt")) {
+                               continue;
+                       }
+
+                       if ($entry_album_list != "." && $entry_album_list != ".." && fnmatch("*", $entry_album_list)) {
+                               $show_album_list[] = $entry_album_list;
+                       }
+               }
+               closedir($dh_album_list);
+       }
+
+       rsort($show_album_list);
+       reset($show_album_list);
+       $count_album_list = count($show_album_list);
+      
+       if ($count_album_list > 0) {
+               echo '<div id=panel_title>Albums</div>';
+               echo '<div id=panel_body>';
+               foreach ($show_album_list as $album_list_entry) {
+                       echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=';
+                       echo $album_list_entry;
+                       echo '&show=album>';
+                       readfile("data/items/$album_list_entry/title.txt");
+                       echo '</a><br>';
+               }
+               echo '</div>';
+       }
+}
+?>
+
+<p></p>
+
+<?php
+
+if ($count_latest_items > 0) {
+       echo '<p><table border=0 cellspacing=2 cellpadding=0 width=100%>';
+       echo '<tr><td align=center><a target="_button" href="http://engels.mortega.net/index.php?entry=20050521000019"><img src=images/button.maj.png border=0 width=80 height=15></a></td></tr>';
+       echo '<tr><td align=center><a target="_button" rel="nofollow" href="http://php.net/"><img src=images/button.php.png border=0 width=80 height=15></a></td></tr>';
+       $validate_uri = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
+       $validate_uri = str_replace('//', '/', $validate_uri);
+       $validate_uri = "http://" . $validate_uri;
+       echo '<tr><td align=center><a target="_button" rel="nofollow" href="http://jigsaw.w3.org/css-validator/validator?uri=' . $validate_uri . '"><img src=images/button.w3c.css.png border=0 width=80 height=15></a></td></tr>';
+       echo '<tr><td align=center><a target="_button" href="rss.php?ver=0.91"><img src=images/button.rss-0.91.png border=0 width=80 height=15></a></td></tr>';
+       echo '<tr><td align=center><a target="_button" href="rss.php?ver=1.0"><img src=images/button.rss-1.0.png border=0 width=80 height=15></a></td></tr>';
+       echo '<tr><td align=center><a target="_button" href="rss.php?ver=2.0"><img src=images/button.rss-2.0.png border=0 width=80 height=15></a></td></tr>';
+       echo '<tr><td align=center><a target="_button" href="sitemap.php"><img src=images/button.sitemap.png border=0 width=80 height=15></a></td></tr>';
+       if (file_exists("data/sfx.txt")) {
+               $fp_sfx = fopen("data/sfx.txt", "r");
+               $sfx = fread($fp_sfx, filesize("data/sfx.txt"));
+               fclose($fp_sfx);
+               echo '<tr><td align=center><a target="_button" rel="nofollow" href="http://www.spreadfirefox.com/?q=affiliates&amp;id=' . $sfx . '&amp;t=85"><img src=images/button.firefox.png border=0 width=80 height=15></a></td></tr>';
+       }
+       echo '</table></p>';
+
+}
+
+?>
+
+<p></p>
+
+</td></tr>
+</table>
+
+<?php
+if (file_exists("footer.php")) {
+       echo '<p></p>';
+       include("footer.php");
+}
+?>
diff --git a/login.php b/login.php
new file mode 100644
index 0000000..1f04be7
--- /dev/null
+++ b/login.php
@@ -0,0 +1,87 @@
+<?php
+session_start();
+session_regenerate_id();
+header("Cache-control: private");
+?>
+
+<style>
+body
+{
+       color: #666666;
+       margin: 10px;
+       padding: 0px;
+       text-align: left;
+       font-family: verdana, helvetica, sans-serif;
+       background-color: #FFFFFF;
+}
+
+p
+{
+       font-size: 11px;
+}
+
+a
+{
+       font-weight: bold;
+       text-decoration: none;
+}
+
+a:link, a:visited
+{
+       color: #666666;
+}
+
+a:hover
+{
+       color: #336699;
+}
+
+a:active {
+       color: #336699;
+}
+.input {      
+       color: #666666;
+       background: #ffffff;
+       border: #999999 solid 1px;
+       width: 125px;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px;
+}
+</style>
+
+<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+<input autocomplete=off class=input type=text name=username>
+<input autocomplete=off class=input type=password name=password>
+<input class=input type=submit value=login>
+</form>
+
+<?php
+
+$username_file = 'data/username.txt';
+$open_username_file = fopen($username_file,"r");
+$login_username = fread($open_username_file,filesize($username_file));
+fclose($open_username_file);
+
+$password_file = 'data/password.txt';
+$open_password_file = fopen($password_file,"r");
+$login_password = fread($open_password_file,filesize($password_file));
+fclose($open_password_file);
+
+$crypt_password = sha1($_REQUEST['password']);
+$crypt_password = md5($crypt_password);
+$crypt_password = crypt($crypt_password, $crypt_password);
+
+if ($login_username != $_REQUEST['username'] || $login_password != $crypt_password) {
+       $_SESSION = array();
+       session_destroy();
+       echo '<p>Enter your login credentials above or click <a href=index.php>here</a> to go to the index page.</p>';
+       exit();
+}
+
+$_SESSION['logged_in'] = $_REQUEST['username'];
+
+if (isset($_SESSION['logged_in'])) {
+       echo '<p>You are now logged in as ' . $_SESSION['logged_in'] . '. Click <a href=index.php>here</a> to continue.</p>';
+}
+
+?>
diff --git a/rss.php b/rss.php
new file mode 100644
index 0000000..8a20401
--- /dev/null
+++ b/rss.php
@@ -0,0 +1,213 @@
+<?php
+
+if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
+       $title_file = "data/title.txt";
+       $fp_title = fopen($title_file, "r");
+       $title = fread($fp_title, filesize($title_file));
+       fclose($fp_title);
+       $description_file = "data/profile.php";
+       $fp_description = fopen($description_file, "r");
+       $description = fread($fp_description, filesize($description_file));
+       fclose($fp_description);
+       $description = strip_tags($description);
+       $description = htmlentities($description, ENT_NOQUOTES);
+       $author_file = "data/author.txt";
+       $fp_author = fopen($author_file, "r");
+       $author = fread($fp_author, filesize($author_file));
+       fclose($fp_author);
+       $default_increase_file = "data/increase.txt";
+       if (file_exists($default_increase_file)) {
+               $fp_default_increase = fopen($default_increase_file, "r");
+               $increase = fread($fp_default_increase, filesize($default_increase_file));
+               fclose($fp_default_increase);
+       }
+       else {
+               $increase = 5;
+       }
+       $link = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
+       $link = str_replace('//', '/', $link);
+       $link = "http://" . $link;
+       $fix_link = array('//index.php', '///index.php');
+       $dir = "data/items";
+       $feeds = $increase;
+
+       if ($dh_rss_items = opendir($dir)) {
+               while (($entry_rss_items = readdir($dh_rss_items)) !== false) {
+
+                       $cat_dir = file_get_contents("data/items/$entry_rss_items/category.txt");
+
+                       if (file_exists("data/categories/$cat_dir/private.txt") and !file_exists("data/items/$entry_rss_items/cat.txt")) {
+                               continue;
+                       }
+
+                       if ($entry_rss_items != "." && $entry_rss_items != ".." && fnmatch("*", $entry_rss_items) && !file_exists("data/items/$entry_rss_items/private.txt")) {
+                               $show_rss_items[] = $entry_rss_items;
+                       }
+               }
+               closedir($dh_rss_items);
+       }
+
+       rsort($show_rss_items);
+       reset($show_rss_items);
+       $count_rss_items = count($show_rss_items);
+
+       if ($count_rss_items < $feeds) {
+               $feeds = $count_rss_items;
+       }
+
+       if ($count_rss_items > 0) {
+
+               if ($_REQUEST['ver'] == "0.91") {
+                       $rss091_file = fopen("data/rss-0.91.txt", "r");
+                       $rss091_count = fread($rss091_file, filesize("data/rss-0.91.txt"));
+                       fclose($rss091_file);
+                       $rss091_count = $rss091_count + 1;
+                       $rss091_file = fopen("data/rss-0.91.txt", "w");
+                       fwrite($rss091_file, $rss091_count);
+                       fclose($rss091_file);
+                       chmod("data/rss-0.91.txt", 0666);
+                       header('Content-type: application/xml');
+                       echo "<rss version=\"0.91\">\n";
+                       echo "<channel>\n";
+                       echo "<title>$title</title>\n";
+                       echo "<link>$link</link>\n";
+                       echo "<description>$description</description>\n";
+                       echo "<language>en-US</language>\n";
+
+                       $increment_rss_entries = 0;
+                       $show_rss_entries = $feeds - 1;
+                       while ($increment_rss_entries <= $show_rss_entries) {
+                               echo "<item>\n";
+                               echo "<title>";
+                               readfile("$dir/$show_rss_items[$increment_rss_entries]/title.txt");
+                               echo "</title>\n";
+                               $link = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php?entry=$show_rss_items[$increment_rss_entries]";
+                               $link = str_replace($fix_link, '/index.php', $link);
+                               echo "<link>$link</link>\n";
+                               echo "<description>";
+                               $description_file = "$dir/$show_rss_items[$increment_rss_entries]/body.txt";
+                               $fp_description = fopen($description_file, "r");
+                               $description = fread($fp_description, filesize($description_file));
+                               fclose($fp_description);
+                               $description = strip_tags($description);
+                               $description = htmlentities($description, ENT_NOQUOTES);
+                               echo $description;
+                               echo "</description>\n";
+                               echo "</item>\n";
+                               $increment_rss_entries = $increment_rss_entries + 1;
+                       }
+                       echo "</channel>\n";
+                       echo "</rss>";
+               }
+
+               if ($_REQUEST['ver'] == "1.0") {
+                       $rss10_file = fopen("data/rss-1.0.txt", "r");
+                       $rss10_count = fread($rss10_file, filesize("data/rss-1.0.txt"));
+                       fclose($rss10_file);
+                       $rss10_count = $rss10_count + 1;
+                       $rss10_file = fopen("data/rss-1.0.txt", "w");
+                       fwrite($rss10_file, $rss10_count);
+                       fclose($rss10_file);
+                       chmod("data/rss-1.0.txt", 0666);
+                       header('Content-type: application/xml');
+                       echo "<rdf:RDF\n";
+                       echo "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
+                       echo "xmlns=\"http://purl.org/rss/1.0/\"\n";
+                       echo "xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n";
+                       echo ">\n";
+                       echo "<channel rdf:about=\"$link\">\n";
+                       echo "<title>$title</title>\n";
+                       echo "<link>$link</link>\n";
+                       echo "<description>$description</description>\n";
+                       echo "<items>\n";
+                       echo "<rdf:Seq>\n";
+                       $increment_rss_entries = 0;
+                       $show_rss_entries = $feeds - 1;
+                       while ($increment_rss_entries <= $show_rss_entries) {
+                               $link = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php?entry=$show_rss_items[$increment_rss_entries]";
+                               $link = str_replace($fix_link, '/index.php', $link);
+                               echo "<rdf:li rdf:resource=\"$link\"/>\n";
+                               $increment_rss_entries = $increment_rss_entries + 1;
+                       }
+                       echo "</rdf:Seq>\n";
+                       echo "</items>\n";
+                       echo "</channel>\n";
+                       $increment_rss_entries = 0;
+                       while ($increment_rss_entries <= $show_rss_entries) {
+                               $link = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php?entry=$show_rss_items[$increment_rss_entries]";
+                               $link = str_replace($fix_link, '/index.php', $link);
+                               echo "<item rdf:about=\"$link\">\n";
+                               echo "<title>";
+                               readfile("$dir/$show_rss_items[$increment_rss_entries]/title.txt");
+                               echo "</title>\n";
+                               echo "<link>$link</link>\n";
+                               echo "<description>";
+                               $description_file = "$dir/$show_rss_items[$increment_rss_entries]/body.txt";
+                               $fp_description = fopen($description_file, "r");
+                               $description = fread($fp_description, filesize($description_file));
+                               fclose($fp_description);
+                               $description = strip_tags($description);
+                               $description = htmlentities($description, ENT_NOQUOTES);
+                               echo $description;
+                               echo "</description>\n";
+                               echo "<dc:creator>$author</dc:creator>\n";
+                               echo "<dc:date>";
+                               readfile("$dir/$show_rss_items[$increment_rss_entries]/date.txt");                             
+                               echo "</dc:date>\n";
+                               echo "</item>\n";
+                               $increment_rss_entries = $increment_rss_entries + 1;
+                       }
+                       echo "</rdf:RDF>";
+               }
+
+               if ($_REQUEST['ver'] == "2.0") {
+                       $rss20_file = fopen("data/rss-2.0.txt", "r");
+                       $rss20_count = fread($rss20_file, filesize("data/rss-2.0.txt"));
+                       fclose($rss20_file);
+                       $rss20_count = $rss20_count + 1;
+                       $rss20_file = fopen("data/rss-2.0.txt", "w");
+                       fwrite($rss20_file, $rss20_count);
+                       fclose($rss20_file);
+                       chmod("data/rss-2.0.txt", 0666);
+                       header('Content-type: application/xml');
+                       echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
+                       echo "<channel>\n";
+                       echo "<title>$title</title>\n";
+                       echo "<link>$link</link>\n";
+                       echo "<description>$description</description>\n";
+                       echo "<language>en-US</language>\n";
+
+                       $increment_rss_entries = 0;
+                       $show_rss_entries = $feeds - 1;
+                       while ($increment_rss_entries <= $show_rss_entries) {
+                               echo "<item>\n";
+                               echo "<title>";
+                               readfile("$dir/$show_rss_items[$increment_rss_entries]/title.txt");
+                               echo "</title>\n";
+                               $link = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php?entry=$show_rss_items[$increment_rss_entries]";
+                               $link = str_replace($fix_link, '/index.php', $link);
+                               echo "<link>$link</link>\n";
+                               echo "<description>";
+                               $description_file = "$dir/$show_rss_items[$increment_rss_entries]/body.txt";
+                               $fp_description = fopen($description_file, "r");
+                               $description = fread($fp_description, filesize($description_file));
+                               fclose($fp_description);
+                               $description = strip_tags($description);
+                               $description = htmlentities($description, ENT_NOQUOTES);
+                               echo $description;
+                               echo "</description>\n";
+                               echo "<dc:creator>$author</dc:creator>";
+                               echo "<dc:date>";
+                               readfile("$dir/$show_rss_items[$increment_rss_entries]/date.txt");                             
+                               echo "</dc:date>\n";
+                               echo "</item>\n";
+                               $increment_rss_entries = $increment_rss_entries + 1;
+                       }
+                       echo "</channel>\n";
+                       echo "</rss>";
+               }
+
+       }
+}
+
+?>
diff --git a/settings.php b/settings.php
new file mode 100644
index 0000000..5634d08
--- /dev/null
+++ b/settings.php
@@ -0,0 +1,588 @@
+<?php
+session_start();
+header("Cache-control: private");
+
+$login_username = file_get_contents("data/username.txt");
+
+if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
+       exit();
+}
+
+if (isset($_REQUEST['title']) and !empty($_REQUEST['title']) and (file_get_contents("data/title.txt") != $_REQUEST['title'])) {
+       $title_write_content = ucfirst($_REQUEST['title']);
+       $fp_title_txt = fopen("data/title.txt","w");
+       chmod("data/title.txt", 0666);
+       fwrite($fp_title_txt,$title_write_content);
+       fclose($fp_title_txt);
+}
+
+if (isset($_REQUEST['author']) and !empty($_REQUEST['author']) and (file_get_contents("data/author.txt") != $_REQUEST['author'])) {
+       $author_write_content = ucfirst($_REQUEST['author']);
+       $fp_author_txt = fopen("data/author.txt","w");
+       chmod("data/author.txt", 0666);
+       fwrite($fp_author_txt,$author_write_content);
+       fclose($fp_author_txt);
+}
+
+if (isset($_REQUEST['email']) and !empty($_REQUEST['email']) and (file_get_contents("data/email.txt") != $_REQUEST['email']) and (ereg("@", $_REQUEST['email'])) and (ereg("\.", $_REQUEST['email']))) {
+       $email_write_content = strtolower($_REQUEST['email']);
+       $email_write_content = trim($email_write_content);
+       $email_write_content = htmlentities($email_write_content, ENT_NOQUOTES);
+       $fp_email_txt = fopen("data/email.txt","w");
+       chmod("data/email.txt", 0666);
+       fwrite($fp_email_txt,$email_write_content);
+       fclose($fp_email_txt);
+}
+
+if (isset($_REQUEST['increase']) and !empty($_REQUEST['increase']) and is_numeric($_REQUEST['increase']) and ($_REQUEST['increase'] > 0) and (file_get_contents("data/increase.txt") != $_REQUEST['increase'])) {
+       $increase_write_content = number_format($_REQUEST['increase'],0,'.','');
+       $fp_increase_txt = fopen("data/increase.txt","w");
+       chmod("data/increase.txt", 0666);
+       fwrite($fp_increase_txt,$increase_write_content);
+       fclose($fp_increase_txt);
+}
+
+if (!isset($_REQUEST['increase']) or empty($_REQUEST['increase']) or !is_numeric($_REQUEST['increase']) or ($_REQUEST['increase'] <= 0)) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/increase.txt")) {
+                       unlink("data/increase.txt");
+               }
+       }
+}
+
+if (isset($_REQUEST['offset']) and !empty($_REQUEST['offset']) and is_numeric($_REQUEST['offset']) and (file_get_contents("data/offset.txt") != $_REQUEST['offset'])) {
+       $fp_offset_txt = fopen("data/offset.txt","w");
+       chmod("data/offset.txt", 0666);
+       fwrite($fp_offset_txt,$_REQUEST['offset']);
+       fclose($fp_offset_txt);
+}
+
+if (!isset($_REQUEST['offset']) or empty($_REQUEST['offset']) or !is_numeric($_REQUEST['offset'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/offset.txt")) {
+                       unlink("data/offset.txt");
+               }
+       }
+}
+
+if (isset($_REQUEST['sfx']) and !empty($_REQUEST['sfx']) and is_numeric($_REQUEST['sfx']) and (file_get_contents("data/sfx.txt") != $_REQUEST['sfx'])) {
+       $fp_sfx_txt = fopen("data/sfx.txt","w");
+       chmod("data/sfx.txt", 0666);
+       fwrite($fp_sfx_txt,$_REQUEST['sfx']);
+       fclose($fp_sfx_txt);
+}
+
+if (!isset($_REQUEST['sfx']) or empty($_REQUEST['sfx']) or !is_numeric($_REQUEST['sfx'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/sfx.txt")) {
+                       unlink("data/sfx.txt");
+               }
+       }
+}
+
+if (isset($_REQUEST['ping']) and !empty($_REQUEST['ping']) and (file_get_contents("data/ping.txt") != $_REQUEST['ping']) and (ereg("\.", $_REQUEST['ping'])) and (ereg("http://", $_REQUEST['ping']))) {
+       $ping_write_content = strtolower($_REQUEST['ping']);
+       $ping_write_content = trim($ping_write_content);
+       $ping_write_content = htmlentities($ping_write_content, ENT_NOQUOTES);
+       $fp_ping_txt = fopen("data/ping.txt","w");
+       chmod("data/ping.txt", 0666);
+       fwrite($fp_ping_txt,$ping_write_content);
+       fclose($fp_ping_txt);
+}
+
+if (!isset($_REQUEST['ping']) or empty($_REQUEST['ping'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/ping.txt")) {
+                       unlink("data/ping.txt");
+               }
+       }
+}
+
+if (isset($_REQUEST['nocomment']) and !empty($_REQUEST['nocomment']) and ($_REQUEST['nocomment'] == "on") and !file_exists("data/nocomment.txt")) {
+       touch("data/nocomment.txt");
+       chmod("data/nocomment.txt", 0666);
+}
+
+if (!isset($_REQUEST['nocomment']) or empty($_REQUEST['nocomment'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/nocomment.txt")) {
+                       unlink("data/nocomment.txt");
+               }
+       }
+}
+
+if (isset($_REQUEST['nak']) and !empty($_REQUEST['nak']) and ($_REQUEST['nak'] == "on") and !file_exists("data/nak.txt")) {
+       touch("data/nak.txt");
+       chmod("data/nak.txt", 0666);
+}
+
+if (!isset($_REQUEST['nak']) or empty($_REQUEST['nak'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/nak.txt")) {
+                       unlink("data/nak.txt");
+               }
+       }
+}
+
+if (isset($_REQUEST['nocat']) and !empty($_REQUEST['nocat']) and ($_REQUEST['nocat'] == "on") and !file_exists("data/nocat.txt")) {
+       touch("data/nocat.txt");
+       chmod("data/nocat.txt", 0666);
+}
+
+if (!isset($_REQUEST['nocat']) or empty($_REQUEST['nocat'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/nocat.txt")) {
+                       unlink("data/nocat.txt");
+               }
+       }
+}
+
+if (isset($_REQUEST['old']) and !empty($_REQUEST['old']) and ($_REQUEST['old'] == "on") and !file_exists("data/old.txt")) {
+       touch("data/old.txt");
+       chmod("data/old.txt", 0666);
+}
+
+if (!isset($_REQUEST['old']) or empty($_REQUEST['old'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/old.txt")) {
+                       unlink("data/old.txt");
+               }
+       }
+}
+
+if (isset($_REQUEST['del_favicon']) and !empty($_REQUEST['del_favicon']) and ($_REQUEST['del_favicon'] == "on")) {
+       if (file_exists("favicon.ico")) {
+               unlink("favicon.ico");
+       }
+}
+
+if (isset($_REQUEST['del_picture']) and !empty($_REQUEST['del_picture']) and ($_REQUEST['del_picture'] == "on")) {
+       if (file_exists("images/profile.gif")) {
+               unlink("images/profile.gif");
+       }
+
+       if (file_exists("images/profile.jpg")) {
+               unlink("images/profile.jpg");
+       }
+
+       if (file_exists("images/profile.png")) {
+               unlink("images/profile.png");
+       }
+}
+
+if (isset($_REQUEST['bg_scroll']) and !empty($_REQUEST['bg_scroll']) and ($_REQUEST['bg_scroll'] == "on") and !file_exists("data/bg-scroll.txt")) {
+       touch("data/bg-scroll.txt");
+       chmod("data/bg-scroll.txt", 0666);
+}
+
+if (!isset($_REQUEST['bg_scroll']) or empty($_REQUEST['bg_scroll'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/bg-scroll.txt")) {
+                       unlink("data/bg-scroll.txt");
+               }
+       }
+}
+
+if (isset($_REQUEST['bg_repeat']) and !empty($_REQUEST['bg_repeat']) and (file_get_contents("data/bg-repeat.txt") != $_REQUEST['bg_repeat']) and ($_REQUEST['bg_repeat'] != "repeat")) {
+       $fp_bg_repeat_txt = fopen("data/bg-repeat.txt","w");
+       chmod("data/bg-repeat.txt", 0666);
+       fwrite($fp_bg_repeat_txt,$_REQUEST['bg_repeat']);
+       fclose($fp_bg_repeat_txt);
+}
+
+if (isset($_REQUEST['bg_repeat']) and !empty($_REQUEST['bg_repeat']) and (file_get_contents("data/bg-repeat.txt") != $_REQUEST['bg_repeat']) and ($_REQUEST['bg_repeat'] == "repeat") and file_exists("data/bg-repeat.txt")) {
+       unlink("data/bg-repeat.txt");
+}
+
+if (isset($_REQUEST['bg_position']) and !empty($_REQUEST['bg_position']) and (file_get_contents("data/bg-position.txt") != $_REQUEST['bg_position']) and ($_REQUEST['bg_position'] != "top left")) {
+       $fp_bg_position_txt = fopen("data/bg-position.txt","w");
+       chmod("data/bg-position.txt", 0666);
+       fwrite($fp_bg_position_txt,$_REQUEST['bg_position']);
+       fclose($fp_bg_position_txt);
+}
+
+if (isset($_REQUEST['bg_position']) and !empty($_REQUEST['bg_position']) and (file_get_contents("data/bg-position.txt") != $_REQUEST['bg_position']) and ($_REQUEST['bg_position'] == "top left") and file_exists("data/bg-position.txt")) {
+       unlink("data/bg-position.txt");
+}
+
+if (isset($_REQUEST['del_background']) and !empty($_REQUEST['del_background']) and ($_REQUEST['del_background'] == "on")) {
+       if (file_exists("images/background.gif")) {
+               unlink("images/background.gif");
+       }
+
+       if (file_exists("images/background.jpg")) {
+               unlink("images/background.jpg");
+       }
+
+       if (file_exists("images/background.png")) {
+               unlink("images/background.png");
+       }
+
+       if (file_exists("data/bg-scroll.txt")) {
+               unlink("data/bg-scroll.txt");
+       }
+
+       if (file_exists("data/bg-repeat.txt")) {
+               unlink("data/bg-repeat.txt");
+       }
+
+       if (file_exists("data/bg-position.txt")) {
+               unlink("data/bg-position.txt");
+       }
+}
+
+$max_image_size = 2000000;
+
+if (isset($_FILES['favicon']) and !empty($_FILES['favicon'])) {
+
+       if (is_uploaded_file($_FILES['favicon']['tmp_name'])) {
+
+               if ($_FILES['favicon']['size']<=$max_image_size) {
+
+                       if ($_FILES['favicon']['name'] == "favicon.ico") {
+
+                               if (file_exists("favicon.ico")) {
+                                       unlink("favicon.ico");
+                               }
+
+                               $res = copy($_FILES['favicon']['tmp_name'], "favicon.ico");
+                               unlink($_FILES['favicon']['tmp_name']);
+                               chmod("favicon.ico", 0666);
+                       }
+                       else {
+                               unlink($_FILES['favicon']['tmp_name']);
+                       }
+               }
+               else {
+                       unlink($_FILES['favicon']['tmp_name']);
+               }
+       }
+       else {
+               unlink($_FILES['favicon']['tmp_name']);
+       }
+}
+
+if (isset($_FILES['picture']) and !empty($_FILES['picture'])) {
+
+       if (is_uploaded_file($_FILES['picture']['tmp_name'])) {
+
+               if ($_FILES['picture']['size']<=$max_image_size) {
+
+                       if (($_FILES['picture']['type']=="image/gif") || ($_FILES['picture']['type']=="image/pjpeg") || ($_FILES['picture']['type']=="image/jpeg") || ($_FILES['picture']['type']=="image/png")) {
+
+                               if (!file_exists("images")) {
+                                       mkdir("images", 0777);
+                                       chmod("images", 0777);
+                               }
+
+                               if (file_exists("images/profile.gif")) {
+                                       unlink("images/profile.gif");
+                               }
+
+                               if (file_exists("images/profile.jpg")) {
+                                       unlink("images/profile.jpg");
+                               }
+
+                               if (file_exists("images/profile.png")) {
+                                       unlink("images/profile.png");
+                               }
+
+                               if ($_FILES['picture']['type']=="image/gif") {
+                                       $res = copy($_FILES['picture']['tmp_name'], "images/profile.gif");
+                                       unlink($_FILES['picture']['tmp_name']);
+                                       chmod("images/profile.gif", 0666);
+                               }
+
+                               if (($_FILES['picture']['type']=="image/jpeg") or ($_FILES['picture']['type']=="image/pjpeg")) {
+                                       $res = copy($_FILES['picture']['tmp_name'], "images/profile.jpg");
+                                       unlink($_FILES['picture']['tmp_name']);
+                                       chmod("images/profile.jpg", 0666);
+                               }
+
+                               if ($_FILES['picture']['type']=="image/png") {
+                                       $res = copy($_FILES['picture']['tmp_name'], "images/profile.png");
+                                       unlink($_FILES['picture']['tmp_name']);
+                                       chmod("images/profile.png", 0666);
+                               }
+                       }
+                       else {
+                               unlink($_FILES['picture']['tmp_name']);
+                       }
+               }
+               else {
+                       unlink($_FILES['picture']['tmp_name']);
+               }
+       }
+       else {
+               unlink($_FILES['picture']['tmp_name']);
+       }
+}
+
+if (isset($_FILES['background']) and !empty($_FILES['background'])) {
+
+       if (is_uploaded_file($_FILES['background']['tmp_name'])) {
+
+               if ($_FILES['background']['size']<=$max_image_size) {
+
+                       if (($_FILES['background']['type']=="image/gif") || ($_FILES['background']['type']=="image/pjpeg") || ($_FILES['background']['type']=="image/jpeg") || ($_FILES['background']['type']=="image/png")) {
+
+                               if (!file_exists("images")) {
+                                       mkdir("images", 0777);
+                                       chmod("images", 0777);
+                               }
+
+                               if (file_exists("images/background.gif")) {
+                                       unlink("images/background.gif");
+                               }
+
+                               if (file_exists("images/background.jpg")) {
+                                       unlink("images/background.jpg");
+                               }
+
+                               if (file_exists("images/background.png")) {
+                                       unlink("images/background.png");
+                               }
+
+                               if ($_FILES['background']['type']=="image/gif") {
+                                       $res = copy($_FILES['background']['tmp_name'], "images/background.gif");
+                                       unlink($_FILES['background']['tmp_name']);
+                                       chmod("images/background.gif", 0666);
+                               }
+
+                               if (($_FILES['background']['type']=="image/jpeg") or ($_FILES['background']['type']=="image/pjpeg")) {
+                                       $res = copy($_FILES['background']['tmp_name'], "images/background.jpg");
+                                       unlink($_FILES['background']['tmp_name']);
+                                       chmod("images/background.jpg", 0666);
+                               }
+
+                               if ($_FILES['background']['type']=="image/png") {
+                                       $res = copy($_FILES['background']['tmp_name'], "images/background.png");
+                                       unlink($_FILES['background']['tmp_name']);
+                                       chmod("images/background.png", 0666);
+                               }
+                       }
+                       else {
+                               unlink($_FILES['background']['tmp_name']);
+                       }
+               }
+               else {
+                       unlink($_FILES['background']['tmp_name']);
+               }
+       }
+       else {
+               unlink($_FILES['background']['tmp_name']);
+       }
+}
+
+if (isset($_REQUEST['profile']) and !empty($_REQUEST['profile']) and (file_get_contents("data/profile.txt") != $_REQUEST['profile'])) {
+       $profile_write_content = ucfirst($_REQUEST['profile']);
+       $fp_profile_txt = fopen("data/profile.php","w");
+       chmod("data/profile.txt", 0666);
+       fwrite($fp_profile_txt,$profile_write_content);
+       fclose($fp_profile_txt);
+}
+
+if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and (file_get_contents("data/username.txt") != $_REQUEST['username'])) {
+       $fp_username_txt = fopen("data/username.txt","w");
+       chmod("data/username.txt", 0666);
+       fwrite($fp_username_txt,$_REQUEST['username']);
+       fclose($fp_username_txt);
+       $login_url = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/login.php";
+       $login_url = str_replace("//login.php", "/login.php", $login_url);
+       header("Location: $login_url");
+}
+
+?>
+
+<style>
+body
+{
+       color: #666666;
+       margin: 10px;
+       padding: 0px;
+       text-align: left;
+       font-family: verdana, helvetica, sans-serif;
+       background-color: #FFFFFF;
+}
+p
+{
+       font-size: 11px;
+}
+a
+{
+       font-weight: bold;
+       text-decoration: none;
+}
+a:link, a:visited
+{
+       color: #666666;
+}
+a:hover
+{
+       color: #336699;
+}
+a:active {
+       color: #336699;
+}
+.input {      
+       color: #666666;
+       background: #ffffff;
+       border: #999999 solid 1px;
+       width: 300px;
+       font-family: verdana,helvetica,sans-serif;
+       font-size: 11px
+}
+</style>
+
+<table border=0 cellspacing=1 cellpadding=2>
+<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+<input type=hidden name=edit value=on>
+<tr><td><p>blog title*</p></td><td><input autocomplete=off class=input type=text name=title value="<?php readfile("data/title.txt"); ?>"></td></tr>
+<tr><td><p>author*</p></td><td><input autocomplete=off class=input type=text name=author value="<?php readfile("data/author.txt"); ?>"></td></tr>
+<tr><td><p>e-mail address*</p></td><td><input autocomplete=off class=input type=text name=email value="<?php readfile("data/email.txt"); ?>"></td></tr>
+<tr><td><p>username*</p></td><td><input autocomplete=off class=input type=text name=username value="<?php readfile("data/username.txt"); ?>"></td></tr>
+<tr><td><p>entries per page*</p></td><td><input autocomplete=off class=input type=text name=increase value="<?php readfile("data/increase.txt"); ?>"></td></tr>
+<tr><td><p>timezone offset in seconds</p></td><td><input autocomplete=off class=input type=text name=offset value="<?php readfile("data/offset.txt"); ?>"></td></tr>
+<tr><td><p>spread firefox <a href="http://www.spreadfirefox.com/?q=user/register&r=76458" target=_maj>affiliate</a> id</p></td><td><input autocomplete=off class=input type=text name=sfx value="<?php readfile("data/sfx.txt"); ?>"></td></tr>
+<tr><td><p>ping on content change</p></td><td><input autocomplete=off class=input type=text name=ping value="<?php readfile("data/ping.txt"); ?>"></td></tr>
+       <tr><td rowspan=4><p>toggles</p></td><td><p><input type=checkbox name=nocomment <?php if (file_exists("data/nocomment.txt")) { echo checked; } ?>> Do not allow visitors to post comments.</p></td></tr>
+<tr><td><p><input type=checkbox name=nak <?php if (file_exists("data/nak.txt")) { echo checked; } ?>> Do not acknowledge comment submissions via e-mail.</p></td></tr>
+<tr><td><p><input type=checkbox name=nocat <?php if (file_exists("data/nocat.txt")) { echo checked; } ?>> Do not show categorized items with unfiled entries.</p></td></tr>
+<tr><td><p><input type=checkbox name=old <?php if (file_exists("data/old.txt")) { echo checked; } ?>> Display entries from oldest to newest.</p></td></tr>
+<?php
+if (file_exists("favicon.ico")) {
+       echo '<tr><td></td><td><p><input type=checkbox name=del_favicon> Delete existing <i>favicon.ico</i>.</p></td></tr>';
+}
+if (file_exists("images/profile.gif") or file_exists("images/profile.jpg") or file_exists("images/profile.png")) {
+       echo '<tr><td></td><td><p><input type=checkbox name=del_picture> Delete existing profile picture.</p></td></tr>';
+}
+if (file_exists("images/background.gif") or file_exists("images/background.jpg") or file_exists("images/background.png")) {
+       echo '<tr><td></td><td><p><input type=checkbox name=del_background> Delete existing background image.</p></td></tr>';
+       echo '<tr><td></td><td><p><input type=checkbox name=bg_scroll';
+       if (file_exists("data/bg-scroll.txt")) {
+               echo " checked";
+       }
+       echo '> Background image scrolls with the rest of the page.</p></td></tr>';
+       echo '<tr><td rowspan=4><p>background repeat</td><td><p><input type="radio" name="bg_repeat" value="repeat"
+  style="background : #FFFFFF; color : #666666"';
+       if (!file_exists("data/bg-repeat.txt")) {
+               echo ' checked';
+       }
+       echo '> Background image will be repeated vertically and horizontally.</p></td></tr>';
+       echo '<tr><td><p><input type="radio" name="bg_repeat" value="repeat-x"
+  style="background : #FFFFFF; color : #666666"';
+       if (file_exists("data/bg-repeat.txt") and (file_get_contents("data/bg-repeat.txt") == "repeat-x")) {
+               echo ' checked';
+       }
+       echo '> Background image will be repeated horizontally.</p></td></tr>';
+       echo '<tr><td><p><input type="radio" name="bg_repeat" value="repeat-y"
+  style="background : #FFFFFF; color : #666666"';
+       if (file_exists("data/bg-repeat.txt") and (file_get_contents("data/bg-repeat.txt") == "repeat-y")) {
+               echo ' checked';
+       }
+       echo '> Background image will be repeated vertically.</p></td></tr>';
+       echo '<tr><td><p><input type="radio" name="bg_repeat" value="no-repeat"
+  style="background : #FFFFFF; color : #666666"';
+       if (file_exists("data/bg-repeat.txt") and (file_get_contents("data/bg-repeat.txt") == "no-repeat")) {
+               echo ' checked';
+       }
+       echo '> Background image will be displayed only once.</p></td></tr>';
+
+       if (file_exists("data/bg-repeat.txt")) {
+               echo '<tr><td><p>background position</td><td>
+
+<table border=0 cellspacing=1 cellpadding=1 bgcolor=#999999>
+<tr><td bgcolor=#FFFFFF width=25% align=center><p>Position</p></td><td bgcolor=#FFFFFF width=25% align=center><p>Left</p></td><td bgcolor=#FFFFFF width=25% align=center><p>Center</p></td><td bgcolor=#FFFFFF width=25% align=center><p>Right</p></td></tr>
+<tr><td bgcolor=#FFFFFF><p>Top</p></td>
+<td bgcolor=#FFFFFF align=center>
+
+<p><input type="radio" name="bg_position" value="top left" style="background : #FFFFFF; color : #666666"';
+               if (!file_exists("data/bg-position.txt")) {
+                       echo ' checked';
+               }
+               echo '></p></td>';
+
+               echo '<td bgcolor=#FFFFFF align=center><p><input type="radio" name="bg_position" value="top center" style="background : #FFFFFF; color : #666666"';
+               if (file_exists("data/bg-position.txt") and (file_get_contents("data/bg-position.txt") == "top center")) {
+                       echo ' checked';
+               }
+               echo '></p></td>';
+
+               echo '<td bgcolor=#FFFFFF align=center><p><input type="radio" name="bg_position" value="top right" style="background : #FFFFFF; color : #666666"';
+               if (file_exists("data/bg-position.txt") and (file_get_contents("data/bg-position.txt") == "top right")) {
+                       echo ' checked';
+               }
+               echo '></p></td></tr>';
+
+               echo '<tr><td bgcolor=#FFFFFF><p>Center</p></td><td bgcolor=#FFFFFF align=center><p><input type="radio" name="bg_position" value="center left" style="background : #FFFFFF; color : #666666"';
+               if (file_exists("data/bg-position.txt") and (file_get_contents("data/bg-position.txt") == "center left")) {
+                       echo ' checked';
+               }
+               echo '></p></td>';
+
+               echo '<td bgcolor=#FFFFFF align=center><p><input type="radio" name="bg_position" value="center center" style="background : #FFFFFF; color : #666666"';
+               if (file_exists("data/bg-position.txt") and (file_get_contents("data/bg-position.txt") == "center center")) {
+                       echo ' checked';
+               }
+               echo '></p></td>';
+
+               echo '<td bgcolor=#FFFFFF align=center><p><input type="radio" name="bg_position" value="center right" style="background : #FFFFFF; color : #666666"';
+               if (file_exists("data/bg-position.txt") and (file_get_contents("data/bg-position.txt") == "center right")) {
+                       echo ' checked';
+               }
+               echo '></p></td></tr>';
+
+               echo '<tr><td bgcolor=#FFFFFF><p>Bottom</p></td><td bgcolor=#FFFFFF align=center><p><input type="radio" name="bg_position" value="bottom left" style="background : #FFFFFF; color : #666666"';
+               if (file_exists("data/bg-position.txt") and (file_get_contents("data/bg-position.txt") == "bottom left")) {
+                       echo ' checked';
+               }
+               echo '></p></td>';
+
+               echo '<td bgcolor=#FFFFFF align=center><p><input type="radio" name="bg_position" value="bottom center" style="background : #FFFFFF; color : #666666"';
+               if (file_exists("data/bg-position.txt") and (file_get_contents("data/bg-position.txt") == "bottom center")) {
+                       echo ' checked';
+               }
+               echo '></p></td>';
+
+               echo '<td bgcolor=#FFFFFF align=center><p><input type="radio" name="bg_position" value="bottom right" style="background : #FFFFFF; color : #666666"';
+               if (file_exists("data/bg-position.txt") and (file_get_contents("data/bg-position.txt") == "bottom right")) {
+                       echo ' checked';
+               }
+         &nbs