maj.world

maj.world

Git

This commit has been accessed 527 times via Git panel.

commit 08159fba8bbabf93c8064444c04b9278c2e59a7c
tree 784fc35e7a2e470dd95702b09f50602d79cb078f
parent e011ee437bfb34cf32d77eb1f22ae07947616f69
author Engels Antonio <engels@majcms.org> 1277314202 +0800
committer Engels Antonio <engels@majcms.org> 1277314202 +0800

    maj-1.0-20081123-bb.zip

diff --git a/add.php b/add.php
index b31967a..01b761f 100644
--- a/add.php
+++ b/add.php
@@ -6,9 +6,16 @@ header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
+
 if (get_magic_quotes_gpc()) {
+
        function stripslashes_array($data) {
+
                if (is_array($data)) {
+
                        foreach ($data as $key => $value){
                                $data[$key] = stripslashes_array($value);
                        }
@@ -18,7 +25,6 @@ if (get_magic_quotes_gpc()) {
                        return stripslashes($data);
                }
        }
-
        $_POST = stripslashes_array($_POST);
 }
 
@@ -33,7 +39,9 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
 if ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) {
 
        if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) {
+
                $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
+
                if (!file_exists("data/categories/$bb_cat") or ($bb_cat == "")) {
                        unlink("data/members/active/{$_SESSION['logged_in']}/category.txt");
                }
@@ -136,7 +144,6 @@ $entry_hour = date("H", time() + $offset);
 $entry_min = date("i", time() + $offset);
 $entry_sec = date("s", time() + $offset);
 
-$image_path = "images/";
 $max_image_size = 8000000;
 $max_file_size = 8000000;
 
@@ -332,6 +339,7 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
 <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>
 <p><input autocomplete="off" type="password" name="passwd"> Enter optional password.</p>
+
 <?php
        if (file_exists("data/categories")) {
                if ($dh_cat = opendir("data/categories")) {
@@ -350,7 +358,7 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
 
                if ($count_cat > 0) {
 
-                       echo "<p><select name=\"category\"><option selected>unfiled";
+                       echo "<p><select name=\"category\"><option value=\"\" selected>unfiled";
 
                        foreach ($show_cat as $category) {
                                echo "<option value=\"";
@@ -370,6 +378,7 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
                }
        }
 ?>
+
 <p><input type="checkbox" name="sticky">Put entry title in Quick Links box.<br>
 <input type="checkbox" name="pdf">Allow PDF generation for this entry.<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>
@@ -828,8 +837,9 @@ if (isset($_POST['pdf']) and !empty($_POST['pdf']) and ($_POST['pdf'] == "on"))
        $title = file_get_contents($title_file);
        $date = file_get_contents($date_file);
 
-       $link = "<a href=http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?entry=" . $entry . ">http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?entry=" . $entry . "</a>";
+       $link = "<a href=\"http://{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}?entry=$entry\">http://{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}?entry=$entry</a>";
        $link = str_replace("pdf.php?entry=","index.php?entry=",$link);
+       $link = str_replace("add.php?entry=","index.php?entry=",$link);
 
        $body = file_get_contents($body_file);
        $body = str_replace("\n","<br>",$body);
@@ -852,89 +862,79 @@ if (isset($_POST['pdf']) and !empty($_POST['pdf']) and ($_POST['pdf'] == "on"))
               
                function PDF($orientation='P',$unit='mm',$format='letter')
                {
-                   //Call parent constructor
-                   $this->FPDF($orientation,$unit,$format);
-                   //Initialization
-                   $this->B=0;
-                   $this->I=0;
-                   $this->U=0;
-                   $this->HREF='';
+                       $this->FPDF($orientation,$unit,$format);
+                       $this->B=0;
+                       $this->I=0;
+                       $this->U=0;
+                       $this->HREF='';
                }
       
                function WriteHTML($html)
                {
-                   //HTML parser
-                   $html=str_replace("\n",' ',$html);
-                   $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
-                   foreach($a as $i=>$e)
-                   {
-                       if($i%2==0)
-                       {
-                           //Text
-                           if($this->HREF)
-                               $this->PutLink($this->HREF,$e);
-                           else
-                               $this->Write(5,$e);
-                       }
-                       else
-                       {
-                           //Tag
-                           if($e{0}=='/')
-                               $this->CloseTag(strtoupper(substr($e,1)));
-                           else
-                           {
-                               //Extract attributes
-                               $a2=explode(' ',$e);
-                               $tag=strtoupper(array_shift($a2));
-                               $attr=array();
-                               foreach($a2 as $v)
-                                   if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3))
-                                       $attr[strtoupper($a3[1])]=$a3[2];
-                               $this->OpenTag($tag,$attr);
-                           }
-                       }
-                   }
+                       $html=str_replace("\n",' ',$html);
+                       $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
+                       foreach($a as $i=>$e)
+                       {
+                           if($i%2==0)
+                           {
+                               if($this->HREF)
+                                   $this->PutLink($this->HREF,$e);
+                               else
+                                   $this->Write(5,$e);
+                           }
+                           else
+                           {
+                               if($e{0}=='/')
+                                   $this->CloseTag(strtoupper(substr($e,1)));
+                               else
+                               {
+                                   $a2=explode(' ',$e);
+                                   $tag=strtoupper(array_shift($a2));
+                                   $attr=array();
+                                   foreach($a2 as $v)
+                                       if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3))
+                                           $attr[strtoupper($a3[1])]=$a3[2];
+                                   $this->OpenTag($tag,$attr);
+                               }
+                           }
+                       }
                }
               
                function OpenTag($tag,$attr)
                {
-                   //Opening tag
-                   if($tag=='B' or $tag=='I' or $tag=='U')
-                       $this->SetStyle($tag,true);
-                   if($tag=='A')
-                       $this->HREF=$attr['HREF'];
-                   if($tag=='BR')
-                       $this->Ln(5);
+                       if($tag=='B' or $tag=='I' or $tag=='U')
+                           $this->SetStyle($tag,true);
+                       if($tag=='A')
+                           $this->HREF=$attr['HREF'];
+                       if($tag=='BR')
+                           $this->Ln(5);
                }
               
                function CloseTag($tag)
                {
-                   //Closing tag
-                   if($tag=='B' or $tag=='I' or $tag=='U')
-                       $this->SetStyle($tag,false);
-                   if($tag=='A')
-                       $this->HREF='';
+                       if($tag=='B' or $tag=='I' or $tag=='U')
+                           $this->SetStyle($tag,false);
+                       if($tag=='A')
+                           $this->HREF='';
                }
               
                function SetStyle($tag,$enable)
                {
-                   //Modify style and select corresponding font
-                   $this->$tag+=($enable ? 1 : -1);
-                   $style='';
-                   foreach(array('B','I','U') as $s)
-                       if($this->$s>0)
-                           $style.=$s;
-                   $this->SetFont('',$style);
+                       $this->$tag+=($enable ? 1 : -1);
+                       $style='';
+                       foreach(array('B','I','U') as $s)
+                           if($this->$s>0)
+                               $style.=$s;
+                       $this->SetFont('',$style);
                }
               
                function PutLink($URL,$txt)
                {
-                   //Put a hyperlink
-                   $this->SetTextColor(0,0,255);
-                   $this->SetStyle('U',true);
-                   $this->Write(5,$txt,$URL);
-                   $this->SetStyle('U',false);
-                   $this->SetTextColor(0);
+                       $this->SetTextColor(0,0,255);
+                       $this->SetStyle('U',true);
+                       $this->Write(5,$txt,$URL);
+                       $this->SetStyle('U',false);
+                       $this->SetTextColor(0);
                }
        }
 
@@ -949,22 +949,31 @@ if (isset($_POST['pdf']) and !empty($_POST['pdf']) and ($_POST['pdf'] == "on"))
        $pdf->Output($filename);
 }
 
-if (isset($_POST['category']) and !empty($_POST['category'])) {
-       if (!file_exists("data/categories")) {
-               mkdir("data/categories");
+if (isset($_POST['category']) and !empty($_POST['category']) and file_exists("data/categories/{$_POST['category']}")) {
+
+       if (!file_exists("data/items/$entry/categories")) {
+               mkdir("data/items/$entry/categories");
        }
-       if (file_exists("data/categories/{$_POST['category']}")) {
-               $fp_category_txt = fopen("data/items/$entry/category.txt","w");
-               fwrite($fp_category_txt, $_POST['category']);
-               fclose($fp_category_txt);
+
+       if (!file_exists("data/items/$entry/categories/{$_POST['category']}")) {
+               mkdir("data/items/$entry/categories/{$_POST['category']}");
        }
 }
 
 
 if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt") and file_exists("data/bb.txt")) {
+
        $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
+
        if (file_exists("data/categories/$bb_cat")) {
-               copy("data/members/active/{$_SESSION['logged_in']}/category.txt","data/items/$entry/category.txt");
+
+               if (!file_exists("data/items/$entry/categories")) {
+                       mkdir("data/items/$entry/categories");
+               }
+
+               if (!file_exists("data/items/$entry/categories/$bb_cat")) {
+                       mkdir("data/items/$entry/categories/$bb_cat");
+               }
        }
 }
 
@@ -982,18 +991,15 @@ if (isset($_POST['passwd']) and !empty($_POST['passwd'])) {
        }
 }
 
-$default_ping_urls = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
-$ping_urls_file = "data/ping.txt";
+$default_ping_url = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
 
-if (!file_exists($ping_urls_file)) {
-       $fp_default_ping_txt = fopen($ping_urls_file,"w");
-       fwrite($fp_default_ping_txt, $default_ping_urls);
+if (!file_exists("data/ping.txt")) {
+       $fp_default_ping_txt = fopen("data/ping.txt","w");
+       fwrite($fp_default_ping_txt, $default_ping_url);
        fclose($fp_default_ping_txt);
 }
 
-$fp_ping_urls = fopen($ping_urls_file, "r");
-$ping_urls = fread($fp_ping_urls, filesize($ping_urls_file));
-fclose($fp_ping_urls);
+$ping_urls = file_get_contents("data/ping.txt");
 
 $get_ping_urls = explode("|", $ping_urls);
 
diff --git a/album.php b/album.php
index c93a220..08231cc 100644
--- a/album.php
+++ b/album.php
@@ -1,14 +1,19 @@
 <?php
 
 session_start();
+
 header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
+
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
                if (is_array($data)) {
-                       foreach ($data as $key => $value){
+                       foreach ($data as $key => $value) {
                                $data[$key] = stripslashes_array($value);
                        }
                        return $data;
@@ -77,16 +82,16 @@ if ((!isset($_POST['caption']) or empty($_POST['caption'])) and isset($_SESSION[
 
 if (isset($_POST['caption']) and !empty($_POST['caption']) and isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and isset($_POST['edit']) and ($_POST['edit'] == "caption")) {
        $caption_put = ucfirst($_POST['caption']);
-       $caption_put = str_replace(':((', '<img src=images/smileys/crying.png border=0>', $caption_put);
-       $caption_put = str_replace(':(', '<img src=images/smileys/frown.png border=0>', $caption_put);
-       $caption_put = str_replace(':|', '<img src=images/smileys/indifferent.png border=0>', $caption_put);
-       $caption_put = str_replace(':D', '<img src=images/smileys/laughing.png border=0>', $caption_put);
-       $caption_put = str_replace(':P', '<img src=images/smileys/lick.png border=0>', $caption_put);
-       $caption_put = str_replace(':O', '<img src=images/smileys/ohno.png border=0>', $caption_put);
-       $caption_put = str_replace(':)', '<img src=images/smileys/smile.png border=0>', $caption_put);
-       $caption_put = str_replace('=)', '<img src=images/smileys/surprised.png border=0>', $caption_put);
-       $caption_put = str_replace(':\\', '<img src=images/smileys/undecided.png border=0>', $caption_put);
-       $caption_put = str_replace(';)', '<img src=images/smileys/wink.png border=0>', $caption_put);
+       $caption_put = str_replace(':((', '<img src="images/smileys/crying.png" border="0">', $caption_put);
+       $caption_put = str_replace(':(', '<img src="images/smileys/frown.png" border="0">', $caption_put);
+       $caption_put = str_replace(':|', '<img src="images/smileys/indifferent.png" border="0">', $caption_put);
+       $caption_put = str_replace(':D', '<img src="images/smileys/laughing.png" border="0">', $caption_put);
+       $caption_put = str_replace(':P', '<img src="images/smileys/lick.png" border="0">', $caption_put);
+       $caption_put = str_replace(':O', '<img src="images/smileys/ohno.png" border="0">', $caption_put);
+       $caption_put = str_replace(':)', '<img src="images/smileys/smile.png" border="0">', $caption_put);
+       $caption_put = str_replace('=)', '<img src="images/smileys/surprised.png" border="0">', $caption_put);
+       $caption_put = str_replace(':\\', '<img src="images/smileys/undecided.png" border="0">', $caption_put);
+       $caption_put = str_replace(';)', '<img src="images/smileys/wink.png" border="0">', $caption_put);
        $caption_put = str_replace('[code]', '<code>', $caption_put);
        $caption_put = str_replace('[/code]', '</code>', $caption_put);
        $caption_put = str_replace("\n", '<br />', $caption_put);
@@ -243,16 +248,16 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
                if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt")) {
                        $caption_get = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
                        $caption_get = str_replace('<br />', "\n", $caption_get);
-                       $caption_get = str_replace('<img src=images/smileys/crying.png border=0>', ':((', $caption_get);
-                       $caption_get = str_replace('<img src=images/smileys/frown.png border=0>', ':(', $caption_get);
-                       $caption_get = str_replace('<img src=images/smileys/indifferent.png border=0>', ':|', $caption_get);
-                       $caption_get = str_replace('<img src=images/smileys/laughing.png border=0>', ':D', $caption_get);
-                       $caption_get = str_replace('<img src=images/smileys/lick.png border=0>', ':P', $caption_get);
-                       $caption_get = str_replace('<img src=images/smileys/ohno.png border=0>', ':O', $caption_get);
-                       $caption_get = str_replace('<img src=images/smileys/smile.png border=0>', ':)', $caption_get);
-                       $caption_get = str_replace('<img src=images/smileys/surprised.png border=0>', '=)', $caption_get);
-                       $caption_get = str_replace('<img src=images/smileys/undecided.png border=0>', ':\\', $caption_get);
-                       $caption_get = str_replace('<img src=images/smileys/wink.png border=0>', ';)', $caption_get);
+                       $caption_get = str_replace('<img src="images/smileys/crying.png" border="0">', ':((', $caption_get);
+                       $caption_get = str_replace('<img src="images/smileys/frown.png" border="0">', ':(', $caption_get);
+                       $caption_get = str_replace('<img src="images/smileys/indifferent.png" border="0">', ':|', $caption_get);
+                       $caption_get = str_replace('<img src="images/smileys/laughing.png" border="0">', ':D', $caption_get);
+                       $caption_get = str_replace('<img src="images/smileys/lick.png" border="0">', ':P', $caption_get);
+                       $caption_get = str_replace('<img src="images/smileys/ohno.png" border="0">', ':O', $caption_get);
+                       $caption_get = str_replace('<img src="images/smileys/smile.png" border="0">', ':)', $caption_get);
+                       $caption_get = str_replace('<img src="images/smileys/surprised.png" border="0">', '=)', $caption_get);
+                       $caption_get = str_replace('<img src="images/smileys/undecided.png" border="0">', ':\\', $caption_get);
+                       $caption_get = str_replace('<img src="images/smileys/wink.png" border="0">', ';)', $caption_get);
                        $caption_get = str_replace('<span style="background-color: #ffff00;">', '<highlight>', $caption_get);
                        $caption_get = str_replace('</span>', '</highlight>', $caption_get);
                        echo $caption_get;
diff --git a/cat.php b/cat.php
index 7ac90c2..2c13521 100644
--- a/cat.php
+++ b/cat.php
@@ -1,23 +1,27 @@
 <?php
 
 session_start();
+
 header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
+
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
-               if (is_array($data)){
-                        foreach ($data as $key => $value){
-                                 $data[$key] = stripslashes_array($value);
-                        }
-                        return $data;
+               if (is_array($data)) {
+                       foreach ($data as $key => $value) {
+                               $data[$key] = stripslashes_array($value);
+                       }
+                       return $data;
                }
-               else{
-                        return stripslashes($data);
+               else {
+                       return stripslashes($data);
                }
        }
-
        $_POST = stripslashes_array($_POST);
 }
 
@@ -27,29 +31,58 @@ if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username
        exit();
 }
 
-function rmdirr($recurse_dirname)
-{
+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 (file_exists("data/items")) {
+
+       if ($dh_cat_txt = opendir("data/items")) {
 
-    if (!file_exists($recurse_dirname)) {
-        return false;
-    }
+               while (($entry_cat_txt = readdir($dh_cat_txt)) !== false) {
 
-    if (is_file($recurse_dirname)) {
-        return unlink($recurse_dirname);
-    }
+                       if ($entry_cat_txt != "." && $entry_cat_txt != "..") {
 
-    $recurse_dir = dir($recurse_dirname);
-    while (false !== $recurse_entry = $recurse_dir->read()) {
+                               if (file_exists("data/items/$entry_cat_txt/category.txt")) {
 
-        if ($recurse_entry == '.' || $recurse_entry == '..') {
-            continue;
-        }
+                                       $category_txt = file_get_contents("data/items/$entry_cat_txt/category.txt");
+                                       $category_txt = strtolower($category_txt);
+                                       $category_txt = str_replace(" ","_",$category_txt);
+                                       $category_txt = trim($category_txt);
 
-        rmdirr("$recurse_dirname/$recurse_entry");
-    }
+                                       if (!file_exists("data/items/$entry_cat_txt/categories")) {
+                                               mkdir("data/items/$entry_cat_txt/categories");
+                                       }
 
-    $recurse_dir->close();
-    return rmdir($recurse_dirname);
+                                       if (!file_exists("data/items/$entry_cat_txt/categories/$category_txt")) {
+                                               mkdir("data/items/$entry_cat_txt/categories/$category_txt");
+                                       }
+
+                                       unlink("data/items/$entry_cat_txt/category.txt");
+                               }
+                       }
+               }
+               closedir($dh_cat_txt);
+       }
 }
 
 if (isset($_POST['new_id']) and !empty($_POST['new_id'])) {
@@ -115,6 +148,39 @@ if (empty($_POST['cat_title']) and file_exists("data/categories/{$_POST['cat_id'
        unlink("data/categories/{$_POST['cat_id']}/title.txt");
 }
 
+if (isset($_POST['cat_ren']) and !empty($_POST['cat_ren'])) {
+
+       $cat_rename = strtolower($_POST['cat_ren']);
+       $cat_rename = str_replace(" ","_",$cat_rename);
+       $cat_rename = trim($cat_rename);
+
+       $cat_oldname = strtolower($_POST['cat_id']);
+       $cat_oldname = str_replace(" ","_",$cat_oldname);
+       $cat_oldname = trim($cat_oldname);
+
+       if (($cat_rename != $cat_oldname) and !file_exists("data/categories/$cat_rename")) {
+               rename("data/categories/$cat_oldname","data/categories/$cat_rename");
+       }
+
+
+       if (file_exists("data/items")) {
+      
+               if ($dh_cat_ren = opendir("data/items")) {
+      
+                       while (($entry_cat_ren = readdir($dh_cat_ren)) !== false) {
+      
+                               if ($entry_cat_ren != "." && $entry_cat_ren != "..") {
+      
+                                       if (file_exists("data/items/$entry_cat_ren/categories/$cat_oldname") and !file_exists("data/items/$entry_cat_ren/categories/$cat_rename")) {
+                                               rename("data/items/$entry_cat_ren/categories/$cat_oldname","data/items/$entry_cat_ren/categories/$cat_rename");
+                                       }
+                               }
+                       }
+                       closedir($dh_cat_ren);
+               }
+       }
+}
+
 ?>
 
 <title>Categories</title>
@@ -132,10 +198,11 @@ body {
                                        echo "{$font_body},";
                                }
        ?> arial, helvetica, sans-serif;
+       font-size: 11px;
        background-color: #FFFFFF;
 }
 
-p {
+p, td {
        font-size: 11px;
 }
 
@@ -167,7 +234,21 @@ a:active {
                                        echo "{$font_input},";
                                }
        ?> arial, helvetica, sans-serif;
-       font-size: 11px
+       font-size: 11px;
+}
+
+.id {  
+       color: #666666;
+       background: #ffffff;
+       border: #999999 solid 1px;
+       width: 150px;
+       font-family: <?php
+                               if (file_exists("data/fonts/input.txt")) {
+                                       $font_input = file_get_contents("data/fonts/input.txt");
+                                       echo "{$font_input},";
+                               }
+       ?> arial, helvetica, sans-serif;
+       font-size: 11px;
 }
 
 .submit {      
@@ -185,16 +266,16 @@ a:active {
 }
 </style>
 
-<p><b>Add Category</b></p><p>Enter a unique category ID and optional title or description.</p>
+<p><b>Add Category</b><br>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>
+<table border="0" cellspacing="1" cellpadding="2">
+<form enctype="multipart/form-data" action="cat.php" method="post">
+<tr><td>category id*</td><td><input type="text" class="input" name="new_id" autocomplete="off" maxlength="30"></td></tr>
+<tr><td>title or description</td><td><input type="text" class="input" name="new_title" autocomplete="off" maxlength="90"></td></tr>
+<tr><td></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 enctype="multipart/form-data" action="index.php" method="post">
+<tr><td></td><td><input class="input" type="submit" value="click here to go to the index page"></td></tr>
 </form>
 </table>
 
@@ -216,33 +297,34 @@ a:active {
 
                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 "<p><b>Category Management</b><br>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>";
+                       echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\">";
+                       echo "<tr><td>category id</td><td align=\"center\">title or description</td><td align=\"center\">hide</td><td align=\"center\">book</td><td align=\"center\">delete</td><td></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(str_replace("_", " ", $category));
-                               echo '</b></p></td><td><p><input type=text class=input name=cat_title value="';
+                               echo "<form enctype=\"multipart/form-data\" action=\"cat.php\" method=\"post\">";
+                               echo "<tr><td><input type=\"text\" class=\"id\" name=\"cat_ren\" value=\"$category\" maxlength=\"30\" autocomplete=\"off\"></td>";
+                               echo "<td><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';
+                               echo "\" autocomplete=\"off\" maxlength=\"90\"></td>";
+                               echo "<td 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";
+
+                               echo "></td>";
+                               echo "<td 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 "></td>";
+                               echo "<td align=\"center\"><input type=\"checkbox\" name=\"cat_del\"></td>";
+                               echo "<td><input type=\"hidden\" name=\"cat_id\" value=\"$category\"><input type=\"hidden\" name=\"cat_edit\" value=\"on\"><input type=\"submit\" class=\"submit\" value=\"submit\"></td>";
                                echo "</tr></form>";
                        }
-
                        echo "</table>";
                }
        }
diff --git a/colors.php b/colors.php
index f8bc755..474fefb 100644
--- a/colors.php
+++ b/colors.php
@@ -1,23 +1,27 @@
 <?php
 
 session_start();
+
 header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
+
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
-               if (is_array($data)){
-                        foreach ($data as $key => $value){
-                                 $data[$key] = stripslashes_array($value);
-                        }
-                        return $data;
+               if (is_array($data)) {
+                       foreach ($data as $key => $value) {
+                               $data[$key] = stripslashes_array($value);
+                       }
+                       return $data;
                }
-               else{
-                        return stripslashes($data);
+               else {
+                       return stripslashes($data);
                }
        }
-
        $_POST = stripslashes_array($_POST);
 }
 
diff --git a/del.php b/del.php
index 7a1b3f0..b3f9fc3 100644
--- a/del.php
+++ b/del.php
@@ -6,6 +6,10 @@ header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
+
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
                if (is_array($data)) {
diff --git a/dig.php b/dig.php
index 3d42668..5c90d8d 100644
--- a/dig.php
+++ b/dig.php
@@ -1,23 +1,27 @@
 <?php
 
 session_start();
+
 header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
+
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
-               if (is_array($data)){
-                        foreach ($data as $key => $value){
-                                 $data[$key] = stripslashes_array($value);
-                        }
-                        return $data;
+               if (is_array($data)) {
+                       foreach ($data as $key => $value) {
+                               $data[$key] = stripslashes_array($value);
+                       }
+                       return $data;
                }
-               else{
-                        return stripslashes($data);
+               else {
+                       return stripslashes($data);
                }
        }
-
        $_POST = stripslashes_array($_POST);
 }
 
@@ -47,7 +51,7 @@ body {
        background-color: #FFFFFF;
 }
 
-p {
+p, td {
        font-size: 11px;
 }
 
@@ -178,9 +182,26 @@ if ($dh_search_items = opendir($dir)) {
                        continue;
                }
 
-               $cat_dir = file_get_contents("data/items/$entry_search_items/category.txt");
+               $private = "0";
+
+               if (file_exists("data/items/$entry_search_items/categories")) {
+                      
+                       if ($dh_cat_dig = opendir("data/items/$entry_search_items/categories")) {
+                      
+                               while (($entry_cat_dig = readdir($dh_cat_dig)) !== false) {
+                      
+                                       if ($entry_cat_dig != "." && $entry_cat_dig != "..") {
+                      
+                                               if (file_exists("data/categories/$entry_cat_dig/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                                                       $private = $private + 1;
+                                               }
+                                       }
+                               }
+                               closedir($dh_cat_dig);
+                       }
+               }
 
-               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))) {
+               if (($private > 0) and !file_exists("data/items/$entry_search_items/cat.txt")) {
                        continue;
                }
 
diff --git a/edit.php b/edit.php
index 79ae111..adfebf7 100644
--- a/edit.php
+++ b/edit.php
@@ -6,6 +6,10 @@ header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
+
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
                if (is_array($data)) {
@@ -15,10 +19,9 @@ if (get_magic_quotes_gpc()) {
                        return $data;
                }
                else {
-                        return stripslashes($data);
+                       return stripslashes($data);
                }
        }
-
        $_REQUEST = stripslashes_array($_REQUEST);
 }
 
@@ -88,13 +91,6 @@ $revisions_file = 'data/items/' . $_REQUEST['entry'] . '/revisions.txt';
 $max_image_size = 8000000;
 $max_file_size = 8000000;
 
-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");
-       }
-}
-
 ?>
 
 <title>Edit</title>
@@ -226,16 +222,16 @@ a:active {
 if (isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_POST['comment_txt']) and !empty($_POST['comment_txt']) and isset($_REQUEST['type']) and !empty($_REQUEST['type']) and (($_REQUEST['type'] == "live") or ($_REQUEST['type'] == "pending"))) {
        $comment_txt = ucfirst($_POST['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 = 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/{$_REQUEST['type']}/{$_REQUEST['comment']}/comment.txt";
        $open_comment_txt_file = fopen($comment_txt_file,"w");
        fwrite($open_comment_txt_file,$comment_txt);
@@ -283,16 +279,16 @@ if (isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_REQ
        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);
+       $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;
 
@@ -318,6 +314,8 @@ if (isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_REQ
 
 ?>
 
+<table border="0" cellspacing="0" cellpadding="0"><tr><td>
+
 <table border="0" cellspacing="0" cellpadding="0" bgcolor="#cccccc"><tr><td width="525">
 
 <div id="panel_title"><?php readfile($title_file); ?></div>
@@ -339,18 +337,18 @@ if (file_exists($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";
-       }
-}
+//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>
@@ -396,50 +394,6 @@ if ($_SESSION['logged_in'] == $login_username) {
        }
        ?></td></tr>
 
-       <?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 "<tr><td><select name=\"category\"><option>unfiled";
-      
-                               foreach ($show_cat as $category) {
-                                       echo "<option value=\"";
-                                       echo strtolower($category);
-                                       echo "\"";
-                                      
-                                       if (file_exists("data/items/{$_REQUEST['entry']}/category.txt") and (file_get_contents("data/items/{$_REQUEST['entry']}/category.txt") == $category)) {
-                                               echo " selected";
-                                       }
-
-                                       echo ">";
-      
-                                       if (file_exists("data/categories/$category/title.txt")) {
-                                               readfile("data/categories/$category/title.txt");
-                                       }
-                                       else {
-                                               echo strtolower($category);
-                                       }
-                               }
-      
-                               echo "</select> Select category.</td></tr>";
-      
-                       }
-               }
-       ?>     
        <tr><td><input type="checkbox" name="sticky" <?php $sticky_sem = 'data/sticky/' . $_REQUEST['entry']; if (file_exists($sticky_sem)) { echo checked; } ?>>Put entry title in Quick Links box.</td></tr>
        <tr><td><input type="checkbox" name="pdf" <?php if (file_exists("data/items/{$_REQUEST['entry']}/pdf/file")) { echo checked; } ?>>Allow PDF generation for this entry.</td></tr>
        <tr><td><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.</td></tr>
@@ -453,24 +407,18 @@ if ($_SESSION['logged_in'] == $login_username) {
 
        <?php
 
-       // start of wiki mod (20071130)
-
        if (file_exists("data/bb.txt") and file_exists("data/wiki.txt")) { ?>
 
        <tr><td><input type="checkbox" name="edit" <?php $edit_sem = "data/items/{$_REQUEST['entry']}/edit.txt"; if (file_exists($edit_sem)) { echo checked; } ?>>Registered members can edit this entry.</td></tr>
 
        <?php
 
-       // end of wiki mod (20071130)
-
        }
 
        ?>
 
        <tr><td><input type="checkbox" name="lastmod" <?php $lastmod_sem = "data/items/{$_REQUEST['entry']}/lastmod.txt"; if (file_exists($lastmod_sem)) { echo checked; } ?>>Display last modification date and time.</td></tr>
 
-      
-
 <?php } ?>
 
 </table></p>
@@ -489,16 +437,16 @@ $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);
+$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);
 $body_read_content = str_replace('<!-- html -->', '<html>', $body_read_content);
 $body_read_content = str_replace('<!-- /html -->', '</html>', $body_read_content);
 $body_read_content = str_replace('<span style="background-color: #ffff00;">', '<highlight>', $body_read_content);
@@ -538,6 +486,81 @@ echo $body_read_content;
 
 </td></tr></table>
 
+</td><td width="25"></td><td valign="top">
+
+<?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)) {
+
+                                       if (file_exists("data/items/{$_REQUEST['entry']}/categories/$entry_cat")) {
+                                               $filed_cat[] = $entry_cat;
+                                       }
+
+                                       if (!file_exists("data/items/{$_REQUEST['entry']}/categories/$entry_cat")) {
+                                               $unfiled_cat[] = $entry_cat;
+                                       }
+                               }
+                       }
+                       closedir($dh_cat);
+               }
+      
+               sort($filed_cat);
+               sort($unfiled_cat);
+
+               reset($filed_cat);
+               reset($unfiled_cat);
+
+               $count_filed_cat = count($filed_cat);
+               $count_unfiled_cat = count($unfiled_cat);
+      
+               if ($count_filed_cat > 0) {
+
+                       echo "<p>This entry has been filed under the following ";
+
+                       if ($count_filed_cat == 1) {
+                               echo "category";
+                       }
+                       else {
+                               echo "categories";
+                       }
+
+                       echo ":</p><table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\" width=\"150\">";
+
+                       foreach ($filed_cat as $filed_category) {
+                               echo "<tr bgcolor=\"#ffffff\"><td>$filed_category</td><td width=\"16\"></td></tr>";
+                       }
+
+                       echo "</table>";
+               }
+       }
+?>    
+
+</td><td width="25"></td><td valign="top">
+
+<?php
+
+if ($count_unfiled_cat > 0) {
+
+       echo "This entry has been filed under the following categories";
+
+       echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\" width=\"150\">";
+
+       foreach ($unfiled_cat as $unfiled_category) {
+               echo "<tr bgcolor=\"#ffffff\"><td width=\"16\"></td><td align=\"right\">$unfiled_category</td></tr>";
+       }
+
+       echo "</table>";
+}
+
+?>
+
+</td></tr></table>
+
 <?php
 if (!isset($_POST['title_input']) or !isset($_POST['body_input']) or empty($_POST['title_input']) or empty($_POST['body_input'])) {
        exit();
@@ -575,16 +598,16 @@ function reformat_code($defang_code) {
        foreach($store_code as $itm_code=>$refh_code) {
                if(eregi("</code>",$refh_code)) {
                        $store_code1=split("</code>",$refh_code);
-                       $store_code1[0] = eregi_replace('<img src=images/smileys/crying.png border=0>',':((',$store_code1[0]);
-                       $store_code1[0] = eregi_replace('<img src=images/smileys/frown.png border=0>',':(',$store_code1[0]);
-                       $store_code1[0] = eregi_replace('<img src=images/smileys/indifferent.png border=0>',':|',$store_code1[0]);
-                       $store_code1[0] = eregi_replace('<img src=images/smileys/laughing.png border=0>',':D',$store_code1[0]);
-                       $store_code1[0] = eregi_replace('<img src=images/smileys/lick.png border=0>',':P',$store_code1[0]);
-                       $store_code1[0] = eregi_replace('<img src=images/smileys/ohno.png border=0>',':O',$store_code1[0]);
-                       $store_code1[0] = eregi_replace('<img src=images/smileys/smile.png border=0>',':)',$store_code1[0]);
-                       $store_code1[0] = eregi_replace('<img src=images/smileys/surprised.png border=0>','=)',$store_code1[0]);
-                       $store_code1[0] = eregi_replace('<img src=images/smileys/undecided.png border=0>',':\\',$store_code1[0]);
-                       $store_code1[0] = eregi_replace('<img src=images/smileys/wink.png border=0>',';)',$store_code1[0]);
+                       $store_code1[0] = eregi_replace('<img src="images/smileys/crying.png" border="0">',':((',$store_code1[0]);
+                       $store_code1[0] = eregi_replace('<img src="images/smileys/frown.png" border="0">',':(',$store_code1[0]);
+                       $store_code1[0] = eregi_replace('<img src="images/smileys/indifferent.png" border="0">',':|',$store_code1[0]);
+                       $store_code1[0] = eregi_replace('<img src="images/smileys/laughing.png" border="0">',':D',$store_code1[0]);
+                       $store_code1[0] = eregi_replace('<img src="images/smileys/lick.png" border="0">',':P',$store_code1[0]);
+                       $store_code1[0] = eregi_replace('<img src="images/smileys/ohno.png" border="0">',':O',$store_code1[0]);
+                       $store_code1[0] = eregi_replace('<img src="images/smileys/smile.png" border="0">',':)',$store_code1[0]);
+                       $store_code1[0] = eregi_replace('<img src="images/smileys/surprised.png" border="0">','=)',$store_code1[0]);
+                       $store_code1[0] = eregi_replace('<img src="images/smileys/undecided.png" border="0">',':\\',$store_code1[0]);
+                       $store_code1[0] = eregi_replace('<img src="images/smileys/wink.png" border="0">',';)',$store_code1[0]);
                        $store_code1[0]=htmlentities($store_code1[0],ENT_NOQUOTES);
                        foreach($store_code1 as $itm_code1=>$refh_code1) {
                                if($itm_code1==0)
@@ -600,16 +623,16 @@ $body_write_content = ucfirst($_POST['body_input']);
 $body_write_content = str_replace("[html]", '<html>', $body_write_content);
 $body_write_content = str_replace("[/html]", '</html>', $body_write_content);
 $body_write_content = reformat_html($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(':((', '<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('[code]', '<code>', $body_write_content);
 $body_write_content = str_replace('[/code]', '</code>', $body_write_content);
 $body_write_content = reformat_code($body_write_content);
@@ -680,16 +703,16 @@ if (isset($_FILES['album_image_input']) and !empty($_FILES['album_image_input'])
 
                                                if (!file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$album_image_input_name}.txt")) {
                                                        $caption_txt = ucfirst($_POST['caption']);
-                                                       $caption_txt = str_replace(':((', '<img src=images/smileys/crying.png border=0>', $caption_txt);
-                                                       $caption_txt = str_replace(':(', '<img src=images/smileys/frown.png border=0>', $caption_txt);
-                                                       $caption_txt = str_replace(':|', '<img src=images/smileys/indifferent.png border=0>', $caption_txt);
-                                                       $caption_txt = str_replace(':D', '<img src=images/smileys/laughing.png border=0>', $caption_txt);
-                                                       $caption_txt = str_replace(':P', '<img src=images/smileys/lick.png border=0>', $caption_txt);
-                                                       $caption_txt = str_replace(':O', '<img src=images/smileys/ohno.png border=0>', $caption_txt);
-                                                       $caption_txt = str_replace(':)', '<img src=images/smileys/smile.png border=0>', $caption_txt);
-                                                       $caption_txt = str_replace('=)', '<img src=images/smileys/surprised.png border=0>', $caption_txt);
-                                                       $caption_txt = str_replace(':\\', '<img src=images/smileys/undecided.png border=0>', $caption_txt);
-                                                       $caption_txt = str_replace(';)', '<img src=images/smileys/wink.png border=0>', $caption_txt);
+                                                       $caption_txt = str_replace(':((', '<img src="images/smileys/crying.png" border="0">', $caption_txt);
+                                                       $caption_txt = str_replace(':(', '<img src="images/smileys/frown.png" border="0">', $caption_txt);
+                                                       $caption_txt = str_replace(':|', '<img src="images/smileys/indifferent.png" border="0">', $caption_txt);
+                                                       $caption_txt = str_replace(':D', '<img src="images/smileys/laughing.png" border="0">', $caption_txt);
+                                                       $caption_txt = str_replace(':P', '<img src="images/smileys/lick.png" border="0">', $caption_txt);
+                                                       $caption_txt = str_replace(':O', '<img src="images/smileys/ohno.png" border="0">', $caption_txt);
+                                                       $caption_txt = str_replace(':)', '<img src="images/smileys/smile.png" border="0">', $caption_txt);
+                                                       $caption_txt = str_replace('=)', '<img src="images/smileys/surprised.png" border="0">', $caption_txt);
+                                                       $caption_txt = str_replace(':\\', '<img src="images/smileys/undecided.png" border="0">', $caption_txt);
+                                                       $caption_txt = str_replace(';)', '<img src="images/smileys/wink.png" border="0">', $caption_txt);
                                                        $caption_txt = str_replace('[code]', '<code>', $caption_txt);
                                                        $caption_txt = str_replace('[/code]', '</code>', $caption_txt);
                                                        $caption_txt = str_replace("\n", '<br />', $caption_txt);
@@ -823,8 +846,6 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
        }
 }
 
-// start of wiki mod (20071130)
-
 $title_get_content = ucfirst($_POST['title_input']);
 $title_get_content = str_replace('<','&lt;',$title_get_content);
 $title_get_content = str_replace('>','&gt;',$title_get_content);
@@ -871,22 +892,16 @@ if (file_exists("data/wiki.txt") and (($title_get_content != file_get_contents("
 
 }
 
-// end of wiki mod (20071130)
-
 $open_body_file = fopen($body_file,"w");
 fwrite($open_body_file,$body_write_content);
 fclose($open_body_file);
 
-// start of wiki mod (20071130)
-
 if (file_exists("data/wiki.txt") and (file_exists("data/items/{$_REQUEST['entry']}/edit.txt") or (file_get_contents("data/items/{$_REQUEST['entry']}/author.txt") == $_SESSION['logged_in']))) {
        $open_contrib_file = fopen("data/items/{$_REQUEST['entry']}/contrib.txt","w");
        fwrite($open_contrib_file,$_SESSION['logged_in']);
        fclose($open_contrib_file);
 }
 
-// end of wiki mod (20071130)
-
 if ($_SESSION['logged_in'] == $login_username) {
 
        $sticky_sem = 'data/sticky/' . $_REQUEST['entry'];
@@ -985,8 +1000,9 @@ if ($_SESSION['logged_in'] == $login_username) {
                $title = file_get_contents($title_file);
                $date = file_get_contents($date_file);
       
-               $link = "<a href=http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?entry=" . $entry . ">http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?entry=" . $entry . "</a>";
+               $link = "<a href=\"http://{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}?entry=$entry\">http://{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}?entry=$entry</a>";
                $link = str_replace("pdf.php?entry=","index.php?entry=",$link);
+               $link = str_replace("edit.php?entry=","index.php?entry=",$link);
       
                $body = file_get_contents($body_file);
                $body = str_replace("\n","<br>",$body);
@@ -1103,20 +1119,23 @@ if ($_SESSION['logged_in'] == $login_username) {
        }
 
        if (isset($_POST['category']) and !empty($_POST['category'])) {
+
                if (!file_exists("data/categories")) {
                        mkdir("data/categories");
                }
-               if ($_POST['category'] == "unfiled") {
-                       unlink("data/items/{$_REQUEST['entry']}/category.txt");
-               }
-               if (file_exists("data/categories/{$_POST['category']}")) {
-                       $fp_category_txt = fopen("data/items/{$_REQUEST['entry']}/category.txt","w");
-                       fwrite($fp_category_txt, $_POST['category']);
-                       fclose($fp_category_txt);
-               }
+
+//             if ($_POST['category'] == "unfiled") {
+//                     unlink("data/items/{$_REQUEST['entry']}/category.txt");
+//             }
+//             if (file_exists("data/categories/{$_POST['category']}")) {
+//                     $fp_category_txt = fopen("data/items/{$_REQUEST['entry']}/category.txt","w");
+//                     fwrite($fp_category_txt, $_POST['category']);
+//                     fclose($fp_category_txt);
+//             }
        }
       
        $passwd_file = "data/items/{$_REQUEST['entry']}/passwd.txt";
+
        if (isset($_POST['passwd']) and !empty($_POST['passwd']) and ($_POST['passwd'] != "password")) {
                $fp_passwd_txt = fopen("$passwd_file","w");
                $passwd_crypt = sha1($_POST['passwd']);
@@ -1125,6 +1144,7 @@ if ($_SESSION['logged_in'] == $login_username) {
                fwrite($fp_passwd_txt, $passwd_crypt);
                fclose($fp_passwd_txt);
        }
+
        if (!isset($_POST['passwd']) or empty($_POST['passwd'])) {
                if (file_exists($passwd_file)) {
                        unlink($passwd_file);
diff --git a/fonts.php b/fonts.php
index 13f67bd..2018bc1 100644
--- a/fonts.php
+++ b/fonts.php
@@ -1,23 +1,27 @@
 <?php
 
 session_start();
+
 header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
+
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
-               if (is_array($data)){
-                        foreach ($data as $key => $value){
-                                 $data[$key] = stripslashes_array($value);
-                        }
-                        return $data;
+               if (is_array($data)) {
+                       foreach ($data as $key => $value) {
+                               $data[$key] = stripslashes_array($value);
+                       }
+                       return $data;
                }
-               else{
-                        return stripslashes($data);
+               else {
+                       return stripslashes($data);
                }
        }
-
        $_POST = stripslashes_array($_POST);
 }
 
diff --git a/index.php b/index.php
index 6804582..adce78a 100644
--- a/index.php
+++ b/index.php
@@ -12,38 +12,52 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP
        header("Location: login.php");
 }
 
-if (get_magic_quotes_gpc()){
-       function stripslashes_array($f_data){
-               if (is_array($f_data)){
-                       foreach ($f_data as $f_key => $f_value){
-                               $f_data[$f_key] = stripslashes_array($f_value);
+if (get_magic_quotes_gpc()) {
+       function stripslashes_array($data) {
+               if (is_array($data)) {
+                       foreach ($data as $key => $value) {
+                               $data[$key] = stripslashes_array($value);
                        }
-                       return $f_data;
+                       return $data;
                }
                else {
-                       return stripslashes($f_data);
+                       return stripslashes($data);
                }
        }
        $_REQUEST = stripslashes_array($_REQUEST);
 }
 
 if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
-       $entry = trim($_REQUEST['entry']);
+       $req_entry = trim($_REQUEST['entry']);
 }
 
 if (isset($_REQUEST['show']) and !empty($_REQUEST['show'])) {
-       $show = trim($_REQUEST['show']);
+       $req_show = trim($_REQUEST['show']);
+}
+
+if (isset($_REQUEST['find']) and !empty($_REQUEST['find'])) {
+       $req_find = trim($_REQUEST['find']);
+       $req_find = str_replace(" ","-",$req_find);
+       $req_find = strtolower($req_find);
+       $req_find = strip_tags($req_find);
 }
 
 if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
-       $category = trim($_REQUEST['category']);
-       $category = str_replace(" ","-",$category);
-       $category = strtolower($category);
-       $category = strip_tags($category);
+       $req_category = trim($_REQUEST['category']);
+       $req_category = str_replace(" ","-",$req_category);
+       $req_category = strtolower($req_category);
+       $req_category = strip_tags($req_category);
 }
 
 if (isset($_REQUEST['archive']) and !empty($_REQUEST['archive'])) {
-       $archive = trim($_REQUEST['archive']);
+       $req_archive = trim($_REQUEST['archive']);
+}
+
+if (isset($_REQUEST['author']) and !empty($_REQUEST['author'])) {
+       $req_author = trim($_REQUEST['author']);
+       $req_author = str_replace(" ","-",$req_author);
+       $req_author = strtolower($req_author);
+       $req_author = strip_tags($req_author);
 }
 
 if (file_exists("data/offset.txt")) {
@@ -63,7 +77,7 @@ else {
 $default_blog_title = "My Activity Journal";
 $default_username = "maj";
 $default_password = "php";
-$default_blog_profile = "This cool site is powered by <a href=http://maj.sourceforge.net/ target=_maj>My Activity Journal</a>,a simple,<a href=http://php.net/ target=_maj>PHP</a>-based,<a href=http://www.opensource.org/licenses/gpl-license.php target=_maj>GPL</a>'ed blog written from scratch as a spare time family project by <a href=http://engels.mortega.net/ target=_maj>Engels</a>,<a href=http://gaffud.com/ target=_maj>Magie</a>,and <a href=http://psylocke.org/ target=_maj>Psylocke</a> Antonio.";
+$default_blog_profile = 'This cool site is powered by <a href="http://maj.sourceforge.net/" target="_maj">My Activity Journal</a>,a simple,<a href="http://php.net/" target="_maj">PHP</a>-based,<a href="http://www.opensource.org/licenses/gpl-license.php" target="_maj">Open Source</a> blog written from scratch as a spare time family project by <a href="http://engels.mortega.net/" target="_maj">Engels</a>,<a href="http://gaffud.com/" target="_maj">Magie</a>,and <a href="http://psylocke.org/" target="_maj">Psylocke</a> Antonio.';
 $default_blog_author = "My Activity Journal";
 
 if (!file_exists("data")) {
@@ -145,43 +159,43 @@ if (@ereg("Google",$_SERVER['HTTP_USER_AGENT'])) {
        fclose($google_hits_file);
 }
 
-function str_rand($f_length = 8,$f_seeds = 'abcdefghijklmnopqrstuvwxyz0123456789') {
-       $f_str = '';
-       $f_seeds_count = strlen($f_seeds);
+function str_rand($length = 8,$seeds = 'abcdefghijklmnopqrstuvwxyz0123456789') {
+       $str = '';
+       $seeds_count = strlen($seeds);
 
-       list($f_usec,$f_sec) = explode(' ',microtime());
-       $f_seed = (float) $f_sec + ((float) $f_usec * 100000);
-       mt_srand($f_seed);
+       list($usec,$sec) = explode(' ',microtime());
+       $seed = (float) $sec + ((float) $usec * 100000);
+       mt_srand($seed);
 
-       for ($f_i = 0; $f_length > $f_i; $f_i++) {
-               $f_str .= $f_seeds{mt_rand(0,$f_seeds_count - 1)};
+       for ($i = 0; $length > $i; $i++) {
+               $str .= $seeds{mt_rand(0,$seeds_count - 1)};
        }
-       return $f_str;
+       return $str;
 }
 
-function rmdirr($f_recurse_dirname) {
+function rmdirr($recurse_dirname) {
 
-       if (!file_exists($f_recurse_dirname)) {
+       if (!file_exists($recurse_dirname)) {
                return false;
        }
 
-       if (is_file($f_recurse_dirname)) {
-               return unlink($f_recurse_dirname);
+       if (is_file($recurse_dirname)) {
+               return unlink($recurse_dirname);
        }
 
-       $f_recurse_dir = dir($f_recurse_dirname);
+       $recurse_dir = dir($recurse_dirname);
 
-       while (false !== $f_recurse_entry = $f_recurse_dir->read()) {
+       while (false !== $recurse_entry = $recurse_dir->read()) {
 
-               if ($f_recurse_entry == '.' || $f_recurse_entry == '..') {
+               if ($recurse_entry == '.' || $recurse_entry == '..') {
                        continue;
                }
 
-               rmdirr("$f_recurse_dirname/$f_recurse_entry");
+               rmdirr("$recurse_dirname/$recurse_entry");
        }
 
-       $f_recurse_dir->close();
-       return rmdir($f_recurse_dirname);
+       $recurse_dir->close();
+       return rmdir($recurse_dirname);
 }
 
 if (isset($_REQUEST['download']) and !empty($_REQUEST['download'])) {
@@ -191,64 +205,64 @@ if (isset($_REQUEST['download']) and !empty($_REQUEST['download'])) {
        die();
 }
 
-function go_download($f_dl_file) {
+function go_download($dl_file) {
 
-       $entry = trim($_REQUEST['entry']);
+       $req_entry = trim($_REQUEST['entry']);
 
        if (isset($_REQUEST['type']) and !empty($_REQUEST['type']) and ($_REQUEST['type'] == "pdf")) {
-               $f_dl_path = "data/items/$entry/pdf/file";
-               $f_count_path = "data/items/$entry/pdf/count";
-               $f_count_file = "dl.txt";
+               $dl_path = "data/items/$req_entry/pdf/file";
+               $count_path = "data/items/$req_entry/pdf/count";
+               $count_file = "dl.txt";
        }
 
        if (isset($_REQUEST['type']) and !empty($_REQUEST['type']) and ($_REQUEST['type'] == "filedrop")) {
-               $f_dl_path = "data/items/$entry/filedrop/files";
-               $f_count_path = "data/items/$entry/filedrop/count";
-               $f_count_file = "{$f_dl_file}.txt";
+               $dl_path = "data/items/$req_entry/filedrop/files";
+               $count_path = "data/items/$req_entry/filedrop/count";
+               $count_file = "{$dl_file}.txt";
        }
 
-       $f_dl_file_size = filesize("$f_dl_path/$f_dl_file");
+       $dl_file_size = filesize("$dl_path/$dl_file");
 
        header("Cache-Control: ");
        header("Pragma: ");
        header("Content-type: application/octet-stream");
-       header("Content-Disposition: attachment; filename=$f_dl_file");
-       header("Content-length: $f_dl_file_size");
+       header("Content-Disposition: attachment; filename=$dl_file");
+       header("Content-length: $dl_file_size");
 
-       $f_get_it = fopen("$f_dl_path/$f_dl_file","rb");
+       $get_it = fopen("$dl_path/$dl_file","rb");
 
-       while (!feof($f_get_it)) {
-               $f_buf = fread($f_get_it,4096);
-               echo $f_buf;
-               $f_bytes_sent += strlen($f_buf);
+       while (!feof($get_it)) {
+               $buf = fread($get_it,4096);
+               echo $buf;
+               $bytes_sent += strlen($buf);
        }
 
-       if ($f_bytes_sent == $f_dl_file_size) {
+       if ($bytes_sent == $dl_file_size) {
 
-               if (!file_exists($f_count_path)) {
-                       mkdir($f_count_path);
+               if (!file_exists($count_path)) {
+                       mkdir($count_path);
                }
 
-               $f_unique_downloads = "$f_count_path/$f_count_file";
+               $unique_downloads = "$count_path/$count_file";
 
-               if (file_exists($f_unique_downloads)) {
-                       $f_count_unique_downloads = file_get_contents($f_unique_downloads);
+               if (file_exists($unique_downloads)) {
+                       $count_unique_downloads = file_get_contents($unique_downloads);
                }
                else {
-                       $f_count_unique_downloads = "0";
+                       $count_unique_downloads = "0";
                }
 
-               $f_count_unique_downloads = $f_count_unique_downloads + 1;
+               $count_unique_downloads = $count_unique_downloads + 1;
 
-               $f_fp_unique_downloads = fopen($f_unique_downloads,"w");
-               fwrite($f_fp_unique_downloads,$f_count_unique_downloads);
-               fclose($f_fp_unique_downloads);
+               $fp_unique_downloads = fopen($unique_downloads,"w");
+               fwrite($fp_unique_downloads,$count_unique_downloads);
+               fclose($fp_unique_downloads);
        }
 }
 
-if (isset($entry) and !empty($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'])) {
+if (isset($req_entry) and !empty($req_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/$entry/comments/pending/{$_REQUEST['comment']}";
+               $comment_dir = "data/items/$req_entry/comments/pending/{$_REQUEST['comment']}";
 
                $login_key = file_get_contents("$comment_dir/key.txt");
 
@@ -256,9 +270,18 @@ if (isset($entry) and !empty($entry) and isset($_REQUEST['comment']) and !empty(
 
                        if ($_REQUEST['action'] == "approve") {
 
-                               $live_dir = "data/items/$entry/comments/live/{$_REQUEST['comment']}";
+                               $live_dir = "data/items/$req_entry/comments/live/{$_REQUEST['comment']}";
+
+                               if (!file_exists("data/items/$req_entry/comments/live")) {
+                                       mkdir("data/items/$req_entry/comments/live");
+                               }
+
+                               if (!file_exists("data/items/$req_entry/comments/live/{$_REQUEST['comment']}")) {
+                                       mkdir("data/items/$req_entry/comments/live/{$_REQUEST['comment']}");
+                               }
 
                                rename($comment_dir,$live_dir);
+
                                unlink("$live_dir/key.txt");
 
                                $cmonth = date("Ym",time() + $offset);
@@ -271,17 +294,34 @@ if (isset($entry) and !empty($entry) and isset($_REQUEST['comment']) and !empty(
                                        mkdir("data/comments/latest/$cmonth");
                                }
 
-                               if (!file_exists("data/comments/latest/$cmonth/$entry")) {
-                                       mkdir("data/comments/latest/$cmonth/$entry");
+                               if (!file_exists("data/comments/latest/$cmonth/$req_entry")) {
+                                       mkdir("data/comments/latest/$cmonth/$req_entry");
                                }
 
-                               if (!file_exists("data/comments/latest/$cmonth/$entry/{$_REQUEST['comment']}")) {
-                                       mkdir("data/comments/latest/$cmonth/$entry/{$_REQUEST['comment']}");
+                               if (!file_exists("data/comments/latest/$cmonth/$req_entry/{$_REQUEST['comment']}")) {
+                                       mkdir("data/comments/latest/$cmonth/$req_entry/{$_REQUEST['comment']}");
                                }
 
-                               $cat_dir = file_get_contents("data/items/$entry/category.txt");
+                               $private_categories = "0";
+
+                               if (file_exists("data/items/$req_entry/categories")) {
+                      
+                                       if ($dh_entry_categories = opendir("data/items/$req_entry/categories")) {
+                      
+                                               while (($entry_category = readdir($dh_entry_categories)) !== false) {
+                      
+                                                       if ($entry_category != "." && $entry_category != "..") {
+                      
+                                                               if (file_exists("data/categories/$entry_category/private.txt")) {
+                                                                       $private_categories = $private_categories + 1;
+                                                               }
+                                                       }
+                                               }
+                                               closedir($dh_entry_categories);
+                                       }
+                               }
 
-                               if (file_exists("data/members/active") and file_exists("data/ml.txt") and file_exists("data/email.txt") and !file_exists("data/items/$entry/private.txt") and !file_exists("data/categories/$cat_dir/private.txt")) {
+                               if (file_exists("data/members/active") and file_exists("data/ml.txt") and file_exists("data/email.txt") and !file_exists("data/items/$req_entry/private.txt") and ($private_categories == "0")) {
 
                                        if (file_exists("data/ml-reply2.txt")) {
                                                $ml_reply2 = file_get_contents("data/ml-reply2.txt");
@@ -301,7 +341,7 @@ if (isset($entry) and !empty($entry) and isset($_REQUEST['comment']) and !empty(
 
                                        $ml_from = '"' . "$ml_from_firstname $ml_from_lastname" . '" <' . $ml_from . '>';
 
-                                       $ml_subject = file_get_contents("data/items/$entry/title.txt");
+                                       $ml_subject = file_get_contents("data/items/$req_entry/title.txt");
 
                                        if (file_exists("data/ml-prepend.txt")) {
                                                $ml_prepend = file_get_contents("data/ml-prepend.txt");
@@ -315,17 +355,17 @@ if (isset($entry) and !empty($entry) and isset($_REQUEST['comment']) and !empty(
                                        $ml_mailer = 'MAJ/0.14 (PHP/' . phpversion() . ')';
 
                                        $ml_body = file_get_contents("$live_dir/comment.txt");
-                                       $ml_body = str_replace('<br />',"\n",$ml_body);
-                                       $ml_body = str_replace('<img src=images/smileys/crying.png border=0>',':((',$ml_body);
-                                       $ml_body = str_replace('<img src=images/smileys/frown.png border=0>',':(',$ml_body);
-                                       $ml_body = str_replace('<img src=images/smileys/indifferent.png border=0>',':|',$ml_body);
-                                       $ml_body = str_replace('<img src=images/smileys/laughing.png border=0>',':D',$ml_body);
-                                       $ml_body = str_replace('<img src=images/smileys/lick.png border=0>',':P',$ml_body);
-                                       $ml_body = str_replace('<img src=images/smileys/ohno.png border=0>',':O',$ml_body);
-                                       $ml_body = str_replace('<img src=images/smileys/smile.png border=0>',':)',$ml_body);
-                                       $ml_body = str_replace('<img src=images/smileys/surprised.png border=0>','=)',$ml_body);
-                                       $ml_body = str_replace('<img src=images/smileys/undecided.png border=0>',':\\',$ml_body);
-                                       $ml_body = str_replace('<img src=images/smileys/wink.png border=0>',';)',$ml_body);
+                                       $ml_body = str_replace('<br>',"\n",$ml_body);
+                                       $ml_body = str_replace('<img src="images/smileys/crying.png" border="0">',':((',$ml_body);
+                                       $ml_body = str_replace('<img src="images/smileys/frown.png" border="0">',':(',$ml_body);
+                                       $ml_body = str_replace('<img src="images/smileys/indifferent.png" border="0">',':|',$ml_body);
+                                       $ml_body = str_replace('<img src="images/smileys/laughing.png" border="0">',':D',$ml_body);
+                                       $ml_body = str_replace('<img src="images/smileys/lick.png" border="0">',':P',$ml_body);
+                                       $ml_body = str_replace('<img src="images/smileys/ohno.png" border="0">',':O',$ml_body);
+                                       $ml_body = str_replace('<img src="images/smileys/smile.png" border="0">',':)',$ml_body);
+                                       $ml_body = str_replace('<img src="images/smileys/surprised.png" border="0">','=)',$ml_body);
+                                       $ml_body = str_replace('<img src="images/smileys/undecided.png" border="0">',':\\',$ml_body);
+                                       $ml_body = str_replace('<img src="images/smileys/wink.png" border="0">',';)',$ml_body);
                                        $ml_body = str_replace('&amp;','&',$ml_body);
                                        $ml_body = str_replace('&lt;','<',$ml_body);
                                        $ml_body = str_replace('&gt;','>',$ml_body);
@@ -352,11 +392,11 @@ if (isset($entry) and !empty($entry) and isset($_REQUEST['comment']) and !empty(
 
                                        $ml_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
                                        $ml_url = str_replace('//','/',$ml_url);
-                                       $ml_url = "http://" . $ml_url . "index.php?entry=$entry&show=comments";
+                                       $ml_url = "http://$ml_url/index.php?entry=$req_entry&show=comments";
 
                                        $ml_body = $ml_body . "\n\nPlease visit the following URL for the full thread:\n\n" . $ml_url;
 
-                                       if (file_exists("data/items/$entry/member.txt")) {
+                                       if (file_exists("data/items/$req_entry/member.txt")) {
                                                $ml_body = $ml_body . "\n\nYou need to login first to view the entry or to add a comment.";
                                        }
 
@@ -368,7 +408,7 @@ if (isset($entry) and !empty($entry) and isset($_REQUEST['comment']) and !empty(
 
                                        if ($dh_ml_member = opendir("data/members/active")) {
                                                while (($ml_member = readdir($dh_ml_member)) !== false) {
-                                                       if ($ml_member != "." && $ml_member != ".." && fnmatch("*",$ml_member)) {
+                                                       if ($ml_member != "." && $ml_member != "..") {
 
                                                                if (file_exists("data/members/active/$ml_member/noml.txt")) {
                                                                        continue;
@@ -387,13 +427,13 @@ if (isset($entry) and !empty($entry) and isset($_REQUEST['comment']) and !empty(
                                                                        mail($ml_to,$ml_subject,$ml_body,
                                                                        "From: $ml_from\r\n" .
                                                                        "Reply-To: $ml_reply2\r\n" .
-                                                                       "References: $entry\r\n" .
+                                                                       "References: $req_entry\r\n" .
                                                                        "X-Mailer: $ml_mailer");
                                                                }
                                                                else {
                                                                        mail($ml_to,$ml_subject,$ml_body,
                                                                        "From: $ml_from\r\n" .
-                                                                       "References: $entry\r\n" .
+                                                                       "References: $req_entry\r\n" .
                                                                        "X-Mailer: $ml_mailer");
                                                                }
                                                        }
@@ -408,7 +448,7 @@ if (isset($entry) and !empty($entry) and isset($_REQUEST['comment']) and !empty(
                                rmdirr($comment_dir);
                        }
 
-                       $pending_comment_flag_dir = $entry;
+                       $pending_comment_flag_dir = $req_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"));
@@ -427,24 +467,24 @@ if (isset($entry) and !empty($entry) and isset($_REQUEST['comment']) and !empty(
                                fclose($fp_comment_count_txt);
                        }
 
-                       header("Location: index.php?entry=$entry&show=comments");
+                       header("Location: index.php?entry=$req_entry&show=comments");
                }
 }
 
-if (isset($entry) and !empty($entry)) {
+if (isset($req_entry) and !empty($req_entry)) {
 
-       if (file_exists("data/items/$entry")) {
+       if (file_exists("data/items/$req_entry")) {
 
-               $filter = $entry;
+               $filter = $req_entry;
 
-               $title = file_get_contents("data/items/$entry/title.txt");
+               $title = file_get_contents("data/items/$req_entry/title.txt");
 
                echo "<title>$title</title>";
 
                if ((!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
 
-                       if (file_exists("data/items/$entry/views.txt")) {
-                               $count_views = file_get_contents("data/items/$entry/views.txt");
+                       if (file_exists("data/items/$req_entry/views.txt")) {
+                               $count_views = file_get_contents("data/items/$req_entry/views.txt");
                        }
                        else {
                                $count_views = "0";
@@ -452,55 +492,55 @@ if (isset($entry) and !empty($entry)) {
 
                        $count_views = $count_views + 1;
 
-                       $fp_views = fopen("data/items/$entry/views.txt","w");
+                       $fp_views = fopen("data/items/$req_entry/views.txt","w");
                        fwrite($fp_views,$count_views);
                        fclose($fp_views);
                }
               
-               if (isset($show) and !empty($show) and isset($_POST['captcha_put']) and !empty($_REQUEST['captcha_get']) and isset($_POST['firstname']) and !empty($_POST['firstname']) and isset($_POST['lastname']) and !empty($_POST['lastname']) and isset($_POST['email']) and !empty($_POST['email']) and isset($_POST['new_comment']) and !empty($_POST['new_comment']) and isset($_POST['captcha_put']) and !empty($_POST['captcha_put']) and ($_REQUEST['captcha_get'] == $_POST['captcha_put']) and (ereg("@",$_POST['email'])) and (ereg("\.",$_POST['email']))) {
+               if (isset($req_show) and !empty($req_show) and isset($_POST['captcha_put']) and !empty($_REQUEST['captcha_get']) and isset($_POST['firstname']) and !empty($_POST['firstname']) and isset($_POST['lastname']) and !empty($_POST['lastname']) and isset($_POST['email']) and !empty($_POST['email']) and isset($_POST['new_comment']) and !empty($_POST['new_comment']) and isset($_POST['captcha_put']) and !empty($_POST['captcha_put']) and ($_REQUEST['captcha_get'] == $_POST['captcha_put']) and (ereg("@",$_POST['email'])) and (ereg("\.",$_POST['email']))) {
               
-                       if (!file_exists("data/items/$entry/comments")) {
-                               mkdir("data/items/$entry/comments");
+                       if (!file_exists("data/items/$req_entry/comments")) {
+                               mkdir("data/items/$req_entry/comments");
                        }
 
-                       if (!file_exists("data/items/$entry/comments/pending")) {
-                               mkdir("data/items/$entry/comments/pending");
+                       if (!file_exists("data/items/$req_entry/comments/pending")) {
+                               mkdir("data/items/$req_entry/comments/pending");
                        }
 
-                       if (!file_exists("data/items/$entry/comments/live")) {
-                               mkdir("data/items/$entry/comments/live");
+                       if (!file_exists("data/items/$req_entry/comments/live")) {
+                               mkdir("data/items/$req_entry/comments/live");
                        }
 
                        $timestamp = date("l,M j,Y,g:i A",time() + $offset);
       
                        $comment_entry_dir = date("YmdHis",time() + $offset);
       
-                       mkdir("data/items/$entry/comments/pending/$comment_entry_dir");
+                       mkdir("data/items/$req_entry/comments/pending/$comment_entry_dir");
       
                        $body_content = ucfirst($_POST['new_comment']);
                        $body_content = htmlentities($body_content,ENT_NOQUOTES);
-                       $body_content = str_replace("\n",'<br />',$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("data/items/$entry/comments/pending/$comment_entry_dir/comment.txt","w");
+                       $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("data/items/$req_entry/comments/pending/$comment_entry_dir/comment.txt","w");
                        fwrite($fp_body_txt,$body_content);
                        fclose($fp_body_txt);
 
-                       $fp_timestamp_txt = fopen("data/items/$entry/comments/pending/$comment_entry_dir/timestamp.txt","w");
+                       $fp_timestamp_txt = fopen("data/items/$req_entry/comments/pending/$comment_entry_dir/timestamp.txt","w");
                        fwrite($fp_timestamp_txt,$timestamp);
                        fclose($fp_timestamp_txt);
 
-                       $fp_firstname_txt = fopen("data/items/$entry/comments/pending/$comment_entry_dir/firstname.txt","w");
+                       $fp_firstname_txt = fopen("data/items/$req_entry/comments/pending/$comment_entry_dir/firstname.txt","w");
                        $firstname = strtolower($_POST['firstname']);
                        $firstname = ucwords($firstname);
                        $firstname = trim($firstname);
@@ -508,7 +548,7 @@ if (isset($entry) and !empty($entry)) {
                        fwrite($fp_firstname_txt,$firstname);
                        fclose($fp_firstname_txt);
 
-                       $fp_lastname_txt = fopen("data/items/$entry/comments/pending/$comment_entry_dir/lastname.txt","w");
+                       $fp_lastname_txt = fopen("data/items/$req_entry/comments/pending/$comment_entry_dir/lastname.txt","w");
                        $lastname = strtolower($_POST['lastname']);
                        $lastname = ucwords($lastname);
                        $lastname = trim($lastname);
@@ -516,7 +556,7 @@ if (isset($entry) and !empty($entry)) {
                        fwrite($fp_lastname_txt,$lastname);
                        fclose($fp_lastname_txt);
 
-                       $fp_email_txt = fopen("data/items/$entry/comments/pending/$comment_entry_dir/email.txt","w");
+                       $fp_email_txt = fopen("data/items/$req_entry/comments/pending/$comment_entry_dir/email.txt","w");
                        $email = strtolower($_POST['email']);
                        $email = trim($email);
                        $email = htmlentities($email,ENT_NOQUOTES);
@@ -524,7 +564,7 @@ if (isset($entry) and !empty($entry)) {
                        fclose($fp_email_txt);
 
                        if (isset($_POST['url']) and !empty($_POST['url']) and (ereg("\.",$_POST['url']))) {
-                               $fp_url_txt = fopen("data/items/$entry/comments/pending/$comment_entry_dir/url.txt","w");
+                               $fp_url_txt = fopen("data/items/$req_entry/comments/pending/$comment_entry_dir/url.txt","w");
                                $url = str_replace("http://","",$_POST['url']);
                                $url = strtolower($url);
                                $url = trim($url);
@@ -535,13 +575,13 @@ if (isset($entry) and !empty($entry)) {
                        }
 
                        if (isset($_POST['cauthor']) and !empty($_POST['cauthor'])) {
-                               $fp_cauthor_txt = fopen("data/items/$entry/comments/pending/$comment_entry_dir/author.txt","w");
+                               $fp_cauthor_txt = fopen("data/items/$req_entry/comments/pending/$comment_entry_dir/author.txt","w");
                                fwrite($fp_cauthor_txt,$_POST['cauthor']);
                                fclose($fp_cauthor_txt);
                        }
 
                        $key_rand = str_rand(14);
-                       $fp_key_txt = fopen("data/items/$entry/comments/pending/$comment_entry_dir/key.txt","w");
+                       $fp_key_txt = fopen("data/items/$req_entry/comments/pending/$comment_entry_dir/key.txt","w");
                        fwrite($fp_key_txt,$key_rand);
                        fclose($fp_key_txt);
 
@@ -567,14 +607,14 @@ if (isset($entry) and !empty($entry)) {
 
                        $mailer = 'MAJ/0.14 (PHP/' . phpversion() . ')';
       
-                       $commented_entry_title_file = "data/items/$entry/title.txt";
+                       $commented_entry_title_file = "data/items/$req_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") and file_exists("data/email.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=$entry&show=comments\n\nThanks again! =)\n\n--\n$sig_author\n$sig_url\n";
+                               $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=$req_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 sharing your thoughts!",$comment_thanks,
@@ -585,7 +625,7 @@ if (isset($entry) and !empty($entry)) {
 
                        if (file_exists("data/email.txt") and !file_exists("data/xscreen.txt")) {
 
-                               $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=$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=$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 = "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=$req_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=$req_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 Comment",$comment_notice,
@@ -602,7 +642,7 @@ if (isset($entry) and !empty($entry)) {
                                mkdir("data/comments/pending");
                        }
 
-                       $pending_comment_flag = $entry;
+                       $pending_comment_flag = $req_entry;
       
                        if (!file_exists("data/comments/pending/$pending_comment_flag")) {
                                mkdir("data/comments/pending/$pending_comment_flag");
@@ -625,8 +665,8 @@ if (isset($entry) and !empty($entry)) {
        else {
                echo "<title>$default_title</title>";
 
-               if (isset($archive) and !empty($archive)) {
-                       $filter = trim($archive) . "*";
+               if (isset($req_archive) and !empty($req_archive)) {
+                       $filter = trim($req_archive) . "*";
                }
                else {
                        $filter = "*";
@@ -636,35 +676,33 @@ if (isset($entry) and !empty($entry)) {
 else {
        echo "<title>$default_title</title>";
 
-       if (isset($archive) and !empty($archive)) {
-               $filter = trim($archive) . "*";
+       if (isset($req_archive) and !empty($req_archive)) {
+               $filter = trim($req_archive) . "*";
        }
        else {
                $filter = "*";
        }
 }
 
-// start: auto-approve comments without rewriting "comment approval system" (20080521)
-
 if (file_exists("data/comments/pending") and file_exists("data/xscreen.txt")) {
 
-       if ($dh_xscreen_list = opendir("data/comments/pending")) {
+       if ($dh_xscreen_comments = opendir("data/comments/pending")) {
 
-               while (($entry_xscreen = readdir($dh_xscreen_list)) !== false) {
+               while (($xscreen_comment = readdir($dh_xscreen_comments)) !== false) {
 
-                       if ($entry_xscreen != "." && $entry_xscreen != "..") {
-                               $show_xscreen_list[] = $entry_xscreen;
+                       if ($xscreen_comment != "." && $xscreen_comment != "..") {
+                               $xscreen_comments[] = $xscreen_comment;
                        }
                }
-               closedir($dh_xscreen_list);
+               closedir($dh_xscreen_comments);
        }
 
-       rsort($show_xscreen_list);
-       reset($show_xscreen_list);
+       rsort($xscreen_comments);
+       reset($xscreen_comments);
 
-       if (count($show_xscreen_list) > 0) {
+       if (count($xscreen_comments) > 0) {
 
-               foreach ($show_xscreen_list as $xscreen_dir) {
+               foreach ($xscreen_comments as $xscreen_dir) {
 
                        if ($dh_xscreen_pending = opendir("data/items/$xscreen_dir/comments/pending")) {
 
@@ -683,30 +721,46 @@ if (file_exists("data/comments/pending") and file_exists("data/xscreen.txt")) {
        }
 }
 
-// end: auto-approve comments without rewriting "comment approval system" (20080521)
-
 ?>
 
 <?php
 
-if (isset($entry) and !empty($entry) and file_exists("data/items/$entry")) {
+if (isset($req_entry) and !empty($req_entry) and file_exists("data/items/$req_entry")) {
+
+       $private_categories = "0";
+
+       if (file_exists("data/items/$req_entry/categories")) {
+                      
+               if ($dh_entry_categories = opendir("data/items/$req_entry/categories")) {
+                      
+                       while (($entry_category = readdir($dh_entry_categories)) !== false) {
+                      
+                               if ($entry_category != "." && $entry_category != "..") {
+                      
+                                       if (file_exists("data/categories/$entry_category/private.txt")) {
+                                               $private_categories = $private_categories + 1;
+                                       }
+                               }
+                       }
+                       closedir($dh_entry_categories);
+               }
+       }
 
-       $cat_dir = file_get_contents("data/items/$entry/category.txt");
 
-       if (!file_exists("data/categories/$cat_dir/private.txt")) {
+       if ($private_categories == "0") {
 
-               if (!file_exists("data/items/$entry/passwd.txt")) {
+               if (!file_exists("data/items/$req_entry/passwd.txt")) {
 
-                       if (!file_exists("data/items/$entry/private.txt")) {
+                       if (!file_exists("data/items/$req_entry/private.txt")) {
 
-                               $description = file_get_contents("data/items/$entry/body.txt");
+                               $description = file_get_contents("data/items/$req_entry/body.txt");
                                $description = strip_tags($description);
                                $description = html_entity_decode($description);
                                $description = str_replace("&","&amp;",$description);
                                $description = str_replace("<","&lt;",$description);
                                $description = str_replace(">","&gt;",$description);
                                $description = str_replace("<br>"," ",$description);
-                               $description = str_replace("<br />"," ",$description);
+                               $description = str_replace("<br>"," ",$description);
                                $description = str_replace("\r"," ",$description);
                                $description = str_replace("\n"," ",$description);
                                $description = str_replace(chr(10)," ",$description);
@@ -975,14 +1029,14 @@ a.navlink:link,a.navlink:visited,a.navlink:active,a.navlink:hover {
                                        echo "{$font_panel_footer},";
                                }
        ?> arial,helvetica,sans-serif;
-       font-size: 11px;
+       font-size: 10px;
        color: <?php
                        if (file_exists("data/colors/pf-font.txt")) {
                                $panel_footer_font_color = file_get_contents("data/colors/pf-font.txt");
                                echo $panel_footer_font_color;
                        }
                        else {
-                               echo "#666666";
+                               echo "#999999";
                        }
        ?>;
        <?php
@@ -1303,6 +1357,60 @@ a.navlink:link,a.navlink:visited,a.navlink:active,a.navlink:hover {
        ?>
 }
 
+#panel_category {
+       font-family: <?php
+                               if (file_exists("data/fonts/panel-footer.txt")) {
+                                       $font_panel_category = file_get_contents("data/fonts/panel-footer.txt");
+                                       echo "{$font_panel_category},";
+                               }
+       ?> arial,helvetica,sans-serif;
+       font-size: 10px;
+       color: <?php
+                       if (file_exists("data/colors/pf-font.txt")) {
+                               $panel_category_font_color = file_get_contents("data/colors/pf-font.txt");
+                               echo $panel_category_font_color;
+                       }
+                       else {
+                               echo "#999999";
+                       }
+       ?>;
+
+       padding: 5px 5px 5px 5px;
+
+       background-color: <?php
+                               if (file_exists("data/colors/pf-bg.txt")) {
+                                       $panel_category_background_color = file_get_contents("data/colors/pf-bg.txt");
+                                       echo $panel_category_background_color;
+                               }
+                               else {
+                                       echo "transparent";
+                               }
+       ?>;
+
+       margin: 0px 0px 0px 0px;
+
+       border-color: <?php
+                               if (file_exists("data/colors/border.txt")) {
+                                       $panel_category_border_color = file_get_contents("data/colors/border.txt");
+                                       echo $panel_category_border_color;
+                               }
+                               else {
+                                       echo "#cccccc";
+                               }
+       ?>;
+       <?php
+               if (file_exists("data/round.txt")) {
+                       echo 'border-width: 1px 1px 0px 1px;';
+                       echo 'border-style: solid solid none solid;';
+               }
+               else {
+                       echo 'border-width: 0px 1px 1px 1px;';
+                       echo 'border-style: none solid solid solid;';
+               }
+       ?>
+       text-align: left;
+}
+
 <?php if (file_exists("data/css.txt")) { readfile("data/css.txt"); } ?>
 
 </style>
@@ -1421,7 +1529,7 @@ else {
 
 Navigation</div>
 <div id="panel_body">
-<a class="navlink" href="<?php echo $_SERVER['PHP_SELF']; ?>">Home</a><br>
+<a class="navlink" href="index.php">Home</a><br>
 
 <?php
 
@@ -1440,14 +1548,14 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
 }
 elseif (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and file_exists("data/members/active/{$_SESSION['logged_in']}") and file_exists("data/bb.txt")) {
 
-       if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) {
-               $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
-               if (!file_exists("data/categories/$bb_cat") or ($bb_cat == "")) {
-                       unlink("data/members/active/{$_SESSION['logged_in']}/category.txt");
+       if (file_exists("data/members/active/{$_SESSION['logged_in']}/categories/$req_category")) {
+
+               if (!file_exists("data/categories/$req_category")) {
+                       rmdirr("data/members/active/{$_SESSION['logged_in']}/categories/$req_category");
                }
        }
 
-       if (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") or file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) {
+       if (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") or file_exists("data/members/active/{$_SESSION['logged_in']}/categories/$req_category")) {
                echo '<a class="navlink" href="add.php">Add Entry</a><br>';
        }
 
@@ -1476,35 +1584,52 @@ else {
 
 if (file_exists("data/sticky")) {
 
-       if ($dh_sticky_list = opendir("data/sticky")) {
+       if ($dh_sticky = opendir("data/sticky")) {
 
-               while (($entry_sticky_list = readdir($dh_sticky_list)) !== false) {
+               while (($sticky_entry = readdir($dh_sticky)) !== false) {
 
-                       if (file_exists("data/items/$entry_sticky_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                       if (file_exists("data/items/$sticky_entry/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                                continue;
                        }
 
-                       if (file_exists("data/items/$entry_sticky_list/member.txt") and (!isset($_SESSION['logged_in']))) {
+                       if (file_exists("data/items/$sticky_entry/member.txt") and (!isset($_SESSION['logged_in']))) {
                                continue;
                        }
 
-                       $get_cat_dir = file_get_contents("data/items/$entry_sticky_list/category.txt");
+                       $private_categories = "0";
+
+                       if (file_exists("data/items/$sticky_entry/categories")) {
+                      
+                               if ($dh_sticky_categories = opendir("data/items/$sticky_entry/categories")) {
+                      
+                                       while (($sticky_category = readdir($dh_sticky_categories)) !== false) {
+                      
+                                               if ($sticky_category != "." && $sticky_category != "..") {
+                      
+                                                       if (file_exists("data/categories/$sticky_category/private.txt")) {
+                                                               $private_categories = $private_categories + 1;
+                                                       }
+                                               }
+                                       }
+                                       closedir($dh_sticky_categories);
+                               }
+                       }
 
-                       if (file_exists("data/categories/$get_cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_sticky_list/cat.txt")) {
+                       if (($private_categories > 0) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$sticky_entry/cat.txt")) {
                                continue;
                        }
 
-                       if ($entry_sticky_list != "." && $entry_sticky_list != ".." && fnmatch("*",$entry_sticky_list)) {
-                               $show_sticky_list[] = $entry_sticky_list;
+                       if ($sticky_entry != "." && $sticky_entry != "..") {
+                               $sticky_entries[] = $sticky_entry;
                        }
                }
-               closedir($dh_sticky_list);
+               closedir($dh_sticky);
        }
 
-       sort($show_sticky_list);
-       reset($show_sticky_list);
+       sort($sticky_entries);
+       reset($sticky_entries);
 
-       $count_sticky_list = count($show_sticky_list);
+       $count_sticky_list = count($sticky_entries);
       
        if ($count_sticky_list > 0) {
 
@@ -1518,8 +1643,8 @@ if (file_exists("data/sticky")) {
                echo 'Quick Links</div>';
                echo '<div id="panel_body">';
 
-               foreach ($show_sticky_list as $sticky_list_entry) {
-                       echo "<a class=\"navlink\" href=\"{$_SERVER['PHP_SELF']}?entry=$sticky_list_entry\">";
+               foreach ($sticky_entries as $sticky_list_entry) {
+                       echo "<a class=\"navlink\" href=\"index.php?entry=$sticky_list_entry\">";
                        readfile("data/items/$sticky_list_entry/title.txt");
                        echo "</a><br>";
                }
@@ -1538,54 +1663,80 @@ if (file_exists("data/sticky")) {
 
 if (file_exists("data/panels")) {
 
-       if ($dh_panel_list = opendir("data/panels")) {
+       if ($dh_panels = opendir("data/panels")) {
 
-               while (($entry_panel_list = readdir($dh_panel_list)) !== false) {
+               while (($panel = readdir($dh_panels)) !== false) {
 
-                       if (file_exists("data/panels/$entry_panel_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
+                       if ($panel != "." && $panel != "..") {
 
-                       if (file_exists("data/panels/$entry_panel_list/right.txt")) {
-                               continue;
-                       }
+                               if (file_exists("data/panels/$panel/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                                       continue;
+                               }
 
-                       if (file_exists("data/panels/$entry_panel_list/center.txt")) {
-                               continue;
-                       }
+                               if (file_exists("data/panels/$panel/top.txt")) {
+                                       $top_panels[] = $panel;
+                                       continue;
+                               }
 
-                       if (file_exists("data/panels/$entry_panel_list/top.txt")) {
-                               continue;
-                       }
+                               if (file_exists("data/panels/$panel/center.txt")) {
+                                       $center_panels[] = $panel;
+                                       continue;
+                               }
 
-                       if (file_exists("data/panels/$entry_panel_list/entry.txt")) {
-                               continue;
-                       }
+                               if (file_exists("data/panels/$panel/entry.txt")) {
+                                       $entry_panels[] = $panel;
+                                       continue;
+                               }
 
-                       if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $entry_panel_list)) {
-                               continue;
-                       }
+                               if (file_exists("data/panels/$panel/right.txt")) {
+                                       $right_panels[] = $panel;
+                                       continue;
+                               }
 
-                       if (file_exists("data/footer.txt") and (file_get_contents("data/footer.txt") == $entry_panel_list)) {
-                               continue;
-                       }
+                               if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $panel)) {
+                                       continue;
+                               }
+
+                               if (file_exists("data/footer.txt") and (file_get_contents("data/footer.txt") == $panel)) {
+                                       continue;
+                               }
 
-                       if ($entry_panel_list != "." && $entry_panel_list != ".." && fnmatch("*",$entry_panel_list)) {
-                               $show_panel_list[] = $entry_panel_list;
+                               $left_panels[] = $panel;
                        }
                }
-               closedir($dh_panel_list);
+               closedir($dh_panels);
        }
 
-       sort($show_panel_list);
-       reset($show_panel_list);
-       $count_panel_list = count($show_panel_list);
-      
-       if ($count_panel_list > 0) {
+       sort($left_panels);
+       reset($left_panels);
+
+       $count_left_panels = count($left_panels);
+
+       sort($top_panels);
+       reset($top_panels);
+
+       $count_top_panels = count($top_panels);
+
+       sort($center_panels);
+       reset($center_panels);
+
+       $count_center_panels = count($center_panels);
+
+       sort($entry_panels);
+       reset($entry_panels);
+
+       $count_entry_panels = count($entry_panels);
 
-               foreach ($show_panel_list as $panel_list_entry) {
+       sort($right_panels);
+       reset($right_panels);
 
-                       if (!file_exists("data/panels/$panel_list_entry/free.txt")) {
+       $count_right_panels = count($right_panels);
+
+       if ($count_left_panels > 0) {
+
+               foreach ($left_panels as $left_panel) {
+
+                       if (!file_exists("data/panels/$left_panel/free.txt")) {
 
                                if (file_exists("data/round.txt")) {
                                        echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
@@ -1594,29 +1745,29 @@ if (file_exists("data/panels")) {
                                        echo '<div id="panel_title">';
                                }
 
-                               readfile("data/panels/$panel_list_entry/title.txt");
+                               readfile("data/panels/$left_panel/title.txt");
 
                                if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
-                                       echo "<a href=panels.php#{$panel_list_entry}>";
+                                       echo "<a href=panels.php#{$left_panel}>";
                                        echo '<img src=images/widget.edit.png border=0 width=11 height=11 align=right></a>';
                                }
 
-                               if (file_exists("data/panels/$panel_list_entry/private.txt")) {
+                               if (file_exists("data/panels/$left_panel/private.txt")) {
                                        echo '<img src=images/widget.private.png border=0 width=11 height=11 align=right>';
                                }
 
                                echo '</div><div id=panel_body>';
                        }
 
-                       if (file_exists("data/panels/$panel_list_entry/free.txt")) {
+                       if (file_exists("data/panels/$left_panel/free.txt")) {
                                echo '<div id=panel_free>';
                        }
 
-                       include("data/panels/$panel_list_entry/panel.php");
+                       include("data/panels/$left_panel/panel.php");
 
                        echo '</div>';
 
-                       if (file_exists("data/round.txt") and !file_exists("data/panels/$panel_list_entry/free.txt")) {
+                       if (file_exists("data/round.txt") and !file_exists("data/panels/$left_panel/free.txt")) {
                                echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
                        }
                }
@@ -1629,407 +1780,440 @@ if (file_exists("data/panels")) {
 <td valign=top width=<?php if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) { echo "610"; } else { echo "525"; } ?>>
 
 <?php
-if (file_exists("data/panels")) {
-
-       if ($dh_top_panel_list = opendir("data/panels")) {
+      
+if ($count_top_panels > 0) {
 
-               while (($entry_top_panel_list = readdir($dh_top_panel_list)) !== false) {
+       foreach ($top_panels as $top_panel) {
 
-                       if (file_exists("data/panels/$entry_top_panel_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
+               if (!file_exists("data/panels/$top_panel/free.txt")) {
 
-                       if (!file_exists("data/panels/$entry_top_panel_list/top.txt")) {
-                               continue;
+                       if (file_exists("data/round.txt")) {
+                               echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
                        }
-
-                       if ($entry_top_panel_list != "." && $entry_top_panel_list != ".." && fnmatch("*",$entry_top_panel_list)) {
-                               $show_top_panel_list[] = $entry_top_panel_list;
+                       else {
+                               echo '<div id="panel_title">';
                        }
-               }
-               closedir($dh_top_panel_list);
-       }
 
-       sort($show_top_panel_list);
-       reset($show_top_panel_list);
-
-       $count_top_panel_list = count($show_top_panel_list);
-      
-       if ($count_top_panel_list > 0) {
-
-               foreach ($show_top_panel_list as $top_panel_list_entry) {
-
-                       if (!file_exists("data/panels/$top_panel_list_entry/free.txt")) {
-
-                               if (file_exists("data/round.txt")) {
-                                       echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
-                               }
-                               else {
-                                       echo '<div id="panel_title">';
-                               }
-
-                               readfile("data/panels/$top_panel_list_entry/title.txt");
-
-                               if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
-                                       echo "<a href=panels.php#{$top_panel_list_entry}>";
-                                       echo '<img src=images/widget.edit.png border=0 width=11 height=11 align=right></a>';
-                               }
+                       readfile("data/panels/$top_panel/title.txt");
 
-                               echo '</div><div id=panel_body>';
+                       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+                               echo "<a href=panels.php#{$top_panel}>";
+                               echo '<img src=images/widget.edit.png border=0 width=11 height=11 align=right></a>';
                        }
 
-                       if (file_exists("data/panels/$top_panel_list_entry/free.txt")) {
-                               echo '<div id=panel_free>';
-                       }
+                       echo '</div><div id=panel_body>';
+               }
 
-                       include("data/panels/$top_panel_list_entry/panel.php");
+               if (file_exists("data/panels/$top_panel/free.txt")) {
+                       echo '<div id=panel_free>';
+               }
 
-                       echo '</div>';
+               include("data/panels/$top_panel/panel.php");
 
-                       if (file_exists("data/round.txt") and !file_exists("data/panels/$top_panel_list_entry/free.txt")) {
-                               echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
-                       }
+               echo '</div>';
+
+               if (file_exists("data/round.txt") and !file_exists("data/panels/$top_panel/free.txt")) {
+                       echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
                }
        }
 }
+
 ?>
 
 <?php
 
-if (file_exists("data/bb.txt") and file_exists("data/bb-summary.txt") and !file_exists("data/lite.txt") and !isset($entry) and !isset($category) and !isset($_REQUEST['start']) and !isset($_REQUEST['author']) and !isset($archive) and !isset($_REQUEST['find'])) {
+// clean-up (start)
 
-       if ($dh_latest_post_items = opendir("data/items")) {
+if (file_exists("data/albums")) {
+       rmdirr("data/albums");
+}
 
-               while (($entry_latest_post_items = readdir($dh_latest_post_items)) !== false) {
-      
-                       $today = date("YmdHis",time() + $offset);
-      
-                       if (($entry_latest_post_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
-      
-                       if (file_exists("data/items/$entry_latest_post_items/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
-      
-                       $cat_dir = file_get_contents("data/items/$entry_latest_post_items/category.txt");
-      
-                       if (file_exists("data/categories/$cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_latest_post_items/cat.txt")) {
-                               continue;
-                       }
-      
-                       if ($entry_latest_post_items != "." && $entry_latest_post_items != ".." && fnmatch("*",$entry_latest_post_items)) {
-                               $show_latest_post_items[] = $entry_latest_post_items;
-                       }
-               }
-               closedir($dh_latest_post_items);
-       }
+// clean-up (end)
 
-       rsort($show_latest_post_items);
-       reset($show_latest_post_items);
+// global entry items (start)
 
-       $count_latest_post_items = count($show_latest_post_items);
+if ($dh_items = opendir("data/items")) {
 
-       if ($count_latest_post_items > 0) {
+       while (($item = readdir($dh_items)) !== false) {
 
-               if (file_exists("data/round.txt")) {
-                       echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
-               }
-               else {
-                       echo '<div id="panel_title">';
-               }
+               if ($item != "." && $item != "..") {
 
-               echo "Latest Entries</div><div id=panel_body>";
-               echo "<table border=0 cellspacing=1 cellpadding=2 bgcolor=#cccccc width=100%>";
-               echo "<tr><td bgcolor=#eeeeee align=center><p>topic</p></td><td bgcolor=#eeeeee align=center><p>author</p></td><td bgcolor=#eeeeee align=center><p>views</p></td><td bgcolor=#eeeeee align=center><p>comments</p></td><td bgcolor=#eeeeee align=center><p>last post</p></td></tr>";
+                       if (file_exists("data/items/$item/comments/live") and (count(glob("data/items/$item/comments/live/*")) < 1)) {
+                               rmdirr("data/items/$item/comments/live");
+                       }
 
-               $increment_latest_post_entries = 0;
-               $show_latest_post_entries = 5;
+                       if (file_exists("data/items/$item/comments/pending") and (count(glob("data/items/$item/comments/pending/*")) < 1)) {
+                               rmdirr("data/items/$item/comments/pending");
+                       }
 
-               while ($increment_latest_post_entries <= $show_latest_post_entries) {
+                       if (file_exists("data/items/$item/comments") and (count(glob("data/items/$item/comments/*")) < 1)) {
+                               rmdirr("data/items/$item/comments");
+                       }
 
-                       echo '<tr><td bgcolor=#ffffff><a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $show_latest_post_items[$increment_latest_post_entries];
+                       if (file_exists("data/items/$item/filedrop/files") and (count(glob("data/items/$item/filedrop/files/*")) < 1)) {
+                               rmdirr("data/items/$item/filedrop/files");
+                       }
 
-                       if ($dh_summary_comments = opendir("data/items/$show_latest_post_items[$increment_latest_post_entries]/comments/live")) {
+                       if (file_exists("data/items/$item/filedrop/count") and (count(glob("data/items/$item/filedrop/count/*")) < 1)) {
+                               rmdirr("data/items/$item/filedrop/count");
+                       }
 
-                               while (($entry_summary_comments = readdir($dh_summary_comments)) !== false) {
+                       if (file_exists("data/items/$item/filedrop") and (count(glob("data/items/$item/filedrop/*")) < 1)) {
+                               rmdirr("data/items/$item/filedrop");
+                       }
 
-                                       if ($entry_summary_comments != "." && $entry_summary_comments != ".." && fnmatch("*",$entry_summary_comments)) {
-                                               $items_summary_comments[] = $entry_summary_comments;
-                                       }
-                               }
-                               closedir($dh_summary_comments);
+                       if ((!file_exists("images/$item/album") or (count(glob("images/$item/album/*")) < 1)) and file_exists("data/items/$item/album/captions") and (count(glob("data/items/$item/album/captions/*")) < 1)) {
+                               rmdirr("data/items/$item/album/captions");
                        }
 
-                       rsort($items_summary_comments);
+                       if ((!file_exists("images/$item/album") or (count(glob("images/$item/album/*")) < 1)) and file_exists("data/items/$item/album/count") and (count(glob("data/items/$item/album/count/*")) < 1)) {
+                               rmdirr("data/items/$item/album/count");
+                       }
 
-                       $summary_comments = count($items_summary_comments);
-      
-                       if ($summary_comments > 0) {
-                               echo '&show=comments';
+                       if ((!file_exists("images/$item/album") or (count(glob("images/$item/album/*")) < 1)) and file_exists("data/items/$item/album") and (count(glob("data/items/$item/album/*")) < 1)) {
+                               rmdirr("data/items/$item/album");
                        }
-      
-                       echo '>';
-                       readfile("data/items/$show_latest_post_items[$increment_latest_post_entries]/title.txt");
-                       echo '</a></td>';
-                       echo '<td bgcolor=#ffffff><a href=member.php?id=';
-                       readfile("data/items/$show_latest_post_items[$increment_latest_post_entries]/author.txt");
-                       echo '>';
-                       readfile("data/items/$show_latest_post_items[$increment_latest_post_entries]/author.txt");
-                       echo '</a></td>';
-                       echo '<td bgcolor=#ffffff align=right>';
-
-                       if (!file_exists("data/items/$show_latest_post_items[$increment_latest_post_entries]/views.txt")) {
-                               echo 0;
+
+                       if (file_exists("images/$item/album") and (count(glob("images/$item/album/*")) < 1)) {
+                               rmdirr("images/$item/album");
                        }
-                       else {
-                               readfile("data/items/$show_latest_post_items[$increment_latest_post_entries]/views.txt");
+
+                       if (file_exists("images/$item") and (count(glob("images/$item/*")) < 1)) {
+                               rmdirr("images/$item");
                        }
-      
-                       echo '</td>';
 
-                       if ($summary_comments < 1) {
+                       if (file_exists("images/$item/categories") and (count(glob("images/$item/categories/*")) < 1)) {
+                               rmdirr("images/$item/categories");
+                       }
 
-                               $iso_year = substr($show_latest_post_items[$increment_latest_post_entries],0,4);
-                               $iso_month = substr($show_latest_post_items[$increment_latest_post_entries],4,2);
-                               $iso_day = substr($show_latest_post_items[$increment_latest_post_entries],6,2);
-                               $iso_last = $iso_year . "-" . $iso_month . "-" . $iso_day;
+                       $grand[] = $item;
 
-                               echo "<td bgcolor=#ffffff align=right><p>0</p></td>";
-                               echo "<td bgcolor=#ffffff align=right><p>$iso_last</p></td>";
-                       }
-                       else {
-                               $iso_year = substr($items_summary_comments[0],0,4);
-                               $iso_month = substr($items_summary_comments[0],4,2);
-                               $iso_day = substr($items_summary_comments[0],6,2);
-                               $iso_last = $iso_year . "-" . $iso_month . "-" . $iso_day;
+                       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
 
-                               echo "<td bgcolor=#ffffff align=right><p>$summary_comments</p></td>";
-                               echo "<td bgcolor=#ffffff align=right><p>$iso_last</p></td>";
-                       }
+                               if (isset($req_entry) or isset($req_category) or isset($req_archive) or isset($req_find) or isset($req_author)) {
       
-                       unset($items_summary_comments);
+                                       if (isset($req_entry) and file_exists("data/items/$req_entry")) {
+                                               $items[] = $req_entry;
+                                       }
 
-                       $increment_latest_post_entries = $increment_latest_post_entries + 1;
-               }
-       }
+                                       if (isset($req_category) and file_exists("data/categories/$req_category") and file_exists("data/items/$item/categories/$req_category")) {
+                                               $items[] = $item;
+                                       }
 
-       if ($count_latest_post_items > 0) {
+                                       if (isset($req_archive) and fnmatch("$req_archive*",$item)) {
+                                               $items[] = $item;
+                                       }
 
-               echo "</table></div>";
+                                       if (isset($req_author) and (file_exists("data/members/active/$req_author") or (file_get_contents("data/username.txt") == $req_author)) and (file_get_contents("data/items/$item/author.txt") == $req_author)) {
+                                               $items[] = $item;
+                                       }
 
-               if (file_exists("data/round.txt")) {
-                       echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
-               }
-       }
+                                       if (isset($req_find)) {
 
-}
+                                               if ((($req_find == "private") or ($req_find == "member") or ($req_find == "passwd")) and file_exists("data/items/$item/{$req_find}.txt")) {
+                                                       $items[] = $item;
+                                               }
 
-?>
+                                               if ((($req_find == "comments") or ($req_find == "filedrop") or ($req_find == "album")) and file_exists("data/items/$item/$req_find")) {
+                                                       $items[] = $item;
+                                               }
 
-<?php
+                                               if (($req_find == "unfiled") and !file_exists("data/items/$item/categories")) {
+                                                       $items[] = $item;
+                                               }
+                                       }
+                               }
+                               else {
+                                       $items[] = $item;
+                               }
 
-if (file_exists("data/panels")) {
+                               $latest[] = $item;
 
-       if ($dh_center_panel_list = opendir("data/panels")) {
+                               if (file_exists("data/items/$item/album")) {
+                                       $albums[] = $item;
+                               }
 
-               while (($entry_center_panel_list = readdir($dh_center_panel_list)) !== false) {
+                               $random[] = $item;                     
 
-                       if (file_exists("data/panels/$entry_center_panel_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
+                               $archives[] = substr($item,0,6);
                        }
+                       else {
 
-                       if (!file_exists("data/panels/$entry_center_panel_list/center.txt")) {
-                               continue;
-                       }
+                               // non-admin stuff (start)
 
-                       if ($entry_center_panel_list != "." && $entry_center_panel_list != ".." && fnmatch("*",$entry_center_panel_list)) {
-                               $show_center_panel_list[] = $entry_center_panel_list;
-                       }
-               }
-               closedir($dh_center_panel_list);
-       }
-
-       sort($show_center_panel_list);
-       reset($show_center_panel_list);
-
-       $count_center_panel_list = count($show_center_panel_list);
+                               $today = date("YmdHis",time() + $offset);
       
-       if ($count_center_panel_list > 0) {
+                               if ($item > $today) {
+                                       continue;
+                               }
 
-               foreach ($show_center_panel_list as $center_panel_list_entry) {
+                               if (file_exists("data/items/$item/private.txt")) {
+                                       continue;
+                               }
 
-                       if (!file_exists("data/panels/$center_panel_list_entry/free.txt")) {
+                               if (file_exists("data/items/$item/member.txt") and (!isset($_SESSION['logged_in']))) {
+                                       continue;
+                               }
 
-                               if (file_exists("data/round.txt")) {
-                                       echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+                               $private_categories = "0";
+
+                               if (file_exists("data/items/$item/categories")) {
+                      
+                                       if ($dh_entry_categories = opendir("data/items/$item/categories")) {
+                      
+                                               while (($item_category = readdir($dh_entry_categories)) !== false) {
+                      
+                                                       if ($item_category != "." && $item_category != "..") {
+                      
+                                                               if (file_exists("data/categories/$item_category/private.txt")) {
+                                                                       $private_categories = $private_categories + 1;
+                                                               }
+                                                       }
+                                               }
+                                               closedir($dh_entry_categories);
+                                       }
                                }
-                               else {
-                                       echo '<div id="panel_title">';
+
+                               if (($private_categories > 0) and !file_exists("data/items/$item/cat.txt")) {
+                                       continue;
                                }
 
-                               readfile("data/panels/$center_panel_list_entry/title.txt");
+                               $latest[] = $item;
 
-                               if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
-                                       echo "<a href=panels.php#{$center_panel_list_entry}>";
-                                       echo '<img src=images/widget.edit.png border=0 width=11 height=11 align=right></a>';
+                               if (file_exists("data/nocat.txt") and file_exists("data/items/$item/categories") and !file_exists("data/items/$item/cat.txt") and (!isset($req_category) or empty($req_category)) and (!isset($req_entry) or empty($req_entry)) and (!isset($req_author) or empty($req_author))) {
+                                       continue;
                                }
 
-                               echo '</div><div id=panel_body>';
-                       }
+                               if (file_exists("data/items/$item/album")) {
+                                       $albums[] = $item;
+                               }
 
-                       if (file_exists("data/panels/$center_panel_list_entry/free.txt")) {
-                               echo '<div id=panel_free>';
-                       }
+                               $random[] = $item;
+                               $archives[] = substr($item,0,6);
 
-                       include("data/panels/$center_panel_list_entry/panel.php");
+                               if (isset($req_entry) or isset($req_category) or isset($req_archive) or isset($req_find) or isset($req_author)) {
+      
+                                       if (isset($req_entry) and file_exists("data/items/$req_entry")) {
+                                               $items[] = $req_entry;
+                                       }
 
-                       echo '</div>';
+                                       if (isset($req_category) and file_exists("data/categories/$req_category") and file_exists("data/items/$item/categories/$req_category")) {
+                                               $items[] = $item;
+                                       }
 
-                       if (file_exists("data/round.txt") and !file_exists("data/panels/$center_panel_list_entry/free.txt")) {
-                               echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+                                       if (isset($req_archive) and fnmatch("$req_archive*",$item)) {
+                                               $items[] = $item;
+                                       }
+
+                                       if (isset($req_author) and (file_exists("data/members/active/$req_author") or (file_get_contents("data/username.txt") == $req_author)) and (file_get_contents("data/items/$item/author.txt") == $req_author)) {
+                                               $items[] = $item;
+                                       }
+                               }
+                               else {
+                                       $items[] = $item;
+                               }
+
+                               // non-admin stuff (end)
                        }
                }
        }
+       closedir($dh_items);
 }
+
+sort($grand);
+reset($grand);
+
+$count_grand = count($grand);
+
+$items = array_unique($items);
+$items = array_values($items);
+
+if (file_exists("data/old.txt")) {
+       sort($items);
+}
+else {
+       rsort($items);
+}
+
+reset($items);
+
+$count_items = count($items);
+
+rsort($latest);
+reset($latest);
+
+$count_latest = count($latest);
+
+rsort($albums);
+reset($albums);
+
+$count_albums = count($albums);
+
+rsort($random);
+reset($random);
+
+$count_random = count($random);
+
+rsort($archives);
+reset($archives);
+
+$count_archives = count($archives);
+
 ?>
 
 <?php
 
-if (is_dir("data/items")) {
-       if ($dh = opendir("data/items")) {
-               while (($entry_main = readdir($dh)) !== false) {
+if (file_exists("data/bb.txt") and file_exists("data/bb-summary.txt") and !file_exists("data/lite.txt") and !isset($req_entry) and !isset($req_category) and !isset($_REQUEST['start']) and !isset($req_author) and !isset($req_archive) and !isset($req_find)) {
 
-                       if ($entry_main != "." && $entry_main != "..") {
-                               $grand[] = $entry_main;
-                       }
+       if ($count_latest > 0) {
 
-                       $today = date("YmdHis",time() + $offset);
+               if (file_exists("data/round.txt")) {
+                       echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+               }
+               else {
+                       echo '<div id="panel_title">';
+               }
 
-                       if (($entry_main > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
+               echo "Latest Entries</div><div id=panel_body>";
+               echo "<table border=0 cellspacing=1 cellpadding=2 bgcolor=#cccccc width=100%>";
+               echo "<tr><td bgcolor=#eeeeee align=center>topic</td><td bgcolor=#eeeeee align=center>author</td><td bgcolor=#eeeeee align=center>views</td><td bgcolor=#eeeeee align=center>comments</td><td bgcolor=#eeeeee align=center>last post</td></tr>";
 
-                       if (file_exists("data/items/$entry_main/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
+               $increment_latest = 0;
+
+               while ($increment_latest <= 4) {
+
+                       echo "<tr><td bgcolor=\"#ffffff\"><a href=\"index.php?entry=$latest[$increment_latest]";
+
+                       if ($dh_summary_comments = opendir("data/items/$latest[$increment_latest]/comments/live")) {
+
+                               while (($change_me_summary_comments = readdir($dh_summary_comments)) !== false) {
+
+                                       if ($change_me_summary_comments != "." && $change_me_summary_comments != "..") {
+                                               $items_summary_comments[] = $change_me_summary_comments;
+                                       }
+                               }
+                               closedir($dh_summary_comments);
                        }
 
-                       if (file_exists("data/items/$entry_main/member.txt") and (!isset($_SESSION['logged_in']))) {
-                               continue;
+                       rsort($items_summary_comments);
+
+                       $summary_comments = count($items_summary_comments);
+      
+                       if ($summary_comments > 0) {
+                               echo "&show=comments";
                        }
+      
+                       echo "\">";
+                       readfile("data/items/$latest[$increment_latest]/title.txt");
+                       echo "</a></td>";
+
+                       echo "<td bgcolor=\"#ffffff\"><a href=\"member.php?id=";
+                       readfile("data/items/$latest[$increment_latest]/author.txt");
+                       echo "\">";
+                       readfile("data/items/$latest[$increment_latest]/author.txt");
+                       echo "</a></td>";
+                       echo "<td bgcolor=\"#ffffff\" align=\"right\">";
+
+                       if (!file_exists("data/items/$latest[$increment_latest]/views.txt")) {
+                               echo 0;
+                       }
+                       else {
+                               readfile("data/items/$latest[$increment_latest]/views.txt");
+                       }
+      
+                       echo "</td>";
 
-                       $cat_dir = file_get_contents("data/items/$entry_main/category.txt");
+                       if ($summary_comments < 1) {
 
-                       if (file_exists("data/categories/$cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_main/cat.txt")) {
-                               continue;
+                               $iso_year = substr($latest[$increment_latest],0,4);
+                               $iso_month = substr($latest[$increment_latest],4,2);
+                               $iso_day = substr($latest[$increment_latest],6,2);
+                               $iso_last = $iso_year . "-" . $iso_month . "-" . $iso_day;
+
+                               echo "<td bgcolor=\"#ffffff\" align=\"right\">0</td>";
+                               echo "<td bgcolor=\"#ffffff\" align=\"right\">$iso_last</td>";
                        }
+                       else {
+                               $iso_year = substr($items_summary_comments[0],0,4);
+                               $iso_month = substr($items_summary_comments[0],4,2);
+                               $iso_day = substr($items_summary_comments[0],6,2);
+                               $iso_last = $iso_year . "-" . $iso_month . "-" . $iso_day;
 
-                       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']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($category) or empty($category)) and (!isset($entry) or empty($entry)) and (!isset($_REQUEST['author']) or empty($_REQUEST['author']))) {
-                               continue;
+                               echo "<td bgcolor=\"#ffffff\" align=\"right\">$summary_comments</td>";
+                               echo "<td bgcolor=\"#ffffff\" align=\"right\">$iso_last</td>";
                        }
+      
+                       unset($items_summary_comments);
 
-                       if ($entry_main != "." && $entry_main != ".." && fnmatch($filter,$entry_main)) {
+                       $increment_latest = $increment_latest + 1;
+               }
+       }
 
-                               if (isset($category) and !empty($category) and file_exists("data/categories/{$category}")) {
+       if ($count_latest > 0) {
 
-                                       if (file_exists("data/items/$entry_main/category.txt") and (file_get_contents("data/items/$entry_main/category.txt") == "$category")) {
-                                               $items[] = $entry_main;
-                                       }
-                               }
-                               elseif (isset($_REQUEST['author']) and !empty($_REQUEST['author']) and file_exists("data/members/active/{$_REQUEST['author']}") and file_exists("data/bb.txt")) {
+               echo "</table></div>";
 
-                                       if (file_exists("data/items/$entry_main/author.txt") and (file_get_contents("data/items/$entry_main/author.txt") == $_REQUEST['author'])) {
-                                               $items[] = $entry_main;
-                                       }
-                               }
-                               elseif (isset($_REQUEST['author']) and !empty($_REQUEST['author']) and !file_exists("data/members/active/{$_REQUEST['author']}") and (file_get_contents("data/username.txt") == $_REQUEST['author']) and file_exists("data/bb.txt")) {
+               if (file_exists("data/round.txt")) {
+                       echo "<b class=\"rbbottom\"><b class=\"rb4b\"></b><b class=\"rb3b\"></b><b class=\"rb2b\"></b><b class=\"rb1b\"></b></b>";
+               }
+       }
 
-                                       if (file_exists("data/items/$entry_main/author.txt") and (file_get_contents("data/items/$entry_main/author.txt") == $_REQUEST['author'])) {
-                                               $items[] = $entry_main;
-                                       }
-                               }
-                               elseif (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "private")) {
-                                       if (file_exists("data/items/$entry_main/private.txt")) {
-                                               $items[] = $entry_main;
-                                       }
-                               }
-                               elseif (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "member")) {
+}
 
-                                       if (file_exists("data/items/$entry_main/member.txt")) {
-                                               $items[] = $entry_main;
-                                       }
-                               }
-                               elseif (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "passwd")) {
+?>
 
-                                       if (file_exists("data/items/$entry_main/passwd.txt")) {
-                                               $items[] = $entry_main;
-                                       }
-                               }
-                               elseif (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "unfiled")) {
-                                       if (!file_exists("data/items/$entry_main/category.txt")) {
-                                               $items[] = $entry_main;
-                                       }
-                               }
-                               elseif (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "comments")) {
+<?php
 
-                                       if (count(glob("data/items/$entry_main/comments/live/*")) === 0) {
-                                               rmdir("data/items/$entry_main/comments/live");
-                                       }
+if ($count_center_panels > 0) {
 
-                                       if (file_exists("data/items/$entry_main/comments/live")) {
-                                               $items[] = $entry_main;
-                                       }
-                               }
-                               elseif (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "filedrop")) {
+       foreach ($center_panels as $center_panel) {
 
-                                       if (count(glob("data/items/$entry_main/filedrop/*")) === 0) {
-                                               rmdir("data/items/$entry_main/filedrop");
-                                       }
+               if (!file_exists("data/panels/$center_panel/free.txt")) {
 
-                                       if (file_exists("data/items/$entry_main/filedrop")) {
-                                               $items[] = $entry_main;
-                                       }
-                               }
-                               elseif (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "album")) {
+                       if (file_exists("data/round.txt")) {
+                               echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+                       }
+                       else {
+                               echo '<div id="panel_title">';
+                       }
 
-                                       if (file_exists("images/$entry_main/album")) {
-                                               $items[] = $entry_main;
-                                       }
-                               }
-                               else {
-                                       $items[] = $entry_main;
-                               }
+                       readfile("data/panels/$center_panel/title.txt");
+
+                       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+                               echo "<a href=panels.php#{$center_panel}>";
+                               echo '<img src=images/widget.edit.png border=0 width=11 height=11 align=right></a>';
                        }
+
+                       echo '</div><div id=panel_body>';
                }
-               closedir($dh);
-       }
-}
 
-if (!file_exists("data/old.txt")) {
-       rsort($items);
-}
+               if (file_exists("data/panels/$center_panel/free.txt")) {
+                       echo '<div id=panel_free>';
+               }
 
-if (file_exists("data/old.txt")) {
-       sort($items);
+               include("data/panels/$center_panel/panel.php");
+
+               echo '</div>';
+
+               if (file_exists("data/round.txt") and !file_exists("data/panels/$center_panel/free.txt")) {
+                       echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+               }
+       }
 }
 
-if (isset($category) and !empty($category)) {
+?>
 
-       $category = str_replace(" ","-",$category);
-       $category = strtolower($category);
-       $category = strip_tags($category);
+<?php
 
-       if (file_exists("data/categories/$category/book.txt")) {
+if (isset($req_category) and !empty($req_category)) {
+
+       if (file_exists("data/categories/$req_category/book.txt")) {
                sort($items);
+               reset($items);
        }
 }
 
-reset($items);
-
-sort($grand);
-reset($grand);
-
-if (count($items) == 0) {
+if ($count_items == 0) {
 
        echo '<table border=0 cellspacing=0 cellpadding=0 bgcolor=#cccccc style="background-color: transparent;"><tr><td width=';
        if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) {
@@ -2050,7 +2234,7 @@ if (count($items) == 0) {
        echo "Oops!</div><div id=panel_body><table border=0 cellspacing=0 cellpadding=4><tr>";
        echo "<td valign=middle><img src=images/oops.png width=36 height=36 border=0></td><td valign=middle>";
 
-       if ((count($grand) == 0) and (count($_GET) == 0)) {
+       if (($count_grand == 0) and (count($_GET) == 0)) {
                echo "No entries found. Perhaps this is a fresh install.";
        }
        else {
@@ -2077,100 +2261,74 @@ if (!isset($_REQUEST['start']) or empty($_REQUEST['start'])) {
        $start = 0;
 }
 
-$end=$start+$increase;
+$end = $start + $increase;
     
-$disp=array_slice($items,$start,$increase);
+$disp = array_slice($items,$start,$increase);
 
 foreach ($disp as $d) {
 
-       if (file_exists("data/items/$d/category.txt")) {
-               $category_check = 'data/categories/' . file_get_contents("data/items/$d/category.txt");
-               if (!file_exists($category_check)) {
-                       unlink("data/items/$d/category.txt");
-               }
-       }
+       echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#cccccc\" style=\"background-color: transparent;\"><tr><td width=\"";
 
-       if (file_exists("data/items/$d/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-               continue;
-       }
-
-       if (file_exists("data/items/$d/member.txt") and (!isset($_SESSION['logged_in']))) {
-               continue;
-       }
-
-       echo '<table border=0 cellspacing=0 cellpadding=0 bgcolor=#cccccc style="background-color: transparent;"><tr><td width=';
        if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) {
                echo "610";
        }
        else {
                echo "525";
        }
-       echo '>';
+       echo "\">";
 
        if (file_exists("data/round.txt")) {
-               echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+               echo "<b class=\"rbtop\"><b class=\"rb1t\"></b><b class=\"rb2t\"></b><b class=\"rb3t\"></b><b class=\"rb4t\"></b></b><div class=\"xtitle\">";
        }
        else {
-               echo '<div id="panel_title">';
+               echo "<div id=\"panel_title\">";
        }
 
        readfile("data/items/$d/title.txt");
 
-       // start of wiki mod (20071130)
-
        if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and file_exists("data/members/active/{$_SESSION['logged_in']}") and file_exists("data/wiki.txt") and (file_exists("data/items/$d/edit.txt") or (file_get_contents("data/items/$d/author.txt") == $_SESSION['logged_in'])) and file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") and !file_exists("data/items/$d/passwd.txt")) {
 
                if (file_exists("data/items/$d/wiki/delta") and (count(glob("data/items/$d/wiki/delta/*")) > 0)) {
-                       echo "<a href=wiki.php?entry=$d>";
-                       echo "<img src=images/widget.back.png border=0 width=11 height=11 align=right alt=revisions>";
+                       echo "<a href=\"wiki.php?entry=$d\">";
+                       echo "<img src=\"images/widget.back.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"revisions\">";
                        echo "</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>';
+               echo "<a href=\"edit.php?entry=$d\"><img src=\"images/widget.edit.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"edit entry\"></a>";
        }
 
-       // end of wiki mod (20071130)
-
        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=\"del.php?entry=$d\"><img src=\"images/widget.del.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"delete entry\"></a>";
 
-               if (!file_exists("data/items/$d/private.txt") and !file_exists("data/items/$d/category.txt") and file_exists("data/bb.txt") and (count(glob("data/items/$d/comments/live/*")) === 0) and (count(glob("data/items/$d/comments/pending/*")) === 0)) {
-                       echo '<a href=move.php?entry=';
-                       echo $d;
-                       echo '><img src=images/widget.move.png border=0 width=11 height=11 align=right alt="move to comment"></a>';
+               if (!file_exists("data/items/$d/private.txt") and !file_exists("data/items/$d/categories") and file_exists("data/bb.txt") and (count(glob("data/items/$d/comments/live/*")) === 0) and (count(glob("data/items/$d/comments/pending/*")) === 0)) {
+                       echo "<a href=\"move.php?entry=$d\"><img src=\"images/widget.move.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"move to comment\"></a>";
                }
 
-
                if (file_exists("data/items/$d/wiki/delta") and (count(glob("data/items/$d/wiki/delta/*")) > 0)) {
-                       echo "<a href=wiki.php?entry=$d>";
-                       echo "<img src=images/widget.back.png border=0 width=11 height=11 align=right alt=revisions>";
-                       echo "</a>";
+                       echo "<a href=\"wiki.php?entry=$d\"><img src=\"images/widget.back.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"revisions\"></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>';
+               echo "<a href=\"edit.php?entry=$d\"><img src=\"images/widget.edit.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"edit entry\"></a>";
+
                if (file_exists("data/items/$d/passwd.txt")) {
-                       echo '<img src=images/widget.protected.png border=0 width=11 height=11 align=right alt="protected entry">';
+                       echo "<img src=\"images/widget.protected.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"protected entry\">";
                }
 
                if (file_exists("data/items/$d/private.txt")) {
-                       echo '<img src=images/widget.private.png border=0 width=11 height=11 align=right alt="private entry">';
+                       echo "<img src=\"images/widget.private.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"private entry\">";
                }
+
                if (file_exists("data/items/$d/member.txt")) {
-                       echo '<img src=images/widget.member.png border=0 width=11 height=11 align=right alt="member-only entry">';
+                       echo "<img src=\"images/widget.member.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"members-only entry\">";
                }
+
                if (file_exists("data/items/$d/cat.txt")) {
-                       echo '<img src=images/widget.cat.png border=0 width=11 height=11 align=right alt="always display">';
+                       echo "<img src=\"images/widget.cat.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"always displayed\">";
                }
-               if (file_exists("data/items/$d/category.txt")) {
 
-                       $read_cat_dir = file_get_contents("data/items/$d/category.txt");
+               if (file_exists("data/items/$d/categories/$req_category")) {
+
+                       $read_cat_dir = file_get_contents("data/items/$d/categories/$req_category");
 
                        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">';
@@ -2185,20 +2343,26 @@ foreach ($disp as $d) {
                        }
 
                        echo '<img src=images/widget.filed.png border=0 width=11 height=11 align=right alt="filed under ';
-                       readfile("data/items/$d/category.txt");
+                       readfile("data/items/$d/categories/$req_category");
                        echo '">';
                }
 
        }
 
-       echo '</div><div id=panel_entry_body><table border=0 cellspacing=0 cellpadding=0><tr>';
+       echo "</div><div id=\"panel_entry_body\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>";
 
        if (file_exists("data/bb.txt") and file_exists("data/avatar.txt") and file_exists("data/items/$d/author.txt")) {
-               echo "<td width=85 valign=top><p>";
+
+               echo "<td width=\"85\" valign=\"top\">";
+
                $author = file_get_contents("data/items/$d/author.txt");
-               echo "<a href=member.php?id=$author>";
+
+               echo "<a href=\"member.php?id=$author\">";
+
                if ((file_get_contents("data/username.txt") == $author) and (file_exists("images/avatar.jpg") or file_exists("images/avatar.gif") or file_exists("images/avatar.png"))) {
+
                        if (file_exists("images/avatar.gif")) {
+
                                $avatar_gif_image_size = getimagesize("images/avatar.gif");
                                $avatar_gif_image_width = $avatar_gif_image_size[0];
                                $avatar_gif_image_height = $avatar_gif_image_size[1];
@@ -2210,13 +2374,11 @@ foreach ($disp as $d) {
                                        $avatar_gif_image_width = (int) ($avatar_gif_image_width * $sizefactor);
                                        $avatar_gif_image_height = (int) ($avatar_gif_image_height * $sizefactor);
                                }
-
-                               echo "<img src=images/avatar.gif border=0 width=";
-                               echo $avatar_gif_image_width;
-                               echo " height=";
-                               echo $avatar_gif_image_height;
+                               echo "<img src=\"images/avatar.gif\" border=\"0\" width=\"$avatar_gif_image_width\" height=\"$avatar_gif_image_height\">";
                        }
+
                        if (file_exists("images/avatar.jpg")) {
+
                                $avatar_jpg_image_size = getimagesize("images/avatar.jpg");
                                $avatar_jpg_image_width = $avatar_jpg_image_size[0];
                                $avatar_jpg_image_height = $avatar_jpg_image_size[1];
@@ -2228,13 +2390,11 @@ foreach ($disp as $d) {
                                        $avatar_jpg_image_width = (int) ($avatar_jpg_image_width * $sizefactor);
                                        $avatar_jpg_image_height = (int) ($avatar_jpg_image_height * $sizefactor);
                                }
-
-                               echo "<img src=images/avatar.jpg border=0 width=";
-                               echo $avatar_jpg_image_width;
-                               echo " height=";
-                               echo $avatar_jpg_image_height;
+                               echo "<img src=\"images/avatar.jpg\" border=\"0\" width=\"$avatar_jpg_image_width\" height=\"$avatar_jpg_image_height\">";
                        }
+
                        if (file_exists("images/avatar.png")) {
+
                                $avatar_png_image_size = getimagesize("images/avatar.png");
                                $avatar_png_image_width = $avatar_png_image_size[0];
                                $avatar_png_image_height = $avatar_png_image_size[1];
@@ -2247,15 +2407,14 @@ foreach ($disp as $d) {
                                        $avatar_png_image_height = (int) ($avatar_png_image_height * $sizefactor);
                                }
                       
-                               echo "<img src=images/avatar.png border=0 width=";
-                               echo $avatar_png_image_width;
-                               echo " height=";
-                               echo $avatar_png_image_height;
+                               echo "<img src=\"images/avatar.png\" border=\"0\" width=\"$avatar_png_image_width\" height=\"$avatar_png_image_height\">";
                        }
-               echo "><br>";
+                       echo "<br>";
                }
                elseif (file_exists("images/members/$author/avatar.jpg") or file_exists("images/members/$author/avatar.gif") or file_exists("images/members/$author/avatar.png")) {
+
                        if (file_exists("images/members/$author/avatar.gif")) {
+
                                $avatar_gif_image_size = getimagesize("images/members/$author/avatar.gif");
                                $avatar_gif_image_width = $avatar_gif_image_size[0];
                                $avatar_gif_image_height = $avatar_gif_image_size[1];
@@ -2267,13 +2426,11 @@ foreach ($disp as $d) {
                                        $avatar_gif_image_width = (int) ($avatar_gif_image_width * $sizefactor);
                                        $avatar_gif_image_height = (int) ($avatar_gif_image_height * $sizefactor);
                                }
-
-                               echo "<img src=images/members/$author/avatar.gif border=0 width=";
-                               echo $avatar_gif_image_width;
-                               echo " height=";
-                               echo $avatar_gif_image_height;
+                               echo "<img src=\"images/members/$author/avatar.gif\" border=\"0\" width=\"$avatar_gif_image_width\" height=\"$avatar_gif_image_height\">";
                        }
+
                        if (file_exists("images/members/$author/avatar.jpg")) {
+
                                $avatar_jpg_image_size = getimagesize("images/members/$author/avatar.jpg");
                                $avatar_jpg_image_width = $avatar_jpg_image_size[0];
                                $avatar_jpg_image_height = $avatar_jpg_image_size[1];
@@ -2285,13 +2442,11 @@ foreach ($disp as $d) {
                                        $avatar_jpg_image_width = (int) ($avatar_jpg_image_width * $sizefactor);
                                        $avatar_jpg_image_height = (int) ($avatar_jpg_image_height * $sizefactor);
                                }
-
-                               echo "<img src=images/members/$author/avatar.jpg border=0 width=";
-                               echo $avatar_jpg_image_width;
-                               echo " height=";
-                               echo $avatar_jpg_image_height;
+                               echo "<img src=\"images/members/$author/avatar.jpg\" border=\"0\" width=\"$avatar_jpg_image_width\" height=\"$avatar_jpg_image_height\">";
                        }
+
                        if (file_exists("images/members/$author/avatar.png")) {
+
                                $avatar_png_image_size = getimagesize("images/members/$author/avatar.png");
                                $avatar_png_image_width = $avatar_png_image_size[0];
                                $avatar_png_image_height = $avatar_png_image_size[1];
@@ -2304,14 +2459,13 @@ foreach ($disp as $d) {
                                        $avatar_png_image_height = (int) ($avatar_png_image_height * $sizefactor);
                                }
                       
-                               echo "<img src=images/members/$author/avatar.png border=0 width=";
-                               echo $avatar_png_image_width;
-                               echo " height=";
-                               echo $avatar_png_image_height;
+                               echo "<img src=\"images/members/$author/avatar.png\" border=\"0\" width=\"$avatar_png_image_width\" height=\"$avatar_png_image_height\">";
                        }
-               echo "><br>";
+                       echo "<br>";
                }
+
                echo "<b>$author</b></a><br>";
+
                if ((file_get_contents("data/username.txt") == $author) and file_exists("data/rank.txt")) {
                        echo "administrator<br>";
                }
@@ -2323,50 +2477,69 @@ foreach ($disp as $d) {
                        echo "member<br>";
                }
 
-               if ($dh_posts = opendir("data/items")) {
-                       while (($entry_posts = readdir($dh_posts)) !== false) {
+               if ($dh_author_posts = opendir("data/items")) {
 
-                               if (file_exists("data/items/$entry_posts/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                                       continue;
-                               }
+                       while (($author_post = readdir($dh_author_posts)) !== false) {
 
-                               // hide_member (20070606)
-                               //if (file_exists("data/items/$entry_posts/member.txt") and (!isset($_SESSION['logged_in']))) {
-                               //      continue;
-                               //}
+                               if ($author_post != "." && $author_post != "..") {
 
-                               $post_cat_dir = file_get_contents("data/items/$entry_posts/category.txt");
+                                       if (file_exists("data/items/$author_post/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                                               continue;
+                                       }
 
-                               if (file_exists("data/categories/$post_cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_posts/cat.txt")) {
-                                       continue;
-                               }
+                                       $private_categories = "0";
+      
+                                       if (file_exists("data/items/$author_post/categories")) {
+                              
+                                               if ($dh_entry_categories_posts = opendir("data/items/$author_post/categories")) {
+                              
+                                                       while (($entry_category_posts = readdir($dh_entry_categories_posts)) !== false) {
+                              
+                                                               if ($entry_category_posts != "." && $entry_category_posts != "..") {
+                              
+                                                                       if (file_exists("data/categories/$entry_category_posts/private.txt")) {
+                                                                               $private_categories = $private_categories + 1;
+                                                                       }
+                                                               }
+                                                       }
+                                                       closedir($dh_entry_categories_posts);
+                                               }
+                                       }
+      
+                                       if (($private_categories > 0) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$author_post/cat.txt")) {
+                                               continue;
+                                       }
 
-                               if ($entry_posts != "." && $entry_posts != ".." && fnmatch("*",$entry_posts)) {
                                        if (file_exists("data/members/active/$author") and file_exists("data/bb.txt")) {
-                                               if (file_exists("data/items/$entry_posts/author.txt") and (file_get_contents("data/items/$entry_posts/author.txt") == $author)) {
-                                                       $items_posts[] = $entry_posts;
+
+                                               if (file_exists("data/items/$author_post/author.txt") and (file_get_contents("data/items/$author_post/author.txt") == $author)) {
+                                                       $items_posts[] = $author_post;
                                                }
                                        }
                                        elseif (!file_exists("data/members/active/$author") and (file_get_contents("data/username.txt") == $author) and file_exists("data/bb.txt")) {
-                                               if (file_exists("data/items/$entry_posts/author.txt") and (file_get_contents("data/items/$entry_posts/author.txt") == $author)) {
-                                                       $items_posts[] = $entry_posts;
+
+                                               if (file_exists("data/items/$author_post/author.txt") and (file_get_contents("data/items/$author_post/author.txt") == $author)) {
+                                                       $items_posts[] = $author_post;
                                                }
                                        }
                                }
                        }
-               closedir($dh_posts);
+                       closedir($dh_author_posts);
                }
+
                $posts = count($items_posts);
+
                if ($posts == 1) {
                        echo "$posts post";
                }
+
                if ($posts > 1) {
                        echo "$posts posts";
                }
-               unset($items_posts);
 
-               echo "</p></td><td width=513 valign=top>";
+               unset($items_posts);
 
+               echo "</td><td width=513 valign=top>";
        }
        else {
                echo "<td width=598 valign=top>";
@@ -2382,54 +2555,47 @@ foreach ($disp as $d) {
                $crypt_passwd = crypt($crypt_passwd,$crypt_passwd);
        }
 
-       echo '<font style="font-size: 10px; color: #999999;">';
+       echo "<font style=\"font-size: 10px; color: #999999;\">";
+
        if ((file_exists("data/items/$d/author.txt") and (file_exists("data/bb.txt") and !file_exists("data/avatar.txt")) or (file_exists("data/items/$d/author.txt") and (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and !file_exists("data/avatar.txt"))))) {
                $xavatar_author = file_get_contents("data/items/$d/author.txt");
-               echo "<a href=member.php?id=$xavatar_author>$xavatar_author</a> - ";
+               echo "$xavatar_author - ";
        }
+
        readfile("data/items/$d/date.txt");
+
        if ((isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) or file_exists("data/items/$d/lastmod.txt")) {
+
                if (file_exists("data/items/$d/revisions.txt")) {
-                       echo ' (Revision ';
+                       echo " (Revision ";
                        readfile("data/items/$d/revisions.txt");
                        echo " - ";
-                       echo date("l,M j,Y,g:i A",filemtime("data/items/$d/body.txt"));
-                       echo ')';
+                       echo date("l, M j, Y, g:i A",filemtime("data/items/$d/body.txt"));
+                       echo ")";
                }
        }
-       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
-               if (file_exists("data/items/$d/category.txt")) {
-                       echo ' Filed under ';
-                       $category_key = file_get_contents("data/items/$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>';
+       echo "</font><font style=\"font-size: 5px;\"><br><br></font>";
 
        if (file_exists("data/items/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
-               echo "This entry is password protected. If you know the magic word,click <a href=passwd.php?entry=$d>here</a> to enter it.";
+               echo "This entry is password protected. If you know the magic word,click <a href=\"passwd.php?entry=$d\">here</a> to enter it.";
        }
        else {
-               $entry_body = file_get_contents("data/items/$d/body.txt");
+               $change_me_body = file_get_contents("data/items/$d/body.txt");
+
                if (file_exists("data/pf.txt") and file_exists("data/pf-badwords.txt") and (!isset($_SESSION['logged_in']) or empty($_SESSION['logged_in']) or (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != file_get_contents("data/username.txt"))))) {
+
                        $badwords = file_get_contents("data/pf-badwords.txt");
+
                        if (file_exists("data/pf-censor.txt")) {
                                $censor = file_get_contents("data/pf-censor.txt");
                        }
                        else {
                                $censor = "[expletive]";
                        }
-                       $entry_body = preg_replace("/\b($badwords)\b/i",$censor,$entry_body);
+                       $change_me_body = preg_replace("/\b($badwords)\b/i",$censor,$change_me_body);
                }
-               echo $entry_body;
+               echo $change_me_body;
        }
 
        if ((file_get_contents("data/username.txt") == $author) and file_exists("data/sig.txt") and file_exists("data/bb.txt") and file_exists("data/bb-sig.txt")) {
@@ -2441,285 +2607,312 @@ foreach ($disp as $d) {
                echo "<br><br>--<br>$sig";
        }
 
-       echo '</td></tr></table>';
+       echo "</td></tr></table>";
 
        if (file_exists("data/round.txt")) {
-               echo "<div class=rbspace></div>";
-       }
-
-       echo '</div><div id=panel_footer>';
-       echo '<font style="font-size: 10px; color: ';
-       if (file_exists("data/colors/pf-font.txt")) {
-               readfile("data/colors/pf-font.txt");
-       }
-       else {
-               echo "#999999";
+               echo "<div class=\"rbspace\"></div>";
        }
-       echo ';">';
 
-if (!file_exists("data/nocomment.txt") or (file_exists("data/memcomment.txt") and isset($_SESSION['logged_in']))) {
+       echo "</div>";
 
-       if (!file_exists("data/items/$d/comments/live")) {
-               echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&show=comments>add comment</a>';
-       }
-       else {
-               if ($dh_comments = opendir("data/items/$d/comments/live")) {
-                       while (($entry_comments = readdir($dh_comments)) !== false) {
-                               if ($entry_comments != "." && $entry_comments != ".." && fnmatch("*",$entry_comments)) {
-                                       $items_comments[] = $entry_comments;
+       if (file_exists("data/items/$d/categories") and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
+              
+               if ($dh_entry_categories = opendir("data/items/$d/categories")) {
+              
+                       while (($change_me_category = readdir($dh_entry_categories)) !== false) {
+              
+                               if ($change_me_category != "." && $change_me_category != "..") {
+                                       $change_me_categories[] = $change_me_category;
                                }
                        }
-               closedir($dh_comments);
+                       closedir($dh_entry_categories);
                }
-               $comments = count($items_comments);
-               echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&show=comments>';
-               if ($comments == 1) {
-                       echo $comments . ' comment';
+
+               sort($change_me_categories);
+               reset($change_me_categories);
+
+               if (count($change_me_categories) > 0) {
+
+                       if (count($change_me_categories) > 1) {
+                               $category_list = "categories";
+                       }
+                       else {
+                               $category_list = "category";
+                       }
+
+                       foreach ($change_me_categories as $filed_under) {
+                               $category_list = $category_list . " | <a href=\"index.php?category=$filed_under\">$filed_under</a>";
+                       }
+
+                       echo "<div id=\"panel_category\">$category_list</div>";
                }
-               elseif ($comments < 1) {
-                       echo 'add comment';
+               unset($change_me_categories);
+       }
+
+       echo "<div id=\"panel_footer\">";
+
+       if (!file_exists("data/nocomment.txt") or (file_exists("data/memcomment.txt") and isset($_SESSION['logged_in']))) {
+
+               if (!file_exists("data/items/$d/comments/live")) {
+                       echo "<a href=\"index.php?entry=$d&show=comments\">add comment</a>";
                }
                else {
-                       echo $comments . ' comments';
+                       if ($dh_comments = opendir("data/items/$d/comments/live")) {
+      
+                               while (($live_comment = readdir($dh_comments)) !== false) {
+      
+                                       if ($live_comment != "." && $live_comment != "..") {
+                                               $live_comments[] = $live_comment;
+                                       }
+                               }
+                               closedir($dh_comments);
+                       }
+
+                       $count_live_comments = count($live_comments);
+
+                       echo "<a href=\"index.php?entry=$d&show=comments\">";
+
+                       if ($count_live_comments == 1) {
+                               echo "$count_live_comments comment";
+                       }
+                       elseif ($count_live_comments < 1) {
+                               echo "add comment";
+                       }
+                       else {
+                               echo "$count_live_comments comments";
+                       }
+                       echo "</a>";
+
+                       unset($live_comments);
                }
-               echo '</a>';
-               unset($items_comments);
        }
-
-}
-else {
-       echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '>permalink</a>';
-}
+       else {
+               echo "<a href=\"index.php?entry=$d\">permalink</a>";
+       }
 
        if (file_exists("data/items/$d/views.txt")) {
-               $fp_views_txt = fopen("data/items/$d/views.txt","r");
-               $views_value = fread($fp_views_txt,filesize("data/items/$d/views.txt"));
-               fclose($fp_views_txt);
+
+               $views_value = file_get_contents("data/items/$d/views.txt");
+
                if ($views_value == 1) {
-                       echo ' ( ' . $views_value . ' view ) ';
+                       echo " ( $views_value view ) ";
                }
                elseif ($views_value > 1) {
-                       echo ' ( ' . $views_value . ' views ) ';
+                       echo " ( $views_value views ) ";
                }
                else {
-                       echo ' ';
+                       echo " ";
                }
        }
 
        if (!file_exists("images/$d/album")) {
-               echo ' ';
+               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;
+
+                       while (($change_me_album = readdir($dh_album)) !== false) {
+
+                               if ($change_me_album != "." && $change_me_album != "..") {
+                                       $items_album[] = $change_me_album;
                                }
                        }
-               closedir($dh_album);
+                       closedir($dh_album);
                }
+
                $album = count($items_album);
-               echo ' | <a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&show=album>';
+
+               echo " | <a href=\"index.php?entry=$d&show=album\">";
+
                if ($album == 1) {
-                       echo $album . ' image';
+                       echo "$album image";
                }
                elseif ($album < 1) {
-                       echo 'album';
+                       echo "album";
                }
                else {
-                       echo $album . ' images';
+                       echo "$album images";
                }
-               echo '</a>';
+
+               echo "</a>";
+
                unset($items_album);
        }
 
-       if (file_exists("images/$d/album") and isset($entry) and !empty($entry) and isset($show) and !empty($show) and ($show == album)) {
+       if (file_exists("images/$d/album") and isset($req_entry) and !empty($req_entry) and isset($req_show) and !empty($req_show) and ($req_show == album)) {
+
                if (!file_exists("data/items/$d/album")) {
                        mkdir("data/items/$d/album");
                }
+
                if ((!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                       $fp_album_views_txt = fopen("data/items/$d/album/views.txt","r");
-                       $album_views_value = fread($fp_album_views_txt,filesize("data/items/$d/album/views.txt"));
-                       fclose($fp_album_views_txt);
+
+                       $album_views_value = file_get_contents("data/items/$d/album/views.txt");
+
                        $album_views_value = $album_views_value + 1;
+
                        $fp_album_views_txt = fopen("data/items/$d/album/views.txt","w");
                        fwrite($fp_album_views_txt,$album_views_value);
                        fclose($fp_album_views_txt);
                }
        }
 
-       $fp_album_views_txt = fopen("data/items/$d/album/views.txt","r");
-       $album_views_value = fread($fp_album_views_txt,filesize("data/items/$d/album/views.txt"));
-       fclose($fp_album_views_txt);
+
+       $album_views_value = file_get_contents("data/items/$d/album/views.txt");
+
        if ($album_views_value == 1) {
-               echo ' ( ' . $album_views_value . ' view ) ';
+               echo " ( $album_views_value view ) ";
        }
        elseif ($album_views_value > 1) {
-               echo ' ( ' . $album_views_value . ' views ) ';
+               echo " ( $album_views_value views ) ";
        }
        else {
-               echo ' ';
+               echo " ";
        }
 
        if (!file_exists("data/items/$d/filedrop/files")) {
-               echo ' ';
+               echo " ";
        }
        else {
                if ($dh_filedrop = opendir("data/items/$d/filedrop/files")) {
+
                        while (($dl_file = readdir($dh_filedrop)) !== false) {
-                               if ($dl_file != "." && $dl_file != ".." && fnmatch("*",$dl_file)) {
+
+                               if ($dl_file != "." && $dl_file != "..") {
                                        $items_filedrop[] = $dl_file;
                                }
                        }
-               closedir($dh_filedrop);
+                       closedir($dh_filedrop);
                }
+
                $filedrop = count($items_filedrop);
-               echo ' | <a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&show=filedrop>';
+
+               echo " | <a href=\"index.php?entry=$d&show=filedrop\">";
+
                if ($filedrop == 1) {
-                       echo $filedrop . ' file';
+                       echo "$filedrop file";
                }
                elseif ($filedrop < 1) {
-                       echo 'filedrop';
+                       echo "filedrop";
                }
                else {
-                       echo $filedrop . ' files';
+                       echo "$filedrop files";
                }
-               echo '</a> ';
+
+               echo "</a> ";
+
                unset($items_filedrop);
        }
 
-       if (isset($entry) and !empty($entry) and isset($show) and !empty($show) and ($show == filedrop)) {
+       if (isset($req_entry) and !empty($req_entry) and isset($req_show) and !empty($req_show) and ($req_show == filedrop)) {
+
                if (!file_exists("data/items/$d/filedrop")) {
                        mkdir("data/items/$d/filedrop");
                }
+
                if (file_exists("data/items/$d/filedrop/files") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                       $fp_filedrop_views_txt = fopen("data/items/$d/filedrop/views.txt","r");
-                       $filedrop_views_value = fread($fp_filedrop_views_txt,filesize("data/items/$d/filedrop/views.txt"));
-                       fclose($fp_filedrop_views_txt);
+
+                       $filedrop_views_value = file_get_contents("data/items/$d/filedrop/views.txt");
+
                        $filedrop_views_value = $filedrop_views_value + 1;
+
                        $fp_filedrop_views_txt = fopen("data/items/$d/filedrop/views.txt","w");
                        fwrite($fp_filedrop_views_txt,$filedrop_views_value);
                        fclose($fp_filedrop_views_txt);
                }
        }
 
-       $fp_filedrop_views_txt = fopen("data/items/$d/filedrop/views.txt","r");
-       $filedrop_views_value = fread($fp_filedrop_views_txt,filesize("data/items/$d/filedrop/views.txt"));
-       fclose($fp_filedrop_views_txt);
+
+       $filedrop_views_value = file_get_contents("data/items/$d/filedrop/views.txt");
+
        if ($filedrop_views_value == 1) {
-               echo ' ( ' . $filedrop_views_value . ' view ) ';
+               echo " ( $filedrop_views_value view ) ";
        }
        elseif ($filedrop_views_value > 1) {
-               echo ' ( ' . $filedrop_views_value . ' views ) ';
+               echo " ( $filedrop_views_value views ) ";
        }
        else {
-               echo ' ';
+               echo " ";
        }
 
        if (!file_exists("data/nopdf.txt") and file_exists("data/items/$d/pdf/file")) {
 
-               echo "| <a href={$_SERVER['PHP_SELF']}?entry=$d&show=pdf>pdf</a> ";
+               echo "| <a href=\"index.php?entry=$d&show=pdf\">pdf</a> ";
 
                if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
+
                        $pdf_views_value = file_get_contents("data/items/$d/pdf/count/views.txt");
+
                        $pdf_views_value = $pdf_views_value + 1;
+
                        $fp_pdf_views_txt = fopen("data/items/$d/pdf/count/views.txt","w");
                        fwrite($fp_pdf_views_txt,$pdf_views_value);
                        fclose($fp_pdf_views_txt);
                }
 
                $pdf_views_value = file_get_contents("data/items/$d/pdf/count/views.txt");
+
                if ($pdf_views_value == 1) {
-                       echo ' ( ' . $pdf_views_value . ' view ) ';
+                       echo " ( $pdf_views_value view ) ";
                }
                elseif ($pdf_views_value > 1) {
-                       echo ' ( ' . $pdf_views_value . ' views ) ';
+                       echo " ( $pdf_views_value views ) ";
                }
                else {
-                       echo ' ';
+                       echo " ";
                }
        }
 
        if (!file_exists("data/nocomment.txt") or (file_exists("data/memcomment.txt") and isset($_SESSION['logged_in']))) {
-               echo '| <a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '>permalink</a></font>';
+               echo "| <a href=\"index.php?entry=$d\">permalink</a>";
        }
 
-       echo '</div>';
+       echo "</div>";
 
        if (file_exists("data/round.txt")) {
-               echo '<b class="rbbottom"><b class="rb4e"></b><b class="rb3e"></b><b class="rb2e"></b><b class="rb1e"></b></b>';
+               echo "<b class=\"rbbottom\"><b class=\"rb4e\"></b><b class=\"rb3e\"></b><b class=\"rb2e\"></b><b class=\"rb1e\"></b></b>";
        }
 
-       echo '</td></tr></table>';
-
-// entry panel
-
-unset($show_per_entry_panel_list);
-
-if (file_exists("data/panels")) {
-       if ($dh_per_entry_panel_list = opendir("data/panels")) {
-               while (($entry_per_entry_panel_list = readdir($dh_per_entry_panel_list)) !== false) {
-
-                       if (file_exists("data/panels/$entry_per_entry_panel_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
+       echo "</td></tr></table>";
 
-                       if (!file_exists("data/panels/$entry_per_entry_panel_list/entry.txt")) {
-                               continue;
-                       }
+       if ($count_entry_panels > 0) {
 
-                       if ($entry_per_entry_panel_list != "." && $entry_per_entry_panel_list != ".." && fnmatch("*",$entry_per_entry_panel_list)) {
-                               $show_per_entry_panel_list[] = $entry_per_entry_panel_list;
-                       }
-               }
-               closedir($dh_per_entry_panel_list);
-       }
+               foreach ($entry_panels as $entry_panel) {
 
-       sort($show_per_entry_panel_list);
-       reset($show_per_entry_panel_list);
-       $count_per_entry_panel_list = count($show_per_entry_panel_list);
+                       if (!file_exists("data/panels/$entry_panel/free.txt")) {
       
-       if ($count_per_entry_panel_list > 0) {
-               foreach ($show_per_entry_panel_list as $per_entry_panel_list_entry) {
-                       if (!file_exists("data/panels/$per_entry_panel_list_entry/free.txt")) {
-
                                if (file_exists("data/round.txt")) {
-                                       echo '<b class="rbper_entry"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+                                       echo "<b class=\"rbper_entry\"><b class=\"rb1t\"></b><b class=\"rb2t\"></b><b class=\"rb3t\"></b><b class=\"rb4t\"></b></b><div class=\"xtitle\">";
                                }
                                else {
-                                       echo '<div id="panel_title">';
+                                       echo "<div id=\"panel_title\">";
                                }
-
-                               readfile("data/panels/$per_entry_panel_list_entry/title.txt");
-
+      
+                               readfile("data/panels/$entry_panel/title.txt");
+      
                                if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
-                                       echo "<a href=panels.php#{$per_entry_panel_list_entry}>";
-                                       echo '<img src=images/widget.edit.png border=0 width=11 height=11 align=right></a>';
+                                       echo "<a href=\"panels.php#$entry_panel\">";
+                                       echo "<img src=\"images/widget.edit.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\"></a>";
                                }
-
-                               echo '</div><div id=panel_body>';
+      
+                               echo "</div><div id=panel_body>";
                        }
-
-                       if (file_exists("data/panels/$per_entry_panel_list_entry/free.txt")) {
-                               echo '<div id=panel_free>';
+      
+                       if (file_exists("data/panels/$entry_panel/free.txt")) {
+                               echo "<div id=\"panel_free\">";
                        }
+      
+                       include("data/panels/$entry_panel/panel.php");
 
-                       include("data/panels/$per_entry_panel_list_entry/panel.php");
-                       echo '</div>';
-
-                       if (file_exists("data/round.txt") and !file_exists("data/panels/$per_entry_panel_list_entry/free.txt")) {
-                               echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+                       echo "</div>";
+      
+                       if (file_exists("data/round.txt") and !file_exists("data/panels/$entry_panel/free.txt")) {
+                               echo "<b class=\"rbbottom\"><b class=\"rb4b\"></b><b class=\"rb3b\"></b><b class=\"rb2b\"></b><b class=\"rb1b\"></b></b>";
                        }
                }
        }
-}
-
 
-// entry panel
-
-
-
-       if (isset($entry) and !empty($entry) and isset($show) and !empty($show) and ($show == album) and file_exists("images/$d/album")) {
+       if (isset($req_entry) and !empty($req_entry) and isset($req_show) and !empty($req_show) and ($req_show == album) and file_exists("images/$d/album")) {
                echo '<table border=0 cellspacing=0 cellpadding=0 width=';
 
                if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) {
@@ -2750,13 +2943,10 @@ if (file_exists("data/panels")) {
                        echo "This entry is password protected. If you know the magic word,click <a href=passwd.php?entry=$d&show=album>here</a> to enter it.";
                }
                else {
-      
-                       /* thumbnail auto-clean-up (20060409) - This should delete thumbnails of non-existent album images. */
-      
                        if (file_exists("images/$d/thumbnails")) {
                                if ($dh_album = opendir("images/$d/thumbnails")) {
                                        while (($thumbnail_album = readdir($dh_album)) !== false) {
-                                               if ($thumbnail_album != "." && $thumbnail_album != ".." && fnmatch("*",$thumbnail_album)) {
+                                               if ($thumbnail_album != "." && $thumbnail_album != "..") {
                                                        $current_thumbnail = "images/$d/thumbnails/$thumbnail_album";
                                                        $parent_image = str_replace("-thumbnail.jpg","",$thumbnail_album);
                                                        $parent_image = "images/$d/album/$parent_image";
@@ -2768,12 +2958,10 @@ if (file_exists("data/panels")) {
                                }
                        }
 
-                       /* caption auto-clean-up (20070216) This should delete captions of non-existent album images. */
-
                        if (file_exists("data/items/$d/album/captions")) {
                                if ($dh_album = opendir("data/items/$d/album/captions")) {
                                        while (($caption_album = readdir($dh_album)) !== false) {
-                                               if ($caption_album != "." && $caption_album != ".." && fnmatch("*",$caption_album)) {
+                                               if ($caption_album != "." && $caption_album != "..") {
                                                        $current_caption = "data/items/$d/album/captions/$caption_album";
                                                        $parent_image = str_replace(".txt","",$caption_album);
                                                        $parent_image = "images/$d/album/$parent_image";
@@ -2785,13 +2973,11 @@ if (file_exists("data/panels")) {
                                }
                        }
       
-                       /* auto-sort entries (20060409) - MAJ previously relied on readdir() alone,causing entries to be displayed in the order in which they are stored by the filesystem. */
-      
                        if (file_exists("images/$d/album")) {
                                if ($dh_album = opendir("images/$d/album")) {
-                                       while (($entry_album = readdir($dh_album)) !== false) {
-                                               if ($entry_album != "." && $entry_album != ".." && fnmatch("*",$entry_album)) {
-                                                       $sort_album[] = $entry_album;
+                                       while (($change_me_album = readdir($dh_album)) !== false) {
+                                               if ($change_me_album != "." && $change_me_album != "..") {
+                                                       $sort_album[] = $change_me_album;
                                                }
                                        }
                                closedir($dh_album);
@@ -2830,8 +3016,6 @@ if (file_exists("data/panels")) {
                                                        $new_width = $current_width;
                                                        $new_height = $current_height;
                                                }
-
-                                               /* auto-thumbnails (20060213) - In maj-0.14-20060131,album thumbnails were simply the original images displayed with smaller "width=" and "height=" values. Album index loading was painfully slow since the browser had to download the original images from the server. This should speed things up. We placed the "function" here instead of edit.php or add.php to make auto-thumbnail generation available for maj-0.14-20060131 users who may already have existing albums. */
       
                                                if (!file_exists("images/$d/thumbnails/{$album_entry}-thumbnail.jpg")) {
       
@@ -2863,8 +3047,6 @@ if (file_exists("data/panels")) {
 
                                                echo "<a href=\"album.php?entry=$d&show=$album_entry\">";
 
-                                               /* auto-thumbnails (20060519) - Just in case php-gd does not exist,do it the old way. */
-
                                                if (!file_exists("images/$d/thumbnails/{$album_entry}-thumbnail.jpg")) {
                                                        echo "<img src=\"images/$d/album/$album_entry\" width=$new_width height=$new_height border=0 hspace=2 vspace=2";
                                                }
@@ -2894,7 +3076,7 @@ if (file_exists("data/panels")) {
 
        }
 
-       if (isset($entry) and !empty($entry) and isset($show) and !empty($show) and ($show == filedrop) and file_exists("data/items/$d/filedrop/files")) {
+       if (isset($req_entry) and !empty($req_entry) and isset($req_show) and !empty($req_show) and ($req_show == filedrop) and file_exists("data/items/$d/filedrop/files")) {
                echo '<table border=0 cellspacing=0 cellpadding=0 width=';
 
                if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) {
@@ -2927,7 +3109,7 @@ if (file_exists("data/panels")) {
 
                        if ($dh_filedrop = opendir("data/items/$d/filedrop/files")) {
                                while (($dl_file = readdir($dh_filedrop)) !== false) {
-                                       if ($dl_file != "." && $dl_file != ".." && fnmatch("*",$dl_file)) {
+                                       if ($dl_file != "." && $dl_file != "..") {
                                                $filedrop_files[] = $dl_file;
                                        }
                                }
@@ -2940,23 +3122,23 @@ if (file_exists("data/panels")) {
                        foreach ($filedrop_files as $filedrop_file) {
 
                                echo "<table border=0 cellspacing=0 cellpadding=4><tr><td>";
-                               echo "<a href=\"{$_SERVER['PHP_SELF']}?entry=$d&download=$filedrop_file&type=filedrop\">";
+                               echo "<a href=\"index.php?entry=$d&download=$filedrop_file&type=filedrop\">";
                                echo "<img src=images/filedrop.png width=36 height=36 border=0 alt=\"download file\"></a></td>";
-                               echo "<td><p><b>$filedrop_file</b>";
+                               echo "<td><b>$filedrop_file</b>";
 
                                if (file_exists("data/items/$d/filedrop/sha1.txt")) {
                                        $sha1 = sha1_file("data/items/$d/filedrop/files/$filedrop_file");
-                                       echo "<br />$sha1 (<a href=http://www.faqs.org/rfcs/rfc3174 target=_maj>sha1</a>)";
+                                       echo "<br>$sha1 (<a href=\"http://www.faqs.org/rfcs/rfc3174\" target=\"_maj\">sha1</a>)";
                                }
                                if (file_exists("data/items/$d/filedrop/md5.txt")) {
                                        $md5 = md5_file("data/items/$d/filedrop/files/$filedrop_file");
-                                       echo "<br />$md5 (<a href=http://www.faqs.org/rfcs/rfc1321 target=_maj>md5</a>)";
+                                       echo "<br>$md5 (<a href=\"http://www.faqs.org/rfcs/rfc1321\" target=\"_maj\">md5</a>)";
                                }
 
                                $size = filesize("data/items/$d/filedrop/files/$filedrop_file");
                                $size_string = ($size > 512)?(  ($size/1024 > 512)  ?sprintf("%.02f MB",($size/1024)/1024)  :sprintf("%.02f KB",$size/1024))  :sprintf("%d B",$size);
 
-                               echo "<br />$size_string";
+                               echo "<br>$size_string";
 
                                $filedrop_count_file = "data/items/$d/filedrop/count/$filedrop_file" . '.txt';
 
@@ -2973,7 +3155,7 @@ if (file_exists("data/panels")) {
                                                echo " downloads";
                                        }
                                }
-                               echo "</p></td></tr></table>";
+                               echo "</td></tr></table>";
                        }
                }
                echo "</div>";
@@ -2985,7 +3167,7 @@ if (file_exists("data/panels")) {
                echo '</td></tr></table>';
        }
 
-       if (isset($entry) and !empty($entry) and isset($show) and !empty($show) and ($show == pdf) and file_exists("data/items/$d/pdf/file")) {
+       if (isset($req_entry) and !empty($req_entry) and isset($req_show) and !empty($req_show) and ($req_show == pdf) and file_exists("data/items/$d/pdf/file")) {
                echo '<table border=0 cellspacing=0 cellpadding=0 width=';
 
                if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) {
@@ -3019,11 +3201,11 @@ if (file_exists("data/panels")) {
 
                        if ($dh_pdf = opendir("data/items/$d/pdf/file")) {
                                while (($dl_file = readdir($dh_pdf)) !== false) {
-                                       if ($dl_file != "." && $dl_file != ".." && fnmatch("*",$dl_file)) {
+                                       if ($dl_file != "." && $dl_file != "..") {
                                                echo '<table border=0 cellspacing=0 cellpadding=4><tr><td>';
-                                               echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&download=' . $dl_file. '&type=pdf>';
+                                               echo "<a href=\"index.php?entry=$d&download=$dl_file&type=pdf\">";
                                                echo '<img src=images/pdf.png width=36 height=36 border=0 alt="download file"></a></td>';
-                                               echo '<td><p><b>';
+                                               echo '<td><b>';
                                                echo $dl_file;
                                                echo'</b><br>';
                                                $size = filesize("data/items/$d/pdf/file/$dl_file");
@@ -3043,7 +3225,7 @@ if (file_exists("data/panels")) {
                                                                echo ' downloads';
                                                        }
                                                }
-                                               echo '</p></td></tr></table>';
+                                               echo '</td></tr></table>';
                                        }
                                }
                        closedir($dh_pdf);
@@ -3058,7 +3240,7 @@ if (file_exists("data/panels")) {
                echo '</td></tr></table>';
        }
 
-       if (isset($entry) and !empty($entry) and isset($show) and !empty($show) and ($show == comments) and (!file_exists("data/nocomment.txt") or (file_exists("data/memcomment.txt") and isset($_SESSION['logged_in'])))) {
+       if (isset($req_entry) and !empty($req_entry) and isset($req_show) and !empty($req_show) and ($req_show == comments) and (!file_exists("data/nocomment.txt") or (file_exists("data/memcomment.txt") and isset($_SESSION['logged_in'])))) {
 
                if (file_exists("data/items/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
                }
@@ -3074,9 +3256,9 @@ if (file_exists("data/panels")) {
 
                        echo '><tr><td>';
                        if ($dh_comments = opendir("data/items/$d/comments/live")) {
-                               while (($entry_comments = readdir($dh_comments)) !== false) {
-                                       if ($entry_comments != "." && $entry_comments != ".." && fnmatch("*",$entry_comments)) {
-                                               $show_comments[] = $entry_comments;
+                               while (($live_comment = readdir($dh_comments)) !== false) {
+                                       if ($live_comment != "." && $live_comment != "..") {
+                                               $show_comments[] = $live_comment;
                                        }
                                }
                        closedir($dh_comments);
@@ -3121,7 +3303,7 @@ if (file_exists("data/panels")) {
                                echo '</div><div id=panel_body><table border=0 cellspacing=0 cellpadding=0><tr>';
                               
                                if (file_exists("data/bb.txt") and file_exists("data/avatar.txt") and file_exists("data/items/$d/comments/live/$comment/author.txt")) {
-                                       echo "<td width=85 valign=top><p>";
+                                       echo "<td width=85 valign=top>";
                                        $c_author = file_get_contents("data/items/$d/comments/live/$comment/author.txt");
                                        echo "<a href=member.php?id=$c_author>";
                                        if ((file_get_contents("data/username.txt") == $c_author) and (file_exists("images/avatar.jpg") or file_exists("images/avatar.gif") or file_exists("images/avatar.png"))) {
@@ -3260,14 +3442,31 @@ if (file_exists("data/panels")) {
                                                        if (file_exists("data/items/$c_entry_posts/member.txt") and (!isset($_SESSION['logged_in']))) {
                                                                continue;
                                                        }
-                      
-                                                       $c_post_cat_dir = file_get_contents("data/items/$c_entry_posts/category.txt");
-                      
-                                                       if (file_exists("data/categories/$c_post_cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$c_entry_posts/cat.txt")) {
+
+                                                       $private_categories = "0";
+                              
+                                                       if (file_exists("data/items/$change_me_c_entry_posts/categories")) {
+                                                      
+                                                               if ($dh_cat2_c_entry_posts = opendir("data/items/$change_me_c_entry_posts/categories")) {
+                                                      
+                                                                       while (($change_me_cat2_c_entry_posts = readdir($dh_cat2_c_entry_posts)) !== false) {
+                                                      
+                                                                               if ($change_me_cat2_c_entry_posts != "." && $change_me_cat2_c_entry_posts != "..") {
+                                                      
+                                                                                       if (file_exists("data/categories/$change_me_cat2_c_entry_posts/private.txt")) {
+                                                                                               $private_categories = $private_categories + 1;
+                                                                                       }
+                                                                               }
+                                                                       }
+                                                                       closedir($dh_cat2_c_entry_posts);
+                                                               }
+                                                       }
+
+                                                       if (($private_categories > 0) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$c_entry_posts/cat.txt")) {
                                                                continue;
                                                        }
                       
-                                                       if ($c_entry_posts != "." && $c_entry_posts != ".." && fnmatch("*",$c_entry_posts)) {
+                                                       if ($c_entry_posts != "." && $c_entry_posts != "..") {
                                                                if (file_exists("data/members/active/$c_author") and file_exists("data/bb.txt")) {
                                                                        if (file_exists("data/items/$c_entry_posts/author.txt") and (file_get_contents("data/items/$c_entry_posts/author.txt") == $c_author)) {
                                                                                $c_items_posts[] = $c_entry_posts;
@@ -3291,13 +3490,13 @@ if (file_exists("data/panels")) {
                                        }
                                        unset($c_items_posts);
                       
-                                       echo "</p></td><td width=513 valign=top>";
+                                       echo "</td><td width=513 valign=top>";
                                }
                                else {
                                        echo "<td width=598 valign=top>";
                                }
 
-                               echo '<p><font style="font-size: 10px; color: #999999;">';
+                               echo '<font style="font-size: 10px; color: #999999;">';
                                if ((file_exists("data/items/$d/comments/live/$comment/author.txt") and (file_exists("data/bb.txt") and !file_exists("data/avatar.txt")) or (file_exists("data/items/$d/comments/live/$comment/author.txt") and (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and !file_exists("data/avatar.txt"))))) {
                                        $cxavatar_author = file_get_contents("data/items/$d/comments/live/$comment/author.txt");
                                        echo "<a href=member.php?id=$cxavatar_author>$cxavatar_author</a> - ";
@@ -3311,7 +3510,7 @@ if (file_exists("data/panels")) {
                                        }
                                }
                                echo '</font><font style="font-size: 5px;"><br><br></font>';
-                               $entry_comment = file_get_contents("data/items/$d/comments/live/$comment/comment.txt");
+                               $change_me_comment = file_get_contents("data/items/$d/comments/live/$comment/comment.txt");
                                if (file_exists("data/pf.txt") and file_exists("data/pf-badwords.txt") and (!isset($_SESSION['logged_in']) or empty($_SESSION['logged_in']) or (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != file_get_contents("data/username.txt"))))) {
                                        $badwords = file_get_contents("data/pf-badwords.txt");
                                        if (file_exists("data/pf-censor.txt")) {
@@ -3320,9 +3519,9 @@ if (file_exists("data/panels")) {
                                        else {
                                                $censor = "[expletive]";
                                        }
-                                       $entry_comment = preg_replace("/\b($badwords)\b/i",$censor,$entry_comment);
+                                       $change_me_comment = preg_replace("/\b($badwords)\b/i",$censor,$change_me_comment);
                                }
-                               echo $entry_comment;
+                               echo $change_me_comment;
                                echo '</p></tr></table></div>';
 
                                if (file_exists("data/round.txt")) {
@@ -3335,7 +3534,7 @@ if (file_exists("data/panels")) {
 
                if (!file_exists("data/nocomment.txt") or (file_exists("data/memcomment.txt") and isset($_SESSION['logged_in']))) {
 
-                       echo '<p><table border=0 cellspacing=0 cellpadding=0 width=';
+                       echo '<table border=0 cellspacing=0 cellpadding=0 width=';
 
                        if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) {
                                echo "610";
@@ -3348,21 +3547,21 @@ if (file_exists("data/panels")) {
 
                        if (!isset($_SESSION['logged_in']) or (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != file_get_contents("data/username.txt") and file_exists("data/members/active/{$_SESSION['logged_in']}")))) {
       
-                               if (isset($show) and !empty($show) and isset($_POST['captcha_put']) and !empty($_REQUEST['captcha_get']) and isset($_POST['firstname']) and !empty($_POST['firstname']) and isset($_POST['lastname']) and !empty($_POST['lastname']) and isset($_POST['email']) and !empty($_POST['email']) and isset($_POST['new_comment']) and !empty($_POST['new_comment']) and isset($_POST['captcha_put']) and !empty($_POST['captcha_put']) and ($_REQUEST['captcha_get'] == $_POST['captcha_put']) and (ereg("@",$_POST['email'])) and (ereg("\.",$_POST['email']))) {
+                               if (isset($req_show) and !empty($req_show) and isset($_POST['captcha_put']) and !empty($_REQUEST['captcha_get']) and isset($_POST['firstname']) and !empty($_POST['firstname']) and isset($_POST['lastname']) and !empty($_POST['lastname']) and isset($_POST['email']) and !empty($_POST['email']) and isset($_POST['new_comment']) and !empty($_POST['new_comment']) and isset($_POST['captcha_put']) and !empty($_POST['captcha_put']) and ($_REQUEST['captcha_get'] == $_POST['captcha_put']) and (ereg("@",$_POST['email'])) and (ereg("\.",$_POST['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. Please check back soon to see if it has been posted.</p></td></tr></table></p>';
+                                       echo '<table border=0 cellspacing=0 cellpadding=0><tr><td><font style="font-size: 12px;"><b>Thanks!</b></font></p>Your comment has been submitted for approval. Please check back soon to see if it has been posted.</td></tr></table></p>';
                                }
                        }
 
-                       echo '<p><font style="font-size: 12px;"><b>Add Comment</b></font></p>';
+                       echo '<font style="font-size: 12px;"><b>Add Comment</b></font></p>';
 
                        if (file_exists("data/items/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
-                               echo "<p>This entry is password protected. If you know the magic word,click <a href=passwd.php?entry=$d&show=comments>here</a> to enter it.</p>";
+                               echo "This entry is password protected. If you know the magic word,click <a href=passwd.php?entry=$d&show=comments>here</a> to enter it.</p>";
                        }
                        else {
                                $captcha_rand = str_rand(7);
               
-                               echo "<p>Fill out the form below";
+                               echo "Fill out the form below";
 
                                if (!isset($_SESSION['logged_in']) or (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != file_get_contents("data/username.txt")))) {
                                        echo " and enter <b>$captcha_rand</b> in the anti-spam field";
@@ -3391,56 +3590,56 @@ if (file_exists("data/panels")) {
                                ?>
                       
                                <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">
+                               <form enctype="multipart/form-data" action="index.php?entry=<?php echo $d; ?>&show=comments" method="post">
                                <input type=hidden name=captcha_get value="<?php echo $captcha_rand; ?>">
                                <tr>
 
                                <?php
                                if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
                                        ?>
-                                       <td width=75><p></p></td><td><input type=hidden name=cauthor value="<?php echo $_SESSION['logged_in']; ?>"><input type=hidden name=firstname value="<?php $logged_in_author = explode(" ",file_get_contents("data/author.txt")); echo trim(str_replace(",","",$logged_in_author[0])); ?>"></p></td>
+                                       <td width=75></td><td><input type=hidden name=cauthor value="<?php echo $_SESSION['logged_in']; ?>"><input type=hidden name=firstname value="<?php $logged_in_author = explode(" ",file_get_contents("data/author.txt")); echo trim(str_replace(",","",$logged_in_author[0])); ?>"></td>
                                        <?php
                                }
                                elseif (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) and file_exists("data/members/active/{$_SESSION['logged_in']}") and file_exists("data/bb.txt")) {
                                        ?>
-                                       <td width=75><p></p></td><td><input type=hidden name=cauthor value="<?php echo $_SESSION['logged_in']; ?>"><input type=hidden name=firstname value="<?php echo file_get_contents("data/members/active/{$_SESSION['logged_in']}/firstname.txt"); ?>"></p></td>
+                                       <td width=75></td><td><input type=hidden name=cauthor value="<?php echo $_SESSION['logged_in']; ?>"><input type=hidden name=firstname value="<?php echo file_get_contents("data/members/active/{$_SESSION['logged_in']}/firstname.txt"); ?>"></td>
                                        <?php
                                }
                                else {
                                        ?>
-                                       <td width=75><p>First Name*</p></td><td width=300><input class=input type=text autocomplete=off name=firstname maxlength=30></td>
+                                       <td width=75>First Name*</td><td width=300><input class=input type=text autocomplete=off name=firstname maxlength=30></td>
                                        <?php
                                }
                                ?>
                                <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>
+                               <tr><td><img src="images/smileys/crying.png" border="0"></td><td>:((</td><td >crying</td></tr>
+                               <tr><td><img src="images/smileys/frown.png" border="0"></td><td>:(</td><td>frown</td></tr>
+                               <tr><td><img src="images/smileys/indifferent.png" border="0"></td><td>:|</td><td>indifferent</td></tr>
+                               <tr><td><img src="images/smileys/laughing.png" border="0"></td><td>:D</td><td>laughing</td></tr>
+                               <tr><td><img src="images/smileys/lick.png" border="0"></td><td>:P</td><td>lick</td></tr>
+                               <tr><td><img src="images/smileys/ohno.png" border="0"></td><td>:O</td><td>oh no!</td></tr>
+                               <tr><td><img src="images/smileys/smile.png" border="0"></td><td>:)</td><td>smile</td></tr>
+                               <tr><td><img src="images/smileys/surprised.png" border="0"></td><td>=)</td><td>surprised</td></tr>
+                               <tr><td><img src="images/smileys/undecided.png" border="0"></td><td>:\</td><td>undecided</td></tr>
+                               <tr><td><img src="images/smileys/wink.png" border="0"></td><td>;)</td><td>wink</td></tr>
                                </td></tr>
                                </table>
 
                                <?php
                                if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
                                        ?>
-                                       <td width=75><p></p></td><td><input type=hidden name=lastname value="<?php echo trim(str_replace(",","",$logged_in_author[1])); ?>"></p></td>
+                                       <td width=75></td><td><input type=hidden name=lastname value="<?php echo trim(str_replace(",","",$logged_in_author[1])); ?>"></td>
                                        <?php
                                }
                                elseif (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) and file_exists("data/members/active/{$_SESSION['logged_in']}") and file_exists("data/bb.txt")) {
                                        ?>
-                                       <td width=75><p></p></td><td><input type=hidden name=lastname value="<?php echo file_get_contents("data/members/active/{$_SESSION['logged_in']}/lastname.txt"); ?>"></p></td>
+                                       <td width=75></td><td><input type=hidden name=lastname value="<?php echo file_get_contents("data/members/active/{$_SESSION['logged_in']}/lastname.txt"); ?>"></td>
                                        <?php
                                }
                                else {
                                        ?>
-                                       <tr><td><p>Last Name*</p></td><td><input class=input type=text autocomplete=off name=lastname maxlength=30></td></tr>
+                                       <tr><td>Last Name*</td><td><input class=input type=text autocomplete=off name=lastname maxlength=30></td></tr>
                                        <?php
                                }
 
@@ -3448,52 +3647,52 @@ if (file_exists("data/panels")) {
 
                                        if (file_exists("data/email.txt")) {
                                                ?>
-                                               <td width=75><p></p></td><td colspan=2><input type=hidden name=email value="<?php echo file_get_contents("data/email.txt"); ?>"></p></td>
+                                               <td width=75></td><td colspan=2><input type=hidden name=email value="<?php echo file_get_contents("data/email.txt"); ?>"></td>
                                                <?php
                                        }
                                        else {
-                                               echo "<tr><td><p>E-mail*</p></td><td colspan=2><input class=input type=text autocomplete=off name=email maxlength=60></td></tr>";
+                                               echo "<tr><td>E-mail*</td><td colspan=2><input class=input type=text autocomplete=off name=email maxlength=60></td></tr>";
                                        }
                                }
                                elseif (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) and file_exists("data/members/active/{$_SESSION['logged_in']}") and file_exists("data/bb.txt")) {
                                        ?>
-                                       <td width=75><p></p></td><td colspan=2><input type=hidden name=email value="<?php echo file_get_contents("data/members/active/{$_SESSION['logged_in']}/email.txt"); ?>"></p></td>
+                                       <td width=75></td><td colspan=2><input type=hidden name=email value="<?php echo file_get_contents("data/members/active/{$_SESSION['logged_in']}/email.txt"); ?>"></td>
                                        <?php
                                }
                                else {
                                        ?>
-                                       <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>E-mail*</td><td colspan=2><input class=input type=text autocomplete=off name=email maxlength=60></td></tr>
                                        <?php
                                }
 
                                if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
                                        ?>
-                                       <td width=75><p></p></td><td colspan=2><input type=hidden name=url value="<?php file_get_contents("data/url.txt"); ?>"></p></td>
+                                       <td width=75></td><td colspan=2><input type=hidden name=url value="<?php file_get_contents("data/url.txt"); ?>"></td>
                                        <?php
                                }
                                elseif (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) and file_exists("data/members/active/{$_SESSION['logged_in']}") and file_exists("data/bb.txt")) {
                                        ?>
-                                       <td width=75><p></p></td><td colspan=2><input type=hidden name=url value="<?php if (file_exists("data/members/active/{$_SESSION['logged_in']}/url.txt")) { echo file_get_contents("data/members/active/{$_SESSION['logged_in']}/url.txt"); } ?>"></p></td>
+                                       <td width=75></td><td colspan=2><input type=hidden name=url value="<?php if (file_exists("data/members/active/{$_SESSION['logged_in']}/url.txt")) { echo file_get_contents("data/members/active/{$_SESSION['logged_in']}/url.txt"); } ?>"></td>
                                        <?php
                                }
                                else {
                                        ?>
-                                       <tr><td><p>Website</p></td><td colspan=2><input class=input type=text autocomplete=off name=url maxlength=300></td></tr>
+                                       <tr><td>Website</td><td colspan=2><input class=input type=text autocomplete=off name=url maxlength=300></td></tr>
                                        <?php
                                }
                                ?>
-                               <tr><td><p>Comment*</p></td><td><textarea class=input name=new_comment rows=15></textarea></td></tr>
+                               <tr><td>Comment*</td><td><textarea class=input name=new_comment rows=15></textarea></td></tr>
                                <?php
 
                                if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
                                        echo "<input type=hidden name=captcha_put value=\"$captcha_rand\">";
                                }
                                else {
-                                       echo "<tr><td><p>Anti-Spam*</p></td><td><input class=input type=text autocomplete=off name=captcha_put maxlength=7></td></tr>";
+                                       echo "<tr><td>Anti-Spam*</td><td><input class=input type=text autocomplete=off name=captcha_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>
+                               <tr><td></td><td><input class=input type=submit value="click here to submit your comment"></td></tr>
                                </form>
                                </table>
                                <?php
@@ -3503,378 +3702,417 @@ if (file_exists("data/panels")) {
                        <?php
                }
        }
-}
-
-if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and isset($entry) and !empty($entry)) {
 
-       if ($dh_pending_comments = opendir("data/items/$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;
+       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and isset($req_entry) and !empty($req_entry)) {
+      
+               if ($dh_pending_comments = opendir("data/items/$d/comments/pending")) {
+      
+                       while (($change_me_pending_comments = readdir($dh_pending_comments)) !== false) {
+      
+                               if ($change_me_pending_comments != "." && $change_me_pending_comments != "..") {
+                                       $show_pending_comments[] = $change_me_pending_comments;
+                               }
                        }
+                       closedir($dh_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=';
       
-                       if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) {
-                               echo "610";
-                       }
-                       else {
-                               echo "525";
-                       }
-
-                       echo '><tr><td>';
+               asort($show_pending_comments);
+               reset($show_pending_comments);
+      
+               $count_pending_comments = count($show_pending_comments);
 
-                       if (file_exists("data/round.txt")) {
-                               echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+               if ($count_pending_comments > 0) {
+      
+                       if ($count_pending_comments == 1) {
+                               echo '<b>Pending Comment</b></p>';
                        }
                        else {
-                               echo '<div id="panel_title">';
+                               echo '<b>Pending Comments</b></p>';
                        }
 
-                       if (file_exists("data/items/$d/comments/pending/$pending_comment/url.txt")) {
-                               echo '<a target=_maj href=';
-                               readfile("data/items/$d/comments/pending/$pending_comment/url.txt");
-                               echo '>';
-                       }
+                       foreach ($show_pending_comments as $pending_comment) {
       
-                       readfile("data/items/$d/comments/pending/$pending_comment/firstname.txt");
-                       echo ' ';
-                       readfile("data/items/$d/comments/pending/$pending_comment/lastname.txt");
+                               echo '<table border=0 cellspacing=0 cellpadding=0 width=';
+              
+                               if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) {
+                                       echo "610";
+                               }
+                               else {
+                                       echo "525";
+                               }
       
-                       if (file_exists("data/items/$d/comments/pending/$pending_comment/url.txt")) {
-                               echo '</a>';
-                       }
+                               echo '><tr><td>';
       
-                       echo ' &lt;';
-                       readfile("data/items/$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=11 height=11 border=0 align=right alt="delete comment"></a>';
-
-                       $pending_comment_key_file = "data/items/$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 '<a href=move.php?entry=' . $d . '&comment=' . $pending_comment . '&type=pending><img src=images/widget.move.png width=11 height=11 border=0 align=right alt="move comment"></a>';
-
-                       echo '<a href=edit.php?entry=' . $d . '&comment=' . $pending_comment . '&type=pending><img src=images/widget.edit.png width=11 height=11 border=0 align=right alt="edit comment"></a>';
-
-                       echo '</div><div id=panel_body><table border=0 cellspacing=0 cellpadding=0><tr>';
-
-                       if (file_exists("data/bb.txt") and file_exists("data/avatar.txt") and file_exists("data/items/$d/comments/pending/$pending_comment/author.txt")) {
-
-                               echo "<td width=85 valign=top><p>";
-
-                               $pc_author = file_get_contents("data/items/$d/comments/pending/$pending_comment/author.txt");
-
-                               echo "<a href=member.php?id=$pc_author>";
-
-                               if ((file_get_contents("data/username.txt") == $pc_author) and (file_exists("images/avatar.jpg") or file_exists("images/avatar.gif") or file_exists("images/avatar.png"))) {
-
-                                       if (file_exists("images/avatar.gif")) {
-                                               $pc_avatar_gif_image_size = getimagesize("images/avatar.gif");
-                                               $pc_avatar_gif_image_width = $pc_avatar_gif_image_size[0];
-                                               $pc_avatar_gif_image_height = $pc_avatar_gif_image_size[1];
-              
-                                               $pc_max_avatar_gif_image_width = 80;
-                                      
-                                               if ($pc_avatar_gif_image_width > $pc_max_avatar_gif_image_width) {  
-                                                       $sizefactor = (double) ($pc_max_avatar_gif_image_width / $pc_avatar_gif_image_width) ;
-                                                       $pc_avatar_gif_image_width = (int) ($pc_avatar_gif_image_width * $sizefactor);
-                                                       $pc_avatar_gif_image_height = (int) ($pc_avatar_gif_image_height * $sizefactor);
-                                               }
+                               if (file_exists("data/round.txt")) {
+                                       echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+                               }
+                               else {
+                                       echo '<div id="panel_title">';
+                               }
+      
+                               if (file_exists("data/items/$d/comments/pending/$pending_comment/url.txt")) {
+                                       echo '<a target=_maj href=';
+                                       readfile("data/items/$d/comments/pending/$pending_comment/url.txt");
+                                       echo '>';
+                               }
               
-                                               echo "<img src=images/avatar.gif border=0 width=";
-                                               echo $pc_avatar_gif_image_width;
-                                               echo " height=";
-                                               echo $pc_avatar_gif_image_height;
-                                       }
-                                       if (file_exists("images/avatar.jpg")) {
-                                               $pc_avatar_jpg_image_size = getimagesize("images/avatar.jpg");
-                                               $pc_avatar_jpg_image_width = $pc_avatar_jpg_image_size[0];
-                                               $pc_avatar_jpg_image_height = $pc_avatar_jpg_image_size[1];
-                                      
-                                               $pc_max_avatar_jpg_image_width = 80;
-                                      
-                                               if ($pc_avatar_jpg_image_width > $pc_max_avatar_jpg_image_width) {  
-                                                       $sizefactor = (double) ($pc_max_avatar_jpg_image_width / $pc_avatar_jpg_image_width) ;
-                                                       $pc_avatar_jpg_image_width = (int) ($pc_avatar_jpg_image_width * $sizefactor);
-                                                       $pc_avatar_jpg_image_height = (int) ($pc_avatar_jpg_image_height * $sizefactor);
-                                               }
+                               readfile("data/items/$d/comments/pending/$pending_comment/firstname.txt");
+                               echo ' ';
+                               readfile("data/items/$d/comments/pending/$pending_comment/lastname.txt");
               
-                                               echo "<img src=images/avatar.jpg border=0 width=";
-                                               echo $pc_avatar_jpg_image_width;
-                                               echo " height=";
-                                               echo $pc_avatar_jpg_image_height;
-                                       }
-                                       if (file_exists("images/avatar.png")) {
-                                               $pc_avatar_png_image_size = getimagesize("images/avatar.png");
-                                               $pc_avatar_png_image_width = $pc_avatar_png_image_size[0];
-                                               $pc_avatar_png_image_height = $pc_avatar_png_image_size[1];
-                                      
-                                               $pc_max_avatar_png_image_width = 80;
-                                      
-                                               if ($pc_avatar_png_image_width > $pc_max_avatar_png_image_width) {  
-                                                       $sizefactor = (double) ($pc_max_avatar_png_image_width / $pc_avatar_png_image_width) ;
-                                                       $pc_avatar_png_image_width = (int) ($pc_avatar_png_image_width * $sizefactor);
-                                                       $pc_avatar_png_image_height = (int) ($pc_avatar_png_image_height * $sizefactor);
-                                               }
-                                      
-                                               echo "<img src=images/avatar.png border=0 width=";
-                                               echo $pc_avatar_png_image_width;
-                                               echo " height=";
-                                               echo $pc_avatar_png_image_height;
-                                       }
-                               echo "><br>";
+                               if (file_exists("data/items/$d/comments/pending/$pending_comment/url.txt")) {
+                                       echo '</a>';
                                }
-                               elseif (file_exists("images/members/$pc_author/avatar.jpg") or file_exists("images/members/$pc_author/avatar.gif") or file_exists("images/members/$pc_author/avatar.png")) {
-
-                                       if (file_exists("images/members/$pc_author/avatar.gif")) {
-                                               $pc_avatar_gif_image_size = getimagesize("images/members/$pc_author/avatar.gif");
-                                               $pc_avatar_gif_image_width = $pc_avatar_gif_image_size[0];
-                                               $pc_avatar_gif_image_height = $pc_avatar_gif_image_size[1];
               
-                                               $pc_max_avatar_gif_image_width = 80;
-                                      
-                                               if ($pc_avatar_gif_image_width > $pc_max_avatar_gif_image_width) {  
-                                                       $sizefactor = (double) ($pc_max_avatar_gif_image_width / $pc_avatar_gif_image_width) ;
-                                                       $pc_avatar_gif_image_width = (int) ($pc_avatar_gif_image_width * $sizefactor);
-                                                       $pc_avatar_gif_image_height = (int) ($pc_avatar_gif_image_height * $sizefactor);
+                               echo ' &lt;';
+                               readfile("data/items/$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=11 height=11 border=0 align=right alt="delete comment"></a>';
+      
+                               $pending_comment_key_file = "data/items/$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=\"index.php?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 "<a href=\"move.php?entry=$d&comment=$pending_comment&type=pending\"><img src=\"images/widget.move.png\" width=\"11\" height=\"11\" border=\"0\" align=\"right\" alt=\"move comment\"></a>";
+      
+                               echo '<a href=edit.php?entry=' . $d . '&comment=' . $pending_comment . '&type=pending><img src=images/widget.edit.png width=11 height=11 border=0 align=right alt="edit comment"></a>';
+      
+                               echo '</div><div id=panel_body><table border=0 cellspacing=0 cellpadding=0><tr>';
+      
+                               if (file_exists("data/bb.txt") and file_exists("data/avatar.txt") and file_exists("data/items/$d/comments/pending/$pending_comment/author.txt")) {
+      
+                                       echo "<td width=85 valign=top>";
+      
+                                       $pc_author = file_get_contents("data/items/$d/comments/pending/$pending_comment/author.txt");
+      
+                                       echo "<a href=member.php?id=$pc_author>";
+      
+                                       if ((file_get_contents("data/username.txt") == $pc_author) and (file_exists("images/avatar.jpg") or file_exists("images/avatar.gif") or file_exists("images/avatar.png"))) {
+      
+                                               if (file_exists("images/avatar.gif")) {
+                                                       $pc_avatar_gif_image_size = getimagesize("images/avatar.gif");
+                                                       $pc_avatar_gif_image_width = $pc_avatar_gif_image_size[0];
+                                                       $pc_avatar_gif_image_height = $pc_avatar_gif_image_size[1];
+                      
+                                                       $pc_max_avatar_gif_image_width = 80;
+                                              
+                                                       if ($pc_avatar_gif_image_width > $pc_max_avatar_gif_image_width) {  
+                                                               $sizefactor = (double) ($pc_max_avatar_gif_image_width / $pc_avatar_gif_image_width) ;
+                                                               $pc_avatar_gif_image_width = (int) ($pc_avatar_gif_image_width * $sizefactor);
+                                                               $pc_avatar_gif_image_height = (int) ($pc_avatar_gif_image_height * $sizefactor);
+                                                       }
+                      
+                                                       echo "<img src=images/avatar.gif border=0 width=";
+                                                       echo $pc_avatar_gif_image_width;
+                                                       echo " height=";
+                                                       echo $pc_avatar_gif_image_height;
                                                }
-              
-                                               echo "<img src=images/members/$pc_author/avatar.gif border=0 width=";
-                                               echo $pc_avatar_gif_image_width;
-                                               echo " height=";
-                                               echo $pc_avatar_gif_image_height;
-                                       }
-                                       if (file_exists("images/members/$pc_author/avatar.jpg")) {
-                                               $pc_avatar_jpg_image_size = getimagesize("images/members/$pc_author/avatar.jpg");
-                                               $pc_avatar_jpg_image_width = $pc_avatar_jpg_image_size[0];
-                                               $pc_avatar_jpg_image_height = $pc_avatar_jpg_image_size[1];
-                                      
-                                               $pc_max_avatar_jpg_image_width = 80;
-                                      
-                                               if ($pc_avatar_jpg_image_width > $pc_max_avatar_jpg_image_width) {  
-                                                       $sizefactor = (double) ($pc_max_avatar_jpg_image_width / $pc_avatar_jpg_image_width) ;
-                                                       $pc_avatar_jpg_image_width = (int) ($pc_avatar_jpg_image_width * $sizefactor);
-                                                       $pc_avatar_jpg_image_height = (int) ($pc_avatar_jpg_image_height * $sizefactor);
+      
+                                               if (file_exists("images/avatar.jpg")) {
+                                                       $pc_avatar_jpg_image_size = getimagesize("images/avatar.jpg");
+                                                       $pc_avatar_jpg_image_width = $pc_avatar_jpg_image_size[0];
+                                                       $pc_avatar_jpg_image_height = $pc_avatar_jpg_image_size[1];
+                                              
+                                                       $pc_max_avatar_jpg_image_width = 80;
+                                              
+                                                       if ($pc_avatar_jpg_image_width > $pc_max_avatar_jpg_image_width) {  
+                                                               $sizefactor = (double) ($pc_max_avatar_jpg_image_width / $pc_avatar_jpg_image_width) ;
+                                                               $pc_avatar_jpg_image_width = (int) ($pc_avatar_jpg_image_width * $sizefactor);
+                                                               $pc_avatar_jpg_image_height = (int) ($pc_avatar_jpg_image_height * $sizefactor);
+                                                       }
+                      
+                                                       echo "<img src=images/avatar.jpg border=0 width=";
+                                                       echo $pc_avatar_jpg_image_width;
+                                                       echo " height=";
+                                                       echo $pc_avatar_jpg_image_height;
                                                }
-              
-                                               echo "<img src=images/members/$pc_author/avatar.jpg border=0 width=";
-                                               echo $pc_avatar_jpg_image_width;
-                                               echo " height=";
-                                               echo $pc_avatar_jpg_image_height;
-                                       }
-                                       if (file_exists("images/members/$pc_author/avatar.png")) {
-                                               $pc_avatar_png_image_size = getimagesize("images/members/$pc_author/avatar.png");
-                                               $pc_avatar_png_image_width = $pc_avatar_png_image_size[0];
-                                               $pc_avatar_png_image_height = $pc_avatar_png_image_size[1];
-                                      
-                                               $pc_max_avatar_png_image_width = 80;
+      
+                                               if (file_exists("images/avatar.png")) {
+                                                       $pc_avatar_png_image_size = getimagesize("images/avatar.png");
+                                                       $pc_avatar_png_image_width = $pc_avatar_png_image_size[0];
+                                                       $pc_avatar_png_image_height = $pc_avatar_png_image_size[1];
                                       
-                                               if ($pc_avatar_png_image_width > $pc_max_avatar_png_image_width) {  
-                                                       $sizefactor = (double) ($pc_max_avatar_png_image_width / $pc_avatar_png_image_width) ;
-                                                       $pc_avatar_png_image_width = (int) ($pc_avatar_png_image_width * $sizefactor);
-                                                       $pc_avatar_png_image_height = (int) ($pc_avatar_png_image_height * $sizefactor);
+                                                       $pc_max_avatar_png_image_width = 80;
+                                              
+                                                       if ($pc_avatar_png_image_width > $pc_max_avatar_png_image_width) {  
+                                                               $sizefactor = (double) ($pc_max_avatar_png_image_width / $pc_avatar_png_image_width) ;
+                                                               $pc_avatar_png_image_width = (int) ($pc_avatar_png_image_width * $sizefactor);
+                                                               $pc_avatar_png_image_height = (int) ($pc_avatar_png_image_height * $sizefactor);
+                                                       }
+                                              
+                                                       echo "<img src=images/avatar.png border=0 width=";
+                                                       echo $pc_avatar_png_image_width;
+                                                       echo " height=";
+                                                       echo $pc_avatar_png_image_height;
                                                }
-                                      
-                                               echo "<img src=images/members/$pc_author/avatar.png border=0 width=";
-                                               echo $pc_avatar_png_image_width;
-                                               echo " height=";
-                                               echo $pc_avatar_png_image_height;
+                                               echo "><br>";
                                        }
-                               echo "><br>";
-                               }
-                               echo "$pc_author</a><br>";
-
-                               if ((file_get_contents("data/username.txt") == $pc_author) and file_exists("data/rank.txt")) {
-                                       echo "administrator<br>";
-                               }
-                               elseif (file_exists("data/members/active/$pc_author/rank.txt") and file_exists("data/rank.txt")) {
-                                       $pc_rank = file_get_contents("data/members/active/$pc_author/rank.txt");
-                                       echo "$pc_rank<br>";
-                               }
-                               elseif (!file_exists("data/members/active/$pc_author/rank.txt") and file_exists("data/rank.txt")) {
-                                       echo "member<br>";
-                               }
-              
-                               if ($pc_dh_posts = opendir("data/items")) {
-
-                                       while (($pc_entry_posts = readdir($pc_dh_posts)) !== false) {
-              
-                                               if (file_exists("data/items/$pc_entry_posts/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                                                       continue;
+                                       elseif (file_exists("images/members/$pc_author/avatar.jpg") or file_exists("images/members/$pc_author/avatar.gif") or file_exists("images/members/$pc_author/avatar.png")) {
+      
+                                               if (file_exists("images/members/$pc_author/avatar.gif")) {
+                                                       $pc_avatar_gif_image_size = getimagesize("images/members/$pc_author/avatar.gif");
+                                                       $pc_avatar_gif_image_width = $pc_avatar_gif_image_size[0];
+                                                       $pc_avatar_gif_image_height = $pc_avatar_gif_image_size[1];
+                      
+                                                       $pc_max_avatar_gif_image_width = 80;
+                                              
+                                                       if ($pc_avatar_gif_image_width > $pc_max_avatar_gif_image_width) {  
+                                                               $sizefactor = (double) ($pc_max_avatar_gif_image_width / $pc_avatar_gif_image_width) ;
+                                                               $pc_avatar_gif_image_width = (int) ($pc_avatar_gif_image_width * $sizefactor);
+                                                               $pc_avatar_gif_image_height = (int) ($pc_avatar_gif_image_height * $sizefactor);
+                                                       }
+                      
+                                                       echo "<img src=images/members/$pc_author/avatar.gif border=0 width=";
+                                                       echo $pc_avatar_gif_image_width;
+                                                       echo " height=";
+                                                       echo $pc_avatar_gif_image_height;
                                                }
               
-                                               if (file_exists("data/items/$pc_entry_posts/member.txt") and (!isset($_SESSION['logged_in']))) {
-                                                       continue;
+                                               if (file_exists("images/members/$pc_author/avatar.jpg")) {
+                                                       $pc_avatar_jpg_image_size = getimagesize("images/members/$pc_author/avatar.jpg");
+                                                       $pc_avatar_jpg_image_width = $pc_avatar_jpg_image_size[0];
+                                                       $pc_avatar_jpg_image_height = $pc_avatar_jpg_image_size[1];
+                                              
+                                                       $pc_max_avatar_jpg_image_width = 80;
+                                              
+                                                       if ($pc_avatar_jpg_image_width > $pc_max_avatar_jpg_image_width) {  
+                                                               $sizefactor = (double) ($pc_max_avatar_jpg_image_width / $pc_avatar_jpg_image_width) ;
+                                                               $pc_avatar_jpg_image_width = (int) ($pc_avatar_jpg_image_width * $sizefactor);
+                                                               $pc_avatar_jpg_image_height = (int) ($pc_avatar_jpg_image_height * $sizefactor);
+                                                       }
+                      
+                                                       echo "<img src=images/members/$pc_author/avatar.jpg border=0 width=";
+                                                       echo $pc_avatar_jpg_image_width;
+                                                       echo " height=";
+                                                       echo $pc_avatar_jpg_image_height;
                                                }
               
-                                               $pc_post_cat_dir = file_get_contents("data/items/$pc_entry_posts/category.txt");
-              
-                                               if (file_exists("data/categories/$pc_post_cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$pc_entry_posts/cat.txt")) {
-                                                       continue;
+                                               if (file_exists("images/members/$pc_author/avatar.png")) {
+                                                       $pc_avatar_png_image_size = getimagesize("images/members/$pc_author/avatar.png");
+                                                       $pc_avatar_png_image_width = $pc_avatar_png_image_size[0];
+                                                       $pc_avatar_png_image_height = $pc_avatar_png_image_size[1];
+                                              
+                                                       $pc_max_avatar_png_image_width = 80;
+                                              
+                                                       if ($pc_avatar_png_image_width > $pc_max_avatar_png_image_width) {  
+                                                               $sizefactor = (double) ($pc_max_avatar_png_image_width / $pc_avatar_png_image_width) ;
+                                                               $pc_avatar_png_image_width = (int) ($pc_avatar_png_image_width * $sizefactor);
+                                                               $pc_avatar_png_image_height = (int) ($pc_avatar_png_image_height * $sizefactor);
+                                                       }
+                                              
+                                                       echo "<img src=images/members/$pc_author/avatar.png border=0 width=";
+                                                       echo $pc_avatar_png_image_width;
+                                                       echo " height=";
+                                                       echo $pc_avatar_png_image_height;
                                                }
+                                               echo "><br>";
+                                       }
+                                       echo "$pc_author</a><br>";
+
+                                       if ((file_get_contents("data/username.txt") == $pc_author) and file_exists("data/rank.txt")) {
+                                               echo "administrator<br>";
+                                       }
+                                       elseif (file_exists("data/members/active/$pc_author/rank.txt") and file_exists("data/rank.txt")) {
+                                               $pc_rank = file_get_contents("data/members/active/$pc_author/rank.txt");
+                                               echo "$pc_rank<br>";
+                                       }
+                                       elseif (!file_exists("data/members/active/$pc_author/rank.txt") and file_exists("data/rank.txt")) {
+                                               echo "member<br>";
+                                       }
               
-                                               if ($pc_entry_posts != "." && $pc_entry_posts != ".." && fnmatch("*",$pc_entry_posts)) {
-                                                       if (file_exists("data/members/active/$pc_author") and file_exists("data/bb.txt")) {
-                                                               if (file_exists("data/items/$pc_entry_posts/author.txt") and (file_get_contents("data/items/$pc_entry_posts/author.txt") == $pc_author)) {
-                                                                       $pc_items_posts[] = $pc_entry_posts;
+                                       if ($pc_dh_posts = opendir("data/items")) {
+      
+                                               while (($pc_entry_posts = readdir($pc_dh_posts)) !== false) {
+                      
+                                                       if (file_exists("data/items/$pc_entry_posts/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                                                               continue;
+                                                       }
+                      
+                                                       if (file_exists("data/items/$pc_entry_posts/member.txt") and (!isset($_SESSION['logged_in']))) {
+                                                               continue;
+                                                       }
+      
+                                                       $private_categories = "0";
+      
+                                                       if (file_exists("data/items/$change_me_pc_entry_posts/categories")) {
+                              
+                                                               if ($dh_cat2_pc_entry_posts = opendir("data/items/$change_me_pc_entry_posts/categories")) {
+                              
+                                                                       while (($change_me_cat2_pc_entry_posts = readdir($dh_cat2_pc_entry_posts)) !== false) {
+                              
+                                                                               if ($change_me_cat2_pc_entry_posts != "." && $change_me_cat2_pc_entry_posts != "..") {
+                              
+                                                                                       if (file_exists("data/categories/$change_me_cat2_pc_entry_posts/private.txt")) {
+                                                                                               $private_categories = $private_categories + 1;
+                                                                                       }
+                                                                               }
+                                                                       }
+                                                                       closedir($dh_cat2_pc_entry_posts);
                                                                }
                                                        }
-                                                       elseif (!file_exists("data/members/active/$pc_author") and (file_get_contents("data/username.txt") == $pc_author) and file_exists("data/bb.txt")) {
-                                                               if (file_exists("data/items/$pc_entry_posts/author.txt") and (file_get_contents("data/items/$pc_entry_posts/author.txt") == $pc_author)) {
-                                                                       $pc_items_posts[] = $pc_entry_posts;
+      
+                                                       if (($private_categories > 0) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$pc_entry_posts/cat.txt")) {
+                                                               continue;
+                                                       }
+                      
+                                                       if ($pc_entry_posts != "." && $pc_entry_posts != "..") {
+                                                               if (file_exists("data/members/active/$pc_author") and file_exists("data/bb.txt")) {
+                                                                       if (file_exists("data/items/$pc_entry_posts/author.txt") and (file_get_contents("data/items/$pc_entry_posts/author.txt") == $pc_author)) {
+                                                                               $pc_items_posts[] = $pc_entry_posts;
+                                                                       }
+                                                               }
+                                                               elseif (!file_exists("data/members/active/$pc_author") and (file_get_contents("data/username.txt") == $pc_author) and file_exists("data/bb.txt")) {
+                                                                       if (file_exists("data/items/$pc_entry_posts/author.txt") and (file_get_contents("data/items/$pc_entry_posts/author.txt") == $pc_author)) {
+                                                                               $pc_items_posts[] = $pc_entry_posts;
+                                                                       }
                                                                }
                                                        }
                                                }
+                                               closedir($pc_dh_posts);
+                                       }
+                                       $pc_posts = count($pc_items_posts);
+                                       if ($pc_posts == 1) {
+                                               echo "$pc_posts post";
                                        }
-                               closedir($pc_dh_posts);
+                                       if ($pc_posts > 1) {
+                                               echo "$pc_posts posts";
+                                       }
+                                       unset($pc_items_posts);
+                      
+                                       echo "</td><td width=513 valign=top>";
                                }
-                               $pc_posts = count($pc_items_posts);
-                               if ($pc_posts == 1) {
-                                       echo "$pc_posts post";
+                               else {
+                                       echo "<td width=598 valign=top>";
                                }
-                               if ($pc_posts > 1) {
-                                       echo "$pc_posts posts";
+      
+                               echo '<font style="font-size: 10px; color: #999999;">';
+      
+                               if ((file_exists("data/items/$d/comments/pending/$pending_comment/author.txt") and (file_exists("data/bb.txt") and !file_exists("data/avatar.txt")) or (file_exists("data/items/$d/comments/pending/$pending_comment/author.txt") and (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and !file_exists("data/avatar.txt"))))) {
+                                       $pxavatar_author = file_get_contents("data/items/$d/comments/pending/$pending_comment/author.txt");
+                                       echo "<a href=member.php?id=$pxavatar_author>$pxavatar_author</a> - ";
                                }
-                               unset($pc_items_posts);
-              
-                               echo "</p></td><td width=513 valign=top>";
-                       }
-                       else {
-                               echo "<td width=598 valign=top>";
-                       }
-
-                       echo '<p><font style="font-size: 10px; color: #999999;">';
-
-                       if ((file_exists("data/items/$d/comments/pending/$pending_comment/author.txt") and (file_exists("data/bb.txt") and !file_exists("data/avatar.txt")) or (file_exists("data/items/$d/comments/pending/$pending_comment/author.txt") and (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and !file_exists("data/avatar.txt"))))) {
-                               $pxavatar_author = file_get_contents("data/items/$d/comments/pending/$pending_comment/author.txt");
-                               echo "<a href=member.php?id=$pxavatar_author>$pxavatar_author</a> - ";
-                       }
-                       readfile("data/items/$d/comments/pending/$pending_comment/timestamp.txt");
-
-                       if (file_exists("data/items/$d/comments/pending/$pending_comment/revisions.txt")) {
-                               echo '  (Revision ';
-                               readfile("data/items/$d/comments/pending/$pending_comment/revisions.txt");
-                               echo ')';
-                       }
-
-                       echo '</font><font style="font-size: 5px;"><br><br></font>';
-                       readfile("data/items/$d/comments/pending/$pending_comment/comment.txt");
-                       echo '</p></tr></table></div>';
-
-                       if (file_exists("data/round.txt")) {
-                               echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+                               readfile("data/items/$d/comments/pending/$pending_comment/timestamp.txt");
+      
+                               if (file_exists("data/items/$d/comments/pending/$pending_comment/revisions.txt")) {
+                                       echo '  (Revision ';
+                                       readfile("data/items/$d/comments/pending/$pending_comment/revisions.txt");
+                                       echo ')';
+                               }
+      
+                               echo '</font><font style="font-size: 5px;"><br><br></font>';
+                               readfile("data/items/$d/comments/pending/$pending_comment/comment.txt");
+                               echo '</p></tr></table></div>';
+      
+                               if (file_exists("data/round.txt")) {
+                                       echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+                               }
+      
+                               unset($show_pending_comments);
+                               echo '</td></tr></table></p>';
                        }
-
-                       unset($show_pending_comments);
-                       echo '</td></tr></table></p>';
                }
        }
 }
+
 ?>
 
-<p><table border=0 cellspacing=0 cellpadding=0 width=100%><tr>
+<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($category) and !empty($category) and file_exists(strip_tags(strtolower(str_replace(" ","_","data/categories/{$category}"))))) {
-               echo "category={$category}&";
+
+       echo "<td align=left><a href=\"index.php?";
+
+       if (isset($req_category) and !empty($req_category) and file_exists("data/categories/$req_category")) {
+               echo "category=$req_category";
        }
-       if (isset($archive) and !empty($archive)) {
-               echo "archive={$archive}&";
+
+       if (isset($req_archive) and !empty($req_archive)) {
+               echo "archive=$req_archive";
        }
-       if (isset($_REQUEST['author']) and !empty($_REQUEST['author']) and file_exists("data/members/active/{$_REQUEST['author']}") and file_exists("data/bb.txt")) {
-               echo "author={$_REQUEST['author']}&";
+
+       if (isset($req_author) and !empty($req_author) and file_exists("data/members/active/$req_author") and file_exists("data/bb.txt")) {
+               echo "author=$req_author";
        }
-       if (isset($_REQUEST['author']) and !empty($_REQUEST['author']) and !file_exists("data/members/active/{$_REQUEST['author']}") and (file_get_contents("data/username.txt") == $_REQUEST['author']) and file_exists("data/bb.txt")) {
-               echo "author={$_REQUEST['author']}&";
+
+       if (isset($req_author) and !empty($req_author) and !file_exists("data/members/active/$req_author") and (file_get_contents("data/username.txt") == $req_author) and file_exists("data/bb.txt")) {
+               echo "author=$req_author";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "private")) {
-               echo "find=private&";
+
+       if (isset($req_find) and !empty($req_find) and ($req_find == "private")) {
+               echo "find=private";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "member")) {
-               echo "find=member&";
+
+       if (isset($req_find) and !empty($req_find) and ($req_find == "member")) {
+               echo "find=member";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "unfiled")) {
-               echo "find=unfiled&";
+
+       if (isset($req_find) and !empty($req_find) and ($req_find == "unfiled")) {
+               echo "find=unfiled";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "passwd")) {
-               echo "find=passwd&";
+
+       if (isset($req_find) and !empty($req_find) and ($req_find == "passwd")) {
+               echo "find=passwd";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "comments")) {
-               echo "find=comments&";
+
+       if (isset($req_find) and !empty($req_find) and ($req_find == "comments")) {
+               echo "find=comments";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "album")) {
-               echo "find=album&";
+
+       if (isset($req_find) and !empty($req_find) and ($req_find == "album")) {
+               echo "find=album";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "filedrop")) {
-               echo "find=filedrop&";
+
+       if (isset($req_find) and !empty($req_find) and ($req_find == "filedrop")) {
+               echo "find=filedrop";
        }
-       echo "start=" . ($start-$increase) . "\">previous</a></p></td>";
+
+       echo "&start=" . ($start-$increase) . "\">previous</a></td>";
 }
 
 if ($end < sizeof($items)) {
-       echo "<td align=right><p><a href=\"" . $_SERVER['PHP_SELF'] . "?";
-       if (isset($category) and !empty($category) and file_exists(strip_tags(strtolower(str_replace(" ","_","data/categories/{$category}"))))) {
-               echo "category={$category}&";
+
+       echo "<td align=right><a href=\"index.php?";
+
+       if (isset($req_category) and !empty($req_category) and file_exists("data/categories/$req_category")) {
+               echo "category=$req_category";
        }
-       if (isset($archive) and !empty($archive)) {
-               echo "archive={$archive}&";
+       if (isset($req_archive) and !empty($req_archive)) {
+               echo "archive=$req_archive";
        }
-       if (isset($_REQUEST['author']) and !empty($_REQUEST['author']) and file_exists("data/members/active/{$_REQUEST['author']}") and file_exists("data/bb.txt")) {
-               echo "author={$_REQUEST['author']}&";
+       if (isset($req_author) and !empty($req_author) and file_exists("data/members/active/$req_author") and file_exists("data/bb.txt")) {
+               echo "author=$req_author";
        }
-       if (isset($_REQUEST['author']) and !empty($_REQUEST['author']) and !file_exists("data/members/active/{$_REQUEST['author']}") and (file_get_contents("data/username.txt") == $_REQUEST['author']) and file_exists("data/bb.txt")) {
-               echo "author={$_REQUEST['author']}&";
+       if (isset($req_author) and !empty($req_author) and !file_exists("data/members/active/$req_author") and (file_get_contents("data/username.txt") == $req_author) and file_exists("data/bb.txt")) {
+               echo "author=$req_author";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "private")) {
-               echo "find=private&";
+       if (isset($req_find) and !empty($req_find) and ($req_find == "private")) {
+               echo "find=private";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "member")) {
-               echo "find=member&";
+       if (isset($req_find) and !empty($req_find) and ($req_find == "member")) {
+               echo "find=member";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "unfiled")) {
-               echo "find=unfiled&";
+       if (isset($req_find) and !empty($req_find) and ($req_find == "unfiled")) {
+               echo "find=unfiled";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "passwd")) {
-               echo "find=passwd&";
+       if (isset($req_find) and !empty($req_find) and ($req_find == "passwd")) {
+               echo "find=passwd";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "comments")) {
-               echo "find=comments&";
+       if (isset($req_find) and !empty($req_find) and ($req_find == "comments")) {
+               echo "find=comments";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "album")) {
-               echo "find=album&";
+       if (isset($req_find) and !empty($req_find) and ($req_find == "album")) {
+               echo "find=album";
        }
-       if (isset($_REQUEST['find']) and !empty($_REQUEST['find']) and ($_REQUEST['find'] == "filedrop")) {
-               echo "find=filedrop&";
+       if (isset($req_find) and !empty($req_find) and ($req_find == "filedrop")) {
+               echo "find=filedrop";
        }
-       echo "start=" . ($start+$increase) . "\">next</a></p></td>";
+       echo "&start=" . ($start+$increase) . "\">next</a></td>";
 }
 ?>
 
@@ -3882,52 +4120,15 @@ if ($end < sizeof($items)) {
 
 </td>
 
-<td width=175 valign=top>
+<td width="175" valign="top">
 
 <?php
-if ($dh_latest_items = opendir("data/items")) {
-       while (($entry_latest_items = readdir($dh_latest_items)) !== false) {
-
-               $today = date("YmdHis",time() + $offset);
-
-               if (($entry_latest_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                       continue;
-               }
-
-               if (file_exists("data/items/$entry_latest_items/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                       continue;
-               }
-
-               if (file_exists("data/items/$entry_latest_items/member.txt") and (!isset($_SESSION['logged_in']))) {
-                       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']) or ($_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']) or ($_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 (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;
+               while (($change_me_pending_comment_flags = readdir($dh_pending_comment_flags)) !== false) {
+                       if ($change_me_pending_comment_flags != "." && $change_me_pending_comment_flags != "..") {
+                               $show_pending_comment_flags[] = $change_me_pending_comment_flags;
                        }
                }
                closedir($dh_pending_comment_flags);
@@ -3937,7 +4138,7 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
        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)) {
+       if (($count_latest > 0) and ($count_pending_comment_flags > 0)) {
 
                if (file_exists("data/round.txt")) {
                        echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
@@ -3951,15 +4152,15 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
 
                if ($dh_list_pending_comment_flags = opendir("data/comments/pending")) {
 
-                       while (($entry_list_pending_comment_flags = readdir($dh_list_pending_comment_flags)) !== false) {
+                       while (($change_me_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)) {
+                               if ($change_me_list_pending_comment_flags != "." && $change_me_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 href=\"index.php?entry=$change_me_list_pending_comment_flags&show=comments\">";
+                                       readfile("data/items/$change_me_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"));
+                                       $fp_comment_count_txt = fopen("data/comments/pending/$change_me_list_pending_comment_flags/count.txt","r");
+                                       $comment_count_value = fread($fp_comment_count_txt,filesize("data/comments/pending/$change_me_list_pending_comment_flags/count.txt"));
                                        fclose($fp_comment_count_txt);
 
                                        if ($comment_count_value == 1) {
@@ -3986,10 +4187,10 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
 
 if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and file_exists("data/members/confirmed") and !file_exists("data/xapp.txt") and file_exists("data/bb.txt") and file_exists("data/reg.txt")) {
        if ($dh_pending_list = opendir("data/members/confirmed")) {
-               while (($entry_pending_list = readdir($dh_pending_list)) !== false) {
+               while (($change_me_pending_list = readdir($dh_pending_list)) !== false) {
 
-                       if ($entry_pending_list != "." && $entry_pending_list != ".." && fnmatch("*",$entry_pending_list)) {
-                               $show_pending_list[] = $entry_pending_list;
+                       if ($change_me_pending_list != "." && $change_me_pending_list != "..") {
+                               $show_pending_list[] = $change_me_pending_list;
                        }
                }
                closedir($dh_pending_list);
@@ -4091,9 +4292,9 @@ if (file_exists("data/bb.txt") and file_exists("data/bb-stats.txt")) {
        echo "Bulletin Board</div><div id=panel_body>";
        if (file_exists("data/members/active") and file_exists("data/bb.txt")) {
                if ($dh_active_list = opendir("data/members/active")) {
-                       while (($entry_active_list = readdir($dh_active_list)) !== false) {
-                               if ($entry_active_list != "." && $entry_active_list != ".." && fnmatch("*",$entry_active_list)) {
-                                       $show_active_list[] = $entry_active_list;
+                       while (($change_me_active_list = readdir($dh_active_list)) !== false) {
+                               if ($change_me_active_list != "." && $change_me_active_list != "..") {
+                                       $show_active_list[] = $change_me_active_list;
                                }
                        }
                closedir($dh_active_list);
@@ -4110,26 +4311,38 @@ if (file_exists("data/bb.txt") and file_exists("data/bb-stats.txt")) {
 
        if (file_exists("data/items")) {
                if ($dh_mempost_list = opendir("data/items")) {
-                       while (($entry_mempost_list = readdir($dh_mempost_list)) !== false) {
+                       while (($change_me_mempost_list = readdir($dh_mempost_list)) !== false) {
 
-                               if (file_exists("data/items/$entry_mempost_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                               if (file_exists("data/items/$change_me_mempost_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                                        continue;
                                }
 
-                               // hide_member (20070606)
-                               //if (file_exists("data/items/$entry_mempost_list/member.txt") and (!isset($_SESSION['logged_in']))) {
-                               //      continue;
-                               //}
+                               $private_categories = "0";
 
-                               $get_cat_dir = file_get_contents("data/items/$entry_mempost_list/category.txt");
+                               if (file_exists("data/items/$change_me_mempost_list/categories")) {
+                      
+                                       if ($dh_entry_categories_mempost_list = opendir("data/items/$change_me_mempost_list/categories")) {
+                      
+                                               while (($entry_category_mempost_list = readdir($dh_entry_categories_mempost_list)) !== false) {
+                      
+                                                       if ($entry_category_mempost_list != "." && $entry_category_mempost_list != "..") {
+                      
+                                                               if (file_exists("data/categories/$entry_category_mempost_list/private.txt")) {
+                                                                       $private_categories = $private_categories + 1;
+                                                               }
+                                                       }
+                                               }
+                                               closedir($dh_entry_categories_mempost_list);
+                                       }
+                               }
 
-                               if (file_exists("data/categories/$get_cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_mempost_list/cat.txt")) {
+                               if (($private_categories > 0) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$change_me_mempost_list/cat.txt")) {
                                        continue;
                                }
       
-                               if ($entry_mempost_list != "." && $entry_mempost_list != ".." && fnmatch("*",$entry_mempost_list)) {
-                                       $entry_mempost_list = substr("$entry_mempost_list",0,6);
-                                       $show_mempost_list[] = $entry_mempost_list;
+                               if ($change_me_mempost_list != "." && $change_me_mempost_list != "..") {
+                                       $change_me_mempost_list = substr("$change_me_mempost_list",0,6);
+                                       $show_mempost_list[] = $change_me_mempost_list;
                                }
                        }
                        closedir($dh_mempost_list);
@@ -4158,7 +4371,7 @@ if (file_exists("data/bb.txt") and file_exists("data/bb-stats.txt")) {
 
 <?php
 
-if (count($grand) > 0) {
+if ($count_grand > 0) {
       
        if (file_exists("data/round.txt")) {
                echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
@@ -4213,18 +4426,18 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
 <?php
 if (file_exists("data/categories")) {
        if ($dh_categories = opendir("data/categories")) {
-               while (($entry_categories = readdir($dh_categories)) !== false) {
+               while (($change_me_categories = readdir($dh_categories)) !== false) {
 
                        if (file_exists("data/xcat.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                                continue;
                        }
 
-                       if (file_exists("data/categories/$entry_categories/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                       if (file_exists("data/categories/$change_me_categories/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                                continue;
                        }
 
-                       if ($entry_categories != "." && $entry_categories != ".." && fnmatch("*",$entry_categories)) {
-                               $show_categories[] = $entry_categories;
+                       if ($change_me_categories != "." && $change_me_categories != "..") {
+                               $show_categories[] = $change_me_categories;
                        }
                }
                closedir($dh_categories);
@@ -4247,7 +4460,7 @@ if (file_exists("data/categories")) {
 
                foreach ($show_categories as $category) {
 
-                       echo "<a class=\"navlink\" href=\"{$_SERVER['PHP_SELF']}?category=$category\">";
+                       echo "<a class=\"navlink\" href=\"index.php?category=$category\">";
 
                        if (file_exists("data/categories/$category/title.txt")) {
                                $category_title = file_get_contents("data/categories/$category/title.txt");
@@ -4257,7 +4470,7 @@ if (file_exists("data/categories")) {
                        }
 
                        echo $category_title;
-                       echo "</a><br />";
+                       echo "</a><br>";
                }
 
                echo '</div>';
@@ -4278,7 +4491,7 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
        }
 
        echo 'Statistics</div><div id=panel_body>';
-       echo "Total Entries: $count_latest_items";
+       echo "Total Entries: $count_latest";
        if (file_exists("data/hits.txt")) {
                echo '<br>Site Hits: ';
                readfile("data/hits.txt");
@@ -4315,7 +4528,7 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
 
 <?php
 
-if (($count_latest_items > 0) and ($count_latest_items > $increase) and (!file_exists("data/xrecent.txt") or isset($_SESSION['logged_in']))) {
+if (($count_latest > 0) and ($count_latest > $increase) and (!file_exists("data/xrecent.txt") or isset($_SESSION['logged_in']))) {
 
        if (file_exists("data/round.txt")) {
                echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
@@ -4328,8 +4541,8 @@ if (($count_latest_items > 0) and ($count_latest_items > $increase) and (!file_e
 
        $increment_recent_entries = "0";
 
-       if ($count_latest_items < 10) {
-               $max_recent_entries = $count_latest_items;
+       if ($count_latest < 10) {
+               $max_recent_entries = $count_latest;
        }
        else {
                $max_recent_entries = "10";
@@ -4337,8 +4550,8 @@ if (($count_latest_items > 0) and ($count_latest_items > $increase) and (!file_e
 
        while ($increment_recent_entries < $max_recent_entries) {
 
-               echo "<a class=\"navlink\" href=\"{$_SERVER['PHP_SELF']}?entry=$show_latest_items[$increment_recent_entries]\">";
-               readfile("data/items/$show_latest_items[$increment_recent_entries]/title.txt");
+               echo "<a class=\"navlink\" href=\"index.php?entry=$latest[$increment_recent_entries]\">";
+               readfile("data/items/$latest[$increment_recent_entries]/title.txt");
                echo "</a><br>";
 
                $increment_recent_entries = $increment_recent_entries + 1;
@@ -4370,16 +4583,16 @@ if (!file_exists("data/comments/latest")) {
 if (file_exists("data/comments/latest/$cmonth")) {
 
        if ($dh_latest_comments = opendir("data/comments/latest/$cmonth")) {
-               while (($entry_latest_comments = readdir($dh_latest_comments)) !== false) {
+               while (($change_me_latest_comments = readdir($dh_latest_comments)) !== false) {
 
                        $today = date("YmdHis",time() + $offset);
 
-                       if (($entry_latest_comments > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                       if (($change_me_latest_comments > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                                continue;
                        }
 
-                       if ($entry_latest_comments != "." && $entry_latest_comments != "..") {
-                               $show_latest_comments[] = $entry_latest_comments;
+                       if ($change_me_latest_comments != "." && $change_me_latest_comments != "..") {
+                               $show_latest_comments[] = $change_me_latest_comments;
                        }
                }
        closedir($dh_latest_comments);
@@ -4391,7 +4604,7 @@ if (file_exists("data/comments/latest/$cmonth")) {
        $count_latest_comments = count($show_latest_comments);
 }
 
-if (($count_latest_comments > 0) and ($count_latest_items > $increase) and (!file_exists("data/xlcomment.txt") or isset($_SESSION['logged_in']))) {
+if (($count_latest_comments > 0) and ($count_latest > $increase) and (!file_exists("data/xlcomment.txt") or isset($_SESSION['logged_in']))) {
 
        if (file_exists("data/round.txt")) {
                echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
@@ -4407,63 +4620,6 @@ if (($count_latest_comments > 0) and ($count_latest_items > $increase) and (!fil
                $latest_comment_entry_title = file_get_contents("data/items/$latest_comment_entry/title.txt");
                $latest_comment_entry_count = count(glob("data/comments/latest/$cmonth/$latest_comment_entry/*"));
 
-               /*
-
-               $get_latest_comment_entry_time = date("Ymd",filemtime("data/comments/latest/$cmonth/$latest_comment_entry") + $offset);
-               $get_latest_comment_entry_hh = date("H",filemtime("data/comments/latest/$cmonth/$latest_comment_entry") + $offset);
-               $get_latest_comment_entry_mm = date("i",filemtime("data/comments/latest/$cmonth/$latest_comment_entry") + $offset);
-               $get_latest_comment_entry_ss = date("s",filemtime("data/comments/latest/$cmonth/$latest_comment_entry") + $offset);
-
-               $latest_comment_entry_time = date("Ymd",time() + $offset) - $get_latest_comment_entry_time;
-               $latest_comment_entry_hh = date("H",time() + $offset) - $get_latest_comment_entry_hh;
-               $latest_comment_entry_mm = date("i",time() + $offset) - $get_latest_comment_entry_mm;
-               $latest_comment_entry_ss = date("s",time() + $offset) - $get_latest_comment_entry_ss;
-
-               if ($latest_comment_entry_time < 1) {
-
-                       if ($latest_comment_entry_hh == 0) {
-
-                               if ($latest_comment_entry_mm < 1) {
-
-                                       if ($latest_comment_entry_ss <= 1) {
-                                               $latest_comment_entry_time = "1 sec";
-                                       }
-                                       else {
-                                               $latest_comment_entry_time = "$latest_comment_entry_ss secs";
-                                       }
-                               }
-
-                               if ($latest_comment_entry_mm == 1) {
-                                       $latest_comment_entry_time = "1 min";
-                               }
-
-                               if ($latest_comment_entry_mm > 1) {
-                                       $latest_comment_entry_time = "$latest_comment_entry_mm mins";
-                               }
-                       }
-
-                       if ($latest_comment_entry_hh == 1) {
-                               $latest_comment_entry_time = "1 hour";
-                       }
-
-                       if ($latest_comment_entry_hh > 1) {
-                               $latest_comment_entry_time = "$latest_comment_entry_hh hours";
-                       }
-               }
-               else {
-                       if ($latest_comment_entry_time == 1) {
-                               $latest_comment_entry_time = "1 day";
-                       }
-
-                       if ($latest_comment_entry_time > 1) {
-                               $latest_comment_entry_time = "$latest_comment_entry_time days";
-                       }                      
-               }
-
-               echo "<tr><td valign=\"bottom\"><a class=\"navlink\" href=\"index.php?entry=$latest_comment_entry&show=comments onmouseover=echo($latest_comment_entry_count)\">$latest_comment_entry_title</a></td><td align=\"right\" valign=\"bottom\"><nobr>$latest_comment_entry_time</nobr></td></tr>";
-
-               */
-
                echo "<tr><td valign=\"bottom\"><a class=\"navlink\" href=\"index.php?entry=$latest_comment_entry&show=comments\">$latest_comment_entry_title</a></td><td align=\"right\" valign=\"bottom\">$latest_comment_entry_count</td></tr>";
        }
 
@@ -4478,113 +4634,46 @@ if (($count_latest_comments > 0) and ($count_latest_items > $increase) and (!fil
 
 <?php
 
-if (file_exists("data/albums")) {
-
-       if ($dh_album_list = opendir("data/albums")) {
-
-               while (($entry_album_list = readdir($dh_album_list)) !== false) {
-
-                       $today = date("YmdHis",time() + $offset);
-
-                       if (($entry_album_list > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
-
-                       if (file_exists("data/items/$entry_album_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
-
-                       if (file_exists("data/items/$entry_album_list/member.txt") and (!isset($_SESSION['logged_in']))) {
-                               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']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_album_list/cat.txt")) {
-                               continue;
-                       }
+if ($count_albums > 0) {
 
-                       if ($entry_album_list != "." && $entry_album_list != ".." && fnmatch("*",$entry_album_list)) {
-                               $show_album_list[] = $entry_album_list;
-                       }
-               }
-               closedir($dh_album_list);
+       if (file_exists("data/round.txt")) {
+               echo "<b class=\"rbtop\"><b class=\"rb1t\"></b><b class=\"rb2t\"></b><b class=\"rb3t\"></b><b class=\"rb4t\"></b></b><div class=\"xtitle\">";
+       }
+       else {
+               echo "<div id=\"panel_title\">";
        }
 
-       rsort($show_album_list);
-       reset($show_album_list);
-
-       $count_album_list = count($show_album_list);
-      
-       if ($count_album_list > 0) {
-
-               if (file_exists("data/round.txt")) {
-                       echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
-               }
-               else {
-                       echo '<div id="panel_title">';
-               }
-
-               echo 'Albums</div>';
-               echo '<div id="panel_body">';
+       echo "Albums</div><div id=\"panel_body\">";
 
-               foreach ($show_album_list as $album_list_entry) {
-                       echo "<a class=\"navlink\" href=\"{$_SERVER['PHP_SELF']}?entry=$album_list_entry&show=album\">";
-                       readfile("data/items/$album_list_entry/title.txt");
-                       echo "</a><br>";
-               }
-               echo '</div>';
+       foreach ($albums as $album) {
+               echo "<a class=\"navlink\" href=\"index.php?entry=$album&show=album\">";
+               readfile("data/items/$album/title.txt");
+               echo "</a><br>";
+       }
+       echo '</div>';
 
-               if (file_exists("data/round.txt")) {
-                       echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
-               }
+       if (file_exists("data/round.txt")) {
+               echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
        }
 }
+
 ?>
 
 <?php
 
 if (!file_exists("data/xrand.txt")) {
-
-       if ($dh_random_post_items = opendir("data/items")) {
-               while (($entry_random_post_items = readdir($dh_random_post_items)) !== false) {
-
-                       $today = date("YmdHis",time() + $offset);
-      
-                       if (($entry_random_post_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
-      
-                       if (file_exists("data/items/$entry_random_post_items/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
-      
-                       $cat_dir = file_get_contents("data/items/$entry_random_post_items/category.txt");
       
-                       if (file_exists("data/categories/$cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_random_post_items/cat.txt")) {
-                               continue;
-                       }
-      
-                       if ($entry_random_post_items != "." && $entry_random_post_items != ".." && fnmatch("*",$entry_random_post_items)) {
-                               $show_random_post_items[] = $entry_random_post_items;
-                       }
-               }
-               closedir($dh_random_post_items);
-       }
-      
-       shuffle($show_random_post_items);
-       reset($show_random_post_items);
+       shuffle($random);
+       reset($random);
 
-       $count_random_post_items = count($show_random_post_items);
-      
        if (file_exists("data/increase.txt")) {
-               $limit_random_post_entries = file_get_contents("data/increase.txt");
+               $limit_random = file_get_contents("data/increase.txt");
        }
        else {
-               $limit_random_post_entries = 5;
+               $limit_random = 5;
        }
       
-       if ($count_random_post_items > $limit_random_post_entries) {
+       if ($count_random > $limit_random) {
       
                if (file_exists("data/round.txt")) {
                        echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
@@ -4595,25 +4684,25 @@ if (!file_exists("data/xrand.txt")) {
       
                echo "Random Entries</div><div id=\"panel_body\">";
       
-               $increment_random_post_entries = 0;
+               $increment_random = 0;
       
-               if ($count_random_post_items <= $limit_random_post_entries * 2) {
-                       $show_random_post_entries = $count_random_post_items - 1;
+               if ($count_random <= $limit_random * 2) {
+                       $show_random = $count_random - 1;
                }
                else {
-                       $show_random_post_entries = $limit_random_post_entries * 2 - 1;
+                       $show_random = $limit_random * 2 - 1;
                }
       
-               while ($increment_random_post_entries <= $show_random_post_entries) {
-                       echo "<a class=\"navlink\" href=\"index.php?entry={$show_random_post_items[$increment_random_post_entries]}\">";
-                       readfile("data/items/$show_random_post_items[$increment_random_post_entries]/title.txt");
+               while ($increment_random <= $show_random) {
+                       echo "<a class=\"navlink\" href=\"index.php?entry={$random[$increment_random]}\">";
+                       readfile("data/items/$random[$increment_random]/title.txt");
                        echo "</a><br>";
       
-                       $increment_random_post_entries = $increment_random_post_entries + 1;
+                       $increment_random = $increment_random + 1;
                }
        }
       
-       if ($count_random_post_items > $limit_random_post_entries) {
+       if ($count_random > $limit_random) {
                echo "</div>";
       
                if (file_exists("data/round.txt")) {
@@ -4625,75 +4714,37 @@ if (!file_exists("data/xrand.txt")) {
 
 
 <?php
-if (file_exists("data/items")) {
-       if ($dh_archive_list = opendir("data/items")) {
-               while (($entry_archive_list = readdir($dh_archive_list)) !== false) {
-
-                       $today = date("YmdHis",time() + $offset);
-      
-                       if (($entry_archive_list > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
-
-                       if (file_exists("data/xarc.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
 
-                       if (file_exists("data/items/$entry_archive_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
+if (($count_archives > 0) and ($count_latest > $increase) and ($count_latest > 0)) {
 
-                       // hide member
-                       //if (file_exists("data/items/$entry_archive_list/member.txt") and (!isset($_SESSION['logged_in']))) {
-                       //      continue;
-                       //}
+       $archive_entries = implode(" ",$archives);
 
-                       $get_cat_dir = file_get_contents("data/items/$entry_archive_list/category.txt");
-
-                       if (file_exists("data/categories/$get_cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_archive_list/cat.txt")) {
-                               continue;
-                       }
+       $unique_archive_list = array_unique($archives);
 
-                       if ($entry_archive_list != "." && $entry_archive_list != ".." && fnmatch("*",$entry_archive_list)) {
-                               $entry_archive_list = substr("$entry_archive_list",0,6);
-                               $show_archive_list[] = $entry_archive_list;
-                       }
-               }
-               closedir($dh_archive_list);
+       if (file_exists("data/round.txt")) {
+               echo "<b class=\"rbtop\"><b class=\"rb1t\"></b><b class=\"rb2t\"></b><b class=\"rb3t\"></b><b class=\"rb4t\"></b></b><div class=\"xtitle\">";
+       }
+       else {
+               echo "<div id=\"panel_title\">";
        }
 
-       rsort($show_archive_list);
-       reset($show_archive_list);
-       $count_archive_list = count($show_archive_list);
-      
-       if (($count_archive_list > 0) and ($count_latest_items > $increase) and ($count_latest_items > 0)) {
-
-               $archive_entries = implode(" ",$show_archive_list);
-               $unique_archive_list = array_unique($show_archive_list);
+       echo "Archives ($count_archives)</div>";
+       echo "<div id=\"panel_body\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">";
 
-               if (file_exists("data/round.txt")) {
-                       echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
-               }
-               else {
-                       echo '<div id="panel_title">';
-               }
+       foreach ($unique_archive_list as $archive_list_entry) {
 
-               echo "Archives ($count_archive_list)</div>";
-               echo "<div id=\"panel_body\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">";
+               $archive_list_value = substr($archive_list_entry,0,6);
+               $archive_list_year = substr($archive_list_entry,0,4);
+               $archive_list_month = substr($archive_list_entry,4,2);
+               $archive_list_month = date("F",mktime(0,0,0,$archive_list_month));
+               $archive_list_num = substr_count($archive_entries,$archive_list_entry);
 
-               foreach ($unique_archive_list as $archive_list_entry) {
-                       $archive_list_value = substr($archive_list_entry,0,6);
-                       $archive_list_year = substr($archive_list_entry,0,4);
-                       $archive_list_month = substr($archive_list_entry,4,2);
-                       $archive_list_month = date("F",mktime(0,0,0,$archive_list_month));
-                       $archive_list_num = substr_count($archive_entries,$archive_list_entry);
-                       echo "<tr><td><a class=\"navlink\" href=\"index.php?archive=$archive_list_value\"><nobr>$archive_list_month $archive_list_year</nobr></a></td><td align=right>$archive_list_num</td></tr>";
-               }
-               echo "</table></div>";
+               echo "<tr><td><a class=\"navlink\" href=\"index.php?archive=$archive_list_value\"><nobr>$archive_list_month $archive_list_year</nobr></a></td><td align=right>$archive_list_num</td></tr>";
+       }
+       echo "</table></div>";
 
-               if (file_exists("data/round.txt")) {
-                       echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
-               }
+       if (file_exists("data/round.txt")) {
+               echo "<b class=\"rbbottom\"><b class=\"rb4b\"></b><b class=\"rb3b\"></b><b class=\"rb2b\"></b><b class=\"rb1b\"></b></b>";
        }
 }
 
@@ -4701,66 +4752,39 @@ if (file_exists("data/items")) {
 
 <?php
 
-if (file_exists("data/panels")) {
-
-       if ($dh_right_panel_list = opendir("data/panels")) {
+if ($count_right_panels > 0) {
 
-               while (($entry_right_panel_list = readdir($dh_right_panel_list)) !== false) {
+       foreach ($right_panels as $right_panel) {
 
-                       if (file_exists("data/panels/$entry_right_panel_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                               continue;
-                       }
+               if (!file_exists("data/panels/$right_panel/free.txt")) {
 
-                       if (!file_exists("data/panels/$entry_right_panel_list/right.txt")) {
-                               continue;
+                       if (file_exists("data/round.txt")) {
+                               echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
                        }
-
-                       if ($entry_right_panel_list != "." && $entry_right_panel_list != ".." && fnmatch("*",$entry_right_panel_list)) {
-                               $show_right_panel_list[] = $entry_right_panel_list;
+                       else {
+                               echo '<div id="panel_title">';
                        }
-               }
-               closedir($dh_right_panel_list);
-       }
-
-       sort($show_right_panel_list);
-       reset($show_right_panel_list);
-
-       $count_right_panel_list = count($show_right_panel_list);
-      
-       if ($count_right_panel_list > 0) {
-
-               foreach ($show_right_panel_list as $right_panel_list_entry) {
-
-                       if (!file_exists("data/panels/$right_panel_list_entry/free.txt")) {
-
-                               if (file_exists("data/round.txt")) {
-                                       echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
-                               }
-                               else {
-                                       echo '<div id="panel_title">';
-                               }
-
-                               readfile("data/panels/$right_panel_list_entry/title.txt");
 
-                               if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
-                                       echo "<a href=panels.php#{$right_panel_list_entry}>";
-                                       echo '<img src=images/widget.edit.png border=0 width=11 height=11 align=right></a>';
-                               }
+                       readfile("data/panels/$right_panel/title.txt");
 
-                               echo '</div><div id=panel_body>';
+                       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+                               echo "<a href=panels.php#{$right_panel}>";
+                               echo '<img src=images/widget.edit.png border=0 width=11 height=11 align=right></a>';
                        }
 
-                       if (file_exists("data/panels/$right_panel_list_entry/free.txt")) {
-                               echo '<div id=panel_free>';
-                       }
+                       echo '</div><div id=panel_body>';
+               }
 
-                       include("data/panels/$right_panel_list_entry/panel.php");
+               if (file_exists("data/panels/$right_panel/free.txt")) {
+                       echo '<div id=panel_free>';
+               }
 
-                       echo '</div>';
+               include("data/panels/$right_panel/panel.php");
 
-                       if (file_exists("data/round.txt") and !file_exists("data/panels/$right_panel_list_entry/free.txt")) {
-                               echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
-                       }
+               echo '</div>';
+
+               if (file_exists("data/round.txt") and !file_exists("data/panels/$right_panel/free.txt")) {
+                       echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
                }
        }
 }
@@ -4769,8 +4793,8 @@ if (file_exists("data/panels")) {
 
 <?php
 
-if ($count_latest_items > 0) {
-       echo '<p><table border="0" cellspacing="2" cellpadding="0" width="100%">';
+if ($count_latest > 0) {
+       echo '<table border="0" cellspacing="2" cellpadding="0" width="100%">';
        echo '<tr><td align="center"><a target="_button" href="http://maj.sourceforge.net/"><img src="images/button.maj.png" border="0" width="80" height="15"></a></td></tr>';
        echo '<tr><td align="center"><a target="_button" href="http://php.net/"><img src="images/button.php.png" border="0" width="80" height="15"></a></td></tr>';
 
@@ -4796,7 +4820,7 @@ if ($count_latest_items > 0) {
 
 ?>
 
-<p></p>
+</p>
 
 </td></tr>
 </table>
diff --git a/member.php b/member.php
index 7cb093a..b480732 100644
--- a/member.php
+++ b/member.php
@@ -1,23 +1,27 @@
 <?php
 
 session_start();
+
 header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
+
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
-               if (is_array($data)){
-                        foreach ($data as $key => $value){
-                                 $data[$key] = stripslashes_array($value);
-                        }
-                        return $data;
+               if (is_array($data)) {
+                       foreach ($data as $key => $value) {
+                               $data[$key] = stripslashes_array($value);
+                       }
+                       return $data;
                }
-               else{
-                        return stripslashes($data);
+               else {
+                       return stripslashes($data);
                }
        }
-
        $_POST = stripslashes_array($_POST);
 }
 
@@ -170,99 +174,97 @@ a:active {
 }
 </style>
 
-<?php if ($id == "all") {
-
-if (isset($_POST['edit']) and !empty($_POST['edit']) and ($_POST['edit'] == "on") and isset($_POST['username']) and !empty($_POST['username']) and file_exists("data/members/active/{$_POST['username']}") and isset($_SESSION['logged_in']) and !empty($_SESSION['logged_in']) and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
-
-       if (isset($_POST['rw']) and !empty($_POST['rw']) and ($_POST['rw'] == "on") and !file_exists("data/members/active/{$_POST['username']}/rw.txt")) {
-               touch("data/members/active/{$_POST['username']}/rw.txt");
-       }
-
-       if ((!isset($_POST['rw']) or empty($_POST['rw'])) and file_exists("data/members/active/{$_POST['username']}/rw.txt")) {
-               unlink("data/members/active/{$_POST['username']}/rw.txt");
-       }
-
-       if (isset($_POST['ul']) and !empty($_POST['ul']) and ($_POST['ul'] == "on") and !file_exists("data/members/active/{$_POST['username']}/ul.txt")) {
-               touch("data/members/active/{$_POST['username']}/ul.txt");
-       }
-
-       if ((!isset($_POST['ul']) or empty($_POST['ul'])) and file_exists("data/members/active/{$_POST['username']}/ul.txt")) {
-               unlink("data/members/active/{$_POST['username']}/ul.txt");
-       }
-
-       if (isset($_POST['noml']) and !empty($_POST['noml']) and ($_POST['noml'] == "on") and !file_exists("data/members/active/{$_POST['username']}/noml.txt")) {
-               touch("data/members/active/{$_POST['username']}/noml.txt");
-       }
-
-       if ((!isset($_POST['noml']) or empty($_POST['noml'])) and file_exists("data/members/active/{$_POST['username']}/noml.txt")) {
-               unlink("data/members/active/{$_POST['username']}/noml.txt");
-       }
-
-       if (isset($_POST['rank']) and !empty($_POST['rank']) and (strtolower($_POST['rank']) != "member")) {
-               $rank_file = "data/members/active/{$_POST['username']}/rank.txt";
-               $fp_rank_txt = fopen($rank_file,"w");
-               fwrite($fp_rank_txt,$_POST['rank']);
-               fclose($fp_rank_txt);
-       }
-
-       if ((!isset($_POST['rank']) or empty($_POST['rank'])) and file_exists("data/members/active/{$_POST['username']}/rank.txt")) {
-               unlink("data/members/active/{$_POST['username']}/rank.txt");
-       }
-
-       if (isset($_POST['category']) and !empty($_POST['category']) and (strtolower($_POST['category']) != "none") and (file_exists("data/categories/{$_POST['category']}"))) {
-               $category_file = "data/members/active/{$_POST['username']}/category.txt";
-               $fp_category_txt = fopen($category_file,"w");
-               fwrite($fp_category_txt,$_POST['category']);
-               fclose($fp_category_txt);
-       }
+<?php
 
-       if ((!isset($_POST['category']) or empty($_POST['category']) or ($_POST['category'] == "none")) and file_exists("data/members/active/{$_POST['username']}/category.txt")) {
-               unlink("data/members/active/{$_POST['username']}/category.txt");
-       }
+if ($id == "all") {
 
-       // start of upload privileges cleanup if ro and nocat (20071204)
-       if (file_exists("data/members/active/{$_POST['username']}/ul.txt") and !file_exists("data/members/active/{$_POST['username']}/rw.txt") and !file_exists("data/members/active/{$_POST['username']}/category.txt")) {
-               unlink("data/members/active/{$_POST['username']}/ul.txt");
-       }
-       // end of upload privileges cleanup if ro and nocat (20071204)
+       if (isset($_POST['edit']) and !empty($_POST['edit']) and ($_POST['edit'] == "on") and isset($_POST['username']) and !empty($_POST['username']) and file_exists("data/members/active/{$_POST['username']}") and isset($_SESSION['logged_in']) and !empty($_SESSION['logged_in']) and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
+      
+               if (isset($_POST['rw']) and !empty($_POST['rw']) and ($_POST['rw'] == "on") and !file_exists("data/members/active/{$_POST['username']}/rw.txt")) {
+                       touch("data/members/active/{$_POST['username']}/rw.txt");
+               }
+      
+               if ((!isset($_POST['rw']) or empty($_POST['rw'])) and file_exists("data/members/active/{$_POST['username']}/rw.txt")) {
+                       unlink("data/members/active/{$_POST['username']}/rw.txt");
+               }
+      
+               if (isset($_POST['ul']) and !empty($_POST['ul']) and ($_POST['ul'] == "on") and !file_exists("data/members/active/{$_POST['username']}/ul.txt")) {
+                       touch("data/members/active/{$_POST['username']}/ul.txt");
+               }
+      
+               if ((!isset($_POST['ul']) or empty($_POST['ul'])) and file_exists("data/members/active/{$_POST['username']}/ul.txt")) {
+                       unlink("data/members/active/{$_POST['username']}/ul.txt");
+               }
+      
+               if (isset($_POST['noml']) and !empty($_POST['noml']) and ($_POST['noml'] == "on") and !file_exists("data/members/active/{$_POST['username']}/noml.txt")) {
+                       touch("data/members/active/{$_POST['username']}/noml.txt");
+               }
+      
+               if ((!isset($_POST['noml']) or empty($_POST['noml'])) and file_exists("data/members/active/{$_POST['username']}/noml.txt")) {
+                       unlink("data/members/active/{$_POST['username']}/noml.txt");
+               }
+      
+               if (isset($_POST['rank']) and !empty($_POST['rank']) and (strtolower($_POST['rank']) != "member")) {
+                       $rank_file = "data/members/active/{$_POST['username']}/rank.txt";
+                       $fp_rank_txt = fopen($rank_file,"w");
+                       fwrite($fp_rank_txt,$_POST['rank']);
+                       fclose($fp_rank_txt);
+               }
+      
+               if ((!isset($_POST['rank']) or empty($_POST['rank'])) and file_exists("data/members/active/{$_POST['username']}/rank.txt")) {
+                       unlink("data/members/active/{$_POST['username']}/rank.txt");
+               }
+      
+               if (isset($_POST['category']) and !empty($_POST['category']) and (strtolower($_POST['category']) != "none") and (file_exists("data/categories/{$_POST['category']}"))) {
+                       $category_file = "data/members/active/{$_POST['username']}/category.txt";
+                       $fp_category_txt = fopen($category_file,"w");
+                       fwrite($fp_category_txt,$_POST['category']);
+                       fclose($fp_category_txt);
+               }
+      
+               if ((!isset($_POST['category']) or empty($_POST['category']) or ($_POST['category'] == "none")) and file_exists("data/members/active/{$_POST['username']}/category.txt")) {
+                       unlink("data/members/active/{$_POST['username']}/category.txt");
+               }
+      
+               if (file_exists("data/members/active/{$_POST['username']}/ul.txt") and !file_exists("data/members/active/{$_POST['username']}/rw.txt") and !file_exists("data/members/active/{$_POST['username']}/category.txt")) {
+                       unlink("data/members/active/{$_POST['username']}/ul.txt");
+               }
+      
+               if (isset($_POST['del']) and !empty($_POST['del']) and ($_POST['del'] == "on")) {
 
-       if (isset($_POST['del']) and !empty($_POST['del']) and ($_POST['del'] == "on")) {
-               function rmdirr($recurse_dirname)
-               {
-              
-                   if (!file_exists($recurse_dirname)) {
-                       return false;
-                   }
-              
-                   if (is_file($recurse_dirname)) {
-                       return unlink($recurse_dirname);
-                   }
+                       function rmdirr($recurse_dirname) {
               
-                   $recurse_dir = dir($recurse_dirname);
-                   while (false !== $recurse_entry = $recurse_dir->read()) {
+                               if (!file_exists($recurse_dirname)) {
+                                       return false;
+                               }
               
-                       if ($recurse_entry == '.' || $recurse_entry == '..') {
-                           continue;
-                       }
+                               if (is_file($recurse_dirname)) {
+                                       return unlink($recurse_dirname);
+                               }
               
-                       rmdirr("$recurse_dirname/$recurse_entry");
-                   }
+                               $recurse_dir = dir($recurse_dirname);
+
+                               while (false !== $recurse_entry = $recurse_dir->read()) {
               
-                   $recurse_dir->close();
-                   return rmdir($recurse_dirname);
+                                       if ($recurse_entry == '.' || $recurse_entry == '..') {
+                                               continue;
+                                       }
+                               rmdirr("$recurse_dirname/$recurse_entry");
+                       }
+                       $recurse_dir->close();
+                       return rmdir($recurse_dirname);
                }
                rmdirr("data/members/active/{$_POST['username']}");
        }
 }
 
-
 ?>
 
-<table border=0 cellspacing=0 cellpadding=0 bgcolor=#CCCCCC style="background-color: transparent;" width=640><tr><td><div id=panel_title>Members</div><div id=panel_body><table border=0 cellspacing=1 cellpadding=2 bgcolor=#cccccc width=628>
-<tr><td bgcolor=#eeeeee align=center><p>status</p></td><td bgcolor=#eeeeee align=center><p>username</p></td><td bgcolor=#eeeeee align=center><p>member since</p></td><td bgcolor=#eeeeee align=center><p>logins</p></td><td bgcolor=#eeeeee align=center><p>posts</p></td><?php
+<table border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC" style="background-color: transparent;" width="640"><tr><td><div id="panel_title">Members</div><div id="panel_body"><table border="0" cellspacing="1" cellpadding="2" bgcolor="#cccccc" width="628">
+<tr><td bgcolor="#eeeeee" align="center">status</td><td bgcolor="#eeeeee" align="center">username</td><td bgcolor="#eeeeee" align="center">member since</td><td bgcolor="#eeeeee" align="center">logins</td><td bgcolor="#eeeeee" align="center">posts</td><?php
 
 if (isset($_SESSION['logged_in']) and !empty($_SESSION['logged_in']) and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
-       echo "<td bgcolor=#eeeeee align=center><p>rw</p></td><td bgcolor=#eeeeee align=center><p>ul</p></td><td bgcolor=#eeeeee align=center><p>noml</p></td><td bgcolor=#eeeeee align=center><p>delete</p></td><td bgcolor=#eeeeee align=center><p>rank</p></td><td bgcolor=#eeeeee align=center><p>category</p></td><td bgcolor=#eeeeee align=center><p>action</p></td>";
+       echo '<td bgcolor="#eeeeee" align="center">rw</td><td bgcolor="#eeeeee" align="center">ul</td><td bgcolor="#eeeeee" align="center">noml</td><td bgcolor="#eeeeee" align="center">delete</td><td bgcolor="#eeeeee" align="center">rank</td><td bgcolor="#eeeeee" align="center">category</td><td bgcolor="#eeeeee" align="center">action</td>';
 }
 
 ?></tr>
@@ -274,7 +276,7 @@ $show_member_list[] = file_get_contents("data/username.txt");
 if (file_exists("data/members/active")) {
        if ($dh_member_list = opendir("data/members/active")) {
                while (($entry_member_list = readdir($dh_member_list)) !== false) {
-                       if ($entry_member_list != "." && $entry_member_list != ".." && fnmatch("*", $entry_member_list)) {
+                       if ($entry_member_list != "." && $entry_member_list != "..") {
                                $show_member_list[] = $entry_member_list;
                        }
                }
@@ -297,7 +299,8 @@ if (file_exists("data/members/active")) {
                }
 
                foreach ($show_member_list as $member_list_entry) {
-                       echo "<tr><td bgcolor=#ffffff align=center><p>";
+
+                       echo "<tr><td bgcolor=#ffffff align=center>";
 
                        $sess_count = 0;
 
@@ -329,10 +332,10 @@ if (file_exists("data/members/active")) {
                                echo "<img src=images/smileys/offline.png>";
                        }
                       
-                       echo "</p></td><td bgcolor=#ffffff><p><a href=member.php?id=$member_list_entry>$member_list_entry</a></p></td>";
+                       echo "</td><td bgcolor=#ffffff><a href=member.php?id=$member_list_entry>$member_list_entry</a></td>";
 
                        if ($member_list_entry == file_get_contents("data/username.txt") or (file_exists("data/members/active/$member_list_entry") and !file_exists("data/members/active/$member_list_entry/timestamp.txt"))) {
-                               echo "<td bgcolor=#ffffff align=center><p><nobr><code>-</code></nobr></p></td>";
+                               echo "<td bgcolor=#ffffff align=center><nobr><code>-</code></nobr></td>";
                        }
 
                        if (file_exists("data/members/active/$member_list_entry") and ($member_list_entry != file_get_contents("data/username.txt")) and file_exists("data/members/active/$member_list_entry/timestamp.txt")) {
@@ -341,60 +344,81 @@ if (file_exists("data/members/active")) {
                                $joined_month = substr($joined,4,2);
                                $joined_day = substr($joined,6,2);
                                $member_since = date("d M Y", mktime(0, 0, 0, $joined_month, $joined_day, $joined_year));
-                               echo "<td bgcolor=#ffffff align=center><p><nobr><code>$member_since</code></nobr></p></td>";
+                               echo "<td bgcolor=#ffffff align=center><nobr><code>$member_since</code></nobr></td>";
                        }
 
                        if ((file_get_contents("data/username.txt") == $member_list_entry) and file_exists("data/logins.txt")) {
                                $logins = file_get_contents("data/logins.txt");
-                               echo "<td bgcolor=#ffffff align=right><p><code>$logins</code></p></td>";
+                               echo "<td bgcolor=#ffffff align=right><code>$logins</code></td>";
                        }
                        elseif (file_exists("data/members/active/$member_list_entry") and file_exists("data/members/active/$member_list_entry/bb-logins.txt")) {
                                $logins = file_get_contents("data/members/active/$member_list_entry/bb-logins.txt");
-                               echo "<td bgcolor=#ffffff align=right><p><code>$logins</code></p></td>";
+                               echo "<td bgcolor=#ffffff align=right><code>$logins</code></td>";
                        }
 
                        if ((file_get_contents("data/username.txt") == $member_list_entry) and !file_exists("data/logins.txt")) {
-                               echo "<td bgcolor=#ffffff align=right><p><code>0</code></p></td>";
+                               echo "<td bgcolor=#ffffff align=right><code>0</code></td>";
                        }
                        elseif (file_exists("data/members/active/$member_list_entry") and !file_exists("data/members/active/$member_list_entry/bb-logins.txt")) {
-                               echo "<td bgcolor=#ffffff align=right><p><code>0</code></p></td>";
+                               echo "<td bgcolor=#ffffff align=right><code>0</code></td>";
                        }
 
-                       if ($dh_posts = opendir("data/items")) {
-                               while (($member_posts = readdir($dh_posts)) !== false) {
+                       if ($dh_posts_all = opendir("data/items")) {
 
-                                       if (file_exists("data/items/$member_posts/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                                               continue;
-                                       }
+                               while (($member_posts = readdir($dh_posts_all)) !== false) {
 
-                                       if (file_exists("data/items/$member_posts/member.txt") and (!isset($_SESSION['logged_in']))) {
-                                               continue;
-                                       }
+                                       if ($member_posts != "." && $member_posts != "..") {
 
-                                       $post_cat_dir = file_get_contents("data/items/$member_posts/category.txt");
+                                               if (file_exists("data/items/$member_posts/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                                                       continue;
+                                               }
 
-                                       if (file_exists("data/categories/$post_cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$member_posts/cat.txt")) {
-                                               continue;
-                                       }
+                                               $private_cat = "0";
+                      
+                                               if (file_exists("data/items/$member_posts/categories")) {
+                                      
+                                                       if ($dh_member_posts_cat2 = opendir("data/items/$member_posts/categories")) {
+                                              
+                                                               while (($member_posts_cat2 = readdir($dh_member_posts_cat2)) !== false) {
+                                              
+                                                                       if ($member_posts_cat2 != "." && $member_posts_cat2 != "..") {
+
+                                                                               if (file_exists("data/categories/$member_posts_cat2/private.txt")) {
+                                                                                       $private_cat = $private_cat + 1;
+                                                                               }
+                                                                       }
+                                                               }
+                                                               closedir($dh_member_posts_cat2);
+                                                       }
+                                               }
+              
+                                               if (($private_cat > 0) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$member_posts/cat.txt")) {
+                                                       continue;
+                                               }
                       
-                                       if ($member_posts != "." && $member_posts != ".." && fnmatch("*", $member_posts)) {
                                                if (file_exists("data/members/active/$member_list_entry") and file_exists("data/bb.txt")) {
+      
                                                        if (file_exists("data/items/$member_posts/author.txt") and (file_get_contents("data/items/$member_posts/author.txt") == $member_list_entry)) {
                                                                $items_posts[] = $member_posts;
                                                        }
                                                }
-                                               elseif (!file_exists("data/members/active/$member_list_entry") and (file_get_contents("data/username.txt") == $member_list_entry) and file_exists("data/bb.txt")) {
-                                                       if (file_exists("data/items/$member_posts/author.txt") and (file_get_contents("data/items/$member_posts/author.txt") == $member_list_entry)) {
-                                                               $items_posts[] = $member_posts;
+                                               else {
+                                                       if (!file_exists("data/members/active/$member_list_entry") and (file_get_contents("data/username.txt") == $member_list_entry) and file_exists("data/bb.txt")) {
+
+                                                               if (file_exists("data/items/$member_posts/author.txt") and (file_get_contents("data/items/$member_posts/author.txt") == $member_list_entry)) {
+                                                                       $items_posts[] = $member_posts;
+                                                               }
                                                        }
                                                }
                                        }
                                }
-                               closedir($dh_posts);
+                               closedir($dh_posts_all);
                        }
                       
                        $posts = count($items_posts);
-                       echo "<td bgcolor=#ffffff align=right><p><code>$posts</code></p></td>";
+
+                       echo "<td bgcolor=#ffffff align=right><code>$posts</code></td>";
+
                        unset($items_posts);
 
                        if (isset($_SESSION['logged_in']) and !empty($_SESSION['logged_in']) and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
@@ -402,26 +426,35 @@ if (file_exists("data/members/active")) {
                                if (($member_list_entry != file_get_contents("data/username.txt")) and file_exists("data/members/active/$member_list_entry")) {
 
                                        echo "<form action=member.php method=post><input type=hidden name=id value=all><input type=hidden name=edit value=on><input type=hidden name=username value=$member_list_entry>";
-                                       echo "<td bgcolor=#ffffff align=center><p><input type=checkbox name=rw";
+                                       echo "<td bgcolor=#ffffff align=center><input type=checkbox name=rw";
+
                                        if (file_exists("data/members/active/$member_list_entry/rw.txt")) {
                                                echo " checked";
                                        }
-                                       echo "></p></td><td bgcolor=#ffffff align=center><p><input type=checkbox name=ul";
+
+                                       echo "></td><td bgcolor=#ffffff align=center><input type=checkbox name=ul";
+
                                        if (file_exists("data/members/active/$member_list_entry/ul.txt")) {
                                                echo " checked";
                                        }
-                                       echo "></p></td><td bgcolor=#ffffff align=center><p><input type=checkbox name=noml";
+
+                                       echo "></td><td bgcolor=#ffffff align=center><input type=checkbox name=noml";
+
                                        if (file_exists("data/members/active/$member_list_entry/noml.txt")) {
                                                echo " checked";
                                        }
-                                       echo "></p></td><td bgcolor=#ffffff align=center><p><input type=checkbox name=del></p></td><td bgcolor=#ffffff align=center><p><input class=submit type=text name=rank autocomplete=off value=\"";
+
+                                       echo "></td><td bgcolor=#ffffff align=center><input type=checkbox name=del></td><td bgcolor=#ffffff align=center><input class=submit type=text name=rank autocomplete=off value=\"";
+
                                        if (file_exists("data/members/active/$member_list_entry/rank.txt")) {
                                                readfile("data/members/active/$member_list_entry/rank.txt");
                                        }
                                        else {
                                                echo member;
                                        }
-                                       echo "\"></p></td><td bgcolor=#ffffff><p><select name=category><option selected>";
+
+                                       echo "\"></td><td bgcolor=#ffffff><select name=category><option>none";
+
                                        if (file_exists("data/members/active/$member_list_entry/category.txt")) {
                                                $bb_cat = file_get_contents("data/members/active/$member_list_entry/category.txt");
                                                if (!file_exists("data/categories/$bb_cat")) {
@@ -429,48 +462,49 @@ if (file_exists("data/members/active")) {
                                                }
                                        }
 
-                                       if (file_exists("data/members/active/$member_list_entry/category.txt")) {
-                                               readfile("data/members/active/$member_list_entry/category.txt");
-                                               echo "<option>none";
-                                       }
+                                       if (file_exists("data/categories")) {
 
-                                       if (!file_exists("data/members/active/$member_list_entry/category.txt")) {
-                                               echo "none";
-                                       }
+                                               if ($dh_cat = opendir("data/categories")) {
 
-       if (file_exists("data/categories")) {
-               if ($dh_cat = opendir("data/categories")) {
-                       while (($entry_cat = readdir($dh_cat)) !== false) {
+                                                       while (($entry_cat = readdir($dh_cat)) !== false) {
 
-                               if ($entry_cat != "." && $entry_cat != ".." && fnmatch("*", $entry_cat)) {
-                                       $show_cat[] = $entry_cat;
-                               }
-                       }
-                       closedir($dh_cat);
-               }
+                                                               if ($entry_cat != "." && $entry_cat != "..") {
+                                                                       $show_cat[] = $entry_cat;
+                                                               }
+                                                       }
+                                                       closedir($dh_cat);
+                                               }
 
-               sort($show_cat);
-               reset($show_cat);
+                                               sort($show_cat);
+                                               reset($show_cat);
 
-               foreach ($show_cat as $category) {
-                       echo "<option>";
-                       echo strtolower($category);
-                       unset($show_cat);
-               }
-       }
+                                               foreach ($show_cat as $category) {
+                                                       echo "<option";
+
+                                                       if (file_get_contents("data/members/active/$member_list_entry/category.txt") == $category) {
+                                                               echo " selected";
+                                                       }
+
+                                                       echo ">";
+                                                       echo strtolower($category);
+                                                       unset($show_cat);
+                                               }
+                                       }
 
-                                       echo "</select></p></td><td bgcolor=#ffffff align=center><p><input class=submit type=submit value=submit></p></td></form>";
+                                       echo "</select></td><td bgcolor=#ffffff align=center><input class=submit type=submit value=submit></td></form>";
                                }
+
                                if ($member_list_entry == file_get_contents("data/username.txt")) {
-                                       echo "<td colspan=7 bgcolor=#ffffff align=center><p><a href=settings.php>administrator settings</a></p></td>";
+                                       echo "<td colspan=7 bgcolor=#ffffff align=center><a href=settings.php>administrator settings</a></td>";
                                }
                        }
                }
        }
 }
+
 ?>
 
-</table></div><div id=panel_footer><font style="font-size: 10px; color: #999999;"><a href=index.php>home</a> | <a href=member.php?id=all>members</a> | <a href=login.php>
+</table></div><div id="panel_footer"><font style="font-size: 10px; color: #999999;"><a href="index.php">home</a> | <a href="member.php?id=all">members</a> | <a href="login.php">
 <?php
 if (isset($_SESSION['logged_in'])) {
        echo "logout";
@@ -484,10 +518,16 @@ else {
 
 <?php exit(); } ?>
 
-<table border=0 cellspacing=0 cellpadding=0 bgcolor=#CCCCCC style="background-color: transparent;"><tr><td width=525><div id=panel_title><?php
+<table border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC" style="background-color: transparent;">
+<tr><td width="525">
+<div id="panel_title">
+
+<?php
 
 if (file_get_contents("data/username.txt") == $id) {
+
        readfile("data/author.txt");
+
        if (isset($_SESSION['logged_in']) and !empty($_SESSION['logged_in']) and ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) and !file_exists("data/members/active/{$_SESSION['logged_in']}")) {
                echo " &lt;";
                readfile("data/email.txt");
@@ -504,14 +544,19 @@ else {
 
 }
 
+?>
 
-?></div><div id=panel_body><table border=0 cellspacing=0 cellpadding=0><tr><td width=90 valign=top><p>
+</div>
 
-<?php
+<div id="panel_body">
+<table border="0" cellspacing="0" cellpadding="0"><tr><td width="90" valign="top">
 
+<?php
 
 if ((file_get_contents("data/username.txt") == $id) and (file_exists("images/avatar.jpg") or file_exists("images/avatar.gif") or file_exists("images/avatar.png"))) {
+
        if (file_exists("images/avatar.gif")) {
+
                $avatar_gif_image_size = getimagesize("images/avatar.gif");
                $avatar_gif_image_width = $avatar_gif_image_size[0];
                $avatar_gif_image_height = $avatar_gif_image_size[1];
@@ -523,13 +568,11 @@ if ((file_get_contents("data/username.txt") == $id) and (file_exists("images/ava
                        $avatar_gif_image_width = (int) ($avatar_gif_image_width * $sizefactor);
                        $avatar_gif_image_height = (int) ($avatar_gif_image_height * $sizefactor);
                }
-
-               echo "<img src=images/avatar.gif border=0 width=";
-               echo $avatar_gif_image_width;
-               echo " height=";
-               echo $avatar_gif_image_height;
+               echo "<img src=\"images/avatar.gif\" border=\"0\" width=\"$avatar_gif_image_width\" height=\"$avatar_gif_image_height\">";
        }
+
        if (file_exists("images/avatar.jpg")) {
+
                $avatar_jpg_image_size = getimagesize("images/avatar.jpg");
                $avatar_jpg_image_width = $avatar_jpg_image_size[0];
                $avatar_jpg_image_height = $avatar_jpg_image_size[1];
@@ -541,13 +584,11 @@ if ((file_get_contents("data/username.txt") == $id) and (file_exists("images/ava
                        $avatar_jpg_image_width = (int) ($avatar_jpg_image_width * $sizefactor);
                        $avatar_jpg_image_height = (int) ($avatar_jpg_image_height * $sizefactor);
                }
-
-               echo "<img src=images/avatar.jpg border=0 width=";
-               echo $avatar_jpg_image_width;
-               echo " height=";
-               echo $avatar_jpg_image_height;
+               echo "<img src=\"images/avatar.jpg\" border=\"0\" width=\"$avatar_jpg_image_width\" height=\"$avatar_jpg_image_height\">";
        }
+
        if (file_exists("images/avatar.png")) {
+
                $avatar_png_image_size = getimagesize("images/avatar.png");
                $avatar_png_image_width = $avatar_png_image_size[0];
                $avatar_png_image_height = $avatar_png_image_size[1];
@@ -559,71 +600,66 @@ if ((file_get_contents("data/username.txt") == $id) and (file_exists("images/ava
                        $avatar_png_image_width = (int) ($avatar_png_image_width * $sizefactor);
                        $avatar_png_image_height = (int) ($avatar_png_image_height * $sizefactor);
                }
-                      
-               echo "<img src=images/avatar.png border=0 width=";
-               echo $avatar_png_image_width;
-               echo " height=";
-               echo $avatar_png_image_height;
+               echo "<img src=\"images/avatar.png\" border=\"0\" width=\"$avatar_png_image_width\" height=\"$avatar_png_image_height\">";
        }
-echo "><br>";
+       echo "<br>";
 }
-elseif (file_exists("images/members/$id/avatar.jpg") or file_exists("images/members/$id/avatar.gif") or file_exists("images/members/$id/avatar.png")) {
-       if (file_exists("images/members/$id/avatar.gif")) {
-               $avatar_gif_image_size = getimagesize("images/members/$id/avatar.gif");
-               $avatar_gif_image_width = $avatar_gif_image_size[0];
-               $avatar_gif_image_height = $avatar_gif_image_size[1];
+else {
 
-               $max_avatar_gif_image_width = 80;
-                      
-               if ($avatar_gif_image_width > $max_avatar_gif_image_width) {  
-                       $sizefactor = (double) ($max_avatar_gif_image_width / $avatar_gif_image_width) ;
-                       $avatar_gif_image_width = (int) ($avatar_gif_image_width * $sizefactor);
-                       $avatar_gif_image_height = (int) ($avatar_gif_image_height * $sizefactor);
+       if (file_exists("images/members/$id/avatar.jpg") or file_exists("images/members/$id/avatar.gif") or file_exists("images/members/$id/avatar.png")) {
+      
+               if (file_exists("images/members/$id/avatar.gif")) {
+
+                       $avatar_gif_image_size = getimagesize("images/members/$id/avatar.gif");
+                       $avatar_gif_image_width = $avatar_gif_image_size[0];
+                       $avatar_gif_image_height = $avatar_gif_image_size[1];
+      
+                       $max_avatar_gif_image_width = 80;
+                              
+                       if ($avatar_gif_image_width > $max_avatar_gif_image_width) {  
+                               $sizefactor = (double) ($max_avatar_gif_image_width / $avatar_gif_image_width) ;
+                               $avatar_gif_image_width = (int) ($avatar_gif_image_width * $sizefactor);
+                               $avatar_gif_image_height = (int) ($avatar_gif_image_height * $sizefactor);
+                       }
+                       echo "<img src=\"images/members/$id/avatar.gif\" border=\"0\" width=\"$avatar_gif_image_width\" height=\"$avatar_gif_image_height\">";
                }
 
-               echo "<img src=images/members/$id/avatar.gif border=0 width=";
-               echo $avatar_gif_image_width;
-               echo " height=";
-               echo $avatar_gif_image_height;
-       }
-       if (file_exists("images/members/$id/avatar.jpg")) {
-               $avatar_jpg_image_size = getimagesize("images/members/$id/avatar.jpg");
-               $avatar_jpg_image_width = $avatar_jpg_image_size[0];
-               $avatar_jpg_image_height = $avatar_jpg_image_size[1];
+
+               if (file_exists("images/members/$id/avatar.jpg")) {
+
+                       $avatar_jpg_image_size = getimagesize("images/members/$id/avatar.jpg");
+                       $avatar_jpg_image_width = $avatar_jpg_image_size[0];
+                       $avatar_jpg_image_height = $avatar_jpg_image_size[1];
                       
-               $max_avatar_jpg_image_width = 80;
+                       $max_avatar_jpg_image_width = 80;
                       
-               if ($avatar_jpg_image_width > $max_avatar_jpg_image_width) {  
-                       $sizefactor = (double) ($max_avatar_jpg_image_width / $avatar_jpg_image_width) ;
-                       $avatar_jpg_image_width = (int) ($avatar_jpg_image_width * $sizefactor);
-                       $avatar_jpg_image_height = (int) ($avatar_jpg_image_height * $sizefactor);
+                       if ($avatar_jpg_image_width > $max_avatar_jpg_image_width) {  
+                               $sizefactor = (double) ($max_avatar_jpg_image_width / $avatar_jpg_image_width) ;
+                               $avatar_jpg_image_width = (int) ($avatar_jpg_image_width * $sizefactor);
+                               $avatar_jpg_image_height = (int) ($avatar_jpg_image_height * $sizefactor);
+                       }
+                       echo "<img src=\"images/members/$id/avatar.jpg\" border=\"0\" width=\"$avatar_jpg_image_width\" height=\"$avatar_jpg_image_height\">";
                }
 
-               echo "<img src=images/members/$id/avatar.jpg border=0 width=";
-               echo $avatar_jpg_image_width;
-               echo " height=";
-               echo $avatar_jpg_image_height;
-       }
-       if (file_exists("images/members/$id/avatar.png")) {
-               $avatar_png_image_size = getimagesize("images/members/$id/avatar.png");
-               $avatar_png_image_width = $avatar_png_image_size[0];
-               $avatar_png_image_height = $avatar_png_image_size[1];
+               if (file_exists("images/members/$id/avatar.png")) {
+
+                       $avatar_png_image_size = getimagesize("images/members/$id/avatar.png");
+                       $avatar_png_image_width = $avatar_png_image_size[0];
+                       $avatar_png_image_height = $avatar_png_image_size[1];
                       
-               $max_avatar_png_image_width = 80;
+                       $max_avatar_png_image_width = 80;
                       
-               if ($avatar_png_image_width > $max_avatar_png_image_width) {  
-                       $sizefactor = (double) ($max_avatar_png_image_width / $avatar_png_image_width) ;
-                       $avatar_png_image_width = (int) ($avatar_png_image_width * $sizefactor);
-                       $avatar_png_image_height = (int) ($avatar_png_image_height * $sizefactor);
+                       if ($avatar_png_image_width > $max_avatar_png_image_width) {  
+                               $sizefactor = (double) ($max_avatar_png_image_width / $avatar_png_image_width) ;
+                               $avatar_png_image_width = (int) ($avatar_png_image_width * $sizefactor);
+                               $avatar_png_image_height = (int) ($avatar_png_image_height * $sizefactor);
+                       }
+                       echo "<img src=\"images/members/$id/avatar.png\" border=\"0\" width=\"$avatar_png_image_width\" height=\"$avatar_png_image_height\">";
                }
-                      
-               echo "<img src=images/members/$id/avatar.png border=0 width=";
-               echo $avatar_png_image_width;
-               echo " height=";
-               echo $avatar_png_image_height;
+               echo "<br>";
        }
-echo "><br>";
 }
+
 echo "<b>$id</b><br>";
 
 if ((file_get_contents("data/username.txt") == $id) and file_exists("data/rank.txt")) {
@@ -640,16 +676,17 @@ elseif (!file_exists("data/members/active/$id/rank.txt") and file_exists("data/r
 ?>
 
 
-</p></td><td width=435 valign=top><table border=0 cellspacing=0 cellpadding=2>
+</td><td width="435" valign="top"><table border="0" cellspacing="0" cellpadding="2">
 
 <?php
+
 if ((file_get_contents("data/username.txt") == $id) and file_exists("data/url.txt") and isset($_SESSION['logged_in']) and !empty($_SESSION['logged_in'])) {
        $member_url = file_get_contents("data/url.txt");
-       echo "<tr><td width=90><p>website</p></td><td><p><a href=$member_url target=_majbb><code>$member_url</code></a></p></td></tr>";
+       echo "<tr><td width=90>website</td><td><a href=$member_url target=_majbb><code>$member_url</code></a></td></tr>";
 }
 elseif (file_exists("data/members/active/$id/url.txt") and isset($_SESSION['logged_in']) and !empty($_SESSION['logged_in'])) {
        $member_url = file_get_contents("data/members/active/$id/url.txt");
-       echo "<tr><td width=90><p>website</p></td><td><p><a href=$member_url target=_majbb><code>$member_url</code></a></p></td></tr>";
+       echo "<tr><td width=90>website</td><td><a href=$member_url target=_majbb><code>$member_url</code></a></td></tr>";
 }
 
 if (file_exists("data/members/active/$id/bday.txt") and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
@@ -658,7 +695,7 @@ if (file_exists("data/members/active/$id/bday.txt") and ($_SESSION['logged_in']
        $bday_month = substr($bday,4,2);
        $bday_day = substr($bday,6,2);
        $bday = date("d M Y [D]", mktime(0, 0, 0, $bday_month, $bday_day, $bday_year));
-       echo "<tr><td width=90><p>birthdate</p></td><td><p><code>$bday</code></p></td></tr>";
+       echo "<tr><td width=90>birthdate</td><td><code>$bday</code></td></tr>";
 }
 
 if (file_exists("data/members/active/$id/timestamp.txt")) {
@@ -669,7 +706,7 @@ if (file_exists("data/members/active/$id/timestamp.txt")) {
        $joined_hh = substr($joined,8,2);
        $joined_mm = substr($joined,10,2);
        $member_since = date("d M Y H:i", mktime($joined_hh, $joined_mm, 0, $joined_month, $joined_day, $joined_year));
-       echo "<tr><td width=90><p>member since</p></td><td><p><code>$member_since</code></p></td></tr>";
+       echo "<tr><td width=90>member since</td><td><code>$member_since</code></td></tr>";
 }
 
 if ((file_get_contents("data/username.txt") == $id) and file_exists("data/lastlog.txt")) {
@@ -680,7 +717,7 @@ if ((file_get_contents("data/username.txt") == $id) and file_exists("data/lastlo
        $lastlog_hh = substr($lastlog,8,2);
        $lastlog_mm = substr($lastlog,10,2);
        $last_login = date("d M Y H:i", mktime($lastlog_hh, $lastlog_mm, 0, $lastlog_month, $lastlog_day, $lastlog_year));
-       echo "<tr><td width=90><p>last login</p></td><td><p><code>$last_login</code></p></td></tr>";
+       echo "<tr><td width=90>last login</td><td><code>$last_login</code></td></tr>";
 }
 elseif (file_exists("data/members/active/$id/bb-last.txt")) {
        $lastlog = file_get_contents("data/members/active/$id/bb-last.txt");
@@ -690,7 +727,7 @@ elseif (file_exists("data/members/active/$id/bb-last.txt")) {
        $lastlog_hh = substr($lastlog,8,2);
        $lastlog_mm = substr($lastlog,10,2);
        $last_login = date("d M Y H:i", mktime($lastlog_hh, $lastlog_mm, 0, $lastlog_month, $lastlog_day, $lastlog_year));
-       echo "<tr><td width=90><p>last login</p></td><td><p><code>$last_login</code></p></td></tr>";
+       echo "<tr><td width=90>last login</td><td><code>$last_login</code></td></tr>";
 }
 
 if ((file_get_contents("data/username.txt") == $id) and file_exists("data/lastpost.txt")) {
@@ -701,7 +738,7 @@ if ((file_get_contents("data/username.txt") == $id) and file_exists("data/lastpo
        $lastpost_hh = substr($lastpost,8,2);
        $lastpost_mm = substr($lastpost,10,2);
        $last_post = date("d M Y H:i", mktime($lastpost_hh, $lastpost_mm, 0, $lastpost_month, $lastpost_day, $lastpost_year));
-       echo "<tr><td width=90><p>last post</p></td><td><p><code>$last_post</code></p></td></tr>";
+       echo "<tr><td width=90>last post</td><td><code>$last_post</code></td></tr>";
 }
 elseif (file_exists("data/members/active/$id/bb-post.txt")) {
        $lastpost = file_get_contents("data/members/active/$id/bb-post.txt");
@@ -711,7 +748,7 @@ elseif (file_exists("data/members/active/$id/bb-post.txt")) {
        $lastpost_hh = substr($lastpost,8,2);
        $lastpost_mm = substr($lastpost,10,2);
        $last_post = date("d M Y H:i", mktime($lastpost_hh, $lastpost_mm, 0, $lastpost_month, $lastpost_day, $lastpost_year));
-       echo "<tr><td width=90><p>last post</p></td><td><p><code>$last_post</code></p></td></tr>";
+       echo "<tr><td width=90>last post</td><td><code>$last_post</code></td></tr>";
 }
 
 if (file_get_contents("data/username.txt") == $id) {
@@ -727,16 +764,19 @@ if (file_get_contents("data/username.txt") == $id) {
                fwrite($views_file, $views);
                fclose($views_file);
        }
-       echo "<tr><td width=90><p>profile views</p></td><td><p><code>$views</code></p></td></tr>";
+       echo "<tr><td width=90>profile views</td><td><code>$views</code></td></tr>";
 }
 elseif (file_exists("data/members/active/$id")) {
+
        if (!file_exists("data/members/active/$id/bb-views.txt")) {
                $views = 0;
        }
        else {
                $views = file_get_contents("data/members/active/$id/bb-views.txt");
        }
+
        if (!isset($_SESSION['logged_in']) or empty($_SESSION['logged_in']) or (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $id))) {
+
                if (!isset($_SESSION['logged_in']) or empty($_SESSION['logged_in']) or (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != file_get_contents("data/username.txt")))) {
                        $views = $views + 1;
                        $views_file = fopen("data/members/active/$id/bb-views.txt", "w");
@@ -744,47 +784,61 @@ elseif (file_exists("data/members/active/$id")) {
                        fclose($views_file);
                }
        }
-       echo "<tr><td width=90><p>profile views</p></td><td><p><code>$views</code></p></td></tr>";
+       echo "<tr><td width=90>profile views</td><td><code>$views</code></td></tr>";
 }
 
 if ((file_get_contents("data/username.txt") == $id) and file_exists("data/logins.txt")) {
        $logins = file_get_contents("data/logins.txt");
-       echo "<tr><td width=90><p>total logins</p></td><td><p><code>$logins</code></p></td></tr>";
+       echo "<tr><td width=90>total logins</td><td><code>$logins</code></td></tr>";
 }
 elseif (file_exists("data/members/active/$id") and file_exists("data/members/active/$id/bb-logins.txt")) {
        $logins = file_get_contents("data/members/active/$id/bb-logins.txt");
-       echo "<tr><td width=90><p>total logins</p></td><td><p><code>$logins</code></p></td></tr>";
+       echo "<tr><td width=90>total logins</td><td><code>$logins</code></td></tr>";
 }
 
 if ($dh_posts = opendir("data/items")) {
+
        while (($member_posts = readdir($dh_posts)) !== false) {
 
                if ($member_posts != "." && $member_posts != "..") {
+      
                        $total_posts[] = $member_posts;
-               }
-
-               if (file_exists("data/items/$member_posts/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
-                       continue;
-               }
-
-               // hide_member (20070606)
-               //if (file_exists("data/items/$member_posts/member.txt") and (!isset($_SESSION['logged_in']))) {
-               //      continue;
-               //}
-
-               $post_cat_dir = file_get_contents("data/items/$member_posts/category.txt");
-
-               if (file_exists("data/categories/$post_cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$member_posts/cat.txt")) {
-                       continue;
-               }
-
-               if ($member_posts != "." && $member_posts != ".." && fnmatch("*", $member_posts)) {
+      
+                       if (file_exists("data/items/$member_posts/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                               continue;
+                       }
+      
+                       $private_cat = "0";
+                              
+                       if (file_exists("data/items/$member_posts/categories")) {
+                                              
+                               if ($dh_member_posts_cat2 = opendir("data/items/$member_posts/categories")) {
+                                                      
+                                       while (($member_posts_cat2 = readdir($dh_member_posts_cat2)) !== false) {
+                                                      
+                                               if ($member_posts_cat2 != "." && $member_posts_cat2 != "..") {
+      
+                                                       if (file_exists("data/categories/$member_posts_cat2/private.txt")) {
+                                                               $private_cat = $private_cat + 1;
+                                                       }
+                                               }
+                                       }
+                                       closedir($dh_member_posts_cat2);
+                               }
+                       }
+                      
+                       if (($private_cat > 0) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$member_posts/cat.txt")) {
+                               continue;
+                       }
+      
                        if (file_exists("data/members/active/$id") and file_exists("data/bb.txt")) {
+
                                if (file_exists("data/items/$member_posts/author.txt") and (file_get_contents("data/items/$member_posts/author.txt") == $id)) {
                                        $items_posts[] = $member_posts;
                                }
                        }
                        elseif (!file_exists("data/members/active/$id") and (file_get_contents("data/username.txt") == $id) and file_exists("data/bb.txt")) {
+
                                if (file_exists("data/items/$member_posts/author.txt") and (file_get_contents("data/items/$member_posts/author.txt") == $id)) {
                                        $items_posts[] = $member_posts;
                                }
@@ -798,22 +852,29 @@ $posts = count($items_posts);
 $all_posts = count($total_posts);
 $ratio_posts = (($posts/$all_posts) * 100);
 $ratio_posts = number_format($ratio_posts,2);
-echo "<tr><td width=90><p>total posts</p></td><td><p><code>$posts</code></p></td></tr>";
-echo "<tr><td width=90><p>&nbsp;</p></td><td><p><code>{$ratio_posts}% of total</code></p></td></tr>";
+
+echo "<tr><td width=90>total posts</td><td><code>$posts</code></td></tr>";
+echo "<tr><td width=90>&nbsp;</td><td><code>{$ratio_posts}% of total</code></td></tr>";
+
 if ($posts > 0) {
-       echo "<tr><td width=90><p>&nbsp;</p></td><td><p><a href=index.php?author=$id><code>find all posts by $id</code></a></p></td></tr>";
+       echo "<tr><td width=90>&nbsp;</td><td><a href=index.php?author=$id><code>find all posts by $id</code></a></td></tr>";
 }
+
 unset($items_posts);
 unset($total_posts);
 
 ?>
 
-<tr><td><p>permissions</p></td><td><p><code>
+<tr><td>permissions</td><td><code>
+
 <?php
+
 if ($id == file_get_contents("data/username.txt")) {
        echo "rw";
 }
+
 if (($id != file_get_contents("data/username.txt")) and file_exists("data/members/active/$id")) {
+
        if (file_exists("data/members/active/$id/rw.txt")) {
                echo "rw";
        }
@@ -821,38 +882,53 @@ if (($id != file_get_contents("data/username.txt")) and file_exists("data/member
                echo "ro";
        }
 }
+
 if (($id != file_get_contents("data/username.txt")) and file_exists("data/members/active/$id")) {
+
        if (file_exists("data/members/active/$id/ul.txt")) {
                echo " upload";
        }
 }
+
 ?>
-</code></p></td></tr>
+
+</code></td></tr>
+
 <?php
+
 if (($id != file_get_contents("data/username.txt")) and file_exists("data/members/active/$id")) {
 
        if (file_exists("data/members/active/$id/category.txt")) {
+
                $bb_cat = file_get_contents("data/members/active/$id/category.txt");
+
                if (!file_exists("data/categories/$bb_cat")) {
                        unlink("data/members/active/$id/category.txt");
                }
        }
 
        if (file_exists("data/members/active/$id/category.txt")) {
-               echo "<tr><td><p>group (rw)</p></td><td><p><code>";
+
+               echo "<tr><td>group (rw)</td><td><code>";
+
                $category_name = file_get_contents("data/members/active/$id/category.txt");
+
                if (file_exists("data/categories/$category_name/title.txt")) {
                        readfile("data/categories/$category_name/title.txt");
                }
                else {
                        echo $category_name;
                }
-               echo "</code></p></td></tr>";
+               echo "</code></td></tr>";
        }
 }
+
 ?>
-<tr><td><p>status</p></td><td><p><code>
+
+<tr><td>status</td><td><code>
+
 <?php
+
 $sess_dir = session_save_path();
 
 if (file_exists("data/bb-idle.txt")) {
@@ -865,14 +941,19 @@ else {
 $sess_count = 0;
 
 if (is_dir($sess_dir)) {
+
        if ($sess_dh = opendir($sess_dir)) {
+
                while (($sess_file = readdir($sess_dh)) !== false) {
+
                        if ($sess_file != '.' && $sess_file != '..') {
+
                                if ((time() - fileatime("$sess_dir/$sess_file")) < ($idle * 60)) {
                       
                                        $sess_content = file_get_contents("$sess_dir/$sess_file");
                       
                                        if (preg_match("/logged_in/",$sess_content)) {
+
                                                if (preg_match("/$id/",$sess_content)) {
                                                        $sess_count++;
                                                }
@@ -890,18 +971,25 @@ if (($sess_count > 0) or (isset($_SESSION['logged_in']) and !empty($_SESSION['lo
 else {
        echo "offline";
 }
+
 ?>
-</code></p></td></tr>
+
+</code></td></tr>
 
 </table></td></tr></table></div>
-<div id=panel_footer><font style="font-size: 10px; color: #999999;"><a href=index.php>home</a> | <a href=member.php?id=all>members</a> | <a href=login.php>
+
+<div id="panel_footer"><font style="font-size: 10px; color: #999999;"><a href="index.php">home</a> | <a href="member.php?id=all">members</a> | <a href="login.php">
+
 <?php
+
 if (isset($_SESSION['logged_in'])) {
        echo "logout";
 }
 else {
        echo "login";
 }
+
 ?>
+
 </a></font></div>
 </td></tr></table>
diff --git a/move.php b/move.php
index 2165d06..05c47b2 100644
--- a/move.php
+++ b/move.php
@@ -6,13 +6,14 @@ header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
-if (get_magic_quotes_gpc()) {
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
 
+if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
-
                if (is_array($data)) {
-
-                       foreach ($data as $key => $value){
+                       foreach ($data as $key => $value) {
                                $data[$key] = stripslashes_array($value);
                        }
                        return $data;
@@ -21,7 +22,6 @@ if (get_magic_quotes_gpc()) {
                        return stripslashes($data);
                }
        }
-
        $_REQUEST = stripslashes_array($_REQUEST);
 }
 
diff --git a/options.php b/options.php
index 37fdc3f..f19fc70 100644
--- a/options.php
+++ b/options.php
@@ -1,23 +1,27 @@
 <?php
 
 session_start();
+
 header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
+
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
-               if (is_array($data)){
-                        foreach ($data as $key => $value){
-                                 $data[$key] = stripslashes_array($value);
-                        }
-                        return $data;
+               if (is_array($data)) {
+                       foreach ($data as $key => $value) {
+                               $data[$key] = stripslashes_array($value);
+                       }
+                       return $data;
                }
-               else{
-                        return stripslashes($data);
+               else {
+                       return stripslashes($data);
                }
        }
-
        $_POST = stripslashes_array($_POST);
 }
 
diff --git a/panels.php b/panels.php
index 5fb391e..c3be8f2 100644
--- a/panels.php
+++ b/panels.php
@@ -6,21 +6,22 @@ header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
-if (get_magic_quotes_gpc()) {
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
 
+if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
-
-               if (is_array($data)){
-                        foreach ($data as $key => $value){
-                                 $data[$key] = stripslashes_array($value);
-                        }
-                        return $data;
+               if (is_array($data)) {
+                       foreach ($data as $key => $value) {
+                               $data[$key] = stripslashes_array($value);
+                       }
+                       return $data;
                }
-               else{
-                        return stripslashes($data);
+               else {
+                       return stripslashes($data);
                }
        }
-
        $_POST = stripslashes_array($_POST);
 }
 
diff --git a/reg.php b/reg.php
index 750b09b..1ea3735 100644
--- a/reg.php
+++ b/reg.php
@@ -12,17 +12,16 @@ error_reporting(E_ERROR);
 
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
-               if (is_array($data)){
-                        foreach ($data as $key => $value){
-                                 $data[$key] = stripslashes_array($value);
-                        }
-                        return $data;
+               if (is_array($data)) {
+                       foreach ($data as $key => $value) {
+                               $data[$key] = stripslashes_array($value);
+                       }
+                       return $data;
                }
-               else{
-                        return stripslashes($data);
+               else {
+                       return stripslashes($data);
                }
        }
-
        $_REQUEST = stripslashes_array($_REQUEST);
 }
 
@@ -121,8 +120,6 @@ a:active {
 
 <?php
 
-// 20061014 - reg.php
-
 function str_rand($length = 8, $seeds = 'abcdefghijklmnopqrstuvwxyz0123456789') {
        $str = '';
        $seeds_count = strlen($seeds);
diff --git a/rel.txt b/rel.txt
new file mode 100644
index 0000000..692f135
--- /dev/null
+++ b/rel.txt
@@ -0,0 +1 @@
+20081123
\ No newline at end of file
diff --git a/reset.php b/reset.php
index 4854557..37ac2b0 100644
--- a/reset.php
+++ b/reset.php
@@ -2,8 +2,6 @@
 
 session_start();
 
-//session_regenerate_id();
-
 header("Cache-control: private");
 
 if (file_exists("data/lite.txt")) {
@@ -18,17 +16,16 @@ error_reporting(E_ERROR);
 
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
-               if (is_array($data)){
-                        foreach ($data as $key => $value){
-                                 $data[$key] = stripslashes_array($value);
-                        }
-                        return $data;
+               if (is_array($data)) {
+                       foreach ($data as $key => $value) {
+                               $data[$key] = stripslashes_array($value);
+                       }
+                       return $data;
                }
-               else{
-                        return stripslashes($data);
+               else {
+                       return stripslashes($data);
                }
        }
-
        $_POST = stripslashes_array($_POST);
 }
 
diff --git a/rss.php b/rss.php
index fb8423f..ed3c5d6 100644
--- a/rss.php
+++ b/rss.php
@@ -4,17 +4,16 @@ error_reporting(E_ERROR);
 
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
-               if (is_array($data)){
-                        foreach ($data as $key => $value){
-                                 $data[$key] = stripslashes_array($value);
-                        }
-                        return $data;
+               if (is_array($data)) {
+                       foreach ($data as $key => $value) {
+                               $data[$key] = stripslashes_array($value);
+                       }
+                       return $data;
                }
-               else{
-                        return stripslashes($data);
+               else {
+                       return stripslashes($data);
                }
        }
-
        $_REQUEST = stripslashes_array($_REQUEST);
 }
 
@@ -66,12 +65,29 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
                                continue;
                        }
 
-                       $cat_dir = file_get_contents("data/items/$entry_rss_items/category.txt");
+                       $private = "0";
 
-                       if (file_exists("data/categories/$cat_dir/private.txt") and !file_exists("data/items/$entry_rss_items/cat.txt")) {
-                               continue;
+                       if (file_exists("data/items/$entry_rss_items/categories")) {
+                      
+                               if ($dh_cat_rss = opendir("data/items/$entry_rss_items/categories")) {
+                      
+                                       while (($entry_cat_rss = readdir($dh_cat_rss)) !== false) {
+                      
+                                               if ($entry_cat_rss != "." && $entry_cat_rss != "..") {
+                      
+                                                       if (file_exists("data/categories/$entry_cat_rss/private.txt")) {
+                                                               $private = $private + 1;
+                                                       }
+                                               }
+                                       }
+                                       closedir($dh_cat_rss);
+                               }
                        }
 
+                       if (($private > 0) and !file_exists("data/items/$entry_rss_items/cat.txt")) {
+                               continue;
+                       }
+                      
                        if (file_exists("data/items/$entry_rss_items/passwd.txt")) {
                                continue;
                        }
diff --git a/settings.php b/settings.php
index bde310e..ba176b4 100644
--- a/settings.php
+++ b/settings.php
@@ -6,10 +6,14 @@ header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
+
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
                if (is_array($data)) {
-                       foreach ($data as $key => $value){
+                       foreach ($data as $key => $value) {
                                $data[$key] = stripslashes_array($value);
                        }
                        return $data;
@@ -301,8 +305,6 @@ if (!isset($_POST['old']) or empty($_POST['old'])) {
        }
 }
 
-// start of wiki mod (20071130)
-
 if (isset($_POST['wiki']) and !empty($_POST['wiki']) and ($_POST['wiki'] == "on") and !file_exists("data/wiki.txt")) {
        touch("data/wiki.txt");
 }
@@ -315,8 +317,6 @@ if (!isset($_POST['wiki']) or empty($_POST['wiki'])) {
        }
 }
 
-// end of wiki mod (20071130)
-
 if (isset($_POST['pf']) and !empty($_POST['pf']) and ($_POST['pf'] == "on") and !file_exists("data/pf.txt")) {
        touch("data/pf.txt");
 }
diff --git a/sitemap.php b/sitemap.php
index b34cf15..d9063e6 100644
--- a/sitemap.php
+++ b/sitemap.php
@@ -20,12 +20,29 @@ if ($dh_sitemap_items = opendir($dir)) {
                        continue;
                }
 
-               $cat_dir = file_get_contents("data/items/$entry_sitemap_items/category.txt");
+               $private = "0";
+
+               if (file_exists("data/items/$entry_sitemap_items/categories")) {
+      
+                       if ($dh_cat_rss = opendir("data/items/$entry_sitemap_items/categories")) {
+              
+                               while (($entry_cat_rss = readdir($dh_cat_rss)) !== false) {
+              
+                                       if ($entry_cat_rss != "." && $entry_cat_rss != "..") {
+              
+                                               if (file_exists("data/categories/$entry_cat_rss/private.txt")) {
+                                                       $private = $private + 1;
+                                               }
+                                       }
+                               }
+                               closedir($dh_cat_rss);
+                       }
+               }
 
-               if (file_exists("data/categories/$cat_dir/private.txt") and !file_exists("data/items/$entry_sitemap_items/cat.txt")) {
+               if (($private > 0) and !file_exists("data/items/$entry_sitemap_items/cat.txt")) {
                        continue;
                }
-
+              
                if ($entry_sitemap_items != "." && $entry_sitemap_items != ".." && fnmatch("*", $entry_sitemap_items) && !file_exists("data/items/$entry_sitemap_items/private.txt")) {
                        $show_sitemap_items[] = $entry_sitemap_items;
                }
diff --git a/wiki.php b/wiki.php
index 2f3bb8a..fcad5f8 100644
--- a/wiki.php
+++ b/wiki.php
@@ -6,6 +6,10 @@ header("Cache-control: private");
 
 error_reporting(E_ERROR);
 
+if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+       header("Location: login.php");
+}
+
 if (get_magic_quotes_gpc()) {
        function stripslashes_array($data) {
                if (is_array($data)) {
 
filedropmaj.git-01822e4.tar.bz2
147.95 KB
62 downloads
filedropmaj.git-01822e4.zip
201.96 KB
19 downloads
filedropmaj.git-0291349.tar.bz2
152.85 KB
60 downloads
filedropmaj.git-0291349.zip
211.90 KB
19 downloads
filedropmaj.git-02cb3b7.tar.bz2
151.48 KB
63 downloads
filedropmaj.git-02cb3b7.zip
209.82 KB
19 downloads
filedropmaj.git-0811dd5.tar.bz2
152.90 KB
60 downloads
filedropmaj.git-0811dd5.zip
211.90 KB
18 downloads
filedropmaj.git-083625f.tar.bz2
132.92 KB
59 downloads
filedropmaj.git-083625f.zip
179.59 KB
20 downloads
filedropmaj.git-0885d7b.tar.bz2
92.63 KB
60 downloads
filedropmaj.git-0885d7b.zip
132.34 KB
17 downloads
filedropmaj.git-09c6f33.tar.bz2
151.51 KB
59 downloads
filedropmaj.git-09c6f33.zip
202.12 KB
18 downloads
filedropmaj.git-0b26a85.tar.bz2
151.44 KB
57 downloads
filedropmaj.git-0b26a85.zip
209.75 KB
16 downloads
filedropmaj.git-0b32424.tar.bz2
151.66 KB
58 downloads
filedropmaj.git-0b32424.zip
206.72 KB
17 downloads
filedropmaj.git-0f3ac59.tar.bz2
152.14 KB
57 downloads
filedropmaj.git-0f3ac59.zip
211.45 KB
13 downloads
filedropmaj.git-11d4582.tar.bz2
143.02 KB
55 downloads
filedropmaj.git-11d4582.zip
195.12 KB
12 downloads
filedropmaj.git-17f105a.tar.bz2
137.96 KB
53 downloads
filedropmaj.git-17f105a.zip
193.02 KB
13 downloads
filedropmaj.git-183270b.tar.bz2
137.54 KB
57 downloads
filedropmaj.git-183270b.zip
187.93 KB
13 downloads
filedropmaj.git-197a49d.tar.bz2
152.03 KB
55 downloads
filedropmaj.git-197a49d.zip
211.32 KB
16 downloads
filedropmaj.git-1b9af25.tar.bz2
152.87 KB
53 downloads
filedropmaj.git-1b9af25.zip
211.96 KB
14 downloads
filedropmaj.git-1be2914.tar.bz2
149.30 KB
55 downloads
filedropmaj.git-1be2914.zip
203.09 KB
13 downloads
filedropmaj.git-1bed800.tar.bz2
138.15 KB
51 downloads
filedropmaj.git-1bed800.zip
190.15 KB
17 downloads
filedropmaj.git-1d330de.tar.bz2
151.65 KB
54 downloads
filedropmaj.git-1d330de.zip
210.80 KB
15 downloads
filedropmaj.git-1df190d.tar.bz2
151.72 KB
55 downloads
filedropmaj.git-1df190d.zip
210.85 KB
13 downloads
filedropmaj.git-1ee1167.tar.bz2
151.52 KB
56 downloads
filedropmaj.git-1ee1167.zip
202.16 KB
14 downloads
filedropmaj.git-2057838.tar.bz2
151.76 KB
52 downloads
filedropmaj.git-2057838.zip
202.36 KB
14 downloads
filedropmaj.git-2075213.tar.bz2
155.81 KB
52 downloads
filedropmaj.git-2075213.zip
208.39 KB
13 downloads
filedropmaj.git-211b7b0.tar.bz2
142.53 KB
55 downloads
filedropmaj.git-211b7b0.zip
194.64 KB
14 downloads
filedropmaj.git-2331f5a.tar.bz2
75.55 KB
55 downloads
filedropmaj.git-2331f5a.zip
100.32 KB
16 downloads
filedropmaj.git-25e3c4c.tar.bz2
147.57 KB
53 downloads
filedropmaj.git-25e3c4c.zip
201.46 KB
13 downloads
filedropmaj.git-2622313.tar.bz2
151.47 KB
50 downloads
filedropmaj.git-2622313.zip
206.44 KB
12 downloads
filedropmaj.git-273e4b2.tar.bz2
152.60 KB
52 downloads
filedropmaj.git-273e4b2.zip
203.40 KB
15 downloads
filedropmaj.git-2753e51.tar.bz2
136.37 KB
55 downloads
filedropmaj.git-2753e51.zip
184.34 KB
12 downloads
filedropmaj.git-2c1a589.tar.bz2
155.89 KB
49 downloads
filedropmaj.git-2c1a589.zip
208.69 KB
13 downloads
filedropmaj.git-2c3d544.tar.bz2
151.33 KB
51 downloads
filedropmaj.git-2c3d544.zip
206.23 KB
14 downloads
filedropmaj.git-2c85f72.tar.bz2
143.23 KB
50 downloads
filedropmaj.git-2c85f72.zip
194.84 KB
12 downloads
filedropmaj.git-2dc622c.tar.bz2
151.76 KB
48 downloads
filedropmaj.git-2dc622c.zip
202.35 KB
14 downloads
filedropmaj.git-2fabf8a.tar.bz2
151.35 KB
53 downloads
filedropmaj.git-2fabf8a.zip
206.24 KB
15 downloads
filedropmaj.git-322736b.tar.bz2
137.81 KB
45 downloads
filedropmaj.git-322736b.zip
190.18 KB
13 downloads
filedropmaj.git-374279c.tar.bz2
137.54 KB
46 downloads
filedropmaj.git-374279c.zip
189.58 KB
12 downloads
filedropmaj.git-37e852d.tar.bz2
151.32 KB
42 downloads
filedropmaj.git-37e852d.zip
206.21 KB
11 downloads
filedropmaj.git-38636de.tar.bz2
147.35 KB
42 downloads
filedropmaj.git-38636de.zip
201.16 KB
69 downloads
filedropmaj.git-3b25d71.tar.bz2
147.88 KB
35 downloads
filedropmaj.git-3b25d71.zip
201.85 KB
14 downloads
filedropmaj.git-3b6df7a.tar.bz2
153.39 KB
33 downloads
filedropmaj.git-3b6df7a.zip
204.55 KB
17 downloads
filedropmaj.git-3bf6bd2.tar.bz2
137.77 KB
38 downloads
filedropmaj.git-3bf6bd2.zip
190.16 KB
14 downloads
filedropmaj.git-3e012ff.tar.bz2
152.83 KB
34 downloads
filedropmaj.git-3e012ff.zip
211.89 KB
16 downloads
filedropmaj.git-4129ab8.tar.bz2
135.86 KB
42 downloads
filedropmaj.git-4129ab8.zip
184.30 KB
14 downloads
filedropmaj.git-414dbb4.tar.bz2
91.09 KB
40 downloads
filedropmaj.git-414dbb4.zip
130.29 KB
14 downloads
filedropmaj.git-43755d0.tar.bz2
150.25 KB
33 downloads
filedropmaj.git-43755d0.zip
204.44 KB
14 downloads
filedropmaj.git-4c20005.tar.bz2
55.59 KB
37 downloads
filedropmaj.git-4c20005.zip
74.20 KB
14 downloads
filedropmaj.git-4ccdbcd.tar.bz2
136.38 KB
38 downloads
filedropmaj.git-4ccdbcd.zip
185.22 KB
16 downloads
filedropmaj.git-4cd1a1c.tar.bz2
155.25 KB
35 downloads
filedropmaj.git-4cd1a1c.zip
207.88 KB
16 downloads
filedropmaj.git-4cf16d1.tar.bz2
76.32 KB
38 downloads
filedropmaj.git-4cf16d1.zip
101.80 KB
12 downloads
filedropmaj.git-4ec45a0.tar.bz2
131.16 KB
35 downloads
filedropmaj.git-4ec45a0.zip
172.66 KB
14 downloads
filedropmaj.git-4f73c22.tar.bz2
134.46 KB
35 downloads
filedropmaj.git-4f73c22.zip
182.45 KB
13 downloads
filedropmaj.git-5457969.tar.bz2
155.21 KB
38 downloads
filedropmaj.git-5457969.zip
207.63 KB
14 downloads
filedropmaj.git-57ee8a1.tar.bz2
145.49 KB
38 downloads
filedropmaj.git-57ee8a1.zip
198.12 KB
66 downloads
filedropmaj.git-592978d.tar.bz2
138.38 KB
36 downloads
filedropmaj.git-592978d.zip
190.58 KB
13 downloads
filedropmaj.git-5935b42.tar.bz2
135.60 KB
34 downloads
filedropmaj.git-5935b42.zip
183.28 KB
15 downloads
filedropmaj.git-5b443b6.tar.bz2
152.00 KB
36 downloads
filedropmaj.git-5b443b6.zip
211.07 KB
13 downloads
filedropmaj.git-5b4a9bf.tar.bz2
155.29 KB
34 downloads
filedropmaj.git-5b4a9bf.zip
207.93 KB
12 downloads
filedropmaj.git-5b6c01d.tar.bz2
147.13 KB
35 downloads
filedropmaj.git-5b6c01d.zip
200.86 KB
16 downloads
filedropmaj.git-5da45f7.tar.bz2
147.27 KB
36 downloads
filedropmaj.git-5da45f7.zip
201.02 KB
13 downloads
filedropmaj.git-5e53618.tar.bz2
75.57 KB
38 downloads
filedropmaj.git-5e53618.zip
100.78 KB
14 downloads
filedropmaj.git-5f8ca35.tar.bz2
136.39 KB
33 downloads
filedropmaj.git-5f8ca35.zip
185.32 KB
13 downloads
filedropmaj.git-61e3d7b.tar.bz2
153.52 KB
33 downloads
filedropmaj.git-61e3d7b.zip
204.73 KB
15 downloads
filedropmaj.git-62a635c.tar.bz2
155.90 KB
37 downloads
filedropmaj.git-62a635c.zip
208.73 KB
14 downloads
filedropmaj.git-6390d34.tar.bz2
138.39 KB
37 downloads
filedropmaj.git-6390d34.zip
190.56 KB
17 downloads
filedropmaj.git-649dfbe.tar.bz2
151.78 KB
37 downloads
filedropmaj.git-649dfbe.zip
210.91 KB
14 downloads
filedropmaj.git-65d6570.tar.bz2
151.63 KB
39 downloads
filedropmaj.git-65d6570.zip
210.80 KB
16 downloads
filedropmaj.git-660433f.tar.bz2
151.67 KB
36 downloads
filedropmaj.git-660433f.zip
206.68 KB
14 downloads
filedropmaj.git-6619ae5.tar.bz2
153.23 KB
46 downloads
filedropmaj.git-6619ae5.zip
204.28 KB
13 downloads
filedropmaj.git-68e4e3a.tar.bz2
135.13 KB
34 downloads
filedropmaj.git-68e4e3a.zip
182.91 KB
13 downloads
filedropmaj.git-6995297.tar.bz2
144.93 KB
38 downloads
filedropmaj.git-6995297.zip
197.18 KB
12 downloads
filedropmaj.git-69d6fd3.tar.bz2
143.23 KB
34 downloads
filedropmaj.git-69d6fd3.zip
194.89 KB
16 downloads
filedropmaj.git-6aa872a.tar.bz2
142.95 KB
39 downloads
filedropmaj.git-6aa872a.zip
195.11 KB
15 downloads
filedropmaj.git-6bad5c7.tar.bz2
147.04 KB
38 downloads
filedropmaj.git-6bad5c7.zip
200.79 KB
14 downloads
filedropmaj.git-6e96a2d.tar.bz2
152.13 KB
37 downloads
filedropmaj.git-6e96a2d.zip
207.21 KB
67 downloads
filedropmaj.git-73d46de.tar.bz2
138.42 KB
36 downloads
filedropmaj.git-73d46de.zip
190.59 KB
13 downloads
filedropmaj.git-75e0478.tar.bz2
144.54 KB
38 downloads
filedropmaj.git-75e0478.zip
196.70 KB
15 downloads
filedropmaj.git-784fc35.tar.bz2
143.07 KB
38 downloads
filedropmaj.git-784fc35.zip
195.01 KB
13 downloads
filedropmaj.git-7872a83.tar.bz2
138.51 KB
39 downloads
filedropmaj.git-7872a83.zip
190.69 KB
13 downloads
filedropmaj.git-788fb89.tar.bz2
138.30 KB
37 downloads
filedropmaj.git-788fb89.zip
191.26 KB
18 downloads
filedropmaj.git-796d8a3.tar.bz2
138.92 KB
35 downloads
filedropmaj.git-796d8a3.zip
191.24 KB
13 downloads
filedropmaj.git-79a5e8d.tar.bz2
132.43 KB
38 downloads
filedropmaj.git-79a5e8d.zip
176.90 KB
14 downloads
filedropmaj.git-7b3b2e0.tar.bz2
147.24 KB
36 downloads
filedropmaj.git-7b3b2e0.zip
201.05 KB
14 downloads
filedropmaj.git-7e28eed.tar.bz2
138.89 KB
33 downloads
filedropmaj.git-7e28eed.zip
191.24 KB
14 downloads
filedropmaj.git-8279296.tar.bz2
135.56 KB
38 downloads
filedropmaj.git-8279296.zip
183.25 KB
14 downloads
filedropmaj.git-84c17fe.tar.bz2
152.87 KB
38 downloads
filedropmaj.git-84c17fe.zip
211.90 KB
14 downloads
filedropmaj.git-87c5d5f.tar.bz2
135.78 KB
36 downloads
filedropmaj.git-87c5d5f.zip
183.64 KB
12 downloads
filedropmaj.git-8a48901.tar.bz2
147.27 KB
39 downloads
filedropmaj.git-8a48901.zip
201.06 KB
14 downloads
filedropmaj.git-8ad9892.tar.bz2
164.04 KB
36 downloads
filedropmaj.git-8ad9892.zip
224.42 KB
13 downloads
filedropmaj.git-8b4cf2a.tar.bz2
134.06 KB
37 downloads
filedropmaj.git-8b4cf2a.zip
180.78 KB
14 downloads
filedropmaj.git-8b7e38d.tar.bz2
138.04 KB
41 downloads
filedropmaj.git-8b7e38d.zip
190.39 KB
70 downloads
filedropmaj.git-8df6e40.tar.bz2
143.11 KB
38 downloads
filedropmaj.git-8df6e40.zip
194.66 KB
18 downloads
filedropmaj.git-8e80c84.tar.bz2
138.18 KB
36 downloads
filedropmaj.git-8e80c84.zip
190.30 KB
14 downloads
filedropmaj.git-8ec0fba.tar.bz2
138.37 KB
39 downloads
filedropmaj.git-8ec0fba.zip
191.39 KB
14 downloads
filedropmaj.git-8f7abf6.tar.bz2
153.36 KB
38 downloads
filedropmaj.git-8f7abf6.zip
211.80 KB
13 downloads
filedropmaj.git-923f11a.tar.bz2
138.14 KB
36 downloads
filedropmaj.git-923f11a.zip
191.03 KB
15 downloads
filedropmaj.git-955e82e.tar.bz2
42.71 KB
35 downloads
filedropmaj.git-955e82e.zip
59.77 KB
14 downloads
filedropmaj.git-95add4a.tar.bz2
151.23 KB
40 downloads
filedropmaj.git-95add4a.zip
205.91 KB
14 downloads
filedropmaj.git-96fe0ba.tar.bz2
137.68 KB
32 downloads
filedropmaj.git-96fe0ba.zip
190.34 KB
13 downloads
filedropmaj.git-99a90ce.tar.bz2
137.82 KB
39 downloads
filedropmaj.git-99a90ce.zip
191.20 KB
16 downloads
filedropmaj.git-9a69bb9.tar.bz2
143.19 KB
39 downloads
filedropmaj.git-9a69bb9.zip
194.70 KB
15 downloads
filedropmaj.git-9b6538e.tar.bz2
151.45 KB
36 downloads
filedropmaj.git-9b6538e.zip
202.15 KB
13 downloads
filedropmaj.git-9c4292d.tar.bz2
132.06 KB
37 downloads
filedropmaj.git-9c4292d.zip
176.93 KB
13 downloads
filedropmaj.git-9c78d40.tar.bz2
137.70 KB
37 downloads
filedropmaj.git-9c78d40.zip
190.49 KB
15 downloads
filedropmaj.git-9f1363f.tar.bz2
43.12 KB
40 downloads
filedropmaj.git-9f1363f.zip
60.31 KB
13 downloads
filedropmaj.git-a16c3eb.tar.bz2
90.22 KB
34 downloads
filedropmaj.git-a16c3eb.zip
128.62 KB
14 downloads
filedropmaj.git-a3aa72d.tar.bz2
153.00 KB
37 downloads
filedropmaj.git-a3aa72d.zip
203.86 KB
16 downloads
filedropmaj.git-a6886e4.tar.bz2
144.69 KB
37 downloads
filedropmaj.git-a6886e4.zip
196.95 KB
13 downloads
filedropmaj.git-a8669dc.tar.bz2
135.60 KB
35 downloads
filedropmaj.git-a8669dc.zip
183.34 KB
14 downloads
filedropmaj.git-a9477f1.tar.bz2
135.59 KB
37 downloads
filedropmaj.git-a9477f1.zip
183.45 KB
14 downloads
filedropmaj.git-aa285db.tar.bz2
151.73 KB
38 downloads
filedropmaj.git-aa285db.zip
210.85 KB
14 downloads
filedropmaj.git-aa6ae87.tar.bz2
135.44 KB
37 downloads
filedropmaj.git-aa6ae87.zip
183.88 KB
14 downloads
filedropmaj.git-ab6bc22.tar.bz2
151.71 KB
33 downloads
filedropmaj.git-ab6bc22.zip
210.84 KB
16 downloads
filedropmaj.git-adef726.tar.bz2
153.48 KB
36 downloads
filedropmaj.git-adef726.zip
212.32 KB
14 downloads
filedropmaj.git-afe5877.tar.bz2
144.73 KB
32 downloads
filedropmaj.git-afe5877.zip
197.01 KB
13 downloads
filedropmaj.git-b2d9f8e.tar.bz2
133.22 KB
35 downloads
filedropmaj.git-b2d9f8e.zip
179.27 KB
13 downloads
filedropmaj.git-b41f320.tar.bz2
151.56 KB
33 downloads
filedropmaj.git-b41f320.zip
209.85 KB
18 downloads
filedropmaj.git-b4432ce.tar.bz2
152.96 KB
34 downloads
filedropmaj.git-b4432ce.zip
203.86 KB
14 downloads
filedropmaj.git-b67b08f.tar.bz2
151.27 KB
36 downloads
filedropmaj.git-b67b08f.zip
206.15 KB
16 downloads
filedropmaj.git-b899831.tar.bz2
143.12 KB
35 downloads
filedropmaj.git-b899831.zip
194.60 KB
14 downloads
filedropmaj.git-b8b49c1.tar.bz2
132.59 KB
33 downloads
filedropmaj.git-b8b49c1.zip
178.90 KB
13 downloads
filedropmaj.git-b9c5bcf.tar.bz2
155.92 KB
34 downloads
filedropmaj.git-b9c5bcf.zip
208.70 KB
12 downloads
filedropmaj.git-bbddb1f.tar.bz2
151.63 KB
33 downloads
filedropmaj.git-bbddb1f.zip
209.92 KB
16 downloads
filedropmaj.git-bcaa744.tar.bz2
146.98 KB
37 downloads
filedropmaj.git-bcaa744.zip
200.79 KB
15 downloads
filedropmaj.git-c1ff9dc.tar.bz2
138.39 KB
38 downloads
filedropmaj.git-c1ff9dc.zip
191.43 KB
97 downloads
filedropmaj.git-c20c4b0.tar.bz2
151.64 KB
35 downloads
filedropmaj.git-c20c4b0.zip
210.79 KB
13 downloads
filedropmaj.git-c37f3f7.tar.bz2
145.45 KB
49 downloads
filedropmaj.git-c37f3f7.zip
198.11 KB
22 downloads
filedropmaj.git-c532394.tar.bz2
146.39 KB
37 downloads
filedropmaj.git-c532394.zip
199.91 KB
15 downloads
filedropmaj.git-c6317a4.tar.bz2
152.01 KB
36 downloads
filedropmaj.git-c6317a4.zip
207.08 KB
13 downloads
filedropmaj.git-c748176.tar.bz2
89.44 KB
34 downloads
filedropmaj.git-c748176.zip
126.35 KB
14 downloads
filedropmaj.git-c9ed81f.tar.bz2
135.56 KB
34 downloads
filedropmaj.git-c9ed81f.zip
183.28 KB
16 downloads
filedropmaj.git-c9f9b80.tar.bz2
138.50 KB
34 downloads
filedropmaj.git-c9f9b80.zip
190.66 KB
15 downloads
filedropmaj.git-ca65b73.tar.bz2
152.69 KB
35 downloads
filedropmaj.git-ca65b73.zip
207.87 KB
15 downloads
filedropmaj.git-cd80b77.tar.bz2
153.12 KB
35 downloads
filedropmaj.git-cd80b77.zip
212.01 KB
12 downloads
filedropmaj.git-cffbb2a.tar.bz2
138.22 KB
33 downloads
filedropmaj.git-cffbb2a.zip
190.28 KB
14 downloads
filedropmaj.git-d061ad7.tar.bz2
55.78 KB
47 downloads
filedropmaj.git-d061ad7.zip
74.39 KB
15 downloads
filedropmaj.git-d0af4d6.tar.bz2
57.28 KB
35 downloads
filedropmaj.git-d0af4d6.zip
78.56 KB
15 downloads
filedropmaj.git-d1caa0a.tar.bz2
144.57 KB
37 downloads
filedropmaj.git-d1caa0a.zip
196.63 KB
14 downloads
filedropmaj.git-d5679b5.tar.bz2
152.37 KB
34 downloads
filedropmaj.git-d5679b5.zip
207.52 KB
15 downloads
filedropmaj.git-d72f459.tar.bz2
147.90 KB
36 downloads
filedropmaj.git-d72f459.zip
201.92 KB
13 downloads
filedropmaj.git-d958c91.tar.bz2
144.67 KB
37 downloads
filedropmaj.git-d958c91.zip
196.88 KB
17 downloads
filedropmaj.git-d96784f.tar.bz2
135.58 KB
36 downloads
filedropmaj.git-d96784f.zip
183.46 KB
12 downloads
filedropmaj.git-da4b73f.tar.bz2
152.62 KB
33 downloads
filedropmaj.git-da4b73f.zip
203.48 KB
13 downloads
filedropmaj.git-dd24240.tar.bz2
138.27 KB
33 downloads
filedropmaj.git-dd24240.zip
190.45 KB
72 downloads
filedropmaj.git-e11e772.tar.bz2
152.09 KB
33 downloads
filedropmaj.git-e11e772.zip
211.33 KB
14 downloads
filedropmaj.git-e61478e.tar.bz2
135.95 KB
37 downloads
filedropmaj.git-e61478e.zip
183.91 KB
14 downloads
filedropmaj.git-e7a2547.tar.bz2
133.80 KB
33 downloads
filedropmaj.git-e7a2547.zip
180.05 KB
16 downloads
filedropmaj.git-e8a3b95.tar.bz2
138.15 KB
37 downloads
filedropmaj.git-e8a3b95.zip
191.04 KB
12 downloads
filedropmaj.git-eac86d5.tar.bz2
155.65 KB
33 downloads
filedropmaj.git-eac86d5.zip
208.28 KB
12 downloads
filedropmaj.git-ed83bf9.tar.bz2
135.16 KB
34 downloads
filedropmaj.git-ed83bf9.zip
182.91 KB
15 downloads
filedropmaj.git-ee50d40.tar.bz2
135.59 KB
36 downloads
filedropmaj.git-ee50d40.zip
183.48 KB
16 downloads
filedropmaj.git-efdb4df.tar.bz2
155.87 KB
36 downloads
filedropmaj.git-efdb4df.zip
208.72 KB
14 downloads
filedropmaj.git-f1554f8.tar.bz2
151.30 KB
37 downloads
filedropmaj.git-f1554f8.zip
206.22 KB
16 downloads
filedropmaj.git-f72a07b.tar.bz2
153.44 KB
37 downloads
filedropmaj.git-f72a07b.zip
212.11 KB
17 downloads
filedropmaj.git-f7ea5a1.tar.bz2
147.46 KB
36 downloads
filedropmaj.git-f7ea5a1.zip
201.32 KB
17 downloads
filedropmaj.git-f8a7353.tar.bz2
138.49 KB
36 downloads
filedropmaj.git-f8a7353.zip
190.66 KB
18 downloads
filedropmaj.git-fb84a8d.tar.bz2
137.61 KB
41 downloads
filedropmaj.git-fb84a8d.zip
190.70 KB
18 downloads
filedropmaj.git-fdcf5d3.tar.bz2
152.34 KB
40 downloads
filedropmaj.git-fdcf5d3.zip
207.53 KB
17 downloads
filedropmaj.git-feca42d.tar.bz2
132.90 KB
38 downloads
filedropmaj.git-feca42d.zip
179.44 KB
19 downloads