commit b22c0a1df893afe3fccc08c3b25846098612afe2
Author: Xkeeper <xkeeper@gmail.com>
Date:   Sat Aug 8 22:45:34 2015 -0700

    First (re-)commit

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1ee8f2e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+.rem/
+.old/
+board/
+xkeeper/
+
+lib/config.php
+lib/firewall.php
\ No newline at end of file
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..123ceea
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,7 @@
+
+ErrorDocument 403 /errors/403.html
+ErrorDocument 404 /errors/404.html
+ErrorDocument 500 /errors/500.html
+
+Order Allow,Deny
+Allow from all
diff --git a/acs.php b/acs.php
new file mode 100644
index 0000000..fa20b7c
--- /dev/null
+++ b/acs.php
@@ -0,0 +1,177 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/layout.php';
+	$userid = htmlspecialchars(stripslashes($_GET['userid']));
+
+	$vd=date('m-d-y', ctime());
+	if (!$m && !$d && !$y) {
+		$m	= date("m", ctime() - 86400);
+		$d	= date("d", ctime() - 86400);
+		$y	= date("y", ctime() - 86400);
+	}
+	if(!$v){
+		$v=0;
+		$dd		= mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2));// + (3*3600);
+		$dd2	= mktime(0,0,0,substr($vd,0,2),substr($vd,3,2)+1,substr($vd,6,2));// + (3*3600);
+	}else{
+		$dd		= mktime(0,0,0,$m,$d,$y);// + (3*3600);
+		$dd2	= mktime(0,0,0,$m,$d+1,$y);// + (3*3600);
+	}
+
+
+	$users = $sql->query("SELECT u.id,u.name,u.aka,u.sex,u.powerlevel,COUNT(*) AS cnt FROM users AS u,posts AS p WHERE p.user=u.id AND p.date>=$dd AND p.date<$dd2 AND u.powerlevel >= 0 GROUP BY u.id ORDER BY cnt DESC");
+	$i=0;
+
+	if (!$u) {
+		$u = 0;
+		$n = $loguser['name'];
+	}
+	elseif ($u==2)
+		$n = $userid;
+
+	if(!$view || $view <= 0 || $view > 2) $view=0;
+
+	$ch1[$v]	= 'checked';
+	$ch2[$u]	= 'checked';
+	$ch3[$view]	= 'checked';
+
+	$tposts		= $sql->resultq("SELECT COUNT(*) AS cnt FROM posts WHERE posts.date>$dd AND posts.date<$dd2",0,'cnt');
+	$rcount		= ($tposts >= 400 ? 10 : 5);
+	$spoints	= ($tposts >= 400 ? 11 : 8);
+	$desc="</b><br>$smallfont";
+	print "
+		$header
+		<br><form action=acs.php>
+		$tblstart
+		$tccellh colspan=2>Currently viewing ".date('m-d-y',$dd)."<tr>
+		$tccell1><b>Day:$desc Select the day to view rankings from. (mm-dd-yy format)</td>
+		$tccell2l>$radio=v value=0 $ch1[0]> Today &nbsp; $radio=v value=1 $ch1[1]> Other: $inpt=m VALUE=\"$m\" SIZE=2 MAXLENGTH=2>-$inpt=d VALUE=\"$d\" SIZE=2 MAXLENGTH=2>-$inpt=y VALUE=\"$y\" SIZE=2 MAXLENGTH=2><tr>
+		$tccell1><b>User:$desc This user will be highlighted.</td>
+		$tccell2l>$radio=u value=1 $ch2[1]> None &nbsp; $radio=u value=0 $ch2[0]> You &nbsp; $radio=u value=2 $ch2[2]> Other: $inpt=userid VALUE=\"$userid\" SIZE=25 MAXLENGTH=25><tr>
+		$tccell1><b>View format:</b></td>
+		$tccell2l>$radio=view value=0 $ch3[0]> Full rankings &nbsp; $radio=view value=1 $ch3[1]> Rankers &nbsp; $radio=view value=2 $ch3[2]> JCS form<tr>
+		$tccell1>&nbsp;</td>
+		$tccell2l><input type=submit value=Submit>
+		$tblend
+		</form>
+		$tblstart
+		";
+	$max=1;
+	if($view<2){
+		print "
+			$tccellh width=30>#</td>
+			$tccellh width=60%>Name</td>
+			$tccellh width=50>Posts
+			$tccellh width=*>Total: $tposts
+			";
+		while($user=$sql->fetch($users)){
+			if($user['cnt']>$max) $max=$user['cnt'];
+			$i++;
+			if($rp!=$user['cnt']) $r=$i;
+			$rp=$user['cnt'];
+
+			// Don't rank with 1 post
+			if ($user['cnt'] <= 1 && $rcount >= $r)
+				$rcount = $r-1;
+
+			if($rr<=$rcount && $r>$rcount && $view==0) print "<tr>$tccellc colspan=4><img src='images/_.gif' height='4' width='1'></td></tr>";
+			$rr=$r;
+			$b = $slashb = '';
+			$td=$tccell1;
+
+			if($r>$rcount) $td=$tccell2;
+			if(!strcasecmp($user['name'], $n)){
+				$td=$tccellc;
+				$b='<b>';
+				$slashb='</b>';
+			}
+
+			$tdl=str_replace(' center','',$td);
+			if($view==0 or ($view==1 and ($r<=$rcount or !strcasecmp($user['name'], $n)))) {
+				print "
+					<tr>
+					$td>$b$r$slashb</td>
+					$tdl><a href=profile.php?id=$user[id]><font ".getnamecolor($user['sex'],$user['powerlevel']).">". (!$_GET['dur'] ? $user['name'] : "DU". str_repeat("R", mt_rand(1,25))) ."</font></a></td>
+					$td>$b$user[cnt]$slashb</td>
+					$tdl><img src=images/$numdir"."bar-on.gif width=".($user[cnt]*100/$max)."% height=8></td>
+					</tr>";
+			}
+		}
+	} else {
+		// Ranked yesterday:
+//		$usersy=mysql_query("SELECT users.id,users.name,users.sex,users.powerlevel,COUNT(posts.id) AS cnt FROM users,posts WHERE posts.user=users.id AND posts.date>".($dd-86400)." AND posts.date<$dd GROUP BY users.id ORDER BY cnt DESC");
+//		$i=0;
+//		while($user=mysql_fetch_array($usersy) and $r <= $rcount ) {
+//			$i++;
+//			if($rp!=$user['cnt']) $r=$i;
+//			$rp=$user['cnt'];
+//			if($r<=5) $ranky[$user['id']]=$r;
+//		}
+
+		$i=0;
+		$rp=0;
+		$r=0;
+		while($user = $sql->fetch($users) and $r <= $rcount){
+			$i++;
+			// Don't rank with 1 post
+			if ($user['cnt'] <= 1 && $rcount >= $r) {
+				$rcount = $r-1;
+			}
+			if($rp!=$user['cnt']){
+				$r=$i;
+				if($tend) $tie='';
+				if($tie) $tend=1;
+			}else{
+				$tie='T';
+				$tend=0;
+			}
+			$posts[$user['id']]=$user['cnt'];
+
+			// Ranked yesterday:
+//			$ry=$ranky[$user['id']];
+//			if(!$ry) $ry='NR';
+
+			$rp=$user['cnt'];
+			//$myfakename = (($user['aka'] && $user['aka'] != $user['name']) ? "$user[aka] ($user[name])" : $user['name']);
+			//$myrealname = (($user['aka']) ? $user['aka'] : $user['name']);
+			$myfakename = $myrealname = $user['name'];
+			$dailyposts		.= $tie . $ndailyposts;
+			$dailypoints	.= $tie . $ndailypoints;
+			$ndailyposts	= "$r) ". $myfakename ." - ". $user['cnt'] ."<br>";
+			$ndailypoints	= "$r) ". $myrealname ." - ". ($spoints - $r) ."<br>";
+
+//			$ndailyposts	= "$tie$r) ". $user['name'] ." - ". $user['cnt'] ." - ". ($spoints - $r) ."<br>";
+//			$ndailyposts	= "$tie$r) ". $user['name'] ." - ". $user['cnt'] ." - ". ($spoints - $r) ."<br>";
+
+		}
+		if($r <= $rcount) {
+			if($tend) $tie='';
+	//			$dailyposts.=$tie.$ndailyposts;
+	//			$dailypoints.=$tie.$ndailypoints;
+		}
+
+		// More ranked yesterday stuff
+//		$lose=$user[cnt];
+//		@mysql_data_seek($usersy,0);
+//		$i=0;
+//		$rp=0;
+//		$r=0;
+//		while($user=mysql_fetch_array($usersy) and $r<=$rcount){
+//			$i++;
+//			if($rp!=$user[cnt]) $r=$i;
+//			$rp=$user[cnt];
+//			if($posts[$user[id]]<=$lose && $r<=$rcount) $offcharts.=($offcharts?', ':'OFF THE CHARTS: ')."$user[name] ($r)";
+//		}
+
+		print "
+			$tccell1l>
+			". strtoupper(date('F j',$dd)) ."<br>".
+			"---------<br><br>".
+			"TOTAL NUMBER OF POSTS: $tposts<br><br>".
+			"$dailyposts<br><br>".
+			"DAILY POINTS<br>".
+			"--------------------<br>".
+			"$dailypoints";
+	}
+	print $tblend.$footer;
+	printtimedif($startingtime);
diff --git a/activeusers.php b/activeusers.php
new file mode 100644
index 0000000..78bce9f
--- /dev/null
+++ b/activeusers.php
@@ -0,0 +1,147 @@
+<?php
+	require 'lib/function.php';
+
+	$windowtitle	= "$boardname -- Active users";
+	require 'lib/layout.php';
+
+	if (($type == 'pm' || $type == 'pms') && !$log)
+		unset($type);
+
+	if (!isset($_GET['time']))
+		$time = 86400;
+	else
+		$time = intval($_GET['time']);
+
+	$query='SELECT users.id, regdate, name, minipic, sex, powerlevel, aka, birthday, COUNT(*) AS cnt FROM users';
+	$endp=' GROUP BY users.id ORDER BY cnt DESC';
+
+	$linklist[0] = "<a href=\"?time=$time\">posts made</a>";
+	$linklist[1] = "<a href=\"?type=thread&time=$time\">new threads</a>";
+	if ($log) {
+		$linklist[2] = "<a href=\"?type=pms&time=$time\">PMs sent by you</a>";
+		$linklist[3] = "<a href=\"?type=pm&time=$time\">PMs sent to you</a>";
+	}
+
+	if ($type == 'thread')	{
+		$posters	= $sql-> query("$query, threads WHERE threads.user=users.id"
+			.($time ? " AND threads.firstpostdate> '". (ctime() - $time) ."'" : '')
+			.$endp);
+		$desc		= "Most active thread posters";
+		$column		= "Threads";
+		$column2	= "threads";
+		$stat = "most thread creators";
+		$linklist[1] = "new threads";
+
+	} elseif ($type == 'pm') {
+		$posters	= $sql-> query("$query, pmsgs WHERE pmsgs.userto=$loguserid"
+			.($time ? " AND pmsgs.date> '". (ctime() - $time) ."'" : '')
+			." AND pmsgs.userfrom=users.id$endp");
+		$desc		= "PMs recieved from";
+		$column		= "PMs";
+		$column2	= "PMs";
+		$stat = "most message senders";
+		$linklist[3] = "PMs sent to you";
+
+	} elseif ($type == 'pms') {
+		$posters	= $sql-> query("$query, pmsgs WHERE pmsgs.userfrom=$loguserid"
+			.($time ? " AND pmsgs.date> '". (ctime() - $time) ."'" : '')
+			." AND pmsgs.userto=users.id$endp");
+		$desc		= "PMs sent to";
+		$column		= "PMs";
+		$column2	= "PMs";
+		$stat = "who you've sent the most messages to";
+		$linklist[2] = "PMs sent by you";
+
+	} else {
+		$posters	= $sql-> query("$query, posts WHERE posts.user=users.id"
+			.($tid ? " AND thread='$tid'" : '')
+			.($time ? " AND posts.date> '". (ctime() - $time) ."'" : '')
+			.$endp);
+		$desc		= "Most active posters";
+		$column		= "Posts";
+		$column2	= "posts";
+		$stat = "most active posters";
+		$linklist[0] = "posts made";
+		$type = '';
+	}
+
+	$link='<a href='.(($type) ? "?type={$type}&" : '?').'time';
+	print "
+		$header
+		$tblstart
+		<td align=left width=50%>$smallfont
+			Show $stat in the:
+			<br>$link=3600>last hour</a> - $link=86400>last day</a> - $link=604800>last week</a> - $link=2592000>last 30 days</a> - $link=0>from the beginning</a>
+		</td><td width=50% align=right>$smallfont
+		Most active users by:<br>
+		".implode(" - ", $linklist)."
+		$tblend
+	"; 
+
+	if ($time)
+		$timespan = " during the last ". timeunits2($time);
+	else
+		$timespan = "";
+
+/*
+	if ($loguser["powerlevel"] >= 1) {
+		// Xk will hate me for using subqueries.
+			// No, I'll just hate you for adding this period
+			// It's like a sore.
+			// Also, uh, interesting I guess. The more you know.
+		$pcounts        = $sql -> query("
+			SELECT
+				(SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel >= 1) AS posts_staff,
+				(SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel = 0) AS posts_users,
+				(SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel = -1) AS posts_banned");
+
+		$pcounts = $sql->fetch($pcounts);
+		print "
+		$tblstart
+		<tr>$tccellh colspan=2>Staff vs. Normal User Posts</tr>
+		<tr>$tccell1>$pcounts[posts_staff]</td>$tccell1>$pcounts[posts_users]</td></tr>
+		<tr>$tccell2 colspan=2>The ratio for staff posts to normal user posts is ".round($pcounts["posts_staff"]/$pcounts["posts_users"],3).".</td></tr>
+		<tr>$tccell2 colspan=2>Not included were the ".abs($pcounts[posts_banned])." posts shat out by a collective of morons. Depressing.</td></tr>
+		$tblend
+		<br>
+		";
+	}
+*/
+
+	print "
+		$tblstart
+			<tr>$tccellc colspan=6><b>$desc$timespan</b></td></tr>
+			<tr>
+			$tccellh width=30>#</td>
+			$tccellh colspan=2>Username</td>
+			$tccellh width=200>Registered on</td>
+			$tccellh width=130 colspan=2>$column</td>
+	";
+
+	$total = 0;
+	for($i = 1; $user = $sql->fetch($posters); $i++) {
+		if($i == 1) $max = $user['cnt'];
+		if ($user['cnt'] != $oldcnt) $rank = $i;
+		$oldcnt	= $user['cnt'];
+		$ulink = getuserlink($user);
+		print "
+			<tr>
+			$tccell1>$rank</td>
+			$tccell1 width=16>". ($user['minipic'] ? "<img src=\"". htmlspecialchars($user['minipic']) ."\" width=16 height=16>" : "&nbsp;") ."</td>
+			$tccell2l>{$ulink}</td>
+			$tccell1>".date($dateformat, $user['regdate'] + $tzoff) ."</td>
+			$tccell2 width=30><b>". $user['cnt'] ."</b></td>
+			$tccell2 width=100>". number_format($user['cnt'] / $max * 100, 1) ."%<br><img src=images/minibar.png width=\"". number_format($user['cnt'] / $max * 100) ."%\" align=left height=3> </td>
+			</tr>";
+
+		$total	+= $user['cnt'];
+	}
+
+	print "
+		<tr>
+			$tccellc colspan=6>". ($i - 1) ." users, $total $column2</td>
+		</tr>
+	";
+
+	print $tblend.$footer;
+	printtimedif($startingtime);
diff --git a/activity.php b/activity.php
new file mode 100644
index 0000000..f42f862
--- /dev/null
+++ b/activity.php
@@ -0,0 +1,64 @@
+<?php
+	require 'lib/function.php';
+
+	$u = intval($_GET['u']);
+	if (!$u) die();
+	$user['regdate'] = $sql->resultq("SELECT regdate FROM users WHERE id='$u'") or die();
+
+	$vd=date('m-d-y', $user['regdate']);
+	$dd=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2));
+
+	$days = floor((ctime()-$dd)/86400);
+	$pq = $sql->getresultsbykey(
+		"SELECT FROM_UNIXTIME(date, '%Y-%m-%d') day, count(*) c ".
+		"FROM posts WHERE user={$u} GROUP BY day ORDER BY day",
+		'day', 'c');
+	for($i=0; $i < $days; ++$i) {
+        $dk = date('Y-m-d',$dd+$i*86400);
+		if (!array_key_exists($dk, $pq)) continue;
+		$p[$i] = $pq[$dk];
+	}
+
+/*
+	if($_GET['debugsql']) {
+		require 'lib/layout.php';
+		print $header.$footer;
+		printtimedif(time());
+		die(1);
+	}
+*/
+
+	$m=max($p);
+	$img=ImageCreate($days,$m);
+
+	$c['bg']  = ImageColorAllocate($img,  0,  0,  0);
+	$c['bg1'] = ImageColorAllocate($img,  0,  0, 80); // Month colors
+	$c['bg2'] = ImageColorAllocate($img,  0,  0,130); //
+	$c['bg3'] = ImageColorAllocate($img, 80, 80,250); // (New year)
+	$c['mk1'] = ImageColorAllocate($img,110,110,160); // Horizontal Rulers
+	$c['mk2'] = ImageColorAllocate($img, 70, 70,130); //
+	$c['bar'] = ImageColorAllocate($img,240,190, 40); // Post count bar
+	$c['pt1']  = ImageColorAllocate($img,250,250,250); // Average
+	$c['pt2']  = ImageColorAllocate($img,240,230,220); // Average (over top of post bar)
+
+	for($i=0;$i<$days; ++$i){
+		$num=date('m',$dd+$i*86400)%2+1;
+		if(date('m-d',$dd+$i*86400)=='01-01') $num=3;
+		ImageLine($img,$i,$m,$i,0,$c["bg$num"]);
+	}
+	for($i=50, $ct=1; $i<=$m; $i+=50, ++$ct)
+		ImageLine($img,0,$m-$i,$days,$m-$i,(($ct&1) ? $c['mk2'] : $c['mk1']));
+
+	$pt=0;
+	for($i=0;$i<$days;$i++) {
+		if (isset($p[$i])) {
+			ImageLine($img,$i,$m,$i,$m-$p[$i],$c['bar']);
+			$pt += $p[$i];
+		}
+		$avg = $pt/($i+1);
+		ImageSetPixel($img,$i,$m-$avg,(($p[$i] >= $avg) ? $c['pt2'] : $c['pt1']));
+	}
+
+	Header('Content-type:image/png');
+	ImagePNG($img);
+	ImageDestroy($img);
\ No newline at end of file
diff --git a/activity2.php b/activity2.php
new file mode 100644
index 0000000..ec9b3ae
--- /dev/null
+++ b/activity2.php
@@ -0,0 +1,112 @@
+<?php
+	require 'lib/function.php';
+ 	$user['regdate']	= $sql -> resultq("SELECT MIN(`regdate`) FROM users WHERE regdate > 0") or die();
+	$max				= ceil(($sql -> resultq("SELECT MAX(`posts`) FROM users") + 1) / 50) * 50;
+
+	$vd = date('m-d-y', $user['regdate']);
+	$dd = mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2));
+
+	$days = floor((ctime()-$dd)/86400);
+	$scalex	= 2;
+	$scaley	= 20;
+	$m = $max / $scaley;
+
+	$img = ImageCreateTrueColor($days * $scalex,$m);
+	$c['bg']  = ImageColorAllocate($img,  0,  0,  0);
+	$c['bg1'] = ImageColorAllocate($img,  0,  0, 60);
+	$c['bg2'] = ImageColorAllocate($img,  0,  0, 80);
+	$c['bg3'] = ImageColorAllocate($img, 40, 40,100);
+	$c['mk1'] = ImageColorAllocate($img, 60, 60,130);
+	$c['mk2'] = ImageColorAllocate($img, 80, 80,150);
+	$c['bar'] = ImageColorAllocate($img,250,190, 40);
+	$c['pt']  = ImageColorAllocate($img,250,250,250);
+
+	for($i=0;$i<$days;$i++){
+		$num=date('m',$dd+$i*86400)%2+1;
+		if(date('m-d',$dd+$i*86400)=='01-01') $num=3;
+		ImageFilledRectangle($img,$i * $scalex,$m,($i + 1) * $scalex - 2,0,$c["bg$num"]);
+	}
+
+	for($i=0;$i<=($m / 50);$i++){
+		ImageLine($img,0,$m-$i*100+50,($days + 1) * $scalex - 1, $m-$i*100+50, $c['mk1']);
+		ImageLine($img,0,$m-$i*100,   ($days + 1) * $scalex - 1, $m-$i*100,    $c['mk2']);
+		imagestring($img, 3, 3, $m-$i*100+1,  ($i * 100)      * $scaley, $c['bg']);
+		imagestring($img, 3, 3, $m-$i*100+51, ($i * 100 - 50) * $scaley, $c['bg']);
+		imagestring($img, 3, 2, $m-$i*100,    ($i * 100)      * $scaley, $c['mk2']);
+		imagestring($img, 3, 2, $m-$i*100+50, ($i * 100 - 50) * $scaley, $c['mk1']);
+	}
+
+	$users	= array();
+	$userq	= $sql -> query("SELECT id, name FROM `users` ORDER BY `posts` DESC LIMIT 0, 10");
+	while ($u = $sql -> fetch($userq))
+		$users[$u['id']]	= array('name' => $u['name'], 'color' => imagecolorallocate($img, rand(100,255), rand(100,255), rand(100,255)));
+
+	$z = count($users);
+	$namespace = 12;
+
+	imagerectangle(      $img, 61, 11, 174, 15 + $z * $namespace, $c['bg']);
+	imagefilledrectangle($img, 60, 10, 173, 14 + $z * $namespace, $c['bg2']);
+	imagerectangle(      $img, 60, 10, 173, 14 + $z * $namespace, $c['mk2']);
+
+	$z	= 0;
+
+	$data = getdata(array_keys($users));
+	foreach($users as $uid => $userx) {
+		drawdata($data[$uid], $userx['color']);
+		imageline($img, 66, $z * $namespace + 19, 76, $z * $namespace + 19, $c['bg']);
+		imageline($img, 65, $z * $namespace + 18, 75, $z * $namespace + 18, $userx['color']);
+		imagestring($img, 2, 80 + 1, $z * $namespace + 12, $userx['name'], $c['bg']);
+		imagestring($img, 2, 80,     $z * $namespace + 11, $userx['name'], $userx['color']);
+		$z++;
+	}
+
+/*	if($_GET['debugsql']) {
+		require 'lib/layout.php';
+		print $header.$footer;
+		printtimedif(time());
+		die(1);
+	} */
+
+	Header('Content-type:image/png');
+	ImagePNG($img);
+	ImageDestroy($img);
+
+function drawdata($p, $color) {
+	global $days, $scalex, $m, $img;
+	$oldy = $m;
+	for ($i=0;$i<$days;$i++){
+		$y		= $m-$p[$i];
+		$x		= $i * $scalex;
+		if (!$p[$i]) {
+			$y	 = $oldy;
+		}
+		imageline($img, $x, $oldy, $x + $scalex - 1, $y, $color);
+		$oldy	= $y;
+	}
+}
+
+function getdata($users) {
+	global $sql, $dd, $scaley, $days;
+
+	$q = $sql->query(
+		"SELECT user, FROM_UNIXTIME(date, '%Y-%m-%d') day, count(*) c ".
+		"FROM posts WHERE user IN (".implode(',',$users).") GROUP BY user, day ORDER BY user, day",
+		'day');
+
+	$tmp = array();
+	$y = array();
+
+	while ($r = $sql->fetch($q, MYSQL_ASSOC))
+		$tmp[$r['user']][$r['day']] = $r;
+
+	for($i=0; $i < $days; ++$i) {
+		$dk = date('Y-m-d',$dd+$i*86400);
+		foreach ($tmp as $uid => $qdata) {
+			if (!array_key_exists($dk, $qdata)) continue;
+
+			$y[$uid] += $qdata[$dk]['c'];
+			$resp[$uid][$i] = $y[$uid] / $scaley;
+		}
+	}
+	return $resp;
+}
diff --git a/activity3.php b/activity3.php
new file mode 100644
index 0000000..43dd5b2
--- /dev/null
+++ b/activity3.php
@@ -0,0 +1,173 @@
+<?php
+ require 'lib/function.php';
+
+
+ $user['regdate']	= $sql -> resultq("SELECT MIN(`regdate`) FROM users");
+
+ $max				= ceil(($sql -> resultq("SELECT COUNT(*) FROM `posts`") + 1) / 5000) * 5000;
+ $alen				= ($_GET['len'] ? $_GET['len'] : 30);
+
+ $alen				= min(max(7, $alen), 90);
+// $max				= 5500;
+
+ $vd=date('m-d-y', $user['regdate']);
+ $dd=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2));
+ $dd2=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2)+1,substr($vd,6,2));
+
+
+ $days=ceil((ctime()-$dd)/86400);
+ $scalex	= 1;
+ $scaley	= 200;
+ $m			= $max / $scaley;
+ $xs		= $days * $scalex;
+
+ $img=ImageCreateTrueColor($xs,$m);
+
+ $c[bg]= ImageColorAllocate($img,  0,  0,  0);
+ $c[bg1]=ImageColorAllocate($img,  0,  0, 60);
+ $c[bg2]=ImageColorAllocate($img,  0,  0, 80);
+ $c[bg3]=ImageColorAllocate($img, 40, 40,100);
+ $c[bg4]=ImageColorAllocate($img,100, 40, 40);
+ $c[mk1]=ImageColorAllocate($img, 60, 60,130);
+ $c[mk2]=ImageColorAllocate($img, 80, 80,150);
+ $c[bar]=ImageColorAllocate($img,250,190, 40);
+ $c[pt] =ImageColorAllocate($img,250,250,250);
+ for($i=0;$i<$days;$i++){
+   $num=date('m',$dd+$i*86400)%2+1;
+    if(date('m-d',$dd+$i*86400)=='01-01') $num=3;
+#   if(date('m-d-y',$dd+$i*86400)=='08-05-09') $num=4;
+#   if(date('m-d-y',$dd+($i-$alen)*86400)=='08-05-09') $num=4;
+   ImageFilledRectangle($img,$i * $scalex,$m,($i + 1) * $scalex - 2,0,$c["bg$num"]);
+
+ }
+ for($i=0;$i<=($m / 50);$i++){
+   ImageLine($img,0,$m-$i*100+50,($days + 1) * $scalex - 1,$m-$i*100+50,$c[mk1]);
+   ImageLine($img,0,$m-$i*100,($days + 1) * $scalex - 1,$m-$i*100,$c[mk2]);
+   imagestring($img, 3, 3, $m-$i*100+1, ($i * 100) * $scaley, $c[bg]);
+   imagestring($img, 3, 3, $m-$i*100+51, ($i * 100 - 50) * $scaley, $c[bg]);
+   imagestring($img, 3, 2, $m-$i*100, ($i * 100) * $scaley, $c[mk2]);
+   imagestring($img, 3, 2, $m-$i*100+50, ($i * 100 - 50) * $scaley, $c[mk1]);
+
+   imagestring($img, 3, $xs - 71, $m-$i*100+1, sprintf("%10d", ($i * 100) * $scaley), $c[bg]);
+   imagestring($img, 3, $xs - 71, $m-$i*100+51, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[bg]);
+   imagestring($img, 3, $xs - 72, $m-$i*100, sprintf("%10d", ($i * 100) * $scaley), $c[mk2]);
+   imagestring($img, 3, $xs - 72, $m-$i*100+50, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[mk1]);
+ }
+
+
+	$users	= array(
+		  1 => array('name' => "Total posts         ", 'color' =>  imagecolorallocate($img, 255, 255, 255)),
+		 -1 => array('name' => "$alen-day average x 200", 'color' =>  0xFF8888),
+/*		 50 => array('name' => "Hyperhacker    ", 'color' =>  imagecolorallocate($img,  50, 255,  50)),
+		 61 => array('name' => "E. Prime       ", 'color' =>  imagecolorallocate($img, 200, 200,   0)),
+		 18 => array('name' => "Hiryuu         ", 'color' =>  imagecolorallocate($img, 255,  50,  50)),
+		 17 => array('name' => "NightKev       ", 'color' =>  imagecolorallocate($img, 200,   0, 200)),
+/		  5 => array('name' => "Hydrapheetz    ", 'color' =>  imagecolorallocate($img,  50,  50, 255)),
+		  3 => array('name' => "cpubasic13     ", 'color' =>  imagecolorallocate($img,   0, 200, 255)),
+		 52 => array('name' => "Shadic         ", 'color' =>  imagecolorallocate($img, 100,  50, 200)),
+		 57 => array('name' => "Kles           ", 'color' =>  imagecolorallocate($img,  50, 200, 100)),
+		 12 => array('name' => "Dorito         ", 'color' =>  imagecolorallocate($img, 200, 100,  50)),
+
+		 36 => array('name' => "Erika          ", 'color' =>  imagecolorallocate($img, 220, 100, 170)),
+		100 => array('name' => "Kas            ", 'color' =>  imagecolorallocate($img, 220, 170, 100)),
+		117 => array('name' => "Rydain         ", 'color' =>  imagecolorallocate($img, 220, 220,  79)),
+		118 => array('name' => "Aiya           ", 'color' =>  imagecolorallocate($img, 170, 150, 255)),
+		175 => array('name' => "Tina           ", 'color' =>  imagecolorallocate($img, 255, 100, 255)),
+		387 => array('name' => "Acmlm          ", 'color' =>  imagecolorallocate($img, 233, 190, 153)),
+		 49 => array('name' => "Dr. Sophie     ", 'color' =>  imagecolorallocate($img, 193, 210, 233)),
+*/
+//		  2 => array('name' => "Drag           ", 'color' =>  imagecolorallocate($img, 255,   0,   0)),
+
+);
+/*
+	$users	= array();
+	$userq	= $sql -> query("SELECT id, name FROM `users` ORDER BY `posts` DESC LIMIT 0, 10");
+	while ($u = $sql -> fetch($userq)) {
+		$users[$u['id']]	= array('name' => $u['name'], 'color' => imagecolorallocate($img, rand(100,255), rand(100,255), rand(100,255)));
+	}
+*/
+
+	$z	= count($users);
+	$namespace	= 12;
+
+	imagerectangle(      $img, 61, 11, 174 + 6 * 5, 15 + $z * $namespace, $c[bg]);
+	imagefilledrectangle($img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[bg2]);
+	imagerectangle(      $img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[mk2]);
+
+	$z	= 0;
+
+	foreach($users as $uid => $userx) {
+		if ($uid > 0) {
+			$data	= getdata($uid);
+			drawdata($data, $userx['color']);
+		}
+		imageline($img, 66, $z * $namespace + 19, 76, $z * $namespace + 19, $c[bg]);
+		imageline($img, 65, $z * $namespace + 18, 75, $z * $namespace + 18, $userx['color']);
+		imagestring($img, 2, 80 + 1, $z * $namespace + 12, $userx['name'], $c[bg]);
+		imagestring($img, 2, 80, $z * $namespace + 11, $userx['name'], $userx['color']);
+		$z++;
+	}
+
+	foreach($xdata as $k => $v) {
+		$xdata2[$k - 13697]	= ($v / 1);
+	}
+
+	if (false) {
+		print "<pre>days = $days \n\n\n";
+		print_r($data);
+		print "\n\n------------------------\n\n";
+		print_r($xdata2);
+		die();
+	}
+	drawdata($xdata2, $users[-1]['color']);
+ 
+ Header('Content-type:image/png');
+ ImagePNG($img);
+ ImageDestroy($img);
+
+
+ function drawdata($p, $color) {
+	 global $days, $scalex, $m, $img;
+	 $oldy	= $m;
+	 for($i=0;$i<$days;$i++){
+		$y		= $m-$p[$i];
+		$x		= $i * $scalex;
+		if (!$p[$i]) {
+			$y	 = $oldy;
+		}
+		imageline($img, $x, $oldy, $x + $scalex - 1, $y, $color);
+		$oldy	= $y;
+
+	 }
+ }
+
+  function getdata($u) {
+	 global $sql, $dd, $dd2, $scaley, $days, $xdata, $alen;
+	 $nn	= $sql -> query("SELECT FROM_UNIXTIME(date,'%Y%m%d') ymd, floor(date/86400) d, count(*) c FROM posts  GROUP BY ymd ORDER BY ymd");
+
+	 while ($n = $sql -> fetch($nn)) {
+	   $p[$n['d']]=$n['c'];
+	   
+	   for ($temp = $n['d']; $temp > $n['d'] - $alen; $temp--) {
+		$xdata[$n['d']]	+= $p[$temp];
+	   }
+	   $xdata[$n['d']]	/= $alen;
+	 
+	 }
+
+	$dat	= $sql -> query(
+		"SELECT count( * ) AS cnt, floor( to_days( now( ) ) ) - floor( to_days( from_unixtime( date ) ) ) AS d "
+		."FROM posts "
+//		."WHERE user =$u "
+		."GROUP BY d ORDER BY d DESC");
+	while ($z = $sql -> fetch($dat)) {
+	   $da = $days - $z['d'];
+	   $y	+= $z['cnt'];
+	   $p[$da] = $y / $scaley;
+
+	 }
+	return $p;
+  }
+
+
+?>
\ No newline at end of file
diff --git a/activity3u.php b/activity3u.php
new file mode 100644
index 0000000..05e97ae
--- /dev/null
+++ b/activity3u.php
@@ -0,0 +1,206 @@
+<?php
+ require 'lib/function.php';
+
+
+ $user['regdate']	= $sql -> resultq("SELECT MIN(`regdate`) FROM users");
+
+// $val				= $sql -> resultq("SELECT COUNT(DISTINCT `user`) FROM `posts` GROUP BY FLOOR(`date` / 86400)");
+ $val				= 99;
+ $max				= ceil(($val + 1) / 50) * 50;
+ $alen				= ($_GET['len'] ? $_GET['len'] : 30);
+
+ $alen				= min(max(7, $alen), 90);
+// $max				= 5500;
+
+ $vd=date('m-d-y', $user['regdate']);
+ $dd=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2));
+ $dd2=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2)+1,substr($vd,6,2));
+
+
+ $days=ceil((ctime()-$dd)/86400);
+ $scalex	= 2;
+ $scaley	= .2;
+ $m			= $max / $scaley;
+ $xs		= $days * $scalex;
+ $xsize		= $days * $scalex;
+
+ $img=ImageCreateTrueColor($xs,$m);
+
+ $c[bg]= ImageColorAllocate($img,  0,  0,  0);
+ $c[bg1]=ImageColorAllocate($img,  0,  0, 60);
+ $c[bg2]=ImageColorAllocate($img,  0,  0, 80);
+ $c[bg3]=ImageColorAllocate($img, 40, 40,100);
+ $c[bg4]=ImageColorAllocate($img,100, 40, 40);
+ $c[mk1]=ImageColorAllocate($img, 60, 60,130);
+ $c[mk2]=ImageColorAllocate($img, 80, 80,150);
+ $c[bar]=ImageColorAllocate($img,250,190, 40);
+ $c[pt] =ImageColorAllocate($img,250,250,250);
+ for($i=0;$i<$days;$i++){
+   $num=date('m',$dd+$i*86400)%2+1;
+   if(date('m-d',$dd+$i*86400)=='01-01') $num=3;
+   ImageFilledRectangle($img,$i * $scalex,$m,($i + 1) * $scalex - 2,0,$c["bg$num"]);
+
+ }
+ for($i=0;$i<=($m / 50);$i++){
+   ImageLine($img,0,$m-$i*100+50,($days + 1) * $scalex - 1,$m-$i*100+50,$c[mk1]);
+   ImageLine($img,0,$m-$i*100,($days + 1) * $scalex - 1,$m-$i*100,$c[mk2]);
+   imagestring($img, 3, 3, $m-$i*100+1, ($i * 100) * $scaley, $c[bg]);
+   imagestring($img, 3, 3, $m-$i*100+51, ($i * 100 - 50) * $scaley, $c[bg]);
+   imagestring($img, 3, 2, $m-$i*100, ($i * 100) * $scaley, $c[mk2]);
+   imagestring($img, 3, 2, $m-$i*100+50, ($i * 100 - 50) * $scaley, $c[mk1]);
+
+   imagestring($img, 3, $xs - 71, $m-$i*100+1, sprintf("%10d", ($i * 100) * $scaley), $c[bg]);
+   imagestring($img, 3, $xs - 71, $m-$i*100+51, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[bg]);
+   imagestring($img, 3, $xs - 72, $m-$i*100, sprintf("%10d", ($i * 100) * $scaley), $c[mk2]);
+   imagestring($img, 3, $xs - 72, $m-$i*100+50, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[mk1]);
+ }
+
+
+	$users	= array(
+		  1 => array('name' => "Users active per day", 'color' =>  imagecolorallocate($img, 255, 255, 255)),
+		 -1 => array('name' => "$alen-day average", 'color' =>  0xFF8888),
+/*		 50 => array('name' => "Hyperhacker    ", 'color' =>  imagecolorallocate($img,  50, 255,  50)),
+		 61 => array('name' => "E. Prime       ", 'color' =>  imagecolorallocate($img, 200, 200,   0)),
+		 18 => array('name' => "Hiryuu         ", 'color' =>  imagecolorallocate($img, 255,  50,  50)),
+		 17 => array('name' => "NightKev       ", 'color' =>  imagecolorallocate($img, 200,   0, 200)),
+/		  5 => array('name' => "Hydrapheetz    ", 'color' =>  imagecolorallocate($img,  50,  50, 255)),
+		  3 => array('name' => "cpubasic13     ", 'color' =>  imagecolorallocate($img,   0, 200, 255)),
+		 52 => array('name' => "Shadic         ", 'color' =>  imagecolorallocate($img, 100,  50, 200)),
+		 57 => array('name' => "Kles           ", 'color' =>  imagecolorallocate($img,  50, 200, 100)),
+		 12 => array('name' => "Dorito         ", 'color' =>  imagecolorallocate($img, 200, 100,  50)),
+
+		 36 => array('name' => "Erika          ", 'color' =>  imagecolorallocate($img, 220, 100, 170)),
+		100 => array('name' => "Kas            ", 'color' =>  imagecolorallocate($img, 220, 170, 100)),
+		117 => array('name' => "Rydain         ", 'color' =>  imagecolorallocate($img, 220, 220,  79)),
+		118 => array('name' => "Aiya           ", 'color' =>  imagecolorallocate($img, 170, 150, 255)),
+		175 => array('name' => "Tina           ", 'color' =>  imagecolorallocate($img, 255, 100, 255)),
+		387 => array('name' => "Acmlm          ", 'color' =>  imagecolorallocate($img, 233, 190, 153)),
+		 49 => array('name' => "Dr. Sophie     ", 'color' =>  imagecolorallocate($img, 193, 210, 233)),
+*/
+//		  2 => array('name' => "Drag           ", 'color' =>  imagecolorallocate($img, 255,   0,   0)),
+
+);
+/*
+	$users	= array();
+	$userq	= $sql -> query("SELECT id, name FROM `users` ORDER BY `posts` DESC LIMIT 0, 10");
+	while ($u = $sql -> fetch($userq)) {
+		$users[$u['id']]	= array('name' => $u['name'], 'color' => imagecolorallocate($img, rand(100,255), rand(100,255), rand(100,255)));
+	}
+*/
+
+	$z	= count($users);
+	$namespace	= 12;
+
+	imagerectangle(      $img, 61, 11, 174 + 6 * 5, 15 + $z * $namespace, $c[bg]);
+	imagefilledrectangle($img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[bg2]);
+	imagerectangle(      $img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[mk2]);
+
+	$z	= 0;
+
+	foreach($users as $uid => $userx) {
+		if ($uid > 0) {
+			$data	= getdata($uid);
+			drawdata($data, $userx['color']);
+		}
+		imageline($img, 66, $z * $namespace + 19, 76, $z * $namespace + 19, $c[bg]);
+		imageline($img, 65, $z * $namespace + 18, 75, $z * $namespace + 18, $userx['color']);
+		imagestring($img, 2, 80 + 1, $z * $namespace + 12, $userx['name'], $c[bg]);
+		imagestring($img, 2, 80, $z * $namespace + 11, $userx['name'], $userx['color']);
+		$z++;
+	}
+
+	foreach($xdata as $k => $v) {
+		$xdata2[$k - 13697]	= ($v * 5);
+	}
+
+	if (0) {
+		print "<pre>days = $days \n\n\n";
+		print_r($data);
+		print "\n\n------------------------\n\n";
+		print_r($xdata2);
+		die();
+	}
+	drawdata($xdata2, $users[-1]['color'], true, $users[-1]['color'] + 0x40000000);
+ 
+	Header('Content-type:image/png');
+	ImagePNG($img);
+	ImageDestroy($img);
+
+
+ function drawdata($p, $color, $derp = false, $color2 = false) {
+	 global $days, $scalex, $m, $img, $xs;
+	 $oldy	= $m;
+	 if ($derp) {
+		$points[]	= 0;
+		$points[]	= $m - 1;
+	 }
+	 for($i=0;$i<$days;$i++){
+		$y		= $m-$p[$i];
+		$x		= $i * $scalex;
+		if (!$p[$i]) {
+			$y	 = $oldy;
+		}
+		
+		if (!$derp) {
+			imageline($img, $x, $oldy, $x + $scalex - 1, $y, $color);
+			$oldy	= $y;
+		} elseif ($y != $m) {
+			$points[]	= $x;
+			$points[]	= $y;
+		}
+
+	 }
+	 if ($derp) {
+//		$points[]	= $xs;
+//		$points[]	= 499;
+//		$points[]	= 2769;
+//		$points[]	= 499;
+		$points[]	= $xs;
+		$points[]	= $y;
+		$points[]	= $xs;
+		$points[]	= $m - 1;
+		 imagefilledpolygon($img, $points, count($points) / 2, $color2);
+		 imagepolygon      ($img, $points, count($points) / 2, $color);
+	 }
+ }
+
+//SELECT COUNT(DISTINCT `user`) FROM `posts` GROUP BY FLOOR(`date` / 86400)
+
+  function getdata($u) {
+	 global $sql, $dd, $dd2, $scaley, $days, $xdata, $alen;
+	 $nn	= $sql -> query("SELECT FROM_UNIXTIME(date,'%Y%m%d') ymd, floor(date/86400) d,  count( DISTINCT `user`) c FROM posts GROUP BY ymd ORDER BY ymd");
+
+	 while ($n = $sql -> fetch($nn)) {
+	   $p[$n['d']]=$n['c'];
+	   
+	   for ($temp = $n['d']; $temp > $n['d'] - $alen; $temp--) {
+		$xdata[$n['d']]	+= $p[$temp];
+	   }
+	   $xdata[$n['d']]	/= $alen;
+	 
+	 }
+
+/*
+	$dat	= $sql -> query(
+		"SELECT count( * ) AS cnt, floor( to_days( now( ) ) ) - floor( to_days( from_unixtime( date ) ) ) AS d "
+		."FROM posts "
+//		."WHERE user =$u "
+		."GROUP BY d ORDER BY d DESC");
+*/
+	$dat	= $sql -> query(
+		"SELECT count( DISTINCT `user` ) AS cnt, floor( to_days( now( ) ) ) - floor( to_days( from_unixtime( date ) ) ) AS d "
+		."FROM posts "
+		."GROUP BY d ORDER BY d DESC");
+
+	while ($z = $sql -> fetch($dat)) {
+	   $da = $days - $z['d'];
+	   $y	+= $z['cnt'];
+	   $y	= $z['cnt'];
+	   $p[$da] = $y / $scaley;
+
+	 }
+	return $p;
+  }
+
+
+?>
\ No newline at end of file
diff --git a/admin-editforums.php b/admin-editforums.php
new file mode 100644
index 0000000..bf465eb
--- /dev/null
+++ b/admin-editforums.php
@@ -0,0 +1,386 @@
+<?php
+require_once('lib/function.php');
+
+if ($_POST['edit'] || $_POST['edit2']) {
+	if (!$isadmin) die("You aren't an admin!");
+
+	if (isset($_GET['preview']))
+		$prevtext = "&preview=" . $_GET['preview'];
+
+	$hidden = (($_POST['hidden']) ? 1 : 0);
+
+	$values .= "`title`          = '$forumtitle',     ";
+	$values .= "`description`    = '$description',    ";
+	$values .= "`catid`          = '$catid',          ";
+	$values .= "`minpower`       = '$minpower',       ";
+	$values .= "`minpowerthread` = '$minpowerthread', ";
+	$values .= "`minpowerreply`  = '$minpowerreply',  ";
+	$values .= "`numthreads`     = '$numthreads',     ";
+	$values .= "`numposts`       = '$numposts',       ";
+	$values .= "`forder`         = '$forder',         ";
+	$values .= "`specialscheme`  = '$edspecialscheme',";
+	$values .= "`hidden`         = '$hideforum',      ";
+	$values .= "`pollstyle`      = '$pollstyle'       ";
+
+	if ($_GET['id'] <= -1) {
+		$sql->query("INSERT INTO `forums` SET $values, `lastpostid` = '0'");
+		if (mysql_error()) die(mysql_error());
+		$id	= mysql_insert_id();
+		trigger_error("Created new forum \"$forumtitle\" with ID $id", E_USER_NOTICE);
+	} else {
+		$sql->query("UPDATE `forums` SET $values WHERE `id` = '". $_GET['id'] ."'");
+		if (mysql_error()) die(mysql_error());
+		$id	= $_GET['id'];
+		trigger_error("Edited forum ID $id", E_USER_NOTICE);
+	}
+
+	if ($_POST['edit'])
+		header("Location: ?id=". $id . $prevtext);
+	else
+		header("Location: ?".substr($prevtext, 1));
+
+	die();
+}
+elseif ($_POST['delete']) {
+	if (!$isadmin)
+		die("You aren't an admin!");
+
+	$id      = intval($_GET['delete']);
+	$mergeid = intval($_POST['mergeid']);
+
+	if (!isset($_GET['delete']) || $id < 0)
+		die("No forum selected to delete.");
+	if (!isset($_POST['mergeid']) || $mergeid < 0)
+		die("No forum selected to merge to.");
+
+	$counts = $sql->fetchq("SELECT `numthreads`, `numposts` FROM `forums` WHERE `id`='$id'");
+	$sql->query("UPDATE `threads` SET `forum`='$mergeid' WHERE `forum`='$id'") or die(mysql_error());
+	$sql->query("UPDATE `announcements` SET `forum`='$mergeid' WHERE `forum`='$id'") or die(mysql_error());
+	$sql->query("DELETE FROM `forummods` WHERE `forum`='$id'") or die(mysql_error());
+	$sql->query("DELETE FROM `forums` WHERE `id`='$id'") or die(mysql_error());
+
+	$lastthread = $sql->fetchq("SELECT * FROM `threads` WHERE `forum`='$mergeid' ORDER BY `lastpostdate` DESC LIMIT 1");
+	$sql->query("UPDATE `forums` SET
+		`numthreads`=`numthreads`+'{$counts['numthreads']}',
+		`numposts`=`numposts`+'{$counts['numposts']}',
+		`lastpostdate`='{$lastthread['lastpostdate']}',
+		`lastpostuser`='{$lastthread['lastposter']}',
+		`lastpostid`='{$lastthread['id']}'
+	WHERE `id`='$mergeid'") or die(mysql_error());
+
+	if (isset($_GET['preview']))
+		$prevtext = "preview=" . $_GET['preview'];
+
+	trigger_error("DELETED forum ID $id; merged into forum ID $mergeid", E_USER_NOTICE);
+
+	header("Location: ?$prevtext");
+	die();
+}
+
+$windowtitle = "Editing Forum List";
+require_once('lib/layout.php');
+
+print "$header<br>";
+
+admincheck();
+print adminlinkbar('admin-editforums.php');
+
+foreach($pwlnames as $pwl=>$pwlname) {
+	if ($pwl < 0) continue;
+	$powers[] = $pwlname;
+}
+$powers[] = '[no access]';
+
+$pollstyles = array(-2 => 'Disallowed',
+                    -1 => 'Normal',
+                     0 => 'Force Regular',
+                     1 => 'Force Influence');
+
+
+if (isset($_GET['delete'])) {
+	$forum = intval($_GET['delete']);
+
+	$forums[-1] = "Choose a forum to merge into...";
+	$forumquery = $sql->query("SELECT id,title FROM forums ORDER BY catid,forder");
+	while ($f = $sql->fetch($forumquery, MYSQL_ASSOC))
+		$forums[$f['id']] = $f['title'];
+
+	if (array_key_exists($forum, $forums)) {
+		$fname = $forums[$forum];
+		unset($forums[$forum]);
+		if (isset($_GET['preview']))
+			$prevtext = "&preview=" . $_GET['preview'];
+
+		echo  "
+		<form method=\"post\" action=\"?delete=". $forum . "$prevtext\">
+		$tblstart
+			<tr>
+				$tccellh>Deleting <b>$fname</b></td>
+			</tr><tr>
+				$tccellc>You are about to delete forum ID <b>$forum</b>.<br><br>
+				All announcements and threads will be moved to the forum below.<br>
+				". dropdownList($forums, -1, "mergeid") . "</td>
+			</tr><tr>
+				$tccellc><input type=\"submit\" name=\"delete\" value=\"DELETE FORUM\"> or <a href=?>Cancel</a></td>
+			</tr>
+		</table></form><br>";
+	}
+}
+else if (isset($_GET['id'])) {
+	$catquery = $sql->query("SELECT id,name FROM categories ORDER BY id");
+	while ($catres = $sql->fetch($catquery))
+		$categories[$catres['id']] = $catres['name'];
+
+	$forum = $sql->fetchq("SELECT * FROM `forums` WHERE `id` = '". $_GET['id'] . "'", MYSQL_ASSOC);
+	if (!$forum)
+		$_GET['id'] = -1;
+
+	if ($forum && !array_key_exists($forum['catid'], $categories))
+		$categories[$forum['catid']] = "Unknown category #" . $forum['catid'];
+
+	if (isset($_GET['preview']))
+		$prevtext = "&preview=" . $_GET['preview'];
+
+	echo  "
+	<form method=\"post\" action=\"?id=". $_GET['id'] . "$prevtext\">
+	$tblstart
+		<tr>
+			$tccellh colspan=6>Editing <b>". ($forum ? htmlspecialchars($forum['title']) : "a new forum") . "</b></td>
+		</tr>
+
+		<tr>
+			$tccellh>Forum Name</td>
+			$tccell1l colspan=4><input type=\"text\" name=\"forumtitle\" value=\"". htmlspecialchars($forum['title']) ."\"  style=\"width: 100%;\" maxlength=\"250\"></td>
+			$tccell1l width=10%><input type=\"checkbox\" id=\"hideforums\" name=\"hideforum\" value=\"1\"". ($forum['hidden'] ? " checked" : "") ."> <label for=\"hideforums\">Hidden</label></td>
+		</tr>
+
+		<tr>
+			$tccellh rowspan=4>Description</td>
+			$tccell1l rowspan=4 colspan=3>$txta=description ROWS=4 style=\"width: 100%; resize:none;\">". htmlspecialchars($forum['description']) ."</TEXTAREA></td>
+			$tccellh colspan=2>Minimum power needed...</td>
+		</tr>
+
+		<tr>
+			$tccellh>...to view the forum</td>
+			$tccell1l>". dropdownList($powers, $forum['minpower'], "minpower") . "</td>
+		</tr>
+
+		<tr>
+			$tccellh>...to post a thread</td>
+			$tccell1l>". dropdownList($powers, $forum['minpowerthread'], "minpowerthread") . "</td>
+		</tr>
+
+		<tr>
+			$tccellh>...to reply</td>
+			$tccell1l>". dropdownList($powers, $forum['minpowerreply'], "minpowerreply") . "</td>
+		</tr>
+
+		<tr>
+			$tccellh  width='10%'>Number of Threads</td>
+			$tccell1l width='24%'><input type=\"text\" name=\"numthreads\" maxlength=\"8\" size=\"10\" value=\"". ($forum['numthreads'] ? $forum['numthreads'] : "0") ."\" class=\"right\"></td>
+			$tccellh  width='10%'>Forum order</td>
+			$tccell1l width='23%'><input type=\"text\" name=\"forder\" maxlength=\"8\" size=\"10\" value=\"". ($forum['forder'] ? $forum['forder'] : "0") ."\" class=\"right\"></td>
+			$tccellh  width='10%'>Poll Style</td>
+			$tccell1l width='23%'>". dropdownList($pollstyles, $forum['pollstyle'], "pollstyle") . "</td>
+		</tr>
+
+		<tr>
+			$tccellh >Number of Posts</td>
+			$tccell1l><input type=\"text\" name=\"numposts\" maxlength=\"8\" size=\"10\" value=\"". ($forum['numposts'] ? $forum['numposts'] : "0") ."\" class=\"right\"></td>
+			$tccellh >Special Scheme</td>
+			$tccell1l><input type=\"text\" name=\"edspecialscheme\" value=\"". htmlspecialchars($forum['specialscheme']) ."\"  style=\"width: 90%;\" maxlength=\"250\"></td>
+			$tccellh >Category</td>
+			$tccell1l>". dropdownList($categories, $forum['catid'], "catid") . "</td>
+		</tr>
+
+		<tr>
+			$tccellc colspan=6><input type=\"submit\" name=\"edit\" value=\"Save and continue\">&nbsp;<input type=\"submit\" name=\"edit2\" value=\"Save and close\"></td>
+		</tr>
+
+	</table></form><br>";
+}
+
+	$forumlist="
+		<tr>
+			$tccellh width=90px>Actions</td>
+			$tccellh>Forum</td>
+			$tccellh width=80>Threads</td>
+			$tccellh width=80>Posts</td>
+			$tccellh width=15%>Last post</td>
+		</tr>
+	";
+
+	if (isset($_GET['preview'])) {
+		$forumquery = $sql->query("SELECT f.*,u.id AS uid,name,sex,powerlevel FROM forums f LEFT JOIN users u ON f.lastpostuser=u.id WHERE (!minpower OR minpower<=$_GET[preview]) AND f.hidden = '0' ORDER BY catid,forder");
+		$catquery = $sql->query("SELECT id,name FROM categories WHERE (!minpower OR minpower<=$_GET[preview]) ORDER BY id");
+		$prevtext = "&preview=" . $_GET['preview'];
+	}
+	else {
+		$forumquery = $sql->query("SELECT f.*,u.id AS uid,name,sex,powerlevel FROM forums f LEFT JOIN users u ON f.lastpostuser=u.id ORDER BY catid,forder");
+		$catquery = $sql->query("SELECT id,name FROM categories ORDER BY id");
+	}
+
+	$modquery = $sql->query("SELECT u.id,name,sex,powerlevel,forum FROM users u INNER JOIN forummods m ON u.id=m.user ORDER BY name");
+
+	$categories	= array();
+	$forums		= array();
+	$mods		= array();
+
+	while ($res = $sql->fetch($catquery))
+		$categories[] = $res;
+	while ($res = $sql->fetch($forumquery))
+		$forums[] = $res;
+	while ($res = $sql->fetch($modquery))
+		$mods[] = $res;
+
+	$forumlist .= "<tr><td class='tbl tdbgc center font' colspan=5>&lt; <a href=admin-editforums.php?id=-1$prevtext>Create a new forum</a> &gt;</td></tr>";
+
+	foreach ($categories as $category) {
+		$forumlist.="<tr><td class='tbl tdbgc center font' colspan=5><b>$category[name]</b></td></tr>";
+
+		foreach ($forums as $forumplace => $forum) {
+			if ($forum['catid'] != $category['id'])
+				continue;
+
+			$m = 0;
+			$modlist = "";
+			foreach ($mods as $modplace => $mod) {
+				if ($mod['forum'] != $forum['id'])
+					continue;
+
+				$namecolor=getnamecolor($mod['sex'],$mod['powerlevel']);
+				$modlist.=($m++?', ':'')."<a href=profile.php?id=$mod[id]><font $namecolor>$mod[name]</font></a>";
+				unset($mods[$modplace]);
+			}
+
+			if ($m)
+				$modlist="$smallfont(moderated by: $modlist)</font>";
+
+			$namecolor = getnamecolor($forum['sex'],$forum['powerlevel']);
+			if($forum['numposts']){
+				$forumlastpost="<nobr>". date($dateformat,$forum['lastpostdate']+$tzoff);
+				$by="$smallfont<br>by <a href=profile.php?id=$forum[uid]><font $namecolor>$forum[name]</font></a>". ($forum['lastpostid'] ? " <a href='thread.php?pid=". $forum['lastpostid'] ."#". $forum['lastpostid'] ."'>". $statusicons['getlast'] ."</a>" : "") ."</nobr></font>";
+			} else {
+				$forumlastpost=getblankdate();
+				$by='';
+			}
+
+			if($forum['lastpostdate']>$category['lastpostdate']){
+				$category['lastpostdate']=$forum['lastpostdate'];
+				$category['l']=$forumlastpost.$by;
+			}
+
+			if ($forum['hidden'])
+				$hidden = " <small><i>(hidden)</i></small>";
+			else
+				$hidden = "";
+
+			if ($_GET['id'] == $forum['id']) {
+				$tc1	= $tccellh;
+				$tc2	= $tccellh;
+				$tc2l	= $tccellhl;
+			}
+			else {
+				$tc1	= $tccell1;
+				$tc2	= $tccell2;
+				$tc2l	= $tccell2l;
+			}
+
+		  $forumlist.="
+			<tr>
+				$tc1><small><a href=admin-editforums.php?id=$forum[id]$prevtext>Edit</a> / <a href=admin-editforums.php?delete=$forum[id]$prevtext>Delete</a></small></td>
+				$tc2l><a href=forum.php?id=$forum[id]>$forum[title]</a>$hidden<br>
+				$smallfont$forum[description]<br>$modlist</td>
+				$tc1>$forum[numthreads]</td>
+				$tc1>$forum[numposts]</td>
+				$tc2><span class='lastpost'>$forumlastpost</span>$by$forumlastuser
+			</tr>
+		  ";
+
+			unset($forums[$forumplace]);
+		}
+	}
+
+// Leftover forums
+if (!isset($_GET['preview']) && count($forums)) {
+	$forumlist.="<tr><td class='tbl tdbgc center font' colspan=5><b><i>These forums are not associated with a valid category ID</i></b></td></tr>";
+
+	foreach ($forums as $forum) {
+		$m = 0;
+		foreach ($mods as $modplace => $mod) {
+			if ($mod['forum'] != $forum['id'])
+				continue;
+
+			$namecolor=getnamecolor($mod['sex'],$mod['powerlevel']);
+			$modlist.=($m++?', ':'')."<a href=profile.php?id=$mod[id]><font $namecolor>$mod[name]</font></a>";
+			unset($mods[$modplace]);
+		}
+
+		if ($m)
+			$modlist="$smallfont(moderated by: $modlist)</font>";
+
+		$namecolor = getnamecolor($forum['sex'],$forum['powerlevel']);
+		if($forum['numposts']){
+			$forumlastpost="<nobr>". date($dateformat,$forum['lastpostdate']+$tzoff);
+			$by="$smallfont<br>by <a href=profile.php?id=$forum[uid]><font $namecolor>$forum[name]</font></a>". ($forum['lastpostid'] ? " <a href='thread.php?pid=". $forum['lastpostid'] ."#". $forum['lastpostid'] ."'>". $statusicons['getlast'] ."</a>" : "") ."</nobr></font>";
+		} else {
+			$forumlastpost=getblankdate();
+			$by='';
+		}
+
+		if($forum['lastpostdate']>$category['lastpostdate']){
+			$category['lastpostdate']=$forum['lastpostdate'];
+			$category['l']=$forumlastpost.$by;
+		}
+
+		if ($forum['hidden'])
+			$hidden = " <small><i>(hidden)</i></small>";
+		else
+			$hidden = "";
+
+		$forumlist.="
+		<tr>
+			$tccell1><small><a href=admin-editforums.php?id=$forum[id]$prevtext>Edit</a> / <a href=admin-editforums.php?delete=$forum[id]$prevtext>Delete</a></small></td>
+			$tccell2l><a href=forum.php?id=$forum[id]>$forum[title]</a>$hidden<br>
+			$smallfont$forum[description]<br>$modlist</td>
+			$tccell1>$forum[numthreads]</td>
+			$tccell1>$forum[numposts]</td>
+			$tccell2><span class='lastpost'>$forumlastpost</span>$by$forumlastuser
+		</tr>
+		";
+	}
+}
+
+print "<center><b>Preview forums with powerlevel:</b> ".previewbox()."</center>\n";
+print "$tblstart$forumlist$tblend$footer";
+printtimedif($startingtime);
+
+function dropdownList($links, $sel, $n) {
+	global $tccell1, $tccellc;
+	$r	= "<select name=\"$n\">";
+
+	foreach($links as $link => $name) {
+		$cell	= $tccell1;
+		if ($link == $sel) $cell	= $tccellc;
+		$r	.= "<option value=\"$link\"". ($sel == $link ? " selected" : "") .">$name</option>";
+	}
+
+	return $r ."</select>";
+}
+
+function previewbox(){
+	if (isset($_GET['id'])) {
+		$idtxt = "id=" . $_GET['id'] . "&";
+		$idtxt2 = "?id=" . $_GET['id'];
+	}
+
+	return "<form><select onChange=parent.location=this.options[this.selectedIndex].value>
+			<option value='admin-editforums.php{$idtxt2}' ".((!$_GET['preview'] || $_GET['preview'] < 0 || $_GET['preview'] > 4) ? 'selected' : '') ."'>Disable</option>
+			<option value='admin-editforums.php?{$idtxt}preview=0' ".((isset($_GET['preview']) && $_GET['preview'] == 0) ? 'selected' : '') .">Normal</option>
+			<option value='admin-editforums.php?{$idtxt}preview=1' ".($_GET['preview'] == 1 ? 'selected' : '') .">Normal +</option>
+			<option value='admin-editforums.php?{$idtxt}preview=2' ".($_GET['preview'] == 2 ? 'selected' : '') .">Moderator</option>
+			<option value='admin-editforums.php?{$idtxt}preview=3' ".($_GET['preview'] == 3 ? 'selected' : '') .">Administrator</option>
+			<option value='admin-editforums.php?{$idtxt}preview=4' ".($_GET['preview'] == 4 ? 'selected' : '') .">Administrator (hidden)</option>
+		</select></form>";
+}
+?>
diff --git a/admin-editmods.php b/admin-editmods.php
new file mode 100644
index 0000000..30a1076
--- /dev/null
+++ b/admin-editmods.php
@@ -0,0 +1,133 @@
+<?php
+
+require 'lib/function.php';
+$windowtitle = "$boardname - Forum Moderators";
+require 'lib/layout.php';
+
+print $header."<br>";
+
+admincheck();
+print adminlinkbar('admin-editmods.php');
+
+$donotprint = false;
+if ($action) {
+//  print "DEBUG: Asked to ".$action." a moderator of forum: ".${$action."modforum"}." and user: ".${$action."moduser"};
+	$donotprint = true;
+	switch($action) {
+		case "remove":
+			$removemod = explode("|", $removemod);
+			$removemoduser = $removemod[1];
+			$removemodforum = $removemod[0];
+
+			$sql->query("DELETE FROM forummods WHERE user='$removemoduser' AND forum='$removemodforum'");
+			if(($err=mysql_error()) != "")
+				print "$tblstart$tccell1> ERROR: $err.";
+			else {
+				$sql->query("INSERT INTO actionlog (atime, adesc, aip) VALUES (".ctime().", \"User ".$loguserid." removed mod $removemoduser from forum $removemodforum\", \"$userip\")");
+				print "$tblstart$tccell1> You successfully deleted user $removemoduser from forum $removemodforum.<br>".redirect("admin-editmods.php",'go back to Edit Mods',0);
+			}
+		break;
+		case "add":
+			$sql->query("INSERT INTO forummods VALUES('$addmodforum', '$addmoduser')");
+			if(($err=mysql_error()) != "")
+				print "$tblstart$tccell1> ERROR: $err.";
+			else {
+ 				$sql->query("INSERT INTO actionlog (atime, adesc, aip) VALUES (".ctime().", \"User ".$loguserid." added mod $addmoduser to forum $addmodforum\", \"$userip\")");
+				print "$tblstart$tccell1> You successfully added user $addmoduser to forum $addmodforum.<br>".redirect("admin-editmods.php",'go back to Edit Mods',0);
+			}
+		break;
+		default:
+			print "No, doofus.";
+  }
+}
+
+if (!$donotprint) {
+	$forums=$sql->query("SELECT id,title,description,catid FROM forums ORDER BY catid");
+	$fa="";
+	$forumselect="<option value=\"0\">Select a forum...</option>\r\n";
+	$forumselectforrem = "<option value=\"0|0\">Select a forum and moderator...</option>\r\n";
+  while($forum=$sql->fetch($forums)) {
+		$m=0;
+		$modlist="";
+		$forumselect.="<option value=\"$forum[id]\">$forum[title]</option>";
+		$mods=$sql->query("SELECT user FROM forummods WHERE forum=$forum[id]");
+		if($mods) {
+			while($mod=$sql->fetch($mods)) {
+				$usermod=$sql->fetchq("SELECT aka,sex,powerlevel,name,id from users where id=$mod[user]");
+				if($m) $modlist.=", ";
+				$modlist .= getuserlink($usermod);
+				$forumselectforrem.="<option value=\"$forum[id]|$usermod[id]\">$forum[title] -- $usermod[name]</option>\r\n";
+				$m++;
+			}
+		}
+		if ($m)
+    $fa.="
+			<tr>
+      <td class='tbl tdbg2 center fonts'>$forum[id]</td>
+			<td class='tbl tdbg1 center fonts'>$forum[title]</td>
+			<td colspan=3 class='tbl tdbg2 left fonts'>$modlist</td>
+      </tr>
+		";
+	}
+
+	$userlist = "<option value=\"0\">Select a user...</option>\r\n";
+	$users1=$sql->query("SELECT `id`, `name` FROM `users` WHERE `powerlevel` > '0' ORDER BY `name`");
+	while($user=$sql->fetch($users1))
+		$userlist.="<option value=$user[id]>$user[name]</option>\r\n";
+
+print "
+
+$tblstart
+<tr><td class='tbl tdbgh center fonts' width=50>ID</td>
+<td class='tbl tdbgh center fonts' width=30%>Forum Name</td>
+<td class='tbl tdbgh center fonts' width=65%>Moderators</td></tr>$fa$tblend
+
+<form action=\"admin-editmods.php\" method=\"POST\">$inph=\"action\" value=\"add\"><br>$tblstart".
+/*            <tr>
+	 $tccellh><b>$smallfont Delete a mod.</td>
+         $tccellh><b>$smallfont Add Moderator.</td>
+
+ </td>
+<tr>
+	$tccell1> User ID: <input type=\"text\" name=\"dm_uid\"></td>
+$tccell1>            User ID: <input type=\"text\" name=\"nm_uid\"></td>
+
+<tr>
+	$tccell1> Forum ID: <input type=\"text\" name=\"dm_fid\"></td>
+$tccell1>            Forum ID: <input type=\"text\" name=\"nm_fid\">
+
+<tr>
+	    $tccell1> <input type=\"submit\" name=\"action\" value=\"Delete Mod\"></td>
+$tccell1>            <input type=\"submit\" name=\"action\" value=\"Add Mod\">*/
+"<tr>$tccellh colspan=\"2\">Add Moderator:</td></tr>
+<tr>$tccell1 width=15%>Forum:</td>$tccell2l width=85%><select name=\"addmodforum\" size=\"1\">$forumselect</select></td></tr> 
+<tr>$tccell1 width=15%>User:</td>$tccell2l width=85%><select name=\"addmoduser\" size=\"1\">$userlist</select> $smallfont(note: this only shows Member+ and above)</font></td></tr>
+<tr>$tccell1 width=15%>&nbsp;</td>$tccell2l width=85%>$inps=\"addmodsubmit\" value=\"Add Moderator\"></td></tr>$tblend</form>"
+.
+
+/*            <tr>
+	 $tccellh><b>$smallfont Delete a mod.</td>
+         $tccellh><b>$smallfont Add Moderator.</td>
+
+ </td>
+<tr>
+	$tccell1> User ID: <input type=\"text\" name=\"dm_uid\"></td>
+$tccell1>            User ID: <input type=\"text\" name=\"nm_uid\"></td>
+
+<tr>
+	$tccell1> Forum ID: <input type=\"text\" name=\"dm_fid\"></td>
+$tccell1>            Forum ID: <input type=\"text\" name=\"nm_fid\">
+
+<tr>
+	    $tccell1> <input type=\"submit\" name=\"action\" value=\"Delete Mod\"></td>
+$tccell1>            <input type=\"submit\" name=\"action\" value=\"Add Mod\">*/
+($forumselectforrem!=""?"<form action=\"admin-editmods.php\" method=\"POST\">$inph=\"action\" value=\"remove\">$tblstart"."<tr>$tccellh colspan=\"2\">Remove Moderator:</td></tr>
+<tr>$tccell1 width=15%>Forum and Moderator:</td>$tccell2l width=85%><select name=\"removemod\" size=\"1\">$forumselectforrem</select></td></tr> 
+<tr>$tccell1 width=15%>&nbsp;</td>$tccell2l width=85%>$inps=\"removemodsubmit\" value=\"Remove Moderator\"></td></tr>$tblend</form>":"");
+
+}
+
+print $footer;
+printtimedif($startingtime);
+
+?>
diff --git a/admin-slammer.php b/admin-slammer.php
new file mode 100644
index 0000000..99447e1
--- /dev/null
+++ b/admin-slammer.php
@@ -0,0 +1,73 @@
+<?php
+
+require 'lib/function.php';
+$windowtitle = "$boardname - EZ Ban Hammer";
+require 'lib/layout.php';
+
+print $header."<br>";
+echo "<div style='white-space:pre;'>";
+
+admincheck();
+//print adminlinkbar('admin-slammer.php');
+
+$target_id = $sql->resultq('SELECT id FROM users ORDER BY id DESC LIMIT 1');
+$uinfo = $sql->fetchq("SELECT name, lastip FROM users WHERE id = '{$target_id}'");
+
+if ($_POST['knockout'] && $_POST['knockout'] != $target_id)
+{
+	echo "Whoops! Someone else took that user to the slammer before you did.\n";
+	echo "\n</div>".redirect("admin-slammer.php", 'the slammer (for another go)', 2);
+	die();
+}
+else if ($_POST['knockout'])
+{
+	echo "SLAM JAM:\n";
+
+	$sql->query("DELETE FROM threads WHERE user = '{$target_id}' LIMIT 50");
+	echo "Deleted threads.\n";
+
+	$sql->query("DELETE FROM posts_text WHERE pid IN (SELECT id FROM posts WHERE user = '{$target_id}') LIMIT 50");
+	$sql->query("DELETE FROM posts WHERE user = '{$target_id}' LIMIT 50");
+	echo "Deleted posts.\n";
+
+	$sql->query("DELETE FROM users WHERE id = '{$target_id}' LIMIT 1");
+	$sql->query("DELETE FROM users_rpg WHERE uid = '{$target_id}' LIMIT 1");
+	echo "Deleted user data.\n";
+
+	$new_maxid = intval($sql->resultq("SELECT id FROM users ORDER BY id DESC LIMIT 1"));
+	$sql->query("ALTER TABLE users AUTO_INCREMENT = {$new_maxid}");
+	echo "Max ID set to {$new_maxid}.\n";
+
+	@$sql->query("INSERT INTO `ipbans` SET `ip` = '". $uinfo['lastip'] ."', `date` = '". ctime() ."', `reason` = 'Thanks for playing!'");
+	echo "Delivered IP ban to {$uinfo['lastip']}.\n";
+
+	xk_ircsend("1|". xk(8) . $uinfo['name'] . xk(7). " (IP " . xk(8) . $uinfo['lastip'] . xk(7) .") is the latest victim of the new EZ BAN button(tm).");
+
+	echo "\n</div>".redirect("admin-slammer.php", 'the slammer (for another go)', 2);
+	die();
+}
+else
+{
+	$threads = $sql->getarraybykey("SELECT id, forum, title FROM threads WHERE user = '{$target_id}'", 'id');
+	$posts = $sql->getarraybykey("SELECT id, thread FROM posts WHERE user = '{$target_id}'", 'id');
+
+	$ct_threads = count($threads);
+	$ct_posts   = count($posts);
+
+	echo "Up on the chopping block today is \"{$uinfo['name']}\".\n\n";
+	echo "Their last known IP address is \"{$uinfo['lastip']}\".\n\n";
+
+	echo "They have made {$ct_threads} thread(s):\n";
+	foreach ($threads as $th)
+		echo "{$th['id']}: {$th['title']} (in forum {$th['forum']})\n";
+
+	echo "\nThey have made {$ct_posts} post(s):\n";
+	foreach ($posts as $po)
+		echo "{$po['id']}: in thread {$po['thread']}\n";
+
+	?>
+
+	</div>Press the button?
+	<form action="?" method="POST"><input type="hidden" name="knockout" value="<?php echo $target_id; ?>"><input type="submit" value="DO IT DAMMIT"></form>
+	<?php
+}
\ No newline at end of file
diff --git a/admin-threads.php b/admin-threads.php
new file mode 100644
index 0000000..326ac60
--- /dev/null
+++ b/admin-threads.php
@@ -0,0 +1,114 @@
+<?php
+
+  $windowtitle	= "Thread Repair System";
+
+  require 'lib/function.php';
+  require 'lib/layout.php';
+
+  print "$header<br>";
+	
+  if (!$isadmin) {
+
+	print "  
+		$tblstart
+			$tccell1>This feature is restricted.</td>
+		$tblend
+
+	$footer
+	";
+	printtimedif($startingtime);
+	die();
+  }
+
+
+	print adminlinkbar("admin-threads.php");
+
+	if (!$_POST['run']) {
+		print "<form action=\"admin-threads.php\" method=\"post\">  
+			$tblstart
+				<tr>$tccellh>Thread Repair System</td></tr>
+				<tr>$tccell1>&nbsp;
+					<br>This page is intended to repair threads with broken reply counts. Please don't flood it with requests.
+					<br>This problem causes \"phantom pages\" (e.g., too few or too many pages displayed).
+					<br>&nbsp;
+					<br>$inps=\"run\" value=\"Start\">
+					<br>&nbsp;
+				</td></tr>
+			$tblend
+			</form>
+		";
+	} else {
+
+		print "
+			$tblstart
+				<tr>$tccellh>Thread Repair System</td></tr>
+				<tr>$tccell1>Now running.
+				</td></tr>
+			$tblend
+		<br>
+		$tblstart
+			<tr>
+				$tccellh>id#</td>
+				$tccellh>Name</td>
+				$tccellh>Reports</td>
+				$tccellh>Real</td>
+				$tccellh>Err</td>
+				$tccellh>Status</td>
+			</tr>
+		";
+
+	$q	= "SELECT `posts`.`thread`, (COUNT(`posts`.`id`)) AS 'real', ((COUNT(`posts`.`id`) - 1) - `threads`.`replies`) AS 'offset', `threads`.`replies`, `threads`.`title` AS `threadname`  FROM `posts` LEFT JOIN `threads` ON `posts`.`thread` = `threads`.`id` GROUP BY `thread` ORDER BY `offset` DESC";
+	$sql	= mysql_query($q) or die(mysql_error());
+
+	$count	= "";
+	while ($data = mysql_fetch_array($sql, MYSQL_ASSOC)) {
+
+		$status	= "";
+
+		if ($data['offset'] != 0) {
+
+			if ($data['offset'] >= 10000000) { 
+				$data['offset']	= ($data['real'] - 1) - $data['replies'];
+//				$status			= "<font color=\"#ff8080\">First post missing or otherwise broken</font>";
+//				$data['offset']	= "&nbsp;";
+			}
+
+			if (!$status) {
+				$status	= mysql_query("UPDATE `threads` SET `replies` = '". ($data['real'] - 1) ."' WHERE `id` = '". $data['thread'] ."'") or "<font color=#ff0000>Error</font>: ". mysql_error();
+				if ($status == 1) $status	= "<font color=#80ff80>Updated</font>";
+//				$status	= "Not updated";
+				$count++;
+			}
+
+			print "
+			<tr>
+				$tccell1>". $data['thread'] ."</td>
+				$tccell2l><a href=\"thread.php?id=". $data['thread'] ."\">". $data['threadname'] ."</a></td>
+				$tccell1r>". $data['replies'] ."</td>
+				$tccell1r>". $data['real'] ."</td>
+				$tccell2r><b>". $data['offset'] ."</b></td>
+				$tccell1l>$status</td>
+			</tr>";		
+
+		} else {
+			break;
+		}
+	}
+
+	if ($count) {
+		print "<tr>$tccellc colspan=6>$count thread". ($count != 1 ? "s" : "") ." updated.</td></tr>";
+	} else {
+
+		print "		<tr>$tccell1 colspan=6>&nbsp;
+					<br>No problems found.
+					<br>&nbsp;
+				</td></tr>";
+	}
+ }
+
+  
+  print "$tblend
+	$footer
+	";
+  printtimedif($startingtime);
+?>
diff --git a/admin-threads2.php b/admin-threads2.php
new file mode 100644
index 0000000..8b9a2f6
--- /dev/null
+++ b/admin-threads2.php
@@ -0,0 +1,108 @@
+<?php
+
+  $windowtitle	= "Thread Repair System II";
+
+  require 'lib/function.php';
+  require 'lib/layout.php';
+
+  print "$header<br>";
+	
+  if (!$isadmin) {
+
+	print "  
+		$tblstart
+			$tccell1>This feature is restricted.</td>
+		$tblend
+
+	$footer
+	";
+	printtimedif($startingtime);
+	die();
+  }
+
+	print adminlinkbar("admin-threads2.php");
+
+	if (!$_POST['run']) {
+		print "<form action=\"admin-threads2.php\" method=\"post\">  
+			$tblstart
+				<tr>$tccellh>Thread Repair System II</td></tr>
+				<tr>$tccell1>&nbsp;
+					<br>This page is intended to repair threads with broken 'last reply' times/users.
+					<br>This problem causes bumped threads that shouldn't be, especially with badly deleted posts.
+					<br>&nbsp;
+					<br>$inps=\"run\" value=\"Start\">
+					<br>&nbsp;
+				</td></tr>
+			$tblend
+			</form>
+		";
+	} else {
+
+		print "
+			$tblstart
+				<tr>$tccellh>Thread Repair System II</td></tr>
+				<tr>$tccell1>Now running.
+				</td></tr>
+			$tblend
+		<br>
+		$tblstart
+			<tr>
+				$tccellh>id#</td>
+				$tccellh>Name</td>
+				$tccellh>Reported Date</td>
+				$tccellh>Real Date</td>
+				$tccellh>Difference</td>
+				$tccellh>Status</td>
+			</tr>
+		";
+
+
+ 
+	$q	= "SELECT `threads`.`id`, `threads`.`title` , `threads`.`lastpostdate` , `posts`.`date` as realdate, (`posts`.`date` - `threads`.`lastpostdate`) AS `diff` FROM `threads` LEFT JOIN (SELECT MAX(`date`) as `date`, `thread` FROM `posts` GROUP BY `thread`) as `posts`  ON `posts`.`thread` = `threads`.`id` ORDER BY `diff` DESC";
+	$sql	= mysql_query($q) or die(mysql_error());
+
+	$count	= "";
+	while ($data = mysql_fetch_array($sql, MYSQL_ASSOC)) {
+
+		$status	= "";
+
+		if ($data['lastpostdate'] != $data['realdate']) {
+
+			if ($data['lastpostdate'] == "0" && $data['realdate'] == NULL) {
+				$status	= "<font color=#ff8888>Broken thread</font>";
+			} else {
+
+				$userd	= mysql_fetch_array(mysql_query("SELECT `date`, `user` FROM `posts` WHERE `thread` = '". $data['id'] ."' ORDER BY `date` DESC LIMIT 1"), MYSQL_ASSOC);
+				$status	= mysql_query("UPDATE `threads` SET `lastposter` = '". $userd['user'] ."', `lastpostdate` = '". $userd['date'] ."' WHERE `id` = '". $data['id'] ."'") or "<font color=#ff0000>Error</font>: ". mysql_error();
+				if ($status == 1) $status	= "<font color=#80ff80>Updated</font>";
+				$count++;
+			}
+		}
+
+		if ($status) {
+
+			print "
+			<tr>
+				$tccell1>". $data['id'] ."</td>
+				$tccell2l><a href=\"thread.php?id=". $data['id'] ."\">". $data['title'] ."</a></td>
+				$tccell1>". ($data['lastpostdate'] ? date($dateformat, $data['lastpostdate'] + $tzoff) : "-") ."</td>
+				$tccell1>". ($data['realdate'] ? date($dateformat, $data['realdate'] + $tzoff) : "-") ."</td>
+				$tccell1>". timeunits2($data['lastpostdate'] - $data['realdate']) ."</td>
+				$tccell2l>$status</td>
+			</tr>";	
+		}
+	}
+
+	if ($count) {
+		print "<tr>$tccellc colspan=6>$count thread". ($count != 1 ? "s" : "") ." updated.</td></tr>";
+	} else {
+		print "<tr>$tccellc colspan=6>Nothing to repair.</td></tr>";
+	}
+ }
+
+  
+  print "$tblend
+	$footer
+	";
+  printtimedif($startingtime);
+?>
diff --git a/admin.php b/admin.php
new file mode 100644
index 0000000..e57f020
--- /dev/null
+++ b/admin.php
@@ -0,0 +1,122 @@
+<?php
+
+	require 'lib/function.php';
+	$windowtitle	= "Admin Cruft -- $boardname";
+	require 'lib/layout.php';
+
+	print "$header<br>";
+	
+	if (!$isadmin) {
+
+		print "  
+			$tblstart
+				$tccell1>Uh oh, you are not the admin go away.</td>
+			$tblend
+
+		$footer
+		";
+		printtimedif($startingtime);
+		die();
+	}
+
+	
+	$misc	= $sql -> fetchq("SELECT * FROM `misc`");
+
+	print adminlinkbar("admin.php") ."
+		$tblstart
+			<tr>$tccellh><b>Panel de Admin<br></td></tr>
+			<tr>$tccell1>&nbsp;
+				<br>Under construction for
+				<br><b>". timeunits2(time() - mktime(19, 20, 21, 9, 27, 2007)) ."</b>
+				<br>...and counting!
+				<br>&nbsp;
+			</td></tr>
+		$tblend
+
+		<br>
+		
+		<form action='admin.php' method='post'>
+		$tblstart
+			<tr>$tccellh colspan=2><b>Setting up the Soft Dip</b></td></tr>
+			<tr>$tccellc colspan=2>Board settings</td></tr>
+
+			<tr>$tccell1 width='200'><b>". $statusicons['hot'] ." threshold</b></td>
+				$tccell2l>	$inpt='hotcount' value='". $misc['hotcount'] ."' class='right'> replies
+							$inph='hotcount_' value='". $misc['hotcount'] ."'>
+				</td></tr>
+
+			<tr>$tccell1 width='200'><b>Disable forum?</b></td>
+				$tccell2l>	$inpc='disable' value='1'> Disable
+				</td></tr>
+
+
+			<tr>$tccellc colspan=2>Records</td></tr>
+
+			<tr>$tccell1 width='200'><b>View count</b></td>
+				$tccell2l>	$inpt='views' value='". $misc['views'] ."' class='right'> views
+							$inph='views' value='". $misc['views'] ."'>
+				</td></tr>
+
+
+			<tr>$tccell1 width='200'><b>Max posts/day</b></td>
+				$tccell2l>	$inpt='maxpostsday' value='". $misc['maxpostsday'] ."' class='right'> posts, at $inpt='maxpostsdaydate' value='". $misc['maxpostsdaydate'] ."' class='right'>
+							$inph='maxpostsday' value='". $misc['maxpostsday'] ."'>$inph='maxpostsdaydate' value='". $misc['maxpostsdaydate'] ."'>
+				</td></tr>
+
+			<tr>$tccell1 width='200'><b>Max posts/hour</b></td>
+				$tccell2l>	$inpt='maxpostshour' value='". $misc['maxpostshour'] ."' class='right'> posts, at $inpt='maxpostshourdate' value='". $misc['maxpostshourdate'] ."' class='right'>
+							$inph='maxpostshour' value='". $misc['maxpostshour'] ."'>$inph='maxpostshourdate' value='". $misc['maxpostshourdate'] ."'>
+				</td></tr>
+
+			<tr>$tccell1 width='200'><b>Most users online</b></td>
+				$tccell2l>	$inpt='maxusers' value='". $misc['maxusers'] ."' class='right'> users, at $inpt='maxusersdate' value='". $misc['maxusersdate'] ."' class='right'>
+							<br>$inpc='maxusersreset' value='1'> Reset user list
+							$inph='maxusers' value='". $misc['maxusers'] ."'>$inph='maxusersdate' value='". $misc['maxusersdate'] ."'>
+				</td></tr>
+
+	
+			<tr>$tccellc colspan=2><img src=\"images/ihateglennbeckbutistillthinkthisimagefitsquitenicelyundertheadminpanelmoneycounter.jpg\" title=\"longest file name ever\"><br>Monetary settings</td></tr>
+
+			<tr>$tccell1 width='200'><b>Donations</b></td>
+				$tccell2l>	$inpt='donations' value='". sprintf("%01.2f", $misc['donations']) ."' class='right'>$
+							$inph='donations' value='". sprintf("%01.2f", $misc['donations']) ."'>
+				</td></tr>
+
+			<tr>$tccell1 width='200'><b>$$$ Ads $$$</b></td>
+				$tccell2l>	$inpt='ads' value='". sprintf("%01.2f", $misc['ads']) ."' class='right'>$
+							$inph='ads' value='". sprintf("%01.2f", $misc['ads']) ."'>
+				</td></tr>
+
+
+			<tr>$tccellc colspan=2>&nbsp;</td></tr>
+
+			<tr>$tccell1 width='200'>&nbsp;</td>
+				$tccell2l>	$inps='submit' value='Submit changes'>
+				<br><s><strong>(Only saves the money settings though.)</strong></s> just kidding, it doesn't work.
+				</td></tr>
+
+		
+		$tblend
+		</form>
+
+	";
+
+
+
+	print "$footer";  
+	printtimedif($startingtime);
+
+
+	// returns several field names with hours/date/time all set up and that jazz etc blah blah blah
+	function timetofields($fname, $time) {
+	
+		
+
+		return;
+	}
+
+
+
+
+
+?>
diff --git a/adnonsense.php b/adnonsense.php
new file mode 100644
index 0000000..b1e69a7
--- /dev/null
+++ b/adnonsense.php
@@ -0,0 +1,154 @@
+<?php
+
+//	die();
+
+	require "lib/function.php";
+	
+	header("Cache-Control: max-age=43200");
+	header('Expires: '.gmdate('D, d M Y H:i:s', time() + 43200).' GMT');
+
+	$img	= imagecreatetruecolor(622, 22);	
+	imagealphablending($img, false);
+	imagesavealpha($img, true);
+	imagefilledrectangle($img, 0, 0, 888, 888, imagecolorallocatealpha($img, 255, 0, 0, 127));
+
+	$font	= imageloadfont("images/terminal6.gdf");
+
+	imageline($img,  21,   0, 621,   0, 0x000000);
+	imageline($img,   0,  21, 600,  21, 0x000000);
+	imageline($img,   0,  21,  21,   0, 0x000000);
+	imageline($img, 600,  21, 621,   0, 0x000000);
+
+
+	$data	= $sql -> fetchq("SELECT `donations`, `ads`, `valkyrie` FROM `misc`");
+	$bonusr	= 0;
+	$bonusg	= 0;
+	$bonusb	= 0;
+
+	if ($_GET['m'] == "d") {
+		$money	= $data['donations'];
+		$text	= "Donations";
+		$textc	= imagecolorallocatealpha($img,  80, 200,  80, 40);
+		if ($money >= 120) {
+			$money	-= 120;
+			$bonusr	= -.5;
+			$bonusg	= .1;
+			$bonusb	= -.5;
+			$bonusm	= 120;
+		}
+	} elseif ($_GET['m'] == "t") {
+		$money	= $data['donations'] + $data['ads'];
+		$text	= "Total";
+		$textc	= imagecolorallocatealpha($img, 140, 140, 255, 40);
+		if ($money >= 120) {
+			$money	= min(120, $data['donations']) + $data['ads'] - 120;	// Extra donations don't count towards extra funding
+//			$money	= $data['donations'] + $data['adsense'] - 120;
+//			$text	= "Extra!";
+			$bonusr	= -.5;
+			$bonusg	= -.5;
+			$bonusb	= .3;
+		}
+
+	} elseif ($_GET['m'] == "v") {
+		$money	= $data['valkyrie'];
+		$text	= "VPS fund";
+		$textc	= imagecolorallocatealpha($img, 140, 140, 255, 40);
+		if ($money >= 120) {
+			$money	-= 120;
+			$bonusr	= -.5;
+			$bonusg	= -.5;
+			$bonusb	= .3;
+		}
+	} else {
+		$money	= $data['ads'];
+		$text	= "Ad rev.";
+		$textc	= imagecolorallocatealpha($img, 255,  80,  80,  40);
+		if ($money >= 120) {
+			$money	-= 120;
+			$bonusr	= .3;
+			$bonusg	= -.3;
+			$bonusb	= -.3;
+			$bonusm	= 120;
+		}
+	}
+
+	
+	for ($i = 0; $i < 600; $i++) {
+		$c	= floor($i / 600 * 100) + 27;
+		if ($i % 50 == 0) $c = floor($c * 0.8);
+		if ($i >= 597) $c = floor($c * (1.3 + ($i == 599 ? 0.4 : 0.0)));
+		if ($i <= 2) $c = floor($c * (1.3 + ($i == 0 ? 0.4 : 0.0)));
+
+		fillbar($img, $i, $c * (1 + $bonusr ), $c * (1 + $bonusg ), $c * (1 + $bonusb ));
+	}
+
+	$max	= min(600, ($money / 120) * 600);
+
+	for ($i = 0; $i < $max; $i++) {
+		if ($_GET['m'] == "d") {	// Donations use a different color scheme
+			$r	=  20 + floor($i / 600 * 100);
+			$g	=  80 + floor($i / 600 * 170);
+			$b	=  25 + floor($i / 600 * 110);
+		} elseif ($_GET['m'] == "t" || $_GET['m'] == "v") {
+			$b	= 100 + floor($i / 600 * 150);
+			$g	=  20 + floor($i / 600 *  60);
+			$r	=  25 + floor($i / 600 *  80);
+		} else {
+			$r	= 100 + floor($i / 600 * 150);
+			$g	=  20 + floor($i / 600 *  60);
+			$b	=  25 + floor($i / 600 *  80);
+		}
+		if ($i % 50 == 0 && $i <= $max - 3) {
+			$r = floor($r * 0.8);
+			$g = floor($g * 0.8);
+			$b = floor($b * 0.8);
+		} elseif ($i >= $max - 3) {
+			$r = floor($r * (1.3 + ($i == $max - 1 ? 0.4 : 0.0)));
+			$g = floor($g * (1.3 + ($i == $max - 1 ? 0.4 : 0.0)));
+			$b = floor($b * (1.3 + ($i == $max - 1 ? 0.4 : 0.0)));
+		} elseif ($i <= 2) {
+			$r = floor($r * (1.3 + ($i == 0 ? 0.4 : 0.0)));
+			$g = floor($g * (1.3 + ($i == 0 ? 0.4 : 0.0)));
+			$b = floor($b * (1.3 + ($i == 0 ? 0.4 : 0.0)));
+		}
+
+
+		fillbar($img, $i, $r, $g, $b);
+/*		imageline($img, $i + 1,  20, $i + 20,   1, 0x010101 * $c);
+		imagesetpixel($img, $i + 20,  1, 0x010101 * min(255, floor($c * 1.7)));
+		imagesetpixel($img, $i + 19,  2, 0x010101 * min(255, floor($c * 1.3)));
+		imagesetpixel($img, $i +  2, 19, 0x010101 * min(255, floor($c * 1.3)));
+		imagesetpixel($img, $i +  1, 20, 0x010101 * min(255, floor($c * 1.7)));
+*/	}
+
+	$s	= sprintf("\$%01.2f", $money + $bonusm);
+	if ($max > 50) {
+		$s	= str_pad($s, 7, " ", STR_PAD_LEFT);
+		$x	= $max - 41;
+	} else {
+		$x	= $max + 12;
+	}
+	imagestring($img, $font, $x + 1, 13, $s, 0x000000);
+	imagestring($img, $font, $x, 12, $s, 0xffffff);
+
+	imagealphablending($img, true);
+
+	imagestring($img, $font, 21, 3, $text, $textc);
+
+
+	header("Content-type: image/png;");
+	imagepng($img);
+	imagedestroy($img);
+
+
+	function fillbar($img, $i, $r, $g, $b) {
+		$r	= min(255, $r);
+		$g	= min(255, $g);
+		$b	= min(255, $b);
+		imageline($img, $i + 1,  20, $i + 20,   1, imagecolorallocate($img, $r, $g, $b));
+		imagesetpixel($img, $i + 20,  1, imagecolorallocate($img, min(255, floor($r * 1.7)), min(255, floor($g * 1.7)), min(255, floor($b * 1.7))));
+		imagesetpixel($img, $i + 19,  2, imagecolorallocate($img, min(255, floor($r * 1.3)), min(255, floor($g * 1.3)), min(255, floor($b * 1.3))));
+		imagesetpixel($img, $i +  2, 19, imagecolorallocate($img, min(255, floor($r * 1.3)), min(255, floor($g * 1.3)), min(255, floor($b * 1.3))));
+		imagesetpixel($img, $i +  1, 20, imagecolorallocate($img, min(255, floor($r * 1.7)), min(255, floor($g * 1.7)), min(255, floor($b * 1.7))));
+		return;
+	}
\ No newline at end of file
diff --git a/announcement.php b/announcement.php
new file mode 100644
index 0000000..6e08422
--- /dev/null
+++ b/announcement.php
@@ -0,0 +1,206 @@
+<?php
+  require 'lib/function.php';
+  require 'lib/layout.php';
+  if(!$f) $f=0;
+  if(@mysql_num_rows(mysql_query("SELECT user FROM forummods WHERE forum=$f and user=$loguserid"))) $ismod=1;
+  $canpost=($isadmin or ($ismod && $f>0));
+  if($_GET[action]=='edit' or $_POST[action]=='editannc'){
+    $annc=mysql_fetch_array(mysql_query("SELECT * FROM announcements WHERE id=$id"));
+    if($annc[forum]>0 && $ismod) $canpost=true;
+  }
+  $smilies=readsmilies();
+  if(!$action){
+    loadtlayout();
+    $ppp=($log?$loguser[postsperpage]:20);
+    $min=$ppp*$page;
+	if ($loguser['id'] && $f == 0) {
+		mysql_query("UPDATE `users` SET `lastannouncement` = (SELECT MAX(`id`) FROM `announcements` WHERE `forum` = 0) WHERE `id` = '". $loguser['id'] ."'");
+	}
+	$anncs=mysql_query("SELECT a.*,u.*,a.title atitle,u.id uid FROM announcements a,users u WHERE forum=$f AND a.user=u.id ORDER BY a.id DESC LIMIT $min,$ppp");
+    $annctotal=@mysql_result(mysql_query("SELECT count(*) FROM announcements WHERE forum=$f"),0,0);
+    $pagelinks=$smallfont.'Pages:';
+    for($i=0;$i<($annctotal/$ppp);$i++){
+	if($i==$page) $pagelinks.=' '.($i+1);
+	else $pagelinks.=" <a href=announcement.php?f=$f&page=$i>".($i+1).'</a>';
+    }
+    $annclist="$tccellh width=150>User</td>$tccellh colspan=2>Announcement<tr>";
+    while($annc=mysql_fetch_array($anncs)){
+	if($annccount) $annclist.='<tr>';
+	$annccount++;
+	$bg=$bg%2+1;
+	$edit='&nbsp;';
+	if($isadmin or ($ismod && $f)){
+	  $edit="<a href=announcement.php?id=$annc[0]&action=edit>Edit</a> | <a href=announcement.php?id=$annc[0]&action=delete&f=$f>Delete</a>";
+	  if($isadmin) $ip=" | IP: $annc[3]";
+	}
+	if($loguser[viewsig]==2){
+	  $annc[headtext]=$annc[postheader];
+	  $annc[signtext]=$annc[signature];
+	}
+	$annc[text]="<center><b>$annc[atitle]</b></center><hr>$annc[text]";
+	$annclist.=threadpost($annc,$bg);
+    }
+  }
+  if($canpost){
+    if($_GET[action]=='delete'){
+	mysql_query("DELETE FROM announcements WHERE id=$id");
+	$annclist.="
+	  $tccell1>Announcement deleted.
+	  <br>".redirect("announcement.php?f=$f",'return to the announcements',0);
+    }
+    if($_GET[action]=='new'){
+	$annclist="
+	  <FORM ACTION=announcement.php NAME=REPLIER METHOD=POST>
+	  $tccellh width=150>&nbsp</td>$tccellh>&nbsp;<tr>
+	  $tccell1><b>Announcement title:</b></td>$tccell2l>$inpt=subject SIZE=70 MAXLENGTH=100><tr>
+	  $tccell1><b>Announcement:</b></td>	$tccell2l>$txta=message ROWS=20 COLS=$numcols></TEXTAREA><tr>
+	  $tccell1>&nbsp;</td>				$tccell2l>$inph=action VALUE=postannc>$inph=f VALUE=$f>
+	  $inps=submit VALUE=\"Post announcement\">
+	  $inps=preview VALUE=\"Preview announcement\"></td></FORM>
+	";
+    }
+    if($_GET[action]=='edit'){
+	if(!$annc[headid]) $head=$annc[headtext];
+	else $head=mysql_result(mysql_query("SELECT text FROM postlayouts WHERE id=$annc[headid]"),0,0);
+	if(!$annc[signid]) $sign=$annc[signtext];
+	else $sign=mysql_result(mysql_query("SELECT text FROM postlayouts WHERE id=$annc[signid]"),0,0);
+	sbr(1,$annc[text]);
+	sbr(1,$head);
+	sbr(1,$sign);
+	$annclist="
+	  <FORM ACTION=announcement.php NAME=REPLIER METHOD=POST>
+	  $tccellh width=150>&nbsp</td>$tccellh>&nbsp;<tr>
+	  $tccell1><b>Announcement title:</b></td>$tccell2l>$inpt=subject VALUE=\"$annc[title]\" SIZE=70 MAXLENGTH=100><tr>
+	  $tccell1><b>Header:</b></td>		$tccell2l>$txta=head ROWS=8 COLS=$numcols>$head</TEXTAREA><tr>
+	  $tccell1><b>Announcement:</b></td>	$tccell2l>$txta=message ROWS=12 COLS=$numcols>$annc[text]</TEXTAREA><tr>
+	  $tccell1><b>Signature:</b></td>		$tccell2l>$txta=sign ROWS=8 COLS=$numcols>$sign</TEXTAREA><tr>
+	  $tccell1>&nbsp</td>				$tccell2l>
+	  $inph=action VALUE=editannc>
+	  $inph=f VALUE=$annc[forum]>
+	  $inph=id VALUE=$id>
+	  $inph=edited VALUE=\"$annc[edited]\">
+	  $inps=submit VALUE=\"Edit announcement\">
+	  $inps=preview VALUE=\"Preview announcement\"></td></FORM>
+	";
+    }
+    if($_POST[action]=='postannc'){
+	$userid = $loguserid;
+	$user   = $loguser;
+	if($userid!=-1){
+	  $sign=$user[signature];
+	  $head=$user[postheader];
+	  if($user[postbg]) $head="<div style=background:url($user[postbg]);height=100%>$head";
+	  $numposts=$user[posts];
+	  $numdays=(ctime()-$user[regdate])/86400;
+	  $message=doreplace($message,$numposts,$numdays,$user['name']);
+	  $rsign=doreplace($sign,$numposts,$numdays,$user['name']);
+	  $rhead=doreplace($head,$numposts,$numdays,$user['name']);
+	  squot(0,$subject);
+	  $currenttime=ctime();
+	  if($submit){
+	    if(!$f) $f=0;
+	    $headid=getpostlayoutid($head);
+	    $signid=getpostlayoutid($sign);
+	    mysql_query("INSERT INTO `announcements` (`user`, `date`, `ip`, `title`, `forum`, `text`, `headid`, `signid`, `tagval`) VALUES ('$userid', '$currenttime', '$userip', '$subject', '$f', '$message', '$headid', '$signid', '$tagval')");
+	    $annclist="
+		$tccell1>Thank you, $user[name], for posting your announcement.<br>
+	     ".redirect("announcement.php?f=$f","the announcements",0)."</table></table>";
+	  }else{
+	    loadtlayout();
+	    $ppost=$user;
+	    $ppost[uid]=$userid;
+	    $ppost[date]=$currenttime;
+	    $ppost[headtext]=$rhead;
+	    $ppost[signtext]=$rsign;
+	    $ppost[text]="<center><b>". stripslashes($subject) ."</b></center><hr>". stripslashes($message);
+	    if($isadmin) $ip=$userip;
+	    $annclist="
+		  <body onload=window.document.REPLIER.message.focus()>
+		  $tccellh>Announcement preview
+		  $tblend$tblstart
+		  ".threadpost($ppost,1)."
+		  $tblend<br>$tblstart
+		  <FORM ACTION=announcement.php NAME=REPLIER METHOD=POST>
+		  $tccellh width=150>&nbsp</td>$tccellh>&nbsp<tr>
+		  $tccell1><b>Announcement title:</td>$tccell2l>$inpt=subject SIZE=70 MAXLENGTH=100 VALUE=\"". stripslashes($subject) ."\"><tr>
+		  $tccell1><b>Announcement:</td>	$tccell2l>$txta=message ROWS=10 COLS=$numcols>". stripslashes($message) ."</TEXTAREA><tr>
+		  $tccell1>&nbsp</td>$tccell2l>
+		  $inps=submit VALUE=\"Submit announcement\">
+		  $inps=preview VALUE=\"Preview announcement\">
+		  $inph=action VALUE=postannc>
+		  $inph=f VALUE=$f>
+		  </td></FORM>
+	    ";
+	  }
+	}else
+	  $annclist="
+	    $tccell1>Couldn't enter the announcement. You haven't entered the right username or password.
+	    ".redirect('announcement.php','return to the announcements',0);
+    }
+    if($_POST[action]=='editannc'){
+      print $tblstart;
+	$numposts=$loguser[posts];
+	$numdays=(ctime()-$loguser[regdate])/86400;
+	$message=doreplace($message,$numposts,$numdays,$loguser[name]);
+
+	$namecolor = getnamecolor($loguser['sex'], $loguser['powerlevel']);
+	$edited ="<a href=profile.php?id=$loguser[id]><font $namecolor>$loguser[name]</font></a>";
+
+	if($submit){
+	  $headid=@mysql_result(mysql_query("SELECT id FROM postlayouts WHERE text='$head' LIMIT 1"),0,'id');
+	  $signid=@mysql_result(mysql_query("SELECT id FROM postlayouts WHERE text='$sign' LIMIT 1"),0,'id');
+	  if($headid) $head=''; else $headid=0;
+	  if($signid) $sign=''; else $signid=0;
+	  mysql_query("UPDATE announcements SET title='$subject', text='$message', headtext='$head', signtext='$sign', edited='$edited', editdate='".ctime()."',headid=$headid,signid=$signid WHERE id=$id");
+	  $annclist="
+	    $tccell1>Thank you, ".$loguser[name].", for editing the announcement.<br>
+	    ".redirect("announcement.php?f=$f","go to the announcements",0);
+	}else{
+	  loadtlayout();
+	  $annc=mysql_fetch_array(mysql_query("SELECT * FROM announcements WHERE id=$id"));
+	  $ppost=mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id=$annc[user]"));
+	$subject = stripslashes($subject);
+	$message = stripslashes($message);
+	$head = stripslashes($head);
+	$sign = stripslashes($sign);
+	  $ppost['uid']=$annc[user];
+	  $ppost['date']=$annc[date];
+	  $ppost['tagval']=$annc[tagval];
+	  $ppost['headtext']=$head;
+	  $ppost['signtext']=$sign;
+	  $ppost['text']="<center><b>$subject</b></center><hr>$message";
+
+	  $ppost['edited']   = $edited;
+	  $ppost['editdate'] = ctime();
+
+	  if($isadmin) $ip=$annc['ip'];
+	  $annclist="
+		<body onload=window.document.REPLIER.message.focus()>
+		$tccellh>Announcement preview
+		$tblend$tblstart
+		".threadpost($ppost,1)."
+		$tblend<br>$tblstart
+		<FORM ACTION=announcement.php NAME=REPLIER METHOD=POST>
+		$tccellh width=150>&nbsp</td>$tccellh>&nbsp<tr>
+		$tccell1><b>Announcement title:</b></td>$tccell2l>$inpt=subject VALUE=\"$subject\" SIZE=70 MAXLENGTH=100><tr>
+		$tccell1><b>Header:</td>	 $tccell2l>$txta=head ROWS=4 COLS=$numcols>$head</TEXTAREA><tr>
+		$tccell1><b>Announcement:</td> $tccell2l>$txta=message ROWS=6 COLS=$numcols>$message</TEXTAREA><tr>
+		$tccell1><b>Signature:</td>	 $tccell2l>$txta=sign ROWS=4 COLS=$numcols>$sign</TEXTAREA><tr>
+		$tccell1>&nbsp</td>$tccell2l>
+		$inps=submit VALUE=\"Edit announcement\">
+		$inps=preview VALUE=\"Preview announcement\">
+		$inph=action VALUE=editannc>
+		$inph=id VALUE=$id>
+		$inph=f VALUE=$f>
+		</td></FORM>
+	  ";
+	}
+    }
+    $postnew="<a href=announcement.php?action=new&f=$f>Post new announcement</a>";
+  }
+  print "$header
+	<table width=100%><td align=left>$fonttag<a href=index.php>$boardname</a> - Announcements</td><td align=right>$smallfont$postnew</table>
+	$pagelinks$tblstart$annclist$tblend$pagelinks$footer
+  ";
+  printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/avatar.php b/avatar.php
new file mode 100644
index 0000000..47a66c3
--- /dev/null
+++ b/avatar.php
@@ -0,0 +1,72 @@
+<?php
+require 'lib/function.php';
+require 'lib/layout.php';
+
+$a	= array(1 => "neutral", "angry", "tired/upset", "playful", "doom", "delight", "guru", "hope", "puzzled", "whatever", "hyperactive", "sadness", "bleh", "embarrassed", "amused", "afraid");
+
+$me = false;
+$form = '<b>Preview mood avatar for user...</b><br>
+  <form><select onChange="parent.location=this.options[this.selectedIndex].value" style="width:500px;">
+  <option value=avatar.php>&lt;Select a user&gt;</option>';
+
+$users = $sql->query("SELECT id, name, moodurl FROM users WHERE moodurl != '' ORDER BY id ASC");
+while ($u = $sql->fetch($users)) {
+  $selected = $fails = '';
+  if ($u['id'] == $id) {
+    $me = $u;
+    $selected = ' selected';
+  }
+  //if (strpos($u['moodurl'], '$') === FALSE)
+  //  $fails = " (improper URL)";
+  $form .= "\r\n  <option value='avatar.php?id=$u[id]'$selected>$u[id]: $u[name]$fails</option>";
+}
+$form .= "\r\n  </select></form>";
+
+if ($me) {
+	$script = '
+	<script type="text/javascript">
+		function avatarpreview(uid,pic) {
+			if (pic > 0) {
+						var moodav="'.htmlspecialchars($me['moodurl']).'";
+						document.getElementById(\'prev\').src=moodav.replace("$", pic);
+			}
+			else {
+				document.getElementById(\'prev\').src="images/_.gif";
+			}
+		}
+	</script>
+	';
+
+  $ret = "<tr>$tccellh colspan=2>$me[name]: <i>".htmlspecialchars($me['moodurl'])."</i></td></tr>";
+	$ret .= "<tr height=400px>$tccell1l width=200px><b>Mood avatar list:</b><br>";
+
+	foreach($a as $num => $name) {
+		$jsclick = "onclick='avatarpreview($me[id],$num)'";
+		$selected = (($num == 1) ? ' checked' : '');
+		$ret .= "<input type='radio' name='moodid' value='$num' id='mood$num' tabindex='". (9000 + $num) ."' style=\"height: 12px;\" $jsclick $selected>
+             <label for='mood$num' style=\"font-size: 12px;\">&nbsp;$num:&nbsp;$name</label><br>\r\n";
+	}
+
+	$startimg = htmlspecialchars(str_replace('$', '1', $me['moodurl']));
+
+  $ret .= "</td>$tccell2 width=400px><img src=\"$startimg\" id=prev></td></tr>";
+
+}
+else {
+	$script = '';
+	$ret = '';
+}
+  print "
+<html><head><title>Mood Avatar Preview</title></head>
+$body
+$css
+$script
+<center>
+ <table height=100% valign=middle><tr><td>
+  $tblstart
+   <tr height=50px>$tccellh colspan=2>$form</td></tr>
+   $ret
+  $tblend
+ </td><tr></table></body></html>
+";
+?>
\ No newline at end of file
diff --git a/biggestposters.php b/biggestposters.php
new file mode 100644
index 0000000..6f56358
--- /dev/null
+++ b/biggestposters.php
@@ -0,0 +1,81 @@
+<?php
+	require 'lib/function.php';
+
+	$windowtitle = "$boardname -- Biggest posters";
+	require 'lib/layout.php';
+
+	if ($_GET['sort'] == "posts")   { $sort = "posts";   $headertext = 'sorted by post count'; }
+	elseif ($_GET['sort'] == "avg") { $sort = "average"; $headertext = 'by average post size'; }
+	else                            { $sort	= "waste";   $headertext = 'by post size'; }
+
+  // Time for an update?
+  if ($sql->resultq("SELECT bigpostersupdate FROM misc") <= ctime()-(3600 * 8)) {
+    $sql->query("TRUNCATE biggestposters");
+  	$sql->query("INSERT INTO biggestposters "
+    ."(id, posts, waste) "
+    ."SELECT u.id, u.posts, SUM(LENGTH(pt.`text`)) "
+    ."FROM `posts` p "
+    ."LEFT JOIN `users` u ON p.user = u.id "
+    ."LEFT JOIN `posts_text` pt on p.id = pt.pid "
+    ."WHERE (u.posts >= 5 OR u.posts < 0) GROUP BY p.user");
+    $sql->query("UPDATE biggestposters SET average = waste / posts");
+    $sql->query("UPDATE misc SET bigpostersupdate = ".ctime());
+  }
+  $posters = $sql->query("SELECT bp.*, u.name, u.regdate, u.minipic, u.sex, u.powerlevel FROM biggestposters bp LEFT JOIN users u ON bp.id=u.id ORDER BY $sort DESC");
+
+	print "
+		$header
+
+		<br>
+
+		$tblstart
+			<tr>$tccellc colspan=7><b>Biggest posters, $headertext</b></td></tr>
+			<tr>
+			$tccellh width=30>#</td>
+			$tccellh colspan=2>Username</td>
+			$tccellh width=200>Registered on</td>
+			$tccellh width=130><a href=\"?sort=posts\">Posts</a></td>
+			$tccellh width=130><a href=\"?\">Size</a></td>
+			$tccellh width=130><a href=\"?sort=avg\">Average</a></td>
+	";
+	
+	for($i=1; $user = $sql -> fetch($posters); $i++) {
+
+		if($i == 1) $max = $user['waste'];
+		if ($user['waste'] != $oldcnt) $rank = $i;
+		$oldcnt	= $user['waste'];
+		$namecolor=getnamecolor($user['sex'],$user['powerlevel']);
+
+		$col	= "";
+		if ($user['average'] >=  500) $col	= "#88ff88";
+		if ($user['average'] >=  750) $col	= "#8888ff";
+		if ($user['average'] <=  200) $col	= "#ffff80";
+		if ($user['average'] <=  100) $col	= "#ff8080";
+		if ($user['average'] <=    0) $col	= "#888888";
+
+		$avgc	= number_format(abs($user['average']), 1);
+		if ($col) $avgc	= "<font color=$col>$avgc</font>";
+
+
+
+		print "
+			<tr>
+			$tccell1>$rank</td>
+			$tccell1 width=16>". ($user['minipic'] ? "<img src=\"". htmlspecialchars($user['minipic']) ."\" width=16 height=16>" : "&nbsp;") ."</td>
+			$tccell2l><a href=\"profile.php?id=". $user['id'] ."\"><font $namecolor>". $user['name'] ."</font></a></td>
+			$tccell1>".date($dateformat, $user['regdate'] + $tzoff) ."</td>
+			$tccell1r>". $user['posts'] ."</td>
+			$tccell1r><b>". number_format($user['waste']) ."</b></td>
+			$tccell2r><b>". $avgc ."</b></td>
+			</tr>";
+	}
+
+	print "
+		$tblend
+
+		$smallfont(Note: this doesn't take into account quotes, joke posts, or other things. It isn't a very good judge of actual post content, just post <i>size</i>.)
+    <br>(This table is cached and updated every few hours.)</font>
+
+		$footer";
+	printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/calendar.php b/calendar.php
new file mode 100644
index 0000000..210b7a4
--- /dev/null
+++ b/calendar.php
@@ -0,0 +1,109 @@
+<?php
+	require 'lib/function.php';
+
+	$mn=array(1=>'January','February','March','April','May','June','July','August','September','October','November','December');
+
+	$date = getdate(time());
+	$year = $date['year'];
+	$month = $date['mon'];
+
+	if (!$y && !$m && !$d)
+		$day = $date['mday'];
+	else {
+		if ($y) $year = intval($y);
+		if ($m) $month = intval($m);
+	  if ($d) $day = intval($d);
+	}
+
+	$eventdata = null;
+	if ($event)
+		$eventdata = $sql->fetchq("SELECT id,d,m,y,user,title,text FROM events WHERE id=$event");
+
+	if ($eventdata) {
+		$month = $eventdata['m'];
+		$day   = $eventdata['d'];
+		$year  = $eventdata['y'];
+	}
+
+	$windowtitle = "{$boardname} -- Calendar for {$mn[$month]} {$year}";
+	require 'lib/layout.php';
+
+	$date = getdate(mktime(0,0,0,$month,1,$year));
+	$i    = 1 - $date['wday'];
+
+	$date = getdate(mktime(0,0,0,$month+1,0,$year));
+	$max  = $date['mday'];
+
+	$users = $sql->query('SELECT id,name,birthday,sex,powerlevel,aka FROM users WHERE birthday ORDER BY birthday ASC, name ASC');
+	while ($user = $sql->fetch($users)) {
+		$date = @getdate($user['birthday']);
+		if ($date['mon'] != $month) continue;
+
+		$age = $year-$date['year'];
+		$userlink = getuserlink($user);
+		$bdaytext[$date['mday']].="<br>- {$userlink} turns {$age}";
+	}
+
+	$events = $sql->query("SELECT id,d,title FROM events WHERE m=$month AND y=$year ORDER BY id");
+	while($event1 = $sql->fetch($events))
+		$eventtext[$event1['d']] .= "<br>- <a href='calendar.php?event=$event1[id]'>$event1[title]</a>";
+
+	print "$header$fonttag<a href=index.php>$boardname</a> - Calendar
+		$tblstart";
+
+	if ($eventdata) {
+		$user = $sql->resultq("SELECT name FROM users WHERE id=$eventdata[user]");
+		print "<tr>
+			{$tccellh} colspan=7><b>$mn[$month] $day, $year: $eventdata[title]</b> - {$user}</td></tr><tr>
+			{$tccell1} colspan=7>$eventdata[text]</td>
+		</tr>";
+	}
+
+	print "<tr>$tccellh colspan=7><font size=5>$mn[$month] $year</font></td></tr>
+		<tr>
+			$tccellh width=14.3%>S</td>
+			$tccellh width=14.3%>M</td>
+			$tccellh width=14.3%>T</td>
+			$tccellh width=14.3%>W</td>
+			$tccellh width=14.3%>T</td>
+			$tccellh width=14.3%>F</td>
+			$tccellh width=14.2%>S</td>
+		</tr>\r\n";
+
+
+  $attribs = " width=14.3% valign=top height=80><font class=fontt size=0>";
+	for(; $i<=$max; $i+=7) {
+    print "<tr>\r\n";
+    for($dn=0;$dn<=6;$dn++){
+      $dd=$i+$dn;
+      $daytext="<a href='calendar.php?y=$year&m=$month&d=$dd'>$dd</a>";
+
+      $tccell = $tccell1l;
+      if ($dd==$day && $day!=0) $tccell = $tccellcl;
+      elseif ($dn==0 || $dn==6) $tccell = $tccell2l;
+
+      if ($dd<1 || $dd>$max)
+        print "$tccell$attribs</td>\r\n";
+      else
+        print "$tccell$attribs$daytext<br>$bdaytext[$dd]$eventtext[$dd]</td>\r\n";
+    }
+    print "</tr>\r\n";
+  }
+
+  for($i=1;$i<=12;$i++){
+    if($i==$month) $monthlinks.=" $i";
+    else $monthlinks.=" <a href='calendar.php?y=$year&m=$i'>$i</a>";
+  }
+  for($i=$year-2;$i<=$year+2;$i++){
+    if($i==$year) $yearlinks.=" $i";
+    else $yearlinks.=" <a href='calendar.php?y=$i'>$i</a>";
+  }
+
+  print "<tr>
+    $tccell2 colspan=7>$smallfont<center>Month:$monthlinks | Year:$yearlinks
+  </td></tr>
+	$tblend
+	$footer";
+
+  printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/css/base.css b/css/base.css
new file mode 100644
index 0000000..2237852
--- /dev/null
+++ b/css/base.css
@@ -0,0 +1,29 @@
+textarea,input,select {
+	border: 1px solid #000;
+	background: #000;
+	color: #EEE;
+	font: 10pt monospace;
+}
+input[type=radio] {
+	border: none;
+}
+input[type=submit] {
+	border: #000 solid 2px;
+	font: 10pt 'verdana', sans-serif;
+}
+body, table, thead, tbody, span, td, tr, th, a, img, br { padding: 0; margin: 0; border: 0; font-size: 100%; }
+center { text-align: center; }
+.tdbgh, .tbl, .tdbgc, .tdbg1, .tdbg2 { line-height: 1; padding: 1px;}
+table { border-spacing: 0; border-collapse: collapse; }
+a:link,a:visited,a:active,a:hover { text-decoration:none; font-weight: bold; }
+table { padding: 0.5em; }
+span.lastpost { font-size: 90%; padding: 0; margin: 0; }
+div.lastpost { font-size: 90%; text-align: right !important; }
+
+.table { width: 100%; empty-cells: show;}
+.sparkline { display: none; }
+.center, center { text-align: center; }
+.right { text-align: right; }
+
+code { overflow: auto; width: 100%; white-space: pre; display: block; }
+code br { display: none; }
diff --git a/css/hydras_blue_thing.css b/css/hydras_blue_thing.css
new file mode 100644
index 0000000..cafd2da
--- /dev/null
+++ b/css/hydras_blue_thing.css
@@ -0,0 +1,18 @@
+body { background: #013 !important; color: #DDD; margin: 1em; }
+
+a { color: #BEBAFE; }
+a:visited { color: #9990c0; }
+a:active { color: #CFBEFF; }
+a:hover { color: #CECAFE; }
+
+.tdbg1 { background: #05375F; } /* tablebg1 */
+.tdbg2 { background: #15426D; } /* tablebg2 */
+.tdbgc { background: #0F265F; }
+.tdbgh { 
+	background: #0048B7 url("/images/julold/header_shade.png") repeat-x bottom center; color: #FFF; border: 1px solid black; text-shadow: 2px 2px 4px #000; font: 13px 'verdana', sans-serif;
+} 
+td.tbl { border-right: 1px solid #000; border-bottom: 1px solid #000; }
+.table { border-top: #000 1px solid; border-left: #000 1px solid; }
+.font { font: 13px 'verdana', sans-serif; }
+.fonts { font: 10px 'verdana', sans-serif; }
+.fontt { font: 10px 'tahoma', serif; }
\ No newline at end of file
diff --git a/del.php b/del.php
new file mode 100644
index 0000000..b0b5db4
--- /dev/null
+++ b/del.php
@@ -0,0 +1,206 @@
+<?php
+
+  require 'lib/function.php';
+
+	$allowedusers	= array(
+		$x_hacks['adminip'],		// Xkeeper
+		"24.234.157.232",			// also me
+		
+		);
+	
+	if (!in_array($_SERVER['REMOTE_ADDR'], $allowedusers)) die("Nein.");
+  
+
+  require 'lib/layout.php';
+  if($_POST['deluser'] and $isadmin) { //($loguserid==1 or $loguserid==2)){
+ 
+		foreach($_POST['deluser'] as $id => $junk) {
+
+			$query = "SELECT id,name,posts,sex,powerlevel FROM users WHERE id=$id";
+			$user2 = mysql_query($query);
+
+			while ($user=mysql_fetch_array($user2)) {
+			$id	= $user['id'];
+
+				$name=$user[name];
+				$namecolor=getnamecolor($user[sex],$user[powerlevel]);
+				mysql_query("INSERT INTO `delusers` ( SELECT * FROM `users` WHERE `id` = '$id' )");
+				$line="<br><br>===================<br>[Posted by <font $namecolor><b>". addslashes($name) ."</b></font>]<br>";
+				$ups=mysql_query("SELECT id FROM posts WHERE user=$id");
+				while($up=mysql_fetch_array($ups)) mysql_query("UPDATE posts_text SET signtext=CONCAT_WS('','$line',signtext) WHERE pid=$up[id]") or print mysql_error();
+				mysql_query("UPDATE threads SET user=89 WHERE user=$id");
+				mysql_query("UPDATE threads SET lastposter=89 WHERE lastposter=$id");
+				mysql_query("UPDATE pmsgs SET userfrom=89 WHERE userfrom=$id");
+				mysql_query("UPDATE pmsgs SET userto=89 WHERE userto=$id");
+				mysql_query("UPDATE posts SET user=89,headid=0,signid=0 WHERE user=$id");
+				mysql_query("UPDATE `users` SET `posts` = -1 * (SELECT COUNT(*) FROM `posts` WHERE `user` = '89') WHERE `id` = '89'");
+				mysql_query("DELETE FROM userratings WHERE userrated=$id OR userfrom=$id");
+				mysql_query("DELETE FROM pollvotes WHERE user=$id");
+				mysql_query("DELETE FROM users WHERE id=$id");
+				mysql_query("DELETE FROM users_rpg WHERE uid=$id");
+
+			$delusertext	.= "\r\n<tr>$tccell1 width=120>$id</td>$tccell2l><font $namecolor><b>$user[name]</b></font></td></tr>";
+			$delusercnt		++;
+		  }
+	  }
+
+	$deltext	= "$tblstart
+	<tr><td class='tbl tdbgc font center' colspan=2><b>$delusercnt user(s) deleted.</b></td></tr>$delusertext
+	$tblend<br>";
+
+	
+	}
+
+
+  if (!$_POST['sortpowerlevel']) $_POST['sortpowerlevel'] = "ab";
+  if (!$_POST['sortord']) $_POST['sortord']	= 0;
+  $powerselect[$_POST['sortpowerlevel']]	= 'selected';
+  $sortsel[$_POST['sorttype']]				= 'selected';
+  $ordsel[$_POST['sortord']]				= 'checked';
+ 
+  print "
+    $header<br>
+
+$deltext
+
+	<form action=del.php method=post>
+	$tblstart
+		<tr>$tccellh colspan=2>Sort Options</td></tr>
+		<tr>$tccell1 width=300><b>User Search:</b></td>
+			$tccell2l>$inpt=searchname size=30 maxlength=15 value='". $_POST['searchname'] ."'></td></tr>
+		<tr>$tccell1 width=300><b>IP Search:</b></td>
+			$tccell2l>$inpt=searchip size=30 maxlength=15 value='". $_POST['searchip'] ."'></td></tr>
+		<tr>$tccell1 width=300><b>Show users with less than:</b></td>
+			$tccell2l>$inpt=maxposts size=15 maxlength=9 value='". $_POST['maxposts'] ."'> posts</td></tr>
+		<tr>$tccell1><b>Powerlevel:</b></td>
+			$tccell2l><select name='sortpowerlevel'>
+				<option value='aa' ". $powerselect['aa'] .">* Any powerlevel</option>
+				<option value='ab' ". $powerselect['ab'] .">* All banned</option>
+				<option value='s3' ". $powerselect['s3'] .">Administrator</option>
+				<option value='s2' ". $powerselect['s2'] .">Moderator</option>
+				<option value='s1' ". $powerselect['s1'] .">Local Moderator</option>
+				<option value='s0' ". $powerselect['s0'] .">Normal User</option>
+				<option value='s-1' ". $powerselect['s-1'] .">Banned</option>
+				<option value='s-2' ". $powerselect['s-2'] .">Permabanned</option>
+			</select></td></tr>
+		<tr>$tccell1 width=300><b>Sort by:</b></td>
+			$tccell2l>
+			<select name='sorttype'>
+				<option value='0' $sortsel[0]> Last activity </option>
+				<option value='1' $sortsel[1]> Register date </option>
+				<option value='2' $sortsel[2]> Posts </option>
+				<option value='3' $sortsel[3]> Powerlevel </option>
+				<option value='4' $sortsel[4]> IP address</option>
+			</select>, 
+				$radio=sortord value='0' $ordsel[0]> Descending&nbsp;&nbsp;
+				$radio=sortord value='1' $ordsel[1]> Ascending
+			</td></tr>
+		<tr>$tccell1>&nbsp;</td>$tccell2l><input type=submit value='Apply filters'></td></tr>
+	$tblend
+	</form>
+  ";
+
+
+//	print_r($_POST);
+	$sqlquery	= "";
+
+	if ($_POST['maxposts'])
+		$sqlquery	= "`posts` <= '". $_POST['maxposts'] ."'";
+
+	if ($_POST['searchip']) {
+		if ($sqlquery)	$sqlquery	.= " AND ";
+		$sqlquery	.= "`lastip` LIKE '". $_POST['searchip'] ."%'";
+	}
+
+	if ($_POST['searchname']) {
+		if ($sqlquery)	$sqlquery	.= " AND ";
+		$sqlquery	.= "`name` LIKE '%". $_POST['searchname'] ."%'";
+	}
+
+	if ($_POST['sortpowerlevel'] != "aa") {
+		if ($sqlquery)	$sqlquery	.= " AND ";
+
+		if ($_POST['sortpowerlevel'] == "ab") 
+			$sqlquery	.= "`powerlevel` < '0'";
+		else
+			$sqlquery	.= "`powerlevel` = '". str_replace("s", "", $_POST['sortpowerlevel']) ."'";
+	}
+
+	switch ($_POST['sorttype']) {
+		case 0:
+			$sortfield	= "lastactivity";
+			break;
+		case 1:
+			$sortfield	= "regdate";
+			break;
+		case 2:
+			$sortfield	= "posts";
+			break;
+		case 3:
+			$sortfield	= "powerlevel";
+			break;
+		case 4:
+			$sortfield	= "lastip";
+			break;
+		default:
+			$sortfield	= "lastactivity";
+			break;
+	}
+
+	if ($_POST['sortord'] == 0) $sortorder	= "DESC";
+		else $sortorder	= "ASC";
+	if ($sqlquery) $sqlquery	= "WHERE ". $sqlquery;
+	$sqlquery	.= " ORDER BY `$sortfield` $sortorder";
+
+
+/*  if(!$p) $p=0;
+  if ($ip) $q = "lastip = '$ip'";
+	else $q = "posts=$p";
+*/
+	$users		= mysql_query("SELECT * FROM `users` $sqlquery");
+	$usercount	= mysql_num_rows($users);
+  print "
+	<form action=del.php method=post>
+    $tblstart
+	<tr><td class='tbl tdbgc font center' colspan=8><b>$usercount user(s) found.</b></td></tr>
+	<tr>
+	$tccellh>&nbsp;</td>
+	$tccellh>Name</td>
+	$tccellh>Posts</td>
+	$tccellh>Regdate</td>
+	$tccellh>Last post</td>
+	$tccellh width=200>Last activity</td>
+	$tccellh>Last URL</td>
+	$tccellh>IP
+  ";
+  while($user=mysql_fetch_array($users)){
+    $namecolor=getnamecolor($user[sex],$user[powerlevel]);
+    $lastpost='-';
+    if($user['lastposttime']) $lastpost		= date($dateshort, $user['lastposttime'] - $tzoff);
+		else $lastpost		= '-';
+    if($user['lastactivity'] != $user['regdate']) $lastactivity	= date($dateformat, $user['lastactivity'] - $tzoff);
+		else $lastactivity	= '-';
+    if($user['regdate']) $regdate			= date($dateshort, $user['regdate'] - $tzoff);
+		else $regdate		= '-';
+
+	$textid	= str_pad($user['id'], 4, "x", STR_PAD_LEFT);
+	$textid	= str_replace("x", "<font color=#606060>0</font>", $textid);
+	$textid	= str_replace("</font><font color=#606060>", "", $textid);
+
+    print "
+      <tr>
+      $tccell1><input type=checkbox name=deluser[". $user['id'] ."] value='1'>
+      $tccell2l>$textid - <a href=profile.php?id=$user[id]><font $namecolor>$user[name]
+	  $tccell1 width=0>$user[posts]
+	$tccell1 width=120>$regdate
+	$tccell1 width=120>$lastpost
+	$tccell1 width=120>$lastactivity
+      $tccell2l>$user[lasturl]&nbsp;
+      $tccell2>$user[lastip]
+    ";
+  }
+
+  echo "		<tr>$tccell1l colspan=8>$inps=submit value=Submit></td></tr>";
+  print $tblend ."</form>". $footer;
+  printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/digits.png b/digits.png
new file mode 100644
index 0000000..b0aec43
Binary files /dev/null and b/digits.png differ
diff --git a/digits4.png b/digits4.png
new file mode 100644
index 0000000..aff1c58
Binary files /dev/null and b/digits4.png differ
diff --git a/digits8.png b/digits8.png
new file mode 100644
index 0000000..326a305
Binary files /dev/null and b/digits8.png differ
diff --git a/digitstiny.png b/digitstiny.png
new file mode 100644
index 0000000..616eca5
Binary files /dev/null and b/digitstiny.png differ
diff --git a/doomcounter.php b/doomcounter.php
new file mode 100644
index 0000000..f060f39
--- /dev/null
+++ b/doomcounter.php
@@ -0,0 +1,163 @@
+<?php
+
+	if (!$_GET['notice']) {
+		
+		header("Pragma: no-cache;");
+		header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
+
+		$image	= imagecreatetruecolor(116, 19);
+
+
+		$offsets	= array( 0, 1, -1, 2, 0, 1, -1, 1, 0, 2);
+
+		shuffle($offsets);
+
+#		for ($i = 0; $i < 10; $i++) {
+#			$offsets[$i]	= mt_rand(-1, 3);
+#		}
+
+
+		switch (((time() % 300) / 300 * 7) % 7) {
+			case 0:
+				$color['text']			= imagecolorallocatealpha($image,   0,   0, 128,  50);
+				$color['shadow']		= imagecolorallocatealpha($image, 225, 210, 255,  10);
+				break;
+
+			case 1:
+				$color['text']			= imagecolorallocatealpha($image,   0,  64,  64,  50);
+				$color['shadow']		= imagecolorallocatealpha($image, 210, 225, 255,  10);
+				break;
+
+			case 2:
+				$color['text']			= imagecolorallocatealpha($image,   0,  96,   0,  50);
+				$color['shadow']		= imagecolorallocatealpha($image, 225, 255, 225,  10);
+				break;
+
+			case 3:
+				$color['text']			= imagecolorallocatealpha($image,  99,  44,   0,  50);
+				$color['shadow']		= imagecolorallocatealpha($image, 255, 255, 210,  10);
+				break;
+
+			case 4:
+				$color['text']			= imagecolorallocatealpha($image, 128,  22,  20,  50);
+				$color['shadow']		= imagecolorallocatealpha($image, 255, 244, 222,  10);
+				break;
+
+			case 5:
+				$color['text']			= imagecolorallocatealpha($image, 128,   0,   0,  50);
+				$color['shadow']		= imagecolorallocatealpha($image, 255, 212, 232,  10);
+				break;
+
+			case 6:
+				$color['text']			= imagecolorallocatealpha($image,  64,   0, 128,  50);
+				$color['shadow']		= imagecolorallocatealpha($image, 235, 212, 255,  10);
+		}
+#		$color['text']			= imagecolorallocatealpha($image,   0,   0,   0,  50);
+#		$color['shadow']		= imagecolorallocatealpha($image, 255,   0,   0,  10);
+
+		imagealphablending($image, false);
+		imagefilledrectangle($image, 0, 0, 500, 500, imagecolorallocatealpha($image, 255, 0, 0, 127));
+		imagealphablending($image, true);
+		imagesavealpha($image, true);
+	//	imagerectangle($image, 0, 0, 113, 18, 0xFF0000);
+
+		$time	= mktime(  0,  0,  0,  4, 5, 2012) - microtime(true);
+		$time	= floor($time * (1000000 / 86400));
+
+		#$time	= microtime(true) - (time() - time() % 86400);
+		#$time	= floor($time * (1000000 / 86400));
+
+		$xpos	= 1;
+		$ypos	= 16;
+
+//		$time	= "---------";
+
+		lazy($image, $xpos - 1, $ypos - 1, $time, $color['shadow']);
+		lazy($image, $xpos - 1, $ypos + 1, $time, $color['shadow']);
+		lazy($image, $xpos + 1, $ypos - 1, $time, $color['shadow']);
+		lazy($image, $xpos + 1, $ypos + 1, $time, $color['shadow']);
+		lazy($image, $xpos - 1, $ypos    , $time, $color['shadow']);
+		lazy($image, $xpos + 1, $ypos    , $time, $color['shadow']);
+		lazy($image, $xpos    , $ypos - 1, $time, $color['shadow']);
+		lazy($image, $xpos    , $ypos + 1, $time, $color['shadow']);
+		lazy($image, $xpos    , $ypos    , $time, $color['text']);
+
+		if (!$_GET['x'] && false) {
+			$image2	= imagecreatetruecolor(116, 19);
+			imagealphablending($image2, false);
+			imagealphablending($image, false);
+			imagefilledrectangle($image2, 0, 0, 115, 18, imagecolorallocatealpha($image, 0, 0, 0, 127));
+			imagecopy($image2, $image, 0, 0, 0, 0, 116, 19);
+			imagefilledrectangle($image, 0, 0, 115, 18, imagecolorallocatealpha($image, 0, 0, 0, 127));
+			for ($y = 0; $y < 19; $y++) {
+				$xofs	= 0;
+				if (mt_rand(0, 10) < 1) {
+//					$xofs	= mt_rand(-15, 15);
+					$xofs	= mt_rand(-1, 1);
+//					$xofs	= 1;
+				}
+				imagecopy($image, $image2, $xofs, $y, 0, $y, 116, 1);
+			}
+		}
+
+		header("Content-type: image/png;");
+		imagepng($image);
+		imagedestroy($image);
+
+	
+	
+	
+	} else {
+
+		header("Pragma: no-cache;");
+		header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
+
+		$image	= imagecreatetruecolor(98, 67);
+
+
+		$color['text']		= imagecolorallocatealpha($image, 225, 210, 255,   0);
+		$color['shadow']	= imagecolorallocatealpha($image, 255,   0,   0,  50);
+
+		imagealphablending($image, false);
+		imagefilledrectangle($image, 0, 0, 500, 500, imagecolorallocatealpha($image, 255, 0, 0, 127));
+		imagealphablending($image, true);
+		imagesavealpha($image, true);
+
+
+		$xpos	= 1;
+		$ypos	= 14;
+
+		$str	= "Notice this ››";
+
+		lazy2($image, $xpos - 1, $ypos - 1, $str, $color['shadow']);
+		lazy2($image, $xpos - 1, $ypos + 1, $str, $color['shadow']);
+		lazy2($image, $xpos + 1, $ypos - 1, $str, $color['shadow']);
+		lazy2($image, $xpos + 1, $ypos + 1, $str, $color['shadow']);
+		lazy2($image, $xpos - 1, $ypos    , $str, $color['shadow']);
+		lazy2($image, $xpos + 1, $ypos    , $str, $color['shadow']);
+		lazy2($image, $xpos    , $ypos - 1, $str, $color['shadow']);
+		lazy2($image, $xpos    , $ypos + 1, $str, $color['shadow']);
+		lazy2($image, $xpos    , $ypos    , $str, $color['text']);
+
+		header("Content-type: image/png;");
+		imagepng($image);
+		imagedestroy($image);
+	}
+
+	function lazy($image, $x, $y, $t, $c) {
+		global $offsets;
+		$t		= str_pad($t, 9, " ", STR_PAD_LEFT);
+		$len	= strlen($t);
+		for ($i = 0; $i < $len; $i++) {
+			imagettftext($image, 24, 0, $x + $i * 11, $y + $offsets[$i], $c, "images/angsa.ttf", $t{$i});
+		}
+		
+		imagettftext($image, 20, 0, $x + 1 + 11 * strlen($t), $y - 2, $c, "images/angsa.ttf", "tu");
+	}
+
+	function lazy2($image, $x, $y, $t, $c) {
+		global $offsets;
+		$t		= str_pad($t, 9, " ", STR_PAD_LEFT);
+		imagettftext($image, 24, 330, $x, $y, $c, "images/angsa.ttf", $t);
+		
+	}
\ No newline at end of file
diff --git a/editpost.php b/editpost.php
new file mode 100644
index 0000000..1e4303a
--- /dev/null
+++ b/editpost.php
@@ -0,0 +1,211 @@
+<?php
+	// (fat catgirl here)
+	require 'lib/function.php';
+
+	// Stop this insanity.  Never index editpost...
+	$meta['noindex'] = true;
+
+	if (!$log) {
+		require_once 'lib/layout.php';
+		errorpage("You are not logged in.",'log in (then try again)','login.php');
+	}
+	if ($loguser['editing_locked'] == 1) {
+		require_once 'lib/layout.php';
+		errorpage("You are not allowed to edit your posts.",'return to the board','index.php');
+	}
+
+	$post     = $sql->fetchq("SELECT * FROM posts,posts_text WHERE id='$id 'AND id=pid");
+	if (!$post) {
+		require_once 'lib/layout.php';
+		errorpage("Post ID #{$id} doesn't exist.",'return to the board','index.php');
+	}
+
+	$threadid = $post['thread'];
+	$thread   = $sql->fetchq("SELECT forum,closed,title FROM threads WHERE id=$threadid");
+	$options  = explode("|", $post['options']);
+
+	$thread['title'] = str_replace('<','&lt;',$thread['title']);
+	$thread['title'] = str_replace('>','&gt;',$thread['title']);
+
+	$smilies = readsmilies();
+
+	$forum = $sql->fetchq("SELECT * FROM forums WHERE id=$thread[forum]");
+	$specialscheme = $forum['specialscheme'];
+	$windowtitle = "$boardname -- $forum[title]: $thread[title] -- Editing Post";
+
+	require_once 'lib/layout.php';
+	print $header;
+
+	if (@mysql_num_rows($sql->query("SELECT user FROM forummods WHERE forum=$forum[id] and user=$loguserid")))
+		$ismod = 1;
+
+	print "$fonttag<a href=index.php>$boardname</a> - ". ($forum['minpower'] <= $loguser['powerlevel'] ? "<a href=forum.php?id=$forum[id]>".$forum['title']."</a> - <a href='thread.php?pid=$id#$id'>$thread[title]</a> - Edit post" : "Restricted thread") ."
+		$tblstart
+		<FORM ACTION=editpost.php NAME=REPLIER METHOD=POST>";
+
+	if(!$action && $log && ($ismod || ($loguserid==$post['user'] && $loguser['powerlevel'] > -1 && !$thread['closed'])) && (!$forum['minpower'] or $power>=$forum['minpower'])) {
+		$message=$post['text'];
+		if(!$post['headid']) $head=$post['headtext'];
+		else $head=$sql->resultq("SELECT text FROM postlayouts WHERE id=$post[headid]",0,0);
+		if(!$post['signid']) $sign=$post['signtext'];
+		else $sign=$sql->resultq("SELECT text FROM postlayouts WHERE id=$post[signid]",0,0);
+
+		sbr(1,$message);
+		sbr(1,$head);
+		sbr(1,$sign);
+
+    $chks = array();
+		if ($options[0]) $chks[0] = "checked";
+		if ($options[1]) $chks[1] = "checked";
+
+		$user=$sql->fetchq("SELECT name FROM users WHERE id=$post[user]");
+
+		print "
+			$tccellh width=150>&nbsp</td>$tccellh colspan=2>&nbsp<tr>
+			$tccell1><b>Header:</td>	 $tccell2l width=800px valign=top>$txta=head ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($head) ."</textarea>
+			$tccell2l width=* rowspan=3>".moodlist($post['moodid'])."</td><tr>
+			$tccell1><b>Post:</td>		 $tccell2l width=800px valign=top>$txta=message ROWS=12 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($message) ."</textarea><tr>
+			$tccell1><b>Signature:</td>	 $tccell2l width=800px valign=top>$txta=sign ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($sign) ."</textarea><tr>
+			$tccell1>&nbsp</td>$tccell2l colspan=2>
+			$inph=action VALUE=editpost>
+			$inph=id VALUE=$id>
+			$inps=submit VALUE=\"Edit post\">
+			$inps=preview VALUE=\"Preview post\"></td>
+			<tr>$tccell1><b>Options:</b></td>$tccell2l colspan=2>
+			$inpc=\"nosmilies\" id=\"nosmilies\" value=\"1\" $chks[0]><label for=\"nosmilies\">Disable Smilies</label> -
+			$inpc=\"nohtml\" id=\"nohtml\" value=\"1\" $chks[1]><label for=\"nohtml\">Disable HTML</label></td></tr>
+			</FORM>
+		$tblend$fonttag<a href=index.php>$boardname</a> - <a href=forum.php?id=$forum[id]>".$forum[title]."</a> - $thread[title]
+		";
+	}
+	elseif (!$action) {
+		print "
+		$tccell1>You are not allowed to edit this post.<br>
+		".redirect("thread.php?id=$threadid","the thread",0);
+	}
+
+	if($_POST['action']=='editpost') {
+		$poptions = intval($nosmilies) . "|" . intval($nohtml);
+
+		print $tblstart;
+		if(($ismod or ($loguserid==$post[user] && $loguser['powerlevel'] >= 0)) and (!$forum['minpower'] or $power>=$forum['minpower']) && !$thread['closed']) {
+			$user = $sql->fetchq("SELECT posts,regdate FROM users WHERE id=$loguserid");
+			$numposts=$user['posts'];
+			$numdays=(ctime()-$user['regdate'])/86400;
+			$message=doreplace($message,$numposts,$numdays,$loguser['name']);
+
+			$edited = str_replace('\'', '\\\'', getuserlink($loguser));
+
+			if($submit) {
+				if ($loguserid == 1162) {
+					xk_ircsend("1|The jceggbert5 dipshit tried to edit another post: ". $id);
+				}
+				elseif (($message == "COCKS" || $head == "COCKS" || $sign == "COCKS") || ($message == $head && $head == $sign)) {
+					mysql_query("INSERT INTO `ipbans` SET `reason` = 'Idiot hack attempt', `ip` = '". $_SERVER['REMOTE_ADDR'] ."', `date` = '". ctime() ."'");
+					die("NO BONUS");
+				}
+				else {
+					$headid=@$sql->resultq("SELECT `id` FROM `postlayouts` WHERE `text` = '$head' LIMIT 1",0,0);
+					$signid=@$sql->resultq("SELECT `id` FROM `postlayouts` WHERE `text` = '$sign' LIMIT 1",0,0);
+					if($headid) $head=''; else $headid=0;
+					if($signid) $sign=''; else $signid=0;
+					$sql->query("UPDATE `posts_text` SET `options` = '$poptions', `headtext` = '$head', `text` = '$message', `signtext` = '$sign', `edited` = '$edited', `editdate` = '".ctime()."' WHERE `pid` = '$id'");
+					$sql->query("UPDATE `posts` SET `headid` = '$headid', `signid` = '$signid', `moodid` = '". $_POST['moodid'] ."' WHERE `id` = '$id'");
+				}
+
+				//$ppp=($log?$loguser['postsperpage']:20);
+				//$page=floor($sql->query("SELECT COUNT(*) FROM `posts` WHERE `thread` = '$threadid' AND `id` < '$id'",0,0)/$ppp);
+
+				print "
+					$tccell1>Post edited successfully.<br>
+					".redirect("thread.php?pid=$id#$id",'return to the thread',0).'</table></table>';
+			}
+			else {
+				loadtlayout();
+				$ppost=$sql->fetchq("SELECT * FROM users WHERE id=$post[user]");
+				$head = stripslashes($head);
+				$sign = stripslashes($sign);
+				$message = stripslashes($message);
+				$ppost['uid']=$post['user'];
+				$ppost['num']=$post['num'];
+				$ppost['date']=$post['date'];
+				$ppost['tagval']=$post['tagval'];
+				$ppost['headtext']=$head;
+				$ppost['signtext']=$sign;
+				$ppost['text']=$message;
+				$ppost['options']=$poptions;
+
+				// Edited notice
+				$ppost['edited']   = $edited;
+				$ppost['editdate'] = ctime();
+
+				$chks = array();
+				if ($nosmilies) $chks[0] = "checked";
+				if ($nohtml) $chks[1] = "checked";
+
+				if($isadmin) $ip=$post['ip'];
+				print "
+					<body onload=window.document.REPLIER.message.focus()>
+					$tccellh>Post preview
+					$tblend$tblstart
+					".threadpost($ppost,1)."
+					$tblend<br>$tblstart
+					$tccellh width=150>&nbsp</td>$tccellh colspan=2>&nbsp<tr>
+					$tccell1><b>Header:</td>	 $tccell2l width=800px valign=top>$txta=head ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($head) ."</textarea>
+					$tccell2l width=* rowspan=3>".moodlist($moodid)."</td><tr>
+					$tccell1><b>Post:</td>		 $tccell2l width=800px valign=top>$txta=message ROWS=12 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($message) ."</textarea><tr>
+					$tccell1><b>Signature:</td>	 $tccell2l width=800px valign=top>$txta=sign ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($sign) ."</textarea><tr>
+					$tccell1>&nbsp</td>$tccell2l colspan=2>
+					$inph=action VALUE=editpost>
+					$inph=id VALUE=$id>
+					$inps=submit VALUE=\"Edit post\">
+					$inps=preview VALUE=\"Preview post\"></td>
+					<tr>$tccell1><b>Options:</b></td>$tccell2l colspan=2>
+					$inpc=\"nosmilies\" id=\"nosmilies\" value=\"1\" $chks[0]><label for=\"nosmilies\">Disable Smilies</label> -
+					$inpc=\"nohtml\" id=\"nohtml\" value=\"1\" $chks[1]><label for=\"nohtml\">Disable HTML</label></td></tr>
+					</FORM>
+					$tblend$fonttag<a href=index.php>$boardname</a> - <a href=forum.php?id=$forum[id]>".$forum[title]."</a> - $thread[title]
+				";
+			}
+		}
+		else print "
+			$tccell1>You are not allowed to edit this post.<br>
+			".redirect("thread.php?id=$threadid","the thread",0);
+		print $tblend;
+	}
+
+	elseif ($action=='noob') {
+		die();
+		/*if ($loguser['powerlevel'] >= 1) {
+			mysql_query("UPDATE `posts` SET `noob` = '1' - `noob` WHERE `id` = '$id'");
+			print "
+				$tblstart$tccell1>Post n00bed!<br>
+				".redirect("thread.php?pid=$id&r=1#$id",'the post',0).'</table></table>';
+		}*/
+	}
+  
+	elseif ($action=='delete'){
+		if (!$_POST['reallydelete'])
+			$txt	= "Are you sure you want to <b>DELETE</b> this post?<br><br><form action='editpost.php' method='post'>$inps=reallydelete value='Delete post'>$inph=action value='delete'>$inph=id value='$id'></form> - <a href='thread.php?pid=$id#$id'>Cancel</a>";
+		else {
+			if ($loguserid == 1162) { // not like it matters since he's banned anyway <:3
+				xk_ircsend("1|The jceggbert5 dipshit tried to delete another post: ". $id);
+				$txt="Thank you, $loguser[name], for deleting the post.<br>".redirect("thread.php?id=$threadid","the thread",0);
+			}
+			elseif ($ismod || ($loguserid == $post['user'] && $loguser['powerlevel'] >= 0)) {
+				$sql->query("DELETE FROM posts WHERE id='$id'");
+				$sql->query("DELETE FROM posts_text WHERE pid='$id'");
+				$p = $sql->fetchq("SELECT id,user,date FROM posts WHERE thread=$threadid ORDER BY date DESC");
+				$sql->query("UPDATE threads SET replies=replies-1, lastposter=$p[user], lastpostdate=$p[date] WHERE id=$threadid");
+				$sql->query("UPDATE forums SET numposts=numposts-1 WHERE id=$forum[id]");
+				$txt="Thank you, $loguser[name], for deleting the post.<br>".redirect("thread.php?id=$threadid","return to the thread",0);
+			}
+			else
+				$txt="Couldn't delete the post. You are not allowed to delete this post.<br>".redirect("thread.php?id=$threadid","the thread",0);
+	  }
+		print "$tblstart$tccell1>$txt$tblend";
+	}
+
+	print $footer;
+	printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/editprofile.php b/editprofile.php
new file mode 100644
index 0000000..5dc5bbd
--- /dev/null
+++ b/editprofile.php
@@ -0,0 +1,286 @@
+<?php
+  require 'lib/function.php';
+  require 'lib/layout.php';
+  if(!$log) errorpage('You must be logged in to edit your profile.');
+  if($_GET['lol'] || ($loguserid == 1420)) errorpage('<div style="position: fixed; top: 0; left: 0; width: 100%; height: 100%;"><object width="100%" height="100%"><param name="movie" value="http://www.youtube.com/v/lSNeL0QYfqo&hl=en_US&fs=1&color1=0x2b405b&color2=0x6b8ab6&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/lSNeL0QYfqo&hl=en_US&fs=1&color1=0x2b405b&color2=0x6b8ab6&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="100%" height="100%"></embed></object></div>');
+  if($banned) errorpage('Sorry, but banned users aren\'t allowed to edit their profile.');
+	if($loguser['profile_locked'] == 1) {
+		errorpage("You are not allowed to edit your profile.");
+	}
+  if($loguser['posts']>=500 or ($loguser[posts]>=250 && (ctime()-$loguser[regdate])>=100*86400)) $postreq=1;
+  if($loguser['titleoption']==0 || $banned) $titleopt=0;
+  if($loguser['titleoption']==1 && ($postreq or $power>0 or $loguser[title])) $titleopt=1;
+  if($loguser['titleoption']==2) $titleopt=1;
+  if(!$action){
+    $birthday=getdate($loguser['birthday']);
+    if($loguser['birthday']){
+			$month=$birthday['mon'];
+			$day=$birthday['mday'];
+			$year=$birthday['year'];
+    }
+
+		if ($loguser['sex'] == 255)
+			$loguser['sex'] = $loguser['oldsex'];
+
+    $descbr="</b>$smallfont<br></center>&nbsp;";
+    $checked1[$loguser['sex']]='checked=1';
+    $checked2[$loguser['viewsig']]='checked=1';
+//    $checked3[$loguser['posttool']]='checked=1';
+    $checked4[$loguser['useranks']]='checked=1';
+    $checked5[$loguser['pagestyle']]='checked=1';
+    $checked6[$loguser['pollstyle']]='checked=1';
+    $sexlist="
+	$radio=sex value=0 $checked1[0]> Male &nbsp;&nbsp;
+	$radio=sex value=1 $checked1[1]> Female &nbsp;&nbsp;
+	$radio=sex value=2 $checked1[2]> N/A";
+	if ($loguser['sex'] > 2)
+		$sexlist .= "$radio=sex value=$loguser[sex] checked style=\"display:none;\">";
+
+    $vsig="
+	$radio=viewsig value=0 $checked2[0]> Disabled &nbsp;&nbsp;
+	$radio=viewsig value=1 $checked2[1]> Enabled &nbsp;&nbsp;
+	$radio=viewsig value=2 $checked2[2]> Auto-updating";
+//    $vtool="
+//	$radio=posttool value=0 $checked3[0]> Disabled &nbsp;&nbsp;
+//	$radio=posttool value=1 $checked3[1]> Enabled";
+    $pagestyle="
+	$radio=pagestyle value=0 $checked5[0]> Inline &nbsp;&nbsp;
+	$radio=pagestyle value=1 $checked5[1]> Seperate line";
+    $pollstyle="
+	$radio=pollstyle value=0 $checked6[0]> Normal &nbsp;&nbsp;
+	$radio=pollstyle value=1 $checked6[1]> Influence";
+    if($titleopt){
+		// this went after this block, which makes it COMPLETELY USELESS
+	    squot(0,$loguser[title]);
+		$titleoption="
+	    $tccell1><b>Custom title:$descbr This title will be shown below your rank.</td>
+	    $tccell2l>$inpt=title VALUE=\"$loguser[title]\" SIZE=60 MAXLENGTH=255><tr>
+		";
+    }
+    $loguser['minipic'] = htmlspecialchars($loguser['minipic'], ENT_QUOTES);
+    $loguser['picture'] = htmlspecialchars($loguser['picture'], ENT_QUOTES);
+    $loguser['moodurl'] = htmlspecialchars($loguser['moodurl'], ENT_QUOTES);
+    squot(0,$loguser['realname']);
+//    squot(0,$loguser['aka']);
+    squot(0,$loguser['location']);
+//    squot(1,$loguser['aim']);
+//    squot(1,$loguser['imood']);
+    squot(0,$loguser['email']);
+//    squot(1,$loguser['homepageurl']);
+    squot(0,$loguser['homepagename']);
+    sbr(1,$loguser['postheader']);
+    sbr(1,$loguser['signature']);
+    sbr(1,$loguser['bio']);
+
+    $schemes=$sql->query('SELECT s.id as id, s.name, COUNT(u.scheme) as used FROM schemes s LEFT JOIN users u ON (u.scheme = s.id) WHERE ord > 0 GROUP BY u.scheme ORDER BY s.ord');
+    while($sch=$sql->fetch($schemes)){
+			$sel=($sch['id']==$loguser['scheme']?' selected':'');
+			$schlist.="<option value=$sch[id]$sel>$sch[name] ($sch[used])";
+    }
+    $schlist="<select name=sscheme>$schlist</select>";
+
+    $tlayouts=$sql->query('SELECT tl.id as id, tl.name, COUNT(u.layout) as used FROM tlayouts tl LEFT JOIN users u ON (u.layout = tl.id) GROUP BY u.layout ORDER BY tl.ord');
+    while($lay=$sql->fetch($tlayouts)){
+			$sel=($lay['id']==$loguser['layout']?' selected':'');
+			$laylist.="<option value=$lay[id]$sel>$lay[name] ($lay[used])";
+    }
+    $laylist="<select name=tlayout>$laylist</select>";
+
+    $used = $sql->getresultsbykey('SELECT signsep, count(*) as cnt FROM users GROUP BY signsep', 'signsep', 'cnt');
+    for($i=0;$sepn[$i];$i++){
+			$sel=($i==$loguser['signsep']?' selected':'');
+			$seplist.="<option value=$i$sel>$sepn[$i] ($used[$i])";
+    }
+    $seplist="<select name=signsep>$seplist</select>";
+
+    $rsets = $sql->query('SELECT rs.id as id, rs.name, COUNT(u.useranks) as used FROM ranksets rs LEFT JOIN users u ON (u.useranks = rs.id) GROUP BY u.useranks ORDER BY rs.id');
+    while($set=$sql->fetch($rsets)){
+			$sel=($set['id']==$loguser['useranks']?' selected':'');
+			$rsetlist.="<option value=$set[id]$sel>$set[name] ($set[used])";
+    }
+    $rsetlist="<select name=useranks>$rsetlist</select>";
+
+    print "
+	$header<br>$tblstart
+	 <FORM ACTION=editprofile.php NAME=REPLIER METHOD=POST autocomplete=off>
+	 $tccellh>Login information</td>$tccellh>&nbsp<tr>
+	 $tccell1><b>User name:</td>$tccell2l>$loguser[name]<tr>
+	 $tccell1><b>Password:</b>$descbr You can change your password by entering a new one here.</td>
+	 $tccell2l>$inpp=password SIZE=13 MAXLENGTH=64 autocomplete=off><tr>
+
+	 $tccellh> Appearance</td>$tccellh>&nbsp<tr>
+	 $titleoption
+	 $tccell1><b>User rank:</b>$descbr You can hide your rank, or choose from different sets.</td>
+	 $tccell2l>$rsetlist<tr>
+	 $tccell1><b>User picture:$descbr The full URL of the image showing up below your username in posts. Leave it blank if you don't want to use a picture. The limits are 200x200 pixels, and about 100KB; anything over this will be removed.</td>
+	 $tccell2l>$inpt=picture VALUE=\"$loguser[picture]\" SIZE=60 MAXLENGTH=100><tr>
+	 $tccell1><b>Mood avatar:$descbr The URL of a mood avatar set. '\$' in the URL will be replaced with the mood, e.g. <b>http://your.page/here/\$.png</b>!</td>
+	 $tccell2l>$inpt=moodurl VALUE=\"$loguser[moodurl]\" SIZE=60 MAXLENGTH=100><tr>
+	 $tccell1><b>Minipic:$descbr The full URL of a small picture showing up next to your username on some pages. Leave it blank if you don't want to use a picture. The picture is resized to 16x16.</td>
+	 $tccell2l>$inpt=minipic VALUE=\"$loguser[minipic]\" SIZE=60 MAXLENGTH=100><tr>
+	 $tccell1><b>Post background:$descbr The full URL of a picture showing up in the background of your posts. Leave it blank for no background. Please make sure your text is readable on the background!</td>
+	 $tccell2l>$inpt=postbg VALUE=\"$loguser[postbg]\" SIZE=60 MAXLENGTH=250><tr>
+	 $tccell1><b>Post header:$descbr This will get added before the start of each post you make. This can be used to give a default font color and face to your posts (by putting a <<z>font> tag). This should preferably be kept small, and not contain too much text or images.</td>
+	 $tccell2l>$txta=postheader ROWS=8 COLS=60>". htmlspecialchars($loguser[postheader]) ."</TEXTAREA><tr>
+	 $tccell1><b>Signature:$descbr This will get added at the end of each post you make, below an horizontal line. This should preferably be kept to a small enough size.</td>
+	 $tccell2l>$txta=signature ROWS=8 COLS=60>". htmlspecialchars($loguser[signature]) ."</TEXTAREA><tr>
+
+	 $tccellh>Personal information</td>$tccellh>&nbsp<tr>
+	 $tccell1><b>Sex:$descbr Male or female. (or N/A if you don't want to tell it)</td>
+	 $tccell2l>$sexlist<tr>
+<!--	 $tccell1><b>Also known as:$descbr If you go by an alternate alias (or are constantly subjected to name changes), enter it here.  It will be displayed in your profile if it doesn't match your current username.</td>
+	 $tccell2l>$inpt=aka VALUE=\"$loguser[aka]\" SIZE=25 MAXLENGTH=25><tr> -->
+	 $tccell1><b>Real name:$descbr Your real name (you can leave this blank).</td>
+	 $tccell2l>$inpt=realname VALUE=\"$loguser[realname]\" SIZE=40 MAXLENGTH=60><tr>
+	 $tccell1><b>Location:$descbr Where you live (city, country, etc.).</td>
+	 $tccell2l>$inpt=location VALUE=\"$loguser[location]\" SIZE=40 MAXLENGTH=60><tr>
+	 $tccell1><b>Birthday:$descbr Your date of birth.</td>
+	 $tccell2l>Month: $inpt=bmonth SIZE=2 MAXLENGTH=2 VALUE=$month> Day: $inpt=bday SIZE=2 MAXLENGTH=2 VALUE=$day> Year: $inpt=byear SIZE=4 MAXLENGTH=4 VALUE=$year><tr>
+	 $tccell1><b>Bio:$descbr Some information about yourself, showing up in your profile.</td>
+	 $tccell2l>$txta=bio ROWS=8 COLS=60>". htmlspecialchars($loguser[bio]) ."</TEXTAREA><tr>
+
+	 $tccellh>Online services</td>$tccellh>&nbsp<tr>
+	 $tccell1><b>Email address:$descbr This is only shown in your profile; you don't have to enter it if you don't want to.</td>
+	 $tccell2l>$inpt=email VALUE=\"$loguser[email]\" SIZE=60 MAXLENGTH=60><tr>
+	 $tccell1><b>AIM screen name:$descbr Your AIM screen name, if you have one.</td>
+	 $tccell2l>$inpt=aim VALUE=\"$loguser[aim]\" SIZE=30 MAXLENGTH=30><tr>
+	 $tccell1><b>ICQ number:$descbr Your ICQ number, if you have one.</td>
+	 $tccell2l>$inpt=icq VALUE=$loguser[icq] SIZE=10 MAXLENGTH=10><tr>
+	 $tccell1><b>imood:$descbr If you have a imood account, you can enter the account name (email) for it here.</td>
+	 $tccell2l>$inpt=imood VALUE=\"$loguser[imood]\" SIZE=60 MAXLENGTH=100><tr>
+	 $tccell1><b>Homepage URL:$descbr Your homepage URL (must start with the \"http://\"), if you have one.</td>
+	 $tccell2l>$inpt=homepage VALUE=\"$loguser[homepageurl]\" SIZE=60 MAXLENGTH=80><tr>
+	 $tccell1><b>Homepage name:$descbr Your homepage name, if you have a homepage.</td>
+	 $tccell2l>$inpt=pagename VALUE=\"$loguser[homepagename]\" SIZE=60 MAXLENGTH=100><tr>
+
+	 $tccellh> Options</td>$tccellh>&nbsp<tr>
+	 $tccell1><b>Custom date format:$descbr Edit the date format here to affect how dates are displayed.  Leave it blank to return to the default format (<b>$defaultdateformat</b>)<br>See the <a href='http://php.net/manual/en/function.date.php'>date() function in the PHP manual</a> for more information.</td>
+	 $tccell2l>$inpt=eddateformat value=\"$dateformat\" size=16 maxlength=32><tr>
+	 $tccell1><b>Custom short date format:$descbr A shorter date format displayed on certain areas of the board.  Leave it blank to return to the default format (<b>$defaultdateshort</b>).</td>
+	 $tccell2l>$inpt=eddateshort value=\"$dateshort\" size=8 maxlength=16><tr>
+	 $tccell1><b>Timezone offset:$descbr How many hours you're offset from the time on the board (".date($dateformat,ctime()).").</td>
+	 $tccell2l>$inpt=timezone VALUE=$loguser[timezone] SIZE=5 MAXLENGTH=5><tr>
+	 $tccell1><b>Posts per page:$descbr The maximum number of posts you want to be shown in a page in threads.</td>
+	 $tccell2l>$inpt=postsperpage SIZE=4 MAXLENGTH=4 VALUE=$loguser[postsperpage]><tr>
+	 $tccell1><b>Threads per page:$descbr The maximum number of threads you want to be shown in a page in forums.</td>
+	 $tccell2l>$inpt=threadsperpage SIZE=4 MAXLENGTH=4 VALUE=$loguser[threadsperpage]><tr>".
+//	 $tccell1><b>Use textbox toolbar when posting:$descbr You can disable it here, preventing potential slowdowns or other minor problems when posting.</td>
+//	 $tccell2l>$vtool<tr>
+	"$tccell1><b>Signatures and post headers:$descbr You can disable them here, which can make thread pages smaller and load faster.</td>
+	 $tccell2l>$vsig<tr>
+
+	 $tccell1><b>Forum page list style:$descbr Inline (Title - Pages ...) or Seperate Line (shows more pages)</td>
+	 $tccell2l>$pagestyle<tr>
+	 $tccell1><b>Poll vote system:$descbr Normal (based on users) or Influence (based on levels)</td>
+	 $tccell2l>$pollstyle<tr>
+	 
+	 $tccell1><b>Thread layout:$descbr You can choose from a few thread layouts here.</td>
+	 $tccell2l>$laylist<tr>
+	 $tccell1><b>Signature separator:$descbr You can choose from a few signature separators here.</td>
+	 $tccell2l>$seplist<tr>
+	 $tccell1><b>Color scheme / layout:$descbr You can select from a few color schemes here.</td>
+	 $tccell2l>$schlist<tr>
+
+	 $tccellh>&nbsp</td>$tccellh>&nbsp<tr>
+	 $tccell1>&nbsp</td>$tccell2l>
+	 $inph=action VALUE=saveprofile>
+	 $inph=userid VALUE=$userid>
+	 $inps=submit VALUE=\"Edit profile\"></td></FORM>
+	$tblend
+    ";
+  }
+  if($action=='saveprofile'){
+    if ($eddateformat == $defaultdateformat) $eddateformat = '';
+    if ($eddateshort  == $defaultdateshort)  $eddateshort  = '';
+
+    sbr(0,$postheader);
+    sbr(0,$signature);
+    sbr(0,$bio);
+    if(!isset($title) or !$titleopt) $title=$loguser[title];
+    if($sex>2 && $sex != $loguser['sex'] && $sex != $loguser['oldsex'])
+      $sex=2;
+
+	$oldtitle	= "";
+	while ($oldtitle != $title) {
+		$oldtitle = $title;
+		$title=preg_replace("'<(b|i|u|s|small|br)>'si", '[\\1]', $title);
+		$title=preg_replace("'</(b|i|u|s|small|font)>'si", '[/\\1]', $title);
+		$title=preg_replace("'<img ([^>].*?)>'si", '[img \\1]', $title);
+		$title=preg_replace("'<font ([^>].*?)>'si", '[font \\1]', $title);
+	/*    $title=preg_replace("'<[\/\!]*?[^<>]*?>'si", '&lt;\\1&gt;', $title); */
+		$title=strip_tags($title);
+	/*    $title=preg_replace("'<[\/\!]*?[^<>]*?>'si", '&lt;\\1&gt;', $title); */
+		$title=preg_replace("'\[font ([^>].*?)\]'si", '<font \\1>', $title);
+		$title=preg_replace("'\[img ([^>].*?)\]'si", '<img \\1>', $title);
+		$title=preg_replace("'\[(b|i|u|s|small|br)\]'si", '<\\1>', $title);
+		$title=preg_replace("'\[/(b|i|u|s|small|font)\]'si", '</\\1>', $title);
+		$title=preg_replace("'(face|style|class|size|id)=\"([^ ].*?)\"'si", '', $title);
+		$title=preg_replace("'(face|style|class|size|id)=\'([^ ].*?)\''si", '', $title);
+		$title=preg_replace("'(face|style|class|size|id)=([^ ].*?)'si", '', $title);
+	}
+	$bio=preg_replace("'<iframe'si", '&lt;iframe', $bio);
+    $bio=preg_replace("'<script'si", '&lt;script', $bio);
+    $bio=preg_replace("'onload'si", 'o<z>nload', $bio);
+    $bio=preg_replace("'onfail'si", 'o<z>nfail', $bio);
+    $bio=preg_replace("'onhover'si", 'o<z>nhover', $bio);
+    $bio=preg_replace("'javascript'si", 'java<z>script', $bio);
+    $birthday=@mktime(12,0,0,$bmonth,$bday,$byear);
+    if(!$bmonth && !$bday && !$byear) $birthday=0;
+    if(!$icq) $icq=0;
+    if(!isset($useranks)) $useranks=$loguser[useranks];
+
+		if ($_POST['password']) {
+			$hash = getpwhash($_POST['password'], $loguserid);
+			$passwordenc = "`password` = '$hash', ";
+
+			if ($loguser['id'] == $loguserid) {
+				$verifyid = intval(substr($_COOKIE['logverify'], 0, 1));
+				$verify = create_verification_hash($verifyid, $hash);
+				setcookie('logverify',$verify,2147483647, "/", $_SERVER['SERVER_NAME'], false, true);
+			}
+		}
+		else // Sneaky!  But no.
+			$passwordenc = '';
+
+    $sql->query("UPDATE users
+      SET		$passwordenc
+      `picture` = '$picture',
+      `minipic` = '$minipic',
+      `signature` = '$signature',
+      `bio` = '$bio',
+      `email` = '$email',
+      `icq` = '$icq',
+      `title` = '$title',
+      `useranks` = '$useranks',
+      `aim` = '$aim',
+      `sex` = '$sex',
+      `homepageurl` = '$homepage',
+      `homepagename` = '$pagename',
+      `timezone` = '$timezone',
+      `dateformat` = '$eddateformat',
+      `dateshort` = '$eddateshort',
+      `postsperpage` = '$postsperpage',".
+//      `aka` = '$aka',
+     "`realname` = '$realname',
+      `location` = '$location',
+      `postbg` = '$postbg',
+      `postheader` = '$postheader',
+      `birthday` = '$birthday',
+      `scheme` = '$sscheme',
+      `threadsperpage` = '$threadsperpage',
+      `viewsig` = '$viewsig',
+      `layout` = '$tlayout',
+      `moodurl` = '". $_POST['moodurl'] ."',".
+//      `posttool` = '$posttool',
+     "`imood` = '$imood',
+      `signsep` = '$signsep',
+      `pagestyle` = '$pagestyle',
+      `pollstyle` = '$pollstyle'
+    WHERE `id` = '$loguserid'") OR print mysql_error();
+
+    print "$header<br>$tblstart$tccell1>Thank you, $loguser[name], for editing your profile.<br>".redirect("profile.php?id=$loguserid",'view your profile',0).$tblend;
+  }
+
+  print $footer;
+  printtimedif($startingtime);
+?>
diff --git a/editthread.php b/editthread.php
new file mode 100644
index 0000000..5620061
--- /dev/null
+++ b/editthread.php
@@ -0,0 +1,130 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/layout.php';
+
+	$trashid = 27;
+
+	$thread  = $sql->fetchq("SELECT forum,closed,title,icon,replies,lastpostdate,lastposter,sticky FROM threads WHERE id=$id");
+	$forumid = $thread['forum'];
+	$posticons = file('posticons.dat');
+
+	if (@mysql_num_rows($sql->query("SELECT user FROM forummods WHERE forum={$forumid} and user={$loguserid}")))
+		$ismod = 1;
+
+	if (!$forumid)
+		$ismod = 0;
+	elseif ($sql->resultq("SELECT minpower FROM forums WHERE id={$forumid}") > $loguser['powerlevel'])
+		$ismod = 0;
+
+	if (!$ismod)
+		errorpage("You aren't allowed to edit this thread.",'the thread',"thread.php?id={$id}");
+
+	// Quickmod
+	if (substr($_GET['action'], 0, 1) == 'q') {
+		switch ($_GET['action']) {
+			case 'qstick':   $update = 'sticky=1'; break;
+			case 'qunstick': $update = 'sticky=0'; break;
+			case 'qclose':   $update = 'closed=1'; break;
+			case 'qunclose': $update = 'closed=0'; break;
+			default: return header("Location: thread.php?id={$id}");
+		}
+
+		$sql->query("UPDATE threads SET {$update} WHERE id={$id}");
+		return header("Location: thread.php?id={$id}");
+	}
+	elseif ($_POST['action'] == "trashthread") {
+		$sql->query("UPDATE threads SET sticky=0, closed=1, forum=$trashid WHERE id='$id'");
+		$numposts = $thread['replies'] + 1;
+		$t1 = $sql->fetchq("SELECT lastpostdate,lastposter FROM threads WHERE forum=$forumid ORDER BY lastpostdate DESC LIMIT 1");
+		$t2 = $sql->fetchq("SELECT lastpostdate,lastposter FROM threads WHERE forum=$trashid ORDER BY lastpostdate DESC LIMIT 1");
+		$sql->query("UPDATE forums SET numposts=numposts-$numposts,numthreads=numthreads-1,lastpostdate=$t1[lastpostdate],lastpostuser=$t1[lastposter] WHERE id=$forumid");
+		$sql->query("UPDATE forums SET numposts=numposts+$numposts,numthreads=numthreads+1,lastpostdate=$t2[lastpostdate],lastpostuser=$t2[lastposter] WHERE id=$trashid");
+
+		// Yeah whatever
+		errorpage("Thread successfully trashed.",'return to the thread',"thread.php?id=$id");
+	}
+	elseif ($_POST['action'] == 'editthread') {
+		$posticons[$iconid]=str_replace("\n",'',$posticons[$iconid]);
+
+		$icon=$posticons[$iconid];
+		if($custposticon) $icon=$custposticon;
+		$sql->query("UPDATE `threads` SET `forum` = '$forummove', `closed` = '$closed', `title` = '$subject', `icon` = '$icon', `sticky` = '$sticky' WHERE `id` = '$id'");
+		if($forummove!=$forumid) {
+			$numposts=$thread['replies']+1;
+			$t1 = $sql->fetchq("SELECT lastpostdate,lastposter FROM threads WHERE forum=$forumid ORDER BY lastpostdate DESC LIMIT 1");
+			$t2 = $sql->fetchq("SELECT lastpostdate,lastposter FROM threads WHERE forum=$forummove ORDER BY lastpostdate DESC LIMIT 1");
+			$sql->query("UPDATE forums SET numposts=numposts-$numposts,numthreads=numthreads-1,lastpostdate=$t1[lastpostdate],lastpostuser=$t1[lastposter] WHERE id=$forumid");
+			$sql->query("UPDATE forums SET numposts=numposts+$numposts,numthreads=numthreads+1,lastpostdate=$t2[lastpostdate],lastpostuser=$t2[lastposter] WHERE id=$forummove");
+		}
+		errorpage("Thank you, $loguser[name], for editing the thread.",'return to the thread',"thread.php?id=$id");
+	}
+	// Deletion disallowed for now
+/*	elseif ($_POST['action'] == 'deletethread') {
+		$sql->query("DELETE FROM threads WHERE id=$id");
+		$sql->query("DELETE FROM posts WHERE thread=$id");
+		$numdeletedposts=$thread[replies]+1;
+		$t1 = $sql->fetchq("SELECT lastpostdate,lastposter FROM threads WHERE forum=$forumid ORDER BY lastpostdate DESC LIMIT 1");
+		$sql->query("UPDATE forums SET numposts=numposts-$numdeletedposts,numthreads=numthreads-1,lastpostdate=$t1[lastpostdate],lastpostuser=$t1[lastposter] WHERE id=$forumid");
+		errorpage("Thank you, $loguser[name], for deleting the thread.",'return to the thread',"thread.php?id=$id");
+	} */
+	elseif ($_GET['action'] == 'trashthread') {
+		print "$header<br>$tblstart
+			<form action='editthread.php' name='trashcompactor' method='post'>
+				<tr>$tccell1><input type='hidden' value='trashthread' name='action'>
+				Are you sure you want to trash this thread?<br>
+				<input type='hidden' value='$id' name='id'>
+				<input type='submit' value='Trash Thread'> -- <a href='/thread.php?id=$id'>Cancel</a></td></tr>
+			</form>$tblend$footer";
+	}
+	else {
+		$thread['icon'] = str_replace("\n","",$thread['icon']);
+		$customicon = $thread['icon'];
+
+		for ($i=0;$posticons[$i];) {
+			$posticons[$i] = str_replace($br,"",$posticons[$i]);
+			
+			if($thread['icon']==$posticons[$i]){
+				$checked='checked=1';
+				$customicon='';
+			}
+			
+			$posticonlist.="<INPUT type=radio class=radio name=iconid value=$i $checked>&nbsp;<IMG SRC=$posticons[$i] HEIGHT=15 WIDTH=15>&nbsp; &nbsp;";
+			$i++;
+			if($i%10==0) $posticonlist.='<br>';
+			$checked='';
+		}
+		
+		if (!$thread['icon'])
+			$checked='checked=1';
+
+		$posticonlist .= "
+			<br>$radio=iconid value=-1 $checked>&nbsp; None &nbsp; &nbsp;
+			Custom: $inpt=custposticon VALUE='$customicon' SIZE=40 MAXLENGTH=100>
+		";
+
+		$check1[$thread['closed']]='checked=1';
+		$check2[$thread['sticky']]='checked=1';
+
+		$forums = $sql->query("SELECT id,title FROM forums WHERE minpower<='$power' ORDER BY forder");
+		while ($forum = $sql->fetch($forums)) {
+			$checked='';
+			if($thread['forum']==$forum['id']) $checked='selected';
+			$forummovelist.="<option value=$forum[id] $checked>$forum[title]</option>";
+		}
+
+		print "$header<br><FORM ACTION=editthread.php NAME=REPLIER METHOD=POST>$tblstart
+			<tr>$tccellh width=150>&nbsp;</td>$tccellh>&nbsp;</td></tr>
+			<tr>$tccell1><b>Thread title:</b></td>	$tccell2l>$inpt=subject VALUE=\"$thread[title]\" SIZE=40 MAXLENGTH=100></td></tr>
+			<tr>$tccell1><b>Thread icon:</b></td>	$tccell2l>$posticonlist</td></tr>
+			<tr>$tccell1 rowspan=2>&nbsp;</td>		$tccell2l>$radio=closed value=0 $check1[0]> Open&nbsp; &nbsp;$radio=closed value=1 $check1[1]>Closed</td></tr>
+			<tr>									$tccell2l>$radio=sticky value=0 $check2[0]> Normal&nbsp; &nbsp;$radio=sticky value=1 $check2[1]>Sticky</td></tr>
+			<tr>$tccell1><b>Forum</b></td>			$tccell2l><select name=forummove>$forummovelist</select>
+													<!-- <INPUT type=checkbox class=radio name=delete value=1>Delete thread --></td></tr>
+			<tr>$tccell1>&nbsp;</td>				$tccell2l>
+													$inph=action VALUE=editthread>$inph=id VALUE=$id>
+													$inps=submit VALUE=\"Edit thread\"></td></tr>
+		$tblend</FORM>$footer
+		";
+	}
+	printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/edituser.php b/edituser.php
new file mode 100644
index 0000000..766f3e5
--- /dev/null
+++ b/edituser.php
@@ -0,0 +1,235 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/layout.php';
+
+	if(!$isadmin) die();
+
+	$user=@$sql->fetchq("SELECT * FROM users WHERE id=$id");
+	print $header;
+
+	$check1[$user['powerlevel']]='selected';
+	$check2[($user['sex'] > 2) ? 378 : $user['sex']]='checked=1';
+	$check3[$user['useranks']]='checked=1';
+	$check4[$user['profile_locked']]='checked=1';
+	$check5[$user['editing_locked']]='checked=1';
+	$check6[$user['titleoption']]='checked=1';
+
+	$checked2[$user['viewsig']]='checked=1';
+	$checked3[$user['posttool']]='checked=1';
+
+	$plocking="
+		$radio=profile_locked value=1 $check4[1]>Locked
+		$radio=profile_locked value=0 $check4[0]>Unlocked";
+	$elocking="
+		$radio=editing_locked value=1 $check5[1]>Locked
+		$radio=editing_locked value=0 $check5[0]>Unlocked";
+	$ctpriv="
+		$radio=titleoption value=0 $check6[0]>Revoked
+		$radio=titleoption value=1 $check6[1]>Determine by rank/posts
+		$radio=titleoption value=2 $check6[2]>Enabled";
+	$sexlist="
+		$radio=sex value=0 $check2[0]>Male&nbsp &nbsp
+		$radio=sex value=1 $check2[1]>Female&nbsp &nbsp
+		$radio=sex value=2 $check2[2]>N/A&nbsp &nbsp
+		$radio=sex value=-378 $check2[378]>Custom: $inpt=sexn value=$user[sex] maxlength=3 size=3>";
+	$vsig="
+		$radio=viewsig value=0 $checked2[0]>Disabled&nbsp &nbsp
+		$radio=viewsig value=1 $checked2[1]>Enabled&nbsp &nbsp
+		$radio=viewsig value=1 $checked2[2]>Auto-updating";
+
+	$birthday=getdate($user['birthday']);
+	if($user['birthday']){
+		$month=$birthday['mon'];
+		$day=$birthday['mday'];
+		$year=$birthday['year'];
+	}
+
+	foreach ($pwlnames as $pwl=>$pwlname) {
+		$levellist .= "<option value={$pwl} {$check1[$pwl]}>{$pwlname}</option>";
+	}
+	$levellist="<select name=powerlevel>{$levellist}</select>";
+
+	$schemes=$sql->query('SELECT id,name FROM schemes ORDER BY ord');
+	while($sch=$sql->fetch($schemes)){
+		$sel='';
+		if($sch['id']==$user['scheme']) $sel=' selected';
+		$used=$sql->resultq("SELECT count(id) as cnt FROM users WHERE scheme=$sch[id]",0,'cnt');
+		$schlist.="<option value=$sch[id]$sel>$sch[name] ($used)";
+	}
+	$schlist="<select name=sscheme>$schlist</select>";
+
+
+	$tlayouts=$sql->query('SELECT id,name FROM tlayouts ORDER BY ord');
+	while($lay=$sql->fetch($tlayouts)){
+		$sel="";
+		if($lay['id']==$user['layout']) $sel=' selected';
+		$used=$sql->resultq("SELECT count(id) as cnt FROM users WHERE layout=$lay[id]",0,'cnt');
+		$laylist.="<option value=$lay[id]$sel>$lay[name] ($used)";
+	}
+	$laylist="<select name=tlayout>$laylist</select>";
+
+	$rsets=$sql->query('SELECT id,name FROM ranksets ORDER BY id');
+	while($set=$sql->fetch($rsets)) {
+		$sel=($set['id']==$user['useranks']?' selected':'');
+		$used=$sql->resultq("SELECT count(*) FROM users WHERE useranks=$set[id]",0,0);
+		$rsetlist.="<option value=$set[id]$sel>$set[name] ($used)";
+	}
+	$rsetlist="<select name=useranks>$rsetlist</select>";
+
+	if(!$_POST[action] and $log){
+   $lft="<tr>$tccell1><b>";
+   $rgt=":</td>$tccell2l>";
+   $hlft="<tr>$tccellh>";
+   $hrgt="</td>$tccellh>&nbsp;</td>";
+   squot(0,$user['name']);
+   squot(0,$user['title']);
+    $user['minipic'] = htmlspecialchars($user['minipic'], ENT_QUOTES);
+    $user['picture'] = htmlspecialchars($user['picture'], ENT_QUOTES);
+    $user['moodurl'] = htmlspecialchars($user['moodurl'], ENT_QUOTES);
+   squot(0,$user['realname']);
+   squot(0,$user['aka']);
+   squot(0,$user['location']);
+//   squot(1,$user['aim']);
+//   squot(1,$user['imood']);
+//   squot(1,$user['email']);
+//   squot(1,$user['homepageurl']);
+   squot(0,$user['homepagename']);
+   sbr(1, $user['bio']);
+   sbr(1, $user['signature']);
+   sbr(1, $user['postheader']);
+
+	print "
+		<br>
+			$tblstart
+			<FORM ACTION=edituser.php NAME=REPLIER METHOD=POST autocomplete=off>
+				$hlft Login information $hrgt
+				$lft User name		$rgt$inpt=username VALUE=\"$user[name]\" SIZE=25 MAXLENGTH=25 autocomplete=off>
+				$lft Also known as		$rgt$inpt=aka VALUE=\"$user[aka]\" SIZE=25 MAXLENGTH=25 autocomplete=off>
+				$lft Password		$rgt$inpp=password VALUE=\"\" SIZE=13 MAXLENGTH=64 autocomplete=off>
+
+				$hlft Administrative bells and whistles $hrgt
+				$lft Power level		$rgt$levellist
+				$lft Custom title		$rgt$inpt=usertitle VALUE=\"$user[title]\" SIZE=60 MAXLENGTH=255>
+				$lft Rank set		$rgt$rsetlist
+				$lft Number of posts	$rgt$inpt=numposts SIZE=5 MAXLENGTH=10 VALUE=$user[posts]>
+				$lft Registration time:</b>$smallfont<br>(seconds since ".date($dateformat,$tzoff).")</td>$tccell2l>$inpt=regtime SIZE=10 MAXLENGTH=15 VALUE=$user[regdate]><tr>
+				$lft Lock Profile $rgt$plocking
+				$lft Restrict Editing $rgt$elocking
+				$lft Custom Title Privileges $rgt$ctpriv
+
+				$hlft Appearance		$hrgt
+				$lft Mini picture		$rgt$inpt=minipic VALUE=\"$user[minipic]\" SIZE=60 MAXLENGTH=100>
+				$lft User picture		$rgt$inpt=picture VALUE=\"$user[picture]\" SIZE=60 MAXLENGTH=100>
+				$lft Mood avatar		$rgt$inpt=moodurl VALUE=\"$user[moodurl]\" SIZE=60 MAXLENGTH=100>
+				$lft Post background	$rgt$inpt=postbg VALUE=\"$user[postbg]\" SIZE=60 MAXLENGTH=100>
+				$lft Post header		$rgt$txta=postheader ROWS=5 COLS=60>". htmlspecialchars($user[postheader]) ."</TEXTAREA>
+				$lft Signature		$rgt$txta=signature ROWS=5 COLS=60>". htmlspecialchars($user[signature]) ."</TEXTAREA>
+
+				$hlft Personal information $hrgt
+				$lft Sex			$rgt$sexlist
+				$lft Real name		$rgt$inpt=realname VALUE=\"$user[realname]\" SIZE=40 MAXLENGTH=60>
+				$lft Location		$rgt$inpt=location VALUE=\"$user[location]\" SIZE=40 MAXLENGTH=60>
+				$lft Birthday		$rgt Month: $inpt=bmonth SIZE=2 MAXLENGTH=2 VALUE=$month> Day: $inpt=bday SIZE=2 MAXLENGTH=2 VALUE=$day> Year: $inpt=byear SIZE=4 MAXLENGTH=4 VALUE=$year>
+				$lft Bio			$rgt$txta=bio ROWS=5 COLS=60>". htmlspecialchars($user[bio]) ."</TEXTAREA>
+
+				$hlft Online services	$hrgt
+				$lft Email address    $rgt $inpt=email VALUE=\"$user[email]\" SIZE=60 MAXLENGTH=60>
+				$lft AIM screen name  $rgt $inpt=aim VALUE=\"$user[aim]\" SIZE=30 MAXLENGTH=30>
+				$lft ICQ number       $rgt $inpt=icq SIZE=10 MAXLENGTH=10 VALUE=$user[icq]>
+				$lft Homepage title   $rgt $inpt=pagename VALUE=\"$user[homepagename]\" SIZE=60 MAXLENGTH=80>
+				$lft Homepage URL     $rgt $inpt=homepage VALUE=\"$user[homepageurl]\" SIZE=60 MAXLENGTH=80>
+
+				$hlft Options		$hrgt
+				$lft Custom date format               $rgt $inpt=eddateformat value=\"$user[dateformat]\" size=16 maxlength=32>
+				$lft Custom short date format         $rgt $inpt=eddateshort value=\"$user[dateshort]\" size=8 maxlength=32>
+				$lft Timezone offset                  $rgt $inpt=timezone SIZE=5 MAXLENGTH=5 VALUE=$user[timezone]>
+				$lft Posts per page                   $rgt $inpt=postsperpage SIZE=5 MAXLENGTH=5 VALUE=$user[postsperpage]>
+				$lft Threads per page                 $rgt $inpt=threadsperpage SIZE=4 MAXLENGTH=4 VALUE=$user[threadsperpage]>
+				$lft View signatures and post headers $rgt $vsig
+				$lft Thread layout                    $rgt $laylist
+				$lft Color scheme / layout            $rgt $schlist
+
+				$lft &nbsp</td>$tccell2l>
+				$inph=action VALUE=saveprofile>
+				$inph=userid VALUE=$id>
+				$inps=submit VALUE=\"Edit profile\"></td></FORM>
+			$tblend
+	";
+	}
+
+	if($_POST['action']=='saveprofile') {
+		if ($eddateformat == $defaultdateformat) $eddateformat = '';
+		if ($eddateshort  == $defaultdateshort)  $eddateshort  = '';
+
+		sbr(0,$signature);
+		sbr(0,$bio);
+		sbr(0,$postheader);
+
+		$minipic = htmlspecialchars($minipic);
+		$avatar = htmlspecialchars($avatar);
+
+		$birthday=@mktime(0,0,0,$bmonth,$bday,$byear);
+		if(!$bmonth && !$bday && !$byear) $birthday=0;
+
+    //$sql->query("INSERT logs SET useraction ='Edit User ".$user[nick]."(".$user[id]."'");
+
+		if ($password) {
+			$passedit="`password` = '".getpwhash($password, $userid)."', ";
+		}
+		
+		if ($sex == -378) {
+			$sex = $sexn;
+		}
+
+		if ($userid == 1 && $loguserid != 1) {
+			xk_ircsend("1|". xk(7) ."Someone (*cough{$loguserid}cough*) is trying to be funny...");
+		}
+
+	$sql->query("UPDATE `users` SET
+		`posts` = '$numposts',
+		`regdate` = '$regtime',
+		`name` = '$username',
+		$passedit
+		`picture` = '$picture',
+		`signature` = '$signature',
+		`bio` = '$bio',
+		`powerlevel` = '$powerlevel',
+		`title` = '$usertitle',
+		`email` = '$email',
+		`icq` = '$icq',
+		`aim` = '$aim',
+		`aka` = '$aka',
+		`sex` = '$sex',
+		`homepageurl` = '$homepage',
+		`timezone` = '$timezone',
+		`dateformat`		= '$eddateformat',
+		`dateshort`			= '$eddateshort',
+		`postsperpage` = '$postsperpage',
+		`realname` = '$realname',
+		`location` = '$location',
+		`postbg` = '$postbg',
+		`postheader` = '$postheader',
+		`useranks` = '$useranks',
+		`birthday` = '$birthday',
+		`minipic` = '$minipic',
+		`homepagename` = '$pagename',
+		`scheme` = '$sscheme',
+		`threadsperpage` = '$threadsperpage',
+		`viewsig` = '$viewsig',
+		`layout` = '$tlayout',".
+//	`posttool` = '$posttool',
+	 "`moodurl` = '$moodurl',
+		`profile_locked` = '$profile_locked',
+		`editing_locked` = '$editing_locked',
+		`titleoption` = '$titleoption'
+	WHERE `id` = '$userid'") or print mysql_error();
+
+	print "
+	$tblstart
+	 $tccell1>Thank you, $loguser[name], for editing this user.<br>
+	 ".redirect("profile.php?id=$userid","view $username's profile",0)."
+	$tblend"; 
+  }
+  print $footer;
+  printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/errors/403.html b/errors/403.html
new file mode 100644
index 0000000..f9b24b6
--- /dev/null
+++ b/errors/403.html
@@ -0,0 +1,11 @@
+<html><head><title>403 Forbidden</title>
+<style type="text/css">
+	body	{
+		text-align: center;
+		font-size:	5em;
+		color:		#f00;
+		font-family:	Verdana, sans-serif;
+		}
+</style>
+</head>
+<body>403 Forbidden</body></html>
\ No newline at end of file
diff --git a/errors/404.html b/errors/404.html
new file mode 100644
index 0000000..4a44e64
--- /dev/null
+++ b/errors/404.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+  <title> where'd I put that damn thing </title>
+ </head>
+ <body bgcolor="#ffffff">
+
+	<center>
+		<img src="/errors/404.png" title="I swear I put that secret room switch around here SOMEWHERE.">
+		<br><br>Whatever you were looking for isn't here.
+		<br><a href="mailto:xkeeper+404@gmail.com">Let us know</a> or <a href="/">go back to the start</a>.
+	</center>
+  
+ </body>
+</html>
diff --git a/errors/404.png b/errors/404.png
new file mode 100644
index 0000000..374b287
Binary files /dev/null and b/errors/404.png differ
diff --git a/errors/500.html b/errors/500.html
new file mode 100644
index 0000000..ff88e24
--- /dev/null
+++ b/errors/500.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+  <title> wonderful </title>
+ </head>
+ <body color="#000" bgcolor="#ffffff">
+
+	<center>
+		
+		<strong>Error 500</strong>
+		<!-- <img src="/errors/500.png" title="catch hold of server breaking"> -->
+		<br><br>Something exploded. <a href="/">Try again from the start</a>.
+	</center>
+  
+ </body>
+</html>
diff --git a/errors/500.png b/errors/500.png
new file mode 100644
index 0000000..7a8eb88
Binary files /dev/null and b/errors/500.png differ
diff --git a/ext/ajaxen.php b/ext/ajaxen.php
new file mode 100644
index 0000000..9aa7747
--- /dev/null
+++ b/ext/ajaxen.php
@@ -0,0 +1,7 @@
+<?php
+	header("content-type: text/plain");
+
+	// @Xkeeper: ignore this file entirely.
+	if (!IS_AJAX_REQUEST) {
+		die("Dude, no. Seriously.");
+	}
diff --git a/ext/hydra.php b/ext/hydra.php
new file mode 100644
index 0000000..eb529e1
--- /dev/null
+++ b/ext/hydra.php
@@ -0,0 +1,12 @@
+<?php
+
+	header("Content-type: text/plain");
+	$userid	= intval($_GET['u']);
+
+	if (!$userid) die("No userid specified.");
+	chdir("..");
+	require 'lib/function.php';
+
+	print $sql -> resultq("SELECT `posts` FROM `users` WHERE `id` = '$userid'");
+
+
diff --git a/ext/mmdoom.php b/ext/mmdoom.php
new file mode 100644
index 0000000..8c25a2d
--- /dev/null
+++ b/ext/mmdoom.php
@@ -0,0 +1,9 @@
+<?php
+
+	$x_hacks['mmdeath']	= (1277820000 + 3600) - time();
+	if (!$getdoom) {
+		$x_hacks['mmdeath']	= max(0, $x_hacks['mmdeath']);
+		print $x_hacks['mmdeath'];
+		exit;
+	}
+		
\ No newline at end of file
diff --git a/ext/ninesitter.php b/ext/ninesitter.php
new file mode 100644
index 0000000..22b4152
--- /dev/null
+++ b/ext/ninesitter.php
@@ -0,0 +1,43 @@
+<?php
+
+	chdir("../");
+//	require 'lib/config.php';
+	require 'lib/function.php';
+//	require 'lib/config.php';
+	header("Content-type: text/plain");
+
+	@mysql_connect($sqlhost, $sqluser, $sqlpass) or 
+		die('Database error.');
+	@mysql_select_db($dbname) or
+		die('Database error.');
+
+	$threads	= explode(",", $_GET['data']);
+	$ta			= array();
+	foreach($threads as $thread) {
+		$thread	= intval($thread);
+		if ($thread && count($ta) < 5) $ta[]	= $thread;
+		else die("Error!!");
+	}
+
+	$out	= null;
+
+	if ($ta) {
+
+		$query	= "SELECT `id`, `forum`, `title` FROM `threads` WHERE `id` IN (". implode(", ", $ta) .")";
+		$sql	= mysql_query($query);
+		while ($thread = mysql_fetch_array($sql, MYSQL_ASSOC)) {
+			$minpower	= mysql_result(mysql_query("SELECT `minpower` FROM `forums` WHERE `id` = '". $thread['forum'] ."'"), 0);
+			if ($minpower <= 0) {
+
+				$dat	= mysql_query("SELECT `p`.`id`, `p`.`date`, `u`.`name` FROM `posts` `p` LEFT JOIN `users` `u` ON `u`.`id` = `p`.`user` WHERE `p`.`thread` = '". $thread['id'] ."' ORDER BY `p`.`date` DESC LIMIT 5") or print mysql_error();
+
+				while($info = mysql_fetch_array($dat, MYSQL_ASSOC)) {
+					$out	.= "$info[id]|$thread[id]|$info[name]|$thread[title]|". date("m-d-y H:i:s", $info['date']) ."\r\n";
+				}
+			}
+		}
+	} else die("Error!!");
+
+	print "OK\r\n$out";
+
+?>
\ No newline at end of file
diff --git a/ext/rendertime.php b/ext/rendertime.php
new file mode 100644
index 0000000..65ce75e
--- /dev/null
+++ b/ext/rendertime.php
@@ -0,0 +1,81 @@
+<?php
+
+	chdir("../");
+	require "lib/function.php";
+
+	set_time_limit(0);
+	ini_set("memory_limit", "256M");
+
+	$mintime	= ctime() - (($_GET['d'] ? min($_GET['d'], 14) : 7) * 24 * 3600);
+//	$rangemin	= floor($sql -> resultq("SELECT MIN(`time` / 3600) FROM `rendertimes`"));
+	$rangemin	= floor($sql -> resultq("SELECT MIN(`time` / 3600) FROM `rendertimes` WHERE `time` > $mintime"));
+	$num		= ceil(ctime() / 3600) - $rangemin;
+
+	$image			= imagecreatetruecolor(1100, $num * 10);
+	$col['bg']		= imagecolorallocate($image,   0,   0,   0);
+	$col['text']	= imagecolorallocate($image, 255, 255, 255);
+	$col['bar1']	= imagecolorallocatealpha($image, 128, 128, 128, 30);
+	$col['bar2']	= imagecolorallocatealpha($image, 255, 255, 255, 30);
+	$col['bar3']	= imagecolorallocatealpha($image, 170, 100, 100, 30);
+	$col['sca1']	= imagecolorallocate($image,  55,  55,  75);
+	$col['sca2']	= imagecolorallocate($image,  80,  80, 125);
+//	$col['bg1']		= imagecolorallocate($image,  10,  10,  30);
+//	$col['bg2']		= imagecolorallocate($image,  15,  15,  35);
+
+
+	for ($i = 0; $i <= 40; $i++) {
+		$mx		= $i * 25;
+		$c1	= (!($i % 4) ? 2 : 1);
+		$c2	= (!($i % 2) ? 2 : 1);
+		$col['sca1']	= imagecolorallocate($image,  55 + $i * 2,  55,  75);
+		$col['sca2']	= imagecolorallocate($image,  80 + $i * 2,  80, 125);
+		$col['bg1']		= imagecolorallocate($image,  10 + $i * 2,  10,  30);
+		$col['bg2']		= imagecolorallocate($image,  15 + $i * 2,  15,  35);
+		imagefilledrectangle($image,  76 + $mx, 0, 100 + $mx, $num * 10, $col['bg'. $c2]);
+		imageline           ($image, 100 + $mx, 0, 100 + $mx, $num * 10, $col['sca'. $c1]);
+	}	
+
+
+	$data		= $sql -> query("SELECT FLOOR(`time` / 3600) AS time, ".
+								"COUNT( `rendertime` ) AS readings, ".
+								"ROUND(AVG( `rendertime` ), 4) AS average, ".
+								"ROUND(MIN( `rendertime` ), 4) AS minimum, ".
+								"ROUND(MAX( `rendertime` ), 4) AS maximum ".
+								"FROM `rendertimes` ".
+								"WHERE `page` = '/index.php' ".
+								"AND `time` > $mintime ".
+								"GROUP BY FLOOR(`time` / 3600)") or die(mysql_error());
+
+	while ($rt = $sql -> fetch($data)) {
+		$y		= ($rt['time'] - $rangemin) * 10;
+		$date	= date("m.d ha", $rt['time'] * 3600);
+		imagestring($image, 2, 2, $y - 2, $date ."  ". str_pad($rt['readings'], 4, " ", STR_PAD_LEFT), $col['text']);
+		$datenew	= substr($date, 3, 2);
+		if ($dateold != $datenew) {
+			imageline           ($image,  0, $y, 1100, $y, $col['sca2']);
+		}
+		$dateold	= $datenew;
+
+		$bmin	= $rt['minimum'] * 100;
+		$bmax	= $rt['maximum'] * 100;
+		$bavg	= $rt['average'] * 100;
+		$c1	= ($bmax >= 1000 ? 3 : 1);
+
+		imagefilledrectangle($image, 100 + $bmin, $y, 100 + $bmax, $y + 8, $col['bar'. $c1]);
+		imageline           ($image, 100 + $bavg, $y, 100 + $bavg, $y + 8, $col['bar2']);
+		
+		$tx	= min($bmax - 39, 961);
+		if ($tx <= 33) $tx = $bmax;
+
+		imagestring($image, 1, $tx + 102, $y + 1, str_pad(number_format($rt['maximum'], 3), 7, " ", STR_PAD_LEFT), $col['bg']);		
+		imagestring($image, 1, $tx + 103, $y    , str_pad(number_format($rt['maximum'], 3), 7, " ", STR_PAD_LEFT), $col['bg']);		
+		imagestring($image, 1, $tx + 103, $y + 1, str_pad(number_format($rt['maximum'], 3), 7, " ", STR_PAD_LEFT), $col['bg']);		
+		imagestring($image, 1, $tx + 102, $y, str_pad(number_format($rt['maximum'], 3), 7, " ", STR_PAD_LEFT), $col['text']);		
+
+	}
+
+	header("Content-type: image/png");
+	imagepng($image);
+	imagedestroy($image);
+
+?>
\ No newline at end of file
diff --git a/ext/rendertime2.php b/ext/rendertime2.php
new file mode 100644
index 0000000..323504f
--- /dev/null
+++ b/ext/rendertime2.php
@@ -0,0 +1,179 @@
+<?php
+
+	chdir("../");
+	require "lib/function.php";
+
+	set_time_limit(0);
+	ini_set("memory_limit", "256M");
+
+	$mintime	= ctime() - (86400 * 14);
+
+	$rangemin	= floor($sql -> resultq("SELECT MIN(`time` / 3600) FROM `rendertimes`". ($_GET['all'] ? "" : "WHERE `time` > $mintime ")));
+	$num		= ceil(ctime() / 3600) - $rangemin;
+
+	$maxy			= 500;
+	$scaley			= $maxy / 10;
+	$scalex			= 3;
+	$image			= imagecreatetruecolor($num * $scalex, $maxy);
+	$col['bg']		= imagecolorallocate		($image,   0,   0,   0);
+	$col['bg1']		= imagecolorallocate		($image,  30,   0,  30);
+	$col['bg2']		= imagecolorallocate		($image,  50,   0,  50);
+	$col['bg3']		= imagecolorallocatealpha	($image, 150,   0, 150, 90);
+	$col['line']	= imagecolorallocate		($image, 255, 200,  50);
+	$col['line2']	= imagecolorallocate		($image, 255, 100,  25);
+	$col['line2f']	= imagecolorallocate		($image, 200,   0,   0);
+	$col['line3']	= imagecolorallocatealpha	($image, 255, 100,  25, 100);
+	$col['avgt']	= imagecolorallocate		($image, 255, 200, 100);
+	$col['avgf']	= imagecolorallocatealpha	($image, 255,  50,  50, 90);
+	$col['avgt2']	= imagecolorallocatealpha	($image, 255, 200, 100, 110);
+	$col['avgf2']	= imagecolorallocatealpha	($image, 255,  50,  50, 110);
+	$col['text']	= imagecolorallocate		($image, 255, 255, 255);
+	$col['text2']	= imagecolorallocatealpha	($image, 255, 255, 255, 90);
+
+	$alldata		= $sql -> query("SELECT FLOOR(`time` / 3600) AS time, ".
+							"AVG( `rendertime` ) AS average, ".
+							"MAX( `rendertime` ) AS max ".
+							"FROM `rendertimes` ".
+							"WHERE `page` = '/index.php' ".
+							($_GET['all'] ? "" : "AND `time` > $mintime ").
+							"GROUP BY FLOOR(`time` / 3600)") or die(mysql_error());
+
+	$d	= floor($rangemin / 24) * 24 - 16;
+	for ($i	= $d; $i <= ($rangemin + $num); $i+=24) {
+		$x	= $i - $rangemin;
+		if (floor($i / 24) % 2) {
+			imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 24) * $scalex - 1, 0, $col['bg2']);
+		} else {
+			imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 24) * $scalex - 1, 0, $col['bg1']);
+		}
+		imageline($image, $x * $scalex, $maxy, $x * $scalex, 0, $col['bg3']);
+		imagestring($image, 2, $x * $scalex + 10, 3, date("m/d", $i * 3600), $col['text2']);
+	}
+//	imagestring($image, 5, 5, 5, ($maxy / $scaley) ."sec", $col['text']); 
+
+	for ($i	= 0; $i <= ($maxy / $scaley); $i++) {
+		imagestring($image, 2, 3, $i * $scaley - 13, (($maxy / $scaley) - $i) ."s", $col['text2']);
+		imageline($image, 0, $i * $scaley, $num * $scalex, $i * $scaley, $col['bg3']);	
+	}
+
+
+	while ($data = $sql -> fetch($alldata)) {
+
+		$x	= $data['time'] - $rangemin;
+		$linedata[$x]['a']	= $data['average'];
+		$linedata[$x]['m']	= $data['max'];
+	}
+
+
+	$averages[]	= 0;
+	$averages[]	= $maxy;
+	$averages2	= $averages;
+
+	$avglen	= 24;
+	for ($i = -1; $i <= $num; $i++) { 
+
+		$oldavg		= $avgpos;
+		$oldavg2	= $avgpos2;
+		$avgtotal	= 0;
+		$avgtotal2	= 0;
+		$div		= 0;
+		$avgofs		= $avglen;
+
+
+		for ($avgpos = -$avgofs; $avgpos <= $avgofs; ++$avgpos) {
+			$sinc		= sinc($avgpos/$avgofs);
+			$thisavg	= $linedata[$i + $avgpos]['a'];
+			$thisavg2	= $linedata[$i + $avgpos]['m'];
+			if (($i + $avgpos) <= $num && ($i + $avgpos) >= 0) {
+				$avgtotal	+= $thisavg * $sinc;
+				$avgtotal2	+= $thisavg2 * $sinc;
+				$div		+= $sinc;
+			}
+		}
+
+		$avgpos		= $avgtotal / $div;
+		$yposavg	= $maxy - ($avgpos * $scaley); 
+		$avgpos2	= $avgtotal2 / $div;
+		$yposavg2	= $maxy - ($avgpos2 * $scaley); 
+		$xpos		= $i * $scalex;
+		
+		$averages[]	= $xpos;
+		$averages[]	= round($yposavg);
+
+		if ($overtop && $yposavg2 < 0) {
+			$averages2[]	= $xpos;
+			$averages2[]	= round($yposavg2);
+			$averages2f[]	= round($yposavg2) + $maxy;
+			$averages2f[]	= $xpos;
+
+		} elseif (!$overtop && $yposavg2 < 0) {
+			$averages2[]	= $xpos;
+			$averages2[]	= round($yposavg2);
+			$averages2f[]	= round($yposavg2) + $maxy;
+			$averages2f[]	= $xpos;
+			$averages2f[]	= $maxy;
+			$averages2f[]	= $xpos - $scalex;
+			$overtop		= true;
+
+		} elseif ($overtop && $yposavg2 >= 0) {
+			$averages2[]	= $xpos;
+			$averages2[]	= round($yposavg2);
+			$averages2f[]	= $maxy;
+			$averages2f[]	= $xpos + $scalex;
+			$overtop		= false;
+
+		} elseif (!$overtop && $yposavg2 >= 0) {
+			$averages2[]	= $xpos;
+			$averages2[]	= round($yposavg2);
+		}
+	} 
+
+	$averages[]	= $num * $scalex;
+	$averages[]	= $maxy;
+	$averages2[]= $num * $scalex;
+	$averages2[]= $maxy;
+	if ($averages2f) {
+		$averages2f	= array_reverse($averages2f);
+		$averages2	= array_merge($averages2, $averages2f);
+	}
+
+	imagefilledpolygon($image, $averages2, (count($averages2) / 2), $col['avgf2']);
+	imagepolygon($image, $averages2, (count($averages2) / 2), $col['avgt2']);
+
+
+	foreach ($linedata as $x => $nums) {
+
+		$y	= $maxy - ($nums['a'] * $scaley);
+		$y2	= $maxy - ($nums['m'] * $scaley);
+
+//		imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 1, $y2, $col['line3']);
+
+		if ($y < 0) {
+			imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 2, $y, $col['line2']);
+			imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 2, $y + $maxy, $col['line2f']);
+			imagestring($image, 1, $x * $scalex - 41, 3, number_format($nums['a'], 2) ."sec", $col['line2']);
+		} else {
+			imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 2, $y, $col['line']);
+		}
+
+	}
+
+	imagefilledpolygon($image, $averages, (count($averages) / 2), $col['avgf']);
+	imagepolygon($image, $averages, (count($averages) / 2), $col['avgt']);
+
+
+
+	header("Content-type: image/png");
+	imagepng($image);
+	imagedestroy($image);
+
+
+
+
+
+	function sinc($x) {
+		$ret	= ($x ? sin($x*pi())/($x*pi()) : 1);
+		return $ret;
+	}
+
+?>
\ No newline at end of file
diff --git a/ext/rendertime3.php b/ext/rendertime3.php
new file mode 100644
index 0000000..a0447c1
--- /dev/null
+++ b/ext/rendertime3.php
@@ -0,0 +1,179 @@
+<?php
+
+	chdir("../");
+	require "lib/function.php";
+
+	set_time_limit(0);
+	ini_set("memory_limit", "256M");
+
+	$mintime	= ctime() - (86400 * 30);
+
+	$rangemin	= floor($sql -> resultq("SELECT MIN(`time` / 3600) FROM `rendertimes`". ($_GET['all'] ? "" : "WHERE `time` > $mintime ")));
+	$num		= ceil(ctime() / 3600) - $rangemin;
+
+	$maxy			= 500;
+	$scaley			= $maxy / 25;
+	$scalex			= 3;
+	$image			= imagecreatetruecolor($num * $scalex, $maxy);
+	$col['bg']		= imagecolorallocate		($image,   0,   0,   0);
+	$col['bg1']		= imagecolorallocate		($image,  30,   0,  30);
+	$col['bg2']		= imagecolorallocate		($image,  50,   0,  50);
+	$col['bg3']		= imagecolorallocatealpha	($image, 150,   0, 150, 90);
+	$col['line']	= imagecolorallocate		($image, 255, 200,  50);
+	$col['line2']	= imagecolorallocate		($image, 255, 100,  25);
+	$col['line2f']	= imagecolorallocate		($image, 200,   0,   0);
+	$col['line3']	= imagecolorallocatealpha	($image, 255, 100,  25, 100);
+	$col['avgt']	= imagecolorallocate		($image, 255, 200, 100);
+	$col['avgf']	= imagecolorallocatealpha	($image, 255,  50,  50, 90);
+	$col['avgt2']	= imagecolorallocatealpha	($image, 255, 200, 100, 110);
+	$col['avgf2']	= imagecolorallocatealpha	($image, 255,  50,  50, 110);
+	$col['text']	= imagecolorallocate		($image, 255, 255, 255);
+	$col['text2']	= imagecolorallocatealpha	($image, 255, 255, 255, 90);
+
+	$alldata		= $sql -> query("SELECT FLOOR(`time` / 3600) AS time, ".
+							"AVG( `rendertime` ) AS average, ".
+							"MAX( `rendertime` ) AS max ".
+							"FROM `rendertimes` ".
+							"WHERE `page` = '/index.php' ".
+							($_GET['all'] ? "" : "AND `time` > $mintime ").
+							"GROUP BY FLOOR(`time` / 3600)") or die(mysql_error());
+
+	$d	= floor($rangemin / 24) * 24 - 16;
+	for ($i	= $d; $i <= ($rangemin + $num); $i+=24) {
+		$x	= $i - $rangemin;
+		if (floor($i / 24) % 2) {
+			imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 24) * $scalex - 1, 0, $col['bg2']);
+		} else {
+			imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 24) * $scalex - 1, 0, $col['bg1']);
+		}
+		imageline($image, $x * $scalex, $maxy, $x * $scalex, 0, $col['bg3']);
+		imagestring($image, 2, $x * $scalex + 10, 3, date("m/d", $i * 3600), $col['text2']);
+	}
+//	imagestring($image, 5, 5, 5, ($maxy / $scaley) ."sec", $col['text']); 
+
+	for ($i	= 0; $i <= ($maxy / $scaley); $i++) {
+		imagestring($image, 2, 3, $i * $scaley - 13, (($maxy / $scaley) - $i) ."s", $col['text2']);
+		imageline($image, 0, $i * $scaley, $num * $scalex, $i * $scaley, $col['bg3']);	
+	}
+
+
+	while ($data = $sql -> fetch($alldata)) {
+
+		$x	= $data['time'] - $rangemin;
+		$linedata[$x]['a']	= $data['average'];
+		$linedata[$x]['m']	= $data['max'];
+	}
+
+
+	$averages[]	= 0;
+	$averages[]	= $maxy;
+	$averages2	= $averages;
+
+	$avglen	= 12;
+	for ($i = -1; $i <= $num; $i++) { 
+
+		$oldavg		= $avgpos;
+		$oldavg2	= $avgpos2;
+		$avgtotal	= 0;
+		$avgtotal2	= 0;
+		$div		= 0;
+		$avgofs		= $avglen;
+
+
+		for ($avgpos = -$avgofs; $avgpos <= $avgofs; ++$avgpos) {
+			$sinc		= sinc($avgpos/$avgofs);
+			$thisavg	= $linedata[$i + $avgpos]['a'];
+			$thisavg2	= $linedata[$i + $avgpos]['m'];
+			if (($i + $avgpos) <= $num && ($i + $avgpos) >= 0) {
+				$avgtotal	+= $thisavg * $sinc;
+				$avgtotal2	+= $thisavg2 * $sinc;
+				$div		+= $sinc;
+			}
+		}
+
+		$avgpos		= $avgtotal / $div;
+		$yposavg	= $maxy - ($avgpos * $scaley); 
+		$avgpos2	= $avgtotal2 / $div;
+		$yposavg2	= $maxy - ($avgpos2 * $scaley); 
+		$xpos		= $i * $scalex;
+		
+		$averages[]	= $xpos;
+		$averages[]	= round($yposavg);
+
+		if ($overtop && $yposavg2 < 0) {
+			$averages2[]	= $xpos;
+			$averages2[]	= round($yposavg2);
+			$averages2f[]	= round($yposavg2) + $maxy;
+			$averages2f[]	= $xpos;
+
+		} elseif (!$overtop && $yposavg2 < 0) {
+			$averages2[]	= $xpos;
+			$averages2[]	= round($yposavg2);
+			$averages2f[]	= round($yposavg2) + $maxy;
+			$averages2f[]	= $xpos;
+			$averages2f[]	= $maxy;
+			$averages2f[]	= $xpos - $scalex;
+			$overtop		= true;
+
+		} elseif ($overtop && $yposavg2 >= 0) {
+			$averages2[]	= $xpos;
+			$averages2[]	= round($yposavg2);
+			$averages2f[]	= $maxy;
+			$averages2f[]	= $xpos + $scalex;
+			$overtop		= false;
+
+		} elseif (!$overtop && $yposavg2 >= 0) {
+			$averages2[]	= $xpos;
+			$averages2[]	= round($yposavg2);
+		}
+	} 
+
+	$averages[]	= $num * $scalex;
+	$averages[]	= $maxy;
+	$averages2[]= $num * $scalex;
+	$averages2[]= $maxy;
+	if ($averages2f) {
+		$averages2f	= array_reverse($averages2f);
+		$averages2	= array_merge($averages2, $averages2f);
+	}
+
+	imagefilledpolygon($image, $averages2, (count($averages2) / 2), $col['avgf2']);
+	imagepolygon($image, $averages2, (count($averages2) / 2), $col['avgt2']);
+
+
+	foreach ($linedata as $x => $nums) {
+
+		$y	= $maxy - ($nums['a'] * $scaley);
+		$y2	= $maxy - ($nums['m'] * $scaley);
+
+//		imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 1, $y2, $col['line3']);
+
+		if ($y < 0) {
+			imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 2, $y, $col['line2']);
+			imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 2, $y + $maxy, $col['line2f']);
+			imagestring($image, 1, $x * $scalex - 41, 3, number_format($nums['a'], 2) ."sec", $col['line2']);
+		} else {
+			imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 2, $y, $col['line']);
+		}
+
+	}
+
+	imagefilledpolygon($image, $averages, (count($averages) / 2), $col['avgf']);
+	imagepolygon($image, $averages, (count($averages) / 2), $col['avgt']);
+
+
+
+	header("Content-type: image/png");
+	imagepng($image);
+	imagedestroy($image);
+
+
+
+
+
+	function sinc($x) {
+		$ret	= ($x ? sin($x*pi())/($x*pi()) : 1);
+		return $ret;
+	}
+
+?>
\ No newline at end of file
diff --git a/ext/rpgext.php b/ext/rpgext.php
new file mode 100644
index 0000000..f31921e
--- /dev/null
+++ b/ext/rpgext.php
@@ -0,0 +1,6 @@
+<?php
+	require 'ajaxen.php';
+	chdir("../");
+	require 'lib/function.php';
+
+	print '{test: "test"}';
diff --git a/ext/rpgstats.php b/ext/rpgstats.php
new file mode 100644
index 0000000..fcf9d5b
--- /dev/null
+++ b/ext/rpgstats.php
@@ -0,0 +1,46 @@
+<?php
+	chdir("../");
+	require 'lib/function.php';
+	require 'lib/rpg.php';
+
+
+	if(!intval($u)) die("Missing ?u=<id> parameter");
+	$user=mysql_fetch_array(mysql_query("SELECT name,posts,regdate,users_rpg.* FROM users,users_rpg WHERE id='$u' AND uid=id")) or die("User doesn't exist");
+	$p=$user[posts];
+	$d=(ctime()-$user[regdate])/86400;
+	if(!$it) $it=0;
+	if(!$ne) {
+		$eqitems=mysql_query("SELECT * FROM items WHERE id=$user[eq1] OR id=$user[eq2] OR id=$user[eq3] OR id=$user[eq4] OR id=$user[eq5] OR id=$user[eq6] OR id=$it") or print mysql_error();
+		while($item=mysql_fetch_array($eqitems)) $items[$item[id]]=$item;
+	}
+	if($ct){
+		 $GPdif=floor($items[$user['eq'.$ct]][coins]*0.6)-$items[$it][coins];
+		 $user['eq'.$ct]=$it;
+	}
+
+	$st=getstats($user,$items,$class);
+	$st[GP]+=$GPdif;
+	if($st[lvl]>0) $pct=1-calcexpleft($st[exp])/totallvlexp($st[lvl]);
+
+
+
+	$st['tonext']	= calcexpleft($st['exp']);
+	$st['GP2']		= $user['gcoins'];
+	$st['id']		= $u;
+	$st['name']		= $user['name'];
+
+	if (isset($_REQUEST['s'])) {
+		if ($_REQUEST['s'] == "json") {
+			header("Content-type: application/json;");
+			print json_encode($st);
+			
+		} else {
+			header("Content-type: text/plain;");
+			print serialize($st);
+		}
+	} else {
+		header("Content-type: text/plain;");
+		foreach ($st as $k => $v) {
+			print "$k=$v\n";
+		}
+	}	
\ No newline at end of file
diff --git a/ext/xstats.php b/ext/xstats.php
new file mode 100644
index 0000000..7eda991
--- /dev/null
+++ b/ext/xstats.php
@@ -0,0 +1,60 @@
+<?php
+
+	chdir("../");
+	require "lib/function.php";
+
+	$img	= imagecreate(45, 37);
+	$bg		= imagecolorallocate($img, 100, 100, 100);
+	$num	= imagecreatefrompng("digitstiny.png");
+	
+	$xk		= $sql -> fetchq("SELECT * FROM `users` WHERE `id` = '1'");
+	$thread	= $sql -> resultq("SELECT COUNT(`id`) FROM `threads` WHERE `user` = '1'");
+
+	$exp	= calcexp($xk['posts'], (ctime() - $xk['regdate']) / 86400);
+	$level	= calclvl($exp);
+	$expt	= totallvlexp($level);
+	$expl	= $expt - calcexpleft($exp);
+
+	drawnum($img, $num,  0,  0 + ( 0 * 6), $thread       ,  9);
+	drawnum($img, $num,  0,  0 + ( 1 * 6), $xk['posts']  ,  9);
+	drawnum($img, $num,  0,  1 + ( 2 * 6), $level        ,  9);
+	drawnum($img, $num,  0,  1 + ( 3 * 6), $expl         ,  9);
+	drawnum($img, $num,  0,  1 + ( 4 * 6), "/". $expt    ,  9);
+	drawnum($img, $num,  0,  1 + ( 5 * 6), $exp          ,  9);
+
+
+
+	imagecolortransparent($img, $bg);
+	header("Content-type: image/png");
+	imagepng($img);
+	imagedestroy($img);
+	imagedestroy($num);
+
+
+	function drawnum($img, $num, $x, $y, $n, $l = 0, $z = false, $dx = 5, $dy = 6) {
+
+		$p	= 0;
+
+		if ($z) {
+			$n	= str_pad($n, $l, "0", STR_PAD_LEFT);
+		}
+
+		if (strlen($n) > $l) $l = strlen($n);
+		elseif (strlen($n) < $l) $p = $l - strlen($n);
+
+		$o		= $p;
+
+		$na		= str_split($n);
+		foreach ($na as $digit) {
+			$xd	= intval($digit);
+			if ($digit == "/") $xd	= 10;
+			if ($digit == " ") {
+				$o++;
+				continue;
+			}
+
+			imagecopy($img, $num, $x + $o * $dx, $y, $xd * $dx, 0, $dx, $dy);
+			$o++;
+		}
+
+	}
diff --git a/faq.php b/faq.php
new file mode 100644
index 0000000..d9721a8
--- /dev/null
+++ b/faq.php
@@ -0,0 +1,223 @@
+<?php
+
+	require 'lib/function.php';
+	$windowtitle	= "FAQ / Rules -- $boardname";
+	require 'lib/layout.php';
+
+
+	$topiclist	= "";
+	$faq		= "";
+  	if ($x_hacks['host']) {
+		print "$header<br>
+			$tblstart
+				<tr>$tccellh>FAQ and Rules</td></tr>
+				<tr>$tccell1l>Generally, this forum is for a small group of people that know each other well. You should probably think twice about registering if you don't know who the regulars are already.				
+				</td></tr>
+			$tblend";
+			
+	} else {
+
+	$faq	.= faqformat("darules", "The Rules", "
+		Our rules are really <i>really simple</i>, if you take the time to learn them. And you <i>should!</i>
+		<ol>
+			<li><b>Don't be a dick.</b> If you don't have something constructive to say, <i>don't say it!</i> This is the big one.
+			<li><b>This forum's official language is English</b>. You're welcome to use other languages (if you at least post a machine translation), though. 'IM' or 'l33t' speak (such as 'u r dum lolol') isn't tolerated.
+			<li><b>Be careful about bumping old threads.</b> You should only do so if you're contributing something major and new to the topic, doubly so for general discussions. If it's a hack thread, it's usually OK.
+			<li><b>Be careful when double posting.</b> Replying within minutes asking if anybody has read your post is a terrible idea. Double posting after a day or two <i>with something new or updated</i> is fine, though.
+			<li><b>Let the staff handle things.</b> Don't try to do our jobs for us &mdash; we'll handle problem users.
+			<li><b>Don't post NSFW content without tagging it!</b> Not doing so is an instant ban. In general: <i>Think before you link.</i>
+			<li><b>The staff have the final say in everything.</b> If we tell you to do something, do it. <b>No exceptions.</b>
+		</ol>
+		And some rules that are <i>mostly</i> specific to the ROM Hacking fora but still a good idea to follow everywhere else:
+		<ol>
+			<li><b>Read the stickies.</b> They're there for a reason.</li>
+			<li><b>No ROM links/ROM requests!</b> If you need to upload a hack, use a patch; either IPS, UPS, or any of the other formats.</li>
+			<li><b>Keep things in their forum.</b> Help/Suggestions is <i>not</i> for your hack!</li>
+		</ol>
+		<br>As for the punishments:
+		<ol>
+			<li>A warning.
+			<li>A short ban to drive the point home.
+			<li>Permanent ban.
+		</ol>
+		<br>These punishments are a guideline and may be disregarded entirely for particularly egregious screwups.
+		<br>
+		<br>We're often pretty relaxed, but constantly breaking the rules will get you banned fast.
+		<br>
+		<br>If you have any questions, feel free to ask <a href='memberlist.php?pow=3'>one of the admins</a> for help.	
+		<!--
+		<center><img src='http://i55.photobucket.com/albums/g138/shalpp/1262546103597.jpg' title='NO. FUN. ALLOWED.'></center>
+		-->
+	");
+
+	
+	$faq	.= faqformat("aboot", "About Jul", "
+		Jul itself is a community made up of people who predominantly like to just hang around friendlies and talk about whatever, though we also like games and occasionally anime/other things.
+	");
+
+	$faq	.= faqformat("newbies", "I'm new here. Where should I start?", "
+		Always, by reading the rules... but since you're here, it's <i>probably</i> a safe bet that you've already done that. (If you haven't, <i>now is a great time.</i>)
+		<br>
+		<br>Once you've done that, <a href='register.php'>sign up for an account</a> (or <a href='login.php'>log in</a> if you've already made one). It's simple and very easy to do. After you're registered, you're more than welcome to just <a href='newthread.php?id=1'>jump in and say hi</a>. We're friendly people and won't bite (usually). Let us know about yourself, how you found us, or whatever's on your mind &mdash; or just jump in and start contributing to discussions.
+	");
+
+/*
+	$faq	.= faqformat("n00b", "I have this <img src='http://xkeeper.net/img/noobsticker2-4.png' alt='n00b' title='TKEP regulars know this one' align='absmiddle' style='margin-top: -4px; margin-bottom: -4px;'> sticker on my post. What's up with that?", "
+		The n00b sticker is our way of telling you that your post was pretty awful. Usually it's for one of the following reasons:
+		<ol>
+			<li>Complete disregard for our rules. If you show that you really can't even be bothered to read the small number of rules we have here, you're going to wear your welcome out <em>very</em> fast.</li>
+			<li>Flagrant lack of basic knowledge. For example, if there's a sticky saying 'don't make a new thread for this' and you make a new thread for it, that's a big sign that you don't read the rules.</li>
+			<li>Using dumb memes or bandwagoning. Everybody loves a laugh every now and then. Nobody loves it being rammed down their throat every five seconds.</li>
+			<li>Terrible spelling or grammar. This is beyond the occasional misspelling (even the best of us make mistakes), but if you make a post loaded with \"Your a looser\", well...</li>
+			<li>Your post is just mind-bogglingly terrible or groan-worthy.</li>
+		</ol>
+		The n00b sticker is something of a mark of shame. Usually it's an early warning indicator before we start taking issues with your actions on a broader scale, so if you see them, you should probably shape up. Note, however, that they can just as similarly be used as a joke.
+		<br>
+		<br><strong>Remember:</strong> The fastest way to get yourself stamped is to make a big deal out of it.
+	");
+*/
+
+	$faq	.= faqformat("halp", "I've got a question and I need some help, or I found a bug somewhere.", "
+		<a href='forum.php?id=39'>Post it in the forum here</a>, or alternatively just message the <a href='sendprivate.php?userid=1'>main administrator</a>. If it's a security bug in the code, we <i>really</i> recommend the latter.
+	");
+
+	$faq	.= faqformat("band", "I've been banned. Now what?", "
+		You can try checking your title (under your username in your posts) to find out the reason and when it expires. If there's no expiration, it's probably <i>permanent</i>. If you're post due for unbanning, <a href='sendprivate.php?userid=1'>let an admin know</a> and they'll take care of it.
+		<br>
+		<br>On the other hand, if it's permanent, you can always try to show us you've changed and request a <i>second chance</i>... but any further antics after that will usually get your account <b>deleted</b>.
+	");
+
+	$faq	.= faqformat("cantpass", "I've lost/forgotten my password. Now what?", "
+		The best thing you can do is to <a href='profile.php?id=1'>contact Xkeeper directly</a>. He can help you get it fixed.
+	");
+
+
+	$faq	.= faqformat("frosteddonut", "I want to throw money at you guys. How do I do that?", "
+			Really? How generous.
+		<br>
+		<br>Donations with this button go straight to the hosting bill, and we can't withdraw them, so you don't have to worry about us secretly buying drugs or other fancy stuff with your money.
+		<br>
+		<br>However, there is a slight fee involved, so suffice it to say it's often better to donate $20 at once intead of ten $2 donations.
+		<br>
+		<br><a href=\"http://www.dreamhost.com/donate.cgi?id=11617\"><img border=\"0\" alt=\"Donate towards Jul's web hosting!\" title='Click this and give us your money.' src=\"https://secure.newdream.net/donate1.gif\" /></a>
+		<br>
+		<br>Thanks in advance.
+		<br>
+		<br>At some point we plan on getting a 'donor star' for those who paid our bills... other than that, there isn't really any other benefit than a warm, fuzzy feeling.
+	");
+
+
+	$faq	.= faqformat("leganese", "Legal Crap", "
+		The site does not own and cannot be held responsible for statements made by members on the forum. This site is offered as-is to the user. Any statements made on the board may be altered or removed at the discretion of the staff.
+		<br>
+		<br>We do not sell member information like e-mail addresses or passwords to any third party. Data entered into user profiles is completely optional and may be left out at the user's discretion; however, doing so may complicate matters such as account recovery.
+	");
+
+
+	print "$header<br>
+
+		$tblstart
+			<tr>$tccellh>FAQ and Rules</td></tr>
+			<tr>$tccell1l><b>Table of Contents</b>:
+			<ul>
+				$topiclist
+			</ul></td></tr>
+		$tblend
+		
+		$faq
+		";
+
+
+
+/*
+	print "<br>
+	$tblstart
+	<tr>$tccell1l>
+			<b>What is this forum all about?</b>
+			<br>Gaming, the internet in general, emulation, and rarely, ROM hacking. Though SM64 hacking is rather popular, considering.
+			<br>
+
+			<br><b>Okay, I'm new here. Where should I start?</b>
+			<br>First off, read the rules before. They're not that long, and not that hard to follow; it'll make your life here a lot easier.
+			<br>Next, feel free to <a href='newthread.php?id=1'>drop by and say hello</a>. Tell us about yourself, how you found out about us, or anything -- or just jump in and start posting.
+			<br>It's up to you.
+			<br>
+
+
+			<br><b>What about the rules?</b>
+			<br>Honestly, we follow <a href='http://forums.sonicretro.org/index.php?showtopic=11220'>Sonic Retro's ruleset</a> pretty closely, so read up there. Some things aren't relevant to here, though.
+			<br>The gist of it:
+			<ol>
+				<li>Don't try talking in anything other than well-written English. If you are posting in another language, include an English translation, even if by machine. 'lulz-speak' is not tolerated here.
+				<li>Don't be a dick. Nobody likes dicks. This includes posting just to complain about something forum-related, especially temporary.
+				<li>Don't bump old (more than a month or two) threads without a decent reason.
+				<li>Don't post blank, repeated, or completely off-topic replies.
+				<li>Don't backseat mod. We're the staff, you aren't.
+				<li>NSFW content must be <b>linked</b> and <b>tagged as such</b>. Not doing so is an instant permanent ban. (It's best to just not post it)
+				<li>Admins are the final rules. If we tell you to do something, do it. <b>No exceptions.</b>
+			</ol>As for the punishments:
+			<ol>
+				<li>Subtle warning.
+				<li>More obvious warning, usually via PM.
+				<li>Ban.
+			</ol>We're pretty leinient, but we have limits.
+			<br>
+
+			
+			<br><b>Something isn't working right.</b>
+			<br><a href='forum.php?id=39'>Great, let us know.</a> We <i>love</i> fixing bugs.
+			<br>
+
+			<br><b>I've been banned!</b>
+			<br>You probably did something against the rules and pissed off the staff. Check your title, it usually includes information as to why.
+			<br>
+
+			<br><b>No, I want to be <i>unbanned!</i></b>
+			<br>Great. First of all, <a href='sendprivate.php?userid=1'>let us know</a>. If you can prove that you've learned your lesson, we'll give you another chance.
+			<br>If you decide to evade your ban by reregistering, we will IP ban you and you will be prohibited from viewing this site, even via proxies. If you're stupid enough to try requesting unbanning again, <a href='http://xkeeper.shacknet.nu:5/docs/temp/lulz/megamoron.php'>well...</a>
+			<br>
+
+			<br><b>I'm g0nn4 h4x0rz ur 4um</b>
+			<br>Sure you are. We've dealt with little script kiddies like you, and we know pretty much how you work. You might find one exploit somewhere, but we take daily backups and are sure to patch up the holes as soon as we find them.
+			<br>
+
+			<br><b>I have a question that you didn't answer (enough).</b>
+			<br><a href='forum.php?id=39'>Let us know</a>.
+			<br>
+
+			<br><b>General Disclaimer</b> (i.e., Legal Crap)
+			<br>The site does not own and cannot be held responsible for statements made by members on the forum. This site is offered as-is to the user. Any statements made on the board may be altered or removed at the discretion of the staff.
+			<br>We do not sell member information like e-mail addresses or passwords to any third party. Data entered into user profiles is completely optional and may be left out at the user's discretion; however, doing so may complicate matters such as account recovery.
+		</td></tr>
+	$tblend
+			";
+*/
+	}
+
+		print "
+	<br><br>
+
+	$footer
+  ";
+  printtimedif($startingtime);
+
+
+
+
+
+	function faqformat($a, $title, $content) {
+		global $tblstart, $tccellh, $tccell1l, $tblend, $topiclist;
+	
+		$topiclist	.= "\n\t\t<li><a href='#$a'>$title</a></li>";
+
+		return "<br><br><a name='$a'></a>
+		$tblstart
+			<tr>$tccellh><div style='float: right;'>[<a href='#top'>^</a>]</div><b>$title</b></td></tr>
+			<tr>$tccell1l style='padding: 4px;'>$content	
+			</td></tr>
+		$tblend
+		";
+	}
+
+
+?>
\ No newline at end of file
diff --git a/favicon-star.ico b/favicon-star.ico
new file mode 100644
index 0000000..8ac7c01
Binary files /dev/null and b/favicon-star.ico differ
diff --git a/favicon.gif b/favicon.gif
new file mode 100644
index 0000000..e69de29
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 0000000..ac63051
Binary files /dev/null and b/favicon.ico differ
diff --git a/favicon.php b/favicon.php
new file mode 100644
index 0000000..7fd986f
--- /dev/null
+++ b/favicon.php
@@ -0,0 +1,3 @@
+<?php
+	header("Location: favicon". rand(1,8) .".ico");
+	return;
diff --git a/favicon1.ico b/favicon1.ico
new file mode 100644
index 0000000..795573a
Binary files /dev/null and b/favicon1.ico differ
diff --git a/favicon1x.ico b/favicon1x.ico
new file mode 100644
index 0000000..d0fc3a9
Binary files /dev/null and b/favicon1x.ico differ
diff --git a/favicon2.ico b/favicon2.ico
new file mode 100644
index 0000000..54a3d0b
Binary files /dev/null and b/favicon2.ico differ
diff --git a/favicon2x.ico b/favicon2x.ico
new file mode 100644
index 0000000..dee5d41
Binary files /dev/null and b/favicon2x.ico differ
diff --git a/favicon3.ico b/favicon3.ico
new file mode 100644
index 0000000..f0ca9e9
Binary files /dev/null and b/favicon3.ico differ
diff --git a/favicon3x.ico b/favicon3x.ico
new file mode 100644
index 0000000..6cf6a8b
Binary files /dev/null and b/favicon3x.ico differ
diff --git a/favicon4.ico b/favicon4.ico
new file mode 100644
index 0000000..6323c94
Binary files /dev/null and b/favicon4.ico differ
diff --git a/favicon4x.ico b/favicon4x.ico
new file mode 100644
index 0000000..4cf7a5f
Binary files /dev/null and b/favicon4x.ico differ
diff --git a/favicon5.ico b/favicon5.ico
new file mode 100644
index 0000000..b06327f
Binary files /dev/null and b/favicon5.ico differ
diff --git a/favicon5x.ico b/favicon5x.ico
new file mode 100644
index 0000000..3266f92
Binary files /dev/null and b/favicon5x.ico differ
diff --git a/favicon6.ico b/favicon6.ico
new file mode 100644
index 0000000..f783392
Binary files /dev/null and b/favicon6.ico differ
diff --git a/favicon6x.ico b/favicon6x.ico
new file mode 100644
index 0000000..7b5224c
Binary files /dev/null and b/favicon6x.ico differ
diff --git a/favicon7.ico b/favicon7.ico
new file mode 100644
index 0000000..7f5bd21
Binary files /dev/null and b/favicon7.ico differ
diff --git a/favicon7x.ico b/favicon7x.ico
new file mode 100644
index 0000000..1d6ba1a
Binary files /dev/null and b/favicon7x.ico differ
diff --git a/favicon8.ico b/favicon8.ico
new file mode 100644
index 0000000..cbf18ae
Binary files /dev/null and b/favicon8.ico differ
diff --git a/favicon8x.ico b/favicon8x.ico
new file mode 100644
index 0000000..48a4e14
Binary files /dev/null and b/favicon8x.ico differ
diff --git a/forum.php b/forum.php
new file mode 100644
index 0000000..c8cc783
--- /dev/null
+++ b/forum.php
@@ -0,0 +1,362 @@
+<?php
+	require_once 'lib/function.php';
+	$id = intval($_GET['id']);
+	$user = intval($_GET['user']);
+
+	if ($log)
+		$postread = $sql->getresultsbykey("SELECT forum,readdate FROM forumread WHERE user=$loguserid", 'forum', 'readdate');
+
+	$forumlist="";
+	$fonline="";
+
+	// Add/remove favorites
+	if ($act == 'add' || $act == 'rem') {
+		$meta['noindex'] = true; // prevent search engines from indexing
+		$t = $sql->fetchq("SELECT title,forum FROM threads WHERE id=$thread");
+
+		if (!$log) {
+			require_once 'lib/layout.php';
+			errorpage("You need to be logged in to edit your favorites!",'return to the forum',"forum.php?id=$t[forum]");
+		}
+
+		$sql->query("DELETE FROM favorites WHERE user=$loguserid AND thread=$thread");
+		if ($act == 'add') {
+			$tx = "\"$t[title]\" has been added to your favorites.";
+
+			$minpower = $sql->resultq("SELECT minpower FROM forums WHERE id=$t[forum]");
+			if($minpower < 1 || $minpower <= $power)
+				$sql->query("INSERT INTO favorites (user,thread) VALUES ($loguserid,$thread)");
+			else
+				$tx = "You can't favorite a thread you don't have access to!";
+		}
+		else
+			$tx = "\"$t[title]\" has been removed from your favorites.";
+
+		require_once 'lib/layout.php';
+		errorpage($tx,'return to the forum',"forum.php?id=$t[forum]");
+	}
+
+	// Forum Setup
+	if ($fav) {
+		if (!$log) {
+			$meta['noindex'] = true; // prevent search engines from indexing what they can't access
+			require_once 'lib/layout.php';
+			errorpage("You need to be logged in to view your favorites.",'log in (then try again)','login.php');
+		}
+
+		$forum['title'] = 'Favorites';
+		if ($user && $user != $loguserid && $isadmin)
+			$forum['title'] .= ' of '.$sql->resultq("SELECT name FROM users WHERE id={$user}");
+		else
+			$user = $loguserid;
+
+		$threadcount = $sql->resultq("SELECT COUNT(*) FROM favorites where user={$user}");
+	}
+	elseif ($user) {
+		$user1=$sql->fetchq("SELECT name,sex,powerlevel,aka,birthday FROM users WHERE id={$user}");
+		if (!$user1) {
+			$meta['noindex'] = true; // prevent search engines from indexing what they can't access
+			require_once 'lib/layout.php';
+			errorpage("No user with that ID exists.",'the index page','index.php');
+		}
+
+		$forum['title']="Threads by $user1[name]";
+		$threadcount = $sql->resultq("SELECT COUNT(*) FROM threads where user=$user");
+	}
+	elseif ($id) { # Default case, show forum with id
+		$id	= intval($id);
+		$forum = $sql->fetchq("SELECT title,minpower,numthreads,specialscheme,pollstyle FROM forums WHERE id=$id");
+
+		if (!$forum) {
+			trigger_error("Attempted to access invalid forum $id", E_USER_NOTICE);
+			$meta['noindex'] = true; // prevent search engines from indexing what they can't access
+			require_once 'lib/layout.php';
+			notAuthorizedError();
+		}
+		elseif ($forum['minpower'] > max(0,$power)) {
+			if ($log)
+				trigger_error("Attempted to access level-$forum[minpower] restricted forum $id (user's powerlevel: ".intval($loguser['powerlevel']).")", E_USER_NOTICE);
+			$meta['noindex'] = true; // prevent search engines from indexing what they can't access
+			require_once 'lib/layout.php';
+			notAuthorizedError();
+		}
+		else
+			$specialscheme=$forum['specialscheme'];
+
+		global $fourmid;
+		$forumid=$id;
+
+		$threadcount = $forum['numthreads'];
+	}
+	else {
+		$meta['noindex'] = true; // prevent search engines from indexing what they can't access
+		require_once 'lib/layout.php';
+		errorpage("No forum specified.",'the index page',"index.php");
+	}
+
+
+	$windowtitle = "$boardname -- $forum[title]";
+	require 'lib/layout.php';
+
+	$hotcount = $sql->resultq('SELECT hotcount FROM misc',0,0);
+	if ($hotcount <= 0) $hotcount = 0xFFFF;
+
+	$ppp = (($_GET['ppp']) ? intval($_GET['ppp']) : (($log) ? $loguser['postsperpage'] : 20));
+	$ppp = max(min($ppp, 500), 1);
+
+	$tpp = (($_GET['tpp']) ? intval($_GET['tpp']) : (($log) ? $loguser['threadsperpage'] : 50));
+	$tpp = max(min($tpp, 500), 1);
+
+	$page = intval($_GET['page']);
+    $min = $page*$tpp;
+
+	$newthreadbar = $forumlist = '';
+	if ($id) {
+		$forumlist = doforumlist($id);
+		$fonline = fonlineusers($id);
+
+		if($log) {
+			$headlinks.=" - <a href=index.php?action=markforumread&forumid=$id>Mark forum read</a>";
+			$header = makeheader($header1,$headlinks,$header2 .(($fonline) ? "$tblstart$tccell1s>$fonline$tblend" : ""));
+		}
+
+		$newthreadbar =
+			"<td align=right class=fonts>".
+			(($forum['pollstyle'] != -2) ? "<a href=newthread.php?poll=1&id=$id>$newpollpic</a>" : "<img src=\"images/nopolls.png\" align=\"absmiddle\">")
+			." - <a href=newthread.php?id=$id>$newthreadpic</a></td>";
+	}
+	$infotable =
+		"<table width=100%><tr>
+			<td align=left class='font'><a href=index.php>$boardname</a> - $forum[title]</td>
+			$newthreadbar
+		</tr></table>";
+
+	$forumpagelinks = '';
+	if($threadcount > $tpp){
+		$query = ($id ? "id=$id" : ($user ? "user=$user" : "fav=1"));
+		if ($_GET['tpp']) $query .= "&tpp=$tpp";
+
+		$forumpagelinks = "<table width=100%><tr>
+			<td align=left class='fonts'>Pages:";
+		for($k=0;$k<($threadcount/$tpp);$k++)
+			$forumpagelinks .= ($k!=$page ? " <a href='?$query&page=$k'>".($k+1).'</a>':' '.($k+1));
+		$forumpagelinks .= "</td></tr></table>";
+    }
+
+	$threadlist = "{$tblstart}";
+
+	// Announcements
+	if ($id) {
+		if($annc = $sql->fetchq('SELECT announcements.id,user,date,announcements.title,name,sex,powerlevel FROM announcements,users WHERE forum=0 AND user=users.id ORDER BY date DESC LIMIT 1')) {
+			$userlink = getuserlink($annc);
+			$threadlist .= "<tr>
+				<td colspan=7 class='tbl tdbgh center fonts'>Announcements</td>
+			</tr><tr>
+				$tccell2>". ($loguser['lastannouncement'] < $annc['id'] && $loguser['id'] ? $newpic : "&nbsp;") ."</td>
+				$tccell1l colspan=6><a href=announcement.php>$annc[title]</a> -- Posted by {$userlink} on ".date($dateformat,$annc[date]+$tzoff)."</td>
+			</tr>";
+		}
+		if($annc = $sql->fetchq("SELECT user,date,announcements.title,name,sex,powerlevel FROM announcements,users WHERE forum=$id AND user=users.id ORDER BY date DESC LIMIT 1")) {
+			$userlink = getuserlink($annc);
+			$threadlist .= "<tr>
+				$tccellhs colspan=7>Forum announcements</td>
+			</tr><tr>
+				$tccell2>&nbsp;</td>
+				$tccell1l colspan=6><a href=announcement.php?f=$id>$annc[title]</a> -- Posted by {$userlink} on ".date($dateformat,$annc[date]+$tzoff)."</td>
+			</tr>";
+		}
+    }
+    // Forum names
+    else
+		$forumnames = $sql->getresultsbykey("SELECT id,title FROM forums WHERE minpower <= ".intval($loguser['powerlevel']), 'id', 'title');
+
+	// Get threads
+	if($fav)
+		$threads = $sql->query("SELECT t.*, minpower,f.id as forumid, "
+			."u1.name AS name1, u1.sex AS sex1, u1.powerlevel AS pwr1, u1.aka as aka1, u1.birthday as bd1,"
+			."u2.name AS name2, u2.sex AS sex2, u2.powerlevel AS pwr2, u2.aka as aka2, u2.birthday as bd2 "
+			.($log ? ", r.read AS tread, r.time as treadtime " : " ")
+			."FROM threads t "
+			.($log ? "LEFT JOIN threadsread r ON (t.id=r.tid AND r.uid=$loguserid) " : "")
+			.",users u1,users u2,forums f,favorites fav "
+			."WHERE u1.id=t.user "
+			."AND u2.id=t.lastposter "
+			."AND fav.thread=t.id "
+			."AND fav.user={$user} "
+			."AND f.id=t.forum "
+			."ORDER BY sticky DESC,lastpostdate DESC "
+			."LIMIT $min,$tpp");
+	elseif($user)
+		$threads = $sql->query("SELECT t.*, minpower, f.id as forumid, "
+			."'".addslashes($user1['name'])."' AS name1, {$user1['sex']} AS sex1, {$user1['powerlevel']} AS pwr1, '"
+			.addslashes($user1['aka'])."' as aka1, {$user1['birthday']} as bd1, "
+			."name AS name2, sex AS sex2, powerlevel AS pwr2, aka as aka2, birthday as bd2"
+			.($log ? ", r.read AS tread, r.time as treadtime " : " ")
+			."FROM threads t "
+			.($log ? "LEFT JOIN threadsread r ON (t.id=r.tid AND r.uid=$loguserid) " : "")
+			.",users u,forums f "
+			."WHERE t.user=$user "
+			."AND u.id=t.lastposter "
+			."AND f.id=t.forum "
+			."ORDER BY sticky DESC,lastpostdate DESC "
+			."LIMIT $min,$tpp");
+	else
+		$threads = $sql->query("SELECT t.*,"
+			."u1.name AS name1, u1.sex AS sex1, u1.powerlevel AS pwr1, u1.aka as aka1, u1.birthday as bd1," 
+			."u2.name AS name2, u2.sex AS sex2, u2.powerlevel AS pwr2, u2.aka as aka2, u2.birthday as bd2 "
+			.($log ? ", r.read AS tread, r.time as treadtime " : " ")
+			."FROM threads t "
+			.($log ? "LEFT JOIN threadsread r ON (t.id=r.tid AND r.uid=$loguserid) " : "")
+			.",users u1,users u2 "
+			."WHERE forum=$id "
+			."AND u1.id=t.user "
+			."AND u2.id=t.lastposter "
+			."ORDER BY sticky DESC,lastpostdate DESC "
+			."LIMIT $min,$tpp");
+
+    $threadlist .= "<tr>
+		$tccellh width=30></td>
+		$tccellh colspan=2 width=*> Thread</td>
+		$tccellh width=14%>Started by</td>
+		$tccellh width=60> Replies</td>
+		$tccellh width=60> Views</td>
+		$tccellh width=150> Last post</td>
+	</tr>";
+
+	$sticklast = 0;
+
+	if (mysql_num_rows($threads) <= 0) {
+		$threadlist .= "<tr>
+			$tccell1 style='font-style:italic;' colspan=7>There are no threads to display.</td>
+		</td></tr>";
+	}
+	else for($i=1; $thread=@$sql->fetch($threads, MYSQL_ASSOC); ++$i) {
+		if($sticklast && !$thread['sticky'])
+			$threadlist .= "<tr>$tccellh colspan=7><img src='images/_.gif' height=6 width=6>";
+		$sticklast = $thread['sticky'];
+
+		if(!$id && $thread['minpower'] > max(0,$power)) {
+			$threadlist .= "<tr>$tccell2s colspan=7>(restricted)</td></tr>";
+			continue;
+		}
+
+		// Disabled polls
+		if ($forum['pollstyle'] == -2)
+			$thread['poll'] = 0;
+
+		$new          = "&nbsp;";
+		$newpost      = false;
+		$threadstatus	= "";
+
+		// Forum, logged in
+		if ($log && $id && $thread['lastpostdate']>$postread[$id] && !$thread['tread']) {
+			$threadstatus	.= "new";
+			$newpost		= true;
+			$newpostt		= ($thread['treadtime'] ? $thread['treadtime'] : $postread[$id]);
+		}
+		// User's thread list / Favorites, logged in
+		elseif ($log && !$id && $thread['lastpostdate']>$postread[$thread['forumid']] && !$thread['tread']) {
+			$threadstatus	.= "new";
+			$newpost		= true;
+			$newpostt		= ($thread['treadtime'] ? $thread['treadtime'] : $postread[$thread['forumid']]);
+		}
+		// Not logged in
+		elseif (!$log && $thread['lastpostdate']>ctime()-3600) {
+			$threadstatus	.= "new";
+			$newpost		= true;
+			$newpostt		= ctime() - 3600;
+		}
+
+		if ($thread['replies'] >= $hotcount) $threadstatus .= "hot";
+		if ($thread['closed'])	$threadstatus .= "off";
+		if ($threadstatus) $new	= $statusicons[$threadstatus];
+
+		$posticon="<img src='$thread[icon]'>";
+
+		if (trim($thread['title']) == "")
+			$thread['title']	= "<i>hurr durr i'm an idiot who made a blank thread</i>";
+		else
+			$thread['title'] = str_replace(array('<', '>'), array('&lt;', '&gt;'), trim($thread['title']));
+
+		$threadtitle	= "<a href='thread.php?id=$thread[id]'>$thread[title]</a>";
+		$belowtitle   = array(); // An extra line below the title in certain circumstances
+
+		$sicon			= "";
+		if ($thread['sticky'])	{
+			$threadtitle	= "<i>". $threadtitle ."</i>";
+			$sicon	.= "sticky";
+		}
+		if ($thread['poll'])	$sicon	.= "poll";
+		if ($sicon)
+			$threadtitle	= $statusicons[$sicon] ." ". $threadtitle;
+
+		// Show forum name if not in a forum
+		if (!$id)
+			$belowtitle[] = "In <a href='forum.php?id=$thread[forumid]'>".$forumnames[$thread['forumid']]."</a>";
+
+		// Extra pages
+		if($thread['replies']>=$ppp) {
+			$pagelinks='';
+
+			$maxfromstart = (($loguser['pagestyle']) ?  9 :  4);
+			$maxfromend   = (($loguser['pagestyle']) ? 20 : 10);
+
+			$totalpages	= ceil(($thread['replies']+1)/$ppp);
+			for($k=0; $k < $totalpages; $k++) {
+				if ($totalpages >= ($maxfromstart+$maxfromend+1) && $k > $maxfromstart && $k < ($totalpages - $maxfromend)) {
+				  $k = ($totalpages - $maxfromend);
+					$pagelinks .= " ...";
+				}
+				$pagelinks.=" <a href='thread.php?id=$thread[id]&page=$k'>".($k+1).'</a>';
+			}
+
+			if ($loguser['pagestyle'])
+				$belowtitle[] = "Page:{$pagelinks}";
+			else
+				$threadtitle .= " {$smallfont}(Pages:{$pagelinks})</span>";
+		}
+
+		if (!empty($belowtitle))
+			$secondline = '<br><span class="fonts" style="position: relative; top: -1px;">&nbsp;&nbsp;&nbsp;' . implode(' - ', $belowtitle) . '</span>';
+		else
+			$secondline = '';
+
+		if(!$thread['icon']) $posticon='&nbsp;';
+		$userlink1 = getuserlink($thread,
+			array('sex'=>'sex1', 'powerlevel'=>'pwr1', 'id'=>'user',       'aka'=>'aka1', 'name'=>'name1', 'birthday'=>'bd1'));
+		$userlink2 = getuserlink($thread,
+			array('sex'=>'sex2', 'powerlevel'=>'pwr2', 'id'=>'lastposter', 'aka'=>'aka2', 'name'=>'name2', 'birthday'=>'bd2'));
+		
+		$threadlist .= "<tr>
+			$tccell1>$new</td>
+			$tccell2 width=40px><div style=\"max-width:60px;max-height:30px;overflow:hidden;\">$posticon</div></td>
+			$tccell2l>". ($newpost ? "<a href='thread.php?id=$thread[id]&lpt=". $newpostt ."'>". $statusicons['getnew'] ."</a> " : "") ."$threadtitle$secondline</td>
+			$tccell2>{$userlink1}</td>
+			$tccell1>$thread[replies]</td>
+			$tccell1>$thread[views]</td>
+			$tccell2><div class='lastpost'>".date($dateformat,$thread['lastpostdate']+$tzoff)."<br>
+				by {$userlink2}
+				<a href='thread.php?id=$thread[id]&end=1'>$statusicons[getlast]</a>
+			</div></td></tr>";
+	}
+	$threadlist .= "{$tblend}";
+
+	print "
+		{$header}
+		{$infotable}
+		{$forumpagelinks}
+		{$threadlist}
+		{$forumpagelinks}
+		{$infotable}
+		{$forumlist}
+		{$footer}
+	";
+	printtimedif($startingtime);
+
+function notAuthorizedError() {
+	global $log;
+	$rreason = (($log) ? 'don\'t have access to it' : 'are not logged in');
+	$redir = (($log) ? 'index.php' : 'login.php');
+	$rtext = (($log) ? 'the index page' : 'log in (then try again)');
+	errorpage("Couldn't enter this restricted forum, as you {$rreason}.", $rtext, $redir);
+}
\ No newline at end of file
diff --git a/hex.php b/hex.php
new file mode 100644
index 0000000..94d60c6
--- /dev/null
+++ b/hex.php
@@ -0,0 +1,43 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/layout.php';
+
+	print "$body
+		<title>Hexadecimal color chart</title>
+		$css
+		<script language=javascript>
+		function hex(val){
+			colortext	= document.getElementById('hexval');
+			colorbox	= document.getElementById('colordisp');
+			reg			= /^([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/;
+
+			if (val.match(reg)) {
+				colorbox.style.background	= '#' + val;
+			}
+			colortext.value				= val;
+		}
+		</script>
+		<form name=hexchart>
+		<map name=colmap>";
+
+	for($g=0;$g<6;$g++)
+		for($r=0;$r<6;$r++)
+			for($b=0;$b<6;$b++) {
+				$x1=$b*8+$r*48+1;
+				$y1=$g*11+1;
+				$x2=$x1+8;
+				$y2=$y1+11;
+				$c=substr(dechex(16777216+$r*51*65536+(5-$g)*51*256+$b*51),-6);
+				print "<area shape=rect coords=$x1,$y1,$x2,$y2 href=javascript:hex('$c')>";
+			}
+
+	print "</map>
+		<table height=100% valign=middle align='center'><td>
+		$tblstart
+		$tccell1>
+		<a><img usemap=#colmap src=images/hexchart.png border=0 width=289 height=67></a><br>
+		Click a color to get its HTML color value.<br>
+		<span style='border: 1px solid #fff;' id='colordisp'><img src='images/_.gif' height=20 width=60'></span> - #$inpt=hexval size=6 value='000000' id='hexval' onkeyup='hex(value)' maxlength=6>
+		$tblend
+		</form>
+		$tblend";
\ No newline at end of file
diff --git a/idiotredir.php b/idiotredir.php
new file mode 100644
index 0000000..dac3ee9
--- /dev/null
+++ b/idiotredir.php
@@ -0,0 +1,28 @@
+<?php
+
+	if (!$_POST['go']) {
+
+		?>
+<html>
+	<title> uh oh </title>
+	<body style="background: #000 url('images/bombbg.png'); color: #f00;">
+		<font style="font-family: Verdana, sans-serif;">
+		<center>
+		<br><font style="color: #f88; size: 175%;"><big><b>This site has been blocked for <i>your protection</i>.</b></big></font>
+		<br>
+		<br><font style="color: #f55;">http://insectduel.proboards82.com/ - Reason: <b>fucking stupid</b></font>
+		<br>
+		<br>If you are sure you want to visit this site (e.g., for humor), please click the button.
+		<br>
+		<br><form style="margin: 0; padding: 0;" action="idiotredir.php" method="post"><input type="submit" name="go" value="I'm sure" style="border: 1px solid #c99; background: #833; color: #fdd; font-weight: bold; font-family: Verdana, sans-serif; padding: 5px;"><input type="hidden" value="<?php print $_SERVER['QUERY_STRING']; ?>" name="url"></form>
+	</body>
+</html>
+	<?php
+
+	} else {
+
+		header("Location: http://insectduel.proboards82.com". $_POST['url']);
+
+	}
+
+?>
\ No newline at end of file
diff --git a/images/.htaccess b/images/.htaccess
new file mode 100644
index 0000000..d66cf89
--- /dev/null
+++ b/images/.htaccess
@@ -0,0 +1,11 @@
+RewriteEngine on
+
+RewriteCond %{HTTP_REFERER} twilightro\.kafuka\.org [NC]
+
+# RewriteCond %{HTTP_REFERER} twilightro\.kafuka\.org [NC,OR]
+# RewriteCond %{HTTP_REFERER} anotherbadsite\.com
+#RewriteCond %{HTTP_REFERER} inanecultgamer\.cwahi\.net [NC]
+# RewriteRule .* /images/trolldra.png
+RewriteRule .* http://jul.rustedlogic.net/images/everybody_loves_dog.jpg
+
+# RewriteRule .* http://xkeeper.net/hotlinkingshithead.png
diff --git a/images/1up.png b/images/1up.png
new file mode 100644
index 0000000..73b419a
Binary files /dev/null and b/images/1up.png differ
diff --git a/images/4funin1.png b/images/4funin1.png
new file mode 100644
index 0000000..7286114
Binary files /dev/null and b/images/4funin1.png differ
diff --git a/images/_.gif b/images/_.gif
new file mode 100644
index 0000000..da95575
Binary files /dev/null and b/images/_.gif differ
diff --git a/images/accentstovensuck.png b/images/accentstovensuck.png
new file mode 100644
index 0000000..4e362de
Binary files /dev/null and b/images/accentstovensuck.png differ
diff --git a/images/acmelfiabg1b.jpg b/images/acmelfiabg1b.jpg
new file mode 100644
index 0000000..995486c
Binary files /dev/null and b/images/acmelfiabg1b.jpg differ
diff --git a/images/acmelfiabg2.jpg b/images/acmelfiabg2.jpg
new file mode 100644
index 0000000..e7176cc
Binary files /dev/null and b/images/acmelfiabg2.jpg differ
diff --git a/images/acmelfiabgxmas1.jpg b/images/acmelfiabgxmas1.jpg
new file mode 100644
index 0000000..26038ab
Binary files /dev/null and b/images/acmelfiabgxmas1.jpg differ
diff --git a/images/admincrap.png b/images/admincrap.png
new file mode 100644
index 0000000..1bdf64a
Binary files /dev/null and b/images/admincrap.png differ
diff --git a/images/adventureofvalkyrie.png b/images/adventureofvalkyrie.png
new file mode 100644
index 0000000..8dbaa37
Binary files /dev/null and b/images/adventureofvalkyrie.png differ
diff --git a/images/angsa.ttf b/images/angsa.ttf
new file mode 100644
index 0000000..8050b99
Binary files /dev/null and b/images/angsa.ttf differ
diff --git a/images/ann-rotohead.gif b/images/ann-rotohead.gif
new file mode 100644
index 0000000..0bfbf45
Binary files /dev/null and b/images/ann-rotohead.gif differ
diff --git a/images/apple_kid.ttf b/images/apple_kid.ttf
new file mode 100644
index 0000000..3495f79
Binary files /dev/null and b/images/apple_kid.ttf differ
diff --git a/images/approvedl.png b/images/approvedl.png
new file mode 100644
index 0000000..3b74fe6
Binary files /dev/null and b/images/approvedl.png differ
diff --git a/images/atlantisnobanner.png b/images/atlantisnobanner.png
new file mode 100644
index 0000000..968da6d
Binary files /dev/null and b/images/atlantisnobanner.png differ
diff --git a/images/atlantisnobanner2.png b/images/atlantisnobanner2.png
new file mode 100644
index 0000000..bb4b112
Binary files /dev/null and b/images/atlantisnobanner2.png differ
diff --git a/images/attitudebarn.png b/images/attitudebarn.png
new file mode 100644
index 0000000..1338edb
Binary files /dev/null and b/images/attitudebarn.png differ
diff --git a/images/back06.gif b/images/back06.gif
new file mode 100644
index 0000000..ffe6f40
Binary files /dev/null and b/images/back06.gif differ
diff --git a/images/back07.gif b/images/back07.gif
new file mode 100644
index 0000000..4bd978e
Binary files /dev/null and b/images/back07.gif differ
diff --git a/images/back08.gif b/images/back08.gif
new file mode 100644
index 0000000..070aeed
Binary files /dev/null and b/images/back08.gif differ
diff --git a/images/back09.gif b/images/back09.gif
new file mode 100644
index 0000000..d30d1db
Binary files /dev/null and b/images/back09.gif differ
diff --git a/images/back10.gif b/images/back10.gif
new file mode 100644
index 0000000..9a5c570
Binary files /dev/null and b/images/back10.gif differ
diff --git a/images/badavatar.png b/images/badavatar.png
new file mode 100644
index 0000000..15ca901
Binary files /dev/null and b/images/badavatar.png differ
diff --git a/images/banner01.gif b/images/banner01.gif
new file mode 100644
index 0000000..5551056
Binary files /dev/null and b/images/banner01.gif differ
diff --git a/images/banner02.gif b/images/banner02.gif
new file mode 100644
index 0000000..48a7ff2
Binary files /dev/null and b/images/banner02.gif differ
diff --git a/images/banner03.gif b/images/banner03.gif
new file mode 100644
index 0000000..fb584bd
Binary files /dev/null and b/images/banner03.gif differ
diff --git a/images/banner04.gif b/images/banner04.gif
new file mode 100644
index 0000000..6093e6c
Binary files /dev/null and b/images/banner04.gif differ
diff --git a/images/banner05.gif b/images/banner05.gif
new file mode 100644
index 0000000..7ddeb55
Binary files /dev/null and b/images/banner05.gif differ
diff --git a/images/banner06.gif b/images/banner06.gif
new file mode 100644
index 0000000..911ba22
Binary files /dev/null and b/images/banner06.gif differ
diff --git a/images/banner07.gif b/images/banner07.gif
new file mode 100644
index 0000000..af03bef
Binary files /dev/null and b/images/banner07.gif differ
diff --git a/images/banner08.gif b/images/banner08.gif
new file mode 100644
index 0000000..ff76e3f
Binary files /dev/null and b/images/banner08.gif differ
diff --git a/images/banvil.gif b/images/banvil.gif
new file mode 100644
index 0000000..c7b64bf
Binary files /dev/null and b/images/banvil.gif differ
diff --git a/images/bar-green.png b/images/bar-green.png
new file mode 100644
index 0000000..f653415
Binary files /dev/null and b/images/bar-green.png differ
diff --git a/images/bar-off.png b/images/bar-off.png
new file mode 100644
index 0000000..ece3f82
Binary files /dev/null and b/images/bar-off.png differ
diff --git a/images/bar-red.png b/images/bar-red.png
new file mode 100644
index 0000000..aeb4552
Binary files /dev/null and b/images/bar-red.png differ
diff --git a/images/blackholetitle.png b/images/blackholetitle.png
new file mode 100644
index 0000000..3c06e9a
Binary files /dev/null and b/images/blackholetitle.png differ
diff --git a/images/blinker.gif b/images/blinker.gif
new file mode 100644
index 0000000..b5ebf64
Binary files /dev/null and b/images/blinker.gif differ
diff --git a/images/bmfbanner1.gif b/images/bmfbanner1.gif
new file mode 100644
index 0000000..7f211b4
Binary files /dev/null and b/images/bmfbanner1.gif differ
diff --git a/images/bmfbanneredit.png b/images/bmfbanneredit.png
new file mode 100644
index 0000000..67d6ce3
Binary files /dev/null and b/images/bmfbanneredit.png differ
diff --git a/images/bmfbanneredit2.png b/images/bmfbanneredit2.png
new file mode 100644
index 0000000..9d2e4fd
Binary files /dev/null and b/images/bmfbanneredit2.png differ
diff --git a/images/bmfbanneredit3.png b/images/bmfbanneredit3.png
new file mode 100644
index 0000000..b6deacd
Binary files /dev/null and b/images/bmfbanneredit3.png differ
diff --git a/images/bomb/index.html b/images/bomb/index.html
new file mode 100644
index 0000000..e1aa278
--- /dev/null
+++ b/images/bomb/index.html
@@ -0,0 +1,39 @@
+<html>
+<head>
+<title>rusted logic</title>
+</head>
+<body bgcolor=#000020>
+<center>
+<table cellpadding=0 cellspacing=0>
+<tr>
+<td colspan=3><img src="http://jul.rustedlogic.net/images/bomb/thebigone1x.gif"></td>
+</tr>
+<tr>
+<td colspan=3><img src="http://jul.rustedlogic.net/images/bomb/thebigone2.gif"></td>
+</tr>
+<tr>
+<td><img src="http://jul.rustedlogic.net/images/bomb/thebigone3.gif"></td><td><img src="http://jul.rustedlogic.net/images/garbg/garbg.png" width=233 height=36</td><td><img src="http://jul.rustedlogic.net/images/bomb/thebigone4.gif"></td>
+</tr>
+<tr>
+<td colspan=3><img src="http://jul.rustedlogic.net/images/bomb/thebigone5x.gif"></td>
+</tr>
+</table>
+<br>
+<br>
+<table cellpadding=0 cellspacing=0>
+<tr>
+<td colspan=3><img src="http://jul.rustedlogic.net/images/bomb/thebigone1.gif"></td>
+</tr>
+<tr>
+<td colspan=3><img src="http://jul.rustedlogic.net/images/bomb/thebigone2.gif"></td>
+</tr>
+<tr>
+<td><img src="http://jul.rustedlogic.net/images/bomb/thebigone3.gif"></td><td><img src="http://jul.rustedlogic.net/images/garbg/garbg.png" width=233 height=36</td><td><img src="http://jul.rustedlogic.net/images/bomb/thebigone4.gif"></td>
+</tr>
+<tr>
+<td colspan=3><img src="http://jul.rustedlogic.net/images/bomb/thebigone5.gif"></td>
+</tr>
+</table>
+</center>
+</body>
+</html>
diff --git a/images/bomb/thebigone1.gif b/images/bomb/thebigone1.gif
new file mode 100644
index 0000000..0a27bc3
Binary files /dev/null and b/images/bomb/thebigone1.gif differ
diff --git a/images/bomb/thebigone1x.gif b/images/bomb/thebigone1x.gif
new file mode 100644
index 0000000..855a4e7
Binary files /dev/null and b/images/bomb/thebigone1x.gif differ
diff --git a/images/bomb/thebigone2.gif b/images/bomb/thebigone2.gif
new file mode 100644
index 0000000..f9b7750
Binary files /dev/null and b/images/bomb/thebigone2.gif differ
diff --git a/images/bomb/thebigone3.gif b/images/bomb/thebigone3.gif
new file mode 100644
index 0000000..ea99de3
Binary files /dev/null and b/images/bomb/thebigone3.gif differ
diff --git a/images/bomb/thebigone4.gif b/images/bomb/thebigone4.gif
new file mode 100644
index 0000000..0f0ee49
Binary files /dev/null and b/images/bomb/thebigone4.gif differ
diff --git a/images/bomb/thebigone5.gif b/images/bomb/thebigone5.gif
new file mode 100644
index 0000000..214771a
Binary files /dev/null and b/images/bomb/thebigone5.gif differ
diff --git a/images/bomb/thebigone5x.gif b/images/bomb/thebigone5x.gif
new file mode 100644
index 0000000..89e0425
Binary files /dev/null and b/images/bomb/thebigone5x.gif differ
diff --git a/images/bombbg.png b/images/bombbg.png
new file mode 100644
index 0000000..47b1891
Binary files /dev/null and b/images/bombbg.png differ
diff --git a/images/byebyemysql.png b/images/byebyemysql.png
new file mode 100644
index 0000000..19cff55
Binary files /dev/null and b/images/byebyemysql.png differ
diff --git a/images/byebyemysql2.png b/images/byebyemysql2.png
new file mode 100644
index 0000000..0082f66
Binary files /dev/null and b/images/byebyemysql2.png differ
diff --git a/images/cardgames.png b/images/cardgames.png
new file mode 100644
index 0000000..0beef17
Binary files /dev/null and b/images/cardgames.png differ
diff --git a/images/ccs/a-sakura.png b/images/ccs/a-sakura.png
new file mode 100644
index 0000000..c452338
Binary files /dev/null and b/images/ccs/a-sakura.png differ
diff --git a/images/ccs/a-syaoran.png b/images/ccs/a-syaoran.png
new file mode 100644
index 0000000..8df2246
Binary files /dev/null and b/images/ccs/a-syaoran.png differ
diff --git a/images/ccs/banner.png b/images/ccs/banner.png
new file mode 100644
index 0000000..ec575e7
Binary files /dev/null and b/images/ccs/banner.png differ
diff --git a/images/ccs/bar-off.gif b/images/ccs/bar-off.gif
new file mode 100644
index 0000000..037f09b
Binary files /dev/null and b/images/ccs/bar-off.gif differ
diff --git a/images/ccs/bar-on.gif b/images/ccs/bar-on.gif
new file mode 100644
index 0000000..0d6fe5c
Binary files /dev/null and b/images/ccs/bar-on.gif differ
diff --git a/images/ccs/barleft.gif b/images/ccs/barleft.gif
new file mode 100644
index 0000000..1ec3aa0
Binary files /dev/null and b/images/ccs/barleft.gif differ
diff --git a/images/ccs/barright.gif b/images/ccs/barright.gif
new file mode 100644
index 0000000..960b0cc
Binary files /dev/null and b/images/ccs/barright.gif differ
diff --git a/images/ccs/bg.png b/images/ccs/bg.png
new file mode 100644
index 0000000..077e882
Binary files /dev/null and b/images/ccs/bg.png differ
diff --git a/images/ccs/hot.png b/images/ccs/hot.png
new file mode 100644
index 0000000..c09a8b2
Binary files /dev/null and b/images/ccs/hot.png differ
diff --git a/images/ccs/hotoff.png b/images/ccs/hotoff.png
new file mode 100644
index 0000000..ab27853
Binary files /dev/null and b/images/ccs/hotoff.png differ
diff --git a/images/ccs/l-sakura.png b/images/ccs/l-sakura.png
new file mode 100644
index 0000000..156ea6c
Binary files /dev/null and b/images/ccs/l-sakura.png differ
diff --git a/images/ccs/l-syaoran.png b/images/ccs/l-syaoran.png
new file mode 100644
index 0000000..61dd453
Binary files /dev/null and b/images/ccs/l-syaoran.png differ
diff --git a/images/ccs/new.png b/images/ccs/new.png
new file mode 100644
index 0000000..b9f636d
Binary files /dev/null and b/images/ccs/new.png differ
diff --git a/images/ccs/newhot.png b/images/ccs/newhot.png
new file mode 100644
index 0000000..3eb53ce
Binary files /dev/null and b/images/ccs/newhot.png differ
diff --git a/images/ccs/newhotoff.png b/images/ccs/newhotoff.png
new file mode 100644
index 0000000..a476130
Binary files /dev/null and b/images/ccs/newhotoff.png differ
diff --git a/images/ccs/newoff.png b/images/ccs/newoff.png
new file mode 100644
index 0000000..fe7f744
Binary files /dev/null and b/images/ccs/newoff.png differ
diff --git a/images/ccs/newpoll.png b/images/ccs/newpoll.png
new file mode 100644
index 0000000..4d81824
Binary files /dev/null and b/images/ccs/newpoll.png differ
diff --git a/images/ccs/newreply.png b/images/ccs/newreply.png
new file mode 100644
index 0000000..631b63f
Binary files /dev/null and b/images/ccs/newreply.png differ
diff --git a/images/ccs/newthread.png b/images/ccs/newthread.png
new file mode 100644
index 0000000..9711ef7
Binary files /dev/null and b/images/ccs/newthread.png differ
diff --git a/images/ccs/off.png b/images/ccs/off.png
new file mode 100644
index 0000000..71c705f
Binary files /dev/null and b/images/ccs/off.png differ
diff --git a/images/ccs/threadclosed.png b/images/ccs/threadclosed.png
new file mode 100644
index 0000000..e000834
Binary files /dev/null and b/images/ccs/threadclosed.png differ
diff --git a/images/christmas-banner-blackroseII.png b/images/christmas-banner-blackroseII.png
new file mode 100644
index 0000000..985f0e7
Binary files /dev/null and b/images/christmas-banner-blackroseII.png differ
diff --git a/images/christmasbanner-cpubasic.png b/images/christmasbanner-cpubasic.png
new file mode 100644
index 0000000..37b3994
Binary files /dev/null and b/images/christmasbanner-cpubasic.png differ
diff --git a/images/christmasbanner-lain.png b/images/christmasbanner-lain.png
new file mode 100644
index 0000000..b4464e6
Binary files /dev/null and b/images/christmasbanner-lain.png differ
diff --git a/images/christmasbanner-snt.png b/images/christmasbanner-snt.png
new file mode 100644
index 0000000..b8699c6
Binary files /dev/null and b/images/christmasbanner-snt.png differ
diff --git a/images/christmasbanner.png b/images/christmasbanner.png
new file mode 100644
index 0000000..140443d
Binary files /dev/null and b/images/christmasbanner.png differ
diff --git a/images/coin.gif b/images/coin.gif
new file mode 100644
index 0000000..644e355
Binary files /dev/null and b/images/coin.gif differ
diff --git a/images/coin2.gif b/images/coin2.gif
new file mode 100644
index 0000000..f380f49
Binary files /dev/null and b/images/coin2.gif differ
diff --git a/images/comport/_.gif b/images/comport/_.gif
new file mode 100644
index 0000000..5a244ad
Binary files /dev/null and b/images/comport/_.gif differ
diff --git a/images/comport/bg.jpg b/images/comport/bg.jpg
new file mode 100644
index 0000000..c286f50
Binary files /dev/null and b/images/comport/bg.jpg differ
diff --git a/images/comport/coin.gif b/images/comport/coin.gif
new file mode 100644
index 0000000..644e355
Binary files /dev/null and b/images/comport/coin.gif differ
diff --git a/images/comport/forumtitle.gif b/images/comport/forumtitle.gif
new file mode 100644
index 0000000..999af49
Binary files /dev/null and b/images/comport/forumtitle.gif differ
diff --git a/images/comport/hexadecimalchart.png b/images/comport/hexadecimalchart.png
new file mode 100644
index 0000000..b9410b4
Binary files /dev/null and b/images/comport/hexadecimalchart.png differ
diff --git a/images/comport/hot.gif b/images/comport/hot.gif
new file mode 100644
index 0000000..2a1d1e2
Binary files /dev/null and b/images/comport/hot.gif differ
diff --git a/images/comport/hotnew.gif b/images/comport/hotnew.gif
new file mode 100644
index 0000000..206e2ca
Binary files /dev/null and b/images/comport/hotnew.gif differ
diff --git a/images/comport/hotoff.gif b/images/comport/hotoff.gif
new file mode 100644
index 0000000..dbc82a5
Binary files /dev/null and b/images/comport/hotoff.gif differ
diff --git a/images/comport/icon_admin.gif b/images/comport/icon_admin.gif
new file mode 100644
index 0000000..17c2798
Binary files /dev/null and b/images/comport/icon_admin.gif differ
diff --git a/images/comport/icon_fullmod.gif b/images/comport/icon_fullmod.gif
new file mode 100644
index 0000000..7c08e8c
Binary files /dev/null and b/images/comport/icon_fullmod.gif differ
diff --git a/images/comport/icon_localmod.gif b/images/comport/icon_localmod.gif
new file mode 100644
index 0000000..cf042ae
Binary files /dev/null and b/images/comport/icon_localmod.gif differ
diff --git a/images/comport/icon_terrorist.gif b/images/comport/icon_terrorist.gif
new file mode 100644
index 0000000..5882864
Binary files /dev/null and b/images/comport/icon_terrorist.gif differ
diff --git a/images/comport/new.gif b/images/comport/new.gif
new file mode 100644
index 0000000..c49a2a6
Binary files /dev/null and b/images/comport/new.gif differ
diff --git a/images/comport/newreply.png b/images/comport/newreply.png
new file mode 100644
index 0000000..e2c1d65
Binary files /dev/null and b/images/comport/newreply.png differ
diff --git a/images/comport/newthread.png b/images/comport/newthread.png
new file mode 100644
index 0000000..887d6af
Binary files /dev/null and b/images/comport/newthread.png differ
diff --git a/images/comport/off.gif b/images/comport/off.gif
new file mode 100644
index 0000000..67766d8
Binary files /dev/null and b/images/comport/off.gif differ
diff --git a/images/comport/poweredbyacmlm.gif b/images/comport/poweredbyacmlm.gif
new file mode 100644
index 0000000..071190a
Binary files /dev/null and b/images/comport/poweredbyacmlm.gif differ
diff --git a/images/comport/ranks/00t.gif b/images/comport/ranks/00t.gif
new file mode 100644
index 0000000..a806799
Binary files /dev/null and b/images/comport/ranks/00t.gif differ
diff --git a/images/comport/ranks/01b.gif b/images/comport/ranks/01b.gif
new file mode 100644
index 0000000..0cc974f
Binary files /dev/null and b/images/comport/ranks/01b.gif differ
diff --git a/images/comport/ranks/02d.gif b/images/comport/ranks/02d.gif
new file mode 100644
index 0000000..0eefb51
Binary files /dev/null and b/images/comport/ranks/02d.gif differ
diff --git a/images/comport/ranks/03p.gif b/images/comport/ranks/03p.gif
new file mode 100644
index 0000000..18949d8
Binary files /dev/null and b/images/comport/ranks/03p.gif differ
diff --git a/images/comport/ranks/04s.gif b/images/comport/ranks/04s.gif
new file mode 100644
index 0000000..37dc1b8
Binary files /dev/null and b/images/comport/ranks/04s.gif differ
diff --git a/images/comport/ranks/05s.gif b/images/comport/ranks/05s.gif
new file mode 100644
index 0000000..ab5e892
Binary files /dev/null and b/images/comport/ranks/05s.gif differ
diff --git a/images/comport/ranks/06u.gif b/images/comport/ranks/06u.gif
new file mode 100644
index 0000000..646111a
Binary files /dev/null and b/images/comport/ranks/06u.gif differ
diff --git a/images/comport/ranks/07r.gif b/images/comport/ranks/07r.gif
new file mode 100644
index 0000000..7889c6b
Binary files /dev/null and b/images/comport/ranks/07r.gif differ
diff --git a/images/comport/ranks/08b.gif b/images/comport/ranks/08b.gif
new file mode 100644
index 0000000..c6b2782
Binary files /dev/null and b/images/comport/ranks/08b.gif differ
diff --git a/images/comport/ranks/09c.gif b/images/comport/ranks/09c.gif
new file mode 100644
index 0000000..08d813b
Binary files /dev/null and b/images/comport/ranks/09c.gif differ
diff --git a/images/comport/ranks/10s.gif b/images/comport/ranks/10s.gif
new file mode 100644
index 0000000..8c72ac4
Binary files /dev/null and b/images/comport/ranks/10s.gif differ
diff --git a/images/comport/ranks/11o.gif b/images/comport/ranks/11o.gif
new file mode 100644
index 0000000..0736504
Binary files /dev/null and b/images/comport/ranks/11o.gif differ
diff --git a/images/comport/ranks/12m.gif b/images/comport/ranks/12m.gif
new file mode 100644
index 0000000..4727b3e
Binary files /dev/null and b/images/comport/ranks/12m.gif differ
diff --git a/images/comport/ranks/13c.gif b/images/comport/ranks/13c.gif
new file mode 100644
index 0000000..ef7d1b5
Binary files /dev/null and b/images/comport/ranks/13c.gif differ
diff --git a/images/comport/ranks/14a.gif b/images/comport/ranks/14a.gif
new file mode 100644
index 0000000..189262f
Binary files /dev/null and b/images/comport/ranks/14a.gif differ
diff --git a/images/comport/ranks/15j.gif b/images/comport/ranks/15j.gif
new file mode 100644
index 0000000..37b558a
Binary files /dev/null and b/images/comport/ranks/15j.gif differ
diff --git a/images/comport/ranks/16r.gif b/images/comport/ranks/16r.gif
new file mode 100644
index 0000000..115f17f
Binary files /dev/null and b/images/comport/ranks/16r.gif differ
diff --git a/images/comport/ranks/17b.gif b/images/comport/ranks/17b.gif
new file mode 100644
index 0000000..b2497e5
Binary files /dev/null and b/images/comport/ranks/17b.gif differ
diff --git a/images/comport/ranks/18t.gif b/images/comport/ranks/18t.gif
new file mode 100644
index 0000000..e6de5a3
Binary files /dev/null and b/images/comport/ranks/18t.gif differ
diff --git a/images/comport/ranks/19i.gif b/images/comport/ranks/19i.gif
new file mode 100644
index 0000000..e53f2e9
Binary files /dev/null and b/images/comport/ranks/19i.gif differ
diff --git a/images/comport/ranks/20w.gif b/images/comport/ranks/20w.gif
new file mode 100644
index 0000000..9a2305d
Binary files /dev/null and b/images/comport/ranks/20w.gif differ
diff --git a/images/comport/ranks/21c.gif b/images/comport/ranks/21c.gif
new file mode 100644
index 0000000..d4d3fab
Binary files /dev/null and b/images/comport/ranks/21c.gif differ
diff --git a/images/comport/ranks/22k.gif b/images/comport/ranks/22k.gif
new file mode 100644
index 0000000..9a140bc
Binary files /dev/null and b/images/comport/ranks/22k.gif differ
diff --git a/images/comport/ranks/23s.gif b/images/comport/ranks/23s.gif
new file mode 100644
index 0000000..601471e
Binary files /dev/null and b/images/comport/ranks/23s.gif differ
diff --git a/images/comport/ranks/24g.gif b/images/comport/ranks/24g.gif
new file mode 100644
index 0000000..277a87d
Binary files /dev/null and b/images/comport/ranks/24g.gif differ
diff --git a/images/comport/ranks/25f.gif b/images/comport/ranks/25f.gif
new file mode 100644
index 0000000..c5392be
Binary files /dev/null and b/images/comport/ranks/25f.gif differ
diff --git a/images/comport/ranks/26b.gif b/images/comport/ranks/26b.gif
new file mode 100644
index 0000000..18e5313
Binary files /dev/null and b/images/comport/ranks/26b.gif differ
diff --git a/images/comport/ranks/27w.gif b/images/comport/ranks/27w.gif
new file mode 100644
index 0000000..32903e1
Binary files /dev/null and b/images/comport/ranks/27w.gif differ
diff --git a/images/comport/ranks/28k.gif b/images/comport/ranks/28k.gif
new file mode 100644
index 0000000..06f5814
Binary files /dev/null and b/images/comport/ranks/28k.gif differ
diff --git a/images/comport/ranks/29d.gif b/images/comport/ranks/29d.gif
new file mode 100644
index 0000000..b918064
Binary files /dev/null and b/images/comport/ranks/29d.gif differ
diff --git a/images/comport/ranks/30n.gif b/images/comport/ranks/30n.gif
new file mode 100644
index 0000000..123321a
Binary files /dev/null and b/images/comport/ranks/30n.gif differ
diff --git a/images/comport/ranks/31m.gif b/images/comport/ranks/31m.gif
new file mode 100644
index 0000000..4d4710e
Binary files /dev/null and b/images/comport/ranks/31m.gif differ
diff --git a/images/comport/ranks/32g.gif b/images/comport/ranks/32g.gif
new file mode 100644
index 0000000..5b01b5b
Binary files /dev/null and b/images/comport/ranks/32g.gif differ
diff --git a/images/comport/ranks/GFX/DONUT1.GIF b/images/comport/ranks/GFX/DONUT1.GIF
new file mode 100644
index 0000000..f27d8d1
Binary files /dev/null and b/images/comport/ranks/GFX/DONUT1.GIF differ
diff --git a/images/comport/ranks/GFX/WS_FTP.LOG b/images/comport/ranks/GFX/WS_FTP.LOG
new file mode 100644
index 0000000..c1303d6
--- /dev/null
+++ b/images/comport/ranks/GFX/WS_FTP.LOG
@@ -0,0 +1,2 @@
+102.06.21 17:33 B d:\webpages\rustedmagick\forum\RANKS\GFX\book1.gif --> 66.162.73.15 /public_html/mb/images/ranks/GFX book1.gif
+102.06.21 17:34 B d:\webpages\rustedmagick\forum\RANKS\GFX\rings1.gif --> 66.162.73.15 /public_html/mb/images/ranks/GFX rings1.gif
diff --git a/images/comport/ranks/GFX/book1.gif b/images/comport/ranks/GFX/book1.gif
new file mode 100644
index 0000000..76ffe10
Binary files /dev/null and b/images/comport/ranks/GFX/book1.gif differ
diff --git a/images/comport/ranks/GFX/dice1.gif b/images/comport/ranks/GFX/dice1.gif
new file mode 100644
index 0000000..bd30041
Binary files /dev/null and b/images/comport/ranks/GFX/dice1.gif differ
diff --git a/images/comport/ranks/GFX/pspbrwse.jbf b/images/comport/ranks/GFX/pspbrwse.jbf
new file mode 100644
index 0000000..7fb2022
Binary files /dev/null and b/images/comport/ranks/GFX/pspbrwse.jbf differ
diff --git a/images/comport/ranks/GFX/rings1.gif b/images/comport/ranks/GFX/rings1.gif
new file mode 100644
index 0000000..fdf806a
Binary files /dev/null and b/images/comport/ranks/GFX/rings1.gif differ
diff --git a/images/comport/ranks/WS_FTP.LOG b/images/comport/ranks/WS_FTP.LOG
new file mode 100644
index 0000000..59f1113
--- /dev/null
+++ b/images/comport/ranks/WS_FTP.LOG
@@ -0,0 +1,34 @@
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\00t.gif --> 66.162.73.15 /public_html/mb/images/ranks 00t.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\01b.gif --> 66.162.73.15 /public_html/mb/images/ranks 01b.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\02d.gif --> 66.162.73.15 /public_html/mb/images/ranks 02d.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\03p.gif --> 66.162.73.15 /public_html/mb/images/ranks 03p.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\04s.gif --> 66.162.73.15 /public_html/mb/images/ranks 04s.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\05s.gif --> 66.162.73.15 /public_html/mb/images/ranks 05s.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\06u.gif --> 66.162.73.15 /public_html/mb/images/ranks 06u.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\07r.gif --> 66.162.73.15 /public_html/mb/images/ranks 07r.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\08b.gif --> 66.162.73.15 /public_html/mb/images/ranks 08b.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\09c.gif --> 66.162.73.15 /public_html/mb/images/ranks 09c.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\10s.gif --> 66.162.73.15 /public_html/mb/images/ranks 10s.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\11o.gif --> 66.162.73.15 /public_html/mb/images/ranks 11o.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\12m.gif --> 66.162.73.15 /public_html/mb/images/ranks 12m.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\13c.gif --> 66.162.73.15 /public_html/mb/images/ranks 13c.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\14a.gif --> 66.162.73.15 /public_html/mb/images/ranks 14a.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\15j.gif --> 66.162.73.15 /public_html/mb/images/ranks 15j.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\16r.gif --> 66.162.73.15 /public_html/mb/images/ranks 16r.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\17b.gif --> 66.162.73.15 /public_html/mb/images/ranks 17b.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\18t.gif --> 66.162.73.15 /public_html/mb/images/ranks 18t.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\19i.gif --> 66.162.73.15 /public_html/mb/images/ranks 19i.gif
+102.05.21 14:33 B d:\webpages\rustedmagick\forum\RANKS\20w.gif --> 66.162.73.15 /public_html/mb/images/ranks 20w.gif
+102.05.22 00:58 B d:\webpages\rustedmagick\forum\RANKS\19i.gif --> 66.162.73.15 /public_html/mb/images/ranks 19i.gif
+102.05.22 00:59 B d:\webpages\rustedmagick\forum\RANKS\12m.gif --> 66.162.73.15 /public_html/mb/images/ranks 12m.gif
+102.05.22 23:13 B d:\webpages\rustedmagick\forum\RANKS\21c.gif --> 66.162.73.15 /public_html/mb/images/ranks 21c.gif
+104.03.17 18:31 B D:\WEBPAGES\rustedmagick\forum\RANKS\24g.gif --> ftp.icehouse.net /d:/inetpub/wwwroot/flory 24g.gif
+104.10.21 15:23 B d:\webpages\rustedmagick\forum\RANKS\25f.gif --> rustedmagick.com /public_html/mb/images/ranks 25f.gif
+105.04.03 23:48 B d:\webpages\rustedmagick\forum\RANKS\22k.gif <-- rustedmagick /public_html/mb/images/ranks 22k.gif
+105.04.03 23:48 B d:\webpages\rustedmagick\forum\RANKS\23s.gif <-- rustedmagick /public_html/mb/images/ranks 23s.gif
+105.04.03 23:48 B d:\webpages\rustedmagick\forum\RANKS\26b.gif --> rustedmagick.com /public_html/mb/images/ranks 26b.gif
+105.04.08 02:27 B d:\webpages\rustedmagick\forum\RANKS\27w.gif --> rustedmagick.com /public_html/mb/images/ranks 27w.gif
+105.12.01 01:18 B d:\webpages\rustedmagick\forum\images\ranks\28d.gif --> rustedmagick.com /public_html/mb/images/ranks 28d.gif
+105.12.01 01:21 B d:\webpages\rustedmagick\forum\images\ranks\28k.gif <-- rustedmagick /public_html/mb/images/ranks 28k.gif
+105.12.01 01:27 B d:\webpages\rustedmagick\forum\images\ranks\30n.gif --> rustedmagick.com /public_html/mb/images/ranks 30n.gif
+106.04.07 00:54 B d:\webpages\rustedmagick\forum\images\ranks\31m.gif --> rustedmagick.com /public_html/mb/images/ranks 31m.gif
diff --git a/images/comport/ranks/pspbrwse.jbf b/images/comport/ranks/pspbrwse.jbf
new file mode 100644
index 0000000..955e4ae
Binary files /dev/null and b/images/comport/ranks/pspbrwse.jbf differ
diff --git a/images/comport/ranks/ranklist.txt b/images/comport/ranks/ranklist.txt
new file mode 100644
index 0000000..45d4567
--- /dev/null
+++ b/images/comport/ranks/ranklist.txt
@@ -0,0 +1,21 @@
+00 - The Number Zero
+01 - Bag of Stinky Weeds
+11 - Oil Puddle
+05 - Slightly Soiled T-Shirt
+02 - Day-Old Cod Sandwich
+10 - Strange-Smelling Mushroom
+03 - Prince Albert in a Can
+15 - Jumbo Bucket O' Ham
+07 - Refreshing Fruit Smoothie
+04 - Sharpened #2 Pencil
+08 - Bug-Eyed Stress Reliever Thingy
+09 - Cheap Toy Ring
+06 - Unknown Chemical Substance
+13 - Creepy Happy Face Button
+14 - Ace of Spades
+17 - Black Cherry Blow Pop
+16 - Ripe Red Cherries
+19 - Imported Chocolate Bar
+18 - The Best of "The Simpsons" DVD
+20 - World's Largest Cubic Zirconia
+12 - Mystery Box
\ No newline at end of file
diff --git a/images/comport/ranks/ranktest.htm b/images/comport/ranks/ranktest.htm
new file mode 100644
index 0000000..0cd3b88
--- /dev/null
+++ b/images/comport/ranks/ranktest.htm
@@ -0,0 +1,3 @@
+<HTML>
+<img src=02d.gif align=absmiddle> <font size=-2 face=Arial>Day-Old Cod Sandwich</font>
+</HTML> 
\ No newline at end of file
diff --git a/images/comport/reply.gif b/images/comport/reply.gif
new file mode 100644
index 0000000..ba64ae6
Binary files /dev/null and b/images/comport/reply.gif differ
diff --git a/images/comport/title.gif b/images/comport/title.gif
new file mode 100644
index 0000000..0258114
Binary files /dev/null and b/images/comport/title.gif differ
diff --git a/images/comport/topic.gif b/images/comport/topic.gif
new file mode 100644
index 0000000..3cc123d
Binary files /dev/null and b/images/comport/topic.gif differ
diff --git a/images/confetti/confetti_blue.png b/images/confetti/confetti_blue.png
new file mode 100644
index 0000000..cb90609
Binary files /dev/null and b/images/confetti/confetti_blue.png differ
diff --git a/images/confetti/confetti_green.png b/images/confetti/confetti_green.png
new file mode 100644
index 0000000..7926c93
Binary files /dev/null and b/images/confetti/confetti_green.png differ
diff --git a/images/confetti/confetti_red.png b/images/confetti/confetti_red.png
new file mode 100644
index 0000000..a253120
Binary files /dev/null and b/images/confetti/confetti_red.png differ
diff --git a/images/confetti/confetti_yellow.png b/images/confetti/confetti_yellow.png
new file mode 100644
index 0000000..56659b5
Binary files /dev/null and b/images/confetti/confetti_yellow.png differ
diff --git a/images/css-auth.mid b/images/css-auth.mid
new file mode 100644
index 0000000..5fca96b
Binary files /dev/null and b/images/css-auth.mid differ
diff --git a/images/denied.gif b/images/denied.gif
new file mode 100644
index 0000000..a4dfbb2
Binary files /dev/null and b/images/denied.gif differ
diff --git a/images/desolation/desolation-0.jpg b/images/desolation/desolation-0.jpg
new file mode 100644
index 0000000..26880be
Binary files /dev/null and b/images/desolation/desolation-0.jpg differ
diff --git a/images/desolation/desolation.jpg b/images/desolation/desolation.jpg
new file mode 100644
index 0000000..521f89c
Binary files /dev/null and b/images/desolation/desolation.jpg differ
diff --git a/images/desolation/specialtitle.jpg b/images/desolation/specialtitle.jpg
new file mode 100644
index 0000000..94d52d4
Binary files /dev/null and b/images/desolation/specialtitle.jpg differ
diff --git a/images/desolation/tdbg1.png b/images/desolation/tdbg1.png
new file mode 100644
index 0000000..eb6125c
Binary files /dev/null and b/images/desolation/tdbg1.png differ
diff --git a/images/desolation/tdbg2.png b/images/desolation/tdbg2.png
new file mode 100644
index 0000000..a8534e0
Binary files /dev/null and b/images/desolation/tdbg2.png differ
diff --git a/images/desolation/tdbg3.png b/images/desolation/tdbg3.png
new file mode 100644
index 0000000..24ba812
Binary files /dev/null and b/images/desolation/tdbg3.png differ
diff --git a/images/desolation/tdbgc.png b/images/desolation/tdbgc.png
new file mode 100644
index 0000000..24ba812
Binary files /dev/null and b/images/desolation/tdbgc.png differ
diff --git a/images/desolation/tdbgh.png b/images/desolation/tdbgh.png
new file mode 100644
index 0000000..0d95c90
Binary files /dev/null and b/images/desolation/tdbgh.png differ
diff --git a/images/digits6.png b/images/digits6.png
new file mode 100644
index 0000000..a500a11
Binary files /dev/null and b/images/digits6.png differ
diff --git a/images/digits6s.png b/images/digits6s.png
new file mode 100644
index 0000000..fd4d8b6
Binary files /dev/null and b/images/digits6s.png differ
diff --git a/images/disgaea-rejected.png b/images/disgaea-rejected.png
new file mode 100644
index 0000000..d6059de
Binary files /dev/null and b/images/disgaea-rejected.png differ
diff --git a/images/dnss/banner.png b/images/dnss/banner.png
new file mode 100644
index 0000000..5f86fcd
Binary files /dev/null and b/images/dnss/banner.png differ
diff --git a/images/dnss/darkest.png b/images/dnss/darkest.png
new file mode 100644
index 0000000..964e5bf
Binary files /dev/null and b/images/dnss/darkest.png differ
diff --git a/images/dot1.gif b/images/dot1.gif
new file mode 100644
index 0000000..359ff99
Binary files /dev/null and b/images/dot1.gif differ
diff --git a/images/dot2.gif b/images/dot2.gif
new file mode 100644
index 0000000..ceeceab
Binary files /dev/null and b/images/dot2.gif differ
diff --git a/images/dot3.gif b/images/dot3.gif
new file mode 100644
index 0000000..0439bbd
Binary files /dev/null and b/images/dot3.gif differ
diff --git a/images/dot4.gif b/images/dot4.gif
new file mode 100644
index 0000000..87a21bc
Binary files /dev/null and b/images/dot4.gif differ
diff --git a/images/dot5.gif b/images/dot5.gif
new file mode 100644
index 0000000..fb24f89
Binary files /dev/null and b/images/dot5.gif differ
diff --git a/images/downtimemessage2.jpg b/images/downtimemessage2.jpg
new file mode 100644
index 0000000..6d9e7dd
Binary files /dev/null and b/images/downtimemessage2.jpg differ
diff --git a/images/dude.png b/images/dude.png
new file mode 100644
index 0000000..0670c4b
Binary files /dev/null and b/images/dude.png differ
diff --git a/images/dude2.png b/images/dude2.png
new file mode 100644
index 0000000..f29194b
Binary files /dev/null and b/images/dude2.png differ
diff --git a/images/dude3.png b/images/dude3.png
new file mode 100644
index 0000000..edb435f
Binary files /dev/null and b/images/dude3.png differ
diff --git a/images/dude4.png b/images/dude4.png
new file mode 100644
index 0000000..b0c7e7d
Binary files /dev/null and b/images/dude4.png differ
diff --git a/images/dude5.png b/images/dude5.png
new file mode 100644
index 0000000..ee3d6de
Binary files /dev/null and b/images/dude5.png differ
diff --git a/images/epicburn.png b/images/epicburn.png
new file mode 100644
index 0000000..c2f7eaf
Binary files /dev/null and b/images/epicburn.png differ
diff --git a/images/everybody_loves_dog.jpg b/images/everybody_loves_dog.jpg
new file mode 100644
index 0000000..8799580
Binary files /dev/null and b/images/everybody_loves_dog.jpg differ
diff --git a/images/f2/bg.png b/images/f2/bg.png
new file mode 100644
index 0000000..bd6c90b
Binary files /dev/null and b/images/f2/bg.png differ
diff --git a/images/f2/bg1.png b/images/f2/bg1.png
new file mode 100644
index 0000000..d2e68b5
Binary files /dev/null and b/images/f2/bg1.png differ
diff --git a/images/f2/bg2.png b/images/f2/bg2.png
new file mode 100644
index 0000000..e13f13c
Binary files /dev/null and b/images/f2/bg2.png differ
diff --git a/images/f2/bg_2.png b/images/f2/bg_2.png
new file mode 100644
index 0000000..544a22b
Binary files /dev/null and b/images/f2/bg_2.png differ
diff --git a/images/facepalm.jpg b/images/facepalm.jpg
new file mode 100644
index 0000000..cf18726
Binary files /dev/null and b/images/facepalm.jpg differ
diff --git a/images/facepalm2.jpg b/images/facepalm2.jpg
new file mode 100644
index 0000000..a9972bb
Binary files /dev/null and b/images/facepalm2.jpg differ
diff --git a/images/fail.png b/images/fail.png
new file mode 100644
index 0000000..232c34c
Binary files /dev/null and b/images/fail.png differ
diff --git a/images/fixpickle.gif b/images/fixpickle.gif
new file mode 100644
index 0000000..84de438
Binary files /dev/null and b/images/fixpickle.gif differ
diff --git a/images/flash1.gif b/images/flash1.gif
new file mode 100644
index 0000000..6b56fb6
Binary files /dev/null and b/images/flash1.gif differ
diff --git a/images/flash2.gif b/images/flash2.gif
new file mode 100644
index 0000000..1bbbd39
Binary files /dev/null and b/images/flash2.gif differ
diff --git a/images/flash3.gif b/images/flash3.gif
new file mode 100644
index 0000000..ee829f7
Binary files /dev/null and b/images/flash3.gif differ
diff --git a/images/gameoverbra.gif b/images/gameoverbra.gif
new file mode 100644
index 0000000..7458334
Binary files /dev/null and b/images/gameoverbra.gif differ
diff --git a/images/garbg/garbanner.png b/images/garbg/garbanner.png
new file mode 100644
index 0000000..6c7e076
Binary files /dev/null and b/images/garbg/garbanner.png differ
diff --git a/images/garbg/garbg.png b/images/garbg/garbg.png
new file mode 100644
index 0000000..3d7f167
Binary files /dev/null and b/images/garbg/garbg.png differ
diff --git a/images/getlast.png b/images/getlast.png
new file mode 100644
index 0000000..7235c7e
Binary files /dev/null and b/images/getlast.png differ
diff --git a/images/getnew.png b/images/getnew.png
new file mode 100644
index 0000000..928be43
Binary files /dev/null and b/images/getnew.png differ
diff --git a/images/gn/gstarsbg.png b/images/gn/gstarsbg.png
new file mode 100644
index 0000000..b17ff60
Binary files /dev/null and b/images/gn/gstarsbg.png differ
diff --git a/images/grouphug.png b/images/grouphug.png
new file mode 100644
index 0000000..5c9e6c6
Binary files /dev/null and b/images/grouphug.png differ
diff --git a/images/gtst4in1.png b/images/gtst4in1.png
new file mode 100644
index 0000000..06b0a00
Binary files /dev/null and b/images/gtst4in1.png differ
diff --git a/images/hate.jpg b/images/hate.jpg
new file mode 100644
index 0000000..71e1587
Binary files /dev/null and b/images/hate.jpg differ
diff --git a/images/hexchart.png b/images/hexchart.png
new file mode 100644
index 0000000..f322f98
Binary files /dev/null and b/images/hexchart.png differ
diff --git a/images/hot.gif b/images/hot.gif
new file mode 100644
index 0000000..844a4ae
Binary files /dev/null and b/images/hot.gif differ
diff --git a/images/hotnew.gif b/images/hotnew.gif
new file mode 100644
index 0000000..0e4d2d8
Binary files /dev/null and b/images/hotnew.gif differ
diff --git a/images/hotoff.gif b/images/hotoff.gif
new file mode 100644
index 0000000..7678d02
Binary files /dev/null and b/images/hotoff.gif differ
diff --git a/images/hugeavatarssuck.png b/images/hugeavatarssuck.png
new file mode 100644
index 0000000..7af28ed
Binary files /dev/null and b/images/hugeavatarssuck.png differ
diff --git a/images/hugeavatarssuck2.png b/images/hugeavatarssuck2.png
new file mode 100644
index 0000000..fe41215
Binary files /dev/null and b/images/hugeavatarssuck2.png differ
diff --git a/images/hugeavatarssuck3.gif b/images/hugeavatarssuck3.gif
new file mode 100644
index 0000000..225ddb1
Binary files /dev/null and b/images/hugeavatarssuck3.gif differ
diff --git a/images/hydras_blue_background.png b/images/hydras_blue_background.png
new file mode 100644
index 0000000..7115822
Binary files /dev/null and b/images/hydras_blue_background.png differ
diff --git a/images/icons/icon1.gif b/images/icons/icon1.gif
new file mode 100644
index 0000000..cdd7c72
Binary files /dev/null and b/images/icons/icon1.gif differ
diff --git a/images/icons/icon13.gif b/images/icons/icon13.gif
new file mode 100644
index 0000000..c171dbc
Binary files /dev/null and b/images/icons/icon13.gif differ
diff --git a/images/icons/icon14.gif b/images/icons/icon14.gif
new file mode 100644
index 0000000..38799af
Binary files /dev/null and b/images/icons/icon14.gif differ
diff --git a/images/icons/icon2.gif b/images/icons/icon2.gif
new file mode 100644
index 0000000..a99b61a
Binary files /dev/null and b/images/icons/icon2.gif differ
diff --git a/images/icons/icon3.gif b/images/icons/icon3.gif
new file mode 100644
index 0000000..f194d38
Binary files /dev/null and b/images/icons/icon3.gif differ
diff --git a/images/icons/icon4.gif b/images/icons/icon4.gif
new file mode 100644
index 0000000..15b03c0
Binary files /dev/null and b/images/icons/icon4.gif differ
diff --git a/images/icons/icon5.gif b/images/icons/icon5.gif
new file mode 100644
index 0000000..e73c3a5
Binary files /dev/null and b/images/icons/icon5.gif differ
diff --git a/images/icons/nsfwicon.gif b/images/icons/nsfwicon.gif
new file mode 100644
index 0000000..cd98c00
Binary files /dev/null and b/images/icons/nsfwicon.gif differ
diff --git a/images/ihateglennbeckbutistillthinkthisimagefitsquitenicelyundertheadminpanelmoneycounter.jpg b/images/ihateglennbeckbutistillthinkthisimagefitsquitenicelyundertheadminpanelmoneycounter.jpg
new file mode 100644
index 0000000..3a0c2a8
Binary files /dev/null and b/images/ihateglennbeckbutistillthinkthisimagefitsquitenicelyundertheadminpanelmoneycounter.jpg differ
diff --git a/images/ikachan/vikingikachan.png b/images/ikachan/vikingikachan.png
new file mode 100644
index 0000000..b5c6676
Binary files /dev/null and b/images/ikachan/vikingikachan.png differ
diff --git a/images/ikachan1.png b/images/ikachan1.png
new file mode 100644
index 0000000..1eae30c
Binary files /dev/null and b/images/ikachan1.png differ
diff --git a/images/ikachan2.png b/images/ikachan2.png
new file mode 100644
index 0000000..5003800
Binary files /dev/null and b/images/ikachan2.png differ
diff --git a/images/ikachanpointer.png b/images/ikachanpointer.png
new file mode 100644
index 0000000..1eae30c
Binary files /dev/null and b/images/ikachanpointer.png differ
diff --git a/images/ikachanpointer2.png b/images/ikachanpointer2.png
new file mode 100644
index 0000000..097996d
Binary files /dev/null and b/images/ikachanpointer2.png differ
diff --git a/images/ikamad.png b/images/ikamad.png
new file mode 100644
index 0000000..5272fdd
Binary files /dev/null and b/images/ikamad.png differ
diff --git a/images/imageshits.png b/images/imageshits.png
new file mode 100644
index 0000000..e84dec3
Binary files /dev/null and b/images/imageshits.png differ
diff --git a/images/inu/7sd.php b/images/inu/7sd.php
new file mode 100644
index 0000000..a13c369
--- /dev/null
+++ b/images/inu/7sd.php
@@ -0,0 +1,145 @@
+<?php
+
+$height = 8;
+$charwidth = 6;
+
+$charlist = array(
+  0x20 => 0x00, // (space)
+  0x22 => 0x22, // "
+  0x27 => 0x02, // '
+  0x2D => 0x40, // -
+          0x10, // .
+  0x30 => 0x3F, // 0
+          0x06, // 1
+          0x5B, // 2
+          0x4F, // 3
+          0x66, // 4
+          0x6D, // 5
+          0x7D, // 6
+          0x07, // 7
+          0x7F, // 8
+          0x6F, // 9
+  0x3D => 0x48, // =
+  0x41 => 0x77, // A
+          0x7C, // b
+          0x39, // C
+          0x5E, // d
+          0x79, // E
+          0x71, // F
+          0x3D, // G
+          0x76, // H
+          0x30, // I
+          0x1E, // J
+          0x7A, // K
+          0x38, // L
+          0x55, // m
+          0x37, // N
+          0x5C, // o
+          0x73, // P
+          0x67, // q
+          0x50, // r
+          0x64, // s
+          0x78, // t
+          0x3E, // U
+          0x2A, // V
+          0x6A, // W
+          0x49, // x
+          0x6E, // y
+          0x52, // z
+  0x5F => 0x08, // _
+);
+
+$shiftt = array();
+$shifts = array();
+$final = array();
+
+if ($_GET['raw']) {
+  $code = intval($_GET['raw']);
+  $raw = true;
+}
+else if ($_GET['s']) $string = strtoupper($_GET['s']);
+else $string = '01234 56789 ABCDE FGHIJ KLMNO PQRST UVWXY Z';
+
+if (!$raw) {
+  $ssplit = str_split($string);
+  $i = 0;
+  while ($i < 200 && ($chr = array_shift($ssplit)) !== NULL) {
+    if ($chr == '>') {
+      $r = hexdec(array_shift($ssplit)) * 17;
+      $g = hexdec(array_shift($ssplit)) * 17;
+      $b = hexdec(array_shift($ssplit)) * 17;
+      $shiftt[$i] = array($r, $g, $b);
+    }
+    elseif (array_key_exists(ord($chr), $charlist))
+      $final[$i++] = ord($chr);
+  }
+}
+$strlen = ($raw) ? 1 : count($final);
+
+$im = @imagecreatetruecolor($strlen*$charwidth, $height) or die('oops, no image.');
+$black = imagecolorallocate($im, 0, 0, 1);
+imagefill($im, 0, 0, $black);
+imagecolortransparent($im, $black);
+$shadow = imagecolorallocate($im, 0, 0, 0);
+
+$cl = imagecolorallocate($im, 0, 255, 0);
+
+if ($raw) {
+  placeshadow($code, 0);
+  place7sd($code, 0);
+
+  header("Content-Type: image/png");
+  imagepng($im);
+  imagedestroy($im);
+  die();
+}
+
+foreach ($shiftt as $p => $s)
+  $shifts[$p] = imagecolorallocate($im, $s[0], $s[1], $s[2]);
+
+for ($i = 0; $i < $strlen; ++$i) {
+  if (array_key_exists($i, $shifts)) $cl = $shifts[$i];
+  $chr = $charlist[$final[$i]];
+  placeshadow($chr, $i);
+  place7sd($chr, $i);
+}
+
+header("Content-Type: image/png");
+imagepng($im);
+imagedestroy($im);
+
+function place7sd($lights, $w) {
+  global $im, $cl, $charwidth;
+  $w *= $charwidth;
+  for ($i = 0x01; $i < 0x80; $i<<=1) {
+    if ($lights & $i) switch ($i) {
+      case 0x01: imageline($im, $w + 1, 0, $w + 2, 0, $cl); break; //seg a
+      case 0x02: imageline($im, $w + 3, 1, $w + 3, 2, $cl); break; //seg b
+      case 0x04: imageline($im, $w + 3, 4, $w + 3, 5, $cl); break; //seg c
+      case 0x08: imageline($im, $w + 1, 6, $w + 2, 6, $cl); break; //seg d
+      case 0x10: imageline($im, $w,     4, $w,     5, $cl); break; //seg e
+      case 0x20: imageline($im, $w,     1, $w,     2, $cl); break; //seg f
+      case 0x40: imageline($im, $w + 1, 3, $w + 2, 3, $cl); break; //seg g
+      default: break;
+    }
+  }
+}
+
+function placeshadow($lights, $w) {
+  global $im, $cl, $charwidth;
+  $w *= $charwidth;
+  for ($i = 0x01; $i < 0x80; $i<<=1) {
+    if ($lights & $i) switch ($i) {
+      case 0x01: imageline($im, $w + 2, 1, $w + 3, 1, $shadow); break; //seg a
+      case 0x02: imageline($im, $w + 4, 2, $w + 4, 3, $shadow); break; //seg b
+      case 0x04: imageline($im, $w + 4, 5, $w + 4, 6, $shadow); break; //seg c
+      case 0x08: imageline($im, $w + 2, 7, $w + 3, 7, $shadow); break; //seg d
+      case 0x10: imageline($im, $w + 1, 5, $w + 1, 6, $shadow); break; //seg e
+      case 0x20: imageline($im, $w + 1, 2, $w + 1, 3, $shadow); break; //seg f
+      case 0x40: imageline($im, $w + 2, 4, $w + 3, 4, $shadow); break; //seg g
+      default: break;
+    }
+  }
+}
+
+?>
\ No newline at end of file
diff --git a/images/inu/cifont/0.gif b/images/inu/cifont/0.gif
new file mode 100644
index 0000000..a648eaa
Binary files /dev/null and b/images/inu/cifont/0.gif differ
diff --git a/images/inu/cifont/1.gif b/images/inu/cifont/1.gif
new file mode 100644
index 0000000..ea915d2
Binary files /dev/null and b/images/inu/cifont/1.gif differ
diff --git a/images/inu/cifont/2.gif b/images/inu/cifont/2.gif
new file mode 100644
index 0000000..d18b0be
Binary files /dev/null and b/images/inu/cifont/2.gif differ
diff --git a/images/inu/cifont/3.gif b/images/inu/cifont/3.gif
new file mode 100644
index 0000000..1b5fb30
Binary files /dev/null and b/images/inu/cifont/3.gif differ
diff --git a/images/inu/cifont/4.gif b/images/inu/cifont/4.gif
new file mode 100644
index 0000000..4e1606d
Binary files /dev/null and b/images/inu/cifont/4.gif differ
diff --git a/images/inu/cifont/5.gif b/images/inu/cifont/5.gif
new file mode 100644
index 0000000..6f9857f
Binary files /dev/null and b/images/inu/cifont/5.gif differ
diff --git a/images/inu/cifont/6.gif b/images/inu/cifont/6.gif
new file mode 100644
index 0000000..084ea84
Binary files /dev/null and b/images/inu/cifont/6.gif differ
diff --git a/images/inu/cifont/7.gif b/images/inu/cifont/7.gif
new file mode 100644
index 0000000..40d1df1
Binary files /dev/null and b/images/inu/cifont/7.gif differ
diff --git a/images/inu/cifont/8.gif b/images/inu/cifont/8.gif
new file mode 100644
index 0000000..33653ee
Binary files /dev/null and b/images/inu/cifont/8.gif differ
diff --git a/images/inu/cifont/9.gif b/images/inu/cifont/9.gif
new file mode 100644
index 0000000..7be77d1
Binary files /dev/null and b/images/inu/cifont/9.gif differ
diff --git a/images/inu/cifont/a.gif b/images/inu/cifont/a.gif
new file mode 100644
index 0000000..e65542c
Binary files /dev/null and b/images/inu/cifont/a.gif differ
diff --git a/images/inu/cifont/b.gif b/images/inu/cifont/b.gif
new file mode 100644
index 0000000..e6d0025
Binary files /dev/null and b/images/inu/cifont/b.gif differ
diff --git a/images/inu/cifont/c.gif b/images/inu/cifont/c.gif
new file mode 100644
index 0000000..fe22fa5
Binary files /dev/null and b/images/inu/cifont/c.gif differ
diff --git a/images/inu/cifont/d.gif b/images/inu/cifont/d.gif
new file mode 100644
index 0000000..ee57b63
Binary files /dev/null and b/images/inu/cifont/d.gif differ
diff --git a/images/inu/cifont/e.gif b/images/inu/cifont/e.gif
new file mode 100644
index 0000000..684c817
Binary files /dev/null and b/images/inu/cifont/e.gif differ
diff --git a/images/inu/cifont/f.gif b/images/inu/cifont/f.gif
new file mode 100644
index 0000000..a83a9f3
Binary files /dev/null and b/images/inu/cifont/f.gif differ
diff --git a/images/inu/cifont/p.gif b/images/inu/cifont/p.gif
new file mode 100644
index 0000000..fd4a16a
Binary files /dev/null and b/images/inu/cifont/p.gif differ
diff --git a/images/inu/cifont/t.gif b/images/inu/cifont/t.gif
new file mode 100644
index 0000000..3c77cde
Binary files /dev/null and b/images/inu/cifont/t.gif differ
diff --git a/images/jmsu.png b/images/jmsu.png
new file mode 100644
index 0000000..2387308
Binary files /dev/null and b/images/jmsu.png differ
diff --git a/images/jul/bar-off.gif b/images/jul/bar-off.gif
new file mode 100644
index 0000000..98e9352
Binary files /dev/null and b/images/jul/bar-off.gif differ
diff --git a/images/jul/bar-on.gif b/images/jul/bar-on.gif
new file mode 100644
index 0000000..4fc432e
Binary files /dev/null and b/images/jul/bar-on.gif differ
diff --git a/images/jul/barleft.gif b/images/jul/barleft.gif
new file mode 100644
index 0000000..312a676
Binary files /dev/null and b/images/jul/barleft.gif differ
diff --git a/images/jul/barright.gif b/images/jul/barright.gif
new file mode 100644
index 0000000..6acf59b
Binary files /dev/null and b/images/jul/barright.gif differ
diff --git a/images/jul88x31.png b/images/jul88x31.png
new file mode 100644
index 0000000..c21f5bc
Binary files /dev/null and b/images/jul88x31.png differ
diff --git a/images/jul_sheet0.png b/images/jul_sheet0.png
new file mode 100644
index 0000000..eab464c
Binary files /dev/null and b/images/jul_sheet0.png differ
diff --git a/images/julmas/flake0.gif b/images/julmas/flake0.gif
new file mode 100644
index 0000000..f7008e7
Binary files /dev/null and b/images/julmas/flake0.gif differ
diff --git a/images/julmas/flake1.gif b/images/julmas/flake1.gif
new file mode 100644
index 0000000..1af6f56
Binary files /dev/null and b/images/julmas/flake1.gif differ
diff --git a/images/julmas/jullights02.gif b/images/julmas/jullights02.gif
new file mode 100644
index 0000000..f58101c
Binary files /dev/null and b/images/julmas/jullights02.gif differ
diff --git a/images/julmas/jullightsplug01.gif b/images/julmas/jullightsplug01.gif
new file mode 100644
index 0000000..adf5504
Binary files /dev/null and b/images/julmas/jullightsplug01.gif differ
diff --git a/images/julmas/snowplosion.gif b/images/julmas/snowplosion.gif
new file mode 100644
index 0000000..757e073
Binary files /dev/null and b/images/julmas/snowplosion.gif differ
diff --git a/images/julold/bar-off.gif b/images/julold/bar-off.gif
new file mode 100644
index 0000000..f0cdfc2
Binary files /dev/null and b/images/julold/bar-off.gif differ
diff --git a/images/julold/bar-on.gif b/images/julold/bar-on.gif
new file mode 100644
index 0000000..1652229
Binary files /dev/null and b/images/julold/bar-on.gif differ
diff --git a/images/julold/barleft.gif b/images/julold/barleft.gif
new file mode 100644
index 0000000..f0d2bee
Binary files /dev/null and b/images/julold/barleft.gif differ
diff --git a/images/julold/barright.gif b/images/julold/barright.gif
new file mode 100644
index 0000000..9745b2e
Binary files /dev/null and b/images/julold/barright.gif differ
diff --git a/images/julold/header_shade.png b/images/julold/header_shade.png
new file mode 100644
index 0000000..253b2e8
Binary files /dev/null and b/images/julold/header_shade.png differ
diff --git a/images/julpleinair.png b/images/julpleinair.png
new file mode 100644
index 0000000..29ffede
Binary files /dev/null and b/images/julpleinair.png differ
diff --git a/images/julstupid1.png b/images/julstupid1.png
new file mode 100644
index 0000000..1614976
Binary files /dev/null and b/images/julstupid1.png differ
diff --git a/images/julstupid2.png b/images/julstupid2.png
new file mode 100644
index 0000000..c273c6e
Binary files /dev/null and b/images/julstupid2.png differ
diff --git a/images/julstupid3.png b/images/julstupid3.png
new file mode 100644
index 0000000..2ac6a0a
Binary files /dev/null and b/images/julstupid3.png differ
diff --git a/images/julstupid4.png b/images/julstupid4.png
new file mode 100644
index 0000000..bfc4978
Binary files /dev/null and b/images/julstupid4.png differ
diff --git a/images/julstupid5.png b/images/julstupid5.png
new file mode 100644
index 0000000..b99dfbc
Binary files /dev/null and b/images/julstupid5.png differ
diff --git a/images/julstupid6.png b/images/julstupid6.png
new file mode 100644
index 0000000..1542058
Binary files /dev/null and b/images/julstupid6.png differ
diff --git a/images/julstupid7.png b/images/julstupid7.png
new file mode 100644
index 0000000..567bc95
Binary files /dev/null and b/images/julstupid7.png differ
diff --git a/images/julstupid8.png b/images/julstupid8.png
new file mode 100644
index 0000000..af04e67
Binary files /dev/null and b/images/julstupid8.png differ
diff --git a/images/justusbmf.jpg b/images/justusbmf.jpg
new file mode 100644
index 0000000..19dcb6e
Binary files /dev/null and b/images/justusbmf.jpg differ
diff --git a/images/justusleague2.jpg b/images/justusleague2.jpg
new file mode 100644
index 0000000..b27ec19
Binary files /dev/null and b/images/justusleague2.jpg differ
diff --git a/images/kafuka/firebg2.jpg b/images/kafuka/firebg2.jpg
new file mode 100644
index 0000000..1478905
Binary files /dev/null and b/images/kafuka/firebg2.jpg differ
diff --git a/images/kafuka/firebg2b.jpg b/images/kafuka/firebg2b.jpg
new file mode 100644
index 0000000..1195f3b
Binary files /dev/null and b/images/kafuka/firebg2b.jpg differ
diff --git a/images/kafuka/firebg4.jpg b/images/kafuka/firebg4.jpg
new file mode 100644
index 0000000..7eb2463
Binary files /dev/null and b/images/kafuka/firebg4.jpg differ
diff --git a/images/kafuka/kafuka.jpg b/images/kafuka/kafuka.jpg
new file mode 100644
index 0000000..e0d2b0b
Binary files /dev/null and b/images/kafuka/kafuka.jpg differ
diff --git a/images/kafuka/newreplykaf.png b/images/kafuka/newreplykaf.png
new file mode 100644
index 0000000..5dee8de
Binary files /dev/null and b/images/kafuka/newreplykaf.png differ
diff --git a/images/kafuka/newthreadkaf.png b/images/kafuka/newthreadkaf.png
new file mode 100644
index 0000000..a9d4e7b
Binary files /dev/null and b/images/kafuka/newthreadkaf.png differ
diff --git a/images/linkingfail.gif b/images/linkingfail.gif
new file mode 100644
index 0000000..1445994
Binary files /dev/null and b/images/linkingfail.gif differ
diff --git a/images/marin_l.jpg b/images/marin_l.jpg
new file mode 100644
index 0000000..863e191
Binary files /dev/null and b/images/marin_l.jpg differ
diff --git a/images/marin_l.png b/images/marin_l.png
new file mode 100644
index 0000000..134d580
Binary files /dev/null and b/images/marin_l.png differ
diff --git a/images/marin_l2.png b/images/marin_l2.png
new file mode 100644
index 0000000..aac6688
Binary files /dev/null and b/images/marin_l2.png differ
diff --git a/images/mariomovie/newpoll.png b/images/mariomovie/newpoll.png
new file mode 100644
index 0000000..99e6038
Binary files /dev/null and b/images/mariomovie/newpoll.png differ
diff --git a/images/mariomovie/newreply.png b/images/mariomovie/newreply.png
new file mode 100644
index 0000000..33a01ab
Binary files /dev/null and b/images/mariomovie/newreply.png differ
diff --git a/images/mariomovie/newthread.png b/images/mariomovie/newthread.png
new file mode 100644
index 0000000..0ad954d
Binary files /dev/null and b/images/mariomovie/newthread.png differ
diff --git a/images/mariomovie/thedata.png b/images/mariomovie/thedata.png
new file mode 100644
index 0000000..4b3e043
Binary files /dev/null and b/images/mariomovie/thedata.png differ
diff --git a/images/mariomovie/threadclosed.png b/images/mariomovie/threadclosed.png
new file mode 100644
index 0000000..1a1682c
Binary files /dev/null and b/images/mariomovie/threadclosed.png differ
diff --git a/images/mariomovie/zeroesbg3.png b/images/mariomovie/zeroesbg3.png
new file mode 100644
index 0000000..eb3678a
Binary files /dev/null and b/images/mariomovie/zeroesbg3.png differ
diff --git a/images/miniapple.gif b/images/miniapple.gif
new file mode 100644
index 0000000..f40eba9
Binary files /dev/null and b/images/miniapple.gif differ
diff --git a/images/minibar.png b/images/minibar.png
new file mode 100644
index 0000000..c739d72
Binary files /dev/null and b/images/minibar.png differ
diff --git a/images/moodrings.png b/images/moodrings.png
new file mode 100644
index 0000000..45e9d13
Binary files /dev/null and b/images/moodrings.png differ
diff --git a/images/mosts/0-1.png b/images/mosts/0-1.png
new file mode 100644
index 0000000..3377261
Binary files /dev/null and b/images/mosts/0-1.png differ
diff --git a/images/mosts/0-2.png b/images/mosts/0-2.png
new file mode 100644
index 0000000..1df1d17
Binary files /dev/null and b/images/mosts/0-2.png differ
diff --git a/images/mosts/0-3.png b/images/mosts/0-3.png
new file mode 100644
index 0000000..315a2ba
Binary files /dev/null and b/images/mosts/0-3.png differ
diff --git a/images/mosts/1-1.png b/images/mosts/1-1.png
new file mode 100644
index 0000000..153a287
Binary files /dev/null and b/images/mosts/1-1.png differ
diff --git a/images/mosts/1-2.png b/images/mosts/1-2.png
new file mode 100644
index 0000000..e744072
Binary files /dev/null and b/images/mosts/1-2.png differ
diff --git a/images/mosts/1-3.png b/images/mosts/1-3.png
new file mode 100644
index 0000000..c15797d
Binary files /dev/null and b/images/mosts/1-3.png differ
diff --git a/images/mosts/2-1.png b/images/mosts/2-1.png
new file mode 100644
index 0000000..89f0870
Binary files /dev/null and b/images/mosts/2-1.png differ
diff --git a/images/mosts/2-2.png b/images/mosts/2-2.png
new file mode 100644
index 0000000..b5609ee
Binary files /dev/null and b/images/mosts/2-2.png differ
diff --git a/images/mosts/2-3.png b/images/mosts/2-3.png
new file mode 100644
index 0000000..fe200f7
Binary files /dev/null and b/images/mosts/2-3.png differ
diff --git a/images/mosts/3-1.png b/images/mosts/3-1.png
new file mode 100644
index 0000000..dfcf92b
Binary files /dev/null and b/images/mosts/3-1.png differ
diff --git a/images/mosts/3-2.png b/images/mosts/3-2.png
new file mode 100644
index 0000000..e9160da
Binary files /dev/null and b/images/mosts/3-2.png differ
diff --git a/images/mosts/3-3.png b/images/mosts/3-3.png
new file mode 100644
index 0000000..a5ca4a0
Binary files /dev/null and b/images/mosts/3-3.png differ
diff --git a/images/mosts/4-1.png b/images/mosts/4-1.png
new file mode 100644
index 0000000..67be176
Binary files /dev/null and b/images/mosts/4-1.png differ
diff --git a/images/mosts/4-2.png b/images/mosts/4-2.png
new file mode 100644
index 0000000..5c7d996
Binary files /dev/null and b/images/mosts/4-2.png differ
diff --git a/images/mosts/4-3.png b/images/mosts/4-3.png
new file mode 100644
index 0000000..0000964
Binary files /dev/null and b/images/mosts/4-3.png differ
diff --git a/images/mosts/5-1.png b/images/mosts/5-1.png
new file mode 100644
index 0000000..837ff1e
Binary files /dev/null and b/images/mosts/5-1.png differ
diff --git a/images/mosts/5-2.png b/images/mosts/5-2.png
new file mode 100644
index 0000000..ba97afe
Binary files /dev/null and b/images/mosts/5-2.png differ
diff --git a/images/mosts/5-3.png b/images/mosts/5-3.png
new file mode 100644
index 0000000..923de47
Binary files /dev/null and b/images/mosts/5-3.png differ
diff --git a/images/mosts/6-1.png b/images/mosts/6-1.png
new file mode 100644
index 0000000..5e775a1
Binary files /dev/null and b/images/mosts/6-1.png differ
diff --git a/images/mosts/6-2.png b/images/mosts/6-2.png
new file mode 100644
index 0000000..dc1be36
Binary files /dev/null and b/images/mosts/6-2.png differ
diff --git a/images/mosts/6-3.png b/images/mosts/6-3.png
new file mode 100644
index 0000000..a684db3
Binary files /dev/null and b/images/mosts/6-3.png differ
diff --git a/images/mosts/7-1.png b/images/mosts/7-1.png
new file mode 100644
index 0000000..eec06c4
Binary files /dev/null and b/images/mosts/7-1.png differ
diff --git a/images/mosts/7-2.png b/images/mosts/7-2.png
new file mode 100644
index 0000000..7b4d7ff
Binary files /dev/null and b/images/mosts/7-2.png differ
diff --git a/images/mosts/7-3.png b/images/mosts/7-3.png
new file mode 100644
index 0000000..d8ad1ad
Binary files /dev/null and b/images/mosts/7-3.png differ
diff --git a/images/mosts/8-1.png b/images/mosts/8-1.png
new file mode 100644
index 0000000..23890fb
Binary files /dev/null and b/images/mosts/8-1.png differ
diff --git a/images/mosts/8-2.png b/images/mosts/8-2.png
new file mode 100644
index 0000000..0378772
Binary files /dev/null and b/images/mosts/8-2.png differ
diff --git a/images/mosts/8-3.png b/images/mosts/8-3.png
new file mode 100644
index 0000000..cc64125
Binary files /dev/null and b/images/mosts/8-3.png differ
diff --git a/images/mosts/hm.png b/images/mosts/hm.png
new file mode 100644
index 0000000..6e98572
Binary files /dev/null and b/images/mosts/hm.png differ
diff --git a/images/mosts/trophies.bin b/images/mosts/trophies.bin
new file mode 100644
index 0000000..27ed093
Binary files /dev/null and b/images/mosts/trophies.bin differ
diff --git a/images/mosts/trophies.dat b/images/mosts/trophies.dat
new file mode 100644
index 0000000..79172b5
Binary files /dev/null and b/images/mosts/trophies.dat differ
diff --git a/images/mosts/trophies.pal b/images/mosts/trophies.pal
new file mode 100644
index 0000000..e38be21
Binary files /dev/null and b/images/mosts/trophies.pal differ
diff --git a/images/mosts/trophies2.bin b/images/mosts/trophies2.bin
new file mode 100644
index 0000000..9d7f63b
Binary files /dev/null and b/images/mosts/trophies2.bin differ
diff --git a/images/mosts/trophies2.dat b/images/mosts/trophies2.dat
new file mode 100644
index 0000000..6edc181
Binary files /dev/null and b/images/mosts/trophies2.dat differ
diff --git a/images/mosts/trophies2.pal b/images/mosts/trophies2.pal
new file mode 100644
index 0000000..a4596f7
Binary files /dev/null and b/images/mosts/trophies2.pal differ
diff --git a/images/motorcycles.png b/images/motorcycles.png
new file mode 100644
index 0000000..5003582
Binary files /dev/null and b/images/motorcycles.png differ
diff --git a/images/new.gif b/images/new.gif
new file mode 100644
index 0000000..a56115f
Binary files /dev/null and b/images/new.gif differ
diff --git a/images/newpoll.png b/images/newpoll.png
new file mode 100644
index 0000000..41eff35
Binary files /dev/null and b/images/newpoll.png differ
diff --git a/images/newreply.png b/images/newreply.png
new file mode 100644
index 0000000..9c144fa
Binary files /dev/null and b/images/newreply.png differ
diff --git a/images/newthread.png b/images/newthread.png
new file mode 100644
index 0000000..b9a1c65
Binary files /dev/null and b/images/newthread.png differ
diff --git a/images/nightscheme_closedthreads.png b/images/nightscheme_closedthreads.png
new file mode 100644
index 0000000..4a87b90
Binary files /dev/null and b/images/nightscheme_closedthreads.png differ
diff --git a/images/nightscheme_hotclosedthreads.png b/images/nightscheme_hotclosedthreads.png
new file mode 100644
index 0000000..12e0425
Binary files /dev/null and b/images/nightscheme_hotclosedthreads.png differ
diff --git a/images/nightscheme_hotnewposts.png b/images/nightscheme_hotnewposts.png
new file mode 100644
index 0000000..8e8dca9
Binary files /dev/null and b/images/nightscheme_hotnewposts.png differ
diff --git a/images/nightscheme_hotthreads.png b/images/nightscheme_hotthreads.png
new file mode 100644
index 0000000..5bbdc7b
Binary files /dev/null and b/images/nightscheme_hotthreads.png differ
diff --git a/images/nightscheme_newposts.png b/images/nightscheme_newposts.png
new file mode 100644
index 0000000..7c0fbb5
Binary files /dev/null and b/images/nightscheme_newposts.png differ
diff --git a/images/nightscheme_starsbg.png b/images/nightscheme_starsbg.png
new file mode 100644
index 0000000..27b9b4f
Binary files /dev/null and b/images/nightscheme_starsbg.png differ
diff --git a/images/nopolls.png b/images/nopolls.png
new file mode 100644
index 0000000..9bc9ba0
Binary files /dev/null and b/images/nopolls.png differ
diff --git a/images/noted.png b/images/noted.png
new file mode 100644
index 0000000..2b35961
Binary files /dev/null and b/images/noted.png differ
diff --git a/images/num1/-.gif b/images/num1/-.gif
new file mode 100644
index 0000000..dd2da86
Binary files /dev/null and b/images/num1/-.gif differ
diff --git a/images/num1/0.gif b/images/num1/0.gif
new file mode 100644
index 0000000..faab295
Binary files /dev/null and b/images/num1/0.gif differ
diff --git a/images/num1/1.gif b/images/num1/1.gif
new file mode 100644
index 0000000..5851bda
Binary files /dev/null and b/images/num1/1.gif differ
diff --git a/images/num1/2.gif b/images/num1/2.gif
new file mode 100644
index 0000000..6920f90
Binary files /dev/null and b/images/num1/2.gif differ
diff --git a/images/num1/3.gif b/images/num1/3.gif
new file mode 100644
index 0000000..8a77c16
Binary files /dev/null and b/images/num1/3.gif differ
diff --git a/images/num1/4.gif b/images/num1/4.gif
new file mode 100644
index 0000000..193d0ed
Binary files /dev/null and b/images/num1/4.gif differ
diff --git a/images/num1/5.gif b/images/num1/5.gif
new file mode 100644
index 0000000..d1ec5e7
Binary files /dev/null and b/images/num1/5.gif differ
diff --git a/images/num1/6.gif b/images/num1/6.gif
new file mode 100644
index 0000000..a7f138e
Binary files /dev/null and b/images/num1/6.gif differ
diff --git a/images/num1/7.gif b/images/num1/7.gif
new file mode 100644
index 0000000..b814d30
Binary files /dev/null and b/images/num1/7.gif differ
diff --git a/images/num1/8.gif b/images/num1/8.gif
new file mode 100644
index 0000000..12f10c1
Binary files /dev/null and b/images/num1/8.gif differ
diff --git a/images/num1/9.gif b/images/num1/9.gif
new file mode 100644
index 0000000..16b5c3f
Binary files /dev/null and b/images/num1/9.gif differ
diff --git a/images/num1/A.gif b/images/num1/A.gif
new file mode 100644
index 0000000..3bde94b
Binary files /dev/null and b/images/num1/A.gif differ
diff --git a/images/num1/N.gif b/images/num1/N.gif
new file mode 100644
index 0000000..f20628e
Binary files /dev/null and b/images/num1/N.gif differ
diff --git a/images/num1/_.gif b/images/num1/_.gif
new file mode 100644
index 0000000..da95575
Binary files /dev/null and b/images/num1/_.gif differ
diff --git a/images/num1/averageiq.gif b/images/num1/averageiq.gif
new file mode 100644
index 0000000..21bed37
Binary files /dev/null and b/images/num1/averageiq.gif differ
diff --git a/images/num1/bar-off.gif b/images/num1/bar-off.gif
new file mode 100644
index 0000000..157b89c
Binary files /dev/null and b/images/num1/bar-off.gif differ
diff --git a/images/num1/bar-off.png b/images/num1/bar-off.png
new file mode 100644
index 0000000..5d64fac
Binary files /dev/null and b/images/num1/bar-off.png differ
diff --git a/images/num1/bar-on.gif b/images/num1/bar-on.gif
new file mode 100644
index 0000000..397c80a
Binary files /dev/null and b/images/num1/bar-on.gif differ
diff --git a/images/num1/bar-onred.gif b/images/num1/bar-onred.gif
new file mode 100644
index 0000000..c3db996
Binary files /dev/null and b/images/num1/bar-onred.gif differ
diff --git a/images/num1/bar-onred.png b/images/num1/bar-onred.png
new file mode 100644
index 0000000..83d7048
Binary files /dev/null and b/images/num1/bar-onred.png differ
diff --git a/images/num1/bar-onspecial.gif b/images/num1/bar-onspecial.gif
new file mode 100644
index 0000000..6ba8a21
Binary files /dev/null and b/images/num1/bar-onspecial.gif differ
diff --git a/images/num1/barleft.gif b/images/num1/barleft.gif
new file mode 100644
index 0000000..4e65f4a
Binary files /dev/null and b/images/num1/barleft.gif differ
diff --git a/images/num1/barleft.png b/images/num1/barleft.png
new file mode 100644
index 0000000..ea34763
Binary files /dev/null and b/images/num1/barleft.png differ
diff --git a/images/num1/barright.gif b/images/num1/barright.gif
new file mode 100644
index 0000000..cd7cb55
Binary files /dev/null and b/images/num1/barright.gif differ
diff --git a/images/num1/barright.png b/images/num1/barright.png
new file mode 100644
index 0000000..a187fa5
Binary files /dev/null and b/images/num1/barright.png differ
diff --git a/images/num1/exp.gif b/images/num1/exp.gif
new file mode 100644
index 0000000..ecdb4ba
Binary files /dev/null and b/images/num1/exp.gif differ
diff --git a/images/num1/fornext.gif b/images/num1/fornext.gif
new file mode 100644
index 0000000..a3a9c86
Binary files /dev/null and b/images/num1/fornext.gif differ
diff --git a/images/num1/level.gif b/images/num1/level.gif
new file mode 100644
index 0000000..dcbf42f
Binary files /dev/null and b/images/num1/level.gif differ
diff --git a/images/num1/posts.gif b/images/num1/posts.gif
new file mode 100644
index 0000000..4831c37
Binary files /dev/null and b/images/num1/posts.gif differ
diff --git a/images/num1/slash.gif b/images/num1/slash.gif
new file mode 100644
index 0000000..b09bcc7
Binary files /dev/null and b/images/num1/slash.gif differ
diff --git a/images/num2/-.gif b/images/num2/-.gif
new file mode 100644
index 0000000..c15c8de
Binary files /dev/null and b/images/num2/-.gif differ
diff --git a/images/num2/.listing b/images/num2/.listing
new file mode 100644
index 0000000..bb9ebe6
--- /dev/null
+++ b/images/num2/.listing
@@ -0,0 +1,22 @@
+-rwxrwx---   1 www-data www-acmlm       96 Nov 17  2005 -.gif
+-rwxrwx---   1 www-data www-acmlm      111 Nov 17  2005 0.gif
+-rwxrwx---   1 www-data www-acmlm      107 Nov 17  2005 1.gif
+-rwxrwx---   1 www-data www-acmlm      111 Nov 17  2005 2.gif
+-rwxrwx---   1 www-data www-acmlm      110 Nov 17  2005 3.gif
+-rwxrwx---   1 www-data www-acmlm      113 Nov 17  2005 4.gif
+-rwxrwx---   1 www-data www-acmlm      109 Nov 17  2005 5.gif
+-rwxrwx---   1 www-data www-acmlm      112 Nov 17  2005 6.gif
+-rwxrwx---   1 www-data www-acmlm      108 Nov 17  2005 7.gif
+-rwxrwx---   1 www-data www-acmlm      112 Nov 17  2005 8.gif
+-rwxrwx---   1 www-data www-acmlm      111 Nov 17  2005 9.gif
+-rwxrwx---   1 www-data www-acmlm      113 Nov 17  2005 A.gif
+-rwxrwx---   1 www-data www-acmlm      114 Nov 17  2005 N.gif
+-rwxrwx---   1 www-data www-acmlm       81 Nov 17  2005 bar-off.gif
+-rwxrwx---   1 www-data www-acmlm       81 Nov 17  2005 bar-on.gif
+-rwxrwx---   1 www-data www-acmlm       92 Nov 17  2005 barleft.gif
+-rwxrwx---   1 www-data www-acmlm       92 Nov 17  2005 barright.gif
+-rwxrwx---   1 www-data www-acmlm      147 Nov 17  2005 exp.gif
+-rwxrwx---   1 www-data www-acmlm      192 Nov 17  2005 fornext.gif
+-rwxrwx---   1 www-data www-acmlm      166 Nov 17  2005 level.gif
+-rwxrwx---   1 www-data www-acmlm      159 Nov 17  2005 posts.gif
+-rwxrwx---   1 www-data www-acmlm      102 Nov 17  2005 slash.gif
diff --git a/images/num2/0.gif b/images/num2/0.gif
new file mode 100644
index 0000000..ed2f8fe
Binary files /dev/null and b/images/num2/0.gif differ
diff --git a/images/num2/1.gif b/images/num2/1.gif
new file mode 100644
index 0000000..96832e2
Binary files /dev/null and b/images/num2/1.gif differ
diff --git a/images/num2/2.gif b/images/num2/2.gif
new file mode 100644
index 0000000..f84e714
Binary files /dev/null and b/images/num2/2.gif differ
diff --git a/images/num2/3.gif b/images/num2/3.gif
new file mode 100644
index 0000000..9bbea87
Binary files /dev/null and b/images/num2/3.gif differ
diff --git a/images/num2/4.gif b/images/num2/4.gif
new file mode 100644
index 0000000..5a8ec8e
Binary files /dev/null and b/images/num2/4.gif differ
diff --git a/images/num2/5.gif b/images/num2/5.gif
new file mode 100644
index 0000000..e36a6d3
Binary files /dev/null and b/images/num2/5.gif differ
diff --git a/images/num2/6.gif b/images/num2/6.gif
new file mode 100644
index 0000000..3b64f6a
Binary files /dev/null and b/images/num2/6.gif differ
diff --git a/images/num2/7.gif b/images/num2/7.gif
new file mode 100644
index 0000000..1bd7421
Binary files /dev/null and b/images/num2/7.gif differ
diff --git a/images/num2/8.gif b/images/num2/8.gif
new file mode 100644
index 0000000..fc18fff
Binary files /dev/null and b/images/num2/8.gif differ
diff --git a/images/num2/9.gif b/images/num2/9.gif
new file mode 100644
index 0000000..244c393
Binary files /dev/null and b/images/num2/9.gif differ
diff --git a/images/num2/A.gif b/images/num2/A.gif
new file mode 100644
index 0000000..0845630
Binary files /dev/null and b/images/num2/A.gif differ
diff --git a/images/num2/N.gif b/images/num2/N.gif
new file mode 100644
index 0000000..a97258c
Binary files /dev/null and b/images/num2/N.gif differ
diff --git a/images/num2/bar-off.gif b/images/num2/bar-off.gif
new file mode 100644
index 0000000..00a7065
Binary files /dev/null and b/images/num2/bar-off.gif differ
diff --git a/images/num2/bar-on.gif b/images/num2/bar-on.gif
new file mode 100644
index 0000000..3edeb64
Binary files /dev/null and b/images/num2/bar-on.gif differ
diff --git a/images/num2/barleft.gif b/images/num2/barleft.gif
new file mode 100644
index 0000000..932eaa3
Binary files /dev/null and b/images/num2/barleft.gif differ
diff --git a/images/num2/barright.gif b/images/num2/barright.gif
new file mode 100644
index 0000000..7a7221b
Binary files /dev/null and b/images/num2/barright.gif differ
diff --git a/images/num2/exp.gif b/images/num2/exp.gif
new file mode 100644
index 0000000..c7a140e
Binary files /dev/null and b/images/num2/exp.gif differ
diff --git a/images/num2/fornext.gif b/images/num2/fornext.gif
new file mode 100644
index 0000000..15d3e85
Binary files /dev/null and b/images/num2/fornext.gif differ
diff --git a/images/num2/level.gif b/images/num2/level.gif
new file mode 100644
index 0000000..9c47ac7
Binary files /dev/null and b/images/num2/level.gif differ
diff --git a/images/num2/posts.gif b/images/num2/posts.gif
new file mode 100644
index 0000000..476a9d4
Binary files /dev/null and b/images/num2/posts.gif differ
diff --git a/images/num2/slash.gif b/images/num2/slash.gif
new file mode 100644
index 0000000..804a4c1
Binary files /dev/null and b/images/num2/slash.gif differ
diff --git a/images/num3/-.gif b/images/num3/-.gif
new file mode 100644
index 0000000..e1f9c40
Binary files /dev/null and b/images/num3/-.gif differ
diff --git a/images/num3/0.gif b/images/num3/0.gif
new file mode 100644
index 0000000..75cfda3
Binary files /dev/null and b/images/num3/0.gif differ
diff --git a/images/num3/1.gif b/images/num3/1.gif
new file mode 100644
index 0000000..ca98e5f
Binary files /dev/null and b/images/num3/1.gif differ
diff --git a/images/num3/2.gif b/images/num3/2.gif
new file mode 100644
index 0000000..de0c134
Binary files /dev/null and b/images/num3/2.gif differ
diff --git a/images/num3/3.gif b/images/num3/3.gif
new file mode 100644
index 0000000..499a6e5
Binary files /dev/null and b/images/num3/3.gif differ
diff --git a/images/num3/4.gif b/images/num3/4.gif
new file mode 100644
index 0000000..7912227
Binary files /dev/null and b/images/num3/4.gif differ
diff --git a/images/num3/5.gif b/images/num3/5.gif
new file mode 100644
index 0000000..d19dd7b
Binary files /dev/null and b/images/num3/5.gif differ
diff --git a/images/num3/6.gif b/images/num3/6.gif
new file mode 100644
index 0000000..d4f395a
Binary files /dev/null and b/images/num3/6.gif differ
diff --git a/images/num3/7.gif b/images/num3/7.gif
new file mode 100644
index 0000000..2e4181f
Binary files /dev/null and b/images/num3/7.gif differ
diff --git a/images/num3/8.gif b/images/num3/8.gif
new file mode 100644
index 0000000..692c435
Binary files /dev/null and b/images/num3/8.gif differ
diff --git a/images/num3/9.gif b/images/num3/9.gif
new file mode 100644
index 0000000..2242394
Binary files /dev/null and b/images/num3/9.gif differ
diff --git a/images/num3/A.gif b/images/num3/A.gif
new file mode 100644
index 0000000..7db488d
Binary files /dev/null and b/images/num3/A.gif differ
diff --git a/images/num3/N.gif b/images/num3/N.gif
new file mode 100644
index 0000000..db0787f
Binary files /dev/null and b/images/num3/N.gif differ
diff --git a/images/num3/bar-off.gif b/images/num3/bar-off.gif
new file mode 100644
index 0000000..ab2a10c
Binary files /dev/null and b/images/num3/bar-off.gif differ
diff --git a/images/num3/bar-on.gif b/images/num3/bar-on.gif
new file mode 100644
index 0000000..8519e8e
Binary files /dev/null and b/images/num3/bar-on.gif differ
diff --git a/images/num3/barleft.gif b/images/num3/barleft.gif
new file mode 100644
index 0000000..31a554f
Binary files /dev/null and b/images/num3/barleft.gif differ
diff --git a/images/num3/barright.gif b/images/num3/barright.gif
new file mode 100644
index 0000000..fa6c388
Binary files /dev/null and b/images/num3/barright.gif differ
diff --git a/images/num3/exp.gif b/images/num3/exp.gif
new file mode 100644
index 0000000..204abd9
Binary files /dev/null and b/images/num3/exp.gif differ
diff --git a/images/num3/fornext.gif b/images/num3/fornext.gif
new file mode 100644
index 0000000..f18f46b
Binary files /dev/null and b/images/num3/fornext.gif differ
diff --git a/images/num3/level.gif b/images/num3/level.gif
new file mode 100644
index 0000000..2315ce3
Binary files /dev/null and b/images/num3/level.gif differ
diff --git a/images/num3/posts.gif b/images/num3/posts.gif
new file mode 100644
index 0000000..d0eb365
Binary files /dev/null and b/images/num3/posts.gif differ
diff --git a/images/num3/slash.gif b/images/num3/slash.gif
new file mode 100644
index 0000000..cdfe6e7
Binary files /dev/null and b/images/num3/slash.gif differ
diff --git a/images/ocarina.png b/images/ocarina.png
new file mode 100644
index 0000000..59dc409
Binary files /dev/null and b/images/ocarina.png differ
diff --git a/images/off.gif b/images/off.gif
new file mode 100644
index 0000000..2375eb1
Binary files /dev/null and b/images/off.gif differ
diff --git a/images/offhotnew.gif b/images/offhotnew.gif
new file mode 100644
index 0000000..af7cedd
Binary files /dev/null and b/images/offhotnew.gif differ
diff --git a/images/offnew.gif b/images/offnew.gif
new file mode 100644
index 0000000..8118c45
Binary files /dev/null and b/images/offnew.gif differ
diff --git a/images/old/hot.gif b/images/old/hot.gif
new file mode 100644
index 0000000..142c6de
Binary files /dev/null and b/images/old/hot.gif differ
diff --git a/images/old/hotnew.gif b/images/old/hotnew.gif
new file mode 100644
index 0000000..c49de11
Binary files /dev/null and b/images/old/hotnew.gif differ
diff --git a/images/old/hotoff.gif b/images/old/hotoff.gif
new file mode 100644
index 0000000..f0766b3
Binary files /dev/null and b/images/old/hotoff.gif differ
diff --git a/images/old/new.gif b/images/old/new.gif
new file mode 100644
index 0000000..17b68ff
Binary files /dev/null and b/images/old/new.gif differ
diff --git a/images/old/off.gif b/images/old/off.gif
new file mode 100644
index 0000000..9eebec8
Binary files /dev/null and b/images/old/off.gif differ
diff --git a/images/penaltyarea.gif b/images/penaltyarea.gif
new file mode 100644
index 0000000..8f0f088
Binary files /dev/null and b/images/penaltyarea.gif differ
diff --git a/images/pescatore.png b/images/pescatore.png
new file mode 100644
index 0000000..ae81261
Binary files /dev/null and b/images/pescatore.png differ
diff --git a/images/pinstripe/bluebg.png b/images/pinstripe/bluebg.png
new file mode 100644
index 0000000..45f8da9
Binary files /dev/null and b/images/pinstripe/bluebg.png differ
diff --git a/images/piticon-ok.png b/images/piticon-ok.png
new file mode 100644
index 0000000..5217a5c
Binary files /dev/null and b/images/piticon-ok.png differ
diff --git a/images/piticon-okx.png b/images/piticon-okx.png
new file mode 100644
index 0000000..316a3eb
Binary files /dev/null and b/images/piticon-okx.png differ
diff --git a/images/piticon-wait.png b/images/piticon-wait.png
new file mode 100644
index 0000000..830aa15
Binary files /dev/null and b/images/piticon-wait.png differ
diff --git a/images/poniecentral.gif b/images/poniecentral.gif
new file mode 100644
index 0000000..d8e5c94
Binary files /dev/null and b/images/poniecentral.gif differ
diff --git a/images/postbar/0.GIF b/images/postbar/0.GIF
new file mode 100644
index 0000000..e752d80
Binary files /dev/null and b/images/postbar/0.GIF differ
diff --git a/images/postbar/10.GIF b/images/postbar/10.GIF
new file mode 100644
index 0000000..f400813
Binary files /dev/null and b/images/postbar/10.GIF differ
diff --git a/images/postbar/3.GIF b/images/postbar/3.GIF
new file mode 100644
index 0000000..947a971
Binary files /dev/null and b/images/postbar/3.GIF differ
diff --git a/images/postbar/4.GIF b/images/postbar/4.GIF
new file mode 100644
index 0000000..04d41da
Binary files /dev/null and b/images/postbar/4.GIF differ
diff --git a/images/postbar/5.GIF b/images/postbar/5.GIF
new file mode 100644
index 0000000..87c1e02
Binary files /dev/null and b/images/postbar/5.GIF differ
diff --git a/images/postbar/6.GIF b/images/postbar/6.GIF
new file mode 100644
index 0000000..39fa7d5
Binary files /dev/null and b/images/postbar/6.GIF differ
diff --git a/images/postbar/7.GIF b/images/postbar/7.GIF
new file mode 100644
index 0000000..1819778
Binary files /dev/null and b/images/postbar/7.GIF differ
diff --git a/images/postbar/8.GIF b/images/postbar/8.GIF
new file mode 100644
index 0000000..9d93ebd
Binary files /dev/null and b/images/postbar/8.GIF differ
diff --git a/images/postbar/9.GIF b/images/postbar/9.GIF
new file mode 100644
index 0000000..4bc5fb0
Binary files /dev/null and b/images/postbar/9.GIF differ
diff --git a/images/poweredbyacmlm.gif b/images/poweredbyacmlm.gif
new file mode 100644
index 0000000..dd449f1
Binary files /dev/null and b/images/poweredbyacmlm.gif differ
diff --git a/images/pumpkinchan.png b/images/pumpkinchan.png
new file mode 100644
index 0000000..283d780
Binary files /dev/null and b/images/pumpkinchan.png differ
diff --git a/images/purple/darkbubblebg.jpg b/images/purple/darkbubblebg.jpg
new file mode 100644
index 0000000..350a7f0
Binary files /dev/null and b/images/purple/darkbubblebg.jpg differ
diff --git a/images/purple/newpollpurple.png b/images/purple/newpollpurple.png
new file mode 100644
index 0000000..0346d41
Binary files /dev/null and b/images/purple/newpollpurple.png differ
diff --git a/images/purple/newreplypurple.png b/images/purple/newreplypurple.png
new file mode 100644
index 0000000..fa45701
Binary files /dev/null and b/images/purple/newreplypurple.png differ
diff --git a/images/purple/newthreadpurple.png b/images/purple/newthreadpurple.png
new file mode 100644
index 0000000..690db10
Binary files /dev/null and b/images/purple/newthreadpurple.png differ
diff --git a/images/purple/purplebanner.png b/images/purple/purplebanner.png
new file mode 100644
index 0000000..b05ade7
Binary files /dev/null and b/images/purple/purplebanner.png differ
diff --git a/images/purple/threadclosedpurple.png b/images/purple/threadclosedpurple.png
new file mode 100644
index 0000000..f44aa7c
Binary files /dev/null and b/images/purple/threadclosedpurple.png differ
diff --git a/images/ranks/mario/babybowser.gif b/images/ranks/mario/babybowser.gif
new file mode 100644
index 0000000..e9b7959
Binary files /dev/null and b/images/ranks/mario/babybowser.gif differ
diff --git a/images/ranks/mario/babymario.gif b/images/ranks/mario/babymario.gif
new file mode 100644
index 0000000..29dc6f5
Binary files /dev/null and b/images/ranks/mario/babymario.gif differ
diff --git a/images/ranks/mario/bandit.gif b/images/ranks/mario/bandit.gif
new file mode 100644
index 0000000..ed5c563
Binary files /dev/null and b/images/ranks/mario/bandit.gif differ
diff --git a/images/ranks/mario/beetle.gif b/images/ranks/mario/beetle.gif
new file mode 100644
index 0000000..a30cfe6
Binary files /dev/null and b/images/ranks/mario/beetle.gif differ
diff --git a/images/ranks/mario/beezo.gif b/images/ranks/mario/beezo.gif
new file mode 100644
index 0000000..0d56a2f
Binary files /dev/null and b/images/ranks/mario/beezo.gif differ
diff --git a/images/ranks/mario/bigcheepcheep.gif b/images/ranks/mario/bigcheepcheep.gif
new file mode 100644
index 0000000..1e4bb83
Binary files /dev/null and b/images/ranks/mario/bigcheepcheep.gif differ
diff --git a/images/ranks/mario/birdogreen.gif b/images/ranks/mario/birdogreen.gif
new file mode 100644
index 0000000..59b1fa7
Binary files /dev/null and b/images/ranks/mario/birdogreen.gif differ
diff --git a/images/ranks/mario/birdopink.gif b/images/ranks/mario/birdopink.gif
new file mode 100644
index 0000000..bc7a402
Binary files /dev/null and b/images/ranks/mario/birdopink.gif differ
diff --git a/images/ranks/mario/birdored.gif b/images/ranks/mario/birdored.gif
new file mode 100644
index 0000000..76f23c0
Binary files /dev/null and b/images/ranks/mario/birdored.gif differ
diff --git a/images/ranks/mario/bloober.gif b/images/ranks/mario/bloober.gif
new file mode 100644
index 0000000..a0dd2c9
Binary files /dev/null and b/images/ranks/mario/bloober.gif differ
diff --git a/images/ranks/mario/bobomb.gif b/images/ranks/mario/bobomb.gif
new file mode 100644
index 0000000..42d9150
Binary files /dev/null and b/images/ranks/mario/bobomb.gif differ
diff --git a/images/ranks/mario/boo.gif b/images/ranks/mario/boo.gif
new file mode 100644
index 0000000..a55f911
Binary files /dev/null and b/images/ranks/mario/boo.gif differ
diff --git a/images/ranks/mario/boo2.gif b/images/ranks/mario/boo2.gif
new file mode 100644
index 0000000..e6c58bd
Binary files /dev/null and b/images/ranks/mario/boo2.gif differ
diff --git a/images/ranks/mario/boomboom.gif b/images/ranks/mario/boomboom.gif
new file mode 100644
index 0000000..ef352a5
Binary files /dev/null and b/images/ranks/mario/boomboom.gif differ
diff --git a/images/ranks/mario/boomerangbrother.gif b/images/ranks/mario/boomerangbrother.gif
new file mode 100644
index 0000000..43280ad
Binary files /dev/null and b/images/ranks/mario/boomerangbrother.gif differ
diff --git a/images/ranks/mario/bowser.gif b/images/ranks/mario/bowser.gif
new file mode 100644
index 0000000..9f8b73e
Binary files /dev/null and b/images/ranks/mario/bowser.gif differ
diff --git a/images/ranks/mario/bulletbill.gif b/images/ranks/mario/bulletbill.gif
new file mode 100644
index 0000000..f0b08cd
Binary files /dev/null and b/images/ranks/mario/bulletbill.gif differ
diff --git a/images/ranks/mario/busterbeetle.gif b/images/ranks/mario/busterbeetle.gif
new file mode 100644
index 0000000..45efe75
Binary files /dev/null and b/images/ranks/mario/busterbeetle.gif differ
diff --git a/images/ranks/mario/cheepcheep.gif b/images/ranks/mario/cheepcheep.gif
new file mode 100644
index 0000000..9133add
Binary files /dev/null and b/images/ranks/mario/cheepcheep.gif differ
diff --git a/images/ranks/mario/chuck.gif b/images/ranks/mario/chuck.gif
new file mode 100644
index 0000000..5d3c002
Binary files /dev/null and b/images/ranks/mario/chuck.gif differ
diff --git a/images/ranks/mario/cobrat.gif b/images/ranks/mario/cobrat.gif
new file mode 100644
index 0000000..9c0cdea
Binary files /dev/null and b/images/ranks/mario/cobrat.gif differ
diff --git a/images/ranks/mario/drybones.gif b/images/ranks/mario/drybones.gif
new file mode 100644
index 0000000..28b2dd4
Binary files /dev/null and b/images/ranks/mario/drybones.gif differ
diff --git a/images/ranks/mario/firebrother.gif b/images/ranks/mario/firebrother.gif
new file mode 100644
index 0000000..1534625
Binary files /dev/null and b/images/ranks/mario/firebrother.gif differ
diff --git a/images/ranks/mario/firesnake.gif b/images/ranks/mario/firesnake.gif
new file mode 100644
index 0000000..9c417d0
Binary files /dev/null and b/images/ranks/mario/firesnake.gif differ
diff --git a/images/ranks/mario/flurry.gif b/images/ranks/mario/flurry.gif
new file mode 100644
index 0000000..2da51b6
Binary files /dev/null and b/images/ranks/mario/flurry.gif differ
diff --git a/images/ranks/mario/fuzzball.gif b/images/ranks/mario/fuzzball.gif
new file mode 100644
index 0000000..f359879
Binary files /dev/null and b/images/ranks/mario/fuzzball.gif differ
diff --git a/images/ranks/mario/fuzzy.gif b/images/ranks/mario/fuzzy.gif
new file mode 100644
index 0000000..fb606e4
Binary files /dev/null and b/images/ranks/mario/fuzzy.gif differ
diff --git a/images/ranks/mario/giantgoomba.gif b/images/ranks/mario/giantgoomba.gif
new file mode 100644
index 0000000..42975b2
Binary files /dev/null and b/images/ranks/mario/giantgoomba.gif differ
diff --git a/images/ranks/mario/giantkoopa.gif b/images/ranks/mario/giantkoopa.gif
new file mode 100644
index 0000000..7c241ac
Binary files /dev/null and b/images/ranks/mario/giantkoopa.gif differ
diff --git a/images/ranks/mario/giantparatroopa.gif b/images/ranks/mario/giantparatroopa.gif
new file mode 100644
index 0000000..08e2c79
Binary files /dev/null and b/images/ranks/mario/giantparatroopa.gif differ
diff --git a/images/ranks/mario/giantredkoopa.gif b/images/ranks/mario/giantredkoopa.gif
new file mode 100644
index 0000000..5dfd29d
Binary files /dev/null and b/images/ranks/mario/giantredkoopa.gif differ
diff --git a/images/ranks/mario/giantredparatroopa.gif b/images/ranks/mario/giantredparatroopa.gif
new file mode 100644
index 0000000..04a7b31
Binary files /dev/null and b/images/ranks/mario/giantredparatroopa.gif differ
diff --git a/images/ranks/mario/goomba.gif b/images/ranks/mario/goomba.gif
new file mode 100644
index 0000000..f0c1b7b
Binary files /dev/null and b/images/ranks/mario/goomba.gif differ
diff --git a/images/ranks/mario/hammerbrother.gif b/images/ranks/mario/hammerbrother.gif
new file mode 100644
index 0000000..2462ec3
Binary files /dev/null and b/images/ranks/mario/hammerbrother.gif differ
diff --git a/images/ranks/mario/hedgehog.gif b/images/ranks/mario/hedgehog.gif
new file mode 100644
index 0000000..8b9a90c
Binary files /dev/null and b/images/ranks/mario/hedgehog.gif differ
diff --git a/images/ranks/mario/iggy.gif b/images/ranks/mario/iggy.gif
new file mode 100644
index 0000000..8d2652c
Binary files /dev/null and b/images/ranks/mario/iggy.gif differ
diff --git a/images/ranks/mario/kamek.gif b/images/ranks/mario/kamek.gif
new file mode 100644
index 0000000..49030b8
Binary files /dev/null and b/images/ranks/mario/kamek.gif differ
diff --git a/images/ranks/mario/kingyoshi.gif b/images/ranks/mario/kingyoshi.gif
new file mode 100644
index 0000000..1a1bfff
Binary files /dev/null and b/images/ranks/mario/kingyoshi.gif differ
diff --git a/images/ranks/mario/koopa.gif b/images/ranks/mario/koopa.gif
new file mode 100644
index 0000000..31e4133
Binary files /dev/null and b/images/ranks/mario/koopa.gif differ
diff --git a/images/ranks/mario/lakitu.gif b/images/ranks/mario/lakitu.gif
new file mode 100644
index 0000000..7c67174
Binary files /dev/null and b/images/ranks/mario/lakitu.gif differ
diff --git a/images/ranks/mario/lanternghost.gif b/images/ranks/mario/lanternghost.gif
new file mode 100644
index 0000000..c0fb407
Binary files /dev/null and b/images/ranks/mario/lanternghost.gif differ
diff --git a/images/ranks/mario/larry.gif b/images/ranks/mario/larry.gif
new file mode 100644
index 0000000..94b98f0
Binary files /dev/null and b/images/ranks/mario/larry.gif differ
diff --git a/images/ranks/mario/lavalotus.gif b/images/ranks/mario/lavalotus.gif
new file mode 100644
index 0000000..45f2b47
Binary files /dev/null and b/images/ranks/mario/lavalotus.gif differ
diff --git a/images/ranks/mario/lemmy.gif b/images/ranks/mario/lemmy.gif
new file mode 100644
index 0000000..bdd531b
Binary files /dev/null and b/images/ranks/mario/lemmy.gif differ
diff --git a/images/ranks/mario/ludwig.gif b/images/ranks/mario/ludwig.gif
new file mode 100644
index 0000000..be5f4e9
Binary files /dev/null and b/images/ranks/mario/ludwig.gif differ
diff --git a/images/ranks/mario/luigi_fire.gif b/images/ranks/mario/luigi_fire.gif
new file mode 100644
index 0000000..567be92
Binary files /dev/null and b/images/ranks/mario/luigi_fire.gif differ
diff --git a/images/ranks/mario/luigibig.gif b/images/ranks/mario/luigibig.gif
new file mode 100644
index 0000000..2b3d9a5
Binary files /dev/null and b/images/ranks/mario/luigibig.gif differ
diff --git a/images/ranks/mario/luigicape.gif b/images/ranks/mario/luigicape.gif
new file mode 100644
index 0000000..30e3e2e
Binary files /dev/null and b/images/ranks/mario/luigicape.gif differ
diff --git a/images/ranks/mario/luigismall.gif b/images/ranks/mario/luigismall.gif
new file mode 100644
index 0000000..5869f0e
Binary files /dev/null and b/images/ranks/mario/luigismall.gif differ
diff --git a/images/ranks/mario/luigistar.gif b/images/ranks/mario/luigistar.gif
new file mode 100644
index 0000000..92b35c6
Binary files /dev/null and b/images/ranks/mario/luigistar.gif differ
diff --git a/images/ranks/mario/mariobig.gif b/images/ranks/mario/mariobig.gif
new file mode 100644
index 0000000..7b99930
Binary files /dev/null and b/images/ranks/mario/mariobig.gif differ
diff --git a/images/ranks/mario/mariocape.gif b/images/ranks/mario/mariocape.gif
new file mode 100644
index 0000000..cf0489a
Binary files /dev/null and b/images/ranks/mario/mariocape.gif differ
diff --git a/images/ranks/mario/mariofire.gif b/images/ranks/mario/mariofire.gif
new file mode 100644
index 0000000..a35907f
Binary files /dev/null and b/images/ranks/mario/mariofire.gif differ
diff --git a/images/ranks/mario/mariosmall.gif b/images/ranks/mario/mariosmall.gif
new file mode 100644
index 0000000..e10b0c7
Binary files /dev/null and b/images/ranks/mario/mariosmall.gif differ
diff --git a/images/ranks/mario/mariostar.gif b/images/ranks/mario/mariostar.gif
new file mode 100644
index 0000000..504bad5
Binary files /dev/null and b/images/ranks/mario/mariostar.gif differ
diff --git a/images/ranks/mario/microgoomba.gif b/images/ranks/mario/microgoomba.gif
new file mode 100644
index 0000000..86c59e3
Binary files /dev/null and b/images/ranks/mario/microgoomba.gif differ
diff --git a/images/ranks/mario/mole.gif b/images/ranks/mario/mole.gif
new file mode 100644
index 0000000..a55f901
Binary files /dev/null and b/images/ranks/mario/mole.gif differ
diff --git a/images/ranks/mario/morton.gif b/images/ranks/mario/morton.gif
new file mode 100644
index 0000000..1c4bdcd
Binary files /dev/null and b/images/ranks/mario/morton.gif differ
diff --git a/images/ranks/mario/ninji.gif b/images/ranks/mario/ninji.gif
new file mode 100644
index 0000000..e6ce05e
Binary files /dev/null and b/images/ranks/mario/ninji.gif differ
diff --git a/images/ranks/mario/nipperplant.gif b/images/ranks/mario/nipperplant.gif
new file mode 100644
index 0000000..2f9cd4e
Binary files /dev/null and b/images/ranks/mario/nipperplant.gif differ
diff --git a/images/ranks/mario/panser.gif b/images/ranks/mario/panser.gif
new file mode 100644
index 0000000..0a89978
Binary files /dev/null and b/images/ranks/mario/panser.gif differ
diff --git a/images/ranks/mario/paragoomba.gif b/images/ranks/mario/paragoomba.gif
new file mode 100644
index 0000000..116350c
Binary files /dev/null and b/images/ranks/mario/paragoomba.gif differ
diff --git a/images/ranks/mario/paratroopa.gif b/images/ranks/mario/paratroopa.gif
new file mode 100644
index 0000000..c5387b8
Binary files /dev/null and b/images/ranks/mario/paratroopa.gif differ
diff --git a/images/ranks/mario/pokey.gif b/images/ranks/mario/pokey.gif
new file mode 100644
index 0000000..b21b2b5
Binary files /dev/null and b/images/ranks/mario/pokey.gif differ
diff --git a/images/ranks/mario/porcupo.gif b/images/ranks/mario/porcupo.gif
new file mode 100644
index 0000000..831558b
Binary files /dev/null and b/images/ranks/mario/porcupo.gif differ
diff --git a/images/ranks/mario/ptooie.gif b/images/ranks/mario/ptooie.gif
new file mode 100644
index 0000000..55521d8
Binary files /dev/null and b/images/ranks/mario/ptooie.gif differ
diff --git a/images/ranks/mario/ptooie2.gif b/images/ranks/mario/ptooie2.gif
new file mode 100644
index 0000000..5c71f4e
Binary files /dev/null and b/images/ranks/mario/ptooie2.gif differ
diff --git a/images/ranks/mario/redcheepcheep.gif b/images/ranks/mario/redcheepcheep.gif
new file mode 100644
index 0000000..36dc6a1
Binary files /dev/null and b/images/ranks/mario/redcheepcheep.gif differ
diff --git a/images/ranks/mario/redgoomba.gif b/images/ranks/mario/redgoomba.gif
new file mode 100644
index 0000000..625553f
Binary files /dev/null and b/images/ranks/mario/redgoomba.gif differ
diff --git a/images/ranks/mario/redkoopa.gif b/images/ranks/mario/redkoopa.gif
new file mode 100644
index 0000000..7b6be4d
Binary files /dev/null and b/images/ranks/mario/redkoopa.gif differ
diff --git a/images/ranks/mario/redparagoomba.gif b/images/ranks/mario/redparagoomba.gif
new file mode 100644
index 0000000..99d72b8
Binary files /dev/null and b/images/ranks/mario/redparagoomba.gif differ
diff --git a/images/ranks/mario/redparatroopa.gif b/images/ranks/mario/redparatroopa.gif
new file mode 100644
index 0000000..0e2e0dc
Binary files /dev/null and b/images/ranks/mario/redparatroopa.gif differ
diff --git a/images/ranks/mario/redsuperkoopa.gif b/images/ranks/mario/redsuperkoopa.gif
new file mode 100644
index 0000000..8f99629
Binary files /dev/null and b/images/ranks/mario/redsuperkoopa.gif differ
diff --git a/images/ranks/mario/rex.gif b/images/ranks/mario/rex.gif
new file mode 100644
index 0000000..cb7ba41
Binary files /dev/null and b/images/ranks/mario/rex.gif differ
diff --git a/images/ranks/mario/roy.gif b/images/ranks/mario/roy.gif
new file mode 100644
index 0000000..8a330d7
Binary files /dev/null and b/images/ranks/mario/roy.gif differ
diff --git a/images/ranks/mario/shyguy.gif b/images/ranks/mario/shyguy.gif
new file mode 100644
index 0000000..ccd3ca9
Binary files /dev/null and b/images/ranks/mario/shyguy.gif differ
diff --git a/images/ranks/mario/sledgebrother.gif b/images/ranks/mario/sledgebrother.gif
new file mode 100644
index 0000000..4a165b7
Binary files /dev/null and b/images/ranks/mario/sledgebrother.gif differ
diff --git a/images/ranks/mario/snifit.gif b/images/ranks/mario/snifit.gif
new file mode 100644
index 0000000..832a971
Binary files /dev/null and b/images/ranks/mario/snifit.gif differ
diff --git a/images/ranks/mario/spike.gif b/images/ranks/mario/spike.gif
new file mode 100644
index 0000000..cbb774e
Binary files /dev/null and b/images/ranks/mario/spike.gif differ
diff --git a/images/ranks/mario/spiny.gif b/images/ranks/mario/spiny.gif
new file mode 100644
index 0000000..7d78893
Binary files /dev/null and b/images/ranks/mario/spiny.gif differ
diff --git a/images/ranks/mario/superkoopa.gif b/images/ranks/mario/superkoopa.gif
new file mode 100644
index 0000000..ab70584
Binary files /dev/null and b/images/ranks/mario/superkoopa.gif differ
diff --git a/images/ranks/mario/thwomp.gif b/images/ranks/mario/thwomp.gif
new file mode 100644
index 0000000..2aef1b3
Binary files /dev/null and b/images/ranks/mario/thwomp.gif differ
diff --git a/images/ranks/mario/triclyde.gif b/images/ranks/mario/triclyde.gif
new file mode 100644
index 0000000..a1123b7
Binary files /dev/null and b/images/ranks/mario/triclyde.gif differ
diff --git a/images/ranks/mario/volcanolotus.gif b/images/ranks/mario/volcanolotus.gif
new file mode 100644
index 0000000..52d6b69
Binary files /dev/null and b/images/ranks/mario/volcanolotus.gif differ
diff --git a/images/ranks/mario/wart.gif b/images/ranks/mario/wart.gif
new file mode 100644
index 0000000..d4e608b
Binary files /dev/null and b/images/ranks/mario/wart.gif differ
diff --git a/images/ranks/mario/wendy.gif b/images/ranks/mario/wendy.gif
new file mode 100644
index 0000000..4cc45dc
Binary files /dev/null and b/images/ranks/mario/wendy.gif differ
diff --git a/images/ranks/mario/yoshi.gif b/images/ranks/mario/yoshi.gif
new file mode 100644
index 0000000..ac40cf6
Binary files /dev/null and b/images/ranks/mario/yoshi.gif differ
diff --git a/images/ranks/mario/yoshiblue.gif b/images/ranks/mario/yoshiblue.gif
new file mode 100644
index 0000000..17e7342
Binary files /dev/null and b/images/ranks/mario/yoshiblue.gif differ
diff --git a/images/ranks/mario/yoshired.gif b/images/ranks/mario/yoshired.gif
new file mode 100644
index 0000000..6f69b59
Binary files /dev/null and b/images/ranks/mario/yoshired.gif differ
diff --git a/images/ranks/mario/yoshiyellow.gif b/images/ranks/mario/yoshiyellow.gif
new file mode 100644
index 0000000..cf625b2
Binary files /dev/null and b/images/ranks/mario/yoshiyellow.gif differ
diff --git a/images/ranks/tgm/1.png b/images/ranks/tgm/1.png
new file mode 100644
index 0000000..d821e0c
Binary files /dev/null and b/images/ranks/tgm/1.png differ
diff --git a/images/ranks/tgm/2.png b/images/ranks/tgm/2.png
new file mode 100644
index 0000000..357c54f
Binary files /dev/null and b/images/ranks/tgm/2.png differ
diff --git a/images/ranks/tgm/3.png b/images/ranks/tgm/3.png
new file mode 100644
index 0000000..1e56ff0
Binary files /dev/null and b/images/ranks/tgm/3.png differ
diff --git a/images/ranks/tgm/4.png b/images/ranks/tgm/4.png
new file mode 100644
index 0000000..98ddae1
Binary files /dev/null and b/images/ranks/tgm/4.png differ
diff --git a/images/ranks/tgm/5.png b/images/ranks/tgm/5.png
new file mode 100644
index 0000000..f577db9
Binary files /dev/null and b/images/ranks/tgm/5.png differ
diff --git a/images/ranks/tgm/6.png b/images/ranks/tgm/6.png
new file mode 100644
index 0000000..6322bac
Binary files /dev/null and b/images/ranks/tgm/6.png differ
diff --git a/images/ranks/tgm/7.png b/images/ranks/tgm/7.png
new file mode 100644
index 0000000..cebb29a
Binary files /dev/null and b/images/ranks/tgm/7.png differ
diff --git a/images/ranks/tgm/8.png b/images/ranks/tgm/8.png
new file mode 100644
index 0000000..dfb6657
Binary files /dev/null and b/images/ranks/tgm/8.png differ
diff --git a/images/ranks/tgm/9.png b/images/ranks/tgm/9.png
new file mode 100644
index 0000000..a18ef7a
Binary files /dev/null and b/images/ranks/tgm/9.png differ
diff --git a/images/ranks/tgm/gm.png b/images/ranks/tgm/gm.png
new file mode 100644
index 0000000..9e64801
Binary files /dev/null and b/images/ranks/tgm/gm.png differ
diff --git a/images/ranks/tgm/s1.png b/images/ranks/tgm/s1.png
new file mode 100644
index 0000000..03bd493
Binary files /dev/null and b/images/ranks/tgm/s1.png differ
diff --git a/images/ranks/tgm/s2.png b/images/ranks/tgm/s2.png
new file mode 100644
index 0000000..64f7e1e
Binary files /dev/null and b/images/ranks/tgm/s2.png differ
diff --git a/images/ranks/tgm/s3.png b/images/ranks/tgm/s3.png
new file mode 100644
index 0000000..a6eeaa9
Binary files /dev/null and b/images/ranks/tgm/s3.png differ
diff --git a/images/ranks/tgm/s4.png b/images/ranks/tgm/s4.png
new file mode 100644
index 0000000..d5bc05e
Binary files /dev/null and b/images/ranks/tgm/s4.png differ
diff --git a/images/ranks/tgm/s5.png b/images/ranks/tgm/s5.png
new file mode 100644
index 0000000..f8f9f34
Binary files /dev/null and b/images/ranks/tgm/s5.png differ
diff --git a/images/ranks/tgm/s6.png b/images/ranks/tgm/s6.png
new file mode 100644
index 0000000..3bdeb62
Binary files /dev/null and b/images/ranks/tgm/s6.png differ
diff --git a/images/ranks/tgm/s7.png b/images/ranks/tgm/s7.png
new file mode 100644
index 0000000..5a9a3f0
Binary files /dev/null and b/images/ranks/tgm/s7.png differ
diff --git a/images/ranks/tgm/s8.png b/images/ranks/tgm/s8.png
new file mode 100644
index 0000000..2c5ec3a
Binary files /dev/null and b/images/ranks/tgm/s8.png differ
diff --git a/images/ranks/tgm/s9.png b/images/ranks/tgm/s9.png
new file mode 100644
index 0000000..f6930d2
Binary files /dev/null and b/images/ranks/tgm/s9.png differ
diff --git a/images/reject.png b/images/reject.png
new file mode 100644
index 0000000..b3f51bd
Binary files /dev/null and b/images/reject.png differ
diff --git a/images/rejected.png b/images/rejected.png
new file mode 100644
index 0000000..657c223
Binary files /dev/null and b/images/rejected.png differ
diff --git a/images/reportbugs.png b/images/reportbugs.png
new file mode 100644
index 0000000..93fd73c
Binary files /dev/null and b/images/reportbugs.png differ
diff --git a/images/rereggie.png b/images/rereggie.png
new file mode 100644
index 0000000..aa06379
Binary files /dev/null and b/images/rereggie.png differ
diff --git a/images/rpg/font.png b/images/rpg/font.png
new file mode 100644
index 0000000..791231f
Binary files /dev/null and b/images/rpg/font.png differ
diff --git a/images/rpg/fontgrid.png b/images/rpg/fontgrid.png
new file mode 100644
index 0000000..d7ec84b
Binary files /dev/null and b/images/rpg/fontgrid.png differ
diff --git a/images/sankachan.png b/images/sankachan.png
new file mode 100644
index 0000000..9223048
Binary files /dev/null and b/images/sankachan.png differ
diff --git a/images/secretbg.jpg b/images/secretbg.jpg
new file mode 100644
index 0000000..48b352c
Binary files /dev/null and b/images/secretbg.jpg differ
diff --git a/images/smilies/affun.gif b/images/smilies/affun.gif
new file mode 100644
index 0000000..4fe80b6
Binary files /dev/null and b/images/smilies/affun.gif differ
diff --git a/images/smilies/annoyed.gif b/images/smilies/annoyed.gif
new file mode 100644
index 0000000..ee1b90a
Binary files /dev/null and b/images/smilies/annoyed.gif differ
diff --git a/images/smilies/approved.gif b/images/smilies/approved.gif
new file mode 100644
index 0000000..4e437e6
Binary files /dev/null and b/images/smilies/approved.gif differ
diff --git a/images/smilies/argh.gif b/images/smilies/argh.gif
new file mode 100644
index 0000000..71066fc
Binary files /dev/null and b/images/smilies/argh.gif differ
diff --git a/images/smilies/awesome.png b/images/smilies/awesome.png
new file mode 100644
index 0000000..67435a5
Binary files /dev/null and b/images/smilies/awesome.png differ
diff --git a/images/smilies/awesomexz.png b/images/smilies/awesomexz.png
new file mode 100644
index 0000000..681f843
Binary files /dev/null and b/images/smilies/awesomexz.png differ
diff --git a/images/smilies/baby.gif b/images/smilies/baby.gif
new file mode 100644
index 0000000..6ed9806
Binary files /dev/null and b/images/smilies/baby.gif differ
diff --git a/images/smilies/bigeyes.gif b/images/smilies/bigeyes.gif
new file mode 100644
index 0000000..15e68c7
Binary files /dev/null and b/images/smilies/bigeyes.gif differ
diff --git a/images/smilies/bigeyes2.gif b/images/smilies/bigeyes2.gif
new file mode 100644
index 0000000..9f4ddd5
Binary files /dev/null and b/images/smilies/bigeyes2.gif differ
diff --git a/images/smilies/biggrin.gif b/images/smilies/biggrin.gif
new file mode 100644
index 0000000..f129263
Binary files /dev/null and b/images/smilies/biggrin.gif differ
diff --git a/images/smilies/bigsad.gif b/images/smilies/bigsad.gif
new file mode 100644
index 0000000..01f12ed
Binary files /dev/null and b/images/smilies/bigsad.gif differ
diff --git a/images/smilies/blank.gif b/images/smilies/blank.gif
new file mode 100644
index 0000000..ebd8add
Binary files /dev/null and b/images/smilies/blank.gif differ
diff --git a/images/smilies/boatanchor.png b/images/smilies/boatanchor.png
new file mode 100644
index 0000000..ca95c12
Binary files /dev/null and b/images/smilies/boatanchor.png differ
diff --git a/images/smilies/cry.gif b/images/smilies/cry.gif
new file mode 100644
index 0000000..e6d764a
Binary files /dev/null and b/images/smilies/cry.gif differ
diff --git a/images/smilies/cute.gif b/images/smilies/cute.gif
new file mode 100644
index 0000000..3baadd3
Binary files /dev/null and b/images/smilies/cute.gif differ
diff --git a/images/smilies/cute2.gif b/images/smilies/cute2.gif
new file mode 100644
index 0000000..ddcc479
Binary files /dev/null and b/images/smilies/cute2.gif differ
diff --git a/images/smilies/damnyou.gif b/images/smilies/damnyou.gif
new file mode 100644
index 0000000..492bd12
Binary files /dev/null and b/images/smilies/damnyou.gif differ
diff --git a/images/smilies/darkaffun.gif b/images/smilies/darkaffun.gif
new file mode 100644
index 0000000..7a86b17
Binary files /dev/null and b/images/smilies/darkaffun.gif differ
diff --git a/images/smilies/denied.gif b/images/smilies/denied.gif
new file mode 100644
index 0000000..a4dfbb2
Binary files /dev/null and b/images/smilies/denied.gif differ
diff --git a/images/smilies/dizzy.gif b/images/smilies/dizzy.gif
new file mode 100644
index 0000000..d0a4a2d
Binary files /dev/null and b/images/smilies/dizzy.gif differ
diff --git a/images/smilies/drool.gif b/images/smilies/drool.gif
new file mode 100644
index 0000000..23bcdef
Binary files /dev/null and b/images/smilies/drool.gif differ
diff --git a/images/smilies/durnip.gif b/images/smilies/durnip.gif
new file mode 100644
index 0000000..25c5c9d
Binary files /dev/null and b/images/smilies/durnip.gif differ
diff --git a/images/smilies/durnip2.gif b/images/smilies/durnip2.gif
new file mode 100644
index 0000000..8188be2
Binary files /dev/null and b/images/smilies/durnip2.gif differ
diff --git a/images/smilies/eek.gif b/images/smilies/eek.gif
new file mode 100644
index 0000000..15f53b8
Binary files /dev/null and b/images/smilies/eek.gif differ
diff --git a/images/smilies/emot-colbert.gif b/images/smilies/emot-colbert.gif
new file mode 100644
index 0000000..b09e25f
Binary files /dev/null and b/images/smilies/emot-colbert.gif differ
diff --git a/images/smilies/emot-effort.gif b/images/smilies/emot-effort.gif
new file mode 100644
index 0000000..12837d4
Binary files /dev/null and b/images/smilies/emot-effort.gif differ
diff --git a/images/smilies/emot-laffotarget.gif b/images/smilies/emot-laffotarget.gif
new file mode 100644
index 0000000..dcbd73e
Binary files /dev/null and b/images/smilies/emot-laffotarget.gif differ
diff --git a/images/smilies/emot-protarget.gif b/images/smilies/emot-protarget.gif
new file mode 100644
index 0000000..8799580
Binary files /dev/null and b/images/smilies/emot-protarget.gif differ
diff --git a/images/smilies/emot-shepface.gif b/images/smilies/emot-shepface.gif
new file mode 100644
index 0000000..db04157
Binary files /dev/null and b/images/smilies/emot-shepface.gif differ
diff --git a/images/smilies/eng101.gif b/images/smilies/eng101.gif
new file mode 100644
index 0000000..6061e1b
Binary files /dev/null and b/images/smilies/eng101.gif differ
diff --git a/images/smilies/eng101.png b/images/smilies/eng101.png
new file mode 100644
index 0000000..354ecdc
Binary files /dev/null and b/images/smilies/eng101.png differ
diff --git a/images/smilies/evil.gif b/images/smilies/evil.gif
new file mode 100644
index 0000000..b361e16
Binary files /dev/null and b/images/smilies/evil.gif differ
diff --git a/images/smilies/ewww.gif b/images/smilies/ewww.gif
new file mode 100644
index 0000000..ad1acd4
Binary files /dev/null and b/images/smilies/ewww.gif differ
diff --git a/images/smilies/eyeshift.gif b/images/smilies/eyeshift.gif
new file mode 100644
index 0000000..dde5071
Binary files /dev/null and b/images/smilies/eyeshift.gif differ
diff --git a/images/smilies/eyeshift2.gif b/images/smilies/eyeshift2.gif
new file mode 100644
index 0000000..0faa287
Binary files /dev/null and b/images/smilies/eyeshift2.gif differ
diff --git a/images/smilies/flunked.png b/images/smilies/flunked.png
new file mode 100644
index 0000000..3045261
Binary files /dev/null and b/images/smilies/flunked.png differ
diff --git a/images/smilies/frown.gif b/images/smilies/frown.gif
new file mode 100644
index 0000000..c715319
Binary files /dev/null and b/images/smilies/frown.gif differ
diff --git a/images/smilies/glare.png b/images/smilies/glare.png
new file mode 100644
index 0000000..2535c93
Binary files /dev/null and b/images/smilies/glare.png differ
diff --git a/images/smilies/glasses.gif b/images/smilies/glasses.gif
new file mode 100644
index 0000000..9141b68
Binary files /dev/null and b/images/smilies/glasses.gif differ
diff --git a/images/smilies/gonk.gif b/images/smilies/gonk.gif
new file mode 100644
index 0000000..66f08d7
Binary files /dev/null and b/images/smilies/gonk.gif differ
diff --git a/images/smilies/heart2.gif b/images/smilies/heart2.gif
new file mode 100644
index 0000000..129e1d3
Binary files /dev/null and b/images/smilies/heart2.gif differ
diff --git a/images/smilies/icon_cool.gif b/images/smilies/icon_cool.gif
new file mode 100644
index 0000000..cead030
Binary files /dev/null and b/images/smilies/icon_cool.gif differ
diff --git a/images/smilies/icon_lol.gif b/images/smilies/icon_lol.gif
new file mode 100644
index 0000000..374ba15
Binary files /dev/null and b/images/smilies/icon_lol.gif differ
diff --git a/images/smilies/jawdrop.gif b/images/smilies/jawdrop.gif
new file mode 100644
index 0000000..d669981
Binary files /dev/null and b/images/smilies/jawdrop.gif differ
diff --git a/images/smilies/laheart.gif b/images/smilies/laheart.gif
new file mode 100644
index 0000000..a5942b1
Binary files /dev/null and b/images/smilies/laheart.gif differ
diff --git a/images/smilies/lol.gif b/images/smilies/lol.gif
new file mode 100644
index 0000000..bf72d17
Binary files /dev/null and b/images/smilies/lol.gif differ
diff --git a/images/smilies/mad.gif b/images/smilies/mad.gif
new file mode 100644
index 0000000..eb720f2
Binary files /dev/null and b/images/smilies/mad.gif differ
diff --git a/images/smilies/magick.gif b/images/smilies/magick.gif
new file mode 100644
index 0000000..0ac5d3c
Binary files /dev/null and b/images/smilies/magick.gif differ
diff --git a/images/smilies/meow.gif b/images/smilies/meow.gif
new file mode 100644
index 0000000..da838c1
Binary files /dev/null and b/images/smilies/meow.gif differ
diff --git a/images/smilies/nyan.001.gif b/images/smilies/nyan.001.gif
new file mode 100644
index 0000000..22acbf6
Binary files /dev/null and b/images/smilies/nyan.001.gif differ
diff --git a/images/smilies/ohdear.png b/images/smilies/ohdear.png
new file mode 100644
index 0000000..9de5cd6
Binary files /dev/null and b/images/smilies/ohdear.png differ
diff --git a/images/smilies/pacsome.png b/images/smilies/pacsome.png
new file mode 100644
index 0000000..7f5b5a2
Binary files /dev/null and b/images/smilies/pacsome.png differ
diff --git a/images/smilies/raddmad.gif b/images/smilies/raddmad.gif
new file mode 100644
index 0000000..d22016f
Binary files /dev/null and b/images/smilies/raddmad.gif differ
diff --git a/images/smilies/raddrock.gif b/images/smilies/raddrock.gif
new file mode 100644
index 0000000..ff85fc5
Binary files /dev/null and b/images/smilies/raddrock.gif differ
diff --git a/images/smilies/raddsigh2.gif b/images/smilies/raddsigh2.gif
new file mode 100644
index 0000000..f2fec66
Binary files /dev/null and b/images/smilies/raddsigh2.gif differ
diff --git a/images/smilies/raddstand.gif b/images/smilies/raddstand.gif
new file mode 100644
index 0000000..ac15481
Binary files /dev/null and b/images/smilies/raddstand.gif differ
diff --git a/images/smilies/raddwink.gif b/images/smilies/raddwink.gif
new file mode 100644
index 0000000..af5c6f9
Binary files /dev/null and b/images/smilies/raddwink.gif differ
diff --git a/images/smilies/raddwow.gif b/images/smilies/raddwow.gif
new file mode 100644
index 0000000..7bbdc36
Binary files /dev/null and b/images/smilies/raddwow.gif differ
diff --git a/images/smilies/ranbowdash.001.png b/images/smilies/ranbowdash.001.png
new file mode 100644
index 0000000..727d1cf
Binary files /dev/null and b/images/smilies/ranbowdash.001.png differ
diff --git a/images/smilies/rlaugh.gif b/images/smilies/rlaugh.gif
new file mode 100644
index 0000000..4064d30
Binary files /dev/null and b/images/smilies/rlaugh.gif differ
diff --git a/images/smilies/rofl.gif b/images/smilies/rofl.gif
new file mode 100644
index 0000000..097e066
Binary files /dev/null and b/images/smilies/rofl.gif differ
diff --git a/images/smilies/roflbar.gif b/images/smilies/roflbar.gif
new file mode 100644
index 0000000..a80ae2f
Binary files /dev/null and b/images/smilies/roflbar.gif differ
diff --git a/images/smilies/roflx.gif b/images/smilies/roflx.gif
new file mode 100644
index 0000000..3386cf2
Binary files /dev/null and b/images/smilies/roflx.gif differ
diff --git a/images/smilies/shiftleft.gif b/images/smilies/shiftleft.gif
new file mode 100644
index 0000000..3a7dd7a
Binary files /dev/null and b/images/smilies/shiftleft.gif differ
diff --git a/images/smilies/shiftright.gif b/images/smilies/shiftright.gif
new file mode 100644
index 0000000..8a514bb
Binary files /dev/null and b/images/smilies/shiftright.gif differ
diff --git a/images/smilies/sick.gif b/images/smilies/sick.gif
new file mode 100644
index 0000000..7751827
Binary files /dev/null and b/images/smilies/sick.gif differ
diff --git a/images/smilies/smb2smileyc.png b/images/smilies/smb2smileyc.png
new file mode 100644
index 0000000..1a3c67f
Binary files /dev/null and b/images/smilies/smb2smileyc.png differ
diff --git a/images/smilies/smile.gif b/images/smilies/smile.gif
new file mode 100644
index 0000000..7c634ba
Binary files /dev/null and b/images/smilies/smile.gif differ
diff --git a/images/smilies/smile2.png b/images/smilies/smile2.png
new file mode 100644
index 0000000..d489f5b
Binary files /dev/null and b/images/smilies/smile2.png differ
diff --git a/images/smilies/smilespin.gif b/images/smilies/smilespin.gif
new file mode 100644
index 0000000..44c60c3
Binary files /dev/null and b/images/smilies/smilespin.gif differ
diff --git a/images/smilies/smilespin2.gif b/images/smilies/smilespin2.gif
new file mode 100644
index 0000000..d41e3ec
Binary files /dev/null and b/images/smilies/smilespin2.gif differ
diff --git a/images/smilies/smugdra.png b/images/smilies/smugdra.png
new file mode 100644
index 0000000..48c69ae
Binary files /dev/null and b/images/smilies/smugdra.png differ
diff --git a/images/smilies/specialed.gif b/images/smilies/specialed.gif
new file mode 100644
index 0000000..d4a06ad
Binary files /dev/null and b/images/smilies/specialed.gif differ
diff --git a/images/smilies/specialed.png b/images/smilies/specialed.png
new file mode 100644
index 0000000..2b70601
Binary files /dev/null and b/images/smilies/specialed.png differ
diff --git a/images/smilies/spinnaz.gif b/images/smilies/spinnaz.gif
new file mode 100644
index 0000000..ca39b7d
Binary files /dev/null and b/images/smilies/spinnaz.gif differ
diff --git a/images/smilies/superd.png b/images/smilies/superd.png
new file mode 100644
index 0000000..1bcdded
Binary files /dev/null and b/images/smilies/superd.png differ
diff --git a/images/smilies/terror.gif b/images/smilies/terror.gif
new file mode 100644
index 0000000..5882864
Binary files /dev/null and b/images/smilies/terror.gif differ
diff --git a/images/smilies/terrormyk.gif b/images/smilies/terrormyk.gif
new file mode 100644
index 0000000..a070819
Binary files /dev/null and b/images/smilies/terrormyk.gif differ
diff --git a/images/smilies/tongue.gif b/images/smilies/tongue.gif
new file mode 100644
index 0000000..b2ea2ac
Binary files /dev/null and b/images/smilies/tongue.gif differ
diff --git a/images/smilies/toot.png b/images/smilies/toot.png
new file mode 100644
index 0000000..ab8a98d
Binary files /dev/null and b/images/smilies/toot.png differ
diff --git a/images/smilies/toot2.gif b/images/smilies/toot2.gif
new file mode 100644
index 0000000..2b5b249
Binary files /dev/null and b/images/smilies/toot2.gif differ
diff --git a/images/smilies/turnip.gif b/images/smilies/turnip.gif
new file mode 100644
index 0000000..ac3021a
Binary files /dev/null and b/images/smilies/turnip.gif differ
diff --git a/images/smilies/v.gif b/images/smilies/v.gif
new file mode 100644
index 0000000..17e1869
Binary files /dev/null and b/images/smilies/v.gif differ
diff --git a/images/smilies/vamp.gif b/images/smilies/vamp.gif
new file mode 100644
index 0000000..25d365f
Binary files /dev/null and b/images/smilies/vamp.gif differ
diff --git a/images/smilies/wink.gif b/images/smilies/wink.gif
new file mode 100644
index 0000000..d091ce0
Binary files /dev/null and b/images/smilies/wink.gif differ
diff --git a/images/smilies/wobbly.gif b/images/smilies/wobbly.gif
new file mode 100644
index 0000000..bd568e6
Binary files /dev/null and b/images/smilies/wobbly.gif differ
diff --git a/images/smilies/woot.gif b/images/smilies/woot.gif
new file mode 100644
index 0000000..c6b1b78
Binary files /dev/null and b/images/smilies/woot.gif differ
diff --git a/images/smilies/words.gif b/images/smilies/words.gif
new file mode 100644
index 0000000..29f627f
Binary files /dev/null and b/images/smilies/words.gif differ
diff --git a/images/smilies/yuck.gif b/images/smilies/yuck.gif
new file mode 100644
index 0000000..74a01f6
Binary files /dev/null and b/images/smilies/yuck.gif differ
diff --git a/images/smilies2/anime.gif b/images/smilies2/anime.gif
new file mode 100644
index 0000000..3fde730
Binary files /dev/null and b/images/smilies2/anime.gif differ
diff --git a/images/smilies2/anime2.gif b/images/smilies2/anime2.gif
new file mode 100644
index 0000000..b6b1383
Binary files /dev/null and b/images/smilies2/anime2.gif differ
diff --git a/images/smilies2/annoyed.gif b/images/smilies2/annoyed.gif
new file mode 100644
index 0000000..feda854
Binary files /dev/null and b/images/smilies2/annoyed.gif differ
diff --git a/images/smilies2/approved.gif b/images/smilies2/approved.gif
new file mode 100644
index 0000000..4e437e6
Binary files /dev/null and b/images/smilies2/approved.gif differ
diff --git a/images/smilies2/baby.gif b/images/smilies2/baby.gif
new file mode 100644
index 0000000..6ed9806
Binary files /dev/null and b/images/smilies2/baby.gif differ
diff --git a/images/smilies2/bigeyes.gif b/images/smilies2/bigeyes.gif
new file mode 100644
index 0000000..774c7fb
Binary files /dev/null and b/images/smilies2/bigeyes.gif differ
diff --git a/images/smilies2/bigeyes2.gif b/images/smilies2/bigeyes2.gif
new file mode 100644
index 0000000..375fc29
Binary files /dev/null and b/images/smilies2/bigeyes2.gif differ
diff --git a/images/smilies2/biggrin.gif b/images/smilies2/biggrin.gif
new file mode 100644
index 0000000..f302908
Binary files /dev/null and b/images/smilies2/biggrin.gif differ
diff --git a/images/smilies2/blank.gif b/images/smilies2/blank.gif
new file mode 100644
index 0000000..7ca8e23
Binary files /dev/null and b/images/smilies2/blank.gif differ
diff --git a/images/smilies2/cry.gif b/images/smilies2/cry.gif
new file mode 100644
index 0000000..bbcc4da
Binary files /dev/null and b/images/smilies2/cry.gif differ
diff --git a/images/smilies2/cute.gif b/images/smilies2/cute.gif
new file mode 100644
index 0000000..d34bdfe
Binary files /dev/null and b/images/smilies2/cute.gif differ
diff --git a/images/smilies2/cute2.gif b/images/smilies2/cute2.gif
new file mode 100644
index 0000000..3ab8349
Binary files /dev/null and b/images/smilies2/cute2.gif differ
diff --git a/images/smilies2/denied.gif b/images/smilies2/denied.gif
new file mode 100644
index 0000000..a4dfbb2
Binary files /dev/null and b/images/smilies2/denied.gif differ
diff --git a/images/smilies2/dizzy.gif b/images/smilies2/dizzy.gif
new file mode 100644
index 0000000..4b9710c
Binary files /dev/null and b/images/smilies2/dizzy.gif differ
diff --git a/images/smilies2/duh.gif b/images/smilies2/duh.gif
new file mode 100644
index 0000000..c649956
Binary files /dev/null and b/images/smilies2/duh.gif differ
diff --git a/images/smilies2/eek.gif b/images/smilies2/eek.gif
new file mode 100644
index 0000000..0f04348
Binary files /dev/null and b/images/smilies2/eek.gif differ
diff --git a/images/smilies2/evil.gif b/images/smilies2/evil.gif
new file mode 100644
index 0000000..8501934
Binary files /dev/null and b/images/smilies2/evil.gif differ
diff --git a/images/smilies2/eyeshift.gif b/images/smilies2/eyeshift.gif
new file mode 100644
index 0000000..409542d
Binary files /dev/null and b/images/smilies2/eyeshift.gif differ
diff --git a/images/smilies2/eyeshift2.gif b/images/smilies2/eyeshift2.gif
new file mode 100644
index 0000000..0faa287
Binary files /dev/null and b/images/smilies2/eyeshift2.gif differ
diff --git a/images/smilies2/flush.gif b/images/smilies2/flush.gif
new file mode 100644
index 0000000..79e85f5
Binary files /dev/null and b/images/smilies2/flush.gif differ
diff --git a/images/smilies2/frown.gif b/images/smilies2/frown.gif
new file mode 100644
index 0000000..cef3b25
Binary files /dev/null and b/images/smilies2/frown.gif differ
diff --git a/images/smilies2/glasses.gif b/images/smilies2/glasses.gif
new file mode 100644
index 0000000..dd82d8a
Binary files /dev/null and b/images/smilies2/glasses.gif differ
diff --git a/images/smilies2/grin.gif b/images/smilies2/grin.gif
new file mode 100644
index 0000000..911853f
Binary files /dev/null and b/images/smilies2/grin.gif differ
diff --git a/images/smilies2/halo.gif b/images/smilies2/halo.gif
new file mode 100644
index 0000000..de25449
Binary files /dev/null and b/images/smilies2/halo.gif differ
diff --git a/images/smilies2/haw.gif b/images/smilies2/haw.gif
new file mode 100644
index 0000000..35c6f6c
Binary files /dev/null and b/images/smilies2/haw.gif differ
diff --git a/images/smilies2/haw2.gif b/images/smilies2/haw2.gif
new file mode 100644
index 0000000..fd53725
Binary files /dev/null and b/images/smilies2/haw2.gif differ
diff --git a/images/smilies2/heart2.gif b/images/smilies2/heart2.gif
new file mode 100644
index 0000000..129e1d3
Binary files /dev/null and b/images/smilies2/heart2.gif differ
diff --git a/images/smilies2/jawdrop.gif b/images/smilies2/jawdrop.gif
new file mode 100644
index 0000000..ef58f1a
Binary files /dev/null and b/images/smilies2/jawdrop.gif differ
diff --git a/images/smilies2/krunk.gif b/images/smilies2/krunk.gif
new file mode 100644
index 0000000..3fc7246
Binary files /dev/null and b/images/smilies2/krunk.gif differ
diff --git a/images/smilies2/lol.gif b/images/smilies2/lol.gif
new file mode 100644
index 0000000..d46619c
Binary files /dev/null and b/images/smilies2/lol.gif differ
diff --git a/images/smilies2/mad.gif b/images/smilies2/mad.gif
new file mode 100644
index 0000000..ea50ab4
Binary files /dev/null and b/images/smilies2/mad.gif differ
diff --git a/images/smilies2/meow.gif b/images/smilies2/meow.gif
new file mode 100644
index 0000000..da838c1
Binary files /dev/null and b/images/smilies2/meow.gif differ
diff --git a/images/smilies2/ooh.gif b/images/smilies2/ooh.gif
new file mode 100644
index 0000000..077e710
Binary files /dev/null and b/images/smilies2/ooh.gif differ
diff --git a/images/smilies2/rofl.gif b/images/smilies2/rofl.gif
new file mode 100644
index 0000000..097e066
Binary files /dev/null and b/images/smilies2/rofl.gif differ
diff --git a/images/smilies2/roflbar.gif b/images/smilies2/roflbar.gif
new file mode 100644
index 0000000..a80ae2f
Binary files /dev/null and b/images/smilies2/roflbar.gif differ
diff --git a/images/smilies2/roflx.gif b/images/smilies2/roflx.gif
new file mode 100644
index 0000000..3386cf2
Binary files /dev/null and b/images/smilies2/roflx.gif differ
diff --git a/images/smilies2/rolleyes.gif b/images/smilies2/rolleyes.gif
new file mode 100644
index 0000000..b7716da
Binary files /dev/null and b/images/smilies2/rolleyes.gif differ
diff --git a/images/smilies2/shiftleft.gif b/images/smilies2/shiftleft.gif
new file mode 100644
index 0000000..a2f9130
Binary files /dev/null and b/images/smilies2/shiftleft.gif differ
diff --git a/images/smilies2/shiftright.gif b/images/smilies2/shiftright.gif
new file mode 100644
index 0000000..858af0b
Binary files /dev/null and b/images/smilies2/shiftright.gif differ
diff --git a/images/smilies2/sick.gif b/images/smilies2/sick.gif
new file mode 100644
index 0000000..0ab837c
Binary files /dev/null and b/images/smilies2/sick.gif differ
diff --git a/images/smilies2/smile.gif b/images/smilies2/smile.gif
new file mode 100644
index 0000000..5836500
Binary files /dev/null and b/images/smilies2/smile.gif differ
diff --git a/images/smilies2/smilespin.gif b/images/smilies2/smilespin.gif
new file mode 100644
index 0000000..44c60c3
Binary files /dev/null and b/images/smilies2/smilespin.gif differ
diff --git a/images/smilies2/smilespin2.gif b/images/smilies2/smilespin2.gif
new file mode 100644
index 0000000..d41e3ec
Binary files /dev/null and b/images/smilies2/smilespin2.gif differ
diff --git a/images/smilies2/terror.gif b/images/smilies2/terror.gif
new file mode 100644
index 0000000..5882864
Binary files /dev/null and b/images/smilies2/terror.gif differ
diff --git a/images/smilies2/tongue.gif b/images/smilies2/tongue.gif
new file mode 100644
index 0000000..b581d17
Binary files /dev/null and b/images/smilies2/tongue.gif differ
diff --git a/images/smilies2/vamp.gif b/images/smilies2/vamp.gif
new file mode 100644
index 0000000..dba65dc
Binary files /dev/null and b/images/smilies2/vamp.gif differ
diff --git a/images/smilies2/wink.gif b/images/smilies2/wink.gif
new file mode 100644
index 0000000..d60e958
Binary files /dev/null and b/images/smilies2/wink.gif differ
diff --git a/images/smilies2/wobbly.gif b/images/smilies2/wobbly.gif
new file mode 100644
index 0000000..a596c36
Binary files /dev/null and b/images/smilies2/wobbly.gif differ
diff --git a/images/smilies2/woot.gif b/images/smilies2/woot.gif
new file mode 100644
index 0000000..c6b1b78
Binary files /dev/null and b/images/smilies2/woot.gif differ
diff --git a/images/smilies2/yuck.gif b/images/smilies2/yuck.gif
new file mode 100644
index 0000000..92c5a92
Binary files /dev/null and b/images/smilies2/yuck.gif differ
diff --git a/images/snow/0.gif b/images/snow/0.gif
new file mode 100644
index 0000000..3b0ba0e
Binary files /dev/null and b/images/snow/0.gif differ
diff --git a/images/snow/0.png b/images/snow/0.png
new file mode 100644
index 0000000..3714b0f
Binary files /dev/null and b/images/snow/0.png differ
diff --git a/images/snowbg.jpg b/images/snowbg.jpg
new file mode 100644
index 0000000..0732f74
Binary files /dev/null and b/images/snowbg.jpg differ
diff --git a/images/spikedball.gif b/images/spikedball.gif
new file mode 100644
index 0000000..c470e62
Binary files /dev/null and b/images/spikedball.gif differ
diff --git a/images/spikedball.png b/images/spikedball.png
new file mode 100644
index 0000000..8cd72ce
Binary files /dev/null and b/images/spikedball.png differ
diff --git a/images/squid.png b/images/squid.png
new file mode 100644
index 0000000..5bed875
Binary files /dev/null and b/images/squid.png differ
diff --git a/images/stardonor.png b/images/stardonor.png
new file mode 100644
index 0000000..12dbaf9
Binary files /dev/null and b/images/stardonor.png differ
diff --git a/images/starsbg-r.png b/images/starsbg-r.png
new file mode 100644
index 0000000..1c568b8
Binary files /dev/null and b/images/starsbg-r.png differ
diff --git a/images/status-classic/hot.gif b/images/status-classic/hot.gif
new file mode 100644
index 0000000..2a1d1e2
Binary files /dev/null and b/images/status-classic/hot.gif differ
diff --git a/images/status-classic/hotnew.gif b/images/status-classic/hotnew.gif
new file mode 100644
index 0000000..206e2ca
Binary files /dev/null and b/images/status-classic/hotnew.gif differ
diff --git a/images/status-classic/hotoff.gif b/images/status-classic/hotoff.gif
new file mode 100644
index 0000000..dbc82a5
Binary files /dev/null and b/images/status-classic/hotoff.gif differ
diff --git a/images/status-classic/new.gif b/images/status-classic/new.gif
new file mode 100644
index 0000000..c49a2a6
Binary files /dev/null and b/images/status-classic/new.gif differ
diff --git a/images/status-classic/off.gif b/images/status-classic/off.gif
new file mode 100644
index 0000000..67766d8
Binary files /dev/null and b/images/status-classic/off.gif differ
diff --git a/images/stupidmage.png b/images/stupidmage.png
new file mode 100644
index 0000000..7e525a0
Binary files /dev/null and b/images/stupidmage.png differ
diff --git a/images/temp/nym-cloud.gif b/images/temp/nym-cloud.gif
new file mode 100644
index 0000000..902b6db
Binary files /dev/null and b/images/temp/nym-cloud.gif differ
diff --git a/images/temp/nym-ehz.gif b/images/temp/nym-ehz.gif
new file mode 100644
index 0000000..c0e0a2d
Binary files /dev/null and b/images/temp/nym-ehz.gif differ
diff --git a/images/terminal6.gdf b/images/terminal6.gdf
new file mode 100644
index 0000000..4cc2419
Binary files /dev/null and b/images/terminal6.gdf differ
diff --git a/images/terrorism2.png b/images/terrorism2.png
new file mode 100644
index 0000000..25e0621
Binary files /dev/null and b/images/terrorism2.png differ
diff --git a/images/thisthreadfails.png b/images/thisthreadfails.png
new file mode 100644
index 0000000..e038920
Binary files /dev/null and b/images/thisthreadfails.png differ
diff --git a/images/threadclosed.png b/images/threadclosed.png
new file mode 100644
index 0000000..02fb3fe
Binary files /dev/null and b/images/threadclosed.png differ
diff --git a/images/toolbar/alphabg.png b/images/toolbar/alphabg.png
new file mode 100644
index 0000000..0e12547
Binary files /dev/null and b/images/toolbar/alphabg.png differ
diff --git a/images/toolbar/alphabg2.png b/images/toolbar/alphabg2.png
new file mode 100644
index 0000000..c8aef4f
Binary files /dev/null and b/images/toolbar/alphabg2.png differ
diff --git a/images/toolbar/bgblack.gif b/images/toolbar/bgblack.gif
new file mode 100644
index 0000000..fbe3138
Binary files /dev/null and b/images/toolbar/bgblack.gif differ
diff --git a/images/toolbar/bgblue.gif b/images/toolbar/bgblue.gif
new file mode 100644
index 0000000..cf5c7df
Binary files /dev/null and b/images/toolbar/bgblue.gif differ
diff --git a/images/toolbar/bgcolor.gif b/images/toolbar/bgcolor.gif
new file mode 100644
index 0000000..67c6c97
Binary files /dev/null and b/images/toolbar/bgcolor.gif differ
diff --git a/images/toolbar/bggreen.gif b/images/toolbar/bggreen.gif
new file mode 100644
index 0000000..1d29656
Binary files /dev/null and b/images/toolbar/bggreen.gif differ
diff --git a/images/toolbar/bgorange.gif b/images/toolbar/bgorange.gif
new file mode 100644
index 0000000..cff2a9b
Binary files /dev/null and b/images/toolbar/bgorange.gif differ
diff --git a/images/toolbar/bgpink.gif b/images/toolbar/bgpink.gif
new file mode 100644
index 0000000..5041375
Binary files /dev/null and b/images/toolbar/bgpink.gif differ
diff --git a/images/toolbar/bgpurple.gif b/images/toolbar/bgpurple.gif
new file mode 100644
index 0000000..7fb884d
Binary files /dev/null and b/images/toolbar/bgpurple.gif differ
diff --git a/images/toolbar/bgred.gif b/images/toolbar/bgred.gif
new file mode 100644
index 0000000..5041375
Binary files /dev/null and b/images/toolbar/bgred.gif differ
diff --git a/images/toolbar/bgyellow.gif b/images/toolbar/bgyellow.gif
new file mode 100644
index 0000000..4b1d187
Binary files /dev/null and b/images/toolbar/bgyellow.gif differ
diff --git a/images/toolbar/bold.gif b/images/toolbar/bold.gif
new file mode 100644
index 0000000..d2a0ff6
Binary files /dev/null and b/images/toolbar/bold.gif differ
diff --git a/images/toolbar/fblack.gif b/images/toolbar/fblack.gif
new file mode 100644
index 0000000..66a6661
Binary files /dev/null and b/images/toolbar/fblack.gif differ
diff --git a/images/toolbar/fblue.gif b/images/toolbar/fblue.gif
new file mode 100644
index 0000000..16a0ef9
Binary files /dev/null and b/images/toolbar/fblue.gif differ
diff --git a/images/toolbar/fcolor.gif b/images/toolbar/fcolor.gif
new file mode 100644
index 0000000..e9c85e5
Binary files /dev/null and b/images/toolbar/fcolor.gif differ
diff --git a/images/toolbar/fgreen.gif b/images/toolbar/fgreen.gif
new file mode 100644
index 0000000..dee1758
Binary files /dev/null and b/images/toolbar/fgreen.gif differ
diff --git a/images/toolbar/forange.gif b/images/toolbar/forange.gif
new file mode 100644
index 0000000..ef962df
Binary files /dev/null and b/images/toolbar/forange.gif differ
diff --git a/images/toolbar/fpink.gif b/images/toolbar/fpink.gif
new file mode 100644
index 0000000..c042a28
Binary files /dev/null and b/images/toolbar/fpink.gif differ
diff --git a/images/toolbar/fpurple.gif b/images/toolbar/fpurple.gif
new file mode 100644
index 0000000..6212ec4
Binary files /dev/null and b/images/toolbar/fpurple.gif differ
diff --git a/images/toolbar/fred.gif b/images/toolbar/fred.gif
new file mode 100644
index 0000000..97b2701
Binary files /dev/null and b/images/toolbar/fred.gif differ
diff --git a/images/toolbar/fyellow.gif b/images/toolbar/fyellow.gif
new file mode 100644
index 0000000..b6f0f7d
Binary files /dev/null and b/images/toolbar/fyellow.gif differ
diff --git a/images/toolbar/image.gif b/images/toolbar/image.gif
new file mode 100644
index 0000000..08f377c
Binary files /dev/null and b/images/toolbar/image.gif differ
diff --git a/images/toolbar/invis.gif b/images/toolbar/invis.gif
new file mode 100644
index 0000000..1d11fa9
Binary files /dev/null and b/images/toolbar/invis.gif differ
diff --git a/images/toolbar/italic.gif b/images/toolbar/italic.gif
new file mode 100644
index 0000000..fb0c6a8
Binary files /dev/null and b/images/toolbar/italic.gif differ
diff --git a/images/toolbar/link.gif b/images/toolbar/link.gif
new file mode 100644
index 0000000..65a167b
Binary files /dev/null and b/images/toolbar/link.gif differ
diff --git a/images/toolbar/smiley.gif b/images/toolbar/smiley.gif
new file mode 100644
index 0000000..a9edefe
Binary files /dev/null and b/images/toolbar/smiley.gif differ
diff --git a/images/toolbar/strike.gif b/images/toolbar/strike.gif
new file mode 100644
index 0000000..3cc37a6
Binary files /dev/null and b/images/toolbar/strike.gif differ
diff --git a/images/toolbar/underline.gif b/images/toolbar/underline.gif
new file mode 100644
index 0000000..e7174fa
Binary files /dev/null and b/images/toolbar/underline.gif differ
diff --git a/images/topsecret.jpg b/images/topsecret.jpg
new file mode 100644
index 0000000..f0bdbad
Binary files /dev/null and b/images/topsecret.jpg differ
diff --git a/images/touhoubanner.png b/images/touhoubanner.png
new file mode 100644
index 0000000..6ad8499
Binary files /dev/null and b/images/touhoubanner.png differ
diff --git a/images/trolldra.png b/images/trolldra.png
new file mode 100644
index 0000000..3bec624
Binary files /dev/null and b/images/trolldra.png differ
diff --git a/images/umad.jpg b/images/umad.jpg
new file mode 100644
index 0000000..f69b414
Binary files /dev/null and b/images/umad.jpg differ
diff --git a/images/unthread.png b/images/unthread.png
new file mode 100644
index 0000000..ae06feb
Binary files /dev/null and b/images/unthread.png differ
diff --git a/images/update.png b/images/update.png
new file mode 100644
index 0000000..5b10523
Binary files /dev/null and b/images/update.png differ
diff --git a/images/wafflebg.png b/images/wafflebg.png
new file mode 100644
index 0000000..d842a02
Binary files /dev/null and b/images/wafflebg.png differ
diff --git a/images/waffleiron.jpg b/images/waffleiron.jpg
new file mode 100644
index 0000000..6602ce3
Binary files /dev/null and b/images/waffleiron.jpg differ
diff --git a/images/wafflemysql.png b/images/wafflemysql.png
new file mode 100644
index 0000000..f98b9c1
Binary files /dev/null and b/images/wafflemysql.png differ
diff --git a/images/wave/cheepcheep.png b/images/wave/cheepcheep.png
new file mode 100644
index 0000000..1d4e672
Binary files /dev/null and b/images/wave/cheepcheep.png differ
diff --git a/images/wave/chest.png b/images/wave/chest.png
new file mode 100644
index 0000000..3e2b084
Binary files /dev/null and b/images/wave/chest.png differ
diff --git a/images/wave/seaweed.png b/images/wave/seaweed.png
new file mode 100644
index 0000000..f237bf2
Binary files /dev/null and b/images/wave/seaweed.png differ
diff --git a/images/wave/squid.png b/images/wave/squid.png
new file mode 100644
index 0000000..5bed875
Binary files /dev/null and b/images/wave/squid.png differ
diff --git a/images/ymar/bar-off.gif b/images/ymar/bar-off.gif
new file mode 100644
index 0000000..037f09b
Binary files /dev/null and b/images/ymar/bar-off.gif differ
diff --git a/images/ymar/bar-on.gif b/images/ymar/bar-on.gif
new file mode 100644
index 0000000..8c06a72
Binary files /dev/null and b/images/ymar/bar-on.gif differ
diff --git a/images/ymar/barleft.gif b/images/ymar/barleft.gif
new file mode 100644
index 0000000..1ec3aa0
Binary files /dev/null and b/images/ymar/barleft.gif differ
diff --git a/images/ymar/barright.gif b/images/ymar/barright.gif
new file mode 100644
index 0000000..960b0cc
Binary files /dev/null and b/images/ymar/barright.gif differ
diff --git a/images/ymar/beegee.png b/images/ymar/beegee.png
new file mode 100644
index 0000000..412ce5a
Binary files /dev/null and b/images/ymar/beegee.png differ
diff --git a/images/ymar/headbg-00.png b/images/ymar/headbg-00.png
new file mode 100644
index 0000000..0ed5368
Binary files /dev/null and b/images/ymar/headbg-00.png differ
diff --git a/images/ymar/headbg.png b/images/ymar/headbg.png
new file mode 100644
index 0000000..c5ea05f
Binary files /dev/null and b/images/ymar/headbg.png differ
diff --git a/images/ymar/hot.png b/images/ymar/hot.png
new file mode 100644
index 0000000..b593ef3
Binary files /dev/null and b/images/ymar/hot.png differ
diff --git a/images/ymar/hotoff.png b/images/ymar/hotoff.png
new file mode 100644
index 0000000..ab27853
Binary files /dev/null and b/images/ymar/hotoff.png differ
diff --git a/images/ymar/new.png b/images/ymar/new.png
new file mode 100644
index 0000000..b9f636d
Binary files /dev/null and b/images/ymar/new.png differ
diff --git a/images/ymar/newhot.png b/images/ymar/newhot.png
new file mode 100644
index 0000000..3eb53ce
Binary files /dev/null and b/images/ymar/newhot.png differ
diff --git a/images/ymar/newhotoff.png b/images/ymar/newhotoff.png
new file mode 100644
index 0000000..a476130
Binary files /dev/null and b/images/ymar/newhotoff.png differ
diff --git a/images/ymar/newoff.png b/images/ymar/newoff.png
new file mode 100644
index 0000000..fe7f744
Binary files /dev/null and b/images/ymar/newoff.png differ
diff --git a/images/ymar/newpoll.png b/images/ymar/newpoll.png
new file mode 100644
index 0000000..b5b13b8
Binary files /dev/null and b/images/ymar/newpoll.png differ
diff --git a/images/ymar/newreply.png b/images/ymar/newreply.png
new file mode 100644
index 0000000..61c1876
Binary files /dev/null and b/images/ymar/newreply.png differ
diff --git a/images/ymar/newthread.png b/images/ymar/newthread.png
new file mode 100644
index 0000000..d6ae606
Binary files /dev/null and b/images/ymar/newthread.png differ
diff --git a/images/ymar/off.png b/images/ymar/off.png
new file mode 100644
index 0000000..71c705f
Binary files /dev/null and b/images/ymar/off.png differ
diff --git a/images/ymar/threadclosed.png b/images/ymar/threadclosed.png
new file mode 100644
index 0000000..cfbe44d
Binary files /dev/null and b/images/ymar/threadclosed.png differ
diff --git a/images/ymar/title.jpg b/images/ymar/title.jpg
new file mode 100644
index 0000000..62ade23
Binary files /dev/null and b/images/ymar/title.jpg differ
diff --git a/images/zen/header.png b/images/zen/header.png
new file mode 100644
index 0000000..793a86d
Binary files /dev/null and b/images/zen/header.png differ
diff --git a/images/zen/t1.png b/images/zen/t1.png
new file mode 100644
index 0000000..0b3da9e
Binary files /dev/null and b/images/zen/t1.png differ
diff --git a/images/zen/zentitle.png b/images/zen/zentitle.png
new file mode 100644
index 0000000..e6e8d8d
Binary files /dev/null and b/images/zen/zentitle.png differ
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..59cc2e8
--- /dev/null
+++ b/index.php
@@ -0,0 +1,289 @@
+<?php
+
+	if (isset($_GET['u']) && $_GET['u']) {
+		header("Location: profile.php?id=". $_GET['u']);
+		die();
+	} elseif (isset($_GET['p']) && $_GET['p']) {
+		header("Location: thread.php?pid=". $_GET['p'] ."#". $_GET['p']);
+		die();
+	} elseif (isset($_GET['t']) && $_GET['t']) {
+		header("Location: thread.php?id=". $_GET['t']);
+		die();
+	}
+
+/*
+	if ($_GET["letitsnow"]) {
+		if (!array_key_exists('snowglobe', $_COOKIE)) {
+			$_COOKIE['snowglobe'] = 1;
+		}
+
+		if (!is_int($_COOKIE['snowglobe'])) {
+			die("no.");
+		}
+		if ($_COOKIE['snowglobe'] == 0) {
+			$_COOKIE['snowglobe'] = 1;
+		} elseif ($_COOKIE['snowglobe'] == 1) {
+			$_COOKIE['snowglobe'] = 0;
+		}
+
+		header("Location: /index.php");
+	}
+*/
+
+	require 'lib/function.php';
+	require 'lib/layout.php';
+
+	$sql->query("UPDATE `users` SET `name` = 'Xkeeper' WHERE `id` = 1"); # I'm hiding it here too as a 'last resort'. Remove this and I'll make that Z-line a month instead.
+	// You know me, I find it more fun to hide code to replace your name everywhere instead of altering the DB <3
+//	$sql->query("UPDATE `users` SET `sex` = '1' WHERE `id` = 2100");  // Me too <3 ~Ras
+
+	if ($x_hacks['smallbrowse'] == 1 and false) {
+		require 'mobile/index.php'; // alternate markup for mobile clients.
+	} else {
+		if($action=='markforumread' and $log) {
+			$sql->query("DELETE FROM forumread WHERE user=$loguserid AND forum='$forumid'");
+			$sql->query("DELETE FROM `threadsread` WHERE `uid` = '$loguserid' AND `tid` IN (SELECT `id` FROM `threads` WHERE `forum` = '$forumid')");
+			$sql->query("INSERT INTO forumread (user,forum,readdate) VALUES ($loguserid,$forumid,".ctime().')');
+			return header("Location: index.php");
+		}
+		
+		if($action=='markallforumsread' and $log) {
+			$sql->query("DELETE FROM forumread WHERE user=$loguserid");
+			$sql->query("DELETE FROM `threadsread` WHERE `uid` = '$loguserid'");
+			$sql->query("INSERT INTO forumread (user,forum,readdate) SELECT $loguserid,id,".ctime().' FROM forums');
+			return header("Location: index.php");
+		}
+
+		$postread = readpostread($loguserid);
+
+		$users1 = $sql->query("SELECT id,name,birthday,sex,powerlevel,aka FROM users WHERE FROM_UNIXTIME(birthday,'%m-%d')='".date('m-d',ctime() + $tzoff)."' AND birthday ORDER BY name");
+		for ($numbd=0;$user=$sql->fetch($users1);$numbd++) {
+			if(!$numbd) $blist="<tr>$tccell2s colspan=5>Birthdays for ".date('F j',ctime() + $tzoff).': ';
+			else $blist.=', ';
+			$users[$user[id]]=$user;
+			$y=date('Y',ctime())-date('Y',$user['birthday']);
+			$userurl = getuserlink($user);
+			$blist.= "$userurl ($y)"; 
+		}
+		
+		$onlinetime=ctime()-300;
+		$onusers=$sql->query("SELECT id,name,powerlevel,lastactivity,sex,minipic,aka FROM users WHERE lastactivity>$onlinetime OR lastposttime>$onlinetime ORDER BY name");
+		$numonline=mysql_num_rows($onusers);
+
+		$numguests=$sql->resultq("SELECT count(*) FROM guests WHERE date>$onlinetime",0,0);
+		if ($numguests) $guestcount=" | <nobr>$numguests guest".($numguests>1?"s":"");
+		for ($numon=0; $onuser = $sql->fetch($onusers);$numon++) {
+			if($numon) { $onlineusers.=', '; }
+			
+			//$namecolor=explode("=", getnamecolor($onuser['sex'],$onuser['powerlevel']));
+			//$namecolor=$namecolor[1];
+			//$namelink="<a href=profile.php?id=$onuser[id] style='color: #$namecolor'>$onuser[name]</a>";
+
+      $namelink = getuserlink($onuser);
+
+			if($onuser['minipic']) {
+				$onuser['minipic']='<img width="16" height="16" src="'.str_replace('"','%22',$onuser[minipic]).'" align="absmiddle"> ';
+			}
+
+			if($onuser['lastactivity']<=$onlinetime) {
+				$namelink="($namelink)";
+			}
+			
+			$onlineusers.="$onuser[minipic]$namelink";
+		}
+
+		if($onlineusers) $onlineusers=': '.$onlineusers;
+
+		if($log){
+			$headlinks.=' - <a href=index.php?action=markallforumsread>Mark all forums read</a>';
+			$header=makeheader($header1,$headlinks,$header2);
+
+			$myurl = getuserlink($loguser);
+			$logmsg = "You are logged in as $myurl.";
+		}
+
+		$lastuser = $sql->fetchq('SELECT id,name,sex,powerlevel,aka FROM users ORDER BY id DESC LIMIT 1');
+    $lastuserurl = getuserlink($lastuser);
+
+		$posts = $sql->fetchq('SELECT (SELECT COUNT( * ) FROM posts WHERE date>'.(ctime()-3600).') AS h, (SELECT COUNT( * ) FROM posts WHERE date>'.(ctime()-86400).') AS d');
+		$count = $sql->fetchq('SELECT (SELECT COUNT( * ) FROM users) AS u, (SELECT COUNT(*) FROM threads) as t, (SELECT COUNT(*) FROM posts) as p');
+
+		$misc = $sql->fetchq('SELECT * FROM misc');
+		
+		if($posts['d']>$misc['maxpostsday'])  $sql->query("UPDATE misc SET maxpostsday=$posts[d],maxpostsdaydate=".ctime());
+		if($posts['h']>$misc['maxpostshour']) $sql->query("UPDATE misc SET maxpostshour=$posts[h],maxpostshourdate=".ctime());
+		if($numonline>$misc['maxusers'])      $sql->query("UPDATE misc SET maxusers=$numonline,maxusersdate=".ctime().",maxuserstext='".addslashes($onlineusers)."'");
+
+		/*// index sparkline
+		$sprkq = mysql_query('SELECT COUNT(id),date FROM posts WHERE date >="'.(time()-3600).'" GROUP BY (date % 60) ORDER BY date');
+		$sprk = array();
+		
+		while ($r = mysql_fetch_row($sprkq)) {
+			array_push($sprk,$r[0]);
+		}
+		// print_r($sprk);
+		$sprk = implode(",",$sprk); */
+
+		if ($_GET['oldcounter'])
+			$statsblip	= "$posts[d] posts during the last day, $posts[h] posts during the last hour.";
+		else {
+			$nthreads = $sql->resultq("SELECT COUNT(*) FROM `threads` WHERE `lastpostdate` > '". (ctime() - 86400) ."'");
+			$nusers   = $sql->resultq("SELECT COUNT(*) FROM `users` WHERE `lastposttime` > '". (ctime() - 86400) ."'");
+			$tthreads = ($nthreads === 1) ? "thread" : "threads";
+			$tusers   = ($nusers   === 1) ? "user" : "users";
+			$statsblip	= "$nusers $tusers active in $nthreads $tthreads during the last day.";
+		}
+
+	  print "$header
+		<br>
+		$tblstart
+		 $tccell1s><table width=100%><td class=fonts>$logmsg</td><td align=right class=fonts>$count[u] registered users<br>Latest registered user: $lastuserurl</table>
+		 $blist<tr>
+		$tccell2s>$count[t] threads and $count[p] posts in the board | $statsblip<tr>
+		 $tccell1s>$numonline user".($numonline!=1?'s':'')." currently online$onlineusers$guestcount
+
+	  ";
+
+		// Displays total PMs along with unread unlike layout.php
+	  $new='&nbsp;';
+		if($log) {
+			$pms = $sql->getresultsbykey("SELECT msgread, COUNT(*) num FROM pmsgs WHERE userto=$loguserid GROUP BY msgread", 'msgread', 'num');
+			$totalpms = intval($pms[0]+$pms[1]);
+
+ 			if ($totalpms) {
+				if($pms[0]) $new = $statusicons['new'];
+
+				$pmsg = $sql->fetchq("SELECT date,u.id uid,name,sex,powerlevel,aka
+					FROM pmsgs p LEFT JOIN users u ON u.id=p.userfrom
+					WHERE userto=$loguserid". (($pms[0]) ? " AND msgread=0": "") ."
+					ORDER BY p.id DESC
+          LIMIT 1");
+
+				$namelink = getuserlink($pmsg, array('id'=>'uid'));
+				$lastmsg = "Last ". (($pms[0]) ? "unread " : "") ."message from $namelink on ".date($dateformat,$pmsg['date']+$tzoff);
+			}
+			$privatebox="
+				$tblstart<tr>
+				$tccellhs colspan=2>Private messages</tr><tr>
+				$tccell1>$new</td>
+				$tccell2l><a href='private.php'>Private messages</a> -- You have $totalpms private messages (".intval($pms[0])." new). $lastmsg</td></tr>
+				$tblend<br>
+			";
+
+		}
+
+  // Hopefully this version won't break horribly if breathed on wrong
+	$forumlist="
+		<tr>
+			$tccellh>&nbsp;</td>
+			$tccellh>Forum</td>
+			$tccellh width=80>Threads</td>
+			$tccellh width=80>Posts</td>
+			$tccellh width=15%>Last post</td>
+		</tr>
+	";
+
+	$forumquery = $sql->query("SELECT f.*,u.id AS uid,name,sex,powerlevel,aka FROM forums f LEFT JOIN users u ON f.lastpostuser=u.id WHERE (!minpower OR minpower<=$power) AND f.hidden = '0' ORDER BY catid,forder");
+	$catquery = $sql->query("SELECT id,name FROM categories WHERE (!minpower OR minpower<=$power) ORDER BY id");
+	$modquery = $sql->query("SELECT u.id id,name,sex,powerlevel,aka,forum FROM users u INNER JOIN forummods m ON u.id=m.user ORDER BY name");
+
+	$categories	= array();
+	$forums		= array();
+	$mods		= array();
+
+	while ($res = $sql->fetch($catquery))
+		$categories[] = $res;
+	while ($res = $sql->fetch($forumquery))
+		$forums[] = $res;
+	while ($res = $sql->fetch($modquery))
+		$mods[] = $res;
+
+  // Quicker (?) new posts calculation that's hopefully accurate v.v
+  if ($log) {
+	  $qadd = array();
+	  foreach ($forums as $forum) $qadd[] = "(lastpostdate > '{$postread[$forum[id]]}' AND forum = '$forum[id]')\r\n";
+	  $qadd = implode(' OR ', $qadd);
+
+		$forumnew = $sql->getresultsbykey("SELECT forum, COUNT(*) AS unread FROM threads t LEFT JOIN threadsread tr ON (tr.tid = t.id AND tr.uid = $loguser[id])
+			WHERE (`read` IS NULL OR `read` != 1) AND ($qadd) GROUP BY forum", 'forum', 'unread');
+	}
+
+	foreach ($categories as $category) {
+		$forumlist.="<tr><td class='tbl tdbgc center font' colspan=5><a href=index.php?cat=$category[id]>$category[name]</a></td></tr>";
+		if($cat && $cat != $category['id'])
+		  continue;
+
+		foreach ($forums as $forumplace => $forum) {
+			if ($forum['catid'] != $category['id'])
+				continue;
+
+			$m = 0;
+			$modlist = "";
+			foreach ($mods as $modplace => $mod) {
+				if ($mod['forum'] != $forum['id'])
+					continue;
+
+				$namelink = getuserlink($mod);
+				$modlist.=($m++?', ':'').$namelink;
+				unset($mods[$modplace]);
+			}
+
+			if ($m)
+				$modlist="$smallfont(moderated by: $modlist)</font>";
+
+			$namelink = getuserlink($forum, array('id'=>'uid'));
+			if($forum['numposts']){
+				$forumlastpost="<nobr>". date($dateformat,$forum['lastpostdate']+$tzoff);
+				$by="$smallfont<br>by $namelink". ($forum['lastpostid'] ? " <a href='thread.php?pid=". $forum['lastpostid'] ."#". $forum['lastpostid'] ."'>". $statusicons['getlast'] ."</a>" : "") ."</nobr></font>";
+			} else {
+				$forumlastpost=getblankdate();
+				$by='';
+			}
+
+			if($forum['lastpostdate']>$category['lastpostdate']){
+				$category['lastpostdate']=$forum['lastpostdate'];
+				$category['l']=$forumlastpost.$by;
+			}
+
+			$new='&nbsp;';
+
+			if ($forum['numposts']) {
+				if ($log && intval($forumnew[$forum['id']]) > 0) {
+  	      $new = $statusicons['new'] ."<br>". generatenumbergfx(intval($forumnew[$forum['id']]));
+				}
+				elseif (!$log && $forum['lastpostdate']>ctime()-3600) {
+					$new = $statusicons['new'];
+				}
+      }
+/*
+			if ($log && $forum['lastpostdate'] > $postread[$forum['id']]) {
+        $newcount	= $sql->resultq("SELECT COUNT(*) FROM `threads` WHERE `id` NOT IN (SELECT `tid` FROM `threadsread` WHERE `uid` = '$loguser[id]' AND `read` = 1) AND `lastpostdate` > '". $postread[$forum['id']] ."' AND `forum` = '$forum[id]'");
+			}
+
+			if ((($forum['lastpostdate'] > $postread[$forum['id']] and $log) or (!$log and $forum['lastpostdate']>ctime()-3600)) and $forum['numposts']) {
+				$new = $statusicons['new'] ."<br>". generatenumbergfx($newcount);
+			}
+*/
+		  $forumlist.="
+			<tr>
+				$tccell1>$new</td>
+				$tccell2l><a href=forum.php?id=$forum[id]>$forum[title]</a><br>
+				$smallfont$forum[description]<br>$modlist</td>
+				$tccell1>$forum[numthreads]</td>
+				$tccell1>$forum[numposts]</td>
+				$tccell2><span class='lastpost'>$forumlastpost</span>$by$forumlastuser
+			</tr>
+		  ";
+
+			unset($forums[$forumplace]);
+		}
+	}
+
+		print "$tblend<br>$privatebox
+		
+		". adbox() ."<br>
+
+		$tblstart$forumlist$tblend$footer";
+		printtimedif($startingtime);
+	}
+?>
diff --git a/ipsearch.php b/ipsearch.php
new file mode 100644
index 0000000..3d2edc8
--- /dev/null
+++ b/ipsearch.php
@@ -0,0 +1,157 @@
+<?php
+  require_once('lib/function.php');
+  $windowtitle = "IP Address Search";
+  require_once('lib/layout.php');
+  print "$header<br>";
+  admincheck();
+  print adminlinkbar('ipsearch.php');
+  print "$tblstart";
+
+	if(!$su) $su='n';
+	if(!$sp) $sp='u';
+	if(!$sm) $sm='n';
+	if(!$d)  $d='y';
+	$ch1[$su]=' checked';
+	$ch2[$sp]=' checked';
+	$ch3[$sm]=' checked';
+	$ch4[$d]=' checked';
+
+	print "
+	  <form action=ipsearch.php method=post>
+	  $tccellh colspan=2>IP search<tr>
+	  $tccell1 width=20%><b>IP to search:</b></td>
+	  $tccell2l>$inpt=ip size=15 maxlength=15 value=$ip><tr>
+	  $tccell1><b>Sort users by:</b></td>
+	  $tccell2l>
+	    $radio=su value=n$ch1[n]> Name &nbsp; &nbsp;
+	    $radio=su value=p$ch1[p]> Posts &nbsp; &nbsp;
+	    $radio=su value=r$ch1[r]> Registration &nbsp; &nbsp;
+	    $radio=su value=s$ch1[s]> Last post &nbsp; &nbsp;
+	    $radio=su value=a$ch1[a]> Last activity &nbsp; &nbsp;
+	    $radio=su value=i$ch1[i]> Last IP
+	  <tr>
+	  $tccell1><b>Sort posts by:</b></td>
+	  $tccell2l>
+	    $radio=sp value=u$ch2[u]> User &nbsp; &nbsp;
+	    $radio=sp value=d$ch2[d]> Date &nbsp; &nbsp;
+	    $radio=sp value=i$ch2[i]> IP
+	  <tr>
+	  $tccell1><b>Sort private messages by:</b></td>
+	  $tccell2l>
+	    $radio=sm value=n$ch3[n]> Sent by &nbsp; &nbsp;
+	    $radio=sm value=d$ch3[d]> Date &nbsp; &nbsp;
+	    $radio=sm value=i$ch3[i]> IP
+	  <tr>
+	  $tccell1><b>Distinct users and IP's:</b></td>
+	  $tccell2l>
+	    $radio=d value=y$ch4[y]> Yes &nbsp; &nbsp;
+	    $radio=d value=n$ch4[n]> No
+	  <tr>
+	  $tccell1>&nbsp</td>
+	  $tccell1l>$inps=s value=Submit></td>
+	  </form>
+	";
+
+	if($ip) {
+		$ip=str_replace('*','%',$ip);
+		switch($su) {
+		  case 'n': $usort='ORDER BY name'; break;
+		  case 'p': $usort='ORDER BY posts DESC'; break;
+		  case 'r': $usort='ORDER BY regdate'; break;
+		  case 's': $usort='ORDER BY lastposttime'; break;
+		  case 'a': $usort='ORDER BY lastactivity'; break;
+		  case 'i': $usort='ORDER BY lastip'; break;
+		}
+		switch($sp) {
+		  case 'u': $psort='ORDER BY name'; break;
+		  case 'd': $psort='ORDER BY date'; break;
+		  case 'i': $psort='ORDER BY ip'; break;
+		}
+		switch($sm) {
+		  case 'n': $msort='ORDER BY name1'; break;
+		  case 'd': $msort='ORDER BY date'; break;
+		  case 'i': $msort='ORDER BY ip'; break;
+		}
+		if($d === 'y') {
+		  $pgroup='GROUP BY p.ip,u.id';
+		  $mgroup='GROUP BY p.ip,u1.id';
+		}
+		$users=$sql->query("SELECT * FROM users WHERE lastip LIKE '$ip' $usort");
+		$posts=$sql->query("SELECT p.*,u.name,u.sex,u.powerlevel,t.title FROM posts p,users u,threads t WHERE ip LIKE '$ip' AND p.user=u.id AND p.thread=t.id $pgroup $psort");
+		$pmsgs=$sql->query("SELECT p.*,t.title,u1.name AS name1,u2.name AS name2,u1.sex AS sex1,u2.sex AS sex2,u1.powerlevel pow1,u2.powerlevel pow2 FROM pmsgs p,pmsgs_text t,users u1,users u2 WHERE ip LIKE '$ip' AND p.userfrom=u1.id AND p.userto=u2.id AND p.id=pid $mgroup $msort");
+
+		print "
+		  $tblend<br>$tblstart
+		  $tccellh colspan=7><b>Users: ".mysql_num_rows($users)."</b><tr>
+		  $tccellc>id</td>
+		  $tccellc>Name</td>
+		  $tccellc>Registered on</td>
+		  $tccellc>Last post</td>
+		  $tccellc>Last activity</td>
+		  $tccellc>Posts</td>
+		  $tccellc>Last IP</td>
+		";
+		for($c=0;$c<500 && $user=$sql->fetch($users);$c++)
+		  if ($users['id'] != 428) print "
+		    <tr>
+		    $tccell2>$user[id]</td>
+		    $tccell1><a href=profile.php?id=$user[id]><font ".getnamecolor($user['sex'],$user['powerlevel']).">$user[name]</font></a></td>
+		    $tccell1>".@date($dateformat,$user['regdate'])."</td>
+		    $tccell1>".date($dateformat,$user['lastposttime'])."</td>
+		    $tccell1>".date($dateformat,$user['lastactivity'])."</td>
+		    $tccell1>$user[posts]</td>
+		    $tccell2>$user[lastip]</td>
+		  ";
+		if($post=$sql->fetch($users))
+		  print "<tr>$tccell2 colspan=7>Too many results!";
+
+		print "
+		  $tblend<br>$tblstart
+		  $tccellh colspan=5><b>Posts: ".mysql_num_rows($posts)."</b><tr>
+		  $tccellc>id</td>
+		  $tccellc>Posted by</td>
+		  $tccellc>Thread</td>
+		  $tccellc>Date</td>
+		  $tccellc>IP</td>
+		";
+		for($c=0;$c<500 && $post=$sql->fetch($posts);$c++)
+			if ($post['user'] != 428)
+			print "
+		    <tr>
+		    $tccell2>$post[id]</td>
+		    $tccell1><a href=profile.php?id=$post[user]><font ".getnamecolor($post['sex'],$post['powerlevel']).">$post[name]</font></a></td>
+		    $tccell1><a href=thread.php?id=$post[thread]>$post[title]</a></td>
+		    $tccell1><nobr>".date($dateformat,$post['date'])."</nobr></td>
+		    $tccell2>$post[ip]</td>
+		  ";
+		if($post=$sql->fetch($posts))
+		  print "<tr>$tccell2 colspan=5>Too many results!";
+
+		print "
+		  $tblend<br>$tblstart
+		  $tccellh colspan=6><b>Private messages: ".mysql_num_rows($pmsgs)."</b><tr>
+		  $tccellc>id</td>
+		  $tccellc>Sent by</td>
+		  $tccellc>Sent to</td>
+		  $tccellc>Title</td>
+		  $tccellc>Date</td>
+		  $tccellc>IP</td>
+		";
+		for($c=0;$c<500 && $pmsg=$sql->fetch($pmsgs);$c++)
+			if ($pmsg['userfrom'] != 428 && $pmsg['userto'] != 428)
+			print "
+		    <tr>
+		    $tccell2>$pmsg[id]</td>
+		    $tccell1><a href=profile.php?id=$pmsg[userfrom]><font ".getnamecolor($pmsg['sex1'],$pmsg['pow1']).">$pmsg[name1]</font></a></td>
+		    $tccell1><a href=profile.php?id=$pmsg[userto]><font ".getnamecolor($pmsg['sex2'],$pmsg['pow2']).">$pmsg[name2]</font></a></td>
+		    $tccell1><a href=showprivate.php?id=$pmsg[id]>$pmsg[title]</a></td>
+		    $tccell1><nobr>".date($dateformat,$pmsg['date'])."</nobr></td>
+		    $tccell2>$pmsg[ip]</td>
+		  ";
+		if($pmsg=$sql->fetch($pmsgs))
+			print "<tr>$tccell2 colspan=6>Too many results!";
+
+  }
+  print $tblend.$footer;
+  printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/irc.php b/irc.php
new file mode 100644
index 0000000..f7bfec2
--- /dev/null
+++ b/irc.php
@@ -0,0 +1,95 @@
+<?php
+
+require 'lib/function.php';
+$windowtitle = "$boardname - IRC Chat";
+require 'lib/layout.php';
+
+	$servers[1]		= "irc.badnik.net";
+	if ($server > count($servers) || $server <= -1) $server = 0;
+
+
+
+print "		$header<br>$tblstart<tr>
+		$tccellh><b>Java IRC Chat - BadnikNET, #x</b></td></tr>
+		<tr>$tccell1>Server List: ";
+
+foreach ($servers as $num => $name) {
+
+	if ($num != 1) print " | ";
+	if ($server == $num) print "<u>";
+	print "<a href=irc.php?server=". $num .">". $name ."</a>";
+	if ($server == $num) print "</u>";
+	if ($num == 1) print " (preferred)";
+
+}
+
+print "		<tr>$tccell2>";
+
+	if ($server) {
+
+	$badchars = array("~", "&", "@", "?", "!", ".", ",", "=", "+", "%", "*");
+
+	$name = str_replace(" ", "", $loguser[name]);
+	$name = str_replace($badchars, "_", $name);
+	if (!$name) { 
+		$name = "J-Guest";
+		$guestmsg	= "<br>Welcome, guest. When you connect to the IRC network, please use the command <tt>/nick NICKNAME</tt>.<br>&nbsp;<br>";
+	}
+	
+print "
+	
+	<applet code=\"IRCApplet.class\" codebase=\"irc/\"  
+	archive=\"irc.jar,pixx.jar\" width=\"100%\" height=500>
+	<param name=\"CABINETS\" value=\"irc.cab,securedirc.cab,pixx.cab\">
+	
+	<param name=\"nick\" value=\"". $name ."\">
+	<param name=\"alternatenick\" value=\"". $name ."_??\">
+	<param name=\"fullname\" value=\"Jul Java IRC User\">
+	<param name=\"host\" value=\"". $servers[$server] ."\">
+	<param name=\"gui\" value=\"pixx\">
+	<param name=\"authorizedcommandlist\" value=\"all-server-s\">
+	<param name=\"authorizedleavelist\" value=\"all-#x\">
+	<param name=\"authorizedjoinlist\" value=\"all\">
+
+	<param name=\"quitmessage\" value=\"JulIRC - http://jul.rustedlogic.net/\">
+	<param name=\"autorejoin\" value=\"true\">
+	
+	<param name=\"style:bitmapsmileys\" value=\"false\">
+	<param name=\"style:backgroundimage\" value=\"false\">
+	<param name=\"style:backgroundimage1\" value=\"none+Channel all 2 background.png.gif\">
+	<param name=\"style:sourcecolorrule1\" value=\"all all 0=000000 1=ffffff 2=0000ff 3=00b000 4=ff4040 5=c00000 6=c000a0 7=ff8000 8=ffff00 9=70ff70 10=00a0a0 11=80ffff 12=a0a0ff 13=ff60d0 14=a0a0a0 15=d0d0d0\">
+	
+	<param name=\"pixx:timestamp\" value=\"true\">
+	<param name=\"pixx:highlight\" value=\"true\">
+	<param name=\"pixx:highlightnick\" value=\"true\">
+	<param name=\"pixx:nickfield\" value=\"false\">
+	<param name=\"pixx:styleselector\" value=\"true\">
+	<param name=\"pixx:setfontonstyle\" value=\"true\">
+
+	". ($_GET['channel'] != "retro" ? "<param name=\"command1\" value=\"/join #x\"><param name=\"command1\" value=\"/join #tcrf\">" : "") ."
+	". ($_GET['channel'] ? "<param name=\"command1\" value=\"/join #". $_GET['channel'] ."\">" : "") ."
+	
+	</applet>";
+
+	} else {
+
+		print "&nbsp;<br>Please choose a server to connect to.<br>&nbsp;";
+
+	}
+
+   print "$tblend
+		<br>$tblstart<tr>
+		$tccellh><b>Quick Help</b></td></tr>
+		<tr>$tccell1l>Commands:
+			<br><tt>/nick [name]</tt> - changes your name
+			<br><tt>/me [action]</tt> - does an action (try it)
+			<br><tt>/msg [name] [message]</tt> - send a private message to another user
+			<br><tt>/join [#channel]</tt> - joins a channel
+			<br><tt>/part [#channel]</tt> - leaves a channel
+			<br><tt>/quit [message]</tt> - obvious
+		$tblend
+		$footer";
+
+ printtimedif($startingtime);
+?>
+
diff --git a/js/button.js b/js/button.js
new file mode 100644
index 0000000..48c7d60
--- /dev/null
+++ b/js/button.js
@@ -0,0 +1,71 @@
+var bgColor;
+var ltColor;
+var dkColor;
+
+function createButton(image, name, event, backcolor, lightcolor, darkcolor)
+{
+  var btnTable;
+
+  bgColor=backcolor;
+  ltColor=lightcolor;
+  dkColor=darkcolor;
+
+  btnTable="<table id='"+name+"' border='0' cellspacing='0' cellpadding='0' width=23 height=17 "+event+">"
+  btnTable+="<TR bgcolor="+backcolor+"><TD></TD><TD></TD><TD><img src=images/toolbar/invis.gif></TD><TD></TD>"
+  btnTable+="</TR><TR bgcolor="+backcolor+"><TD><img src=images/toolbar/invis.gif></TD>"
+  btnTable+="<TD colspan='2'>"
+  btnTable+="<table border='0' cellspacing='0' cellpadding='0' bgcolor="+backcolor+" width=100% height=100%>"
+  btnTable+="<tr valign=top><td align=center><img name='"+name+"imgtop' src=images/toolbar/invis.gif></td></tr>"
+  btnTable+="<tr valign=center><td align=center><img name='"+name+"imgleft' src=images/toolbar/invis.gif>"+image+"<img name='"+name+"imgright' src=images/toolbar/invis.gif></td></tr>"
+  btnTable+="<tr valign=bottom><td align=center><img name='"+name+"imgbottom' src=images/toolbar/invis.gif height=2></td></tr>"
+  btnTable+="</table>"
+  btnTable+="</TD><TD bgcolor="+backcolor+"><img src=images/toolbar/invis.gif></TD></TR>"
+  btnTable+="<TR bgcolor="+backcolor+"><TD></TD><TD></TD><TD></TD><TD></TD></TR>"
+  btnTable+="</TABLE>"
+
+  return btnTable;
+}
+
+function createSeperation(backcolor, lightcolor, darkcolor)
+{
+  var btnTable;
+
+  btnTable="<table border='0' bgcolor='"+backcolor+"' cellspacing='0' cellpadding='0' width=2 height=17>"
+  btnTable+="<TR valign=top><TD><img src=images/toolbar/invis.gif height=1></TD><TD><img src=images/toolbar/invis.gif></TD></TR>"
+  btnTable+="<TR><TD bgcolor='"+darkcolor+"' width=1 height=7></TD><TD bgcolor='"+lightcolor+"' width=1></TD></TR>"
+  btnTable+="<TR><TD bgcolor='"+darkcolor+"' width=1 height=7></TD><TD bgcolor='"+lightcolor+"' width=1></TD></TR>"
+  btnTable+="<TR valign=bottom><TD><img src=images/toolbar/invis.gif height=1></TD><TD><img src=images/toolbar/invis.gif></TD></TR>"
+  btnTable+="</TABLE>"
+
+  return btnTable;
+}
+
+function buttonOut(name)
+{
+  eval(name+'.rows[0].style.backgroundColor=bgColor');
+  eval(name+'.rows[1].style.backgroundColor=bgColor');
+  eval(name+'.rows[1].cells[2].style.backgroundColor=bgColor');
+  eval(name+'.rows[2].style.backgroundColor=bgColor');
+}
+
+function buttonDown(name)
+{
+  eval(name+'.rows[0].style.backgroundColor=dkColor');
+  eval(name+'.rows[1].style.backgroundColor=dkColor');
+  eval(name+'.rows[1].cells[2].style.backgroundColor=ltColor');
+  eval(name+'.rows[2].style.backgroundColor=ltColor');
+  eval('document.all.'+name+'imgtop.height=2');
+  eval('document.all.'+name+'imgleft.width=2');
+  eval('document.all.'+name+'imgright.width=0');
+}
+
+function buttonUp(name)
+{
+  eval(name+'.rows[0].style.backgroundColor=ltColor');
+  eval(name+'.rows[1].style.backgroundColor=ltColor');
+  eval(name+'.rows[1].cells[2].style.backgroundColor=dkColor');
+  eval(name+'.rows[2].style.backgroundColor=dkColor');
+  eval('document.all.'+name+'imgtop.height=1');
+  eval('document.all.'+name+'imgleft.width=1');
+  eval('document.all.'+name+'imgright.width=1');
+}
\ No newline at end of file
diff --git a/js/hex.js b/js/hex.js
new file mode 100644
index 0000000..ce24bce
--- /dev/null
+++ b/js/hex.js
@@ -0,0 +1,5 @@
+<script>
+function hexidecimalchart() {
+newwin=window.open('hex.php','hexidecimalchart','toolbar=no,scrollbars=no,status=no,width=350,height=195');
+}
+</script>
diff --git a/js/jquery.hotkeys-0.7.9.min.js b/js/jquery.hotkeys-0.7.9.min.js
new file mode 100644
index 0000000..53e37cc
--- /dev/null
+++ b/js/jquery.hotkeys-0.7.9.min.js
@@ -0,0 +1,19 @@
+(function(jQuery){jQuery.fn.__bind__=jQuery.fn.bind;jQuery.fn.__unbind__=jQuery.fn.unbind;jQuery.fn.__find__=jQuery.fn.find;var hotkeys={version:'0.7.9',override:/keypress|keydown|keyup/g,triggersMap:{},specialKeys:{27:'esc',9:'tab',32:'space',13:'return',8:'backspace',145:'scroll',20:'capslock',144:'numlock',19:'pause',45:'insert',36:'home',46:'del',35:'end',33:'pageup',34:'pagedown',37:'left',38:'up',39:'right',40:'down',109:'-',112:'f1',113:'f2',114:'f3',115:'f4',116:'f5',117:'f6',118:'f7',119:'f8',120:'f9',121:'f10',122:'f11',123:'f12',191:'/'},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":"\"",",":"<",".":">","/":"?","\\":"|"},newTrigger:function(type,combi,callback){var result={};result[type]={};result[type][combi]={cb:callback,disableInInput:false};return result;}};hotkeys.specialKeys=jQuery.extend(hotkeys.specialKeys,{96:'0',97:'1',98:'2',99:'3',100:'4',101:'5',102:'6',103:'7',104:'8',105:'9',106:'*',107:'+',109:'-',110:'.',111:'/'});jQuery.fn.find=function(selector){this.query=selector;return jQuery.fn.__find__.apply(this,arguments);};jQuery.fn.unbind=function(type,combi,fn){if(jQuery.isFunction(combi)){fn=combi;combi=null;}
+if(combi&&typeof combi==='string'){var selectorId=((this.prevObject&&this.prevObject.query)||(this[0].id&&this[0].id)||this[0]).toString();var hkTypes=type.split(' ');for(var x=0;x<hkTypes.length;x++){delete hotkeys.triggersMap[selectorId][hkTypes[x]][combi];}}
+return this.__unbind__(type,fn);};jQuery.fn.bind=function(type,data,fn){var handle=type.match(hotkeys.override);if(jQuery.isFunction(data)||!handle){return this.__bind__(type,data,fn);}
+else{var result=null,pass2jq=jQuery.trim(type.replace(hotkeys.override,''));if(pass2jq){result=this.__bind__(pass2jq,data,fn);}
+if(typeof data==="string"){data={'combi':data};}
+if(data.combi){for(var x=0;x<handle.length;x++){var eventType=handle[x];var combi=data.combi.toLowerCase(),trigger=hotkeys.newTrigger(eventType,combi,fn),selectorId=((this.prevObject&&this.prevObject.query)||(this[0].id&&this[0].id)||this[0]).toString();trigger[eventType][combi].disableInInput=data.disableInInput;if(!hotkeys.triggersMap[selectorId]){hotkeys.triggersMap[selectorId]=trigger;}
+else if(!hotkeys.triggersMap[selectorId][eventType]){hotkeys.triggersMap[selectorId][eventType]=trigger[eventType];}
+var mapPoint=hotkeys.triggersMap[selectorId][eventType][combi];if(!mapPoint){hotkeys.triggersMap[selectorId][eventType][combi]=[trigger[eventType][combi]];}
+else if(mapPoint.constructor!==Array){hotkeys.triggersMap[selectorId][eventType][combi]=[mapPoint];}
+else{hotkeys.triggersMap[selectorId][eventType][combi][mapPoint.length]=trigger[eventType][combi];}
+this.each(function(){var jqElem=jQuery(this);if(jqElem.attr('hkId')&&jqElem.attr('hkId')!==selectorId){selectorId=jqElem.attr('hkId')+";"+selectorId;}
+jqElem.attr('hkId',selectorId);});result=this.__bind__(handle.join(' '),data,hotkeys.handler)}}
+return result;}};hotkeys.findElement=function(elem){if(!jQuery(elem).attr('hkId')){if(jQuery.browser.opera||jQuery.browser.safari){while(!jQuery(elem).attr('hkId')&&elem.parentNode){elem=elem.parentNode;}}}
+return elem;};hotkeys.handler=function(event){var target=hotkeys.findElement(event.currentTarget),jTarget=jQuery(target),ids=jTarget.attr('hkId');if(ids){ids=ids.split(';');var code=event.which,type=event.type,special=hotkeys.specialKeys[code],character=!special&&String.fromCharCode(code).toLowerCase(),shift=event.shiftKey,ctrl=event.ctrlKey,alt=event.altKey||event.originalEvent.altKey,mapPoint=null;for(var x=0;x<ids.length;x++){if(hotkeys.triggersMap[ids[x]][type]){mapPoint=hotkeys.triggersMap[ids[x]][type];break;}}
+if(mapPoint){var trigger;if(!shift&&!ctrl&&!alt){trigger=mapPoint[special]||(character&&mapPoint[character]);}
+else{var modif='';if(alt)modif+='alt+';if(ctrl)modif+='ctrl+';if(shift)modif+='shift+';trigger=mapPoint[modif+special];if(!trigger){if(character){trigger=mapPoint[modif+character]||mapPoint[modif+hotkeys.shiftNums[character]]||(modif==='shift+'&&mapPoint[hotkeys.shiftNums[character]]);}}}
+if(trigger){var result=false;for(var x=0;x<trigger.length;x++){if(trigger[x].disableInInput){var elem=jQuery(event.target);if(jTarget.is("input")||jTarget.is("textarea")||jTarget.is("select")||elem.is("input")||elem.is("textarea")||elem.is("select")){return true;}}
+result=result||trigger[x].cb.apply(this,[event]);}
+return result;}}}};window.hotkeys=hotkeys;return jQuery;})(jQuery);
\ No newline at end of file
diff --git a/js/jquery.min.js b/js/jquery.min.js
new file mode 100644
index 0000000..c72011d
--- /dev/null
+++ b/js/jquery.min.js
@@ -0,0 +1,16 @@
+/*!
+ * jQuery JavaScript Library v1.6
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Mon May 2 13:50:00 2011 -0400
+ */
+(function(a,b){function cw(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function ct(a){if(!ch[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ci||(ci=c.createElement("iframe"),ci.frameBorder=ci.width=ci.height=0),c.body.appendChild(ci);if(!cj||!ci.createElement)cj=(ci.contentWindow||ci.contentDocument).document,cj.write("<!doctype><html><body></body></html>");b=cj.createElement(a),cj.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ci)}ch[a]=d}return ch[a]}function cs(a,b){var c={};f.each(cn.concat.apply([],cn.slice(0,b)),function(){c[this]=a});return c}function cr(){co=b}function cq(){setTimeout(cr,0);return co=f.now()}function cg(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cf(){try{return new a.XMLHttpRequest}catch(b){}}function b_(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function b$(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bZ(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):bZ(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bZ(a+"["+e+"]",b[e],c,d);else d(a,b)}function bY(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bY(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bY(a,c,d,e,"*",g));return l}function bX(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?bv:bw,e=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return e;f.each(d,function(){c||(e-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?e+=parseFloat(f.css(a,"margin"+this))||0:e-=parseFloat(f.css(a,"border"+this+"Width"))||0});return e}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval(b.text||b.textContent||b.innerHTML||""),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):a.getElementsByTagName&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bf(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function W(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(R.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(x,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){name="data-"+c.replace(j,"$1-$2").toLowerCase(),d=a.getAttribute(name);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(e){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?g=[null,a,null]:g=i.exec(a);if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:E?function(a){return a==null?"":E.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?C.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(F)return F.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=D.call(arguments,2),g=function(){return a.apply(c,f.concat(D.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(c,d){d&&d instanceof e&&!(d instanceof a)&&(d=a(d));return e.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){G["[object "+b+"]"]=b.toLowerCase()}),x=e.uaMatch(w),x.browser&&(e.browser[x.browser]=!0,e.browser.version=x.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?z=function(){c.removeEventListener("DOMContentLoaded",z,!1),e.ready()}:c.attachEvent&&(z=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",z),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g](h)}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b,d,e,f,g,h,i,j,k,l,m,n,o,p,q;a.setAttribute("className","t"),a.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",b=a.getElementsByTagName("*"),d=a.getElementsByTagName("a")[0];if(!b||!b.length||!d)return{};e=c.createElement("select"),f=e.appendChild(c.createElement("option")),g=a.getElementsByTagName("input")[0],i={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.55$/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:g.value==="on",optSelected:f.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},g.checked=!0,i.noCloneChecked=g.cloneNode(!0).checked,e.disabled=!0,i.optDisabled=!f.disabled;try{delete a.test}catch(r){i.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function click(){i.noCloneEvent=!1,a.detachEvent("onclick",click)}),a.cloneNode(!0).fireEvent("onclick")),g=c.createElement("input"),g.value="t",g.setAttribute("type","radio"),i.radioValue=g.value==="t",g.setAttribute("checked","checked"),a.appendChild(g),j=c.createDocumentFragment(),j.appendChild(a.firstChild),i.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",k=c.createElement("body"),l={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(p in l)k.style[p]=l[p];k.appendChild(a),c.documentElement.appendChild(k),i.appendChecked=g.checked,i.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,i.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",i.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",m=a.getElementsByTagName("td"),q=m[0].offsetHeight===0,m[0].style.display="",m[1].style.display="none",i.reliableHiddenOffsets=q&&m[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(h=c.createElement("div"),h.style.width="0",h.style.marginRight="0",a.appendChild(h),i.reliableMarginRight=(parseInt(c.defaultView.getComputedStyle(h,null).marginRight,10)||0)===0),k.innerHTML="",c.documentElement.removeChild(k);if(a.attachEvent)for(p in{submit:1,change:1,focusin:1})o="on"+p,q=o in a,q||(a.setAttribute(o,"return;"),q=typeof a[o]=="function"),i[p+"Bubbles"]=q;return i}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[c]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function l(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark";while(g--)if(tmp=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,tmp.done(l);l();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:data-|aria-)/,u=/\:/,v;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.addClass(a.call(this,b,c.attr("class")||""))});if(a&&typeof a=="string"){var b=(a||"").split(o);for(var c=0,d=this.length;c<d;c++){var e=this[c];if(e.nodeType===1)if(!e.className)e.className=a;else{var g=" "+e.className+" ",h=e.className;for(var i=0,j=b.length;i<j;i++)g.indexOf(" "+b[i]+" ")<0&&(h+=" "+b[i]);e.className=f.trim(h)}}}return this},removeClass:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a=="string"||a===b){var c=(a||"").split(o);for(var d=0,e=this.length;d<e;d++){var g=this[d];if(g.nodeType===1&&g.className)if(a){var h=(" "+g.className+" ").replace(n," ");for(var i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){var d=f(this);d.toggleClass(a.call(this,c,d.attr("class"),b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||"set"in c&&c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b=a.selectedIndex,c=[],d=a.options,e=a.type==="select-one";if(b<0)return null;for(var g=e?b:0,h=e?b+1:d.length;g<h;g++){var i=d[g];if(i.selected&&(f.support.optDisabled?!i.disabled:i.getAttribute("disabled")===null)&&(!i.parentNode.disabled||!f.nodeName(i.parentNode,"optgroup"))){value=f(i).val();if(e)return value;c.push(value)}}if(e&&!c.length&&d.length)return f(d[b]).val();return c},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex",readonly:"readOnly"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c]||(v&&(f.nodeName(a,"form")||u.test(c))?v:b);if(d!==b){if(d===null||d===!1&&!t.test(c)){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;d===!0&&!t.test(c)&&(d=c),a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.getAttribute("value");a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),f.support.getSetAttribute||(f.attrFix=f.extend(f.attrFix,{"for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder"}),v=f.attrHooks.name=f.attrHooks.value=f.valHooks.button={get:function(a,c){var d;if(c==="value"&&!f.nodeName(a,"button"))return a.getAttribute(c);d=a.getAttributeNode(c);return d&&d.specified?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=Object.prototype.hasOwnProperty,x=/\.(.*)$/,y=/^(?:textarea|input|select)$/i,z=/\./g,A=/ /g,B=/[^\w\s.|`]/g,C=function(a){return a.replace(B,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=D;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=D);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),C).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,N(a.origType,a.selector),f.extend({},a,{handler:M,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,N(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?E:D):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=E;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=E;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=E,this.stopPropagation()},isDefaultPrevented:D,isPropagationStopped:D,isImmediatePropagationStopped:D};var F=function(a){var b=a.relatedTarget;try{if(b&&b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&(a.type=a.data,f.event.handle.apply(this,arguments))}catch(d){}},G=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?G:F,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?G:F)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&K("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&K("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var H,I=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function J(a){var c=a.target,d,e;if(!!y.test(c.nodeName)&&!c.readOnly){d=f._data(c,"_change_data"),e=I(c),(a.type!=="focusout"||c.type!=="radio")&&f._data(c,"_change_data",e);if(d===b||e===d)return;if(d!=null||e)a.type="change",a.liveFired=b,f.event.trigger(a,arguments[1],c)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var L={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||D,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=x.exec(h),k="",j&&(k=j[0],h=h.replace(x,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,L[h]?(a.push(L[h]+k),h=h+k):h=(L[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+N(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+N(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){return a.nodeName.toLowerCase()==="input"&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(a===b){g=!0;return 0}if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var O=/Until$/,P=/^(?:parents|prevUntil|prevAll)/,Q=/,/,R=/^.[^:#\[\.,]*$/,S=Array.prototype.slice,T=f.expr.match.POS,U={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(W(this,a,!1),"not",a)},filter:function(a){return this.pushStack(W(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=T.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/<tbody/i,ba=/<|&#?\w+;/,bb=/<(?:script|object|embed|option|style)/i,bc=/checked\s*(?:[^=]|=\s*.checked.)/i,bd=/\/(java|ecma)script/i,be={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!be[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bc.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bf(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bl)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bb.test(a[0])&&(f.support.checkClone||!bc.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[];for(var i=0,j;(j=a[i])!=null;i++){typeof j=="number"&&(j+="");if(!j)continue;if(typeof j=="string")if(!ba.test(j))j=b.createTextNode(j);else{j=j.replace(Z,"<$1></$2>");var k=($.exec(j)||["",""])[1].toLowerCase(),l=be[k]||be._default,m=l[0],n=b.createElement("div");n.innerHTML=l[1]+j+l[2];while(m--)n=n.lastChild;if(!f.support.tbody){var o=_.test(j),p=k==="table"&&!o?n.firstChild&&n.firstChild.childNodes:l[1]==="<table>"&&!o?n.childNodes:[];for(var q=p.length-1;q>=0;--q)f.nodeName(p[q],"tbody")&&!p[q].childNodes.length&&p[q].parentNode.removeChild(p[q])}!f.support.leadingWhitespace&&Y.test(j)&&n.insertBefore(b.createTextNode(Y.exec(j)[0]),n.firstChild),j=n.childNodes}var r;if(!f.support.appendChecked)if(j[0]&&typeof (r=j.length)=="number")for(i=0;i<r;i++)bk(j[i]);else bk(j);j.nodeType?h.push(j):h=f.merge(h,j)}if(d){g=function(a){return!a.type||bd.test(a.type)};for(i=0;h[i];i++)if(e&&f.nodeName(h[i],"script")&&(!h[i].type||h[i].type.toLowerCase()==="text/javascript"))e.push(h[i].parentNode?h[i].parentNode.removeChild(h[i]):h[i]);else{if(h[i].nodeType===1){var s=f.grep(h[i].getElementsByTagName("script"),g);h.splice.apply(h,[i+1,0].concat(s))}d.appendChild(h[i])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bm=/alpha\([^)]*\)/i,bn=/opacity=([^)]*)/,bo=/-([a-z])/ig,bp=/([A-Z]|^ms)/g,bq=/^-?\d+(?:px)?$/i,br=/^-?\d/,bs=/^[+\-]=/,bt=/[^+\-\.\de]+/g,bu={position:"absolute",visibility:"hidden",display:"block"},bv=["Left","Right"],bw=["Top","Bottom"],bx,by,bz,bA=function(a,b){return b.toUpperCase()};f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bx(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0,widows:!0,orphans:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bs.test(d)&&(d=+d.replace(bt,"")+parseFloat(f.css(a,c))),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bx)return bx(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bo,bA)}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){a.offsetWidth!==0?e=bB(a,b,d):f.swap(a,bu,function(){e=bB(a,b,d)});if(e<=0){e=bx(a,b,b),e==="0px"&&bz&&(e=bz(a,b,b));if(e!=null)return e===""||e==="auto"?"0px":e}if(e<0||e==null){e=a.style[b];return e===""||e==="auto"?"0px":e}return typeof e=="string"?e:e+"px"}},set:function(a,b){if(!bq.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV;try{bU=e.href}catch(bW){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bX(bS),ajaxTransport:bX(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?b$(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b_(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bY(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bY(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bZ(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var ca=f.now(),cb=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+ca++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cb.test(b.url)||e&&cb.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cb,l),b.url===j&&(e&&(k=k.replace(cb,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cc=a.ActiveXObject?function(){for(var a in ce)ce[a](0,1)}:!1,cd=0,ce;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cf()||cg()}:cf,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cc&&delete ce[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cd,cc&&(ce||(ce={},f(a).unload(cc)),ce[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ch={},ci,cj,ck=/^(?:toggle|show|hide)$/,cl=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cm,cn=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],co,cp=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cs("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",ct(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cs("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cs("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g];if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=ct(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block")),b.animatedProperties[g]=f.isArray(h)?h[1]:b.specialEasing&&b.specialEasing[g]||b.easing||"swing"}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],ck.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=cl.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[g]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cs("show",1),slideUp:cs("hide",1),slideToggle:cs("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this),f.isFunction(d.old)&&d.old.call(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=co||cq(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!cm&&(cp?(cm=1,g=function(){cm&&(cp(g),e.tick())},cp(g)):cm=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=co||cq(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a=f.timers,b=a.length;while(b--)a[b]()||a.splice(b,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cm),cm=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cu=/^t(?:able|d|h)$/i,cv=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cw(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cu.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cv.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cv.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cw(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cw(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);
\ No newline at end of file
diff --git a/js/latestposts.js b/js/latestposts.js
new file mode 100644
index 0000000..c968c10
--- /dev/null
+++ b/js/latestposts.js
@@ -0,0 +1,117 @@
+function filter(func, list) {
+	var retl = [];
+	var idx  = 0;
+	for (var i = 0; i < list.length; i++) {
+		if (func(list[i]) == 1) {
+			retl[idx] = list[i];
+			idx++;
+		}
+	}
+	return retl;
+}
+
+function pluralize(val, str) {
+	if (val == 1) {
+		return String(val) + " " + str;
+	} else if (val == 0 || val >= 2) {
+		return String(val) + " " + str + "s";
+	}
+}
+
+function htmlattrs(attrs) {
+	var attrStrings = [];
+	for (var i in attrs) {
+		attrStrings.push(i + '="' + attrs[i] + '"');
+	}
+	return attrStrings.join(" ");
+}
+
+var gen_row = function (elements, attrs) { return "<tr"+(attrs["row"]!=undefined?" "+htmlattrs(attrs["row"]):"")+">"+elements.join("")+"</tr>"; }
+var gen_cell = function (text, attrs) { return "<td"+(attrs!=undefined?" "+htmlattrs(attrs):"")+">"+text+"</td>"; }
+
+function htmlchars(str) {
+	return str;
+}
+
+function linkify(text, attrs) {
+	var attrStrings = [];
+	for (var i in attrs) {
+		attrStrings.push(i + '="' + htmlchars(attrs[i]) + '"')
+	}
+	return "<a "+(attrStrings.join(" "))+">"+htmlchars(text)+"</a>";
+}
+
+var postlist = function() {$.get("latestposts.php", {raw: 1}, function(data) {
+		var ctime = new Date();
+		var lines   = data.split("\n");
+		var splitter = /"(.*?)"/gi;
+		var noCommas = function(e) { return e != ","; }
+		var rows    = [];
+		for (var i = 0; i < lines.length; i++) {
+			rows[i] = filter(noCommas, lines[i].split(splitter));
+			rows[i].splice(0,1);
+		}
+		var html_rows = function() {
+			var trows = [];
+			var statr1 = {class: "tbl tdbg1 font center"};
+			var statr2 = {class: "tbl tdbg2 font"};
+			var statr3 = {class: "tbl tdbg1 font"};
+			var statr4 = {class: "tbl tdbg2 font center"};
+			trows[0] = gen_row([gen_cell("<b>Latest Posts</b>", {class: "tbl tdbgc font center", colspan: "5"})], {});
+			trows[1] = gen_row([
+				gen_cell("&nbsp;", {class: "tbl tdbgh font center", width: 30}),
+				gen_cell("Forum", {class: "tbl tdbgh font center", width: 200}),
+				gen_cell("Thread",{class: "tbl tdbgh font center"}),
+				gen_cell("User", {class: "tbl tdbgh font center", width: 200}),
+				gen_cell("Time", {class: "tbl tdbgh font center", width: 130})], {});
+			for (var i = 2; i < rows.length; i++) {
+				var trow = rows[i-2];
+				var dt = new datetime(trow[8]);
+				trows[i] = gen_row([
+						gen_cell(trow[0], statr2),
+						gen_cell(linkify(trow[1], {href: "/forum.php?id="+trow[2], target: "blank"}),statr4),
+						gen_cell(linkify(trow[3], {href: "/thread.php?pid="+trow[0]+"&r=1#"+trow[0], target: "blank"}), statr3),
+						gen_cell("<span style='font-weight: bold; color: #"+trow[7]+";'>"+trow[4]+"</span>", statr1),
+						gen_cell(dt.since(), statr4)
+						], {});
+			}
+			var html = trows.join("");
+			return html;
+		};
+		$("table[name=latest]").html(html_rows());
+});}
+
+function datetime(tstamp) {
+	var ctime = new Date();
+	this.timestamp = tstamp-10800;
+	this.now       = ctime.valueOf()/1000;
+	this.since = function() {
+		var delta = (this.now - this.timestamp);
+		if (delta >= 0 && delta <= 10) {
+			return "Just now";
+		} else if (delta < 60 && delta > 10) {
+			var val = Math.round(delta/60).toString();
+			return pluralize(val, "second")
+		} else if (delta < 3600 && delta > 59) {
+			var val = Math.round(delta/60).toString();
+			return pluralize(val, "minute");
+		} else if (delta < 86400 && delta > 3599) {
+			var val = Math.round(delta/3600).toString();
+			return pluralize(val, "hour");
+		}
+		return delta;
+	}
+	this.idelta = function() {
+		return (this.now - this.timestamp);
+	}
+}
+
+$(document).ready(function() {
+	var UPDATE_TIME = 250;
+	postlist();
+	setInterval(
+		function() {
+				postlist();
+		}, 30000);
+});
+
diff --git a/js/layoutpreview.js b/js/layoutpreview.js
new file mode 100644
index 0000000..939d012
--- /dev/null
+++ b/js/layoutpreview.js
@@ -0,0 +1,219 @@
+// Live layout preview 0.1
+// by Jesper, for AcmlmBoard.
+
+isIE = false;
+var sep = "";
+var fooElement = document.createElement('style');
+fooElement.type = 'text/css';
+tn = document.createTextNode("foo");
+if ((document.all)&&(navigator.appVersion.indexOf("Mac")!=-1)&&(navigator.userAgent.indexOf("Gecko")==-1)&&(navigator.userAgent.indexOf("KHTML")==-1)) { isIE = true; }
+try {
+  fooElement.appendChild(tn);  
+} catch(e) {
+  if (e == "[object Error]") { // we have IE
+    isIE = true;
+  }
+}
+
+function init(d,s) {
+  if (!isIE) {
+    thedoc = d;
+    sep = s;
+//    d.getElementById("noscript").style.display = "none";
+    
+/*    d.getElementById("show-blockquote").onclick = refreshLayoutPreview;
+    d.getElementById("show-link").onclick = refreshLayoutPreview;
+    d.getElementById("show-stretchimage").onclick = refreshLayoutPreview;
+    d.getElementById("show-stretchtext").onclick = refreshLayoutPreview;
+    d.getElementById("postbg").onfocus = refreshLayoutPreview;
+    d.getElementById("postsign").onfocus = refreshLayoutPreview;
+    d.getElementById("postheader").onfocus = refreshLayoutPreview; */
+    d.getElementById("preview-button").onclick = refreshLayoutPreview;
+    
+    d.getElementById("dataloaderhouse").innerHTML += "<iframe name=\"dataloader\" id=\"dataloader\" src=\"about:blank\" style=\"width: 0px; height: 0px; background: white; border: 0; -moz-opacity: 0; filter:alpha(opacity=0); opacity: 0; \"></iframe>";
+    return 1;
+  } else { return 0; }
+}
+
+var thedoc;
+var foo;
+var theStyle;
+function refreshLayoutPreview() {
+if (!isIE) {
+  var sampleText = "(sample text)";
+  
+  d = thedoc;
+
+  var cnv = d.getElementById("layout-preview");
+  
+  var pbg = d.getElementById("postbg");
+  var phd = d.getElementById("postheader");
+  var psg = d.getElementById("postsign");
+  
+  var sbq = d.getElementById("show-blockquote");
+  var sln = d.getElementById("show-link");
+  var str = d.getElementById("show-stretchimage");
+  var stt = d.getElementById("show-stretchtext");
+  
+  var ssp = d.getElementById("signsep");
+
+  var text = cnv.innerHTML+"";
+  
+//  thedoc = d;
+  foo = "doodad";
+  
+//  alert("foo");
+  var formm = d.createElement("form");
+  formm.setAttribute("method","POST");
+  formm.setAttribute("action","/layoutpreviewfilter.php");
+  formm.setAttribute("target","dataloader");
+  formm.setAttribute("id","theform");
+  formm.setAttribute("name","theform");
+//  formm.setAttribute("onsubmit","alert('submitting')");
+  var i1 = d.createElement("input");
+  var i2 = d.createElement("input");
+  var i3 = d.createElement("input");
+  var i4 = d.createElement("input");
+  i1.setAttribute("type","hidden");
+  i2.setAttribute("type","hidden");
+  i3.setAttribute("type","hidden");
+  i4.setAttribute("type","submit");
+  i1.setAttribute("name","headtext");
+  i2.setAttribute("name","text");
+  i3.setAttribute("name","signtext");
+  i4.setAttribute("name","dosubmit");
+  i4.setAttribute("id","submitbutton");
+  i4.style.display = "none";
+  i4.setAttribute("onclick","alert(document.body.innerHTML);");
+  
+  if (sln.checked) {
+    sampleText = "(<a href=\"#\" onclick=\"return false\">sample</a> text)";
+  }
+  text = sampleText;
+  if (sbq.checked) {
+    text = "<blockquote><font class=fonts><i>Originally posted by Someone</i></font><hr>" + sampleText + "<hr></blockquote>" + sampleText;
+  }
+  if (str.checked) {
+    text = text + "<img src=\"images/stretchtest.gif\">";
+  }
+  if (stt.checked) {
+    text = text + "<br><br>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam luctus augue blandit nisl. Etiam id lacus sed ante pulvinar euismod. Maecenas neque quam, scelerisque sed, semper id, vulputate a, eros. Suspendisse mauris erat, condimentum in, pellentesque nec, lobortis vitae, elit. Nunc nec elit quis augue viverra consequat. In eget augue. Aliquam erat volutpat. Nulla blandit massa sed velit. Quisque nonummy consectetuer lacus. Aliquam egestas augue sit amet nulla. In diam leo, lacinia eget, convallis sed, pellentesque eu, velit. Nullam sem. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.<br><br>" + "Morbi rhoncus lectus id leo lacinia blandit. Fusce felis dolor, ullamcorper id, venenatis at, rhoncus feugiat, odio. Suspendisse et nulla eget lectus iaculis elementum. Suspendisse at felis non lectus blandit commodo. Morbi volutpat. Sed eget elit nec libero lobortis consequat. Duis eget magna gravida odio pellentesque venenatis. Maecenas ligula lorem, pellentesque ut, consequat et, commodo et, est. In dictum purus ac lorem. Vestibulum vel felis. In erat. Mauris sit amet est elementum ligula adipiscing vulputate. Curabitur ultrices dolor sagittis neque. Aenean adipiscing odio non lorem. Integer non odio. Nam libero. Vivamus posuere, lorem rutrum iaculis aliquet, metus nibh elementum neque, lacinia eleifend wisi libero vitae tellus. Aenean varius mauris in ipsum.<br><br>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam luctus augue blandit nisl. Etiam id lacus sed ante pulvinar euismod. Maecenas neque quam, scelerisque sed, semper id, vulputate a, eros. Suspendisse mauris erat, condimentum in, pellentesque nec, lobortis vitae, elit. Nunc nec elit quis augue viverra consequat. In eget augue. Aliquam erat volutpat. Nulla blandit massa sed velit. Quisque nonummy consectetuer lacus. Aliquam egestas augue sit amet nulla. In diam leo, lacinia eget, convallis sed, pellentesque eu, velit. Nullam sem. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.<br><br>" + "Morbi rhoncus lectus id leo lacinia blandit. Fusce felis dolor, ullamcorper id, venenatis at, rhoncus feugiat, odio. Suspendisse et nulla eget lectus iaculis elementum. Suspendisse at felis non lectus blandit commodo. Morbi volutpat. Sed eget elit nec libero lobortis consequat. Duis eget magna gravida odio pellentesque venenatis. Maecenas ligula lorem, pellentesque ut, consequat et, commodo et, est. In dictum purus ac lorem. Vestibulum vel felis. In erat. Mauris sit amet est elementum ligula adipiscing vulputate. Curabitur ultrices dolor sagittis neque. Aenean adipiscing odio non lorem. Integer non odio. Nam libero. Vivamus posuere, lorem rutrum iaculis aliquet, metus nibh elementum neque, lacinia eleifend wisi libero vitae tellus. Aenean varius mauris in ipsum.";
+  }
+  
+  i2.setAttribute("value",text);
+  
+  if (pbg.value != "") {
+    i1.setAttribute("value","<div style=\"background-image: url(" + pbg.value + ")\">" + phd.value);
+    if (psg.value != "") { 
+      i3.setAttribute("value",sep + psg.value + "</div>");
+    } else {
+      i3.setAttribute("value",psg.value + "</div>");
+    }
+  } else {
+    i1.setAttribute("value",phd.value);
+    if (psg.value != "") { 
+      i3.setAttribute("value",sep + psg.value);
+    } else {
+      i3.setAttribute("value",psg.value);
+    }
+  }
+  
+  formm.appendChild(i1);
+  formm.appendChild(i2);
+  formm.appendChild(i3);
+  formm.appendChild(i4);
+//  alert("bar: " + i3.getAttribute('value')); 
+  
+  var IFrameDoc;
+  if (d.getElementById("dataloader").contentDocument) {
+    // For NS6
+    IFrameDoc = d.getElementById("dataloader").contentDocument; 
+  } else if (d.getElementById("dataloader").contentWindow) {
+    // For IE5.5 and IE6
+    IFrameDoc = d.getElementById("dataloader").contentWindow.document;
+  } else if (d.getElementById("dataloader").document) {
+    // For IE5
+    IFrameDoc = d.getElementById("dataloader").document;
+  } 
+  
+/*	while(IFrameDoc.body.hasChildNodes() == true)
+	{
+		IFrameDoc.body.removeChild(IFrameDoc.body.childNodes[0]);
+	}*/
+  if (d.getElementById("theform")) {
+    d.body.removeChild(d.getElementById("theform"));
+  }
+  d.body.appendChild(formm);
+  
+//  alert("b: " + IFrameDoc.body.innerHTML);  
+
+//IFrameDoc.theform.submit();
+  setTimeout('submitFormStuff()',10);
+//  formm.submit();
+  
+  
+  
+/*  cnvs = doFilter(phd.value) + cnvs + ssp.value + doFilter(psg.value);
+  if (pbg.value != "") {
+    cnvs = "<div style=\"background-image: url(" + pbg.value + ")\">" + cnvs + "</div>";
+  }
+//  alert(cnvs);
+  d.getElementById("layout-preview").innerHTML = cnvs;*/
+return false;
+} else { return true; }
+}
+
+function submitFormStuff() {
+  var IFrameDoc;
+//  alert("submitformstuff");  
+  if (thedoc.getElementById("dataloader").contentDocument) {
+    // For NS6
+    IFrameDoc = thedoc.getElementById("dataloader").contentDocument; 
+  } else if (thedoc.getElementById("dataloader").contentWindow) {
+    // For IE5.5 and IE6
+    IFrameDoc = thedoc.getElementById("dataloader").contentWindow.document;
+  } else if (thedoc.getElementById("dataloader").document) {
+    // For IE5
+    IFrameDoc = thedoc.getElementById("dataloader").document;
+  } 
+//  alert("before submit: " + IFrameDoc.body.innerHTML);
+//  alert(IFrameDoc.getElementById("theform").innerHTML+"");
+//  IFrameDoc.getElementById("theform").submit();
+//  IFrameDoc.getElementById("submitbutton").click();
+//  alert("after: " + IFrameDoc.body.innerHTML);
+//  alert(foo);
+  thedoc.getElementById("theform").submit();
+}
+
+function setPreview(n,s) {
+//  alert("howdy");
+//    n = "<style>" + s + "</style>" + n;
+    thedoc.getElementById("layout-preview").innerHTML = n;
+    
+    var styleElement = document.createElement('style');
+    styleElement.type = 'text/css';
+    tn = document.createTextNode(s);
+    try {
+      styleElement.appendChild(tn);  
+    } catch(e) {
+      if (e == "[object Error]") { // we have IE
+        styleElement.innerHTML = s;
+      }
+    }
+    if (!theStyle) {
+      theStyle = document.getElementsByTagName('head')[0].appendChild(styleElement);
+    } else {
+      theStyle = document.getElementsByTagName('head')[0].replaceChild(styleElement,theStyle);
+    }
+    
+/*  try {
+  // IE can't handle inline stylesheets, so let's add them 'the right way' - replacing if we're reloading
+    if (csscreated) { css = document.styleSheets[document.styleSheets.length-1]; }
+    else { css = document.createStyleSheet(); csscreated = "1"; }
+    css.cssText = s;
+    thedoc.getElementById("layout-preview").innerHTML = n;
+  } catch(e) {
+    return;
+  }*/
+//  alert(thedoc.getElementById("layout-preview").innerHTML);
+}
\ No newline at end of file
diff --git a/js/menu.js b/js/menu.js
new file mode 100644
index 0000000..c5746a7
--- /dev/null
+++ b/js/menu.js
@@ -0,0 +1,219 @@
+//Netscape Resize fix
+if (document.layers)
+{
+  widthCheck = window.innerWidth
+  heightCheck = window.innerHeight
+}
+
+function resizeFix()
+{
+  if (widthCheck != window.innerWidth || heightCheck != window.innerHeight)
+  {
+	document.location.href = document.location.href
+  }
+}
+
+window.onerror = null;
+var DOM;
+var bName = navigator.appName;
+var bVer = parseInt(navigator.appVersion);
+var NS4 = (bName == "Netscape" && bVer >= 4 && bVer <5);
+var NS5 = (bName == "Netscape" && bVer >=5);
+var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4);
+var NS3 = (bName == "Netscape" && bVer < 4);
+var IE3 = (bName == "Microsoft Internet Explorer" && bVer < 4);
+
+if (document.getElementById)
+{
+  DOM = true;
+  NS4 = false
+}
+else
+{
+  DOM= false;
+}
+
+var MTOP = 57
+
+var menuActive = 0
+var MenuOn = 0
+var onLayer
+var timeOn = null
+var loaded = 0
+var openmenu = "";
+var closemenu = "";
+var activeLayer = "";
+
+var menu1 = new Image();
+menu1.src = "images/toolbar/invis.gif"; //Invisibol Placeholder
+
+var menu2 = new Image();
+menu2.src = menu1.src;
+ 
+// MENU COLOR VARIABLE
+var menuColor = "#000000"
+
+// LAYER SWITCHING CODE
+if (NS4 || IE4)
+{
+  if (navigator.appName == "Netscape")
+  {
+    layerStyleRef="layer.";
+    layerRef="document.layers";
+    styleSwitch="";
+  }
+  else
+  {
+    layerStyleRef="layer.style.";
+    layerRef="document.all";
+    styleSwitch=".style";
+  }
+}
+
+// SHOW MENU
+function showLayer(layerName, e)
+{
+  MenuOn=1
+  if (NS4 || IE4 || DOM)
+  {
+    if (timeOn != null)
+    {
+      clearTimeout(timeOn)
+      hideLayer(onLayer)
+    }
+    if (NS4 || IE4)
+    {
+      eval(layerName+'.style.left=e.clientX-e.offsetX');
+      eval(layerName+'.style.top=e.clientY');
+      eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
+
+      activeLayer=layerName;
+    } 
+    if (DOM)
+    {
+      document.getElementById(layerName).style.visibility='visible'
+    }
+  }
+  onLayer = layerName
+}
+
+// HIDE MENU
+function hideLayer(layerName)
+{
+  MenuOn=0
+  if (menuActive == 0)
+  {
+    if (NS4 || IE4)
+    {
+      eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
+    }
+    if (DOM)
+    {
+      document.getElementById(layerName).style.visibility='hidden'
+    }
+  }
+}
+
+// TIMER FOR BUTTON MOUSE OUT
+function btnTimer()
+{
+  if(MenuOn==1)
+  {
+    timeOn = setTimeout("btnOut()",1000)
+  }
+}
+
+// BUTTON MOUSE OUT
+function btnOut()
+{
+  hideLayer(onLayer)
+}
+
+// MENU MOUSE OVER  
+function menuOver(layerName)
+{
+  if(layerName==activeLayer)
+  {
+    clearTimeout(timeOn)
+    menuActive = 1
+    return true;
+  }
+  else
+  {
+    return false;
+  }
+}
+
+// MENU MOUSE OUT 
+function menuOut()
+{
+  menuActive = 0
+  timeOn = setTimeout("hideLayer(onLayer)", 400)
+}
+
+// Creates menu object
+function menuLink(title, url)
+{
+  this.title = title
+  this.url = url
+}
+
+// Builds menu table
+function menuMaker(menuArray, fontcolor, backcolor, lightcolor, darkcolor)
+{
+  topTable = ""
+  btmTable = ""
+
+  n = ""
+  j = eval(menuArray + ".length")-1;
+
+  topTable = "<div ID='" + eval(menuArray + ".id") + "' STYLE='POSITION: absolute; LEFT: 0; TOP: 0; VISIBILITY: hidden; Z-INDEX: 1'>"
+  topTable+="<table border='0' cellspacing='0' cellpadding='0'>"
+  topTable+="<TR><TD bgcolor='"+lightcolor+"'></TD><TD bgcolor='"+lightcolor+"' ALT='Top Border'></TD><TD bgcolor='"+lightcolor+"' ALT='Top Right Small Background'><img src=images/toolbar/invis.gif height=1 width=1></TD><TD bgcolor='"+lightcolor+"'></TD>"
+  topTable+="</TR><TR><TD bgcolor='"+lightcolor+"'><img src=images/toolbar/invis.gif></TD>"
+  topTable+="<TD colspan='2'>"
+  topTable+="<table border='0' cellspacing='0' cellpadding='0'>"
+
+  btmTable = "</table>"
+  btmTable+="</TD><TD bgcolor='"+darkcolor+"'><img src=images/toolbar/invis.gif></TD></TR>"
+  //btmTable+="</TR><TR><TD bgcolor='"+darkcolor+"'></TD><TD bgcolor='"+darkcolor+"' ALT='Lower Right Side Border'><img src=images/toolbar/invis.gif></TD></TR>"
+  btmTable+="<TR><TD bgcolor='"+darkcolor+"' ALT='Lower Right Corner Border'></TD><TD bgcolor='"+darkcolor+"'></TD><TD bgcolor='"+darkcolor+"'></TD><TD bgcolor='"+darkcolor+"'></TD></TR></TABLE>"
+  btmTable+="</div>"
+ 
+  bgnrow = ""
+  for( var i = 0; i <=j; i++)
+  {
+    test=eval(menuArray + "[" + i + "].title")
+    bgnrow += "<tr valign=Center><td bgcolor='"+backcolor+"' align=Center width=100%><a onMouseOut='menuOut()' onMouseOver='menuOver(activeLayer)' class='menus' target='_top'><img src='images/toolbar/invis.gif' width=15 height=15 border='0'></a>"
+    bgnrow += "<a onClick='" + eval(menuArray + "[" + i + "].url") + "' onMouseOut='menuOut()' onMouseOver='menuOver(activeLayer)' class='menus' target='_top'><font face='MS Sans Serif, Western' size=1 color='"+fontcolor+"'>" + test + "</font></td></tr>"
+  }
+
+  n= topTable+bgnrow+btmTable
+  return n;
+}
+
+function getScale()
+{
+  var scale;
+  var newwidth
+  if (bName == "Netscape")
+  {
+    newwidth =  window.innerWidth
+  } 
+  else
+  {
+    newwidth=  document.body.clientWidth
+  }
+	
+  center = ((newwidth-371)/2)+251;
+
+  minWidth = 539
+  if (center <minWidth)
+  {
+    return minWidth;
+  }
+  else
+  {
+    return center;
+  }
+}
\ No newline at end of file
diff --git a/js/password.js b/js/password.js
new file mode 100644
index 0000000..35d78a2
--- /dev/null
+++ b/js/password.js
@@ -0,0 +1,77 @@
+function checkName()
+{
+  if (window.document.REPLIER.username.value == '')
+  {
+    alert('Please Enter Your Username');
+    return true;
+  }
+  else
+  {
+    return false;
+  }
+}
+
+function checkPass()
+{
+  if (window.document.REPLIER.password.value == '')
+  {
+    alert('Please Enter Your Password');
+    return true;
+  }
+  else
+  {
+    return false;
+  }
+}
+
+function checkTitle()
+{
+  if (window.document.REPLIER.subject.value == '')
+  {
+    alert('Please Enter Your Thread Title');
+    return true;
+  }
+  else
+  {
+    return false;
+  }
+}
+
+function checkPost()
+{
+  if (window.document.REPLIER.message.value == '')
+  {
+    alert('Please Enter Your Message');
+    return true;
+  }
+  else
+  {
+    return false;
+  }
+}
+
+function checkReciever()
+{
+  if (window.document.REPLIER.username.value == '')
+  {
+    alert('Please Enter The Recieving User');
+    return true;
+  }
+  else
+  {
+    return false;
+  }
+}
+
+function checkSubject()
+{
+  if (window.document.REPLIER.subject.value == '')
+  {
+    alert('Please Enter The Subject');
+    return true;
+  }
+  else
+  {
+    return false;
+  }
+}
\ No newline at end of file
diff --git a/js/png.js b/js/png.js
new file mode 100644
index 0000000..0794f17
--- /dev/null
+++ b/js/png.js
@@ -0,0 +1,20 @@
+if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
+	document.writeln('<style type="text/css">img { visibility:hidden; } </style>');
+	window.attachEvent("onload", fnLoadPngs);
+}
+
+function fnLoadPngs() {
+	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
+	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
+
+	for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
+		if (itsAllGood && img.src.match(/\.png$/i) != null) {
+			var src = img.src;
+			img.style.width = img.width + "px";
+			img.style.height = img.height + "px";
+			img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')"
+			img.src = "images/_.gif";
+		}
+		img.style.visibility = "visible";
+	}
+}
\ No newline at end of file
diff --git a/js/snow.js b/js/snow.js
new file mode 100644
index 0000000..365ba70
--- /dev/null
+++ b/js/snow.js
@@ -0,0 +1,84 @@
+var snow = new Array();
+var captions = new Array();
+var halt = 0;
+
+captions[ 0]	= "happy 100000th post!";
+
+var snowfnam	= new Array();
+snowfnam[ 0]	= "/images/confetti/confetti_blue.png";
+snowfnam[ 1]	= "/images/confetti/confetti_yellow.png";
+snowfnam[ 2]    = "/images/confetti/confetti_green.png";
+snowfnam[ 3]    = "/images/confetti/confetti_red.png";
+
+var MaxFPS = 60;
+
+function update_snow() {
+	if (halt == 1) { return null; }
+	var innerHeight = window.innerHeight;
+	var innerWidth  = window.innerWidth;
+	for (var i = 0; i < snow.length; i++) {
+		var thisflake      = snow[i]; // local referencing.
+		var _posy = thisflake.posy;
+		var _posx = thisflake.posx;
+		if ((_posy + 8) > innerHeight || (_posx + 8) > innerWidth || (_posx - 8) < 0) {
+			_posy = 0;
+			left = Math.random()*innerWidth;
+			thisflake.style.left = left;
+			_posx = left;
+			thisflake.scrollfactor_x = Math.random()*-5;
+			thisflake.scrollfactor_y = (Math.random()*15) + .5;
+			if (Math.round(Math.random()*10) % 5 == 0) {
+				thisflake.scrollfactor_x *= -1;
+			}
+		}
+		_posy += thisflake.scrollfactor_y;
+		_posx += thisflake.scrollfactor_x;
+		thisflake.style.top = _posy;
+		thisflake.style.left = _posx;
+		thisflake.posy = _posy;
+		thisflake.posx = _posx;
+	}
+}
+
+function snow_halt() {
+	halt = 1;
+}
+
+function snow_unhalt() {
+	halt = 0;
+}
+function drawsnow() {
+	var flakes = 25;
+	
+	var element = document.createElement("div");
+	element.id = "snow_canvas";
+	document.body.appendChild(element);
+	for (var i = 0; i < flakes; i++) {
+		var flakeimg = document.createElement("img");
+		flakeimg.style.display = "block";
+		flakeimg.style.position = "fixed";
+		flakeimg.style.zIndex   = 1;
+		pleft = Math.random()*window.innerWidth;
+		ptop  = Math.random()*window.innerHeight;
+		flakeimg.style.left = pleft + "px";
+		flakeimg.style.top = ptop + "px";
+		flakeimg.scrollfactor_x = (Math.random() * 2 - 1);
+		flakeimg.scrollfactor_y = (Math.random()*10) + 1;
+//		if (Math.round(Math.random()*10) % 5 == 0) {
+//			flakeimg.scrollfactor_x *= -1;
+//		}
+		flakeimg.posx = pleft;
+		flakeimg.posy = ptop;
+		flakeimg.src = snowfnam[Math.round(Math.random()*3)];
+		flakeimg.title	= captions[0];
+		temp	= Math.round(Math.random() * 4 + 3);
+		flakeimg.width	= temp;
+		flakeimg.height	= temp;
+		snow.push(flakeimg);
+		element.appendChild(flakeimg);
+	}
+	setInterval(update_snow, 66);
+}
+window.addEventListener("load", function() {drawsnow();}, false);
+window.addEventListener("blur", function() {snow_halt()}, false);
+window.addEventListener("focus", function() {snow_unhalt()}, false);
diff --git a/js/snowflakes.js b/js/snowflakes.js
new file mode 100644
index 0000000..a6d04f1
--- /dev/null
+++ b/js/snowflakes.js
@@ -0,0 +1,472 @@
+/*
+   DHTML PNG Snowstorm! OO-style Jascript-based Snow effect
+   --------------------------------------------------------
+   Version 1.3.20081215 (Previous rev: v1.2.20041121a)
+   Dependencies: GIF/PNG images (0 through 4.gif/png)
+   Code by Scott Schiller - http://schillmania.com
+   --------------------------------------------------------
+   Description:
+  
+   Initializes after body onload() by default (via addEventHandler() call at bottom.)
+  
+   Properties:
+  
+   usePNG
+   ---------------
+   Enables PNG images if supported ("false" falls back to GIF)
+  
+   flakeTypes
+   ---------------
+   Sets the range of flake images to use (eg. a value of 5
+   will use images ranging from 0.png to 4.png.)
+  
+   flakesMax
+   ---------------
+   Sets the maximum number of snowflakes that can exist on
+   the screen at any given time.
+   
+   flakesMaxActive
+   ---------------
+   Sets the limit of "falling" snowflakes (ie. moving, thus
+   considered to be "active".)
+  
+   vMax
+   ---------------
+   Defines the maximum X and Y velocities for the storm.
+   A range up to this value is selected at random.
+  
+   flakeWidth
+   ---------------
+   The width (in pixels) of each snowflake image.
+  
+   flakeHeight
+   ---------------
+   Height (pixels) of each snowflake image.
+   
+   flakeBottom
+   ---------------
+   Limits the "bottom" coordinate of the snow.
+
+   snowStick
+   ---------------
+   Allows the snow to "stick" to the bottom of the window.
+   When off, snow will never sit at the bottom.
+  
+   snowCollect
+   ---------------
+   Enables snow to pile up (slowly) at bottom of window.
+   Can be very CPU/resource-intensive over time.
+   Also requires snowStick = true.
+
+   followMouse
+   ---------------
+   Allow the mouse to affect the "wind", left-to-right.
+
+*/
+
+var snowStorm = null;
+
+function SnowStorm() {
+
+  // PROPERTIES
+  // ------------------
+
+  var imagePath = 'images/snow/'; // relative path to snow images (including trailing slash)
+  var flakesMax = 128; 
+  var flakesMaxActive = 64;
+  var vMaxX = 12;
+  var vMaxY = 10;
+  var usePNG = false;
+  var flakeBottom = null;        // Integer for fixed bottom, 0 or null for "full-screen" snow effect
+  var snowStick = false;
+  var snowCollect = false;
+  var targetElement = null;      // element which snow will be appended to (document body if undefined)
+  var followMouse = false;
+  var flakeTypes = 1;
+  var flakeWidth = 8;
+  var flakeHeight = 8;
+
+  // ------------------
+
+  var zIndex = 1; // CSS stacking order applied to each snowflake
+  var flakeLeftOffset = 0; // amount to subtract from edges of container
+  var flakeRightOffset = 0; // amount to subtract from edges of container
+
+  // --- End of user section ---
+
+  var addEvent = function(o,evtName,evtHandler) {
+    typeof(attachEvent)=='undefined'?o.addEventListener(evtName,evtHandler,false):o.attachEvent('on'+evtName,evtHandler);
+  }
+
+  var removeEvent = function(o,evtName,evtHandler) {
+    typeof(attachEvent)=='undefined'?o.removeEventListener(evtName,evtHandler,false):o.detachEvent('on'+evtName,evtHandler);
+  }
+
+  var classContains = function(o,cStr) {
+    return (typeof(o.className)!='undefined'?o.className.indexOf(cStr)+1:false);
+  }
+
+  var s = this;
+  var storm = this;
+  this.timers = [];
+  this.flakes = [];
+  this.disabled = false;
+  this.terrain = [];
+  this.active = false;
+
+  var isIE = navigator.userAgent.match(/msie/i);
+  var isIE6 = navigator.userAgent.match(/msie 6/i);
+  var isOldIE = (isIE && (isIE6 || navigator.userAgent.match(/msie 5/i)));
+  var isWin9X = navigator.appVersion.match(/windows 98/i);
+  var isiPhone = navigator.userAgent.match(/iphone/i);
+  var isBackCompatIE = (isIE && document.compatMode == 'BackCompat');
+  var isOpera = navigator.userAgent.match(/opera/i);
+  if (isOpera) isIE = false; // Opera (which may be sneaky, pretending to be IE by default)
+  var noFixed = (isBackCompatIE || isIE6 || isiPhone);
+  var screenX = null;
+  var screenX2 = null;
+  var screenY = null;
+  var scrollY = null;
+  var vRndX = null;
+  var vRndY = null;
+  var windOffset = null;
+  var windMultiplier = null;
+  var pngSupported = (!isIE || (isIE && !isIE6 && !isOldIE)); // IE <7 doesn't do PNG nicely without crap filters
+  var docFrag = document.createDocumentFragment();
+  this.oControl = null; // toggle element
+  if (flakeLeftOffset == null) flakeLeftOffset = 0;
+  if (flakeRightOffset == null) flakeRightOffset = 0;
+
+  function rnd(n,min) {
+    if (isNaN(min)) min = 0;
+    return (Math.random()*n)+min;
+  }
+
+  this.randomizeWind = function() {
+    vRndX = plusMinus(rnd(vMaxX,0.2));
+    vRndY = rnd(vMaxY,0.2);
+    if (this.flakes) {
+      for (var i=0; i<this.flakes.length; i++) {
+        if (this.flakes[i].active) this.flakes[i].setVelocities();
+      }
+    }
+  }
+
+  function plusMinus(n) {
+    return (parseInt(rnd(2))==1?n*-1:n);
+  }
+
+  this.scrollHandler = function() {
+    // "attach" snowflakes to bottom of window if no absolute bottom value was given
+    scrollY = (flakeBottom?0:parseInt(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop));
+    if (isNaN(scrollY)) scrollY = 0; // Netscape 6 scroll fix
+    if (!flakeBottom && s.flakes) {
+      for (var i=0; i<s.flakes.length; i++) {
+        if (s.flakes[i].active == 0) s.flakes[i].stick();
+      }
+    }
+  }
+
+  this.resizeHandler = function() {
+    if (window.innerWidth || window.innerHeight) {
+      screenX = window.innerWidth-(!isIE?16:2)-flakeRightOffset;
+      screenY = (flakeBottom?flakeBottom:window.innerHeight);
+    } else {
+      screenX = (document.documentElement.clientWidth||document.body.clientWidth||document.body.scrollWidth)-(!isIE?8:0)-flakeRightOffset;
+      screenY = flakeBottom?flakeBottom:(document.documentElement.clientHeight||document.body.clientHeight||document.body.scrollHeight);
+    }
+    screenX2 = parseInt(screenX/2);
+  }
+
+  this.resizeHandlerAlt = function() {
+    screenX = targetElement.offsetLeft+targetElement.offsetWidth-flakeRightOffset;
+    screenY = flakeBottom?flakeBottom:targetElement.offsetTop+targetElement.offsetHeight;
+    screenX2 = parseInt(screenX/2);
+  }
+
+  this.freeze = function() {
+    // pause animation
+    if (!s.disabled) {
+      s.disabled = 1;
+    } else {
+      return false;
+    }
+    for (var i=0; i<s.timers.length; i++) {
+      clearInterval(s.timers[i]);
+    }
+  }
+
+  this.resume = function() {
+    if (s.disabled) {
+       s.disabled = 0;
+    } else {
+      return false;
+    }
+    s.timerInit();
+  }
+
+  this.toggleSnow = function() {
+    if (!s.flakes.length) {
+      // first run
+      s.start();
+      s.setControlActive(true);
+    } else {
+      s.active = !s.active;
+      if (s.active) {
+        s.show();
+        s.resume();
+        s.setControlActive(true);
+      } else {
+        s.stop();
+        s.freeze();
+        s.setControlActive(false);
+      }
+    }
+  }
+
+  this.stop = function() {
+    this.freeze();
+    for (var i=this.flakes.length; i--;) {
+      this.flakes[i].o.style.display = 'none';
+    }
+    removeEvent(window,'scroll',s.scrollHandler);
+    removeEvent(window,'resize',s.resizeHandler);
+    if (!isIE) {
+      removeEvent(window,'blur',s.freeze);
+      removeEvent(window,'focus',s.resume);
+    }
+    // removeEventHandler(window,'resize',this.resizeHandler,false);
+  }
+
+  this.show = function() {
+    for (var i=this.flakes.length; i--;) {
+      this.flakes[i].o.style.display = 'block';
+    }
+  }
+
+  this.SnowFlake = function(parent,type,x,y) {
+    var s = this;
+    var storm = parent;
+    this.type = type;
+    this.x = x||parseInt(rnd(screenX-20));
+    this.y = (!isNaN(y)?y:-rnd(screenY)-12);
+
+    if (this.x < 0) {
+	    this.x = this.x * -1;
+    }
+    if (this.y < 0) {
+	    this.y = this.y * -1;
+    }
+    this.vX = null;
+    this.vY = null;
+    this.vAmpTypes = [2.0,1.0,1.25,1.0,1.5,1.75]; // "amplification" for vX/vY (based on flake size/type)
+    this.vAmp = this.vAmpTypes[this.type];
+
+    this.active = 1;
+    this.o = document.createElement('img');
+    this.o.style.position = 'absolute';
+    this.o.style.width = flakeWidth+'px';
+    this.o.style.height = flakeHeight+'px';
+    this.o.style.fontSize = '1px'; // so IE keeps proper size
+    this.o.style.zIndex = zIndex;
+    this.o.src = imagePath+this.type+(pngSupported && usePNG?'.png':'.gif');
+    docFrag.appendChild(this.o);
+
+    this.refresh = function() {
+      s.o.style.left = s.x+'px';
+      s.o.style.top = s.y+'px';
+    }
+
+    this.stick = function() {
+      if (noFixed || (targetElement != document.documentElement && targetElement != document.body)) {
+	s.o.style.top = (screenY+scrollY-flakeHeight-storm.terrain[Math.floor(s.x)])+'px';
+      } else {
+        s.o.style.display = 'none';
+	s.o.style.top = 'auto';
+        s.o.style.bottom = '0px';
+	s.o.style.position = 'fixed';
+        s.o.style.display = 'block';
+      }
+    }
+
+    this.vCheck = function() {
+      if (s.vX>=0 && s.vX<0.2) {
+        s.vX = 0.2;
+      } else if (s.vX<0 && s.vX>-0.2) {
+        s.vX = -0.2;
+      }
+      if (s.vY>=0 && s.vY<0.2) {
+        s.vY = 0.2;
+      }
+    }
+
+    this.move = function() {
+      var vX = s.vX*windOffset;
+      s.x += vX;
+      s.y += (s.vY*s.vAmp);
+      if (vX >= 0 && (s.x >= screenX || screenX-s.x < (flakeWidth+1))) { // X-axis scroll check
+        s.x = 0;
+      } else if (vX < 0 && s.x-flakeLeftOffset<0-flakeWidth) {
+        s.x = screenX-flakeWidth-1; // flakeWidth;
+      }
+      s.refresh();
+      var yDiff = screenY+scrollY-s.y-storm.terrain[Math.floor(s.x)];
+      if (yDiff<flakeHeight) {
+        s.active = 0;
+        if (snowCollect && snowStick) {
+          var height = [0.75,1.5,0.75];
+          for (var i=0; i<2; i++) {
+            storm.terrain[Math.floor(s.x)+i+2] += height[i];
+          }
+        }
+        s.o.style.left = (s.x/screenX*100)+'%'; // set "relative" left (change with resize)
+        if (!flakeBottom) {
+	  if (snowStick) {
+            s.stick();
+	  } else {
+	    s.recycle();
+	  }
+        }
+      }
+
+    }
+
+    this.animate = function() {
+      // main animation loop
+      // move, check status, die etc.
+      s.move();
+    }
+
+    this.setVelocities = function() {
+      s.vX = vRndX+rnd(vMaxX*0.12,0.8);
+      s.vY = vRndY+rnd(vMaxY*0.12,0.8);
+    }
+
+    this.recycle = function() {
+      s.o.style.display = 'none';
+      s.o.style.position = 'absolute';
+      s.o.style.bottom = 'auto';
+      s.setVelocities();
+      s.vCheck();
+      s.x = parseInt(rnd(screenX-flakeWidth-20));
+      s.y = parseInt(rnd(screenY)*-1)-flakeHeight;
+      s.o.style.left = s.x+'px';
+      s.o.style.top = s.y+'px';
+      s.o.style.display = 'block';
+      s.active = 1;
+    }
+
+    this.recycle(); // set up x/y coords etc.
+    this.refresh();
+
+  }
+
+  this.snow = function() {
+    var active = 0;
+    var used = 0;
+    var waiting = 0;
+    for (var i=s.flakes.length; i--;) {
+      if (s.flakes[i].active == 1) {
+        s.flakes[i].move();
+        active++;
+      } else if (s.flakes[i].active == 0) {
+        used++;
+      } else {
+        waiting++;
+      }
+    }
+    if (snowCollect && !waiting) { // !active && !waiting
+      // create another batch of snow
+      s.createSnow(flakesMaxActive,true);
+    }
+    if (active<flakesMaxActive) {
+      with (s.flakes[parseInt(rnd(s.flakes.length))]) {
+        if (!snowCollect && active == 0) {
+          recycle();
+        } else if (active == -1) {
+          active = 1;
+        }
+      }
+    }
+  }
+
+  this.mouseMove = function(e) {
+    if (!followMouse) return true;
+    var x = parseInt(e.clientX);
+    if (x<screenX2) {
+      windOffset = -windMultiplier+(x/screenX2*windMultiplier);
+    } else {
+      x -= screenX2;
+      windOffset = (x/screenX2)*windMultiplier;
+    }
+  }
+
+  this.createSnow = function(limit,allowInactive) {
+    for (var i=0; i<limit; i++) {
+      s.flakes[s.flakes.length] = new s.SnowFlake(s,parseInt(rnd(flakeTypes)));
+      if (allowInactive || i>flakesMaxActive) s.flakes[s.flakes.length-1].active = -1;
+    }
+    targetElement.appendChild(docFrag);
+  }
+
+  this.timerInit = function() {
+    s.timers = (!isWin9X?[setInterval(s.snow,20)]:[setInterval(s.snow,75),setInterval(s.snow,25)]);
+  }
+
+  this.init = function() {
+    for (var i=0; i<2048; i++) {
+      s.terrain[i] = 0;
+    }
+    s.randomizeWind();
+    s.createSnow(snowCollect?flakesMaxActive:flakesMaxActive*2); // create initial batch
+    addEvent(window,'resize',s.resizeHandler);
+    addEvent(window,'scroll',s.scrollHandler);
+    if (!isIE) {
+      addEvent(window,'blur',s.freeze);
+      addEvent(window,'focus',s.resume);
+    }
+    s.resizeHandler();
+    s.scrollHandler();
+    if (followMouse) {
+      addEvent(document,'mousemove',s.mouseMove);
+    }
+    s.timerInit();
+  }
+
+  var didInit = false;
+
+  this.start = function(bFromOnLoad) {
+	if (!didInit) {
+	  didInit = true;
+	} else if (bFromOnLoad) {
+	  // already loaded and running
+	  return true;
+	}
+    if (typeof targetElement == 'string') {
+      targetElement = document.getElementById(targetElement);
+      if (!targetElement) throw new Error('Snowstorm: Unable to get targetElement');
+    }
+	if (!targetElement) {
+	  targetElement = (!isIE?(document.documentElement?document.documentElement:document.body):document.body);
+	}
+    if (targetElement != document.documentElement && targetElement != document.body) s.resizeHandler = s.resizeHandlerAlt; // re-map handler to get element instead of screen dimensions
+    s.resizeHandler(); // get bounding box elements
+    if (screenX && screenY && !s.disabled) {
+      s.init();
+      s.active = true;
+    }
+  }
+
+  if (document.addEventListener) {
+	// safari 3.0.4 doesn't do DOMContentLoaded, maybe others - use a fallback to be safe.
+	document.addEventListener('DOMContentLoaded',function(){s.start(true)},false);
+    window.addEventListener('load',function(){s.start(true)},false);
+  } else {
+    addEvent(window,'load',function(){s.start(true)});
+  }
+
+}
+
+
+
+snowStorm = new SnowStorm();
diff --git a/js/toolbar.js b/js/toolbar.js
new file mode 100644
index 0000000..7bbf318
--- /dev/null
+++ b/js/toolbar.js
@@ -0,0 +1,86 @@
+  imgFColor = new Image();
+  imgFColor.src = "images/toolbar/fcolor.gif";
+
+  imgBGColor = new Image();
+  imgBGColor.src = "images/toolbar/bgcolor.gif";
+
+  imgBold = new Image();
+  imgBold.src = "images/toolbar/bold.gif";
+
+  imgItalic = new Image();
+  imgItalic.src = "images/toolbar/italic.gif";
+
+  imgUnderline = new Image();
+  imgUnderline.src = "images/toolbar/underline.gif";
+
+  imgStrike = new Image();
+  imgStrike.src = "images/toolbar/strike.gif";
+
+  imgLink = new Image();
+  imgLink.src = "images/toolbar/link.gif";
+
+  imgImage = new Image();
+  imgImage.src = "images/toolbar/image.gif"
+
+  imgSmiley = new Image();
+  imgSmiley.src = "images/toolbar/smiley.gif";
+
+  var mnuFGround = "Menu1";
+  var mnuBGround = "Menu2";
+  var mnuSmiley = "Menu3";
+
+  var btnfcolorname = "FColor";
+  var btnbgcolorname = "BGColor";
+  var btnboldname = "bold";
+  var btnitalname = "italic";
+  var btnundname = "underline";
+  var btnstrikename = "strike";
+  var btnlinkname = "link";
+  var btnimagename = "image";
+  var btnsmileyname = "smiley";
+
+  var boldOpen = "[b]";
+  var boldClose = "[/b]";
+  var boldDown = 0;
+
+  var italOpen = "[i]";
+  var italClose = "[/i]";
+  var italDown = 0;
+
+  var undOpen = "[u]";
+  var undClose = "[/u]";
+  var undDown = 0;
+
+  var strkOpen = "[s]";
+  var strkClose = "[/s]";
+  var strkDown = 0;
+
+  var linkOpen = "[url]";
+  var linkClose = "[/url]";
+  var linkDown = 0;
+
+  var imageOpen = "[img]";
+  var imageClose = "[/img]";
+  var imageDown = 0;
+  
+  function checkBrowser()
+  {
+    return (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4); //checks to see if IE is running
+  }
+
+  function checkKey(btnNumber, e)
+  {
+    if(e.keyCode==btnNumber)
+    {
+      return true;
+    }
+    else
+    {
+      return false;
+    }
+  }
+
+  function doCode(code)
+  {
+    window.document.REPLIER.message.value+=code;
+  }
\ No newline at end of file
diff --git a/js/useful.js b/js/useful.js
new file mode 100644
index 0000000..90500ed
--- /dev/null
+++ b/js/useful.js
@@ -0,0 +1,37 @@
+// placeholder for useful shit 8)
+$("a.popout").click(function() {window.open(event.target.href, event.target.title, "toolbar=no,scrollbars=no,status=no,width=648,height=480"); event.preventDefault();});
+var options = {"fgcolor": "#FFFFFF"};
+
+function amax(a) {
+		return Math.max.apply(null, a);
+}
+
+function sparkline(e, data) {
+	var ctx = e.getContext("2d");
+	var inc = Math.round(e.width / data.length);
+	var penx = 0;
+	var shigh = amax(data); // highest point
+	
+	ctx.strokeStyle = options["fgcolor"];
+	ctx.beginPath();
+	ctx.moveTo(0,e.height - Math.round(e.height * (data[0] / shigh)));
+	for (var i = 0; i < data.length-1; i++) {
+		ctx.lineTo(penx + inc, e.height - Math.round(e.height * (data[i+1] / shigh)));
+		penx += inc;
+	}
+	ctx.stroke();
+}
+
+$(".sparkline").each(function(e) {
+	var d = $(this).text().split(",");
+	var a = d.map(function(q){return Number(q);});
+	var c = document.createElement("canvas");
+	c.width = $(this).width()
+	c.height =$(this).height();
+	c.id = "sparkline_"+e;
+	$(this).html("");
+	$(c).appendTo($(this));
+	c = document.getElementById(c.id);
+	sparkline(c, a);
+	$(this).show();
+});
\ No newline at end of file
diff --git a/latestposts.php b/latestposts.php
new file mode 100644
index 0000000..02a9853
--- /dev/null
+++ b/latestposts.php
@@ -0,0 +1,93 @@
+<?php
+	require 'lib/function.php';
+  $maxtime  = (($_GET['t']) ? max(min($_GET['t'], 86400), 60) : false);
+  $maxposts = (($_GET['p']) ? max(min($_GET['p'], 100),   1)  : false);
+  if ($maxtime === false && $maxposts === false) $maxposts = 50; // Default
+
+	$data	= $sql->query(
+		"SELECT p.id, p.user, p.date as date, f.title as ftitle, t.forum as fid, t.title as title, ".
+		"u.name as uname, u.sex as usex, u.powerlevel as upowerlevel ".
+		(($log) ? ", r.read AS tread, r.time as treadtime " : "").
+		"FROM `posts` p ".
+		"LEFT JOIN `threads` t ON p.thread = t.id ".
+		"LEFT JOIN `forums` f ON t.forum = f.id ".
+		"LEFT JOIN `users` u ON p.user = u.id ".
+		(($log) ? "LEFT JOIN threadsread r ON (t.id=r.tid AND r.uid=$loguser[id]) " : "").
+		"\n WHERE f.minpower <= '". $loguser['powerlevel'] ."' ".
+		"AND p.date >= ".(($maxtime !== false)  ? (ctime()-$maxtime) : (ctime()-86400*7))." ". // time limit here
+    (($_GET['lastid'])     ? "AND p.id > $_GET[lastid] ":"").
+		"\nORDER BY `id` DESC ".
+		(($maxposts !== false) ? "LIMIT 0, $maxposts" : '') // posts limit here
+	);
+	$_count = @mysql_num_rows($data);
+
+	$output	= "";
+	if ($_GET['raw']) {
+		$outarray	= array('id', 'ftitle', 'fid', 'title', 'uname', 'upowerlevel', 'usex', 'ucolor', 'date', 'user');
+		$outchunks = Array();
+	}
+
+	$windowtitle	= "$boardname - A revolution in posting technology&trade;";
+	require 'lib/layout.php';
+
+	if($log && !$_GET['raw']) {
+		$headlinks.=' - <a href=index.php?action=markallforumsread>Mark all posts read</a>';
+		$header=makeheader($header1,$headlinks,$header2);
+
+		$forumread = $sql->getresultsbykey("SELECT forum,readdate FROM forumread WHERE user=$loguserid", 'forum', 'readdate');
+	}
+
+	$_counter = 1;
+	while ($in = $sql->fetch($data, MYSQL_ASSOC)) {
+		if (!$_GET['raw']) {
+			if ($log && $in['date'] > max($forumread[$in['fid']], $in['treadtime']))
+				$newpost = $statusicons['new']."&nbsp";
+			else $newpost = "";
+			$output	.= "<tr>
+					$tccell2>". $in['id'] ."</td>
+					$tccell2><a href='forum.php?id=". $in['fid'] ."'>". $in['ftitle'] ."</a></td>
+					$tccell1l>$newpost<a href='thread.php?pid=". $in['id'] ."&r=1#". $in['id'] ."'>". $in['title'] ."</a></td>
+					$tccell1><a href='profile.php?id=". $in['user'] ."'><font ". getnamecolor($in['usex'], $in['upowerlevel']) .">". $in['uname'] ."</font></a></td>
+					$tccell2>". timeunits(ctime() - $in['date']) ."</td>
+				</tr>\n";
+		}
+		else {
+			$in['ucolor']	= str_replace('color=', '', getnamecolor($in['usex'], $in['upowerlevel']));
+			$in['title'] = str_replace("\\", "\\\\", $in['title']);
+			$temp	= Array();
+			foreach($outarray as $outkey)
+				$temp[] = ('"'.$outkey . "\":\"" . htmlspecialchars($in[$outkey]) . '"');
+			$temp = "{".implode(",",$temp)."}".($_counter == $_count ? "" : ",");
+			$output	.= $temp;
+		}
+		$_counter++;
+	}
+
+	if (!$_GET['raw']) {
+/* Doesn't work, as far as I'm aware?
+		if ($_GET['fungies']) {
+			$jscripts	= '<script type="text/javascript" src="/js/jquery.min.js"></script><script type="text/javascript" src="/js/latestposts.js"></script>';
+		} */
+		print "
+			$header
+			Show:$smallfont
+			<br>Last <a href='?t=1800'>30 minutes</a> - <a href='?t=3600'>1 hour</a> - <a href='?t=18000'>5 hours</a> - <a href='?t=86400'>1 day</a>
+			<br>Most recent <a href='?p=20'>20 posts</a> - <a href='?p=50'>50 posts</a> - <a href='?p=100'>100 posts</a>
+			<table class='table' cellspacing='0' name='latest'>
+				<tr>$tccellc colspan=6><b>Latest Posts</b></td></tr>
+				<tr>
+				$tccellh width=30>&nbsp;</td>
+				$tccellh width=280>Forum</td>
+				$tccellh width=*>Thread</td>
+				$tccellh width=200>User</td>
+				$tccellh width=130>Time</td>
+				</tr>
+				$output
+		". $tblend . $jscripts . $footer;
+		printtimedif($startingtime);
+	}
+	else {
+		header("Content-type: text/plain");
+		header("Ajax-request: ".IS_AJAX_REQUEST);
+		print '{"tzoff": "'.$tzoff.'", "localtime": "'.ctime().'", "posts": ['.$output."]}";
+	}
diff --git a/lib/.htaccess b/lib/.htaccess
new file mode 100644
index 0000000..729aedd
--- /dev/null
+++ b/lib/.htaccess
@@ -0,0 +1 @@
+#RedirectMatch 404 /
\ No newline at end of file
diff --git a/lib/colors.php b/lib/colors.php
new file mode 100644
index 0000000..7762dec
--- /dev/null
+++ b/lib/colors.php
@@ -0,0 +1,133 @@
+<?php
+/*
+	if (!$x_hacks['host']) {
+		if ($loguserid == 1) $boardtitle	= "";
+
+		$autobancount = $sql->fetchq("SELECT COUNT(*) AS cnt, MAX(`date`) as time FROM `ipbans` WHERE `reason` LIKE 'Autoban'", MYSQL_ASSOC);
+		$totalbancount = $sql->fetchq("SELECT COUNT(*) AS cnt, MAX(`date`) as time FROM `ipbans`", MYSQL_ASSOC);
+
+		$boardtitle	.= "<br><font class=font color=#ff0000><b>If you got banned, PM an admin for a password change</b></font><br><font class=fonts>". $autobancount['cnt'] ." automatic IP bans have been issued, last ". timeunits2(ctime() - $autobancount['time']) ." ago"
+			."<br>". $totalbancount['cnt'] ." IP bans have been issued in total, last ". timeunits2(ctime() - $totalbancount['time']) ." ago";
+	
+		$boardtitle= "<span style='font-size: 40pt; font-variant: small-caps; color: #f33;'>The Hivemind Collective</span><br><span style='font-size: 6pt; font-variant: small-caps; color: #c00'>(because a group of friends sharing a similar opinion is totally hivemind, dood!)</span>";
+	}
+*/
+
+	$pwlnames=array('-2'=>'Permabanned','-1'=>'Banned','Normal','Normal +','Moderator','Administrator','Sysadmin');
+	$nmcol[0]=array('-2'=>'6a6a6a','-1'=>'888888','97ACEF','D8E8FE','AFFABE','FFEA95');
+	$nmcol[1]=array('-2'=>'767676','-1'=>'888888','F185C9','FFB3F3','C762F2','C53A9E');
+	$nmcol[2]=array('-2'=>'767676','-1'=>'888888','7C60B0','EEB9BA','47B53C','F0C413');
+
+	$linkcolor='FFD040';
+	$linkcolor2='F0A020';
+	$linkcolor3='FFEA00';
+	$linkcolor4='FFFFFF';
+	$textcolor='E0E0E0';
+
+	$font	='verdana';
+	$font2	='verdana';
+	$font3	='tahoma';
+
+	$newpollpic		= '<img src="images/newpoll.png" alt="New poll" align="absmiddle">';
+	$newreplypic	= '<img src="images/newreply.png" alt="New reply" align="absmiddle">';
+	$newthreadpic	= '<img src="images/newthread.png" alt="New thread" align="absmiddle">';
+	$closedpic		= '<img src="images/threadclosed.png" alt="Thread closed" align="absmiddle">';
+	$numdir			='jul/';
+
+	$statusicons['new']			= '<img src=images/new.gif>';
+	$statusicons['newhot']		= '<img src=images/hotnew.gif>';
+	$statusicons['newoff']		= '<img src=images/off.gif>';
+	$statusicons['newhotoff']	= '<img src=images/hotoff.gif>';
+	$statusicons['hot']			= '<img src=images/hot.gif>';
+	$statusicons['hotoff']		= '<img src=images/hotoff.gif>';
+	$statusicons['off']			= '<img src=images/off.gif>';
+
+	$statusicons['getnew']		= '<img src=images/getnew.png title="Go to new posts" align="absmiddle">';
+	$statusicons['getlast']		= '<img src=images/getlast.png title="Go to last post" style="position:relative;top:1px;">';
+
+	$statusicons['sticky']		= 'Sticky:';
+	$statusicons['poll']		= 'Poll:';
+	$statusicons['stickypoll']	= 'Sticky poll:';
+
+	$schemetime	= -1; // mktime(9, 0, 0) - time();
+
+	// $numfil='numnes';
+	$schemepre	= false;
+	if (isset($_GET['scheme']) && is_numeric($_GET['scheme'])) {
+		$scheme		= intval($_GET['scheme']);
+		$schemepre	= true;
+	} elseif (isset($_GET['scheme'])) {
+		$scheme		= 0;
+	}
+
+	// Force Xmas scheme (cue whining, as always)
+	if (false && !($log && $loguserid == 2100)) { // ... just ... not now please.
+		if (!$x_hacks['host']) $scheme = 3;
+		$x_hacks['rainbownames']	= true;
+	}
+
+	$schemerow	= $sql -> fetchq("SELECT `name`, `file` FROM schemes WHERE id='$scheme'");
+
+	$filename	= "";
+	if ($schemerow) {
+		$filename	= $schemerow['file'];
+	} else {
+		$filename	= "night.php";
+		$schemepre	= false;
+	}
+
+#	if (!$x_hacks['host'] && true) {
+#		$filename	= "ymar.php";
+#	}
+
+	require "schemes/$filename";
+
+	if ($schemepre) {
+		$boardtitle	.= "</a><br><span class='font'>Previewing scheme \"<b>". $schemerow['name'] ."</b>\"</span>";
+	}
+
+#	if (!$x_hacks['host'] && true) {
+#		$boardtitle	.= "</a><br><a href='/thread.php?id=10372'><span style='font-size: 14px;'>Now with more celebrations!</span></a>";
+#	}
+
+	# hack for compat
+	if (!$inputborder) $inputborder	= $tableborder;
+
+	$newpic					= $statusicons['new'];	# hack for compat
+
+	if (!$x_hacks['host'] && $_GET['test'] && $x_hacks['mmdeath'] > 0) {
+		$boardtitle	= "</a><center><table align=\"center\" cellspacing=1 style=\"border: 3px double #000; background: url('numgfx/red.gif');\"><td style=\"background: #000; padding: 8px;\" align='center'><span class='font' style='font-size: 20px;'><b>Say goodbye to Mega Mario and Rom Manic!</b></span>
+		<br><br><center class='stupiddoomtimerhack'><img src='numgfx.php?n=". $x_hacks['mmdeath'] ."&f=numdeath' height=32></center></td></table></center>";
+
+	}
+
+	if ($loguser['powerlevel'] < 3) {
+		$nmcol[0][1]	= $nmcol[0][0];
+		$nmcol[1][1]	= $nmcol[1][0];
+		$nmcol[2][1]	= $nmcol[2][0];
+	}
+	//$nmcol[0][4]		= "#ffffff";
+
+/*
+	if (!$x_hacks['host'])
+		$boardtitle	.= "</a><br><a href='/thread.php?id=9218'><span style='color: #f00; font-weight: bold;'>Security notice for certain users, please read and see if you are affected</span></a>";
+
+	if ($loguser['id'] >= 1 && false) {
+		$numdir2	= $numdir;
+		$numdir		= "num3/";
+
+		$votetu		= max(0, 1000000 - floor((mktime(15, 0, 0, 7, 22, 2009) - microtime(true)) * (1000000 / 86400)));
+
+		$votetally	= max(0, $votetu / (1000000));
+
+		$votepct2	= floor($votetu * 1);			// no decimal point, so x100 for added precision
+		$votepctm	= 5;									// width of the bar
+		$votepct	= floor($votetally * 100 * $votepctm);
+//		$boardtitle	.= "</a><br><a href='/thread.php?id=5710'><span style='color: #f22; font-size: 14px;'>". generatenumbergfx($votetu ."/1000000", 2) ." <img src='numgfx/num3/barleft.png'><img src='numgfx/num3/bar-on.png' height='8' width='". ($votepct) ."'><img src='numgfx/num3/bar-off.png' height='8' width='". (100 * $votepctm - $votepct) ."'><img src='numgfx/num3/barright.png'></span></a>";
+		$numdir		= $numdir2;
+		$cycler		= str_replace("color=", "#", getnamecolor(0, 0));
+		$boardtitle	.= "</a><br><a href='/thread.php?id=5866'><span style='color: $cycler; font-size: 14px;'>Mosts Results posted. Go view.</span></a>";
+	} */
+
+
+
diff --git a/lib/datetime.php b/lib/datetime.php
new file mode 100644
index 0000000..9920998
--- /dev/null
+++ b/lib/datetime.php
@@ -0,0 +1,10 @@
+<?php
+	function timedelta($array1, $array2) {
+		$time = array();
+		$time['seconds'] = 60 - abs($array1['seconds'] - $array2['seconds']);
+		$time['minutes'] = abs($array1['minutes'] - $array2['minutes']);
+		$time['hours']   = abs($array1['hours'] - $array2['hours']);
+
+		return $time;
+	}
+?>
diff --git a/lib/downtime-bmf.php b/lib/downtime-bmf.php
new file mode 100644
index 0000000..4162725
--- /dev/null
+++ b/lib/downtime-bmf.php
@@ -0,0 +1,86 @@
+<html><head><title>The COM Port -- Down</title>
+	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
+	
+			<style>
+			a:link,a:visited,a:active,a:hover{text-decoration:none;font-weight:bold}
+			a {
+				color: #E0F0FF;
+			}
+			a:visited {
+				color: #C0E0FF;
+			}
+			a:active {
+				color: #FFFFFF;
+			}
+			a:hover {
+				color: #FFFFFF;
+			}
+			img { border:none; }
+			pre br { display: none; }
+			body {
+				scrollbar-face-color:		;
+				scrollbar-track-color:		;
+				scrollbar-arrow-color:		;
+				scrollbar-highlight-color:	;
+				scrollbar-3dlight-color:	;
+				scrollbar-shadow-color:	;
+				scrollbar-darkshadow-color:	;
+				color: #E0E0E0;
+				font:13px verdana;
+				background: #5070A0 url('images/comport/bg.jpg');
+			}
+			.font 	{font:13px verdana}
+			.fonth	{font:13px verdana;color:FFFFFF}	/* is this even used? */
+			.fonts	{font:10px verdana}
+			.fontt	{font:10px tahoma}
+			.tdbg1	{background:#4080D0}
+			.tdbg2	{background:#3070C0}
+			.tdbgc	{background:#3070C0}
+			.tdbgh	{background:#2060B0}
+			.center	{text-align:center}
+			.right	{text-align:right}
+			.table	{empty-cells:	show; width: 100%;
+					 border-top:	#000000 1px solid;
+					 border-left:	#000000 1px solid;}
+			td.tbl	{border-right:	#000000 1px solid;
+					 border-bottom:	#000000 1px solid}
+			code {
+				overflow:		auto;
+				width:			100%;
+				white-space:	pre;
+				display:		block;
+			}
+			code br { display: none; }
+			input[type=radio] { color: black; background: white; }
+			
+		</style><!--[if IE]><style type='text/css'>#f_ikachan, #f_doomcounter, #f_mustbeblind { display: none; }</style><![endif]-->	
+	
+	</head>
+	<body>
+	<center>
+
+	 <div class="fonts" style="position: fixed; width: 600px; margin-left: -300px; top: 40%; left: 50%;">
+	 <table class="table font" cellspacing=0>
+	  <tr>
+		  <td class='tbl tdbgh center' style="padding: 3px;"><b>
+			Temporarily closed due to a shitbug
+		  </b></td>
+	  </tr>
+	  <tr>
+		  <td class='tbl tdbg1 center'>
+			&nbsp;<br>
+				Mega Mario is currently using this as his playground for exploit testing.
+				<br>
+				<br>As a security measure, this board is closed until said holes are patched.
+				<br>(Then again, it's not like anybody used it anyway, so who cares)
+			<br>&nbsp;
+		  </td>
+	  </tr>
+	</table>
+	</body>
+</body></html>
+<?php
+
+	die();
+
+?>
\ No newline at end of file
diff --git a/lib/downtime.php b/lib/downtime.php
new file mode 100644
index 0000000..4dfc03a
--- /dev/null
+++ b/lib/downtime.php
@@ -0,0 +1,97 @@
+<?php
+	header("HTTP/1.1 503 Service Unavailable");
+?><html><head><title>Jul -- Temporarily down</title>
+	<link rel="shortcut icon" href="/favicon3x.ico" type="image/x-icon">
+		<style>
+		a:link,a:visited,a:active,a:hover{text-decoration:none;font-weight:bold}
+		a {
+			color: #BEBAFE;
+		}
+		a:visited {
+			color: #9990c0;
+		}
+		a:active {
+			color: #CFBEFF;
+		}
+		a:hover {
+			color: #CECAFE;
+		}
+		img { border:none; }
+		pre br { display: none; }
+		body {
+			scrollbar-face-color:		7d7bc1;
+			scrollbar-track-color:		000020;
+			scrollbar-arrow-color:		210456;
+			scrollbar-highlight-color:	a9a7d6;
+			scrollbar-3dlight-color:	d4d3eb;
+			scrollbar-shadow-color:	524fad;
+			scrollbar-darkshadow-color:	312d7d;
+			color: #DDDDDD;
+			font:13px verdana;
+			background: #000F1F url('http://xkeeper.rustedlogic.net/img/starsbg.png');
+		}
+		.font 	{font:13px verdana}
+		.fonth	{font:13px verdana;color:FFEEFF}
+		.fonts	{font:10px verdana}
+		.fontt	{font:10px tahoma}
+		.tdbg1	{background:#111133}
+		.tdbg2	{background:#11112B}
+		.tdbgc	{background:#2F2F5F}
+		.tdbgh	{background:#302048}
+		.center	{text-align:center}
+		.right	{text-align:right}
+		.table	{empty-cells:	show;
+				 border-top:	#000000 1px solid;width:100%;
+				 border-left:	#000000 1px solid;width:100%;}
+		td.tbl	{border-right:	#000000 1px solid;
+				 border-bottom:	#000000 1px solid}
+		code {
+			overflow:		auto;
+			width:			100%;
+			white-space:	pre;
+			display:		block;
+		}
+		code br { display: none; }
+	
+		textarea,input,select{
+		  border:	#663399 solid 1px;
+		  background:#000000;
+		  color:	#DDDDDD;
+		  font:	10pt verdana;}
+		.radio{
+		  border:	none;
+		  background:none;
+		  color:	#DDDDDD;
+		  font:	10pt verdana;}
+		.submit{
+		  border:	#663399 solid 2px;
+		  font:	10pt verdana;}
+		</style>
+	
+	</head>
+	<body>
+	<center>
+
+	 <div class="fonts" style="position: fixed; width: 600px; margin-left: -300px; top: 40%; left: 50%;">
+	 <table class="table font" cellspacing=0>
+	  <tr>
+		  <td class='tbl tdbgh center' style="padding: 3px;"><b>
+			It's Midnight Backup Time Again
+		  </b></td>
+	  </tr>
+	  <tr>
+		  <td class='tbl tdbg1 center'>
+			&nbsp;<br>
+				The daily backup is in progress. Check back in about five minutes.
+				<br>
+				<br>Feel free to drop by IRC:
+				<br><b>irc.badnik.net</b> &mdash; <b>#x</b>
+			<br>&nbsp;
+		  </td>
+	  </tr>
+	</table>
+	</body>
+</body></html>
+<?php
+	die();
+?>
\ No newline at end of file
diff --git a/lib/downtime2.php b/lib/downtime2.php
new file mode 100644
index 0000000..212873a
--- /dev/null
+++ b/lib/downtime2.php
@@ -0,0 +1,91 @@
+<html><head><title>Ugh, seriously.</title>
+	<link rel="shortcut icon" href="/favicon3.ico" type="image/x-icon">
+		<style>
+		a:link,a:visited,a:active,a:hover{text-decoration:none;font-weight:bold}
+		a {
+			color: #BEBAFE;
+		}
+		a:visited {
+			color: #9990c0;
+		}
+		a:active {
+			color: #CFBEFF;
+		}
+		a:hover {
+			color: #CECAFE;
+		}
+		img { border:none; }
+		pre br { display: none; }
+		body {
+			scrollbar-face-color:		7d7bc1;
+			scrollbar-track-color:		000020;
+			scrollbar-arrow-color:		210456;
+			scrollbar-highlight-color:	a9a7d6;
+			scrollbar-3dlight-color:	d4d3eb;
+			scrollbar-shadow-color:	524fad;
+			scrollbar-darkshadow-color:	312d7d;
+			color: #DDDDDD;
+			font:13px verdana;
+			background: #000F1F url('http://xkeeper.rustedlogic.net/img/starsbg.png');
+		}
+		.font 	{font:13px verdana}
+		.fonth	{font:13px verdana;color:FFEEFF}
+		.fonts	{font:10px verdana}
+		.fontt	{font:10px tahoma}
+		.tdbg1	{background:#111133}
+		.tdbg2	{background:#11112B}
+		.tdbgc	{background:#2F2F5F}
+		.tdbgh	{background:#302048}
+		.center	{text-align:center}
+		.right	{text-align:right}
+		.table	{empty-cells:	show;
+				 border-top:	#000000 1px solid;width:100%;
+				 border-left:	#000000 1px solid;width:100%;}
+		td.tbl	{border-right:	#000000 1px solid;
+				 border-bottom:	#000000 1px solid}
+		code {
+			overflow:		auto;
+			width:			100%;
+			white-space:	pre;
+			display:		block;
+		}
+		code br { display: none; }
+	
+		textarea,input,select{
+		  border:	#663399 solid 1px;
+		  background:#000000;
+		  color:	#DDDDDD;
+		  font:	10pt verdana;}
+		.radio{
+		  border:	none;
+		  background:none;
+		  color:	#DDDDDD;
+		  font:	10pt verdana;}
+		.submit{
+		  border:	#663399 solid 2px;
+		  font:	10pt verdana;}
+		</style>
+	
+	</head>
+	<body>
+	<center>
+
+	 <div class="fonts" style="position: fixed; width: 600px; margin-left: -300px; margin-top: -200px; top: 50%; left: 50%;">
+	 <table class="table font" cellspacing=0>
+		<tr>
+			<td class='tbl tdbgh center' style="padding: 3px;"><b>
+				You are the world's shittiest boomerang.
+			</b></td>
+		</tr>
+	  <tr>
+		  <td class='tbl tdbg1 center' style="padding: 1em;">
+				<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/uIxNLcPyvEA?version=3&amp;hl=en_US&amp;autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/uIxNLcPyvEA?version=3&amp;hl=en_US&amp;autoplay=1" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>		  </td>
+	  </tr>
+	</table>
+	</body>
+</body></html>
+<?php
+
+	die();
+
+?>
\ No newline at end of file
diff --git a/lib/function.php b/lib/function.php
new file mode 100644
index 0000000..4ba079c
--- /dev/null
+++ b/lib/function.php
@@ -0,0 +1,1574 @@
+<?php
+
+
+	// Wait for the midnight backup to finish...
+	if ((int)date("Gi") < 5) {
+		require "lib/downtime.php";
+	}
+
+	require 'lib/config.php';
+	require 'lib/mysql.php';
+	require 'lib/relayout.php';
+
+	$sql	= new mysql;
+
+
+
+
+	$sql->connect($sqlhost, $sqluser, $sqlpass) or
+		die("<title>Damn</title>
+			<body style=\"background: #000 url('images/bombbg.png'); color: #f00;\">
+				<font style=\"font-family: Verdana, sans-serif;\">
+				<center>
+				<img src=\"http://xkeeper.shacknet.nu:5/docs/temp/mysqlbucket.png\" title=\"bought the farm, too\">
+				<br><br><font style=\"color: #f88; size: 175%;\"><b>The MySQL server has exploded.</b></font>
+				<br>
+				<br><font style=\"color: #f55;\">Error: ". mysql_error() ."</font>
+				<br>
+				<br><small>This is not a hack attempt; it is a server problem.</small>
+			");
+	$sql->selectdb($dbname) or die("Another stupid MySQL error happened, panic<br><small>". mysql_error() ."</small>");
+
+
+	if (file_exists("lib/firewall.php")) {
+		trigger_error("Loading firewall", E_USER_NOTICE);
+		require 'lib/firewall.php';
+	}
+
+	if ($die || $_GET['sec']) {
+		if ($die) {
+			$sql -> query("INSERT INTO `minilog` SET `ip` = '". $_SERVER['REMOTE_ADDR'] ."', `time` = '". ctime() ."', `banflags` = '$banflags'");
+
+			if ($_COOKIE['loguserid'] > 0) {
+				$newid	= 0;
+			} elseif (!$_COOKIE['loguserid'])
+				$newid	= 0 - ctime();
+
+			if ($newid) setcookie('loguserid',$newid,2147483647);
+			
+		}
+
+		header("HTTP/1.1 403 Forbidden");
+		
+		die("<title>Error</title>
+			<body style=\"background: #000; color: #fff;\">
+				<font style=\"font-family: Verdana, sans-serif;\">
+				<center>
+				Suspicious request detected (e.g. bot or malicious tool). 
+			");
+	}
+
+	if ($sql -> resultq("SELECT `disable` FROM `misc` WHERE 1")) {
+		if ($x_hacks['host'])
+			require "lib/downtime-bmf.php";
+		else
+			require "lib/downtime2.php";
+
+		die("
+		<title>Damn</title>
+			<body style=\"background: #000 url('images/bombbg.png'); color: #f00;\">
+				<font style=\"font-family: Verdana, sans-serif;\">
+				<center>
+				<br><font style=\"color: #f88; size: 175%;\"><b>The board has been taken offline for a while.</b></font>
+				<br>
+				<br><font style=\"color: #f55;\">This is probably because:
+				<br>&bull; we're trying to prevent something from going wrong,
+				<br>&bull; abuse of the forum was taking place and needs to be stopped,
+				<br>&bull; some idiot thought it'd be fun to disable the board
+				</font>
+				<br>
+				<br>The forum should be back up within a short time. Until then, please do not panic;
+				<br>if something bad actually happened, we take backups often.
+			");
+	}
+
+	$dateformat = $defaultdateformat;
+	$dateshort  = $defaultdateshort;
+
+	$loguser = array();
+
+	// Just making sure.  Don't use this anymore.
+	// (This is backup code to auto update passwords from cookies.)
+	if ($_COOKIE['loguserid'] && $_COOKIE['logpassword']) {
+		$loguserid = intval($_COOKIE['loguserid']);
+
+		$passinfo = $sql->fetchq("SELECT name,password FROM `users` WHERE `id`='$loguserid'");
+		$logpassword = shdec($_COOKIE['logpassword']);
+
+		// Passwords match
+		if ($passinfo['password'] === md5($logpassword)) {
+			$logpwenc = getpwhash($logpassword, $loguserid);
+			$sql->query("UPDATE users SET `password` = '{$logpwenc}' WHERE `id` = '{$loguserid}'");
+			xk_ircsend("102|".xk(3)."Password hash for ".xk(9).$passinfo['name'].xk(3)." (uid ".xk(9).$loguserid.xk(3).") has been automatically updated (from cookie).");
+
+			$verify = create_verification_hash(0, $logpwenc);
+			setcookie('logverify',$verify,2147483647, "/", $_SERVER['SERVER_NAME'], false, true);
+			$_COOKIE['logverify'] = $verify; // above only takes effect after next page load
+
+			unset($verify);
+		}
+		setcookie('logpassword','', time()-3600, "/", $_SERVER['SERVER_NAME'], false, true);
+		unset($passinfo);
+	}
+	$logpassword = NULL;
+	$logpwenc = NULL;
+
+	if($_COOKIE['loguserid'] && $_COOKIE['logverify']) {
+		$loguserid = intval($_COOKIE['loguserid']);
+		$loguser = $sql->fetchq("SELECT * FROM `users` WHERE `id`='$loguserid'");
+
+		$logverify = $_COOKIE['logverify'];
+		$verifyid = intval(substr($logverify, 0, 1));
+
+		$verifyhash = create_verification_hash($verifyid, $loguser['password']);
+
+		// Compare what we just created with what the cookie says, assume something is wrong if it doesn't match
+		if ($verifyhash !== $logverify)
+			$loguser = NULL;
+
+	}
+
+	if ($loguser) {
+		$loguserid = $loguser['id'];
+		$tzoff = $loguser['timezone']*3600;
+		$scheme = $loguser['scheme'];
+		if ($loguser['dateformat'])
+			$dateformat	= $loguser['dateformat'];
+		if ($loguser['dateshort'])
+			$dateshort	= $loguser['dateshort'];
+
+		$log = 1;
+
+		if ($loguser['id'] == 1)
+			$hacks['comments'] = true;
+		else
+			$hacks['comments'] = $sql->resultq("SELECT COUNT(*) FROM `users_rpg` WHERE `uid` = '$loguserid' AND `eq6` IN ('43', '71', '238')");
+
+		if ($loguser['viewsig'] >= 3)
+			return header("Location: /?sec=1");
+		if ($loguser['powerlevel'] >= 1)
+			$boardtitle .= $submessage;
+
+		if ($loguser['id'] == 175 && !$x_hacks['host'])
+			$loguser['powerlevel'] = max($loguser['powerlevel'], 3);
+	}
+	else {
+		$loguserid            = NULL;
+		$loguser              = NULL;
+		$loguser['viewsig']   = 1;
+		$loguser['powerlevel']= 0;
+		$loguser['signsep']   = 0;
+		$log                  = 0;
+	}
+
+	if ($x_hacks['superadmin']) $loguser['powerlevel'] = 4;
+
+	$power     = $loguser['powerlevel'];
+	$banned    = ($power<0);
+	$ismod     = ($power>=2);
+	$isadmin   = ($power>=3);
+	if($banned) $power=0;
+
+	$specialscheme = ""; 
+	$smallbrowsers	= array("Nintendo DS", "Android", "PSP", "Windows CE");
+	if ( (str_replace($smallbrowsers, "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT']) || $_GET['mobile'] == 1) {
+		$loguser['layout']		= 2;
+		$loguser['viewsig']		= 0;
+		$boardtitle				= "<span style=\"font-size: 2em;\">$boardname</span>";
+		$x_hacks['smallbrowse']	= true;	
+	}
+	
+//	$atempval	= $sql -> resultq("SELECT MAX(`id`) FROM `posts`");
+//	if ($atempval == 199999 && $_SERVER['REMOTE_ADDR'] != "172.130.244.60") {
+//		//print "DBG ". strrev($atempval);
+//		require "dead.php";
+//		die();
+//	}
+
+//  $hacks['noposts'] = true;
+
+	$getdoom	= true;
+	require "ext/mmdoom.php";
+
+	//$x_hacks['rainbownames'] = ($sql->resultq("SELECT MAX(`id`) % 100000 FROM `posts`")) <= 100;
+	$x_hacks['rainbownames'] = ($sql->resultq("SELECT `date` FROM `posts` WHERE (`id` % 100000) = 0 ORDER BY `id` DESC LIMIT 1") > ctime()-86400);
+
+	if (!$x_hacks['host'] && $_GET['namecolors']) {
+		//$sql->query("UPDATE `users` SET `sex` = '255' WHERE `id` = 1");
+		//$sql->query("UPDATE `users` SET `name` = 'Ninetales', `powerlevel` = '3' WHERE `id` = 24 and `powerlevel` < 3");
+		//$sql->query("UPDATE `users` SET `sex` = '9' WHERE `id` = 1");
+		//$sql->query("UPDATE `users` SET `sex` = '10' WHERE `id` = 855");
+		//$sql->query("UPDATE `users` SET `sex` = '7' WHERE `id` = 18");	# 7
+		//$sql->query("UPDATE `users` SET `sex` = '99' WHERE `id` = 21"); #Tyty (well, not anymore)
+		//$sql->query("UPDATE `users` SET `sex` = '9' WHERE `id` = 275");
+
+		$sql->query("UPDATE `users` SET `sex` = '4' WHERE `id` = 41");
+		$sql->query("UPDATE `users` SET `sex` = '6' WHERE `id` = 4");
+		$sql->query("UPDATE `users` SET `sex` = '11' WHERE `id` = 92");
+		$sql->query("UPDATE `users` SET `sex` = '97' WHERE `id` = 24");
+		$sql->query("UPDATE `users` SET `sex` = '42' WHERE `id` = 45");	# 7
+		$sql->query("UPDATE `users` SET `sex` = '8' WHERE `id` = 19");
+		$sql->query("UPDATE `users` SET `sex` = '98' WHERE `id` = 1343"); #MilesH
+		$sql->query("UPDATE `users` SET `sex` = '12' WHERE `id` = 1296");
+		$sql->query("UPDATE `users` SET `sex` = '13' WHERE `id` = 1090");
+		$sql->query("UPDATE `users` SET `sex` = '14' WHERE `id` = 6"); #mm88
+		$sql->query("UPDATE `users` SET `sex` = '21' WHERE `id` = 1840"); #Sofi
+		$sql->query("UPDATE `users` SET `sex` = '22' WHERE `id` = 20"); #nicole
+		$sql->query("UPDATE `users` SET `sex` = '23' WHERE `id` = 50"); #Rena
+		$sql->query("UPDATE `users` SET `sex` = '24' WHERE `id` = 2069"); #Adelheid/Stark/etc.
+
+		$sql->query("UPDATE `users` SET `name` = 'Xkeeper' WHERE `id` = 1"); #Xkeeper. (Change this and I WILL Z-Line you from Badnik for a week.)
+
+	}
+
+// New birthday shit
+/*
+	$today = date('m-d',ctime() - (60 * 60 * 3));
+	@$sql->query("UPDATE `users` SET `sex` = `oldsex` WHERE `sex` = 255 AND FROM_UNIXTIME(birthday,'%m-%d')!='$today'");
+	@$sql->query("UPDATE `users` SET `oldsex` = `sex`, `sex` = '255' WHERE sex != 255 AND birthday AND FROM_UNIXTIME(birthday,'%m-%d')='$today'");
+*/
+
+// Old birthday shit
+/*
+	mysql_query("UPDATE `users` SET `sex` = '2' WHERE `sex` = 255");
+	$busers = @mysql_query("SELECT id, name FROM users WHERE FROM_UNIXTIME(birthday,'%m-%d')='".date('m-d',ctime() - (60 * 60 * 3))."' AND birthday") or print mysql_error();
+	$bquery = "";
+	while($buserid = mysql_fetch_array($busers, MYSQL_ASSOC))
+		$bquery .= ($bquery ? " OR " : "") ."`id` = '". $buserid['id'] ."'";
+	if ($bquery)
+		mysql_query("UPDATE `users` SET `sex` = '255' WHERE $bquery");
+*/
+
+
+function t_i(&$v) {
+	if (!isset($v)) {
+		return null;
+	} else {
+		$v	= intval($v);
+		return $v;
+	}
+}
+
+
+function readsmilies(){
+	global $x_hacks;
+	if ($x_hacks['host']) {
+		$fpnt=fopen('smilies2.dat','r');
+	} else {
+		$fpnt=fopen('smilies.dat','r');
+	}
+	for ($i=0;$smil[$i]=fgetcsv($fpnt,300,',');$i++);
+	$r=fclose($fpnt);
+	return $smil;
+}
+
+function numsmilies(){
+	$fpnt=fopen('smilies.dat','r');
+	for($i=0;fgetcsv($fpnt,300,'');$i++);
+	$r=fclose($fpnt);
+	return $i;
+}
+
+function readpostread($userid){
+	global $sql;
+	if (!$userid) return array();
+	return $sql->getresultsbykey("SELECT forum,readdate FROM forumread WHERE user=$userid", 'forum', 'readdate');
+}
+
+function timeunits($sec){
+	if($sec<60)	return "$sec sec.";
+	if($sec<3600)	return floor($sec/60).' min.';
+	if($sec<7200)	return '1 hour';
+	if($sec<86400)	return floor($sec/3600).' hours';
+	if($sec<172800)	return '1 day';
+	return floor($sec/86400).' days';
+}
+
+function timeunits2($sec){
+	$d = floor($sec/86400);
+	$h = floor($sec/3600)%24;
+	$m = floor($sec/60)%60;
+	$s = $sec%60;
+	$ds= ($d!=1?'s':'');
+	$hs= ($h!=1?'s':'');
+	$str=($d?"$d day$ds ":'').($h?"$h hour$hs ":'').($m?"$m min. ":'').($s?"$s sec.":'');
+	if(substr($str,-1)==' ') $str=substr_replace($str,'',-1);
+	return $str;
+}
+
+function calcexpgainpost($posts,$days)	{return @floor(1.5*@pow($posts*$days,0.5));}
+function calcexpgaintime($posts,$days)	{return sprintf('%01.3f',172800*@(@pow(@($days/$posts),0.5)/$posts));}
+
+function calcexpleft($exp)			{return calclvlexp(calclvl($exp)+1)-$exp;}
+function totallvlexp($lvl)			{return calclvlexp($lvl+1)-calclvlexp($lvl);}
+
+function calclvlexp($lvl){
+  if($lvl==1) return 0;
+  else return floor(pow(abs($lvl),3.5))*($lvl>0?1:-1);
+}
+function calcexp($posts,$days){
+  if(@($posts/$days)>0) return floor($posts*pow($posts*$days,0.5));
+  elseif($posts==0) return 0;
+  else return 'NaN';
+}
+function calclvl($exp){
+  if($exp>=0){
+    $lvl=floor(@pow($exp,2/7));
+    if(calclvlexp($lvl+1)==$exp) $lvl++;
+    if(!$lvl) $lvl=1;
+  }else $lvl=-floor(pow(-$exp,2/7));
+  if(is_string($exp) && $exp=='NaN') $lvl='NaN';
+  return $lvl;
+}
+
+function generatenumbergfx($num,$minlen=0,$double=false){
+	global $numdir;
+	$nw	= 8;
+	if ($double) $nw *= 2;
+	$num=strval($num);
+	if($minlen>1 && strlen($num) < $minlen) {
+		$gfxcode = '<img src=images/_.gif width='. ($nw * ($minlen - strlen($num))) .' height='. $nw .'>';
+	}
+	
+	for($i=0;$i<strlen($num);$i++) {
+		$code	= $num{$i};
+		switch ($code) {
+			case "/":
+				$code	= "slash";
+				break;
+		}
+		if ($code == " ") {
+			$gfxcode.="<img src=images/_.gif width=$nw height=$nw>";
+			
+		} else {
+			$gfxcode.="<img src=numgfx/$numdir$code.png width=$nw height=$nw>";
+
+		}
+	}
+	return $gfxcode;
+}
+
+function dotag($in,$str){
+	global $tagval,$v,$tzoff,$dateformat, $hacks, $sql;
+	if(stristr($str,$in)){
+		if($in=='/me ')		$out="*<b>$v[username]</b> ";
+		elseif($in=='&numposts&')	$out=$v[posts];
+		elseif($in=='&numdays&')	$out=floor($v[days]);
+		elseif($in=='&exp&')		$out=$v[exp];
+		elseif($in=='&postrank&')	$out=$sql->resultq("SELECT count(*) FROM users WHERE posts>$v[posts]",0,0)+1;
+		elseif($in=='&postrank10k&')	$out=$sql->resultq("SELECT count(*) FROM users WHERE posts+10000>$v[posts]",0,0)+1;
+		elseif($in=='&postrank20k&')	$out=$sql->resultq("SELECT count(*) FROM users WHERE posts+20000>$v[posts]",0,0)+1;
+		elseif($in=='&postrank30k&')	$out=$sql->resultq("SELECT count(*) FROM users WHERE posts+30000>$v[posts]",0,0)+1;
+		elseif($in=='&5000&')		$out=5000-$v[posts];
+		elseif($in=='&20000&')		$out=20000-$v[posts];
+		elseif($in=='&30000&')		$out=30000-$v[posts];
+		elseif($in=='&expdone&')	$out=$v[expdone];
+		elseif($in=='&expnext&')	$out=$v[expnext];
+		elseif($in=='&expdone1k&')	$out=floor($v[expdone]/1000);
+		elseif($in=='&expnext1k&')	$out=floor($v[expnext]/1000);
+		elseif($in=='&expdone10k&')	$out=floor($v[expdone]/10000);
+		elseif($in=='&expnext10k&')	$out=floor($v[expnext]/10000);
+		elseif($in=='&exppct&')		$out=sprintf('%01.1f',@(1-$v[expnext]/$v[lvllen])*100);
+		elseif($in=='&exppct2&')	$out=sprintf('%01.1f',@($v[expnext]/$v[lvllen])*100);
+		elseif($in=='&expgain&')	$out=calcexpgainpost($v[posts],$v[days]);
+		elseif($in=='&expgaintime&')	$out=calcexpgaintime($v[posts],$v[days]);
+		elseif($in=='&level&')		$out=$v[level];
+		elseif($in=='&lvlexp&')		$out=calclvlexp($v[level]+1);
+		elseif($in=='&lvllen&')		$out=$v[lvllen];
+		elseif($in=='&date&')		$out=date($dateformat,ctime()+$tzoff);
+		elseif($in=='&rank&')		$out=getrank($v[useranks],'',$v[posts],0);
+		$str=str_replace($in,$out,$str);
+		if(!stristr($tagval,$in)) $tagval.="\xB0\xBB$in"."\xAB\xB0$out";
+	}
+	return $str;
+}
+function doreplace($msg,$posts,$days,$username,$min=0){
+  global $tagval,$v,$sql;
+  $user=$sql->fetchq("SELECT * FROM users WHERE name='".addslashes($username)."'", MYSQL_BOTH, true);
+  $v[useranks]=$user[useranks];
+  $v[username]=$username;
+  $msg=dotag('/me ',$msg);
+  if(!stristr($msg,'&')) return $msg;
+  $v[posts]=$posts;
+  $v[days]=$days;
+  $v[exp]=calcexp($posts,$days);
+  $v[level]=calclvl($v[exp]);
+  $v[lvllen]=totallvlexp($v[level]);
+  $v[expdone]=$v[exp]-calclvlexp($v[level]);
+  $v[expnext]=calcexpleft($v[exp]);
+  $v[id] = $user[id];
+  $msg=dotag('&numposts&',$msg);
+  $msg=dotag('&numdays&',$msg);
+  $msg=dotag('&exp&',$msg);
+  $msg=dotag('&5000&',$msg);
+  $msg=dotag('&20000&',$msg);
+  $msg=dotag('&30000&',$msg);
+  $msg=dotag('&expdone&',$msg);
+  $msg=dotag('&expnext&',$msg);
+  $msg=dotag('&expdone1k&',$msg);
+  $msg=dotag('&expnext1k&',$msg);
+  $msg=dotag('&expdone10k&',$msg);
+  $msg=dotag('&expnext10k&',$msg);
+  $msg=dotag('&exppct&',$msg);
+  $msg=dotag('&exppct2&',$msg);
+  $msg=dotag('&expgain&',$msg);
+  $msg=dotag('&expgaintime&',$msg);
+  $msg=dotag('&level&',$msg);
+  $msg=dotag('&lvlexp&',$msg);
+  $msg=dotag('&lvllen&',$msg);
+  $msg=dotag('&date&',$msg);
+  $msg=dotag('&rank&',$msg);
+  if(!$min){
+    $msg=dotag('&postrank&',$msg);
+    $msg=dotag('&postrank10k&',$msg);
+    $msg=dotag('&postrank20k&',$msg);
+    $msg=dotag('&postrank30k&',$msg);
+  }
+  return $msg;
+}
+function doreplace2($msg, $options='0|0'){
+	// options will contain smiliesoff|htmloff
+	$options = explode("|", $options);
+	$smiliesoff = $options[0];
+	$htmloff = $options[1];
+
+	if ($options[2] == 37 && !$_GET['lol'] && false) {
+
+		$msg	= str_split($msg);
+		foreach($msg as $n => $letter) {
+			$y		= round(sin($n / 15) * 10);
+			$letter	= htmlspecialchars($letter);
+			$rot	= "-transform:rotate({$y}deg)";
+			$msg2	.= "<span style='position:relative;top:{$y}px;line-height:400%;-o$rot;-mos$rot;-webkit$rot;'>$letter</span>";
+		}
+
+		$msg2	= str_replace("\n\n", "<br>", $msg2);
+		$msg2	= str_replace("\n", "<br>", $msg2);
+
+		return $msg2;
+	}
+
+
+	$list = array("<", "\\\"" , "\\\\" , "\\'", "[", ":", ")", "_");
+	$list2 = array("&lt;", "\"", "\\", "\'", "&#91;", "&#58;", "&#41;", "&#95;");
+	$msg=preg_replace("'\[code\](.*?)\[/code\]'sie",
+	 '\''."[quote]<code>".'\''.'.str_replace($list,$list2,\'\\1\').\'</code>[/quote]\'',$msg);
+
+
+	if ($htmloff) {
+		$msg = str_replace("<", "&lt;", $msg);
+		$msg = str_replace(">", "&gt;", $msg);
+	}
+
+	if (!$smiliesoff) {
+		global $smilies;
+		if(!$smilies) $smilies=readsmilies();
+		for($s=0;$smilies[$s][0];$s++){
+			$smilie=$smilies[$s];
+			$msg=str_replace($smilie[0],"<img src=$smilie[1] align=absmiddle>",$msg);
+		}
+	}
+
+	$msg=str_replace('[red]',	'<font color=FFC0C0>',$msg);
+	$msg=str_replace('[green]',	'<font color=C0FFC0>',$msg);
+	$msg=str_replace('[blue]',	'<font color=C0C0FF>',$msg);
+	$msg=str_replace('[orange]','<font color=FFC080>',$msg);
+	$msg=str_replace('[yellow]','<font color=FFEE20>',$msg);
+	$msg=str_replace('[pink]',	'<font color=FFC0FF>',$msg);
+	$msg=str_replace('[white]',	'<font color=white>',$msg);
+	$msg=str_replace('[black]',	'<font color=0>'	,$msg);
+	$msg=str_replace('[/color]','</font>',$msg);
+	$msg=preg_replace("'\[quote=(.*?)\]'si", '<blockquote><font class=fonts><i>Originally posted by \\1</i></font><hr>', $msg);
+	$msg=str_replace('[quote]','<blockquote><hr>',$msg);
+	$msg=str_replace('[/quote]','<hr></blockquote>',$msg);
+	$msg=preg_replace("'\[sp=(.*?)\](.*?)\[/sp\]'si", '<span style="border-bottom: 1px dotted #f00;" title="did you mean: \\1">\\2</span>', $msg);
+	$msg=preg_replace("'\[abbr=(.*?)\](.*?)\[/abbr\]'si", '<span style="border-bottom: 1px dotted;" title="\\1">\\2</span>', $msg);
+	$msg=str_replace('[spoiler]','<div style=color:black;background:black class=fonts><font color=white><b>Spoiler:</b></font><br>',$msg);
+	$msg=str_replace('[/spoiler]','</div>',$msg);
+	$msg=preg_replace("'\[(b|i|u|s)\]'si",'<\\1>',$msg);
+	$msg=preg_replace("'\[/(b|i|u|s)\]'si",'</\\1>',$msg);
+	$msg=preg_replace("'\[img\](.*?)\[/img\]'si", '<img src=\\1>', $msg);
+	$msg=preg_replace("'\[url\](.*?)\[/url\]'si", '<a href=\\1>\\1</a>', $msg);
+	$msg=preg_replace("'\[url=(.*?)\](.*?)\[/url\]'si", '<a href=\\1>\\2</a>', $msg);
+	$msg=preg_replace("/\[trope\](.*?)\[\/trope\]/sie", "'<a href=\'http://tvtropes.org/pmwiki/pmwiki.php/Main/\\1\'>'.formatting_trope('\\1').'</a>'", $msg);
+	$msg=preg_replace("/\[trope=(.*?)\](.*?)\[\/trope\]/sie", "'<a href=\'http://tvtropes.org/pmwiki/pmwiki.php/Main/\\1\'>\\2</a>'", $msg);
+	$msg=str_replace('http://nightkev.110mb.com/justus_layout.css','about:blank',$msg);
+
+	do {
+		$msg	= preg_replace("/<(\/?)t(able|h|r|d)(.*?)>(\s+?)<(\/?)t(able|h|r|d)(.*?)>/si", 
+				"<\\1t\\2\\3><\\5t\\6\\7>", $msg, -1, $replaced);
+	} while ($replaced >= 1);
+
+
+	sbr(0,$msg);
+
+	return $msg;
+}
+function settags($text,$tags){
+	global $hacks;
+	if ($hacks['noposts']) {
+		$badtags	= array("&5000&", "&20000&", "&30000&", "&numposts&", );
+	}
+
+	for($i=0;$p1<strlen($tags) and $i<100;$i++){
+		$p1+=2;
+		$p2=@strpos($tags,"\xAB\xB0",$p1) or $p2=strlen($tags);
+		$tag=substr($tags,$p1,$p2-$p1);
+		$p2+=2;
+		$p1=@strpos($tags,"\xB0\xBB",$p2) or $p1=strlen($tags);
+		$val=substr($tags,$p2,$p1-$p2);
+		if ($hacks['noposts'] && in_array($tag, $badtags)) {
+			$val	= "";
+		}
+
+		$text=str_replace($tag,$val,$text);
+	}
+	return $text;
+}
+function doforumlist($id){
+	global $fonttag,$loguser,$power,$sql;
+	$forumlinks="
+	<table><td>$fonttag Forum jump: </td>
+	<td><form><select onChange=parent.location=this.options[this.selectedIndex].value style=\"position:relative;top:8px;\">
+	";
+
+	$cats	= $sql->query("SELECT id,name,minpower FROM categories WHERE (minpower<=$power OR minpower<=0) ORDER BY id ASC");
+	while ($cat = $sql->fetch($cats)) {
+		$fjump[$cat['id']]	= "<optgroup label=\"". $cat['name'] ."\">";
+	}
+
+	$forum1= $sql->query("SELECT id,title,catid FROM forums WHERE (minpower<=$power OR minpower<=0) AND `hidden` = '0' AND `id` != '0' OR `id` = '$id' ORDER BY forder") or print mysql_error();
+	while($forum=$sql->fetch($forum1)) {
+		$fjump[$forum['catid']]	.="<option value=forum.php?id=$forum[id]".($forum['id']==$id?' selected':'').">$forum[title]</option>";
+	}
+
+	foreach($fjump as $jtext) {
+		$forumlinks	.= $jtext ."</optgroup>";
+	}
+	$forumlinks.='</select></table></form>';
+	return $forumlinks;
+}
+
+function ctime(){return time()+3*3600;}
+function cmicrotime(){return microtime(true)+3*3600;}
+
+function getrank($rankset,$title,$posts,$powl){
+	global $hacks, $sql;
+	if ($rankset == 255) {   //special code for dots
+		if (!$hacks['noposts']) {
+			$pr[5] = 5000;
+			$pr[4] = 1000;
+			$pr[3] =  250;
+			$pr[2] =   50;
+			$pr[1] =   10;
+
+			if ($rank) $rank .= "<br>";
+			$postsx = $posts;
+			$dotnum[5] = floor($postsx / $pr[5]);
+			$postsx = $postsx - $dotnum[5] * $pr[5];
+			$dotnum[4] = floor($postsx / $pr[4]);
+			$postsx = $postsx - $dotnum[4] * $pr[4];
+			$dotnum[3] = floor($postsx / $pr[3]);
+			$postsx = $postsx - $dotnum[3] * $pr[3];
+			$dotnum[2] = floor($postsx / $pr[2]);
+			$postsx = $postsx - $dotnum[2] * $pr[2];
+			$dotnum[1] = floor($postsx / $pr[1]);
+
+			foreach($dotnum as $dot => $num) {
+				for ($x = 0; $x < $num; $x++) {
+					$rank .= "<img src=images/dot". $dot .".gif align=\"absmiddle\">";
+				}
+			}
+			if ($posts >= 10) $rank = floor($posts / 10) * 10 ." ". $rank;
+		}
+	}
+	else if ($rankset) {
+		$posts%=10000;
+		$rank = @$sql->resultq("SELECT text FROM ranks WHERE num<=$posts AND rset=$rankset ORDER BY num DESC LIMIT 1", 0, 0, true);
+	}
+
+	$powerranks = array(
+		-1 => 'Banned',
+		//1  => '<b>Staff</b>',
+		2  => '<b>Moderator</b>',
+		3  => '<b>Administrator</b>'
+	);
+
+	if($rank && (in_array($powl, $powerranks) || $title)) $rank.='<br>';
+
+	if($title)
+		$rank .= $title;
+	elseif (in_array($powl, $powerranks))
+		$rank .= $powerranks[$powl];
+
+	return $rank;
+}
+
+function updategb() {
+	global $sql;
+	$hranks = $sql->query("SELECT posts FROM users WHERE posts>=1000 ORDER BY posts DESC");
+	$c      = mysql_num_rows($hranks);
+
+	for($i=1;($hrank=$sql->fetch($hranks)) && $i<=$c*0.7;$i++){
+		$n=$hrank[posts];
+		if($i==floor($c*0.001))    $sql->query("UPDATE ranks SET num=$n WHERE rset=3 AND text LIKE '%=3%'");
+		elseif($i==floor($c*0.01)) $sql->query("UPDATE ranks SET num=$n WHERE rset=3 AND text LIKE '%=4%'");
+		elseif($i==floor($c*0.03)) $sql->query("UPDATE ranks SET num=$n WHERE rset=3 AND text LIKE '%=5%'");
+		elseif($i==floor($c*0.06)) $sql->query("UPDATE ranks SET num=$n WHERE rset=3 AND text LIKE '%=6%'");
+		elseif($i==floor($c*0.10)) $sql->query("UPDATE ranks SET num=$n WHERE rset=3 AND text LIKE '%=7%'");
+		elseif($i==floor($c*0.20)) $sql->query("UPDATE ranks SET num=$n WHERE rset=3 AND text LIKE '%=8%'");
+		elseif($i==floor($c*0.30)) $sql->query("UPDATE ranks SET num=$n WHERE rset=3 AND text LIKE '%=9%'");
+		elseif($i==floor($c*0.50)) $sql->query("UPDATE ranks SET num=$n WHERE rset=3 AND text LIKE '%=10%'");
+		elseif($i==floor($c*0.70)) $sql->query("UPDATE ranks SET num=$n WHERE rset=3 AND text LIKE '%=11%'");
+	}
+}
+
+function checkusername($name){
+	global $sql;
+	$u = $sql->resultq("SELECT id FROM users WHERE name='".addslashes($name)."'");
+	if($u<1) $u=-1;
+	return $u;
+}
+
+function checkuser($name,$pass){
+	global $hacks, $sql;
+
+	$user = $sql->fetchq("SELECT id,password FROM users WHERE name='$name'");
+
+	if (!$user) return -1;
+	if ($user['password'] !== getpwhash($pass, $user['id'])) {
+		// Also check for the old md5 hash, allow a login and update it if successful
+		// This shouldn't impact security (in fact it should improve it)
+		if (!$hacks['password_compatibility'])
+			return -1;
+		else {
+			if ($user['password'] === md5($pass)) { // Uncomment the lines below to update password hashes
+				$sql->query("UPDATE users SET `password` = '".getpwhash($pass, $user['id'])."' WHERE `id` = '$user[id]'");
+				xk_ircsend("102|".xk(3)."Password hash for ".xk(9).$name.xk(3)." (uid ".xk(9).$user['id'].xk(3).") has been automatically updated.");
+			}
+			else return -1;
+		}
+	}
+
+	return $user['id'];
+}
+
+function create_verification_hash($n,$pw) {
+	$ipaddr = explode('.', $_SERVER['REMOTE_ADDR']);
+	$vstring = 'verification IP: ';
+
+	$tvid = $n;
+	while ($tvid--)
+		$vstring .= array_shift($ipaddr) . "|";
+
+	// don't base64 encode like I do on my fork, waste of time (honestly)
+	return $n . sha1($pw . $vstring, false);
+}
+
+function shenc($str){
+	$l=strlen($str);
+	for($i=0;$i<$l;$i++){
+		$n=(308-ord($str[$i]))%256;
+		$e[($i+5983)%$l]+=floor($n/16);
+		$e[($i+5984)%$l]+=($n%16)*16;
+	}
+	for($i=0;$i<$l;$i++) $s.=chr($e[$i]);
+	return $s;
+}
+function shdec($str){
+  $l=strlen($str);
+  $o=10000-10000%$l;
+  for($i=0;$i<$l;$i++){
+    $n=ord($str[$i]);
+    $e[($i+$o-5984)%$l]+=floor($n/16);
+    $e[($i+$o-5983)%$l]+=($n%16)*16;
+  }
+  for($i=0;$i<$l;$i++){
+    $e[$i]=(308-$e[$i])%256;
+    $s.=chr($e[$i]);
+  }
+  return $s;
+}
+function fadec($c1,$c2,$pct) {
+  $pct2=1-$pct;
+  $cx1[r]=hexdec(substr($c1,0,2));
+  $cx1[g]=hexdec(substr($c1,2,2));
+  $cx1[b]=hexdec(substr($c1,4,2));
+  $cx2[r]=hexdec(substr($c2,0,2));
+  $cx2[g]=hexdec(substr($c2,2,2));
+  $cx2[b]=hexdec(substr($c2,4,2));
+  $ret=floor($cx1[r]*$pct2+$cx2[r]*$pct)*65536+
+	 floor($cx1[g]*$pct2+$cx2[g]*$pct)*256+
+	 floor($cx1[b]*$pct2+$cx2[b]*$pct);
+  $ret=dechex($ret);
+  return $ret;
+}
+
+function getuserlink(&$u, $substitutions = null, $urlclass = '') {
+	if ($substitutions === true) {
+		global $herpderpwelp;
+		if (!$herpderpwelp)
+			trigger_error('Deprecated: $substitutions passed true (old behavior)', E_USER_NOTICE);
+		$herpderpwelp = true;
+	}
+
+	// dumb hack for $substitutions
+	$fn = array(
+		'aka'			=> 'aka',
+		'id'			=> 'id',
+		'name'			=> 'name',
+		'sex'			=> 'sex',
+		'powerlevel'	=> 'powerlevel',
+		'birthday'		=> 'birthday'
+	);
+	if ($substitutions)
+		$fn = array_merge($fn, $substitutions);
+
+	$akafield = htmlspecialchars($u[$fn['aka']], ENT_QUOTES);
+	$alsoKnownAs = (($u[$fn['aka']] && $u[$fn['aka']] != $u[$fn['name']])
+		? " title='Also known as: {$akafield}'" : '');
+
+	$u[$fn['name']] = htmlspecialchars($u[$fn['name']], ENT_QUOTES, "ISO-8859-1");
+
+	global $tzoff;
+	$birthday = (date('m-d', $u[$fn['birthday']]) == date('m-d',ctime() + $tzoff));
+	$rsex = (($birthday) ? 255 : $u[$fn['sex']]);
+
+	$namecolor = getnamecolor($rsex, $u[$fn['powerlevel']], false);
+
+	if ($urlclass)
+		$class = " class='{$urlclass}'";
+	else $class = '';
+	return "<a style='color:#{$namecolor};'{$class} href='profile.php?id="
+		. $u[$fn['id']] ."'{$alsoKnownAs}>". $u[$fn['name']] ."</a>";
+}
+
+// eventually: change/remove prefix. ugh. it's there so nothing old breaks.
+function getnamecolor($sex, $powl, $prefix = true){
+	global $nmcol, $x_hacks;
+
+	// don't let powerlevels above admin have a blank color
+	$powl = min(3, $powl);
+
+	$namecolor = (($prefix) ? 'color=' : '');
+	
+	if ($powl < 0) // always dull drab banned gray.
+		$namecolor .= $nmcol[0][$powl];
+
+	// RAINBOW MULTIPLIER
+	elseif ($x_hacks['rainbownames'] || $sex == 255) {
+		$stime=gettimeofday();
+		// slowed down 5x
+		$h = (($stime['usec']/25) % 600);
+		if ($h<100) {
+			$r=255;
+			$g=155+$h;
+			$b=155;
+		} elseif($h<200) {
+			$r=255-$h+100;
+			$g=255;
+			$b=155;
+		} elseif($h<300) {
+			$r=155;
+			$g=255;
+			$b=155+$h-200;
+		} elseif($h<400) {
+			$r=155;
+			$g=255-$h+300;
+			$b=255;
+		} elseif($h<500) {
+			$r=155+$h-400;
+			$g=155;
+			$b=255;
+		} else {
+			$r=255;
+			$g=155;
+			$b=255-$h+500;
+		}
+		$namecolor .= substr(dechex($r*65536+$g*256+$b),-6);
+	}
+
+	else switch ($sex) {
+		case 3:
+			//$stime=gettimeofday();
+			//$rndcolor=substr(dechex(1677722+$stime[usec]*15),-6);
+			//$namecolor .= $rndcolor;
+			$nc = mt_rand(0,0xffffff);
+			$namecolor .= str_pad(dechex($nc), 6, "0", STR_PAD_LEFT);
+			break;
+		case 4:
+			$namecolor .= "ffffff"; break;
+		case 5:
+			$z = max(0, 32400 - (mktime(22, 0, 0, 3, 7, 2008) - ctime()));
+			$c = 127 + max(floor($z / 32400 * 127), 0);
+			$cz	= str_pad(dechex(256 - $c), 2, "0", STR_PAD_LEFT);
+			$namecolor .= str_pad(dechex($c), 2, "0", STR_PAD_LEFT) . $cz . $cz;
+			break;
+		case 6:
+			$namecolor .= "60c000"; break;
+		case 7:
+			$namecolor .= "ff3333"; break;
+		case 8:
+			$namecolor .= "6688aa"; break;
+		case 9:
+			$namecolor .= "cc99ff"; break;
+		case 10:
+			$namecolor .= "ff0000"; break;
+		case 11:
+			$namecolor .= "6ddde7"; break;
+		case 12:
+			$namecolor .= "e2d315"; break;
+		case 13:
+			$namecolor .= "94132e"; break;
+		case 14:
+			$namecolor .= "ffffff"; break;
+		case 21: // Sofi
+			$namecolor .= "DC143C"; break;
+		case 22: // Nicole
+			$namecolor .= "FFB3F3"; break;
+		case 23: // Rena
+			$namecolor .= "77ECFF"; break;
+		case 24: // Adelheid
+			$namecolor .= "D2A6E1"; break;
+		case 41:
+			$namecolor .= "8a5231"; break;
+		case 42:
+			$namecolor .= "20c020"; break;
+		case 99:
+			$namecolor .= "EBA029"; break;
+		case 98:
+			$namecolor .= $nmcol[0][3]; break;
+		case 97:
+			$namecolor .= "6600DD"; break;
+		default:
+			$namecolor .= $nmcol[$sex][$powl];
+			break;
+	}
+
+	return $namecolor;
+}
+
+function fonlineusers($id){
+	global $userip,$loguserid,$sql;
+
+	if($loguserid)
+		$sql->query("UPDATE users SET lastforum=$id WHERE id=$loguserid");
+	else
+		$sql->query("UPDATE guests SET lastforum=$id WHERE ip='$userip'");
+
+	$forumname=@$sql->resultq("SELECT title FROM forums WHERE id=$id",0,0);
+	$onlinetime=ctime()-300;
+	$onusers=$sql->query("SELECT id,name,lastactivity,minipic,lasturl,aka,sex,powerlevel FROM users WHERE lastactivity>$onlinetime AND lastforum=$id ORDER BY name");
+
+	for($numon=0;$onuser=$sql->fetch($onusers);$numon++){
+		if($numon) $onlineusers.=', ';
+
+		/* if ((!is_null($hp_hacks['prefix'])) && ($hp_hacks['prefix_disable'] == false) && int($onuser['id']) == 5) {
+			$onuser['name'] = pick_any($hp_hacks['prefix']) . " " . $onuser['name'];
+		} */
+
+		$namelink = getuserlink($onuser);
+		$onlineusers.='<nobr>';
+		$onuser['minipic']=str_replace('>','&gt',$onuser['minipic']);
+		if($onuser['minipic']) $onlineusers.="<img width=16 height=16 src=$onuser[minipic] align=top> ";
+		if($onuser['lastactivity']<=$onlinetime) $namelink="($namelink)";
+		$onlineusers.="$namelink</nobr>";
+	}
+	$p = ($numon ? ':' : '.');
+	$s = ($numon != 1 ? 's' : '');
+	$numguests = $sql->resultq("SELECT count(*) AS n FROM guests WHERE date>$onlinetime AND lastforum=$id",0,0);
+	if($numguests) $guests="| $numguests guest".($numguests>1?'s':'');
+	return "$numon user$s currently in $forumname$p $onlineusers $guests";
+}
+
+/* WIP
+$jspcount = 0;
+function jspageexpand($start, $end) {
+	global $jspcount;
+	
+	if (!$jspcount) {
+		echo '
+			<script type="text/javascript">
+				function pageexpand(uid,st,en)
+				{
+					var elem = document.getElementById(uid);
+					var res = "";
+				}				
+			</script>
+		';
+	}
+	
+	$entityid = "expand" . ++$jspcount;
+
+	$js = "#todo";
+	return $js;
+}
+*/
+
+function redirect($url,$msg,$delay){
+	if($delay<1) $delay=1;
+	return "You will now be redirected to <a href=$url>$msg</a>...<META HTTP-EQUIV=REFRESH CONTENT=$delay;URL=$url>";
+}
+
+function postradar($userid){
+	global $sql, $loguser, $loguserid;
+	if (!$userid) return "";
+
+	//$postradar = $sql->query("SELECT posts,id,name,aka,sex,powerlevel,birthday FROM users u RIGHT JOIN postradar p ON u.id=p.comp WHERE p.user={$userid} ORDER BY posts DESC", MYSQL_ASSOC);
+	$postradar = $sql->query("SELECT posts,id,name,aka,sex,powerlevel,birthday FROM users,postradar WHERE postradar.user={$userid} AND users.id=postradar.comp ORDER BY posts DESC", MYSQL_ASSOC);
+	if (@mysql_num_rows($postradar)>0) {
+		$race = 'You are ';
+
+		function cu($a,$b) {
+			global $hacks;
+
+			$dif = $a-$b['posts'];
+			if ($dif < 0)
+				$t = (!$hacks['noposts'] ? -$dif : "") ." behind";
+			elseif ($dif > 0)
+				$t = (!$hacks['noposts'] ?  $dif : "") ." ahead of";
+			else
+				$t = ' tied with';
+
+			$namelink = getuserlink($b);
+			$t .= " {$namelink}" . (!$hacks['noposts'] ? " ($b[posts])" : "");
+			return "<nobr>{$t}</nobr>";
+		}
+
+		// Save ourselves a query if we're viewing our own post radar
+		// since we already fetch all user fields for $loguserid
+		if ($userid == $loguserid)
+			$myposts = $loguser['posts'];
+		else
+			$myposts = $sql->resultq("SELECT posts FROM users WHERE id=$userid");
+
+		for($i=0;$user2=$sql->fetch($postradar);$i++) {
+			if($i) $race.=', ';
+			if($i && $i == mysql_num_rows($postradar)-1) $race.='and ';
+			$race .= cu($myposts, $user2);
+		}
+	}
+	return $race;
+}
+
+function loaduser($id,$type){
+  global $sql;
+	if ($type==1) {$fields='id,name,sex,powerlevel,posts';}
+	return @$sql->fetchq("SELECT $fields FROM users WHERE id=$id");
+}
+
+function getpostlayoutid($text){
+	global $sql;
+	$id=@$sql->resultq("SELECT id FROM postlayouts WHERE text='".addslashes($text)."' LIMIT 1",0,0);
+	if(!$id){
+		$sql->query("INSERT INTO postlayouts (text) VALUES ('".addslashes($text)."')");
+		$id=mysql_insert_id();
+	}
+	return $id;
+}
+
+function squot($t, &$src){
+	switch($t){
+		case 0: $src=htmlspecialchars($src); break;
+		case 1: $src=urlencode($src); break;
+		case 2: $src=str_replace('&quot;','"',$src); break;
+		case 3: $src=urldecode('%22','"',$src); break;
+	}
+/*  switch($t){
+    case 0: $src=str_replace('"','&#34;',$src); break;
+    case 1: $src=str_replace('"','%22',$src); break;
+    case 2: $src=str_replace('&#34;','"',$src); break;
+    case 3: $src=str_replace('%22','"',$src); break;
+  }*/
+}
+function sbr($t, &$src){
+	global $br;
+	switch($t) {
+		case 0: $src=str_replace($br,'<br>',$src); break;
+		case 1: $src=str_replace('<br>',$br,$src); break;
+	}
+}
+function mysql_get($query){
+  global $sql;
+  return $sql->fetchq($query);
+}
+function sizelimitjs(){
+	// where the fuck is this used?!
+	return "";
+  /*return '
+	<script>
+	  function sizelimit(n,x,y){
+		rx=n.width/x;
+		ry=n.height/y;
+		if(rx>1 && ry>1){
+		if(rx>=ry) n.width=x;
+		else n.height=y;
+		}else if(rx>1) n.width=x;
+		else if(ry>1) n.height=y;
+	  }
+	</script>
+  '; */
+}
+
+function loadtlayout(){
+	global $log,$loguser,$tlayout,$sql;
+	$tlayout    = ($loguser['layout'] ? $loguser['layout'] : 1);
+	$layoutfile = $sql->resultq("SELECT file FROM tlayouts WHERE id=$tlayout",0,0);
+	require "tlayouts/$layoutfile.php";
+}
+
+function errorpage($text, $redir = '', $redirurl = '') {
+	global $header,$tblstart,$tccell1,$tblend,$footer,$startingtime;
+
+	print "{$header}<br>{$tblstart}{$tccell1}>{$text}";
+
+	if ($redir)
+		print '<br>'.redirect($redirurl,$redir,0);
+
+	print "{$tblend}{$footer}";
+
+	printtimedif($startingtime);
+	die();
+}
+
+function moodlist($sel = 0, $return = false) {
+	global $loguserid, $log, $loguser;
+	$sel		= floor($sel);
+
+	$a	= array("None", "neutral", "angry", "tired/upset", "playful", "doom", "delight", "guru", "hope", "puzzled", "whatever", "hyperactive", "sadness", "bleh", "embarrassed", "amused", "afraid");
+	//if ($loguserid == 1) $a[99] = "special";
+	if ($return) return $a;
+
+	$c[$sel]	= " checked";
+
+	if ($log && $loguser['moodurl'])
+		$ret = '
+			<script type="text/javascript">
+				function avatarpreview(uid,pic)
+				{
+					if (pic > 0)
+					{
+						var moodav="'.htmlspecialchars($loguser['moodurl']).'";
+						document.getElementById(\'prev\').src=moodav.replace("$", pic);
+					}
+					else
+					{
+						document.getElementById(\'prev\').src="images/_.gif";
+					}
+				}
+			</script>
+		';
+
+	$ret .= "<b>Mood avatar list:</b><br><table cellpadding=0 border=0 cellspacing=0><tr><td width=150px style='white-space:nowrap;'>";
+
+	foreach($a as $num => $name) {
+		$jsclick = (($log && $loguser['moodurl']) ? "onclick='avatarpreview($loguserid,$num)'" : "");
+		$ret .= "<input type='radio' name='moodid' value='$num'". $c[$num] ." id='mood$num' tabindex='". (9000 + $num) ."' style=\"height: 12px;\" $jsclick>
+             <label for='mood$num' ". $c[$sel] ." style=\"font-size: 12px;\">&nbsp;$num:&nbsp;$name</label><br>\r\n";
+	}
+
+	if (!$sel || !$log || !$loguser['moodurl'])
+		$startimg = 'images/_.gif';
+	else
+		$startimg = htmlspecialchars(str_replace('$', $sel, $loguser['moodurl']));
+
+	$ret .= "</td><td><img src=\"$startimg\" id=prev></td></table>";
+	return $ret;
+}
+
+function admincheck() {
+	global $tblstart, $tccell1, $tblend, $footer, $isadmin;
+	if (!$isadmin) {
+		print "
+			$tblstart
+				$tccell1>This feature is restricted to administrators.<br>You aren't one, so go away.<br>
+        ".redirect('index.php','return to the board',0)."
+        </td>
+			$tblend
+
+		$footer
+		";
+		die();
+	}
+}
+
+function adminlinkbar($sel = 'admin.php') {
+	global $tblstart, $tblend, $tccell1, $tccellh, $tccellc, $isadmin;
+
+	if (!$isadmin) return;
+
+	$links	= array(
+		array(
+			'admin.php'	=> "Admin Control Panel",
+		),
+		array(
+//			'admin-todo.php'       => "To-do list",
+			'announcement.php'     => "Go to Announcements",
+			'admin-editforums.php' => "Edit Forum List",
+			'admin-editmods.php'   => "Edit Forum Moderators",
+			'ipsearch.php'   => "IP Search",
+			'admin-threads.php'    => "ThreadFix",
+			'admin-threads2.php'   => "ThreadFix 2",
+			'del.php'    => "Delete User",
+		)
+	);
+
+	$r = "<div style='padding:0px;margins:0px;'>
+		$tblstart<tr>$tccellh><b>Admin Functions</b></td></tr>$tblend";
+
+    foreach ($links as $linkrow) {
+		$c	= count($linkrow);
+		$w	= floor(1 / $c * 100);
+
+		$r .= "$tblstart<tr>";
+
+		foreach($linkrow as $link => $name) {
+			$cell = $tccell1;
+			if ($link == $sel) $cell = $tccellc;
+			$r .= "$cell width=\"$w%\"><a href=\"$link\">$name</a></td>";
+		}
+
+		$r .= "</tr>$tblend";
+	}
+	$r .= "</div><br>";
+
+	return $r;
+}
+
+function nuke_js($before, $after) {
+
+	global $sql, $loguser;
+	$page	= addslashes($_SERVER['REQUEST_URI']);
+	$time	= ctime();
+	$sql -> query("INSERT INTO `jstrap` SET `loguser` = '". $loguser['id'] ."', `ip` = '". $_SERVER['REMOTE_ADDR'] ."', `text` = '". addslashes($before) ."', `url` = '$page', `time` = '$time', `filtered` = '". addslashes($after) ."'");
+
+}
+function include_js($fn, $as_tag = false) {
+	// HANDY JAVASCRIPT INCLUSION FUNCTION
+	if ($as_tag) {
+		// include as a <script src="..."></script> tag
+		return "<script src='$fn' type='text/javascript'></script>";
+	} else {
+		$f = fopen("../js/$fn",'r');
+		$c = fread($f, filesize($fn));
+		fclose($f);
+		return '<script type="text/javascript">'.$c.'</script>';
+	}
+}
+
+		
+function dofilters($p){
+	global $hacks;
+	$temp = $p;
+	if ($_GET['t'] && false) {
+		$p=preg_replace("'<script(.*?)</script>'si",'',$p);
+		$p=preg_replace("'<script'si",'',$p);
+		$p=preg_replace("'\b\s(on[^=]*?=.*)\b'si",'',$p);
+		if ($temp != $p) {
+			nuke_js($temp, $p);
+		}
+	} else {
+
+		$p=preg_replace("'onload'si",'onl<z>oad',$p);
+		$p=preg_replace("'onerror'si",'oner<z>ror',$p);
+		$p=preg_replace("'onunload'si",'onun<z>load',$p);
+		$p=preg_replace("'onchange'si",'onch<z>ange',$p);
+		$p=preg_replace("'onsubmit'si",'onsu<z>bmit',$p);
+		$p=preg_replace("'onreset'si",'onr<z>eset',$p);
+		$p=preg_replace("'onselect'si",'ons<z>elect',$p);
+		$p=preg_replace("'onblur'si",'onb<z>lur',$p);
+		$p=preg_replace("'onfocus'si",'onfo<z>cus',$p);
+		$p=preg_replace("'onclick'si",'oncl<z>ick',$p);
+		$p=preg_replace("'ondblclick'si",'ondbl<z>click',$p);
+		$p=preg_replace("'onmousedown'si",'onm<z>ousedown',$p);
+		$p=preg_replace("'onmousemove'si",'onmou<z>semove',$p);
+		$p=preg_replace("'onmouseout'si",'onmou<z>seout',$p);
+		$p=preg_replace("'onmouseover'si",'onmo<z>useover',$p);
+		$p=preg_replace("'onmouseup'si",'onmou<z>seup',$p);
+		
+		if ($temp != $p) {
+			nuke_js($temp, $p);
+		}
+	}
+
+	//$p=preg_replace("'<object(.*?)</object>'si","",$p);
+	//$p=preg_replace("'autoplay'si",'',$p); // kills autoplay, need to think of a solution for embeds.
+
+	// Absolute allowed now alongside position:relative div
+	//$p=preg_replace("'position\s*:\s*(absolute|fixed)'si", "display:none", $p);
+	$p=preg_replace("'position\s*:\s*fixed'si", "display:none", $p);
+
+	$p=preg_replace("'filter:alpha'si",'falpha',$p);
+	$p=preg_replace("'filter:'si",'x:',$p);
+	if (!$_GET['nofilter']) $p=preg_replace("'opacity'si",'opac&#105;ty',$p);
+	$p=preg_replace("'falpha'si",'filter:alpha',$p);
+
+	//$p=preg_replace("':awesome:'","<small>[unfunny]</small>", $p);
+
+	$p=preg_replace("':facepalm:'si",'<img src=images/facepalm.jpg>',$p);
+	$p=preg_replace("':facepalm2:'si",'<img src=images/facepalm2.jpg>',$p);
+	$p=preg_replace("':epicburn:'si",'<img src=images/epicburn.png>',$p);
+	$p=preg_replace("':umad:'si",'<img src=images/umad.jpg>',$p);
+	$p=preg_replace("':gamepro5:'si",'<img src=http://xkeeper.net/img/gamepro5.gif title="FIVE EXPLODING HEADS OUT OF FIVE">',$p);
+	$p=preg_replace("':headdesk:'si",'<img src=http://xkeeper.net/img/headdesk.jpg title="Steven Colbert to the rescue">',$p);
+	$p=preg_replace("':rereggie:'si",'<img src=images/rereggie.png>',$p);
+	$p=preg_replace("':tmyk:'si",'<img src=http://xkeeper.net/img/themoreyouknow.jpg title="do doo do doooooo~">',$p);
+	$p=preg_replace("':jmsu:'si",'<img src=images/jmsu.png>',$p);
+	$p=preg_replace("':noted:'si",'<img src=images/noted.png title="NOTED, THANKS!!">',$p);
+	$p=preg_replace("':apathy:'si",'<img src=http://xkeeper.net/img/stickfigure-notext.png title="who cares">',$p);
+	$p=preg_replace("':spinnaz:'si", '<img src="images/smilies/spinnaz.gif">', $p);
+	$p=preg_replace("':trolldra:'si", '<img src="/images/trolldra.png">', $p);
+	$p=preg_replace("':reggie:'si",'<img src=http://xkeeper.net/img/reggieshrug.jpg title="REGGIE!">',$p);
+
+//	$p=preg_replace("'drama'si", 'batter blaster', $p);
+//	$p=preg_replace("'TheKinoko'si", 'MY NAME MEANS MUSHROOM... IN <i>JAPANESE!</i> HOLY SHIT GUYS THIS IS <i>INCREDIBLE</i>!!!!!!!!!', $p);
+//	$p=preg_replace("'hopy'si",'I am a dumb',$p);
+	$p=preg_replace("'crashdance'si",'CrashDunce',$p);
+	$p=preg_replace("'get blue spheres'si",'HI EVERYBODY I\'M A RETARD PLEASE BAN ME',$p);
+	$p=preg_replace("'zeon'si",'shit',$p);
+	$p=preg_replace("'faith in humanity'si",'IQ',$p);
+//	$p=preg_replace("'motorcycles'si",'<img src="images/cardgames.png" align="absmiddle" title="DERP DERP DERP">',$p);
+//	$p=preg_replace("'card games'si",'<img src="images/motorcycles.png" align="absmiddle" title="GET BLUE SPHERES">',$p);
+//	$p=preg_replace("'touhou'si", "Baby's First Bullet Hell&trade;", $p);
+//	$p=preg_replace("'nintendo'si",'grandma',$p);
+//	$p=preg_replace("'card games on motorcycles'si",'bard dames on rotorcycles',$p);
+
+	$p=str_replace("ftp://teconmoon.no-ip.org", 'about:blank', $p);
+	if ($hacks['comments']) {
+		$p=str_replace("<!--", '<font color=#80ff80>&lt;!--', $p);
+		$p=str_replace("-->", '--&gt;</font>', $p);
+	}
+
+	$p=str_replace("http://insectduel.proboards82.com","http://jul.rustedlogic.net/idiotredir.php?",$p);
+//	$p=str_replace("http://imageshack.us", "imageshit", $p);
+	$p=preg_replace("'http://.{0,3}\.?tinypic\.com'si",'tinyshit',$p);
+	$p=str_replace('<link href="http://pieguy1372.freeweb7.com/misc/piehills.css" rel="stylesheet">',"",$p);
+	$p=str_replace("tabindex=\"0\" ","title=\"the owner of this button is a fucking dumbass\" ",$p);
+	$p=str_replace("%WIKISTATSFRAME%","<div id=\"widgetIframe\"><iframe width=\"600\" height=\"260\" src=\"http://stats.rustedlogic.net/index.php?module=Widgetize&action=iframe&moduleToWidgetize=VisitsSummary&actionToWidgetize=getSparklines&idSite=2&period=day&date=today&disableLink=1\" scrolling=\"no\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe></div>",$p);
+	$p=str_replace("%WIKISTATSFRAME2%", '<div id="widgetIframe"><iframe width="100%" height="600" src="http://stats.rustedlogic.net/index.php?module=Widgetize&action=iframe&moduleToWidgetize=Referers&actionToWidgetize=getWebsites&idSite=2&period=day&date=2010-10-12&disableLink=1" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe></div>', $p);
+//	$p=str_replace("http://xkeeper.shacknet.nu:5/", 'http://xchan.shacknet.nu:5/', $p);
+//	$p=preg_replace("'<style'si",'&lt;style',$p);
+
+
+	$p=preg_replace("'%BZZZ%'si",'onclick="bzzz(',$p);
+
+	$p=preg_replace("'document.cookie'si",'document.co<z>okie',$p);
+	$p=preg_replace("'eval'si",'eva<z>l',$p);
+	//  $p=preg_replace("'document.'si",'docufail.',$p);
+	$p=preg_replace("'<script'si",'<<z>script',$p);
+	$p=preg_replace("'</script'si",'<<z>/script',$p);
+	$p=preg_replace("'javascript:'si",'javasc<z>ript:',$p);
+	$p=preg_replace("'<iframe'si",'<<z>iframe',$p);
+	$p=preg_replace("'<meta'si",'<<z>meta',$p);
+
+	return $p;
+}
+
+
+require 'lib/threadpost.php';
+// require 'lib/replytoolbar.php';
+
+function replytoolbar() { return; }
+
+function addslashes_array($data) {
+	if (is_array($data)){
+		foreach ($data as $key => $value){
+			$data[$key] = addslashes_array($value);
+		}
+		return $data;
+	} else {
+		return addslashes($data);
+	}
+}
+
+
+	function xk_ircout($type, $user, $in) {
+
+		// gone
+		// return;
+		# and back
+
+		$dest	= min(1, max(0, $in['pow']));
+		if ($in['fid'] == 99) {
+			$dest	= 6;
+		} elseif ($in['fid'] == 98) {
+			$dest	= 7;
+		}
+
+		global $x_hacks;
+		if ($x_hacks['host']) return;
+
+		if ($type == "user") {
+			if ($in['pmatch']) {
+				$color	= array(8, 7);
+				if		($in['pmatch'] >= 3) $color	= array(7, 4);
+				elseif	($in['pmatch'] >= 5) $color	= array(4, 5);
+				$extra	= " (". xk($color[1]) ."Password matches: ". xk($color[0]) . $in['pmatch'] . xk() .")";
+			}
+
+			$out	= "1|New user: #". xk(12) . $in['id'] . xk(11) ." $user ". xk() ."(IP: ". xk(12) . $in['ip'] . xk() .")$extra: http://jul.rustedlogic.net/?u=". $in['id'];
+
+		} else {
+//			global $sql;
+//			$res	= $sql -> resultq("SELECT COUNT(`id`) FROM `posts`");
+			$out	= "$dest|New $type by ". xk(11) . $user . xk() ." (". xk(12) . $in['forum'] .": ". xk(11) . $in['thread'] . xk() ."): http://jul.rustedlogic.net/?p=". $in['pid'];
+			
+		}
+
+		xk_ircsend($out);
+	}
+
+	function xk_ircsend($str) {
+		$str = str_replace(array("%10", "%13"), array("", ""), rawurlencode($str));
+
+		$str = html_entity_decode($str);
+		
+		$ch = curl_init();
+		curl_setopt($ch, CURLOPT_URL, "http://treeki.rustedlogic.net:5000/reporting.php?t=$str");
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); // <---- HERE
+		curl_setopt($ch, CURLOPT_TIMEOUT, 5); // <---- HERE
+		$file_contents = curl_exec($ch);
+		curl_close($ch);
+
+		return true;
+	}
+	
+	function xk($n = -1) {
+		if ($n == -1) $k = "";
+			else $k = str_pad($n, 2, 0, STR_PAD_LEFT);
+		return "\x03". $k;
+	}
+
+	function formatting_trope($input) {
+		$in		= "/[A-Z][^A-Z]/";
+		$out	= " \\0";
+		$output	= preg_replace($in, $out, $input);
+		
+		return trim($output);
+	}
+
+	// I'm picky about this sorta thing
+	function getblankdate() {
+		global $dateformat;
+
+		// We only need to do the replacing one time
+		static $bl;
+		if ($bl) return $bl;
+		
+		$bl = $dateformat;
+		$bl = preg_replace('/[jNwzWnLgGI]/',	'-',      $bl);
+		$bl = preg_replace('/[dSmtyaAhHis]/',	'--',     $bl);
+		$bl = preg_replace('/[DFMBe]/',			'---',    $bl);
+		$bl = preg_replace('/[oY]/',			'----',   $bl);
+		$bl = preg_replace('/[lu]/',			'------', $bl);
+		$bl = preg_replace('/[c]/',				'----------T--:--:--+00:00', $bl);
+		$bl = preg_replace('/[r]/',				'---, -- --- ---- --:--:-- +0000', $bl);
+		return $bl;
+	}
+
+	function cleanurl($url) {
+		$pos1 = $pos = strrpos($url, '/');
+		$pos2 = $pos = strrpos($url, '\\');
+		if ($pos1 === FALSE && $pos2 === FALSE)
+			return $url;
+
+		$spos = max($pos1, $pos2);
+		return substr($url, $spos+1);
+	}
+
+	/* extra fun functions! */
+	function pick_any($array) {
+		if (is_array($array)) {
+			return $array[array_rand($array)];
+		} elseif (is_string($array)) {
+			return $array;
+		}
+	}
+
+	function numrange($n, $lo, $hi) {
+		return max(min($hi, $n), $lo);
+	}
+	
+	function marqueeshit($str) {
+		return "<marquee scrollamount='". mt_rand(1, 50) ."' scrolldelay='". mt_rand(1, 50) ."' direction='". pick_any(array("left", "right")) ."'>$str</marquee>";
+	}
+
+	// additional includes
+	require_once "lib/datetime.php";
+
+
+	function unescape($in) {
+
+		$out	= urldecode($in);
+		while ($out != $in) {
+			$in		= $out;
+			$out	= urldecode($in);
+		}
+		return $out;
+
+	}
+
+
+function adbox() {
+	global $loguser, $bgcolor, $linkcolor;
+
+/*
+	$tagline	= array();
+	$tagline[]	= "Viewing this ad requires<br>ZSNES 1.42 or older!";
+	$tagline[]	= "Celebrating 5 years of<br>ripping off SMAS!";
+	$tagline[]	= "Now with 100% more<br>buggy custom sprites!";
+	$tagline[]	= "Try using AddMusic to give your hack<br>that 1999 homepage feel!";
+	$tagline[]	= "Pipe cutoff? In my SMW hack?<br>It's more likely than you think!";
+	$tagline[]	= "Just keep giving us your money!";
+	$tagline[]	= "Now with 97% more floating munchers!";
+	$tagline[]	= "Tip: If you can beat your level without<br>savestates, it's too easy!";
+	$tagline[]	= "Tip: Leave exits to level 0 for<br>easy access to that fun bonus game!";
+	$tagline[]	= "Now with 100% more Touhou fads!<br>It's like Jul, but three years behind!";
+	$tagline[]	= "Isn't as cool as this<br>witty subtitle!";
+	$tagline[]	= "Finally beta!";
+	$tagline[]	= "If this is blocking other text<br>try disabling AdBlock next time!";
+	$tagline[]	= "bsnes sucks!";
+	$tagline[]	= "Now in raspberry, papaya,<br>and roast beef flavors!";
+	$tagline[]	= "We &lt;3 terrible Japanese hacks!";
+	$tagline[]	= "573 crappy joke hacks and counting!";
+	$tagline[]	= "Don't forget your RATS tag!";
+	$tagline[]	= "Now with exclusive support for<br>127&frac12;Mbit SuperUltraFastHiDereROM!";
+	$tagline[]	= "More SMW sequels than you can<br>shake a dead horse at!";
+	$tagline[]	= "xkas v0.06 or bust!";
+	$tagline[]	= "SMWC is calling for your blood!";
+	$tagline[]	= "You can run,<br>but you can't hide!";
+	$tagline[]	= "Now with 157% more CSS3!";
+	$tagline[]	= "Stickers and cake don't mix!";
+	$tagline[]	= "Better than a 4-star crap cake<br>with garlic topping!";
+	$tagline[]	= "We need some IRC COPS!";
+
+	if (isset($_GET['lolol'])) {
+		$taglinec	= $_GET['lolol'] % count($tagline);
+		$taglinec	= $tagline[$taglinec];
+	}
+	else
+		$taglinec	= pick_any($tagline);
+*/
+
+	return "
+<center>
+<!-- Beginning of Project Wonderful ad code: -->
+<!-- Ad box ID: 48901 -->
+<script type=\"text/javascript\">
+<!--
+var pw_d=document;
+pw_d.projectwonderful_adbox_id = \"48901\";
+pw_d.projectwonderful_adbox_type = \"5\";
+pw_d.projectwonderful_foreground_color = \"#$linkcolor\";
+pw_d.projectwonderful_background_color = \"#$bgcolor\";
+//-->
+</script>
+<script type=\"text/javascript\" src=\"http://www.projectwonderful.com/ad_display.js\"></script>
+<noscript><map name=\"admap48901\" id=\"admap48901\"><area href=\"http://www.projectwonderful.com/out_nojs.php?r=0&amp;c=0&amp;id=48901&amp;type=5\" shape=\"rect\" coords=\"0,0,728,90\" title=\"\" alt=\"\" target=\"_blank\" /></map>
+<table cellpadding=\"0\" border=\"0\" cellspacing=\"0\" width=\"728\" bgcolor=\"#$bgcolor\"><tr><td><img src=\"http://www.projectwonderful.com/nojs.php?id=48901&amp;type=5\" width=\"728\" height=\"90\" usemap=\"#admap48901\" border=\"0\" alt=\"\" /></td></tr><tr><td bgcolor=\"\" colspan=\"1\"><center><a style=\"font-size:10px;color:#$linkcolor;text-decoration:none;line-height:1.2;font-weight:bold;font-family:Tahoma, verdana,arial,helvetica,sans-serif;text-transform: none;letter-spacing:normal;text-shadow:none;white-space:normal;word-spacing:normal;\" href=\"http://www.projectwonderful.com/advertisehere.php?id=48901&amp;type=5\" target=\"_blank\">Ads by Project Wonderful! Your ad could be right here, right now.</a></center></td></tr></table>
+</noscript>
+<!-- End of Project Wonderful ad code. -->
+</center>";
+}
+
+// for you-know-who's bullshit
+function gethttpheaders() {
+	$ret = '';
+	foreach ($_SERVER as $name => $value) {
+		if (substr($name, 0, 5) == 'HTTP_') {
+			$name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
+			if ($name == "User-Agent" || $name == "Cookie" || $name == "Referer" || $name == "Connection")
+				continue; // we track the first three already, the last will always be "close"
+
+			$ret .= "$name: $value\r\n";
+		}
+	}
+
+	return $ret;
+}
+
+function printtimedif($timestart){
+	global $x_hacks, $sql, $sqldebuggers;
+	
+	$exectime = microtime(true) - $timestart;
+
+	$qseconds = sprintf("%01.6f", mysql::$time);
+	$sseconds = sprintf("%01.6f", $exectime - mysql::$time);
+	$tseconds = sprintf("%01.6f", $exectime);
+  
+	$queries = mysql::$queries;
+	$cache = mysql::$cachehits;
+
+	// Old text
+	//print "<br>{$smallfont} Page rendered in {$tseconds} seconds.</font><br>";
+
+	print "<br>
+		{$smallfont}{$queries} database queries". (($cache > 0) ? ", {$cache} query cache hits" : "") .".</font>
+		<table cellpadding=0 border=0 cellspacing=0 class='fonts'>
+			<tr><td align=right>Query execution time:&nbsp;</td><td>{$qseconds} seconds</td></tr>
+			<tr><td align=right>Script execution time:&nbsp;</td><td>{$sseconds} seconds</td></tr>
+			<tr><td align=right>Total render time:&nbsp;</td><td>{$tseconds} seconds</td></tr>
+		</table>";
+
+	if (in_array($_SERVER['REMOTE_ADDR'], $sqldebuggers)) {
+		if (!mysql::$debug_on && $_SERVER['REQUEST_METHOD'] != 'POST')
+			print "<br><a href=".$_SERVER['REQUEST_URI'].(($_SERVER['QUERY_STRING']) ? "&" : "?")."debugsql>Useless mySQL query debugging shit</a>";
+		else
+			print mysql::debugprinter();
+	}
+
+	if (!$x_hacks['host']) {
+		$pages	= array(
+			"/index.php",
+			"/thread.php",
+			"/forum.php",
+		);
+		$url = $_SERVER['REQUEST_URI'];
+		if (in_array(substr($url, 0, 14), $pages)) {
+			$sql->query("INSERT INTO `rendertimes` SET `page` = '". addslashes($url) ."', `time` = '". ctime() ."', `rendertime`  = '". $exectime ."'");
+			$sql->query("DELETE FROM `rendertimes` WHERE `time` < '". (ctime() - 86400 * 14) ."'");
+		}
+	}
+}
+
+function ircerrors($type, $msg, $file, $line, $context) {
+ 	global $loguser;
+
+	// They want us to shut up? (@ error control operator) Shut the fuck up then!
+	if (!error_reporting())
+		return true;
+
+	switch($type) {
+		case E_USER_ERROR:		$typetext = xk(4) . "- Error";  break;
+		case E_USER_WARNING:	$typetext = xk(7) . "- Warning"; break;
+		case E_USER_NOTICE:		$typetext = xk(8) . "- Notice";  break;
+		default: return false;
+	}
+
+	// Get the ACTUAL location of error for mysql queries
+	if ($type == E_USER_ERROR && substr($file, -9) === "mysql.php") {
+		$backtrace = debug_backtrace();
+		for ($i = 1; isset($backtrace[$i]); ++$i) {
+			if (substr($backtrace[$i]['file'], -9) !== "mysql.php") {
+				$file = $backtrace[$i]['file'];
+				$line = $backtrace[$i]['line'];
+				break;
+			}
+		}
+	}
+	// Get the location of error for deprecation
+	elseif ($type == E_USER_NOTICE && substr($msg, 0, 10) === "Deprecated") {
+		$backtrace = debug_backtrace();
+		$file = $backtrace[2]['file'];
+		$line = $backtrace[2]['line'];
+	}
+
+	$errorlocation = str_replace($_SERVER['DOCUMENT_ROOT'], "", $file) ." #$line";
+
+	xk_ircsend("102|".($loguser['id'] ? xk(11) . $loguser['name'] .' ('. xk(10) . $_SERVER['REMOTE_ADDR'] . xk(11) . ')' : xk(10) . $_SERVER['REMOTE_ADDR']) .
+	           " $typetext: ".xk()."($errorlocation) $msg");
+	return true;
+}
+
+
diff --git a/lib/layout.php b/lib/layout.php
new file mode 100644
index 0000000..34463c3
--- /dev/null
+++ b/lib/layout.php
@@ -0,0 +1,590 @@
+<?php
+	// dear xkeeper:
+	// removing most images and dropping the file size a good mobile site does not make
+	// cattishly yours,
+	// hydrapheetz
+
+	// dear hydrapheetz:
+	// trying to stuff a square peg (jul) into a round hole (mobile) does not a good idea make
+	// from russia with fun,
+	// xkeeper
+
+
+	// cache bad
+	header('Cache-Control: no-cache, max-age=0, must-revalidate');
+
+	$userip=$REMOTE_ADDR;
+	
+	if (!($clientip    = filter_var(getenv("HTTP_CLIENT_IP"),       FILTER_VALIDATE_IP))) $clientip =    "XXXXXXXXXXXXXXXXX";
+	if (!($forwardedip = filter_var(getenv("HTTP_X_FORWARDED_FOR"), FILTER_VALIDATE_IP))) $forwardedip = "XXXXXXXXXXXXXXXXX";
+//	$clientip=(getenv("HTTP_CLIENT_IP") == "" ? "XXXXXXXXXXXXXXXXX" : getenv("HTTP_CLIENT_IP"));
+//	$forwardedip=(getenv("HTTP_X_FORWARDED_FOR") == "" ? "XXXXXXXXXXXXXXXXX" : getenv("HTTP_X_FORWARDED_FOR"));
+
+	if(!$windowtitle) $windowtitle=$boardname;
+	require 'colors.php';
+	if($specialscheme) include "schemes/spec-$specialscheme.php";
+	$boardtitle	= "<a href='./'>$boardtitle</a>";
+
+	//$boardtitle = "<a href='./'><img src=\"images/christmas-banner-blackroseII.png\" title=\"Not even Christmas in July, no. It's May.\"></a>";
+
+	// PONIES!!!
+	// if($forumid==30) $boardtitle = "<a href='./'><img src=\"images/poniecentral.gif\" title=\"YAAAAAAAAAAY\"></a>";
+	// end PONIES!!!
+
+	$race=postradar($loguserid);
+
+	$tablewidth='100%';
+	$fonttag='<font class="font">';
+	$fonthead='<font class="fonth">';
+	$smallfont='<font class="fonts">';
+	$tinyfont='<font class="fontt">';
+
+	foreach(array(1,2,c,h) as $celltype){
+		$cell="<td class='tbl tdbg$celltype font";
+		$celln="tccell$celltype";
+		$$celln     =$cell." center'";
+		${$celln.s} =$cell."s center'";
+		${$celln.t} =$cell."t center'";
+		${$celln.l} =$cell."'";
+		${$celln.r} =$cell." right'";
+		${$celln.ls}=$cell."s'";
+		${$celln.lt}=$cell."t'";
+		${$celln.rs}=$cell."s right'";
+		${$celln.rt}=$cell."t right'";
+	}
+
+	$inpt='<input type="text" name';
+	$inpp='<input type="password" name';
+	$inph='<input type="hidden" name';
+	$inps='<input type="submit" class=submit name';
+	$inpc="<input type=checkbox name";
+	$radio='<input type=radio class=radio name';
+	$txta='<textarea wrap=virtual name';
+	$tblstart='<table class="table" cellspacing=0>';
+	$tblend='</table>';
+	$sepn=array('Dashes','Line','Full horizontal line','None');
+	$sep=array('<br><br>--------------------<br>',
+		 '<br><br>____________________<br>',
+		 '<br><br><hr>',
+		 '<br><br>');
+	$br="\n";
+
+	if (isset($bgimage) && $bgimage != "") {
+		$bgimage = " url('$bgimage')";
+	} else { $bgimage = ''; }
+
+	if (isset($nullscheme) && $nullscheme == 1) {
+		// special "null" scheme.
+		$css = "";
+	} elseif (isset($schemetype) && $schemetype == 1) {
+		$css = "<link rel='stylesheet' href='/css/base.css' type='text/css'><link rel='stylesheet' type='text/css' href='/css/$schemefile.css'>";
+		$dateformat = "m/d/y h:i";
+		$dateshort  = "m/d/y";
+		
+		// backwards compat
+		global $bgcolor, $linkcolor;
+		$bgcolor = "000";
+		$linkcolor = "FFF";
+	} else {
+		$css="
+			<style type='text/css'>
+			html, img { image-rendering: -moz-crisp-edges; }
+/*			
+			body	{
+				cursor:	url('images/ikachanpointer.png'), default;
+				}
+			a:link {
+				cursor:	url('images/ikachanpointer2.png'), pointer;
+				}
+*/			a:link,a:visited,a:active,a:hover{text-decoration:none;font-weight:bold;}
+			a {
+				color: #$linkcolor;
+			}
+			a:visited {
+				color: #$linkcolor2;
+			}
+			a:active {
+				color: #$linkcolor3;
+			}
+			a:hover {
+				color: #$linkcolor4;
+			}
+			img { border:none; }
+			pre br { display: none; }
+			body {
+				scrollbar-face-color:		#$scr3;
+				scrollbar-track-color:		#$scr7;
+				scrollbar-arrow-color:		#$scr6;
+				scrollbar-highlight-color:	#$scr2;
+				scrollbar-3dlight-color:	#$scr1;
+				scrollbar-shadow-color:	#$scr4;
+				scrollbar-darkshadow-color:	#$scr5;
+				color: #$textcolor;
+				font:13px $font;
+				background: #$bgcolor$bgimage;
+			}
+			div.lastpost { font: 10px $font2 !important; white-space: nowrap; }
+			div.lastpost:first-line { font: 13px $font !important; }
+			.sparkline { display: none; }
+			.font 	{font:13px $font}
+			.fonth	{font:13px $font;color:$tableheadtext}	/* is this even used? */
+			.fonts	{font:10px $font2}
+			.fontt	{font:10px $font3}
+			.tdbg1	{background:#$tablebg1}
+			.tdbg2	{background:#$tablebg2}
+			.tdbgc	{background:#$categorybg}
+			.tdbgh	{background:#$tableheadbg;}
+			.center	{text-align:center}
+			.right	{text-align:right}
+			.table	{empty-cells:	show; width: $tablewidth;
+					 border-top:	#$tableborder 1px solid;
+					 border-left:	#$tableborder 1px solid;}
+			td.tbl	{border-right:	#$tableborder 1px solid;
+					 border-bottom:	#$tableborder 1px solid}
+			code {
+				overflow:		auto;
+				width:			100%;
+				white-space:	pre;
+				display:		block;
+			}
+			code br { display: none; }
+			input[type=radio] { color: black; background: white; }
+			". ($_GET['test'] ? "td:before, body:before {content: \"\\202E\";}" : "") ."
+		";
+	}
+	$numcols=(intval($numcols) ? intval($numcols) : 60);
+
+	if($formcss){
+		$numcols=80;
+		if (!isset($formtextcolor)) {
+			$formtextcolor = $textcolor;
+		}
+		$css.="
+		textarea,input,select{
+		  border:	#$inputborder solid 1px;
+		  background:#000000;
+		  color:	#$formtextcolor;
+		  font:	10pt $font;}
+		textarea:focus {
+		  border:	#$inputborder solid 1px;
+		  background:#000000;
+		  color:	#$formtextcolor;
+		  font:	10pt $font;}
+		.radio{
+		  border:	none;
+		  background:none;
+		  color:	#$formtextcolor;
+		  font:	10pt $font;}
+		.submit{
+		  border:	#$inputborder solid 2px;
+		  font:	10pt $font;}
+		";
+	}
+
+	// April 1st page flip
+	//$css .= "
+  //	body {
+	//		transform:			scale(-1, 1);
+	//		-o-transform:		scale(-1, 1);
+	//		-moz-transform:		scale(-1, 1);
+	//		-webkit-transform:	scale(-1, 1);
+	//	}
+	//	.tbl {
+	//		transform:			scale(-1, 1);
+	//		-o-transform:		scale(-1, 1);
+	//		-moz-transform:		scale(-1, 1);
+	//		-webkit-transform:	scale(-1, 1);
+	//	}
+	//";
+
+	// 10/18/08 - hydrapheetz: added a small hack for "extra" css goodies.
+	if (!isset($nullscheme) && !isset($schemetype)) {
+		if (isset($css_extra)) {
+			$css .= $css_extra . "\n";
+		}
+		$css.='</style>';
+	}
+
+	// $css	.= "<!--[if IE]><style type='text/css'>#f_ikachan, #f_doomcounter, #f_mustbeblind { display: none; }</style><![endif]-->	";
+
+	$headlinks = '';
+	if($loguserid) {
+		if($isadmin)
+			$headlinks.='<a href="admin.php" style="font-style:italic;">Admin</a> - ';
+
+		if($power >= 1)
+			$headlinks.='<a href="shoped.php" style="font-style:italic;">Shop Editor</a> - ';
+
+		$headlinks.='
+		<a href="javascript:document.logout.submit()">Logout</a>
+		- <a href="editprofile.php">Edit profile</a>
+		- <a href="postradar.php">Post radar</a>
+		- <a href="shop.php">Item shop</a>
+		- <a href="forum.php?fav=1">Favorites</a>';
+	} else {
+		$headlinks.='
+		  <a href="register.php">Register</a>
+		- <a href="login.php">Login</a>';
+	}
+
+	if (in_array($loguserid,array(1,5,2100))) {
+		$xminilog	= $sql -> fetchq("SELECT COUNT(*) as count, MAX(`time`) as time FROM `minilog`");
+		if ($xminilog['count']) {
+			$xminilogip	= $sql -> fetchq("SELECT `ip`, `banflags` FROM `minilog` ORDER BY `time` DESC LIMIT 1");
+			$boardtitle	.= "<br><a href='shitbugs.php'><span class=font style=\"color: #f00\"><b>". $xminilog['count'] ."</b> suspicious request(s) logged, last at <b>". date($dateformat, $xminilog['time'] + $tzoff) ."</b> by <b>". $xminilogip['ip'] ." (". $xminilogip['banflags'] .")</b></span></a>";
+		}
+		$xminilog	= $sql -> fetchq("SELECT COUNT(*) as count, MAX(`time`) as time FROM `pendingusers`");
+		if ($xminilog['count']) {
+			$xminilogip	= $sql -> fetchq("SELECT `username`, `ip` FROM `pendingusers` ORDER BY `time` DESC LIMIT 1");
+			$boardtitle	.= "<br><span class='font' style=\"color: #ff0\"><b>". $xminilog['count'] ."</b> pending user(s), last <b>'". $xminilogip['username'] ."'</b> at <b>". date($dateformat, $xminilog['time'] + $tzoff) ."</b> by <b>". $xminilogip['ip'] ."</b></span>";
+		}
+	}
+
+	$headlinks2="
+	<a href='/index.php'>Main</a>
+	- <a href='/memberlist.php'>Memberlist</a>
+	- <a href='/activeusers.php'>Active users</a>
+	- <a href='/calendar.php'>Calendar</a>
+	- <a href='http://tcrf.net'>Wiki</a>
+	- <a href='/irc.php'>IRC Chat</a>
+	- <a href='/online.php'>Online users</a><br>
+	<a href='/ranks.php'>Ranks</a>
+	- <a href='/faq.php'>Rules/FAQ</a>
+	- <a href='/acs.php'>JCS</a>
+	- <a href='/stats.php'>Stats</a>
+	- <a href='/latestposts.php'>Latest Posts</a>
+	- <a href='/hex.php' title='Color Chart' class='popout' target='_blank'>Color Chart</a>
+	- <a href='/smilies.php' title='Smilies' class='popout' target='_blank'>Smilies</a>
+	";
+
+
+	$ipbanned	= $torbanned = 0;
+
+	$checkips = "INSTR('$userip',ip)=1";
+	if ($forwardedip !== "XXXXXXXXXXXXXXXXX")
+		$checkips .= " OR INSTR('$forwardedip',ip)=1";
+	if ($clientip !== "XXXXXXXXXXXXXXXXX")
+		$checkips .= " OR INSTR('$clientip',ip)=1";
+
+	if($sql->resultq("SELECT count(*) FROM ipbans WHERE $checkips")) $ipbanned=1;
+	if($sql->resultq("SELECT count(*) FROM `tor` WHERE `ip` = '". $_SERVER['REMOTE_ADDR'] ."' AND `allowed` = '0'")) $torbanned=1;
+
+	if ($ipbanned || $torbanned)
+		$windowtitle = $boardname;
+
+	if($ipbanned) {
+		$url .=' (IP banned)';
+	}
+
+	if ($torbanned) {
+		$url .=' (Tor proxy)';
+		$sql->query("UPDATE `tor` SET `hits` = `hits` + 1 WHERE `ip` = '". $_SERVER['REMOTE_ADDR'] ."'");
+	}
+
+	$views=$sql->resultq('SELECT views FROM misc')+1;
+	
+	if (!$ipbanned && !$torbanned && !IS_AJAX_REQUEST) {
+		// Don't increment the view counter for bots
+		$sql->query("UPDATE misc SET views=$views");
+		
+		if($views%1000000>999000 or $views%1000000<1000) {
+			$u=($loguserid?$loguserid:0);
+			$sql->query("INSERT INTO hits VALUES ($views,$u,'$userip',".ctime().')');
+		}
+		
+		if ($views%1000000>999994 || ($views % 1000000 >= 991000 && $views % 1000 == 0) || ($views % 1000000 >= 999900 && $views % 10 == 0) || $views % 1000000 < 5) {
+			xk_ircsend("0|View ". xk(11) . str_pad(number_format($views), 10, " ", STR_PAD_LEFT) . xk() ." by ". ($loguser['id'] ? xk(11) . str_pad($loguser['name'], 25, " ") : xk(12) . str_pad($_SERVER['REMOTE_ADDR'], 25, " ")) . xk() . ($views % 1000000 > 500000 ? " (". xk(12) . str_pad(number_format(1000000 - ($views % 1000000)), 5, " ", STR_PAD_LEFT) . xk(2) ." to go" . xk() .")" : ""));
+
+		}
+
+		if ($views == 44444444 || $views == 55555555 || $views == 66666666 || $views == 67108864) {
+			xk_ircsend("0|View ". xk(11) . str_pad(number_format($views), 10, " ", STR_PAD_LEFT) . xk() ." by ". ($loguser['id'] ? xk(11) . str_pad($loguser['name'], 25, " ") : xk(12) . str_pad($_SERVER['REMOTE_ADDR'], 25, " ")) . xk());
+
+		}
+	}
+
+	// Dailystats update in one query
+	$sql->query("INSERT INTO dailystats (date, users, threads, posts, views) " .
+	             "VALUES ('".date('m-d-y',ctime())."', (SELECT COUNT( * ) FROM users), (SELECT COUNT(*) FROM threads), (SELECT COUNT(*) FROM posts), $views) ".
+	             "ON DUPLICATE KEY UPDATE users=VALUES(users), threads=VALUES(threads), posts=VALUES(posts), views=$views");
+
+//	$sql->query("INSERT INTO dailystats (date) VALUES ('".date('m-d-y',ctime())."')");
+//	$sql->query("UPDATE dailystats SET users=$count[u],threads=$count[t],posts=$count[p],views=$views WHERE date='".date('m-d-y',ctime())."'");
+
+	//No gunbound rankset here (yet), stop futily trying to update it
+	//updategb();
+
+	$new='&nbsp;';
+
+  // Note that we ignore this in private.php (obviously) and the index page (it handles PMs itself)
+  // This box only shows up when a new PM is found, so it's optimized for that
+	if ($log && strpos($PHP_SELF, "private.php") == false && strpos($PHP_SELF, "index.php") == 0) {
+    $newmsgquery = $sql->query("SELECT date,u.id uid,name,sex,powerlevel,aka FROM pmsgs p LEFT JOIN users u ON u.id=p.userfrom WHERE userto=$loguserid AND msgread=0 ORDER BY p.id DESC");
+		if ($pmsg = $sql->fetch($newmsgquery)) {
+			$namelink = getuserlink($pmsg, array('id'=>'uid'));
+			$lastmsg  = "Last unread message from $namelink on ".date($dateformat,$pmsg['date']+$tzoff);
+
+      $numnew = mysql_num_rows($newmsgquery);
+			if ($numnew > 1) $ssss = "s";
+
+			$privatebox = "<tr><td colspan=3 class='tbl tdbg2 center fonts'>$newpic <a href=private.php>You have $numnew new private message$ssss</a> -- $lastmsg</td></tr>";
+		}
+		else $privatebox = "";
+	}
+
+	$jscripts = '';
+	if (true) { // Ikachan! :D!
+		//$ikachan = 'images/ikachan/vikingikachan.png';
+		//$ikachan = 'images/sankachan.png';
+		$ikachan = 'images/ikamad.png';
+		//$ikachan = 'images/squid.png';
+
+		$ikaquote = 'Someone stole my hat!';
+		//$ikaquote = 'If you don\'t like Christmas music, well... it\'s time to break out the earplugs.';
+		//$ikaquote = 'This viking helmet is stuck on my head!';
+		//$ikaquote = 'Searching for hats to wear!  If you find any, please let me know...';
+		//$ikaquote = 'What idiot thought celebrating a holiday five months late was a good idea?';
+		//$ikaquote = 'Back to being a fixture now, please stop bitching.';
+		//$ikaquote = 'I just want to let you know that you are getting coal this year. You deserve it.';
+
+		$yyy = "<img id='f_ikachan' src='$ikachan' style=\"position: fixed; left: ". mt_rand(0,100) ."%; top: ". mt_rand(0,100) ."%;\" title=\"$ikaquote\">";
+	}
+
+	/*if ($_GET['w']) {
+		$yyy	= "<img src=images/wave/squid.png style=\"position: fixed; left: ". mt_rand(0,100) ."%; top: ". mt_rand(0,100) ."%;\" title=\"Ikachaaaan!\">";
+		$yyy	.= "<img src=images/wave/cheepcheep.png style=\"position: fixed; left: ". mt_rand(0,100) ."%; top: ". mt_rand(0,100) ."%;\" title=\"cheep tricks\">";
+		$yyy .= "<img src=images/wave/chest.png style=\"position: fixed; right: 20px; bottom: 0px;\" title=\"1\">";
+
+		for ($xxx = rand(0,5); $xxx < 20; $xxx++) {
+			$yyy .= "<img src=images/wave/seaweed.png style=\"position: fixed; left: ". mt_rand(0,100) ."%; bottom: -". mt_rand(24,72) ."px;\" title=\"weed\">";
+		}
+	}*/
+	
+	$dispviews = $views;
+//	if (($views % 1000000 >= 999000) && ($views % 1000000 < 999990))
+//		$dispviews = substr((string)$views, 0, -3) . "???";
+
+	// :shepicide:
+	$body="<body>";
+
+  $metatag = '';
+
+	if ($meta['noindex'])
+		$metatag .= "<meta name=\"robots\" content=\"noindex,follow\" />";
+
+	if ($meta['description'])
+		$metatag .= "<meta name=\"description\" content=\"{$meta[description]}\" />";
+
+	if ($x_hacks['smallbrowse'] == 1 and false) {
+		$css = "";
+		$css = "<link rel='stylesheet' href='/mobile.css'>";
+	}
+
+	$header1="<html><head><title>$windowtitle</title>
+	$metatag
+	<link rel=\"shortcut icon\" href=\"/favicon". (!$x_hacks['host'] ? rand(1,8) ."" : "" ) .".ico\" type=\"image/x-icon\">
+	$css
+	<link rel=\"stylesheet\" href=\"http://xkeeper.net/img/layouts/fonts/stylesheet.css\" type=\"text/css\">
+	</head>
+	$body
+	$yyy
+	<center>
+	 $tblstart
+	  <form action='login.php' method='post' name='logout'><input type='hidden' name='action' value='logout'></form>
+	  <td class='tbl tdbg1 center' colspan=3>$boardtitle";
+  $header2="
+	  ". (!$x_hacks['smallbrowse'] ? "
+	  </td><tr>
+		  <td width='120px' class='tbl tdbg2 center fonts'><nobr>Views: $dispviews<br><img src=images/_.gif width=120 height=1></td>
+		  <td width='100%' class='tbl tdbg2 center fonts'>$headlinks2</td>
+		  <td width='120px' class='tbl tdbg2 center fonts'><nobr>".  date($dateformat,ctime()+$tzoff) ."<br><img src=images/_.gif width=120 height=1><tr>" 
+		: "<br>$dispviews views, ". date($dateformat,ctime()+$tzoff) ."
+		  </td><tr>
+			<td width=100% class='tbl tdbg2 center fonts' colspan=3>$headlinks2</td><tr>") ."
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	  $privatebox
+	 $tblend
+	</center>";
+
+	$headlinks = "$smallfont<br>$headlinks";
+
+	function makeheader($header1,$headlinks,$header2) {
+		global $loguser, $PHP_SELF;
+		$header	= $header1.$headlinks.$header2;
+		if (!$loguser['id'] && strpos($PHP_SELF, "index.php") === false) {
+			$header .= adbox() ."<br>";
+		}
+		return $header;
+	}
+
+	$ref=$HTTP_REFERER;
+	$url=getenv('SCRIPT_URL');
+	
+	if(!$url) $url=str_replace('/etc/board','',getenv('SCRIPT_NAME'));
+	$q=getenv('QUERY_STRING');
+	
+	if($q) $url.="?$q";
+	
+	if($ref && substr($ref,7,7)!="jul.rus") $sql->query("INSERT INTO referer (time,url,ref,ip) VALUES (". ctime() .", '".addslashes($url)."', '".addslashes($ref)."', '". $_SERVER['REMOTE_ADDR'] ."')");
+
+	$sql->query("DELETE FROM guests WHERE ip='$userip' OR date<".(ctime()-300));
+	
+	if($log) {
+		/*
+			$ulastip=mysql_result(mysql_query("SELECT lastip FROM users WHERE id=$loguserid"),0,0);
+			$aol1=(substr($userip,0,7)=='152.163' or substr($userip,0,7)=='205.188' or substr($userip,0,6)=='64.12.' or substr($userip,0,6)=='195.93' or substr($userip,0,6)=='198.81');
+			$aol2=(substr($ulastip,0,7)=='152.163' or substr($ulastip,0,7)=='205.188' or substr($ulastip,0,6)=='64.12.' or substr($ulastip,0,6)=='195.93' or substr($ulastip,0,6)=='198.81');
+			if($userip!=$ulastip && !($aol1 && $aol2)){
+			$fpnt=fopen('ipchanges.log', 'a');
+			$r=fputs($fpnt, "User $loguserid IP changed from $ulastip to $userip, on ".date($dateformat,ctime())."
+		");
+			$r=fclose($fpnt);
+			}
+		*/
+		//if ($loguserid != 3 && $loguserid != 2)
+		if (($loguser['powerlevel'] <= 5) and (!IS_AJAX_REQUEST)) {
+			$influencelv=calclvl(calcexp($loguser[posts],(ctime()-$loguser[regdate])/86400));
+
+      // Alart #defcon?
+			if ($loguser['lastip'] != $_SERVER['REMOTE_ADDR']) {
+				$ip1 = explode(".", $loguser['lastip']);
+				$ip2 = explode(".", $_SERVER['REMOTE_ADDR']);
+				for ($diff = 0; $diff < 3; ++$diff)
+					if ($ip1[$diff] != $ip2[$diff]) break;
+				if ($diff == 0) $color = xk(4);
+				else            $color = xk(8);
+				$diff = "/".($diff+1)*8;
+
+				xk_ircsend("102|". xk(7) ."User $loguser[name] (id $loguserid) changed from IP ". xk(8) . $loguser['lastip'] . xk(7) ." to ". xk(8) . $_SERVER['REMOTE_ADDR'] .xk(7). " ({$color}{$diff}" .xk(7). ")");
+			}
+
+			$sql->query("UPDATE users SET lastactivity=".ctime().",lastip='$userip',lasturl='".addslashes($url)."',lastforum=0,`influence`='$influencelv' WHERE id=$loguserid");
+		}
+
+	} else {
+		$sql->query("INSERT INTO guests (ip,date,useragent,lasturl) VALUES ('$userip',".ctime().",'".addslashes($_SERVER['HTTP_USER_AGENT']) ."','". addslashes($url) ."')");
+	}
+	
+	$honeypot	= array(
+		"<a href=\"http://xkeeper.rustedlogic.net/sweetandsour.php\"><!-- bargaining-tycoon --></a>",
+		"<a href=\"http://xkeeper.rustedlogic.net/sweetandsour.php\"><img src=\"bargaining-tycoon.gif\" height=\"1\" width=\"1\" border=\"0\"></a>",
+		"<a href=\"http://xkeeper.rustedlogic.net/sweetandsour.php\" style=\"display: none;\">bargaining-tycoon</a>",
+		"<div style=\"display: none;\"><a href=\"http://xkeeper.rustedlogic.net/sweetandsour.php\">bargaining-tycoon</a></div>",
+		"<a href=\"http://xkeeper.rustedlogic.net/sweetandsour.php\"></a>",
+		"<!-- <a href=\"http://xkeeper.rustedlogic.net/sweetandsour.php\">bargaining-tycoon</a> -->",
+		"<div style=\"position: absolute; top: -250px; left: -250px;\"><a href=\"http://xkeeper.rustedlogic.net/sweetandsour.php\">bargaining-tycoon</a></div>",
+		"<a href=\"http://xkeeper.rustedlogic.net/sweetandsour.php\"><span style=\"display: none;\">bargaining-tycoon</span></a>",
+		"<a href=\"http://xkeeper.rustedlogic.net/sweetandsour.php\"><div style=\"height: 0px; width: 0px;\"></div></a>",
+		);
+
+	$honeypot2	= array(
+		"<a href=\"http://jul.rustedlogic.net/accounting.php\"><!-- fortyfive-antelope --></a>",
+		"<a href=\"http://jul.rustedlogic.net/accounting.php\"><img src=\"images/_.gif\" height=\"1\" width=\"1\" border=\"0\" style='display: none;'></a>",
+		"<a href=\"http://jul.rustedlogic.net/accounting.php\" style=\"display: none;\">fortyfive-antelope</a>",
+		"<div style=\"display: none;\"><a href=\"http://jul.rustedlogic.net/accounting.php\">fortyfive-antelope</a></div>",
+		"<a href=\"http://jul.rustedlogic.net/accounting.php\"></a>",
+		"<!-- <a href=\"http://jul.rustedlogic.net/accounting.php\">fortyfive-antelope</a> -->",
+		"<div style=\"position: absolute; top: -250px; left: -250px;\"><a href=\"http://jul.rustedlogic.net/accounting.php\">fortyfive-antelope</a></div>",
+		"<a href=\"http://jul.rustedlogic.net/accounting.php\"><span style=\"display: none;\">fortyfive-antelope</span></a>",
+		"<a href=\"http://jul.rustedlogic.net/accounting.php\"><div style=\"height: 0px; width: 0px;\"></div></a>",
+		);
+	$honeypotl	= pick_any($honeypot);
+	$honeypotl2	= pick_any($honeypot2);
+
+	$header2	.= $honeypotl2;
+
+
+	$header=makeheader($header1,$headlinks,$header2);
+
+	$footer="	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+<br>". 	($loguser['id'] && strpos($PHP_SELF, "index.php") === false ? adbox() ."<br>" : "") ."
+<center>
+
+<img src='adnonsense.php?m=d' title='generous donations to the first national bank of bad jokes and other dumb crap people post' style='margin-left: 44px;'><br>
+<img src='adnonsense.php' title='hotpod fund' style='margin: 0 22px;'><br>
+<img src='adnonsense.php?m=v' title='VPS slushie fund' style='margin-right: 44px;'>
+"
+.
+/* "
+<br><img src='http://valkyrie.rustedlogic.net/h/' style='padding: 8px;' alt='' title='YOU ARE NOW HALF-ASSEDLY TESTING OUR NEW SERVER.'>
+"
+. */
+/* "<script type=\"text/javascript\">
+var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");
+document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));
+</script>
+<script type=\"text/javascript\">
+try {
+var pageTracker = _gat._getTracker(\"UA-9215725-1\");
+pageTracker._trackPageview();
+} catch(err) {}</script>"
+. */
+"
+<br>
+	$smallfont
+	<br><br><a href=$siteurl>$sitename</a>
+	<br>$affiliatelinks	
+	<br>
+	<table cellpadding=0 border=0 cellspacing=2><tr>
+		<td>
+			<img src=images/poweredbyacmlm.gif>
+		</td>
+		<td>
+			{$smallfont}
+			Acmlmboard -  $verupdated b". str_pad($vernumber, 3, "0", STR_PAD_LEFT) ."
+			<br>&copy;2000-2013 Acmlm, Xkeeper, Inuyasha, et al. <!-- Acmlm, Emuz, Blades, Xkeeper
+			<br><img src=\"images/4funin1.png\" title=\"totally!\" width=448 height=48> -->
+			</font>
+		</td>
+	</tr></table>
+	$honeypotl
+	". ($x_hacks['mmdeath'] >= 0 ? "<div style='position: absolute; top: -100px; left: -100px;'>Hidden preloader for doom numbers:
+		<img src='numgfx/death/0.png'> <img src='numgfx/death/1.png'> <img src='numgfx/death/2.png'> <img src='numgfx/death/3.png'> <img src='numgfx/death/4.png'> <img src='numgfx/death/5.png'> <img src='numgfx/death/6.png'> <img src='numgfx/death/7.png'> <img src='numgfx/death/8.png'> <img src='numgfx/death/9.png'>" : "") ."
+<!-- Piwik -->
+<script type=\"text/javascript\">
+var pkBaseURL = ((\"https:\" == document.location.protocol) ? \"https://stats.tcrf.net/\" : \"http://stats.tcrf.net/\");
+document.write(unescape(\"%3Cscript src='\" + pkBaseURL + \"piwik.js' type='text/javascript'%3E%3C/script%3E\"));
+</script><script type=\"text/javascript\">
+try {
+var piwikTracker = Piwik.getTracker(pkBaseURL + \"piwik.php\", 4);
+piwikTracker.trackPageView();
+piwikTracker.enableLinkTracking();
+} catch( err ) {}
+</script><noscript><p><img src=\"http://stats.tcrf.net/piwik.php?idsite=4\" style=\"border:0\" alt=\"\" /></p></noscript>
+<!-- End Piwik Tag -->
+<!--<script type=\"text/javascript\" src=\"http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.min.js\"></script>
+<script type=\"text/javascript\" src=\"js/useful.js\"></script> -->
+
+</body></html>
+  ";
+	if($ipbanned) {
+		if ($loguser['title'] == "Banned; account hijacked. Contact admin via PM to change it.") {
+			$reason	= "Your account was hijacked; please contact Xkeeper to reset your password and unban your account.";
+		} elseif ($loguser['title']) {
+			$reason	= "Ban reason: ". $loguser['title'] ."<br>If you think have been banned in error, please contact Xkeeper.";
+		} else {
+			$reason	= $sql->resultq("SELECT `reason` FROM ipbans WHERE $checkips",0,0);
+			$reason	= ($reason ? "Reason: $reason" : "<i>(No reason given)</i>");
+		}
+		die("$header<br>$tblstart$tccell1>
+		You are banned from this board.
+		<br>". $reason ."
+		<br>
+		<br>Contact info:
+		<br>AIM: XkeeperNaN
+		<br>E-mail: xkeeper@gmail.com
+		<br>MSN: xkeeper6@yahoo.com
+		$tblend$footer");
+	}
+	if($torbanned) die("$header<br>$tblstart$tccell1>
+	You appear to be using a Tor proxy. For added security, Tor is banned from this board.
+	<br>If you have been banned in error, please contact Xkeeper.
+	<br>
+	<br>Contact info: 
+	<br>AIM: XkeeperNaN
+	<br>E-mail: xkeeper@gmail.com
+	<br>MSN: xkeeper6@yahoo.com
+	$tblend$footer");
+
+
+
diff --git a/lib/layout_mobile.php b/lib/layout_mobile.php
new file mode 100644
index 0000000..cc9a8ef
--- /dev/null
+++ b/lib/layout_mobile.php
@@ -0,0 +1,5 @@
+<?php
+	// mobile layout stuff
+
+	print $body;
+?>
diff --git a/lib/mysql.php b/lib/mysql.php
new file mode 100644
index 0000000..8b8f365
--- /dev/null
+++ b/lib/mysql.php
@@ -0,0 +1,206 @@
+<?php
+	class mysql {
+		// a 'backport' of my 'static' class in not-as-static form
+		// the statistics remain static so they're global just in case this gets used for >1 connection
+		static $queries   = 0;
+		static $cachehits = 0;
+		static $rowsf     = 0;
+		static $rowst     = 0;
+		static $time      = 0;
+
+		// Query debugging functions for admins
+		static $connection_count = 0;
+		static $debug_on   = false;
+		static $debug_list = array();
+
+		var $cache = array();
+		var $connection = NULL;
+		var $id = 0;
+
+		public function connect($host,$user,$pass,$persist=false) {
+			$start=microtime(true);
+			$this->connection = (($persist) ? mysql_pconnect($host,$user,$pass) : mysql_connect($host,$user,$pass));
+			$t = microtime(true)-$start;
+			$this->id = ++self::$connection_count;
+
+			if (self::$debug_on) {
+				$b = self::getbacktrace();
+				self::$debug_list[] = array($this->id, $b['pfunc'], "$b[file]:$b[line]", "<i>".(($persist)?"Persistent c":"C")."onnection established to mySQL server ($host, $user, using password: ".(($pass!=="") ? "YES" : "NO").")</i>", sprintf("%01.6fs",$t));
+			}
+
+			self::$time += $t;
+			return $this->connection;
+		}
+
+		public function selectdb($dbname)	{
+			$start=microtime(true);
+			$r = mysql_select_db($dbname, $this->connection);
+			self::$time += microtime(true)-$start;
+			return $r;
+		}
+
+		public function query($query, $usecache = false) {
+			if ($usecache && array_key_exists($hash = md5($query), $this->cache)) {
+				$start=microtime(true);
+				++self::$cachehits;
+				@mysql_data_seek($this->cache[$hash], 0);
+				$t = microtime(true)-$start;
+				if (self::$debug_on) {
+					$b = self::getbacktrace();
+					self::$debug_list[] = array($this->id, $b['pfunc'], "$b[file]:$b[line]", "<font color=#00dd00>$query</font>", "<font color=#00dd00>".sprintf("%01.6fs",$t)."</font>");
+				}
+				return $this->cache[$hash];
+			}
+
+			$start=microtime(true);
+			if($res = mysql_query($query, $this->connection)) {
+				++self::$queries;
+				if (!is_bool($res))
+					self::$rowst += @mysql_num_rows($res);
+
+				if ($usecache) {
+					$this->cache[md5($query)] = &$res;
+				}
+			}
+			else {
+				// the huge SQL warning text sucks
+				$err = str_replace("You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use", "SQL syntax error", mysql_error());
+				trigger_error("MySQL error: $err", E_USER_ERROR);
+			}
+
+			$t = microtime(true)-$start;
+			self::$time += $t;
+
+			if (self::$debug_on) {
+				$b = self::getbacktrace();
+				$tx = ((!$err) ? $query : "<span style=\"color:#FF0000;border-bottom:1px dotted red;\" title=\"$err\">$query</span>");
+				self::$debug_list[] = array($this->id, $b['pfunc'], "$b[file]:$b[line]", $tx, sprintf("%01.6fs",$t));
+			}
+
+			return $res;
+		}
+
+		public function fetch($result, $flag = MYSQL_BOTH){
+			$start=microtime(true);
+
+			if($result && $res=mysql_fetch_array($result, $flag))
+					++self::$rowsf;
+
+			self::$time += microtime(true)-$start;
+			return $res;
+		}
+
+		public function result($result,$row=0,$col=0){
+			$start=microtime(true);
+
+			if($result) {
+				if (mysql_num_rows($result) < $row+1)
+					$res = NULL;
+				elseif ($res=@mysql_result($result,$row,$col))
+					++self::$rowsf;
+			}
+
+			self::$time += microtime(true)-$start;
+			return $res;
+		}
+
+		public function fetchq($query, $flag = MYSQL_BOTH, $cache = false){
+			$res = $this->query($query, $cache);
+			$res = $this->fetch($res, $flag);
+			return $res;
+		}
+
+		public function resultq($query,$row=0,$col=0, $cache = false){
+			$res = $this->query($query, $cache);
+			$res = $this->result($res,$row,$col);
+			return $res;
+		}
+
+		public function getmultiresults($query, $key, $wanted, $cache = false) {
+			$q = $this->query($query, $cache);
+			$ret = array();
+			$tmp = array();
+
+			while ($res = @$this->fetch($q, MYSQL_ASSOC))
+				$tmp[$res[$key]][] = $res[$wanted];
+			foreach ($tmp as $keys => $values)
+				$ret[$keys] = implode(",", $values);
+			return $ret;
+		}
+
+		public function getresultsbykey($query, $key, $wanted, $cache = false) {
+			$q = $this->query($query, $cache);
+			$ret = array();
+			while ($res = @$this->fetch($q, MYSQL_ASSOC))
+				$ret[$res[$key]] = $res[$wanted];
+			return $ret;
+		}
+
+		public function getresults($query, $wanted, $cache = false) {
+			$q = $this->query($query, $cache);
+			$ret = array();
+			while ($res = @$this->fetch($q, MYSQL_ASSOC))
+				$ret[] = $res[$wanted];
+			return $ret;
+		}
+
+		public function getarraybykey($query, $key, $cache = false) {
+			$q = $this->query($query, $cache);
+			$ret = array();
+			while ($res = @$this->fetch($q, MYSQL_ASSOC))
+				$ret[$res[$key]] = $res;
+			return $ret;
+		}
+
+		public function getarray($query, $cache = false) {
+			$q = $this->query($query, $cache);
+			$ret = array();
+			while ($res = @$this->fetch($q, MYSQL_ASSOC))
+				$ret[] = $res;
+			return $ret;
+		}
+
+		//private function __construct() {}
+
+		// Debugging shit for admins
+		public static function debugprinter() {
+			global $tccellh, $tccellc, $tccell1, $tccell2, $tblstart, $smallfont, $tblend;
+			if (!self::$debug_on) return "";
+			$out  = "";
+			$out .= "<br>$tblstart<tr>$tccellh colspan=5><b>SQL Debug</b></td><tr>
+				$tccellh width=20>&nbsp</td>
+				$tccellh width=20>ID</td>
+				$tccellh width=300>Function</td>
+				$tccellh width=*>Query</td>
+				$tccellh width=90>Time</td></tr>";
+			foreach(self::$debug_list as $i => $d) {
+				$altcell = "tccell" . (($i & 1)+1);
+				$cell = $$altcell;
+				if ($oldid && $oldid != $d[0])
+					$out .= "<tr>$tccellc colspan=5><img src='images/_.gif' height='4' width='1'></td></tr>";
+				$oldid = $d[0];
+				$out .= "<tr>
+					$cell>$i</td>
+					$cell>$d[0]</td>
+					$cell>$d[1]$smallfont<br>$d[2]</font></td>
+					$cell style='white-space: pre-wrap; text-align: left'>$d[3]</td>
+					$cell>$d[4]</td></tr>";
+			}
+			$out .= "$tblend";
+			return $out;
+		}
+
+		private static function getbacktrace() {
+			$backtrace = debug_backtrace();
+			for ($i = 1; isset($backtrace[$i]); ++$i) {
+				if (substr($backtrace[$i]['file'], -9) !== "mysql.php") {
+					if (!($backtrace[$i]['pfunc'] = $backtrace[$i+1]['function']))
+						$backtrace[$i]['pfunc'] = "<i>(main)</i>";
+					$backtrace[$i]['file'] = str_replace($_SERVER['DOCUMENT_ROOT'], "", $backtrace[$i]['file']);
+					return $backtrace[$i];
+				}
+			}
+			return $backtrace[$i-1];
+		}
+	}
+?>
diff --git a/lib/rpg.php b/lib/rpg.php
new file mode 100644
index 0000000..d3ab067
--- /dev/null
+++ b/lib/rpg.php
@@ -0,0 +1,69 @@
+<?php
+	$stat=array('HP','MP','Atk','Def','Int','MDf','Dex','Lck','Spd');
+	function basestat($p,$d,$stat){
+		$p+=0;
+		$e=calcexp($p,$d);
+		$l=calclvl($e);
+		if($l=='NAN') return 1;
+		switch($stat){
+			case 0: return (pow($p,0.26) * pow($d,0.08) * pow($l,1.41) * 0.95) + 20; //HP
+			case 1: return (pow($p,0.22) * pow($d,0.12) * pow($l,1.41) * 0.32) + 10; //MP
+			case 2: return (pow($p,0.18) * pow($d,0.04) * pow($l,1.37) * 0.29) +  2; //Str
+			case 3: return (pow($p,0.16) * pow($d,0.07) * pow($l,1.37) * 0.28) +  2; //Atk
+			case 4: return (pow($p,0.15) * pow($d,0.09) * pow($l,1.37) * 0.29) +  2; //Def
+			case 5: return (pow($p,0.14) * pow($d,0.10) * pow($l,1.37) * 0.29) +  1; //Shl
+			case 6: return (pow($p,0.17) * pow($d,0.05) * pow($l,1.37) * 0.29) +  2; //Lck
+			case 7: return (pow($p,0.19) * pow($d,0.03) * pow($l,1.37) * 0.29) +  1; //Int
+			case 8: return (pow($p,0.21) * pow($d,0.02) * pow($l,1.37) * 0.25) +  1; //Spd
+		}
+	}
+	function getstats($u, $items=0, $class = 0){
+
+		$stat=array('HP','MP','Atk','Def','Int','MDf','Dex','Lck','Spd');
+		$p=$u[posts];
+		$d=(ctime()-$u[regdate])/86400;
+		for($i=0;$i<9;$i++) {
+		$m[$i]=1;
+		}
+		for($i=1;$i<7;$i++){
+			$item=$items[$u['eq'.$i]];
+			for($k=0;$k<9;$k++){
+				$is=$item['s'.$stat[$k]];
+				if(substr($item[stype],$k,1)=='m') $m[$k]*=$is/100;
+				else $a[$k]+=$is;
+			}
+		}
+		for($i=0;$i<9;$i++){
+			$stats[$stat[$i]]=max(1,floor(basestat($p,$d,$i)*$m[$i])+$a[$i]);
+		}
+		// after calculating stats with items
+		for($k=0;$k<9;$k++){
+			if (isset($class[$stat[$k]])) {
+				//$stats[$stat[$k]]	= ceil($stats[$stat[$k]] * ($class[$stat[$k]] != 0 ? $class[$stat[$k]] : -1));		// 0 can be 0, anything else will result in 1 because of max(1)
+				$stats[$stat[$k]] = ceil($stats[$stat[$k]] * $class[$stat[$k]]);
+			}
+		}
+
+		$stats[GP]=coins($p,$d)-$u[spent];
+		$stats[exp]=calcexp($p,$d);
+		$stats[lvl]=calclvl($stats[exp]);
+		return $stats;
+	}
+	function coins($p,$d){
+		$p+=0;
+		if($p<0 or $d<0) return 0;
+		return floor(pow($p,1.3) * pow($d,0.4) + $p*10);
+	}
+
+/*
+	case 0: return (pow($p,0.21) * pow($d,0.15) * pow($l,1.11) * 1.00) + 20; //HP
+	case 1: return (pow($p,0.10) * pow($d,0.26) * pow($l,1.11) * 0.32) + 10; //MP
+	case 2: return (pow($p,0.16) * pow($d,0.09) * pow($l,1.09) * 0.29) +  2; //Str
+	case 3: return (pow($p,0.15) * pow($d,0.11) * pow($l,1.09) * 0.28) +  2; //Atk
+	case 4: return (pow($p,0.10) * pow($d,0.17) * pow($l,1.09) * 0.29) +  2; //Def
+	case 5: return (pow($p,0.09) * pow($d,0.18) * pow($l,1.09) * 0.29) +  1; //Shl
+	case 6: return (pow($p,0.13) * pow($d,0.13) * pow($l,1.09) * 0.29) +  2; //Lck
+	case 7: return (pow($p,0.07) * pow($d,0.20) * pow($l,1.09) * 0.29) +  1; //Int
+	case 8: return (pow($p,0.19) * pow($d,0.07) * pow($l,1.09) * 0.25) +  1; //Spd
+*/
+
diff --git a/lib/threadpost.php b/lib/threadpost.php
new file mode 100644
index 0000000..6b4f8ae
--- /dev/null
+++ b/lib/threadpost.php
@@ -0,0 +1,148 @@
+<?php
+	function threadpost($post,$bg,$pthread='') {
+		global $loguser,$quote,$edit,$ip,$smallfont,$tzoff,$sep,$dateformat,$dateshort,$tlayout,${"tablebg$bg"};
+		$post = setlayout($post);
+		$p = $post['id'];
+		$u = $post['uid'];
+		$set['bg']    = ${"tablebg$bg"};
+		$set['tdbg']  = "<td class='tbl font tdbg$bg' valign=top";
+
+    $linkclass = "url".$post['uid'];
+    $userlink = getuserlink($post, array('id'=>'uid'), $linkclass);
+    unset($postuser);
+
+		$set['userrank'] = getrank($post['useranks'],str_replace("<div", "<<z>idiot", $post[title]),$post[posts],$post[powerlevel]);
+		$set['userlink'] = "<a name={$p}></a>{$userlink}";
+		$set['date']  = date($dateformat,$post[date]+$tzoff);
+
+		if($post['location']) { $set[location]="<br>From: $post[location]"; }
+
+		if($post['picture'] || ($post['moodid'] && $post['moodurl'])){
+			$post['picture']  = str_replace('>','%3E',$post[picture]);
+			$set['userpic']   = "<img src=\"$post[picture]\">";
+			$set['picture']   = $post['picture'];
+
+			if ($post['moodid'] && $post['moodurl']) {
+				$set['userpic'] = "<img src=\"". str_replace(array('$', '>'), array($post['moodid'], '%3E'), $post['moodurl']) ."\">";
+				$set['picture'] = str_replace(array('$', '>'), array($post['moodid'], '%3E'), $post['moodurl']);
+			}
+			//   $userpicture="<img src=\"$user[picture]\" name=pic$p onload=sizelimit(pic$p,60,100)>";
+		}
+
+		if($post['signtext']) {
+			$post[signtext]=$sep[$loguser[signsep]].$post[signtext];
+		}
+
+		if($pthread) { 
+			$set['threadlink'] = "<a href=thread.php?id=$pthread[id]>$pthread[title]</a>";
+		}
+
+		$post[text]=doreplace2($post[text], $post[options]);
+	//  if (strpos($post['text'], "http://hyperhacker.no-ip.org/b/smilies/lolface.png") || strpos($post['text'], "images/smilies/roflx.gif")) $post['text'] = "<img src=images/smilies/roflx.gif><br><br><small>(Excessive post content hidden)</small>";
+
+		if ($post['editdate']) {
+			$post['edited'] = " (last edited by $post[edited] at ".date($dateformat,$post['editdate']+$tzoff).")";
+		}
+
+		$return=dofilters(postcode($post,$set));
+		return $return;
+	}
+
+	function preplayouts($posts) {
+		global $sql, $postl;
+
+		$ids = array();
+
+		// PHP pre-buffers all queries' results by default
+		// Just fetch everything now, seek back to beginning for the original function,
+		// and fire off one query to get all post layout data in one query
+		// instead of hitting the DB for each new header/signature encountered
+		while ($ps = $sql->fetch($posts)) {
+			if ($ps['headid']) $ids[] = $ps['headid'];
+			if ($ps['signid']) $ids[] = $ps['signid'];
+		}
+		@mysql_data_seek($posts, 0);
+
+    if (!count($ids)) return;
+		$postl = $sql->getresultsbykey("SELECT id, text FROM postlayouts WHERE id IN (".implode(",", array_unique($ids, SORT_NUMERIC)).")", 'id', 'text');
+	}
+
+	function setlayout($post) {
+		global $sql,$loguser,$postl;
+
+		if($loguser['viewsig']!=1) { 
+			$post['headid']=$post['signid']=0;
+		}
+
+		if(!$loguser['viewsig']){
+			$post['headtext']=$post['signtext']='';
+			return $post;
+		}
+
+		$post['tagval'].="\xB0\xBB";
+
+		if($loguser['viewsig']!=2){
+			if($headid=$post['headid']) {
+				// just in case
+				if($postl[$headid] === NULL) $postl[$headid]=$sql->resultq("SELECT text FROM postlayouts WHERE id=$headid");
+				$post['headtext']=$postl[$headid];
+			}
+			if($signid=$post['signid']) {
+				// just in case
+				if($postl[$signid] === NULL) $postl[$signid]=$sql->resultq("SELECT text FROM postlayouts WHERE id=$signid");
+				$post['signtext']=$postl[$signid];
+			}
+		}
+
+		$post['headtext']=settags($post['headtext'],$post['tagval']);
+		$post['signtext']=settags($post['signtext'],$post['tagval']);
+
+		if($loguser['viewsig']==2){
+			$post['headtext']=doreplace($post['headtext'],$post['num'],($post['date']-$post['regdate'])/86400,$post['name'],1);
+			$post['signtext']=doreplace($post['signtext'],$post['num'],($post['date']-$post['regdate'])/86400,$post['name'],1);
+		}
+		$post['headtext']=doreplace2($post['headtext']);
+		$post['signtext']=doreplace2($post['signtext']);
+		//	$post[text]=doreplace2($post[text], $post[options]);
+		return $post;
+	}
+
+function syndrome($num, $double=false, $bar=true){
+	$bar	= false;
+	$a='>Affected by';
+	if($num>=75)  {  $syn="83F3A3$a 'Reinfors Syndrome'";			$last=  75; $next=  25;	}
+	if($num>=100) {  $syn="FFE323$a 'Reinfors Syndrome' +";		$last= 100; $next=  50;	}
+	if($num>=150) {  $syn="FF5353$a 'Reinfors Syndrome' ++";		$last= 150; $next=  50;	}
+	if($num>=200) {  $syn="CE53CE$a 'Reinfors Syndrome' +++";		$last= 200; $next=  50;	}
+	if($num>=250) {  $syn="8E83EE$a 'Reinfors Syndrome' ++++";	$last= 250; $next=  50;	}
+	if($num>=300) {  $syn="BBAAFF$a 'Wooster Syndrome'!!";		$last= 300; $next=  50;	}
+	if($num>=350) {  $syn="FFB0FF$a 'Wooster Syndrome' +!!";		$last= 350; $next=  50;	}
+	if($num>=400) {  $syn="FFB070$a 'Wooster Syndrome' ++!!";		$last= 400; $next=  50;	}
+	if($num>=450) {  $syn="C8C0B8$a 'Wooster Syndrome' +++!!";	$last= 450; $next=  50;	}
+	if($num>=500) {  $syn="A0A0A0$a 'Wooster Syndrome' ++++!!";	$last= 500; $next= 100;	}
+	if($num>=600) {  $syn="C762F2$a 'Anya Syndrome' +++++!!!";	$last= 600; $next= 200;	}
+	if($num>=800) {  $syn="62C7F2$a 'Xkeeper Syndrome' +++++!!";/*	$last= 600; $next= 200;		}
+	if($num>=1000) {  $syn="FFFFFF$a 'Something higher than Xkeeper Syndrome' +++++!!";*/		}
+
+	if($syn) {
+		if ($next && $bar) {
+			$barw1	= min(round(($num - $last) / $next * 150), 150);
+			$barw2	= 150 - $barw1;
+			$barimg	= "red.png";
+
+			if ($double == true) {
+				$hi = 16;
+				$barw1 *= 2;
+				$barw2 *= 2;
+			} else {
+				$hi	= 8;
+			}
+
+			if ($next	>= 100) $barimg	= "special.gif";
+			$bar	= "<br><nobr>". generatenumbergfx($num, 3, $double) ."<img src=images/num1/barleft.png height=$hi><img src=images/num1/bar-on$barimg width=$barw1 height=$hi><img src=images/num1/bar-off.png width=$barw2 height=$hi><img src=images/num1/barright.png height=$hi>". generatenumbergfx($next - ($num - $last), 3, $double) ."</nobr>";
+		}
+		$syn="<br><i><font color=$syn</font></i>$bar<br>";
+	}
+
+	return $syn;
+}
diff --git a/login.php b/login.php
new file mode 100644
index 0000000..1471c8f
--- /dev/null
+++ b/login.php
@@ -0,0 +1,97 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/layout.php';
+
+	// Bots don't need to be on this page
+	$meta['noindex'] = true;
+
+	$username = $_POST['username'];
+	$password = $_POST['userpass'];
+	$verifyid = $_POST['verify'];
+
+	$txt="$header<br>$tblstart";
+
+	if($_POST['action']=='login') {
+		if (!$username)
+			$msg = "Couldn't login.  You didn't input a username.";
+		else {
+			$username = trim($username);
+			$userid = checkuser($username,$password);
+
+			if($userid!=-1) {
+				$pwhash = $sql->resultq("SELECT `password` FROM `users` WHERE `id` = '$userid'");
+				$verify = create_verification_hash($verifyid, $pwhash);
+
+				setcookie('loguserid',$userid,2147483647, "/", $_SERVER['SERVER_NAME'], false, true);
+				setcookie('logverify',$verify,2147483647, "/", $_SERVER['SERVER_NAME'], false, true);
+
+				$msg = "You are now logged in as $username.";
+			}
+			else if (/*$username == "Blaster" || */$username === "tictOrnaria") {
+				$sql->query("INSERT INTO `ipbans` SET `ip` = '". $_SERVER['REMOTE_ADDR'] ."', `date` = '". ctime() ."', `reason` = 'Abusive / malicious behavior'");
+				@xk_ircsend("1|". xk(7) ."Auto banned tictOrnaria (malicious bot) with IP ". xk(8) . $_SERVER['REMOTE_ADDR'] . xk(7) .".");
+			}
+			else {
+				$sql->query("INSERT INTO `failedlogins` SET `time` = '". ctime() ."', `username` = '". $username ."', `password` = '". $password ."', `ip` = '". $_SERVER['REMOTE_ADDR'] ."'");
+				$fails = $sql->resultq("SELECT COUNT(`id`) FROM `failedlogins` WHERE `ip` = '". $_SERVER['REMOTE_ADDR'] ."' AND `time` > '". (ctime() - 1800) ."'");
+
+				// Keep in mind, it's now not possible to trigger this if you're IP banned
+				// when you could previously, making extra checks to stop botspam not matter
+
+				//if ($fails > 1)
+				@xk_ircsend("102|". xk(14) ."Failed attempt". xk(8) ." #$fails ". xk(14) ."to log in as ". xk(8) . $username . xk(14) ." by IP ". xk(8) . $_SERVER['REMOTE_ADDR'] . xk(14) .".");
+
+				if ($fails >= 5) {
+					$sql->query("INSERT INTO `ipbans` SET `ip` = '". $_SERVER['REMOTE_ADDR'] ."', `date` = '". ctime() ."', `reason` = 'Send e-mail for password recovery'");
+					@xk_ircsend("102|". xk(7) ."Auto-IP banned ". xk(8) . $_SERVER['REMOTE_ADDR'] . xk(7) ." for this.");
+					@xk_ircsend("1|". xk(7) ."Auto-IP banned ". xk(8) . $_SERVER['REMOTE_ADDR'] . xk(7) ." for repeated failed logins.");
+				}
+
+				$msg = "Couldn't login.  Either you didn't enter an existing username, or you haven't entered the right password for the username.";
+			}
+		}
+		$txt.="$tccell1>$msg<br>".redirect('index.php','return to the board',0);
+	}
+	elseif ($_POST['action']=='logout') {
+		setcookie('loguserid','', time()-3600, "/", $_SERVER['SERVER_NAME'], false, true);
+		setcookie('logverify','', time()-3600, "/", $_SERVER['SERVER_NAME'], false, true);
+
+		// May as well unset this as well
+		setcookie('logpassword','', time()-3600, "/", $_SERVER['SERVER_NAME'], false, true);
+		$txt.="$tccell1> You are now logged out.<br>".redirect('index.php','return to the board',0);
+	}
+	elseif (!$_POST['action']) {
+		$ipaddr = explode('.', $_SERVER['REMOTE_ADDR']);
+		for ($i = 4; $i > 0; --$i) {
+			$verifyoptext[$i] = "(".implode('.', $ipaddr).")";
+			$ipaddr[$i-1]       = 'xxx';
+		}
+		$txt .= "<body onload=window.document.REPLIER.username.focus()>
+		<FORM ACTION=login.php NAME=REPLIER METHOD=POST><tr>
+		$tccellh width=150>&nbsp;</td>$tccellh width=40%>&nbsp</td>$tccellh width=150>&nbsp;</td>$tccellh width=40%>&nbsp;</td></tr><tr>
+		$tccell1><b>User name:</b></td>       $tccell2l>$inpt=username MAXLENGTH=25 style='width:280px;'></td>
+		$tccell1 rowspan=2><b>IP Verification:</b></td> $tccell2l rowspan=2>
+			<select name=verify>
+				<option selected value=0>Don't use</option>
+				<option value=1> /8 $verifyoptext[1]</option>
+				<option value=2>/16 $verifyoptext[2]</option>
+				<option value=3>/24 $verifyoptext[3]</option>
+				<option value=4>/32 $verifyoptext[4]</option>
+			</select><br><small>You can require your IP address to match your current IP, to an extent, to remain logged in.</small>
+		</tr><tr>
+		$tccell1><b>Password:</b></td>        $tccell2l>$inpp=userpass MAXLENGTH=64 style='width:180px;'></td>
+		</tr><tr>
+		$tccell1>&nbsp;</td>$tccell2l colspan=3>
+		$inph=action VALUE=login>
+		$inps=submit VALUE=Login></td></tr>
+		</FORM>";
+	}
+	else { // Just what do you think you're doing
+		$sql->query("INSERT INTO `ipbans` SET `ip` = '". $_SERVER['REMOTE_ADDR'] ."', `date` = '". ctime() ."', `reason` = 'Generic internet exploit searcher'");
+		if (!mysql_error())
+			xk_ircsend("1|". xk(7) ."Auto-banned asshole trying to be clever with the login form (action: ".xk(8).$_POST['action'].xk(7).") with IP ". xk(8) . $_SERVER['REMOTE_ADDR'] . xk(7) .".");
+	}	
+
+	print $txt.$tblend.$footer;
+	printtimedif($startingtime);
+?>
diff --git a/memberlist.php b/memberlist.php
new file mode 100644
index 0000000..2da5c97
--- /dev/null
+++ b/memberlist.php
@@ -0,0 +1,168 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/rpg.php';
+	require 'lib/layout.php';
+
+	function sortbyexp($a,$b) {
+		$cmpa = (($a['exp'] === 'NaN') ? -1 : intval($a['exp']));
+		$cmpb = (($b['exp'] === 'NaN') ? -1 : intval($b['exp']));
+		if ($cmpa==$cmpb) return $a['id']-$b['id'];
+		return $cmpb-$cmpa;
+	}
+
+	if($sex) $qsex="&sex=$sex";
+	if($pow) $qpow="&pow=$pow";
+	if($ppp) $qppp="&ppp=$ppp";
+	if($rpg) $qrpg="&rpg=1";
+	$q = $qppp.$qrpg;
+
+	if(!$ppp) $ppp=50;
+	if(!$page) $page=0;
+
+	$lnk='<a href=memberlist.php?sort';
+
+	$qwhere = array();
+	if($sex=='m') $qwhere[] = '(sex=0)';
+	if($sex=='f') $qwhere[] = '(sex=1)';
+	if($sex=='n') $qwhere[] = '(sex=2)';
+
+	if($pow!='') {
+		$pow = intval($pow);
+		if (($pow == 1 || $pow == 0) && $loguser['powerlevel'] < 3)
+			$pow = "IN (0, 1)";
+		elseif ($pow == 3 || $pow == 4) // merge admin + sysadmin (they appear the same)
+			$pow = "IN (3, 4)";
+		elseif ($pow == -1 || $pow == -2) // merge banned + permabanned
+			$pow = "IN (-1, -2)";
+		else
+			$pow = "= '$pow'";
+
+		$qwhere[] = "powerlevel $pow";
+	}
+
+	$where = 'WHERE '.((empty($qwhere)) ? '1' : implode(' AND ', $qwhere));
+	
+	if (!in_array($sort, array('name','reg','exp','age','posts')))
+		$sort = 'posts';
+
+	$query='SELECT id,posts,regdate,name,minipic,sex,powerlevel,aka,r.* FROM users LEFT JOIN users_rpg r ON id=uid ';
+	if($sort=='name')  $users1=$sql->query("$query$where ORDER BY name", MYSQL_ASSOC);
+	if($sort=='reg')   $users1=$sql->query("$query$where ORDER BY regdate DESC", MYSQL_ASSOC);
+	if($sort=='exp')   $users1=$sql->query("$query$where", MYSQL_ASSOC);
+	if($sort=='age')   $users1=$sql->query("$query$where AND birthday ORDER BY birthday", MYSQL_ASSOC);
+	if($sort=='posts') $users1=$sql->query("$query$where ORDER BY posts DESC", MYSQL_ASSOC);
+
+	$numusers=mysql_num_rows($users1);
+
+	for($i=0;$user = $sql->fetch($users1);$i++){
+		$user['days'] = (ctime()-$user['regdate'])/86400;
+		$user['exp']  = calcexp($user['posts'],$user['days']);
+		$user['lvl']  = calclvl($user['exp']);
+		$users[] = $user;
+	}
+
+	if($sort=='exp')
+		usort($users,'sortbyexp');
+
+	$pagelinks=$smallfont.'Pages:';
+	for($i=0;$i<($numusers/$ppp);$i++)
+		$pagelinks.=($i==$page?' '.($i+1):" <a href=memberlist.php?sort=$sort$qsex$qpow$qrpg$qppp&page=$i>".($i+1).'</a>');
+
+	if($numusers>1) $s="s";
+	print "
+		$header<br>$tblstart
+		<tr>
+		$tccellh colspan=2>$numusers user$s found.
+		</tr><tr>
+		$tccell1s>	Sort by:
+		$tccell2s>
+			$lnk=posts$q$qpow$qsex>Total posts</a> |
+			$lnk=exp$q$qpow$qsex>EXP</a> |
+			$lnk=name$q$qpow$qsex>User name</a> |
+			$lnk=reg$q$qpow$qsex>Registration date</a> |
+			$lnk=age$q$qpow$qsex>Age</a>
+		</tr><tr>
+		$tccell1s>	Sex:
+		$tccell2s>
+			$lnk=$sort$q$qpow&sex=m>Male</a> |
+			$lnk=$sort$q$qpow&sex=f>Female</a> |
+			$lnk=$sort$q$qpow&sex=n>N/A</a> |
+			$lnk=$sort$q$qpow>All</a><tr>
+		</tr><tr>
+		$tccell1s>	Powerlevel:
+		$tccell2s>
+			$lnk=$sort$q$qsex&pow=-1>Banned</a> |
+			$lnk=$sort$q$qsex&pow=0>Normal</a> |
+			". ($loguser['powerlevel'] >= 3 ? "$lnk=$sort$q$qsex&pow=1>Normal +</a> | " : "") ."
+			$lnk=$sort$q$qsex&pow=2>Moderator</a> |
+			$lnk=$sort$q$qsex&pow=3>Administrator</a> |
+			$lnk=$sort$q$qsex>All</a>
+		</tr>$tblend<br>$tblstart
+		<tr>
+		$tccellh width=30>#</td>
+		$tccellh width=16><img src=images/_.gif width=16 height=8></td>
+		$tccellh>Username</td>
+	";
+
+	if(!$rpg) {
+		print "
+			$tccellh width=200>Registered on</td>
+			$tccellh width=60>Posts</td>
+			$tccellh width=35>Level</td>
+			$tccellh width=100>EXP</td></tr>
+		";
+	}
+	else {
+		$items   = $sql->getarraybykey("SELECT * FROM items", 'id');
+        $classes = $sql->getarraybykey("SELECT * FROM rpg_classes", 'id');
+
+		print "$tccellh width=35>Level</td>";
+		print "$tccellh width=90>Class</td>";
+		for($i=0;$i<9;$i++) print "$tccellh width=65>".$stat[$i].'</td>';
+		print "$tccellh width=80><img src=images/coin.gif></td>";
+		print "$tccellh width=60><img src=images/coin2.gif></td>";
+		print "</tr>";
+	}
+
+	$s = $ppp*$page;
+	for($u=0;$u < $ppp;$u++) {
+		$i = $s + $u;
+		$ulist.="<tr style=\"height:24px;\">";
+		$user = $users[$i];
+		if (!$user) break;
+
+		$userpicture='&nbsp';
+		if ($user['minipic'])
+			$userpicture="<img width=16 height=16 src='".str_replace('>','&gt;',$user['minipic'])."'>";
+
+		$userlink = getuserlink($user);
+		$ulist.="
+			$tccell2>".($i+1).".</td>
+			$tccell1l>{$userpicture}</td>
+			$tccell2l>{$userlink}</td>
+		";
+
+		if(!$rpg){
+			$ulist.="
+				$tccell2>".date($dateformat,$user['regdate']+$tzoff)."</td>
+				$tccell1>{$user['posts']}</td>
+				$tccell1>{$user['lvl']}</td>
+				$tccell1>{$user['exp']}</td>
+			";
+		}
+		else {
+			if (!($class = $classes[$user['class']]))
+				$class = array('name'=>'None');
+			$stats=getstats($user,$items,$class);
+
+			$ulist.="$tccell1>$user[lvl]</td>";
+			$ulist.="$tccell1>$class[name]</td>";
+			for($k=0;$k<9;$k++) $ulist.="$tccell1s>".$stats[$stat[$k]].'</td>';
+			$ulist.="$tccell1s>$stats[GP]</td>";
+			$ulist.="$tccell1s>$user[gcoins]</td>";
+		}
+		$ulist.="</tr>";
+	}
+
+	print "$ulist$tblend$pagelinks$footer";
+	printtimedif($startingtime);
\ No newline at end of file
diff --git a/milestones.php b/milestones.php
new file mode 100644
index 0000000..528c2a6
--- /dev/null
+++ b/milestones.php
@@ -0,0 +1,146 @@
+<?php
+	require 'lib/function.php';
+	$windowtitle="$boardname -- Milestones";
+	require 'lib/layout.php';
+
+  $posts   = max(10000, intval($_GET['p']));
+  $threads = max(1000,  intval($_GET['t']));
+
+  $tmp1 = $tmp2 = 0;
+	$milestones = $sql->query("SELECT p.*, t.title as threadname, u.name as uname, u.sex as usex, u.powerlevel as upowerlevel, f.id as fid, f.title as ftitle, f.minpower as mpl "
+			."FROM posts p "
+			."LEFT JOIN users u ON p.user = u.id "
+			."LEFT JOIN threads t ON p.thread = t.id "
+			."LEFT JOIN forums f ON t.forum = f.id "
+			."WHERE (p.id % $posts = 0 OR p.id = 1) "
+			."ORDER BY p.id ASC");
+	$poststable = "<tr>$tccellh colspan=6 style=\"font-weight:bold;\">Post Milestones</td></tr><tr>
+			$tccellh width=30>&nbsp;</td>
+			$tccellh width=280>Forum</td>
+			$tccellh width=*>In Thread</td>
+			$tccellh width=200>User</td>
+			$tccellh width=250>Time</td>
+		</tr>";
+	$last = 0;
+	while ($ms = $sql->fetch($milestones)) {
+    $tmp2 = $ms['id'];
+    while (($tmp2 -= $posts) > $tmp1) {
+			$poststable .= "<tr>
+				$tccell1>$tmp2</td>
+				$tccell2><i>(unknown)</i></td>
+				$tccell2><i>(post deleted)</i></td>
+				$tccell1>????</td>
+				$tccell1>????<br>$smallfont(????)</td>
+			</td>";
+    }
+    $tmp1 = $ms['id'];
+
+    if ($ms['mpl'] && $ms['mpl'] > $loguser['powerlevel']) {
+			$forumlink = "<i>(restricted forum)</i>";
+			$threadlink = "<i>(restricted)</i>";
+			$userlink = "????";
+		}
+		else {
+			$forumlink = "<a href='forum.php?id=$ms[fid]'>$ms[ftitle]</a>";
+			$threadlink = "<a href='thread.php?pid=$ms[id]#$ms[id]'>$ms[threadname]</a>";
+			$userlink = "<a href='profile.php?id=$ms[user]'><font ". getnamecolor($ms['usex'], $ms['upowerlevel']) .">$ms[uname]</font></a>";
+		}
+
+    if ($last)
+      $timetaken = "<br>$smallfont(".timeunits($ms['date']-$last).")";
+    else
+      $timetaken = "<br>$smallfont(first post)";
+		$last = $ms['date'];
+		$timestamp = date($dateformat,$ms['date']+$tzoff).$timetaken;
+
+		$poststable .= "<tr>
+			$tccell1>$ms[id]</td>
+			$tccell2>$forumlink</td>
+			$tccell2>$threadlink</td>
+			$tccell1>$userlink</td>
+			$tccell1>$timestamp</td>
+		</td>";
+	}
+
+  $tmp1 = $tmp2 = 0;
+
+	$milestones = $sql->query("SELECT t.*,u1.name AS name1,u1.sex AS sex1,u1.powerlevel AS power1,u2.name AS name2,u2.sex AS sex2,u2.powerlevel AS power2, f.minpower as mpl, f.title as forumtitle "
+			."FROM threads t,forums f,users u1,users u2 "
+			."WHERE (t.id % $threads = 0 OR t.id = 1) "
+			."AND f.id=t.forum "
+			."AND u1.id=t.user "
+			."AND u2.id=t.lastposter "
+			."ORDER BY t.id ASC");
+	$threadstable = "<tr>$tccellh colspan=7 style=\"font-weight:bold;\">Thread Milestones</td></tr><tr>
+			$tccellh width=30></td>
+			$tccellh colspan=2> Thread</td>
+			$tccellh width=20%>Started by</td>
+			$tccellh width=60> Replies</td>
+			$tccellh width=60> Views</td>
+			$tccellh width=180> Last post</td>
+    </tr>";
+	while ($ms = $sql->fetch($milestones)) {
+    $tmp2 = $ms['id'];
+    while (($tmp2 -= $threads) > $tmp1) {
+			$threadstable .= "<tr>
+				$tccell1>$tmp2</td>
+				$tccell1 width=40px>&nbsp;</td>
+				$tccell2l><i>(thread deleted)</i></td>
+				$tccell2>????</td>
+				$tccell1>????</td>
+				$tccell1>????</td>
+				$tccell1>????$smallfont<br>by ????</td>
+			</td>";
+    }
+    $tmp1 = $ms['id'];
+
+    if ($ms['mpl'] && $ms['mpl'] > $loguser['powerlevel']) {
+			$threadlink = "<i>(restricted)</i>";
+			$userlink = "????";
+			$tpic = "&nbsp;";
+			$replies = "????";
+			$views = "????";
+			$lastpost = "????$smallfont<br>by ????";
+		}
+		else {
+			$threadlink = "<a href='thread.php?id=$ms[id]'>$ms[title]</a>";
+			$threadlink .= '<br><span class="fonts" style="position: relative; top: -1px;">&nbsp;&nbsp;&nbsp;'
+       ."In <a href='forum.php?id=$ms[forum]'>".$ms['forumtitle']."</a>"
+       .'</span>';
+			$userlink = "<a href='profile.php?id=$ms[user]'><font ". getnamecolor($ms['sex1'], $ms['power1']) .">$ms[name1]</font></a>";
+			$lastpost = date($dateformat,$ms['lastpostdate']+$tzoff)."
+        $smallfont<br>by <a href='profile.php?id=$ms[user]'><font ". getnamecolor($ms['sex2'], $ms['power2']) .">$ms[name2]</font></a>
+				<a href='thread.php?id=$ms[id]&end=1'>$statusicons[getlast]</a>
+      ";
+
+      $replies = $ms['replies'];
+      $views = $ms['views'];
+      $tpic = ($ms['icon']) ? "<img src='$ms[icon]'>" : "&nbsp;";
+		}
+		$threadstable .= "<tr>
+			$tccell1>$ms[id]</td>
+			$tccell1 width=40px style=\"max-width:40px;max-height:30px;overflow:hidden;\">$tpic</td>
+			$tccell2l>$threadlink</td>
+			$tccell2>$userlink</td>
+			$tccell1>$replies</td>
+			$tccell1>$views</td>
+			$tccell1>$lastpost</td>
+		</td>";
+	}
+
+
+
+	print "
+		$header
+			<br>
+			<table class='table' cellspacing='0'>
+			$poststable
+			$tblend
+			<br>
+			$tblstart
+			$threadstable
+			$tblend
+    $footer";
+		printtimedif($startingtime);
+
+?>
diff --git a/mobile.css b/mobile.css
new file mode 100644
index 0000000..4ef973f
--- /dev/null
+++ b/mobile.css
@@ -0,0 +1,4 @@
+a:link,a:visited,a:active,a:hover{text-decoration:none;font-weight:bold}
+html { width: 480px; }
+body { background: #079; color: #fff;}
+
diff --git a/newreply.php b/newreply.php
new file mode 100644
index 0000000..5b64f7d
--- /dev/null
+++ b/newreply.php
@@ -0,0 +1,352 @@
+<?php
+	// die("Disabled.");
+	require 'lib/function.php';
+	$thread=$sql->fetchq("SELECT forum, closed, sticky,title,lastposter FROM threads WHERE id=$id");
+
+	// Stop this insanity.  Never index newreply.
+	$meta['noindex'] = true;
+
+	if (!$thread) {
+		require_once 'lib/layout.php';
+		print "
+			$header<br>$tblstart
+			$tccell1>Nice try. Next time, wait until someone makes the thread <i>before</i> trying to reply to it.<br>".redirect("index.php", 'return to the index page', 0)."
+			$tblend$footer
+		";
+		printtimedif($startingtime);
+		die();
+	}
+
+ 	$forumid=intval($thread[forum]);
+	$forum=$sql->fetchq("SELECT title,minpower,minpowerreply,id,specialscheme FROM forums WHERE id=$forumid");
+	if ($forum['minpower'] && $power < $forum['minpower']) {
+		$forum['title'] = '';
+		$thread['title'] = '(restricted thread)';
+	}
+	$specialscheme = $forum['specialscheme'];
+	$windowtitle="$boardname -- $forum[title]: $thread[title] -- New Reply";
+
+	$thread['title']=str_replace('<','&lt;',$thread['title']);
+
+	require_once 'lib/layout.php';
+
+	$smilies=readsmilies();
+	if(!$ppp) $ppp=(!$log?20:$loguser[postsperpage]);
+	$fonline=fonlineusers($forumid);
+	$header=makeheader($header1,$headlinks,$header2 ."	$tblstart$tccell1s>$fonline$tblend");
+
+	if(@mysql_num_rows($sql->query("SELECT user FROM forummods WHERE forum=$forumid and user=$loguserid"))) $ismod=1;
+
+	if ($ismod) { 
+		if ($thread[sticky] == 1) $sticky = "checked";
+		$modoptions = "	<tr>$tccell1><b>Moderator Options:</b></td>$tccell2l colspan=2>
+		$inpc=\"close\" id=\"close\" value=\"1\"><label for=\"close\">Close</label> - 
+		$inpc=\"stick\" id=\"stick\" value=\"1\" $sticky><label for=\"stick\">Sticky</label>";
+	}
+
+	if ($forum['minpowerreply'] > $power && $forum['minpowerreply'] > 0)
+		$restricted		= true;
+
+	$header	= "$header
+		$fonttag<a href=index.php>$boardname</a> - <a href=forum.php?id=$forumid>$forum[title]</a> - $thread[title]<form action=newreply.php name=replier method=post autocomplete=\"off\"> $tblstart";
+	replytoolbar(1);
+
+	if($log) activitycheck($loguserid);
+
+  // Post preview
+	if (($power>=$forum['minpowerreply'] || $forum['minpowerreply']<1) && $id>0) {
+		$postlist="<tr>$tccellh colspan=2 style=\"font-weight:bold;\">Thread history</tr><tr>$tccellh width=150>User</td>$tccellh width=*>Post</tr>";
+		$qppp = $ppp + 1;
+		$posts=$sql->query("SELECT name,posts,sex,powerlevel,user,text,options,num FROM users u,posts p,posts_text WHERE thread=$id AND p.id=pid AND user=u.id ORDER BY p.id DESC LIMIT $qppp");
+		$i = 0;
+
+		while($post=$sql->fetch($posts)){
+			$bg = ((($i++) & 1) ? 'tdbg2' : 'tdbg1');
+			if ($ppp-- > 0){
+				$postnum=($post[num]?"$post[num]/":'');
+				$tcellbg="<td class='tbl $bg font' valign=top>";
+				$namecolor=getnamecolor($post[sex],$post[powerlevel]);
+				$postlist.="<tr>
+					$tcellbg<a href=profile.php?id=$post[user]><font $namecolor>$post[name]</font></a>$smallfont<br>
+					Posts: $postnum$post[posts]</td>
+					$tcellbg".doreplace2(dofilters($post[text]), $post[options])."</tr>
+				";
+			}
+			else{
+				$tcellbg="<td bgcolor=$tablebg1 valign=top colspan=2";
+				$postlist.="<tr>$tccellh colspan=2>This is a long thread. Click <a href=thread.php?id=$id>here</a> to view it.</td></tr>";
+			}
+		}
+	}
+
+	if(!$_POST['action'] && !$thread['closed'] && !($banned && $log)
+	 && ($power>=$forum[minpowerreply] || $forum[minpowerreply]<1) && $id>0) {
+		print $header;
+		print "";
+
+		if ($log) {
+			$username=$loguser['name'];
+			$passhint = 'Alternate Login:';
+			$altloginjs = "<a href=\"#\" onclick=\"document.getElementById('altlogin').style.cssText=''; this.style.cssText='display:none'\">Use an alternate login</a>
+				<span id=\"altlogin\" style=\"display:none\">";
+		}
+		else {
+			$username = '';
+			$passhint = 'Login Info:';
+			$altloginjs = "<span>";
+		}
+
+		if($postid){
+			$post=$sql->fetchq("SELECT user,text,thread FROM posts,posts_text WHERE id=$postid AND id=pid");
+			$post['text']=str_replace('<br>',$br,$post[text]);
+			$u=$post['user'];
+			$users[$u]=loaduser($u,1);
+			if($post['thread']==$id) $quotemsg="[quote={$users[$u]['name']}]{$post['text']}[/quote]\r\n";
+		}
+
+  print "
+	 <body>
+	  $tccellh width=150>&nbsp</td>$tccellh colspan=2>&nbsp<tr>
+	  $tccell1><b>{$passhint}</td> $tccell2l colspan=2>
+		{$altloginjs}
+		<b>Username:</b> $inpt=username VALUE=\"".htmlspecialchars($username)."\" SIZE=25 MAXLENGTH=25 autocomplete=\"off\">
+		<b>Password:</b> $inpp=password SIZE=13 MAXLENGTH=64 autocomplete=\"off\">
+		</span><tr>
+	  $tccell1><b>Reply:</td>
+	  $tccell2l width=800px valign=top>".replytoolbar(2)."
+	  $txta=message ROWS=21 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\" ".replytoolbar(3).">". htmlspecialchars($quotemsg, ENT_QUOTES, "ISO-8859-1") ."</TEXTAREA></td>
+    $tccell2l width=*>".moodlist($moodid)."</td><tr>
+	<tr>
+	  $tccell1>&nbsp</td>$tccell2l colspan=2>
+	  $inph=action VALUE=postreply>
+	  $inph=id VALUE=$id>
+	  $inph=valid value=\"". md5($_SERVER['REMOTE_ADDR'] . $id ."sillysaltstring") ."\">
+	  $inps=submit VALUE=\"Submit reply\">
+	  $inps=preview VALUE=\"Preview reply\"></td>
+	<tr>$tccell1><b>Options:</b></td>$tccell2l colspan=2>
+		$inpc=\"nosmilies\" id=\"nosmilies\" value=\"1\"><label for=\"nosmilies\">Disable Smilies</label> - 
+		$inpc=\"nolayout\" id=\"nolayout\" value=\"1\"><label for=\"nolayout\">Disable Layout</label> - 
+		$inpc=\"nohtml\" id=\"nohtml\" value=\"1\"><label for=\"nohtml\">Disable HTML</label></td></tr>
+		$modoptions
+		$tblend
+		<br>
+	 $tblstart$postlist$tblend
+	</table>
+		</form>
+	$fonttag<a href=index.php>$boardname</a> - <a href=forum.php?id=$forumid>$forum[title]</a> - $thread[title]
+	".replytoolbar(4);
+  } elseif(!$_POST[action]) {
+			print $header;
+			print "$tccell1>You are not allowed to post in this thread.
+			<br>".redirect("index.php", 'return to the index page', 0)."</table>";
+	}
+
+ 
+  if($_POST[action]=='postreply' && !($banned && $log) && $id>0) {
+		if ($log && !$password)
+			$userid = $loguserid;
+		else
+			$userid = checkuser($username,$password);
+
+/*
+	if (stripos($message, "i hate metal man!!") !== false) {
+		xk_ircsend("1|". xk(4) ."NO BONUS!". xk() ." Seems that ". xk(11) ."'$username'". xk() ." is another rereg, so I've banned his account (". xk(11) ."$userid". xk() .") and IP (". xk(11) ."$userip". xk() .").");
+		$sql -> query("UPDATE `users` SET `power` = '-1', `title` = 'Get out.' WHERE `id` = '$userid'");
+		$sql -> query("INSERT INTO `ipbans` SET `ip` = '". $_SERVER['REMOTE_ADDR'] ."', `date` = '". ctime() ."', `reason` = 'NO BONUS'");
+		die("Winners don't do drugs!");
+	}
+*/
+
+	$error='';
+    if($userid==-1) 
+      $error="Either you didn't enter an existing username, or you haven't entered the right password for the username.";
+    else{
+	$user=@$sql->fetchq("SELECT * FROM users WHERE id=$userid");
+//      if($thread[lastposter]==$userid && $user[powerlevel]<=2)
+//        $error='You already have the last reply in this thread.';
+      if($thread[closed])
+        $error='The thread is closed and no more replies can be posted.';
+      if($user[powerlevel]<$forum[minpowerreply])
+        $error='Replying in this forum is restricted, and you are not allowed to post in this forum.';
+      if(!$message)
+        $error="You didn't enter anything in the post.";
+    }
+    if(!$error){
+	activitycheck($userid);
+	$sign=$user[signature];
+	$head=$user[postheader];
+	if($user[postbg]) $head="<div style=background:url($user[postbg]);height=100%>$head";
+
+	$numposts=$user[posts]+ 1;
+
+	$numdays=(ctime()-$user[regdate])/86400;
+	$message=doreplace($message,$numposts,$numdays,$username);
+	$rsign=doreplace($sign,$numposts,$numdays,$username);
+	$rhead=doreplace($head,$numposts,$numdays,$username);
+	$currenttime=ctime();
+	if($submit){
+
+	  if (!(!$x_hacks['host'] && $userid == 715) || true) {
+
+	  $sql->query("UPDATE `users` SET `posts` = $numposts, `lastposttime` = '$currenttime' WHERE `id` = '$userid'");
+
+		if ($nolayout) {
+			$headid = 0;
+			$signid = 0;
+		} else {
+			$headid=getpostlayoutid($head);
+			$signid=getpostlayoutid($sign);
+		}
+
+
+		if ($ismod) {
+			if ($close) $close = "`closed` = '1',";
+				else $close = "`closed` = '0',";
+			if ($stick) $stick = "`sticky` = '1',";
+				else $stick = "`sticky` = '0',";
+			}
+
+		$sql->query("INSERT INTO posts (thread,user,date,ip,num,headid,signid,moodid) VALUES ($id,$userid,$currenttime,'$userip',$numposts,$headid,$signid,'". $_POST['moodid'] ."')");
+		$pid=mysql_insert_id();
+
+		$options = intval($nosmilies) . "|" . intval($nohtml);
+
+	  if($pid) $sql->query("INSERT INTO `posts_text` (`pid`,`text`,`tagval`, `options`) VALUES ('$pid','$message','$tagval', '$options')");
+
+	  if (in_array($id, array(3424, 3425, 3426, 3816, 4907)) && !$x_hacks['host']) {
+		$lastgmpost	= $sql -> resultq("SELECT MAX(`id`) FROM `posts` WHERE `user` = '24' AND `thread` = '$id'");
+
+		if ($id == 3424) {
+			$inarray	= "49, 203, 41, 29";
+		} elseif ($id == 3425) {
+			$inarray	= "3, 25, 14, 22";
+		} elseif ($id == 3426) {
+			$inarray	= "61, 1, 18, 555";
+		} elseif ($id == 3816) {
+			$inarray	= "4, 10, 66, 125";
+		} elseif ($id == 4907) {
+			$inarray	= "18, 19, 21, 2";
+		}
+
+		$playerposts	= $sql -> resultq("SELECT COUNT(DISTINCT `user`) FROM `posts` WHERE `user` IN ($inarray) AND `thread` = '$id' AND `id` > '$lastgmpost'");
+		if ($playerposts >= 4) $stick .= " `icon` = 'images/piticon-ok.png',";
+		else  $stick .= " `icon` = 'images/piticon-wait.png',";
+
+	  }
+
+	  $sql->query("UPDATE `threads` SET $close $stick `replies` =  `replies` + 1, `lastpostdate` = '$currenttime', `lastposter` = '$userid' WHERE `id`='$id'");
+	  $sql->query("UPDATE `forums` SET `numposts` = `numposts` + 1, `lastpostdate` = '$currenttime', `lastpostuser` ='$userid', `lastpostid` = '$pid' WHERE `id`='$forumid'");
+
+	  $sql->query("UPDATE `threadsread` SET `read` = '0' WHERE `tid` = '$id'");
+	  $sql->query("REPLACE INTO threadsread SET `uid` = '$userid', `tid` = '$id', `time` = ". ctime() .", `read` = '1'");
+	  
+
+/*
+	  print "
+	   $tccell1>Reply posted successfully!
+	<br>".redirect("thread.php?pid=$pid#$pid", $thread[title], 0) .$tblend;
+*/
+		xk_ircout("reply", $user['name'], array(
+			'forum'		=> $forum['title'],
+			'fid'		=> $forumid,
+			'thread'	=> str_replace("&lt;", "<", $thread['title']),
+			'pid'		=> $pid,
+			'pow'		=> $forum['minpower'],
+		));
+
+		if (in_array($id, array(3426, 4907, 6358)) && !$x_hacks['host'] && false) {
+		
+			relay_vgg($id, $userid, $username, $message);
+
+		}
+
+		return header("Location: thread.php?pid=$pid#$pid");
+
+
+	  } else {
+		  print "
+		   $tccell1>Reply posted successfully!
+		<br>".redirect("thread.php?id=$id", $thread[title], 0) .$tblend;
+	  }
+	}else{
+		loadtlayout();
+		$message = stripslashes($message);
+		$ppost=$user;
+		$ppost[uid]=$userid;
+		$ppost[num]=$numposts;
+		$ppost[posts]++;
+		$ppost[lastposttime]=$currenttime;
+		$ppost[date]=$currenttime;
+		$ppost[moodid]=$_POST['moodid'];
+		if ($nolayout) {
+			$ppost[headtext] = "";
+			$ppost[signtext] = "";
+		} else {
+			$ppost[headtext]=$rhead;
+			$ppost[signtext]=$rsign;
+		}
+		$ppost[text]=$message;
+		$ppost[options] = $nosmilies . "|" . $nohtml;
+
+	  if($isadmin) $ip=$userip;
+
+		$chks = array();
+		if ($nosmilies) $chks[0] = "checked";
+		if ($nolayout)  $chks[1] = "checked";
+		if ($nohtml)    $chks[2] = "checked";
+
+	  print "$header
+		<body onload=window.document.REPLIER.message.focus()>
+		$tccellh>Post preview
+		$tblend$tblstart
+		".threadpost($ppost,1)."
+		$tblend<br>$tblstart
+		<FORM ACTION=newreply.php NAME=REPLIER METHOD=POST>
+		$tccellh width=150>&nbsp</td>$tccellh colspan=2>&nbsp<tr>
+		$tccell1><b>Reply:</td>
+		$tccell2l width=800px valign=top>$txta=message ROWS=21 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($message, ENT_QUOTES, "ISO-8859-1") ."</TEXTAREA></td>
+    $tccell2l width=*>".moodlist($moodid)."</td><tr>
+		$tccell1>&nbsp</td>$tccell2l colspan=2>
+		$inps=submit VALUE=\"Submit reply\">
+		$inps=preview VALUE=\"Preview reply\"></td>
+		$inph=username VALUE=\"".htmlspecialchars($username)."\">
+		$inph=password VALUE=\"".htmlspecialchars($password)."\">
+		$inph=valid value=\"". md5($_SERVER['REMOTE_ADDR'] . $id ."sillysaltstring") ."\">
+		$inph=action VALUE=postreply>
+		$inph=id VALUE=$id>
+	<tr>$tccell1><b>Options:</b></td>$tccell2l colspan=2>
+		$inpc=\"nosmilies\" id=\"nosmilies\" value=\"1\" $chks[0]><label for=\"nosmilies\">Disable Smilies</label> -
+		$inpc=\"nolayout\" id=\"nolayout\" value=\"1\" $chks[1]><label for=\"nolayout\">Disable Layout</label> -
+		$inpc=\"nohtml\" id=\"nohtml\" value=\"1\" $chks[2]><label for=\"nohtml\">Disable HTML</label></td></tr>
+		$modoptions
+		$tblend
+		</FORM>
+	 $tblstart$postlist$tblend
+		</td></FORM>
+	  ";
+      }
+    }else
+	print "$header$tccell1>Couldn't enter the post. $error<br>".redirect("thread.php?id=$id", $thread['title'], 0);
+  }
+  if($thread[closed])
+    print "
+	$tccell1>Sorry, but this thread is closed, and no more replies can be posted in it.
+	<br>".redirect("thread.php?id=$id",$thread[title],0);
+  if($banned and $log)
+    print "
+	$tccell1>Sorry, but you are banned from the board, and can not post.
+	<br>".redirect("thread.php?id=$id",$thread[title],0);
+
+  print $footer;
+  printtimedif($startingtime);
+
+function activitycheck($userid){
+  global $id,$thread,$header,$tblstart,$tccell1,$tblend,$footer,$loguser,$sql;
+  $activity=$sql->resultq("SELECT count(*) FROM posts WHERE user=$userid AND thread=$id AND date>".(ctime()-86400),0,0);
+//  if($activity>=(stristr($thread[title],'ACS ')?5:5000))
+//    die("$tblstart$tccell1>You have posted enough in this thread today. Come back later!$tblend$footer");
+  $activity=$sql->resultq("SELECT count(*) FROM posts WHERE user=$userid AND date>".(ctime()-300),0,0);
+	  if($activity && $userid == 1079)
+		 die("$header$tblstart$tccell1>You can only post once every five minutes! Make it count!$tblend$footer");
+}
+
diff --git a/newthread.php b/newthread.php
new file mode 100644
index 0000000..b01eccd
--- /dev/null
+++ b/newthread.php
@@ -0,0 +1,343 @@
+<?php
+	require 'lib/function.php';
+	$forum = $sql->fetchq("SELECT * FROM forums WHERE id=$id");
+	$windowtitle = "$boardname -- $forum[title] -- New Thread";
+	$specialscheme	= $forum['specialscheme'];
+
+	// Stop this insanity.  Never index newthread.
+	$meta['noindex'] = true;
+
+	require 'lib/layout.php';
+
+	$forumid=$id;
+	$fonline=fonlineusers($forumid);
+	$header=makeheader($header1,$headlinks,$header2 ."	$tblstart$tccell1s>$fonline$tblend");
+
+	$smilies=readsmilies();
+	replytoolbar(1);
+
+/*
+	if (false && $id == 27) { //trash forum
+		print "$header
+			<br>
+			$tblstart
+				$tccell1>
+					No. Stop that, you idiot.
+				</td>
+			$tblend
+		$footer";
+		die();
+	}
+	if ($forum['nopolls'] && $poll) {
+		print "$header
+			<br>
+			$tblstart 
+				$tccell1>
+					A for effort, but F for still failing.
+				</td>
+			$tblend
+		$footer";
+		die();
+	}
+*/
+
+	print $header;
+	if($poll) {
+		$c=1;
+		$d=0;
+		while($chtext[$c+$d] || $c < $_POST['count']) {
+			if($remove[$c+$d]) $d++;
+			else {
+				$choices.="Choice $c: $inpt=chtext[$c] SIZE=30 MAXLENGTH=255 VALUE=\"".stripslashes(htmlspecialchars($chtext[$c+$d]))."\"> &nbsp Color: $inpt=chcolor[$c] SIZE=7 MAXLENGTH=25 VALUE=\"".stripslashes(htmlspecialchars($chcolor[$c+$d]))."\"> &nbsp <INPUT type=checkbox class=radio name=remove[$c] value=1> Remove<br>";
+				$c++;
+			}
+		}
+		$choices.="Choice $c: $inpt=chtext[$c] SIZE=30 MAXLENGTH=255> &nbsp Color: $inpt=chcolor[$c] SIZE=7 MAXLENGTH=25><br>$inps=paction VALUE=\"Submit changes\"> and show $inpt=count size=4 maxlength=2 VALUE=\"".stripslashes(htmlspecialchars(($_POST['count']) ? $_POST['count'] : $c))."\"> options";
+		if($mltvote) $checked1='checked';
+		else $checked0='checked';
+	}
+	$posticons=file('posticons.dat');
+	for($i=0;$posticons[$i];$i++) {
+		if($iconid==$i) $checked='checked';
+		$posticonlist.="$radio=iconid value=$i $checked>&nbsp<IMG SRC=$posticons[$i] HEIGHT=15 WIDTH=15>&nbsp; &nbsp;";
+		$checked='';
+		if(($i+1)%10==0) $posticonlist.='<br>';
+	}
+	if(!$iconid or $iconid==-1) $checked='checked';
+	$posticonlist.="
+		<br>$radio=iconid value=-1 $checked>&nbsp;None&nbsp; &nbsp; &nbsp;
+		Custom: $inpt=custposticon SIZE=40 MAXLENGTH=100 VALUE=\"". stripslashes($custposticon) ."\">
+	";
+	$subject=htmlspecialchars($subject);
+	$question=htmlspecialchars($question);
+
+	if ($nosmilies)	$nosmilieschk	= " checked";
+	if ($nohtml)	$nohtmlchk	= " checked";
+	if ($nolayout)	$nolayoutchk	= " checked";
+
+	$form=(!$poll?"
+		<tr>$tccell1><b>Thread icon:</td>	$tccell2l colspan=2>$posticonlist</td></tr>
+		<tr>$tccell1><b>Thread title:</td>$tccell2l colspan=2>$inpt=subject SIZE=40 MAXLENGTH=100 VALUE=\"". stripslashes($subject) ."\"></td></tr>
+		<tr>$tccell1><b>Post:</td>$tccell2l width=800px valign=top>".replytoolbar(2)."
+		$txta=message ROWS=21 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". stripslashes(htmlspecialchars($message)) ."</TEXTAREA></td>
+		$tccell2l width=*>".moodlist($moodid)."</td></tr>
+		<tr>$tccell1>&nbsp</td>$tccell2l colspan=2>
+		$inph=action VALUE=postthread>
+		$inph=id VALUE=$id>
+		$inps=submit VALUE=\"Submit thread\">
+		$inps=preview VALUE=\"Preview thread\"></td></tr>
+		<tr>
+		  $tccell1><b>Options:</b></td>$tccell2l colspan=2>
+			$inpc=\"nosmilies\" id=\"nosmilies\" value=\"1\"$nosmilieschk><label for=\"nosmilies\">Disable Smilies</label> -
+			$inpc=\"nolayout\" id=\"nolayout\" value=\"1\"$nolayoutchk><label for=\"nolayout\">Disable Layout</label> -
+			$inpc=\"nohtml\" id=\"nohtml\" value=\"1\"$nohtmlchk><label for=\"nohtml\">Disable HTML</label></td></tr><tr>
+		<!-- </FORM> -->
+	":"
+		<tr>$tccell1><b>Poll icon:</td>	$tccell2l colspan=2>$posticonlist</td></tr>
+		<tr>$tccell1><b>Poll title:</td>	$tccell2l colspan=2>$inpt=subject SIZE=40 MAXLENGTH=100 VALUE=\"". stripslashes($subject) ."\"></td></tr>
+		<tr>$tccell1><b>Question:</td>	$tccell2l colspan=2>$inpt=question SIZE=60 MAXLENGTH=255 VALUE=\"". stripslashes($question) ."\"></td></tr>
+		<tr>$tccell1><b>Briefing:</td>	$tccell2l colspan=2>$txta=briefing ROWS=2 COLS=$numcols style=\"resize:vertical;\">". stripslashes($briefing) ."</TEXTAREA></td></tr>
+		<tr>$tccell1><b>Multi-voting:</td>$tccell2l colspan=2>$radio=mltvote value=0 $checked0> Disabled &nbsp $radio=mltvote value=1 $checked1> Enabled</td></tr>
+		<tr>$tccell1><b>Choices:</td>	$tccell2l colspan=2>$choices</td></tr>
+		<tr>$tccell1><b>Post:</td>$tccell2l width=800px valign=top>".replytoolbar(2)."
+		$txta=message ROWS=21 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". stripslashes(htmlspecialchars($message)) ."</TEXTAREA></td>
+		$tccell2l width=*>".moodlist($moodid)."</td></tr>
+
+		<tr>
+		$tccell1>&nbsp</td>$tccell2l colspan=2>
+		$inph=action VALUE=postthread>
+		$inph=id VALUE=$id>
+		$inph=poll VALUE=1>
+		$inps=submit VALUE=\"Submit poll\">
+		$inps=preview VALUE=\"Preview poll\"></td>
+		<tr>
+		  $tccell1><b>Options:</b></td>$tccell2l colspan=2>
+			$inpc=\"nosmilies\" id=\"nosmilies\" value=\"1\"$nosmilieschk><label for=\"nosmilies\">Disable Smilies</label> -
+			$inpc=\"nolayout\" id=\"nolayout\" value=\"1\"$nolayoutchk><label for=\"nolayout\">Disable Layout</label> -
+			$inpc=\"nohtml\" id=\"nohtml\" value=\"1\"$nohtmlchk><label for=\"nohtml\">Disable HTML</label></td></tr><tr>
+		<!-- </FORM> -->
+	");
+	if(!$_POST[action] or $_POST[paction]) {
+		print "
+			$fonttag<a href=index.php>$boardname</a> - <a href=forum.php?id=$forumid>".$forum[title]."</a>
+			<form action=newthread.php name=replier method=post autocomplete=\"off\">
+			$tblstart
+		";
+		if($log and $forums[$id][minpowerthread]>$power) {
+			print "$tccell1>Sorry, but you are not allowed to post";
+			if($banned) print ", because you are banned from this board.<br>".redirect("forum.php?id=$id",'return to the forum',0); 
+			else print ' in this restricted forum.<br>'.redirect('index.php','return to the board',0);
+		}
+		else {
+			if ($log) {
+				$username=$loguser['name'];
+				$passhint = 'Alternate Login:';
+				$altloginjs = "<a href=\"#\" onclick=\"document.getElementById('altlogin').style.cssText=''; this.style.cssText='display:none'\">Use an alternate login</a>
+					<span id=\"altlogin\" style=\"display:none\">";
+			}
+			else {
+				$username = '';
+				$passhint = 'Login Info:';
+				$altloginjs = "<span>";
+			}
+
+			print "
+				<body onload=window.document.REPLIER.subject.focus()>
+				$tccellh width=150>&nbsp</td>$tccellh colspan=2>&nbsp<tr>
+				$tccell1><b>{$passhint}</td> $tccell2l colspan=2>
+					{$altloginjs}
+					<b>Username:</b> $inpt=username VALUE=\"".htmlspecialchars($username)."\" SIZE=25 MAXLENGTH=25 autocomplete=\"off\">
+					<b>Password:</b> $inpp=password SIZE=13 MAXLENGTH=64 autocomplete=\"off\">
+				</span><tr>";
+			print $form;
+		}
+		print "
+			</table>
+			</table>
+			</form>
+			$fonttag<a href=index.php>$boardname</a> - <a href=forum.php?id=$forumid>".$forum[title]."</a>
+			".replytoolbar(4);
+	}
+	if($_POST[action]=='postthread' and !$_POST[paction]) {
+		print "<br>$tblstart";
+		if ($log && !$password)
+			$userid = $loguserid;
+		else
+			$userid = checkuser($username,$password);
+
+		$user=$sql->fetchq("SELECT * FROM users WHERE id=$userid");
+		if($user[powerlevel]<0) $userid=-1;
+
+		// can't be posting too fast now
+		$limithit = $user[lastposttime] < (ctime()-30);
+		// can they post in this forum?
+		$authorized = $user[powerlevel] >= $forum[minpowerthread];
+		// does the forum exist?
+		$forumexists = $forum[title];
+
+		// ---
+		// lol i'm eminem
+		if (strpos($message , '[Verse ') !== FALSE) {
+			$authorized = false;
+			@$sql->query("INSERT INTO `ipbans` SET `ip` = '". $_SERVER['REMOTE_ADDR'] ."', `date` = '". ctime() ."', `reason` = 'Listen to some good music for a change.'");
+			if ($_COOKIE['loguserid'] > 0)
+				@$sql->query("UPDATE `users` SET `powerlevel` = '-2' WHERE `id` = {$_COOKIE['loguserid']}");
+			xk_ircsend("1|". xk(7) ."Auto-banned another Eminem wannabe with IP ". xk(8) . $_SERVER['REMOTE_ADDR'] . xk(7) .".");
+		}
+		// ---
+
+		if($userid!=-1 && $subject && $message && $forumexists && $authorized && $limithit) {
+			$msg=$message;
+			// squot(0,$msg);
+			$sign=$user['signature'];
+			$head=$user['postheader'];
+
+			// improved post backgrounds
+			if($user['postbg']) {
+				$head = "<table width=100% height=100% border=0 cellpadding=0 cellspacing=0><td valign=top background=\"$user[postbg]\">$head";
+				$sign = "$sign</td></table>";
+			}
+
+			$numposts = $user[posts] + 1;
+			$numdays = (ctime()-$user[regdate])/86400;
+			$msg = doreplace($msg, $numposts, $numdays, $username);
+			$rsign = doreplace($sign, $numposts, $numdays, $username);
+			$rhead = doreplace($head, $numposts, $numdays, $username);
+			$posticons = file('posticons.dat');
+			$posticon = $posticons[$iconid];
+			$currenttime = ctime();
+			$postnum = $numposts;
+			if($iconid == -1) $posticon='';
+			if($custposticon) $posticon = $custposticon;
+
+			if($submit) {
+				mysql_query("UPDATE `users` SET `posts` = $numposts, `lastposttime` = '$currenttime' WHERE `id` = '$userid'");
+				$headid=getpostlayoutid($head);
+				$signid=getpostlayoutid($sign);
+
+				mysql_query("INSERT INTO `threads` (`forum`, `user`, `views`, `closed`, `title`, `icon`, `replies`, `firstpostdate`, `lastpostdate`, `lastposter`) ".
+							"VALUES ('$id', '$userid', '0', '0', '$subject', '$posticon', '0', '$currenttime', '$currenttime', '$userid')");
+				$t = mysql_insert_id();
+				mysql_query("INSERT INTO `posts` (`thread`, `user`, `date`, `ip`, `num`, `headid`, `signid`, `moodid`) VALUES ('$t', '$userid', '$currenttime', '$userip', '$postnum', '$headid', '$signid','". $_POST['moodid'] ."')");
+				$pid=mysql_insert_id();
+				$options = intval($nosmilies) . "|" . intval($nohtml);
+				if($pid) mysql_query("INSERT INTO `posts_text` (`pid`, `text`, `tagval`, `options`) VALUES ('$pid', '$msg', '$tagval', '$options')");
+				mysql_query("UPDATE `forums` SET `numthreads` = `numthreads` + 1, `numposts` = `numposts` + 1, `lastpostdate` = '$currenttime', `lastpostuser` = '$userid', `lastpostid` = '$pid' WHERE id=$id");
+
+				if(!$poll) {
+					print "
+						$tccell1>Thread posted successfully!
+						<br>".redirect("thread.php?id=$t", stripslashes($subject), 0).$tblend;
+
+					xk_ircout("thread", $user['name'], array(
+						'forum'		=> $forum['title'],
+						'fid'		=> $forum['id'],
+						'thread'	=> str_replace("&lt;", "<", $subject),
+						'pid'		=> $pid,
+						'pow'		=> $forum['minpower'],
+					));
+				}
+				else {
+					mysql_query("INSERT INTO `poll` (`question`, `briefing`, `closed`, `doublevote`) VALUES ('$question', '$briefing', '0', '$mltvote')");
+					$p=mysql_insert_id();
+					mysql_query("UPDATE `threads` SET `poll` = '$p' where `id` = '$t'");
+					$c=1;
+					while($chtext[$c]){
+						mysql_query("INSERT INTO `poll_choices` (`poll`, `choice`, `color`) VALUES ('$p', '$chtext[$c]', '$chcolor[$c]')");
+						$c++;
+					}
+					print "
+						$tccell1>Poll created successfully!
+						<br>".redirect("thread.php?id=$t", stripslashes($subject), 0).$tblend;
+
+					xk_ircout("poll", $user['name'], array(
+						'forum'		=> $forum['title'],
+						'fid'		=> $forum['id'],
+						'thread'	=> str_replace("&lt;", "<", $subject),
+						'pid'		=> $pid,
+						'pow'		=> $forum['minpower'],
+					));
+				}
+			}
+			else {
+				if($posticon) $posticon1="<img src='". stripslashes($posticon) ."' height=15 align=absmiddle>";
+		
+				if($poll) {
+					for($c=1;$chtext[$c];$c++) {
+						$chtext[$c]=stripslashes($chtext[$c]);
+						$chcolor[$c]=stripslashes($chcolor[$c]);
+						$hchoices.="$inph=chtext[$c] VALUE=\"".htmlspecialchars($chtext[$c])."\">$inph=chcolor[$c] VALUE=\"".htmlspecialchars($chcolor[$c]).'">';
+						$pchoices.="
+							$tccell1l width=20%>$chtext[$c]</td>
+							$tccell2l width=60%><table cellpadding=0 cellspacing=0 width=50% bgcolor='$chcolor[$c]'><td>&nbsp</table></td>
+							$tccell1 width=20%>$fonttag ? votes, ??.?%<tr>
+						";
+					}
+					$mlt=($mltvote?'enabled':'disabled');
+					$pollpreview="
+						<td colspan=3 class='tbl tdbgc center font'><b>$question<tr>
+						$tccell2ls colspan=3>$briefing<tr>
+						$pchoices
+						$tccell2ls colspan=3>Multi-voting is $mlt.
+						$tblend<br>$tblstart
+					";
+					$subject = htmlspecialchars(stripslashes($subject));
+					$question = htmlspecialchars(stripslashes($question));
+					$briefing = htmlspecialchars(stripslashes($briefing));
+				}
+				loadtlayout();
+				$ppost=$user;
+				$ppost['uid']=$userid;
+				$ppost['num']=$postnum;
+				$ppost['posts']++;
+				$ppost['lastposttime']=$currenttime;
+				$ppost['date']=$currenttime;
+				//$ppost['headtext']=$rhead;
+				//$ppost['signtext']=$rsign;
+				if ($nolayout) {
+					$ppost['headtext'] = "";
+					$ppost['signtext'] = "";
+				}
+				else {
+					$ppost['headtext']=$rhead;
+					$ppost['signtext']=$rsign;
+				}
+				$ppost['moodid']=$_POST['moodid'];
+				$ppost['text']=stripslashes($message);
+				$ppost['options'] = $_POST['nosmilies'] . "|" . $_POST['nohtml'];
+				if($isadmin) $ip=$userip;
+				$threadtype=($poll?'poll':'thread');
+				print "
+					<body onload=window.document.REPLIER.message.focus()>
+					$tccellh>".($poll?'Poll':'Thread')." preview
+					$tblend$tblstart
+					$pollpreview
+					$tccell2l>$posticon1 <b>". stripslashes($subject) ."</b>
+					$tblend$tblstart
+					".threadpost($ppost,1)."
+					$tblend<br>$tblstart
+					<FORM ACTION=newthread.php NAME=REPLIER METHOD=POST>
+					$tccellh width=150>&nbsp</td>$tccellh colspan=2>&nbsp<tr>
+					$inph=username VALUE=\"".htmlspecialchars($username)."\">
+					$inph=password VALUE=\"".htmlspecialchars($password)."\">
+					$form
+					</td></FORM>
+					$tblend
+				";
+			}
+		}
+		else {
+			$reason = "You haven't entered your username and password correctly.";
+			if (!$limithit) $reason = "You are trying to post too rapidly.";
+			if (!$message) $reason = "You haven't entered a message.";
+			if (!$subject) $reason = "You haven't entered a subject.";
+			if (!$authorized) $reason = "You aren't allowed to post in this forum.";
+	
+			print "
+				$tccell1>Couldn't post the thread. $reason
+				<br>".redirect("forum.php?id=$id", $forum[title], 2).$tblend;
+		}
+	}
+
+	print $footer;
+	printtimedif($startingtime);
diff --git a/newyear.php b/newyear.php
new file mode 100644
index 0000000..17ca155
--- /dev/null
+++ b/newyear.php
@@ -0,0 +1,102 @@
+<?php
+
+//	die("D'oh");
+	header("Cache-Control: no-cache");
+
+	if ($_GET['z']) {
+		die( "<body bgcolor=#111122><META HTTP-EQUIV=REFRESH CONTENT=0;URL=newyear.php?z=". rand(0,9999) ."><center><br><br><br><br><img src=newyear.php width=100%>");
+	}
+
+//	require "lib/function.php";
+
+	$bombday		= mktime(0, 0,  0,  1, 1, 2008);
+	$time			= microtime(true) + (3600 * $_GET['to']);
+	$left			= $bombday - $time;
+	$left			= max(0, $left);
+//	$left			= rand(0, 86400);
+	$barpct			= min(64, floor($left / 3600 * 64));
+	$bpad			= (64 - $barpct) / 2;
+//	$hours			= str_pad(floor(($left) / 3600), 2, "o", STR_PAD_LEFT);
+//	$mins			= str_pad(floor(($left % 3600) / 60), 2, "0", STR_PAD_LEFT);
+	$mins			= str_pad(floor(($left) / 60), 3, "o", STR_PAD_LEFT);
+	$secs			= floor(($left - floor($left / 60) * 60) * 100) / 100;
+	$secs			= explode(".", $secs);
+	$secs			= implode("\"", array(str_pad($secs[0], 2, "0", STR_PAD_LEFT), str_pad($secs[1], 2, "0", STR_PAD_RIGHT)));
+
+	$teststring		= "$mins'$secs";
+
+//	$teststring		= "00d00:00:00.01";
+
+	$image			= imagecreate(64, 9);
+	$imagenum		= imagecreatefrompng("digits8.png");
+	$bg				= imagecolorallocate($image, 255, 0, 255);
+	$black			= imagecolorallocate($image,   0, 0, 0);
+
+	if ($left > 3600) {
+		$barcol			= imagecolorallocate($image, 100, 255, 100);
+	} elseif ($left >= 1800) {
+		$barcolr		= 50 + 205 * ($left / 1800);
+		$barcol			= imagecolorallocate($image, 100, 255, $barcolr);
+	} else {
+		$barcolg		= 0 + 255 * ($left / 1800 );
+		$barcol			= imagecolorallocate($image, 0, $barcolg, 255);
+		imagecolorset($imagenum, 2, $barcolg, $barcolg / 2 + 128, 255);
+		imagecolorset($imagenum, 3, 0, $barcolg / 4, $barcolg / 1.5);
+	}
+
+	imageline($image, $bpad + 1, 8, $barpct+1 + $bpad, 8, $black);
+	imageline($image, $bpad, 7, $barpct + $bpad, 7, $barcol);
+
+
+	$nums			= str_split($teststring);
+
+	$ofs			= 5;
+
+	foreach ($nums as $n) {
+
+		$of		= 6;
+
+		switch ($n) {
+			case ":":
+				$w	= 2;
+				$p	= 81;
+				$of	= 2;
+				break;
+			case "\"":
+				$w	= 4;
+				$p	= 77;
+				$of	= 4;
+				break;
+			case "'":
+				$w	= 2;
+				$p	= 77;
+				$of	= 2;
+				break;
+			case "o":
+				$w	= 7;
+				$p	= 70;
+				$of	= 7;
+				break;
+			case " ":
+				$w	= 0;
+				break;
+			default:
+				$w	= 7;
+				$p	= 7 * $n;
+				$of	= 7;
+				//$ofs++;
+				break;
+		}
+
+		if ($w) imagecopymerge($image, $imagenum, $ofs, 0, $p, 0, $w, 7, 100);
+		
+		$ofs	+= $of;
+	}
+
+	imagecolortransparent($image, $bg);
+	header("Content-type: image/png");
+	imagepng($image);
+	imagedestroy($image);
+	imagedestroy($imagenum);
+
+?>
\ No newline at end of file
diff --git a/numgfx.php b/numgfx.php
new file mode 100644
index 0000000..d504e83
--- /dev/null
+++ b/numgfx.php
@@ -0,0 +1,33 @@
+<?php
+$n = $_GET['n'];
+$l = $_GET['l'];
+$f = $_GET['f'];
+ $len=strlen($n .'');
+ if($len<$l){
+   $ofs=$l-$len;
+   $len=$l;
+ }
+ if(!$f) $f='numnes';
+ $gfx=ImageCreateFromPNG("numgfx/$f.png");
+ $img=ImageCreate($len*8,8);
+ ImageCopy($img,$gfx,0,0,104,0,1,1);
+ for($i=0;$i<$len;$i++){
+  switch($n[$i]){
+    case '/': $d=10; break;
+    case 'N': $d=11; break;
+    case 'A': $d=12; break;
+    case '-': $d=13; break;
+    default: $d=$n[$i];
+  }
+  ImageCopy($img,$gfx,($i+$ofs)*8,0,$d*8,0,8,8);
+ }
+ Header('Content-type:image/png');
+ if ($f == "numdeath") {
+	 $ctp	= 1;
+ } else {
+	 $ctp	= 0;
+ }
+ ImageColorTransparent($img,$ctp);
+ ImagePNG($img);
+ ImageDestroy($img);
+?>
\ No newline at end of file
diff --git a/numgfx/ccs/0.png b/numgfx/ccs/0.png
new file mode 100644
index 0000000..c0a49cc
Binary files /dev/null and b/numgfx/ccs/0.png differ
diff --git a/numgfx/ccs/1.png b/numgfx/ccs/1.png
new file mode 100644
index 0000000..b583911
Binary files /dev/null and b/numgfx/ccs/1.png differ
diff --git a/numgfx/ccs/2.png b/numgfx/ccs/2.png
new file mode 100644
index 0000000..9255790
Binary files /dev/null and b/numgfx/ccs/2.png differ
diff --git a/numgfx/ccs/3.png b/numgfx/ccs/3.png
new file mode 100644
index 0000000..b14d8f4
Binary files /dev/null and b/numgfx/ccs/3.png differ
diff --git a/numgfx/ccs/4.png b/numgfx/ccs/4.png
new file mode 100644
index 0000000..ee86c5c
Binary files /dev/null and b/numgfx/ccs/4.png differ
diff --git a/numgfx/ccs/5.png b/numgfx/ccs/5.png
new file mode 100644
index 0000000..bf617d2
Binary files /dev/null and b/numgfx/ccs/5.png differ
diff --git a/numgfx/ccs/6.png b/numgfx/ccs/6.png
new file mode 100644
index 0000000..e7cc6ac
Binary files /dev/null and b/numgfx/ccs/6.png differ
diff --git a/numgfx/ccs/7.png b/numgfx/ccs/7.png
new file mode 100644
index 0000000..c8cc40f
Binary files /dev/null and b/numgfx/ccs/7.png differ
diff --git a/numgfx/ccs/8.png b/numgfx/ccs/8.png
new file mode 100644
index 0000000..e968c38
Binary files /dev/null and b/numgfx/ccs/8.png differ
diff --git a/numgfx/ccs/9.png b/numgfx/ccs/9.png
new file mode 100644
index 0000000..f1b63c3
Binary files /dev/null and b/numgfx/ccs/9.png differ
diff --git a/numgfx/death/0.png b/numgfx/death/0.png
new file mode 100644
index 0000000..050597a
Binary files /dev/null and b/numgfx/death/0.png differ
diff --git a/numgfx/death/1.png b/numgfx/death/1.png
new file mode 100644
index 0000000..10684f9
Binary files /dev/null and b/numgfx/death/1.png differ
diff --git a/numgfx/death/2.png b/numgfx/death/2.png
new file mode 100644
index 0000000..1fd549b
Binary files /dev/null and b/numgfx/death/2.png differ
diff --git a/numgfx/death/3.png b/numgfx/death/3.png
new file mode 100644
index 0000000..497e471
Binary files /dev/null and b/numgfx/death/3.png differ
diff --git a/numgfx/death/4.png b/numgfx/death/4.png
new file mode 100644
index 0000000..406d608
Binary files /dev/null and b/numgfx/death/4.png differ
diff --git a/numgfx/death/5.png b/numgfx/death/5.png
new file mode 100644
index 0000000..e736e8b
Binary files /dev/null and b/numgfx/death/5.png differ
diff --git a/numgfx/death/6.png b/numgfx/death/6.png
new file mode 100644
index 0000000..00a847f
Binary files /dev/null and b/numgfx/death/6.png differ
diff --git a/numgfx/death/7.png b/numgfx/death/7.png
new file mode 100644
index 0000000..0df142f
Binary files /dev/null and b/numgfx/death/7.png differ
diff --git a/numgfx/death/8.png b/numgfx/death/8.png
new file mode 100644
index 0000000..6de000b
Binary files /dev/null and b/numgfx/death/8.png differ
diff --git a/numgfx/death/9.png b/numgfx/death/9.png
new file mode 100644
index 0000000..6ffa95f
Binary files /dev/null and b/numgfx/death/9.png differ
diff --git a/numgfx/jul/0.png b/numgfx/jul/0.png
new file mode 100644
index 0000000..ec2a557
Binary files /dev/null and b/numgfx/jul/0.png differ
diff --git a/numgfx/jul/1.png b/numgfx/jul/1.png
new file mode 100644
index 0000000..1c2ab91
Binary files /dev/null and b/numgfx/jul/1.png differ
diff --git a/numgfx/jul/2.png b/numgfx/jul/2.png
new file mode 100644
index 0000000..d5362bd
Binary files /dev/null and b/numgfx/jul/2.png differ
diff --git a/numgfx/jul/3.png b/numgfx/jul/3.png
new file mode 100644
index 0000000..79500c3
Binary files /dev/null and b/numgfx/jul/3.png differ
diff --git a/numgfx/jul/4.png b/numgfx/jul/4.png
new file mode 100644
index 0000000..96aed28
Binary files /dev/null and b/numgfx/jul/4.png differ
diff --git a/numgfx/jul/5.png b/numgfx/jul/5.png
new file mode 100644
index 0000000..63b533f
Binary files /dev/null and b/numgfx/jul/5.png differ
diff --git a/numgfx/jul/6.png b/numgfx/jul/6.png
new file mode 100644
index 0000000..0e9a8e5
Binary files /dev/null and b/numgfx/jul/6.png differ
diff --git a/numgfx/jul/7.png b/numgfx/jul/7.png
new file mode 100644
index 0000000..7b2b17e
Binary files /dev/null and b/numgfx/jul/7.png differ
diff --git a/numgfx/jul/8.png b/numgfx/jul/8.png
new file mode 100644
index 0000000..029b65c
Binary files /dev/null and b/numgfx/jul/8.png differ
diff --git a/numgfx/jul/9.png b/numgfx/jul/9.png
new file mode 100644
index 0000000..b22b3e5
Binary files /dev/null and b/numgfx/jul/9.png differ
diff --git a/numgfx/num2/0.png b/numgfx/num2/0.png
new file mode 100644
index 0000000..58dd832
Binary files /dev/null and b/numgfx/num2/0.png differ
diff --git a/numgfx/num2/1.png b/numgfx/num2/1.png
new file mode 100644
index 0000000..2de42d6
Binary files /dev/null and b/numgfx/num2/1.png differ
diff --git a/numgfx/num2/2.png b/numgfx/num2/2.png
new file mode 100644
index 0000000..458b92e
Binary files /dev/null and b/numgfx/num2/2.png differ
diff --git a/numgfx/num2/3.png b/numgfx/num2/3.png
new file mode 100644
index 0000000..ec79c6c
Binary files /dev/null and b/numgfx/num2/3.png differ
diff --git a/numgfx/num2/4.png b/numgfx/num2/4.png
new file mode 100644
index 0000000..3e78005
Binary files /dev/null and b/numgfx/num2/4.png differ
diff --git a/numgfx/num2/5.png b/numgfx/num2/5.png
new file mode 100644
index 0000000..adb0299
Binary files /dev/null and b/numgfx/num2/5.png differ
diff --git a/numgfx/num2/6.png b/numgfx/num2/6.png
new file mode 100644
index 0000000..da4fcf1
Binary files /dev/null and b/numgfx/num2/6.png differ
diff --git a/numgfx/num2/7.png b/numgfx/num2/7.png
new file mode 100644
index 0000000..4fee76d
Binary files /dev/null and b/numgfx/num2/7.png differ
diff --git a/numgfx/num2/8.png b/numgfx/num2/8.png
new file mode 100644
index 0000000..a113ba1
Binary files /dev/null and b/numgfx/num2/8.png differ
diff --git a/numgfx/num2/9.png b/numgfx/num2/9.png
new file mode 100644
index 0000000..47c2a7a
Binary files /dev/null and b/numgfx/num2/9.png differ
diff --git a/numgfx/num2/A.png b/numgfx/num2/A.png
new file mode 100644
index 0000000..ca3ea2c
Binary files /dev/null and b/numgfx/num2/A.png differ
diff --git a/numgfx/num2/Dash.png b/numgfx/num2/Dash.png
new file mode 100644
index 0000000..f42c521
Binary files /dev/null and b/numgfx/num2/Dash.png differ
diff --git a/numgfx/num2/N.png b/numgfx/num2/N.png
new file mode 100644
index 0000000..1ed610e
Binary files /dev/null and b/numgfx/num2/N.png differ
diff --git a/numgfx/num2/Slash.png b/numgfx/num2/Slash.png
new file mode 100644
index 0000000..c5de970
Binary files /dev/null and b/numgfx/num2/Slash.png differ
diff --git a/numgfx/num3/-.png b/numgfx/num3/-.png
new file mode 100644
index 0000000..96a6daf
Binary files /dev/null and b/numgfx/num3/-.png differ
diff --git a/numgfx/num3/0.png b/numgfx/num3/0.png
new file mode 100644
index 0000000..8eda8b0
Binary files /dev/null and b/numgfx/num3/0.png differ
diff --git a/numgfx/num3/1.png b/numgfx/num3/1.png
new file mode 100644
index 0000000..7292ee2
Binary files /dev/null and b/numgfx/num3/1.png differ
diff --git a/numgfx/num3/2.png b/numgfx/num3/2.png
new file mode 100644
index 0000000..78d6a31
Binary files /dev/null and b/numgfx/num3/2.png differ
diff --git a/numgfx/num3/3.png b/numgfx/num3/3.png
new file mode 100644
index 0000000..8feda42
Binary files /dev/null and b/numgfx/num3/3.png differ
diff --git a/numgfx/num3/4.png b/numgfx/num3/4.png
new file mode 100644
index 0000000..2d5467f
Binary files /dev/null and b/numgfx/num3/4.png differ
diff --git a/numgfx/num3/5.png b/numgfx/num3/5.png
new file mode 100644
index 0000000..9a4a614
Binary files /dev/null and b/numgfx/num3/5.png differ
diff --git a/numgfx/num3/6.png b/numgfx/num3/6.png
new file mode 100644
index 0000000..4badc8b
Binary files /dev/null and b/numgfx/num3/6.png differ
diff --git a/numgfx/num3/7.png b/numgfx/num3/7.png
new file mode 100644
index 0000000..67b8637
Binary files /dev/null and b/numgfx/num3/7.png differ
diff --git a/numgfx/num3/8.png b/numgfx/num3/8.png
new file mode 100644
index 0000000..e7a2f90
Binary files /dev/null and b/numgfx/num3/8.png differ
diff --git a/numgfx/num3/9.png b/numgfx/num3/9.png
new file mode 100644
index 0000000..848e75c
Binary files /dev/null and b/numgfx/num3/9.png differ
diff --git a/numgfx/num3/A.png b/numgfx/num3/A.png
new file mode 100644
index 0000000..dd066d5
Binary files /dev/null and b/numgfx/num3/A.png differ
diff --git a/numgfx/num3/N.png b/numgfx/num3/N.png
new file mode 100644
index 0000000..dc8417c
Binary files /dev/null and b/numgfx/num3/N.png differ
diff --git a/numgfx/num3/bar-off.png b/numgfx/num3/bar-off.png
new file mode 100644
index 0000000..c3f9334
Binary files /dev/null and b/numgfx/num3/bar-off.png differ
diff --git a/numgfx/num3/bar-on.png b/numgfx/num3/bar-on.png
new file mode 100644
index 0000000..92a3435
Binary files /dev/null and b/numgfx/num3/bar-on.png differ
diff --git a/numgfx/num3/barleft.png b/numgfx/num3/barleft.png
new file mode 100644
index 0000000..fff8586
Binary files /dev/null and b/numgfx/num3/barleft.png differ
diff --git a/numgfx/num3/barright.png b/numgfx/num3/barright.png
new file mode 100644
index 0000000..9e54ae9
Binary files /dev/null and b/numgfx/num3/barright.png differ
diff --git a/numgfx/num3/exp.png b/numgfx/num3/exp.png
new file mode 100644
index 0000000..a3abb0f
Binary files /dev/null and b/numgfx/num3/exp.png differ
diff --git a/numgfx/num3/fornext.png b/numgfx/num3/fornext.png
new file mode 100644
index 0000000..c2a170a
Binary files /dev/null and b/numgfx/num3/fornext.png differ
diff --git a/numgfx/num3/level.png b/numgfx/num3/level.png
new file mode 100644
index 0000000..6e95d3a
Binary files /dev/null and b/numgfx/num3/level.png differ
diff --git a/numgfx/num3/posts.png b/numgfx/num3/posts.png
new file mode 100644
index 0000000..83e592e
Binary files /dev/null and b/numgfx/num3/posts.png differ
diff --git a/numgfx/num3/slash.png b/numgfx/num3/slash.png
new file mode 100644
index 0000000..ae7f6be
Binary files /dev/null and b/numgfx/num3/slash.png differ
diff --git a/numgfx/numbloodlust.png b/numgfx/numbloodlust.png
new file mode 100644
index 0000000..0a19061
Binary files /dev/null and b/numgfx/numbloodlust.png differ
diff --git a/numgfx/numcircuit.png b/numgfx/numcircuit.png
new file mode 100644
index 0000000..a3a5d55
Binary files /dev/null and b/numgfx/numcircuit.png differ
diff --git a/numgfx/numdani.png b/numgfx/numdani.png
new file mode 100644
index 0000000..19d27c0
Binary files /dev/null and b/numgfx/numdani.png differ
diff --git a/numgfx/numdeath.png b/numgfx/numdeath.png
new file mode 100644
index 0000000..832848d
Binary files /dev/null and b/numgfx/numdeath.png differ
diff --git a/numgfx/numkafuka.png b/numgfx/numkafuka.png
new file mode 100644
index 0000000..10fe674
Binary files /dev/null and b/numgfx/numkafuka.png differ
diff --git a/numgfx/nummario.png b/numgfx/nummario.png
new file mode 100644
index 0000000..0535e73
Binary files /dev/null and b/numgfx/nummario.png differ
diff --git a/numgfx/nummegaman.png b/numgfx/nummegaman.png
new file mode 100644
index 0000000..cda2d04
Binary files /dev/null and b/numgfx/nummegaman.png differ
diff --git a/numgfx/numnes.png b/numgfx/numnes.png
new file mode 100644
index 0000000..78add82
Binary files /dev/null and b/numgfx/numnes.png differ
diff --git a/numgfx/numnes8bit.png b/numgfx/numnes8bit.png
new file mode 100644
index 0000000..56b777b
Binary files /dev/null and b/numgfx/numnes8bit.png differ
diff --git a/numgfx/numpurple.png b/numgfx/numpurple.png
new file mode 100644
index 0000000..bd40ff4
Binary files /dev/null and b/numgfx/numpurple.png differ
diff --git a/numgfx/numxmas.png b/numgfx/numxmas.png
new file mode 100644
index 0000000..452ba02
Binary files /dev/null and b/numgfx/numxmas.png differ
diff --git a/numgfx/red.gif b/numgfx/red.gif
new file mode 100644
index 0000000..2b61d73
Binary files /dev/null and b/numgfx/red.gif differ
diff --git a/numgfx/ymar/0.png b/numgfx/ymar/0.png
new file mode 100644
index 0000000..bde8a66
Binary files /dev/null and b/numgfx/ymar/0.png differ
diff --git a/numgfx/ymar/1.png b/numgfx/ymar/1.png
new file mode 100644
index 0000000..0161767
Binary files /dev/null and b/numgfx/ymar/1.png differ
diff --git a/numgfx/ymar/2.png b/numgfx/ymar/2.png
new file mode 100644
index 0000000..b7288e3
Binary files /dev/null and b/numgfx/ymar/2.png differ
diff --git a/numgfx/ymar/3.png b/numgfx/ymar/3.png
new file mode 100644
index 0000000..c4ac51b
Binary files /dev/null and b/numgfx/ymar/3.png differ
diff --git a/numgfx/ymar/4.png b/numgfx/ymar/4.png
new file mode 100644
index 0000000..69b6c12
Binary files /dev/null and b/numgfx/ymar/4.png differ
diff --git a/numgfx/ymar/5.png b/numgfx/ymar/5.png
new file mode 100644
index 0000000..4bf611a
Binary files /dev/null and b/numgfx/ymar/5.png differ
diff --git a/numgfx/ymar/6.png b/numgfx/ymar/6.png
new file mode 100644
index 0000000..c6ffd18
Binary files /dev/null and b/numgfx/ymar/6.png differ
diff --git a/numgfx/ymar/7.png b/numgfx/ymar/7.png
new file mode 100644
index 0000000..686bfd3
Binary files /dev/null and b/numgfx/ymar/7.png differ
diff --git a/numgfx/ymar/8.png b/numgfx/ymar/8.png
new file mode 100644
index 0000000..c68940d
Binary files /dev/null and b/numgfx/ymar/8.png differ
diff --git a/numgfx/ymar/9.png b/numgfx/ymar/9.png
new file mode 100644
index 0000000..afa483e
Binary files /dev/null and b/numgfx/ymar/9.png differ
diff --git a/numgfxbig.php b/numgfxbig.php
new file mode 100644
index 0000000..b3fe6f2
--- /dev/null
+++ b/numgfxbig.php
@@ -0,0 +1,34 @@
+<?php
+
+	$n	= intval($_GET['n']) ."";
+	$l	= intval($_GET['l']);
+	$p	= 0;
+
+	if ($_GET['z']) {
+		$n	= str_pad($n, $l, "0", STR_PAD_LEFT);
+	}
+
+	if (strlen($n) > $l) $l = strlen($n);
+	elseif (strlen($n) < $l) $p = $l - strlen($n);
+
+	$img	= imagecreate(26 * $l, 28);
+	$bg		= imagecolorallocate($img, 5, 5, 5);
+	$num	= imagecreatefrompng("digits.png");
+	$o		= $p;
+
+	$na		= str_split($n);
+	foreach ($na as $x) {
+		$x	= intval($x);
+		$y	= floor($x / 5) * 28;
+		$x	= ($x % 5) * 26;
+		
+		imagecopy($img, $num, $o * 26, 0, $x, $y, 26, 28);
+		$o++;
+	}
+	
+	imagecolortransparent($img, $bg);
+	header("Content-type: image/png");
+	imagepng($img);
+	imagedestroy($img);
+	imagedestroy($num);
+
diff --git a/online.php b/online.php
new file mode 100644
index 0000000..17b6b01
--- /dev/null
+++ b/online.php
@@ -0,0 +1,165 @@
+<?php
+	require 'lib/function.php';
+
+	$windowtitle = "$boardname -- Online users";
+	require 'lib/layout.php';
+
+/*
+	if (empty($_COOKIE) && $_SERVER['HTTP_REFERER'] == "http://jul.rustedlogic.net/") {
+		// Some lame botnet that keeps refreshing this page every second or so.
+		xk_ircsend("102|". date("Y-m-d h:i:s") ." - ".xk(7)."IP address ". xk(8) . $_SERVER['REMOTE_ADDR'] . xk(7) ." is being weird. ". xk(5) ."(UA: ". $_SERVER['HTTP_USER_AGENT'] .")");
+		header("Location: http://". $_SERVER['REMOTE_ADDR'] ."/");
+		die("Fuck off, forever.");
+	}
+	if (empty($_COOKIE)) {
+		// Some lame botnet that keeps refreshing this page every second or so.
+		xk_ircsend("102|". date("Y-m-d h:i:s") ." - ".xk(7)."IP address ". xk(8) . $_SERVER['REMOTE_ADDR'] . xk(7) ." is being slightly less weird, but still weird. ". xk(5) ."(UA: ". $_SERVER['HTTP_USER_AGENT'] .")");
+		header("Location: http://". $_SERVER['REMOTE_ADDR'] ."/");
+		die("Don't be weird.");
+	}
+*/
+
+	if ($time = intval($_GET['time']));
+	else $time = 300;
+
+	// FOR THE LOVE OF GOD XKEEPER JUST GIVE ME ~NUKE ACCESS
+	$banorama	= ($_SERVER['REMOTE_ADDR'] == $x_hacks['adminip'] || $loguser['id'] == 1 || $loguser['id'] == 5 || $loguser['id'] == 2100);
+
+	if ($_GET['banip'] && $_GET['valid'] == md5($_GET['banip'] . "aglkdgslhkadgshlkgds") && $banorama) {
+		$sql->query("INSERT INTO `ipbans` SET `ip` = '". $_GET['banip'] ."', `reason`='online.php ban', `date` = '". ctime() ."', `banner` = '$loguserid'") or print mysql_error();
+//		if ($_GET['uid']) mysql_query("UPDATE `users` SET `powerlevel` = -1, `title` = 'Banned; account hijacked. Contact admin via PM to change it.' WHERE `id` = '". $_GET['uid'] ."'") or print mysql_error();
+		xk_ircsend("1|". xk(8) . $loguser['name'] . xk(7) ." added IP ban for ". xk(8) . $_GET['banip'] . xk(7) .".");
+		return header("Location: online.php?m=1");
+	}
+
+  //$server=getenv('SERVER_NAME');
+  //$port=getenv('SERVER_PORT');
+  //$host=$server;
+
+	$lnk='<a href=online.php?'.($sort?"sort=$sort&":'').'time';
+	print "
+		$header$smallfont
+		Timeframe:
+		$lnk=60>Last minute</a> |
+		$lnk=300>Last 5 minutes</a> |
+		$lnk=900>Last 15 minutes</a> |
+		$lnk=3600>Last hour</a> |
+		$lnk=86400>Last day</a>
+	";
+	if($isadmin)
+		print '<br>Admin cruft: <a href=online.php?'.($sort=='IP'?'':'sort=IP&')."time=$time>Sort by ".($sort=='IP'?'date':'IP')."</a>";
+
+	// Logged in users
+	$posters = $sql->query("SELECT id,posts,name,sex,powerlevel,aka,lastactivity,lastip,lastposttime,lasturl FROM users WHERE lastactivity>".(ctime()-$time).' ORDER BY '.($sort=='IP'&&$isadmin?'lastip':'lastactivity DESC'));
+
+	print "<br>
+	$fonttag Online users during the last ".timeunits2($time).":
+	$tblstart
+		$tccellh width=20>&nbsp</td>
+		$tccellh width=200>Username</td>
+		$tccellh width=120> Last activity</td>
+		$tccellh width=180> Last post</td>
+		$tccellh width=*>URL</td>
+	";
+	if($isadmin) print "$tccellh width=120>IP address</td>";
+	print "$tccellh width=60> Posts</tr>";
+
+	for ($i=1; $user=$sql->fetch($posters); $i++) {
+		$userlink = getuserlink($user);
+		if(!$user['posts']) $user['lastposttime'] = getblankdate();
+		else                $user['lastposttime'] = date($dateformat,$user['lastposttime']+$tzoff);
+
+		$user['lasturl']=str_replace('<','&lt;',$user['lasturl']);
+		$user['lasturl']=str_replace('>','&gt;',$user['lasturl']);
+		$user['lasturl']=str_replace('%20',' ',$user['lasturl']);
+		$user['lasturl']=str_replace('shoph','shop',$user['lasturl']);
+		$user['lasturl']=preg_replace('/[\?\&]debugsql(|=[0-9]+)/i','',$user['lasturl']); // let's not give idiots any ideas
+		$lasturltd	= "$tccell2l><a rel=\"nofollow\" href=\"". urlformat($user['lasturl']) ."\">$user[lasturl]";
+
+		if (substr($user['lasturl'], -11) =='(IP banned)')
+			$lasturltd	= "$tccell2l><a rel=\"nofollow\" href=\"". substr($user['lasturl'], 0, -12) ."\">". substr($user[lasturl], 0, -12) ."</a> (IP banned)";
+		elseif (substr($user['lasturl'], -11) =='(Tor proxy)')
+			$lasturltd	= "$tccell2l><a rel=\"nofollow\" href=\"". substr($user['lasturl'], 0, -12) ."\">". substr($user[lasturl], 0, -12) ."</a> (Tor proxy)";
+
+		print "<tr style=\"height:24px;\">
+			$tccell1>$i</td>
+			$tccell2l>{$userlink}</td>
+			$tccell1>".date('h:i:s A',$user['lastactivity']+$tzoff)."</td>
+			$tccell1>$user[lastposttime]</td>
+			$lasturltd</td>";
+
+		if ($banorama)
+			$ipban	= "$smallfont<br>[<a href=?banip=$user[lastip]&uid=$user[id]&valid=". md5($user['lastip'] . "aglkdgslhkadgshlkgds") .">Ban</a> - <a href=http://google.com/search?q=$user[lastip]>G</a>]</font>";
+
+		if($isadmin)
+			print "$tccell1><a href=ipsearch.php?ip=$user[lastip]>$user[lastip]</a> $ipban</td>";
+//		$tccell1r>". $user['ipmatches'] ." <img src='". ($user['ipmatches'] > 0 ? "images/dot2.gif" : "images/dot5.gif") ."' align='absmiddle'></td>";
+
+		print "$tccell2>$user[posts]</tr>";
+	}
+
+	//WHERE date>'.(ctime()-$time).'
+	$guests = $sql->query('SELECT *, (SELECT COUNT(`ip`) FROM `ipbans` WHERE `ip` = `guests`.`ip`) AS banned FROM guests ORDER BY '.($sort=='IP'&&$isadmin?'ip':'date').' DESC');
+
+	print "
+		$tblend
+		$fonttag<br>Guests online in the past 5 min.:
+		$tblstart<tr>
+		$tccellh width=20>&nbsp</td>
+		$tccellh width=300>&nbsp</td>
+		$tccellh width=120>Last activity</td>
+		$tccellh width=*>URL</td>
+	";
+	if($isadmin) print "$tccellh width=120> IP address</td>";
+	print '</tr>';
+
+	for($i=1;$guest=$sql->fetch($guests);$i++){
+		$guest['lasturl']=str_replace('<','&lt;',$guest['lasturl']);
+		$guest['lasturl']=str_replace('>','&gt;',$guest['lasturl']);
+		$guest['lasturl']=str_replace('shoph','shop',$guest['lasturl']);
+		$guest['lasturl']=preg_replace('/[\?\&]debugsql=[0-9]+/i','',$guest['lasturl']); // let's not give idiots any ideas
+
+/*		if ($guest['useragent'] == "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.19) Gecko/2010031218 Firefox/3.0.19" && $banorama) {
+//		if (stripos($guest['useragent'], "robot") !== false && $banorama)
+			$marker	= " style='color: #f88;'";
+		else
+			$marker	= "";
+*/
+
+		$marker = '';
+
+		$lasturltd	= "$tccell2l$marker><a rel=\"nofollow\" href=\"". urlformat($guest['lasturl']) ."\">$guest[lasturl]";
+		if (substr($guest['lasturl'], -11) =='(IP banned)')
+			$lasturltd	= "$tccell2l$marker><a rel=\"nofollow\" href=\"". substr($guest['lasturl'], 0, -12) ."\">". substr($guest['lasturl'], 0, -12) ."</a> (IP banned)";
+		elseif (substr($guest['lasturl'], -11) =='(Tor proxy)')
+			$lasturltd	= "$tccell2l$marker><a rel=\"nofollow\" href=\"". substr($guest['lasturl'], 0, -12) ."\">". substr($guest['lasturl'], 0, -12) ."</a> (Tor proxy)";
+
+
+		print "<tr style=\"height:40px;\">
+			$tccell1$marker>$i</td>
+			$tccell2s$marker>". htmlspecialchars($guest['useragent']) ."</td>
+			$tccell1$marker>".date('h:i:s A',$guest['date']+$tzoff)."</td>
+			$lasturltd</td>";
+
+
+		if ($banorama && !$guest['banned'])
+			$ipban	= "<a href=?banip=$guest[ip]&valid=". md5($guest['ip'] . "aglkdgslhkadgshlkgds") .">Ban</a> - ";
+		elseif ($guest['banned'])
+		 	$ipban	= "<span style='color: #f88; font-weight: bold;'>Banned</span> - ";
+		else
+			$ipban	= "";
+
+		if($isadmin)
+			print "</td>$tccell1$marker>
+			<a href=ipsearch.php?ip=$guest[ip]>$guest[ip]</a>$smallfont
+			<br>[$ipban<a href=http://google.com/search?q=$guest[ip]>G</a>-<a href=http://en.wikipedia.org/wiki/User:$guest[ip]>W</a>-<a href=http://$guest[ip]/>H</a>]</a></font>";
+  
+		print "</tr>";
+	}
+
+	print $tblend.$footer;
+	printtimedif($startingtime);
+
+	function urlformat($url) {
+		return preg_replace("/^\/thread\.php\?pid=([0-9]+)$/", "/thread.php?pid=\\1#\\1", $url);
+	}
\ No newline at end of file
diff --git a/perfdata.php b/perfdata.php
new file mode 100644
index 0000000..266e5e5
--- /dev/null
+++ b/perfdata.php
@@ -0,0 +1,11 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/layout.php';
+	if (!$isadmin) { die(); }
+	print "$header<br>";
+	
+	print adminlinkbar("perfdata.php");
+	
+	
+	
+	
\ No newline at end of file
diff --git a/posticons.dat b/posticons.dat
new file mode 100644
index 0000000..d98e331
--- /dev/null
+++ b/posticons.dat
@@ -0,0 +1,30 @@
+images/icons/icon1.gif
+images/icons/icon2.gif
+images/icons/icon3.gif
+images/icons/icon4.gif
+images/icons/icon5.gif
+images/icons/icon13.gif
+images/icons/icon14.gif
+images/coin.gif
+images/coin2.gif
+images/smilies/baby.gif
+images/smilies/smile.gif
+images/smilies/wink.gif
+images/smilies/biggrin.gif
+images/smilies/cute.gif
+images/smilies/glasses.gif
+images/smilies/mad.gif
+images/smilies/frown.gif
+images/smilies/yuck.gif
+images/smilies/sick.gif
+images/smilies/wobbly.gif
+images/smilies/eek.gif
+images/smilies/blank.gif
+images/smilies/jawdrop.gif
+images/smilies/bigeyes.gif
+images/smilies/tongue.gif
+images/smilies/vamp.gif
+images/smilies/dizzy.gif
+images/smilies/eyeshift.gif
+images/smilies/shiftleft.gif
+images/smilies/shiftright.gif
\ No newline at end of file
diff --git a/postradar.php b/postradar.php
new file mode 100644
index 0000000..c1db8ab
--- /dev/null
+++ b/postradar.php
@@ -0,0 +1,86 @@
+<?php
+  require 'lib/function.php';
+  
+  $windowtitle = "Editing Post Radar";
+
+  if (!$log) {
+		require 'lib/layout.php';
+
+		print "$header
+		<br>$tblstart$tccell1>You must be logged in to edit your post radar.<br>
+		".redirect('index.php','return to the board',0).$tblend.$footer;
+
+		printtimedif($startingtime);
+		die();
+  }
+
+  // Login confirmed from here on out
+	// Changes above form to save a redirect
+	if ($_POST['action'] == 'dochanges') {
+		$user = $sql->resultq("SELECT name FROM users WHERE id=$loguserid");
+		if ($rem) $sql->query("DELETE FROM postradar WHERE user=$loguserid and comp=". intval($rem) ."");
+		if ($add) $sql->query("INSERT INTO postradar (user,comp) VALUES ($loguserid,". intval($add) .")");
+		if ($submit2) {
+			require 'lib/layout.php';
+
+			print "$header
+			<br>$tblstart$tccell1>Thank you, $user, for editing your post radar.<br>
+			".redirect('index.php','return to the board',0).$tblend.$footer;
+
+			printtimedif($startingtime);
+			die();
+		}
+	}
+
+	// Form
+	// Include layout now so post radar on top of page is properly updated
+	require 'lib/layout.php';
+
+	// Deletions before additions
+	$users1 = $sql->query("SELECT p.comp, u.name, u.posts FROM postradar p, users u WHERE u.id=p.comp AND user=$loguserid");
+
+	while($user = $sql->fetch($users1)){
+		$remlist.="<option value=$user[comp]>$user[name] -- $user[posts] posts";
+		$idlist[] = $user['comp'];
+	}
+	$remlist="
+		<select name=rem>
+		<option value=0 selected>Do not remove anyone
+		$remlist
+		</select>";
+
+	// Remove those already added
+	if (count($idlist))
+		$qwhere = "AND id NOT IN (". implode(",", $idlist).")";
+	else $qwhere = '';
+
+  // Additions
+	$users1 = $sql->query("SELECT id,name,posts FROM users WHERE posts > 0 {$qwhere} ORDER BY name");
+
+	while($user = $sql->fetch($users1)){
+		$addlist.="<option value=$user[id]>$user[name] -- $user[posts] posts";
+	}
+
+	$addlist="
+	<select name=add>
+	<option value=0 selected>Do not add anyone
+	$addlist
+	</select>";
+
+	$prtable="
+		$tccellh>&nbsp</td>$tccellh>&nbsp<tr>
+		$tccell1><b>Add an user</td>$tccell2l>$addlist<tr>
+		$tccell1><b>Remove an user</td>$tccell2l>$remlist<tr>
+		$tccellh>&nbsp</td>$tccellh>&nbsp<tr>
+		$tccell1>&nbsp</td>$tccell2l>
+		$inph=action VALUE=dochanges>
+		$inph=userpass VALUE=\"$user[password]\">
+		$inps=submit1 VALUE=\"Submit and continue\">
+		$inps=submit2 VALUE=\"Submit and finish\"></td></FORM>
+    ";
+
+	print "$header<br>
+	<FORM ACTION=postradar.php NAME=REPLIER METHOD=POST>
+	$tblstart$prtable$tblend$footer";
+	printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/postsbyforum.php b/postsbyforum.php
new file mode 100644
index 0000000..353ef1a
--- /dev/null
+++ b/postsbyforum.php
@@ -0,0 +1,79 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/layout.php';
+
+	$qstrings = array();
+
+	if ($id) {
+		$qstrings[] = "posts.user={$id}";
+		$by = 'by '.$sql->resultq("SELECT name FROM users WHERE id={$id}");
+	}
+
+	if (!isset($_GET['posttime'])) $posttime = 86400;
+	else $posttime = intval($_GET['posttime']);
+	if (($posttime === 0 || $posttime > 2592000) && !$id)
+		$posttime = 2592000;
+
+	if ($posttime !== 0) {
+		$qstrings[] = "posts.date > ".(ctime()-$posttime);
+		$during = ' during the last '.timeunits2($posttime);
+	}
+
+	if (empty($qstrings)) $qwhere = '1';
+	else $qwhere = implode(' AND ', $qstrings);
+
+	$posters = $sql->query(
+		"SELECT forums.*,COUNT(posts.id) AS cnt ".
+		"FROM forums,threads,posts ".
+		"WHERE posts.thread=threads.id ".
+		"AND threads.forum=forums.id ".
+		"AND {$qwhere} ".
+		"GROUP BY forums.id ORDER BY cnt DESC");
+
+	$userposts = $sql->resultq("SELECT COUNT(*) FROM posts WHERE $qwhere");
+	$lnk="<a href=postsbyforum.php?id=$id&posttime";
+
+	print "$header
+		$smallfont
+		$lnk=3600>During last hour</a> |
+		$lnk=86400>During last day</a> |
+		$lnk=604800>During last week</a> |
+		$lnk=2592000>During last 30 days</a>".
+		((!$id) ? "" : " | $lnk=0>Total</a>").
+		"<br>
+		$fonttag Posts $by in forums$during:
+		$tblstart<tr>
+		$tccellh width=20>&nbsp</td>
+		$tccellh width=100>&nbsp</td>
+		$tccellh>Forum</td>
+		$tccellh width=60>Posts</td>
+		$tccellh width=80>Forum total</td></tr>
+	";
+
+	for ($i=1;$f=$sql->fetch($posters);$i++) {
+		print '<tr>';
+
+		if($f['minpower']>$power) {
+			$link="(restricted)";
+			$viewall="(<s><b>view</b></s>)";
+		}
+		else {
+			$link="<a href='forum.php?id=$f[id]'>$f[title]</a>";
+			$timeid = (($posttime !== 0) ? "&time={$posttime}" : '');
+			$viewall="(<a href='postsbyuser.php?id={$id}&forum={$f['id']}{$timeid}'>View</a>)";
+		}
+
+   if (!$id) $viewall = '';
+
+		print "
+			$tccell2>$i</td>
+			$tccell2>$viewall</td>
+			$tccell1l>$link</td>
+			$tccell1><b>$f[cnt]</td>
+			$tccell1>$f[numposts]</td></tr>
+		";
+	}
+
+	print "$tblend Total: $userposts posts$footer";
+	printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/postsbythread.php b/postsbythread.php
new file mode 100644
index 0000000..9cde7fd
--- /dev/null
+++ b/postsbythread.php
@@ -0,0 +1,71 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/layout.php';
+
+	$qstrings = array();
+
+	if ($id) {
+		$qstrings[] = "p.user={$id}";
+		$by = 'by '.$sql->resultq("SELECT name FROM users WHERE id={$id}");
+	}
+
+	if (!isset($_GET['posttime'])) $posttime = 86400;
+	else $posttime = intval($_GET['posttime']);
+	if (($posttime === 0 || $posttime > 2592000) && !$id)
+		$posttime = 2592000;
+
+	if ($posttime !== 0) {
+		$qstrings[] = "p.date > ".(ctime()-$posttime);
+		$during = ' during the last '.timeunits2($posttime);
+	}
+
+	if (empty($qstrings)) $qwhere = '1';
+	else $qwhere = implode(' AND ', $qstrings);
+
+	$posters = $sql->query(
+		"SELECT t.id,t.replies,t.title,t.forum,f.minpower,f.title ftitle,COUNT(p.id) cnt " .
+		"FROM threads t,posts p,forums f " .
+		"WHERE p.thread=t.id AND t.forum=f.id AND $qwhere " .
+		"GROUP BY t.id ORDER BY cnt DESC,t.firstpostdate DESC LIMIT 1000");
+
+	$lnk="<a href=postsbythread.php?id=$id&posttime";
+
+	print "$header$smallfont
+		$lnk=3600>During last hour</a> |
+		$lnk=86400>During last day</a> |
+		$lnk=604800>During last week</a> |
+		$lnk=2592000>During last 30 days</a>".
+		((!$id) ? "" : " | $lnk=0>Total</a>").
+		"<br>
+		$fonttag Posts $by in threads$during:
+		$tblstart
+		$tccellh width=30>&nbsp</td>
+		$tccellh width=300>Forum</td>
+		$tccellh>Thread</td>
+		$tccellh width=70>Posts</td>
+		$tccellh width=90>Thread total
+	";
+
+	for($i=1;$t=$sql->fetch($posters);$i++) {
+		$t['title'] = str_replace(array('<', '>'), array('&lt;', '&gt;'), $t['title']);
+
+		if($t['minpower']>$power && $t['minpower']>0) {
+			$forum  = '(restricted forum)';
+			$thread = '(private thread)';
+		}
+		else {
+			$forum  = "<a href='forum.php?id={$t['forum']}'>{$t['ftitle']}</a>";
+			$thread = "<a href='thread.php?id={$t['id']}'>{$t['title']}</a>";
+		}
+
+		print "<tr>
+			$tccell2>$i</td>
+			$tccell2>{$forum}</td>
+			$tccell1l>{$thread}</td>
+			$tccell1 style='font-weight:bold;'>$t[cnt]</td>
+			$tccell1>".($t['replies']+1)."</td></tr>";
+	}
+
+	print $tblend.$footer;
+	printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/postsbytime.php b/postsbytime.php
new file mode 100644
index 0000000..9747183
--- /dev/null
+++ b/postsbytime.php
@@ -0,0 +1,57 @@
+<?php
+	require 'lib/function.php';
+	$windowtitle = "Posts by time of day";
+	require 'lib/layout.php';
+
+	if (!isset($_GET['posttime'])) $posttime = 86400;
+	else $posttime = intval($_GET['posttime']);
+
+	if($id) {
+		$qstrings[] = "user={$id}";
+		$from = " from ".$sql->resultq("SELECT name FROM users WHERE id=$id");
+	}
+	else $from = ' on the board';
+
+	if ($posttime !== 0) {
+		$qstrings[] = "date > ".(ctime()-$posttime);
+		$during = ' during the last '.timeunits2($posttime);
+	}
+
+	if (empty($qstrings)) $qwhere = '1';
+	else $qwhere = implode(' AND ', $qstrings);
+
+	$posts = $sql->query("SELECT count(*) AS cnt, FROM_UNIXTIME(date,'%k') AS hour FROM posts WHERE {$qwhere} GROUP BY hour");
+	$link = "<a href=postsbytime.php?" . (($id) ? "id=$id&" : "") . "posttime";
+	print "$header$smallfont
+		Timeframe:
+		$link=86400>Last day</a> |
+		$link=604800>Last week</a> |
+		$link=2592000>Last 30 days</a> |
+		$link=31536000>Last year</a> |
+		$link=0>All-time</a><br>
+		$fonttag Posts$from by time of day$during:
+		$tblstart
+			$tccellh width=100>Time</td>
+			$tccellh width=50>Posts</td>
+			$tccellh>&nbsp</tr>";
+
+	$postshour = array_fill(0, 24, 0);
+	$max = 0;
+	while($h=$sql->fetch($posts))
+		if (($postshour[$h['hour']] = $h['cnt']) > $max)
+			$max = $h['cnt'];
+
+	for($i=0;$i<24;$i++) {
+		$time = sprintf('%1$02d:00 - %1$02d:59', $i);
+		$bar  = "<img src=images/$numdir".'bar-on.gif width='.(@floor($postshour[$i]/$max*10000)/100).'% height=8>';
+
+		print "<tr>
+		$tccell2s>$time</td>
+		$tccell2s>$postshour[$i]</td>
+		$tccell1ls width=*>$bar</td>
+		</tr>";
+	}
+
+	print $tblend.$footer;
+	printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/postsbyuser.php b/postsbyuser.php
new file mode 100644
index 0000000..3151e7a
--- /dev/null
+++ b/postsbyuser.php
@@ -0,0 +1,83 @@
+<?php
+	require 'lib/function.php';
+
+	$user = $sql->resultq("SELECT name FROM users WHERE id=$id");
+	$windowtitle = "Listing posts by $user";
+	require 'lib/layout.php';
+
+	if (!$id)
+		errorpage('No user specified.', 'return to the board', 'index.php');
+
+	if ($_GET['forum']) {
+		$fid = intval($_GET['forum']);
+		$forum = $sql->fetchq("SELECT title, minpower FROM forums WHERE id={$fid}");
+		if ($forum['minpower'] > 0 && $power < $forum['minpower'])
+			errorpage('You don\'t have access to view posts in this forum.', 'return to the board', 'index.php');
+		$where = "in $forum[title]";
+		$forumquery = " AND t.forum = {$fid}";
+	}
+	else {
+		$forumquery = '';
+		$where = "on the board";
+	}
+
+	if ($_GET['time']) {
+		$time = intval($_GET['time']);
+		$when = " over the past ".timeunits2($time);
+		$timequery = ' AND p.date > ' . (ctime()-$time);
+	}
+	else
+		$timequery = $when = '';
+
+	if (!$page) $page=0;
+ 	if (!$ppp) $ppp=50;
+	$min = $ppp*$page;
+
+	$posts=$sql->query("SELECT p.id,thread,ip,date,num,t.title,minpower "
+		."FROM posts p "
+		."LEFT JOIN threads t ON (thread=t.id) "
+		."LEFT JOIN forums f ON (t.forum=f.id) "
+		."WHERE p.user={$id}{$forumquery}{$timequery} ORDER BY p.id DESC");
+
+	$posttotal=mysql_num_rows($posts);
+
+	// Seek to page
+	if (!@mysql_data_seek($posts, $min)) $page = 0;
+
+	$pagelinks=$smallfont.'Pages:';
+	for($i=0;$i<($posttotal/$ppp);$i++) {
+		if($i==$page) $pagelinks.=' '.($i+1);
+		else {
+			if($ppp != 50) $postperpage = "&ppp=$ppp";
+			if($forumquery) $forumlink = '&forum='.intval($_GET['forum']);
+			$pagelinks.=" <a href=postsbyuser.php?id=$id$postperpage$forumlink&page=$i>".($i+1).'</a>';
+		}
+	}
+
+	$postlist="
+	$tccellhs width=50>#</td>
+	$tccellhs width=50>Post</td>
+	$tccellhs width=130>Date</td>
+	$tccellhs>Thread</td>
+	" . (($isadmin) ? "$tccellhs width=110>IP address</td>" : "");
+
+	while(($post = $sql->fetch($posts)) && $ppp--) {
+		if($post['minpower']<=$power or !$post['minpower'])
+			$threadlink="<a href=thread.php?pid=$post[0]#$post[0]>".str_replace('<','&lt',$post['title']).'</a>';
+		else $threadlink='(restricted)';
+
+		if(!$post['num']) $post['num']='?';
+
+		$postlist.="<tr>
+			$tccell1s>$post[0]</td>
+			$tccell1s>$post[num]</td>
+			$tccell1s>".date($dateformat,$post[3]+$tzoff)."</td>
+			$tccell1ls>#<a href=thread.php?id=$post[thread]>$post[1]</a> - $threadlink
+			" . (($isadmin) ? "</td>$tccell1s>$post[2]" : "") ."
+		</tr>";
+	 }
+
+	print "{$header}{$fonttag}Posts by {$user} {$where}{$when}: ({$posttotal} posts found)
+		$tblstart$postlist$tblend$pagelinks$footer";
+	printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/ppdgauge.php b/ppdgauge.php
new file mode 100644
index 0000000..78589ea
--- /dev/null
+++ b/ppdgauge.php
@@ -0,0 +1,214 @@
+<?php
+
+	require "lib/function.php";
+	//$sql->selectdb("sonicret_s2bivb");
+
+	if ($_GET['s']) $size = $_GET['s'];
+	if ($size > 1024 || $size < 80) $size = 255;
+	if ($_GET['t']) $classt = $_GET['t'];
+	if ($classt > 9999 || $classt < 10) $classt = 500;
+
+	$size			= 255;
+	$classt			= 500;
+	$class			= $sql->resultq("SELECT COUNT(`id`) FROM `posts` WHERE `date` > ". (ctime() - 86400));
+
+	if ($_GET['s']) $size = numrange((int)$_GET['s'], 80, 1024);
+	if ($_GET['t']) $classt = numrange((int)$_GET['t'], 10, 1000);
+	
+	$classtxt		= "    ppd   ";
+
+	$image			= imagecreatetruecolor( $size + 1, $size + 1 );
+
+	imageantialias($image, true);
+	imagesavealpha($image, true);
+	imagealphablending($image, false);
+
+	$color['white']	= imagecolorallocate($image, 255, 255, 255);
+	$color['black']	= imagecolorallocate($image,   0,   0,   0);
+	$color['gray1']	= imagecolorallocate($image,  40,  40,  40);
+	$color['gray2']	= imagecolorallocate($image, 120, 120, 120);
+	$color['gray3']	= imagecolorallocate($image, 230, 230, 230);
+	$color['red']	= imagecolorallocate($image, 255, 100, 100);
+	$color['blue']	= imagecolorallocate($image, 125, 125, 255);
+
+	imagefilledrectangle($image, 0, 0, $size+1, $size+1, imagecolorallocatealpha($image, 0, 0, 0, 127));
+	imagealphablending($image, true);
+
+	$point	= anglepos($size / 3, $size/2, $size/2, 90+45);
+
+//	drawgauge($size/2, $size/2, $size, 180, 270);
+	drawgauge($size/2, $size/2, $size, 180 - 45, 270);
+
+//	drawgauge($point['x'], $point['y'], $size / 3, 180, 270);
+
+	function drawgauge($xpos, $ypos, $size, $startangle, $endangle) {
+		global $image, $color, $class, $classt, $classtxt;
+
+//		$startangle	= 90;
+		$endangle	= $startangle + $endangle;
+		$angsize	= $endangle - $startangle;
+
+		$radius			= $size / 2;
+
+		imagefilledarc($image, $xpos, $ypos, $size, $size, 0, 360, $color['gray1'], IMG_ARC_PIE);
+		imagearc      ($image, $xpos, $ypos, $size, $size, 0, 360, $color['black']);
+
+		for ($i = 0; $i <= 100; $i ++) {
+
+			if ($i % 5 == 0) {
+				$c	= $color['white'];
+				$l	= 10;
+			} else {
+				$c	= $color['black'];
+				$l	= 0;
+			}
+
+			if ($i >= 0 && $i <= 99) {
+				if ($i <= 24) {
+					$cx	= ($i) / 25 * 255;
+					$cc	= imagecolorallocate($image, 255, $cx, 0);
+				} elseif ($i <= 49) {
+					$cx	= ($i - 75) / 25 * 127;
+					$cc	= imagecolorallocate($image, 255 - $cx, 255 - $cx, $cx);
+				} elseif ($i <= 74) {
+					$cx	= ($i - 50) / 25 * 31;
+					$cc	= imagecolorallocate($image, 128 - $cx, 128 - $cx, 128 + $cx);
+				} else {
+					$cx	= ($i - 75) / 25 * 95;
+					$cc	= imagecolorallocate($image, 95 - $cx, 95 - $cx, 255 - $cx);
+				}
+
+				$r	= $i * ($angsize * .01) - $startangle + ($angsize * .01);
+				$q[0]	= anglepos($radius - 3, $xpos, $ypos, $r);
+				$q[1]	= anglepos($radius - 3 - 5, $xpos, $ypos, $r);
+				$r	= $i * ($angsize * .01) - $startangle - 1;
+				$q[2]	= anglepos($radius - 3, $xpos, $ypos, $r);
+				$q[3]	= anglepos($radius - 3 - 5, $xpos, $ypos, $r);
+
+				$pts	= array(
+					$q[0]['x'], $q[0]['y'],
+					$q[2]['x'], $q[2]['y'],
+					$q[3]['x'], $q[3]['y'],
+					$q[1]['x'], $q[1]['y'],
+					);
+
+//				imageline($image, $p1['x'], $p1['y'], $p2['x'], $p2['y'], $cc);
+//				imageline($image, $p1['x'], $p1['y'], $p2['x'], $p2['y'], $cc);
+				imagefilledpolygon($image, $pts, 4, $cc);
+//				imageline($image, $q[0]['x'], $q[0]['y'], $q[3]['x'], $q[3]['y'], $cc);
+			}
+
+			$r	= $i * ($angsize * .01) - $startangle;
+
+			$p1	= anglepos($radius - 3, $xpos, $ypos, $r);
+			$p2	= anglepos($radius - 3 - $l, $xpos, $ypos, $r);
+
+			imageline($image, $p1['x'], $p1['y'], $p2['x'], $p2['y'], $c);
+
+			$markers	= ($size < 255 ? 25 : 10);
+			if ($i % $markers == 0) {
+				$p3		= anglepos($radius - 20, $xpos, $ypos, $r);
+				$p4		= anglepos($radius - 42, $xpos, $ypos, $r);
+
+				$n		= round($classt * ($i/100)) ."";
+
+				$nl		= strlen($n);
+
+				$x	= 2 + (3.5 * ($nl - 1));
+				imagestring($image, 3, $p3['x'] - $x, $p3['y'] - 7, $n, $color['white']);
+			}
+
+		}
+
+
+		$rad	= 45;
+
+	//	imageline($image, $radius, $radius, $point['x'], $point['y'], $color['black']);
+	//	drawneedle($houra, $radius, $radius, $radius - 30,  7, - 3, $color['black']);
+	//	drawneedle($mina,  $radius, $radius, $radius -  5,  5, - 5, $color['black']);
+	//	drawneedle($seca,  $radius, $radius, $radius -  2,  4, -10, $color['red']);
+
+		$ang	= @(min($classt, $class)/$classt) * $angsize - $startangle;
+		drawneedle($ang,  $xpos, $ypos, $radius -  2, 5, -20, $color['blue']);
+
+		if ($size >= 128) {
+			imagestring($image, 1, $size / 2 - 26, $size * .7 + 4    , $classtxt, $color['white']);
+//			if (!$_GET['p']) imagestring($image, 1, $size / 2 + 14, $size * .7 + 16, "%", 0xcccccc);
+			digits($size * .50 - 12, $size * .7 + 14, $class, 3, 0);
+		} else {
+			digits($size * .50 - 12, $size * .7 + 9, $class, 3, 0);
+		}
+	}
+
+//	imagestring($image, 1, $size / 2 - 42, $size * .93 - 10, date("m/d/y H:i:s", time()), 0xcccccc);
+	header("Content-type: image/png");
+	imagepng($image);
+	imagedestroy($image);
+
+
+
+	function anglepos($radius, $origo_x, $origo_y, $angle) {
+//		$angle	+= 90;
+		$radius--;
+		$pont['x'] = $origo_x + ($radius * sin(deg2rad($angle)));
+		$pont['y'] = $origo_y - ($radius * cos(deg2rad($angle)));
+		return $pont;
+	}
+
+
+	function drawneedle($angle, $cx, $cy, $radius, $width, $tail, $color) {
+		global $image;
+		$point	= anglepos($tail * -1, $cx, $cy, $angle + 180);
+
+		$width	*= .75;
+
+		$point1	= anglepos($width, $point['x'], $point['y'], $angle - 90);
+		$point2	= anglepos($width, $point['x'], $point['y'], $angle + 90);
+		$point3	= anglepos($radius, $cx, $cy, $angle);
+//		$point3	= anglepos($radius, $cx, $cy, $angle - .5);
+//		$point4	= anglepos($radius, $cx, $cy, $angle + .5);
+		$point9	= anglepos($radius - 4, $cx, $cy, $angle);
+
+		$points	= array(
+					$point1['x'], $point1['y'],
+//					$point['x'], $point['y'],
+					$point2['x'], $point2['y'],
+//					$point4['x'], $point4['y'],
+					$point3['x'], $point3['y'],
+			);
+		imagefilledpolygon($image, $points, 3, $color);
+		imagepolygon($image, $points, 3, $color);
+		imageline($image, $point9['x'], $point9['y'], $cx, $cy, 0xffffff);
+//		imagefilledpolygon($image, $points, 3, $color);
+
+	}
+
+	
+	function digits($x, $y, $n, $l = 4, $d = 2, $overlay = false) {
+		global $image;
+
+		$numimage	= imagecreatefrompng("digits4.png");
+		$n			= number_format($n, $d);
+		$n			= str_replace(",", "", $n);
+		$n2			= explode(".", $n);
+
+		$big		= str_pad($n2[0], $l, ":", STR_PAD_LEFT);
+		$len		= strlen($big);
+
+		for($o = 0; $o < $len; $o++) {
+			$chrpos	= ord($big{$o}) - 48;
+			imagecopy($image, $numimage, $x + ($o * 8), $y, $chrpos * 9, 0, 8, 14);
+		}
+
+		$small		= $n2[1];
+		$slen		= strlen($small) + $o - 1;
+		for(; $o <= $slen; $o++) {
+			$lp		= $o - $len;
+			imagecopy($image, $numimage, $x + $o * 8, $y, $small{$lp} * 9, 14, 8, 14);
+		}
+
+		$maxlen		= strlen($big) + strlen($small);
+		imagerectangle($image, $x - 1, $y - 1, $x + $maxlen * 8, $y + 14, 0x000000);
+
+		if ($overlay) imagefilledrectangle($image, $x, $y, $x + $maxlen * 8 - 1, $y + 13, $overlay);
+	}
\ No newline at end of file
diff --git a/private.php b/private.php
new file mode 100644
index 0000000..9bb58af
--- /dev/null
+++ b/private.php
@@ -0,0 +1,89 @@
+<?php
+	require 'lib/function.php';
+	$windowtitle = "$boardname -- Private Messages";
+	require 'lib/layout.php';
+
+	if (!$log)
+		errorpage("You need to be logged in to read your private messages.", 'log in (then try again)', 'login.php');
+
+	// Viewing someone else?
+	$u = $loguserid;
+	if ($isadmin && $id) {
+		$u = $id;
+		$idparam = "id=$id&";
+	}
+
+	// Viewing sent messages?
+	$to   = 'to';
+	$from = 'from';
+	if ($view == 'sent') {
+		$to   = 'from';
+		$from = 'to';
+		$viewparam = 'view=sent&';
+	}
+
+	if(!$ppp)
+		$ppp=50;
+	if(!$page)
+		$page=1;
+
+	$pmin=($page-1)*$ppp;
+	$msgtotal=$sql->resultq("SELECT count(*) FROM pmsgs WHERE user$to=$u");
+	$pagelinks='Pages:';
+	$p=0;
+	for($i=0; $i<$msgtotal; $i+=$ppp) {
+		$p++;
+		if($p==$page)
+			$pagelinks.=" $p";
+		else
+			$pagelinks.=" <a href=private.php?{$idparam}{$viewparam}page={$p}>{$p}</a>";
+	}
+
+	// 1252378129
+	$pmsgs   = $sql->query("SELECT p.id,user$from uid,date,t.title,msgread,name,sex,powerlevel,aka
+		FROM pmsgs p,pmsgs_text t,users u
+		WHERE user$to=$u
+		AND p.id=pid
+		AND user$from=u.id "
+		.($loguser['id'] == 175 ? "AND p.id > 8387 " : "")
+		."ORDER BY " .($loguser['id'] == 175 ? "user$from DESC, " : "msgread ASC, ")
+		."p.id DESC
+		LIMIT $pmin,$ppp
+	");
+
+	$from[0] = strtoupper($from[0]);
+
+	if(!$view)
+		$viewlink="<a href=private.php?{$idparam}view=sent>View sent messages</a>";
+	else
+		$viewlink="<a href=private.php?{$idparam}>View received messages</a>";
+
+	print "$header
+		<table width=100%><td>$fonttag<a href=index.php>$boardname</a> - "
+			.(($u != $loguserid) ? $sql->resultq("SELECT `name` FROM `users` WHERE `id` = '$u'")."'s private messages" : "Private messages")
+			." - "
+			.((!$view) ? 'Inbox' : 'Outbox').": $msgtotal</td>
+		<td align=right>$smallfont$viewlink | <a href=sendprivate.php>Send new message</a></table>
+		$tblstart<tr>
+		$tccellh width=50>&nbsp</td>
+		$tccellh>Subject</td>
+		$tccellh width=15%>$from</td>
+		$tccellh width=180>Sent on</td></tr>
+	";
+
+	while($pmsg = $sql->fetch($pmsgs)) {
+		$new       = ($pmsg['msgread']?'&nbsp;':$statusicons['new']);
+		$namecolor = getuserlink($pmsg, array('id'=>'uid'));
+		print "
+			<tr style='height:20px;'>
+			$tccell1>$new</td>
+			$tccell2l><a href=showprivate.php?id=$pmsg[id]>$pmsg[title]</td>
+			$tccell2>$namecolor</td>
+			$tccell2>".date($dateformat,$pmsg['date']+$tzoff)."
+			</tr>
+		";
+	}
+
+	print "$tblend$smallfont$pagelinks$footer";
+	printtimedif($startingtime);
+?>
diff --git a/profile.php b/profile.php
new file mode 100644
index 0000000..ad689b8
--- /dev/null
+++ b/profile.php
@@ -0,0 +1,240 @@
+<?php
+	require 'lib/function.php';
+	$user=@$sql->fetchq("SELECT * FROM users WHERE id=$id");
+	$windowtitle="$boardname -- Profile for $user[name]";
+	require 'lib/layout.php';
+
+//	if ($_GET['id'] == 1 && !$x_hacks['host']) {
+//		print "$header<br><center><img src='http://earthboundcentral.com/wp-content/uploads/2009/01/m3deletede.png'></center><br>$footer";
+//		printtimedif($startingtime);
+//		die();
+//	}
+
+	if (!$user) {
+		print "$header<br>$tblstart$tccell1>The specified user doesn't exist.$tblend$footer";
+		printtimedif($startingtime);
+		die();
+	}
+
+	$maxposts=$sql->resultq("SELECT posts FROM users ORDER BY posts DESC LIMIT 1");
+
+/*  User ratings (disabled)
+	$users1=$sql->query("SELECT id,posts,regdate FROM users");
+	while($u=$sql->fetch_array($users1)){
+		$u['level']=calclvl(calcexp($u['posts'],(ctime()-$u['regdate'])/86400));
+		if ($u['posts']<0 or $u['regdate']>ctime()) $u['level']=1;
+		$users[$u['id']]=$u;
+	}
+
+	$ratescore=0;
+	$ratetotal=0;
+	$ratings=$sql->query("SELECT userfrom,rating FROM userratings WHERE userrated=$id");
+	while($rating=@$sql->fetch($ratings)){
+		$ratescore+=$rating['rating']*$users[$rating['userfrom']]['level'];
+		$ratetotal+=$users[$rating['userfrom']]['level'];
+	}
+	$ratetotal*=10;
+	$numvotes=mysql_num_rows($ratings);
+	if($ratetotal) {
+		$ratingstatus=(floor($ratescore*1000/$ratetotal)/100)." ($ratescore/$ratetotal, $numvotes votes)";
+	} else { 
+		$ratingstatus="None";
+	}
+	if($loguserid and $logpwenc and $loguserid!=$id)
+		$ratelink=" | <a href=rateuser.php?id=$id>Rate user</a>";
+*/
+
+	$userrank=getrank($user['useranks'],$user['title'],$user['posts'],$user['powerlevel']);
+	$threadsposted=$sql->resultq("SELECT count(id) AS cnt FROM threads WHERE user=$id",0,"cnt");
+
+	$i=0;
+	$lastpostdate="None";
+	if($user['posts']) {
+		$lastpostdate=date($dateformat,$user['lastposttime']+$tzoff);
+
+		//$postsfound=$sql->resultq("SELECT count(id) AS cnt FROM posts WHERE user=$id",0,"cnt");
+		$post = @$sql->fetchq("SELECT id, thread FROM posts WHERE user=$id AND date=$user[lastposttime]");
+
+		if ($post && $thread = $sql->fetchq("SELECT title,forum FROM threads WHERE id=$post[1]")) {
+			$forum = $sql->fetchq("SELECT id,title,minpower FROM forums WHERE id=$thread[forum]");
+			$thread[0]=str_replace("<","&lt",$thread[0]);
+			if ($forum['minpower']>$loguser['powerlevel'] and $forum['minpower'])
+				$lastpostlink=", in a restricted forum";
+			else
+				$lastpostlink=", in <a href=thread.php?pid=$post[0]#$post[0]>$thread[0]</a> (<a href=forum.php?id=$forum[id]>$forum[title]</a>)";
+		}
+	}
+
+	if($log) {
+		$sendpmsg=" | <a href=sendprivate.php?userid=$id>Send private message</a>";
+		if($isadmin){
+			if($user['lastip'])
+				$lastip=" <br>with IP: <a href='ipsearch.php?ip={$user['lastip']}' style='font-style:italic;'>$user[lastip]</a>";
+			$sneek="<tr>$tccell1s colspan=2><a href='private.php?id={$id}' style='font-style:italic;'>View private messages</a> |"
+				." <a href='forum.php?fav=1&user={$id}' style='font-style:italic;'>View favorites</a> |"
+				//." <a href='rateuser.php?action=viewvotes&id={$id}' style='font-style:italic;'>View votes</a> |"
+				." <a href='edituser.php?id={$id}' style='font-style:italic;'>Edit user</a>";
+		}
+	}
+
+	$aim=str_replace(" ","+",$user[aim]);
+	$schname=$sql->resultq("SELECT name FROM schemes WHERE id=$user[scheme]");
+	$numdays=(ctime()-$user['regdate'])/86400;
+
+	$user['signature']=doreplace($user['signature'],$user['posts'],$numdays,$user['name']);
+	//  $user['signature']=doreplace2($user['signature'],$user['posts'],$numdays,$user['name']);
+	$user['postheader']=doreplace($user['postheader'],$user['posts'],$numdays,$user['name']);
+	//  $user['postheader']=doreplace2($user['postheader'],$user['posts'],$numdays,$user['name']);
+	
+	if ($user['picture']) $picture = "<img src=\"$user[picture]\">";
+	if ($user['moodurl']) $moodavatar = " | <a href='avatar.php?id=$id' class=\"popout\" target=\"_blank\">Preview mood avatar</a>";
+	
+	$icqicon="<a href=http://wwp.icq.com/$user[icq]#pager><img src=http://wwp.icq.com/scripts/online.dll?icq=$user[icq]&img=5 border=0></a>";
+	
+	if(!$user['icq']){
+		$user['icq']="";
+		$icqicon="";
+	}
+	
+	$tccellha="<td bgcolor=$tableheadbg";
+	$tccellhb="><center>$fonthead";
+
+	// Todo: This is a clear hack. Remove it.
+	$birthday = (date('m-d', $user['birthday']) == date('m-d',ctime() + $tzoff));
+	$rsex = (($birthday) ? 255 : $user['sex']);
+	$namecolor = getnamecolor($rsex,$user['powerlevel'], false);
+
+	$tzoffset=$user['timezone'];
+	$tzoffrel=$tzoffset-$loguser['timezone'];
+	$tzdate=date($dateformat,ctime()+$tzoffset*3600);
+	if($user[birthday]){
+		$birthday=date("l, F j, Y",$user[birthday]);
+		$age="(".floor((ctime()-$user[birthday])/86400/365.2425)." years old)";
+	}
+
+	// RPG fun shit
+	$exp=calcexp($user['posts'],(ctime()-$user['regdate'])/86400);
+	$lvl=calclvl($exp);
+	$expleft=calcexpleft($exp);
+	$expstatus="Level: $lvl<br>EXP: $exp (for next level: $expleft)";
+	if($user['posts'] > 0) $expstatus.="<br>Gain: ".calcexpgainpost($user['posts'],(ctime()-$user['regdate'])/86400)." EXP per post, ".calcexpgaintime($user[posts],(ctime()-$user[regdate])/86400)." seconds to gain 1 EXP when idle";
+	$postavg=sprintf("%01.2f",$user[posts]/(ctime()-$user[regdate])*86400);
+	$totalwidth=116;
+	$barwidth=@floor(($user[posts]/$maxposts)*$totalwidth);
+	if($barwidth<0) $barwidth=0;
+	if($barwidth) $baron="<img src=images/$numdir"."bar-on.gif width=$barwidth height=8>";
+	if($barwidth<$totalwidth) $baroff="<img src=images/$numdir"."bar-off.gif width=".($totalwidth-$barwidth)." height=8>";
+	$bar="<img src=images/$numdir"."barleft.gif>$baron$baroff<img src=images/$numdir"."barright.gif><br>";
+	if(!$topposts) $topposts=5000;
+
+	if($user['posts']) $projdate=ctime()+(ctime()-$user['regdate'])*($topposts-$user['posts'])/($user['posts']);
+	if(!$user['posts'] or $user['posts']>=$topposts or $projdate>2000000000 or $projdate<ctime()) $projdate="";
+	else $projdate=" -- Projected date for $topposts posts: ".date($dateformat,$projdate+$tzoff);
+
+	if($user['minipic']) $minipic="<img src=\"". htmlspecialchars($user[minipic]) ."\" width=16 height=16 align=absmiddle> ";
+	$homepagename=$user['homepageurl'];
+	if($user['homepagename']) $homepagename="$user[homepagename]</a> - $user[homepageurl]";
+	if($user['postbg']) $postbg="<div style='background:url($user[postbg]);' height=100%>";
+
+	loadtlayout();
+	$user['headtext']=$user['postheader'];
+	$user['signtext']=$user['signature'];
+	$user['text'] = "Sample text. [quote=fhqwhgads]A sample quote, with a <a href=about:blank>link</a>, for testing your layout.[/quote]This is how your post will appear.";
+	$user['uid']	= $_GET['id'];
+	$user['date']	= ctime();
+
+	// so that layouts show up regardless of setting (for obvious reasons)
+	$loguser['viewsig'] = 1;
+
+	// shop/rpg such
+	$shops=$sql->query('SELECT * FROM itemcateg ORDER BY corder');
+	$eq=$sql->fetchq("SELECT * FROM users_rpg WHERE uid=$id");
+	$itemids=array_unique(array($eq['eq1'], $eq['eq2'], $eq['eq3'], $eq['eq4'], $eq['eq5'], $eq['eq6'], $eq['eq7']));
+	$itemids=implode(',', $itemids);
+	$eqitems=$sql->query("SELECT * FROM items WHERE id IN ({$itemids})");
+	while($item=$sql->fetch($eqitems)) $items[$item['id']]=$item;
+	while($shop=$sql->fetch($shops))
+		$shoplist.="
+			<tr>
+			$tccell1s>$shop[name]</td>
+			$tccell2s width=100%>".$items[$eq['eq'.$shop['id']]]['name']."&nbsp;</td>
+		";
+
+	/* extra munging for whatever reason */
+	$user['email'] = urlencode($user['email']);
+
+	// AKA
+	if ($user['aka'] && $user['aka'] != $user['name'])
+		$aka = "$tccell1l width=150><b>Also known as</td>			$tccell2l>$user[aka]<tr>";
+	else $aka='';
+
+  print "
+	$header
+	<div>$fonttag Profile for <b>$minipic<span style='color:#{$namecolor}'>$user[name]</span></b></div>
+<table cellpadding=0 cellspacing=0 border=0>
+<td width=100% valign=top>
+$tblstart
+	$tccellh colspan=2><center>General information<tr>
+	<!-- $tccell1l width=150><b>Username</td>			$tccell2l>$user[name]<tr> -->
+	$aka
+	$tccell1l width=150><b>Total posts</td>			$tccell2l>$user[posts] ($postavg per day) $projdate<br>$bar<tr>
+	$tccell1l width=150><b>Total threads</td>		$tccell2l>$threadsposted<tr>
+	$tccell1l width=150><b>EXP</td>					$tccell2l>$expstatus<tr>
+". (false ? "	$tccell1l width=150><b>User rating</td>			$tccell2l>$ratingstatus<tr>" : "") ."
+	$tccell1l width=150><b>Registered on</td>		$tccell2l>".@date($dateformat,$user[regdate]+$tzoff)." (".floor((ctime()-$user[regdate])/86400)." days ago)<tr>
+	$tccell1l width=150><b>Last post</td>			$tccell2l>$lastpostdate$lastpostlink<tr>
+	$tccell1l width=150><b>Last activity</td>		$tccell2l>".date($dateformat,$user[lastactivity]+$tzoff)."$lastip<tr>
+$tblend
+<br>$tblstart
+	$tccellh colspan=2><center>Contact information<tr>
+	$tccell1l width=150><b>Email address</td>		$tccell2l><a href='mailto:$user[email]'>$user[email]</a>&nbsp;<tr>
+	$tccell1l width=150><b>Homepage</td>			$tccell2l><a href='$user[homepageurl]'>$homepagename</a>&nbsp;<tr>
+	$tccell1l width=150><b>ICQ number</td>			$tccell2l>$user[icq] $icqicon&nbsp;<tr>
+	$tccell1l width=150><b>AIM screen name</td>		$tccell2l><a href='aim:goim?screenname=$aim'>$user[aim]</a>&nbsp;<tr>
+$tblend
+<br>$tblstart
+	$tccellh colspan=2><center>User settings<tr>
+	$tccell1l width=150><b>Timezone offset</td>		$tccell2l>$tzoffset hours from the server, $tzoffrel hours from you (current time: $tzdate)<tr>
+	$tccell1l width=150><b>Items per page</td>		$tccell2l>". $user['threadsperpage'] ." threads, ". $user['postsperpage'] ." posts<tr>
+	$tccell1l width=150><b>Color scheme</td>		$tccell2l>".$schname."<tr>
+$tblend
+</td><td>&nbsp;&nbsp;&nbsp;</td><td valign=top>
+$tblstart
+	$tccellh><center>RPG status<tr>
+	$tccell1l><img src='status.php?u=$id'>
+$tblend
+<br>$tblstart
+	$tccellh colspan=2><center>Equipped Items<tr>
+	$shoplist
+$tblend
+</td></table>
+<br>$tblstart
+	$tccellh colspan=2><center>Personal information<tr>
+	$tccell1l width=150><b>Real name</td>			$tccell2l>$user[realname]&nbsp;<tr>
+	$tccell1l width=150><b>Location</td>			$tccell2l>$user[location]&nbsp;<tr>
+	$tccell1l width=150><b>Birthday</td>			$tccell2l>$birthday $age&nbsp;<tr>
+	$tccell1l width=150><b>User bio</td>			$tccell2l>". dofilters(doreplace2(doreplace($user['bio'], $user['posts'], (ctime()-$user['regdate'])/86400, $user['name']))) ."&nbsp;<tr>
+$tblend
+<br>$tblstart
+	$tccellh colspan=2><center>Sample post<tr>
+	". threadpost($user, 1) ."
+$tblend
+<br>$tblstart
+	$tccellhs colspan=2><center>Options<tr>
+	$tccell2s colspan=2>
+	<a href=thread.php?user=$id>Show posts</a> | 
+	<a href=forum.php?user=$id>View threads by this user</a>
+	$sendpmsg
+  $ratelink
+  $moodavatar
+  <tr>
+	$tccell2s colspan=2>
+	<a href=postsbyuser.php?id=$id>List posts by this user</a> |
+	<a href=postsbytime.php?id=$id>Posts by time of day</a> |
+	<a href=postsbythread.php?id=$id>Posts by thread</a> | 
+	<a href=postsbyforum.php?id=$id>Posts by forum</td>$sneek
+	$tblend$footer
+  ";
+
+  printtimedif($startingtime);
+?>
diff --git a/ranks.php b/ranks.php
new file mode 100644
index 0000000..be754a3
--- /dev/null
+++ b/ranks.php
@@ -0,0 +1,101 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/layout.php';
+
+	$set = (($_GET['set']) ? (int)$_GET['set'] : -1);
+	$showall = (($_GET['showall']) ? 1 : 0);
+
+	$rsets = $sql->query('SELECT * FROM ranksets WHERE id>0 ORDER BY id');
+	while($rset = $sql->fetch($rsets)) {
+		// First rankset
+		if($set < 0) $set = $rset['id'];
+		$selected = (($rset['id']==$set) ? 'selected' : '' );
+
+		$ranksetlist.="<option value={$rset['id']} {$selected}>{$rset['name']}";
+	}
+	$ch[$showall]='checked';
+
+	print "
+		$header
+		<FORM ACTION=ranks.php NAME=REPLIER>
+		$tblstart
+		$tccellh colspan=2>&nbsp;<tr>
+		$tccell1><b>Rank set</b></td>
+		$tccell2l><select name=set>$ranksetlist</select><tr>
+		$tccell1><b>Users to show</b></td>
+		$tccell2l>
+			$radio=showall value=0 $ch[0]> Selected rank set only
+			&nbsp; &nbsp;
+			$radio=showall value=1 $ch[1]> All users
+		<tr>
+		$tccellh colspan=2>&nbsp;<tr>
+		$tccell1>&nbsp;</td>
+		$tccell2l><input type=submit class=submit value=View></td>
+		</FORM>
+		$tblend
+		<br>
+		$tblstart
+		$tccellh width=150>Rank</td>
+		$tccellh width=60>Posts</td>
+		$tccellh width=60>Ranking</td>
+		$tccellh colspan=2>Users on that rank
+	";
+
+	$useranks = ($showall?'':"AND useranks={$set}");
+	$btime=ctime()-86400*30;
+
+	$ranks = $sql->query("SELECT * FROM ranks WHERE rset=$set ORDER BY num");
+	$totalranks = mysql_num_rows($ranks);
+
+	if ($totalranks > 0) {
+		$rank  = $sql->fetch($ranks);
+
+		// 300 queries [11sec] ---> 20 queries [1sec]
+		$users = $sql->query("SELECT id,name,sex,powerlevel,aka,birthday,posts,lastactivity,lastposttime FROM users WHERE posts >= $rank[num] $useranks ORDER BY posts ASC");
+		$user  = $sql->fetch($users);
+		$total = mysql_num_rows($users);
+	}
+	
+	for($i=0; $i<$totalranks; ++$i) {
+		$rankn=$sql->fetch($ranks);
+		if(!$rankn['num']) $rankn['num']=8388607;
+
+		$userarray = array();
+		$inactive = 0;
+
+		for($u=0;$user && $user['posts'] < $rankn['num'];$u++){
+			if (max($user['lastactivity'], $user['lastposttime']) > $btime)
+				$userarray[$user['name']] = getuserlink($user);
+			else ++$inactive;
+			$user = $sql->fetch($users);
+		}
+
+		@ksort($userarray);
+		$userlisting = implode(", ", $userarray);
+
+		if($inactive) $userlisting.=($userlisting?', ':'')."$inactive inactive";
+		if(!$userlisting) $userlisting='&nbsp;';
+
+		if($userlisting != '&nbsp;' || $rank['num'] <= $loguser['posts'] || $ismod) {
+			print "<tr>
+				$tccell2ls width=200>$rank[text]</td>
+				$tccell1 width=60>$rank[num]</td>
+				$tccell1 width=60>$total</td>
+				$tccell1 width=30>$u</td>
+				$tccell2s width=*>$userlisting";
+		}
+		else {
+			print "<tr>
+				$tccell1>? ? ?</td>
+				$tccell1>???</td>
+				$tccell1>?</td>
+				$tccell1>?</td>
+				$tccell1s>?";
+		}
+		$rank = $rankn;
+		$total -= $u;
+	}
+
+	print $tblend.$footer;
+	printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/register.php b/register.php
new file mode 100644
index 0000000..85c89d3
--- /dev/null
+++ b/register.php
@@ -0,0 +1,164 @@
+<?php
+
+  if ($_POST['action'] == "Register" && $_POST['homepage']) {
+	  header("Location: http://acmlm.no-ip.org/board/register.php");
+	  die();
+  }
+
+
+  require 'lib/function.php';
+  require 'lib/layout.php';
+  $ipstart=substr($userip,0,6);
+  print $header;
+
+	if ($adminconfig['registrationdisable'])
+		die("$tblstart<br>$tccell2>Registration is disabled. Please contact an admin if you have any questions.$tblend$footer");
+  
+
+  if (!$_POST[action]){
+    $descbr="</b>$smallfont<br></center>&nbsp";
+    print "
+	<body onload=window.document.REPLIER.username.focus()>
+	<form ACTION=register.php NAME=REPLIER METHOD=POST>
+	<br>$tblstart
+	
+	$tccellh colspan=2>Login information</td><tr>
+	$tccell1><b>User name:</b>$descbr The name you want to use on the board.</td>
+	$tccell2l width=50%>$inpt=name SIZE=25 MAXLENGTH=25><tr>
+	$tccell1><b>Password:</b>$descbr Enter any password up to 32 characters in length. It can later be changed by editing your profile.<br><br>Warning: Do <b>not</b> use unsecure passwords such as '123456', 'qwerty', or 'pokemon'. It'll result in an instant IP ban.</td>
+	$tccell2l width=50%>$inpp=pass SIZE=13 MAXLENGTH=64><tr>
+	$tccellh>&nbsp</td>$tccellh>&nbsp<tr>
+	$tccell1>&nbsp</td>$tccell2l>
+	$inph=action VALUE=\"Register\">
+	$inps=submit VALUE=\"Register account\"></td>
+	</table>
+		<div style='visibility: hidden;'><b>Homepage:</b><small> DO NOT FILL IN THIS FIELD. DOING SO WILL RESULT IN INSTANT IP-BAN.</small> - $inpt=homepage SIZE=25 MAXLENGTH=255></div>
+
+		</form>
+
+    ";
+  }
+  if($_POST['action']=='Register') {
+
+	if ($_POST['name'] == "Blaster") {
+		$sql -> query("INSERT INTO `ipbans` SET `ip` = '". $_SERVER['REMOTE_ADDR'] ."', `date` = '". ctime() ."', `reason` = 'Idiot'");
+		@xk_ircsend("1|". xk(7) ."Auto-IP banned Blaster with IP ". xk(8) . $_SERVER['REMOTE_ADDR'] . xk(7) ." on registration.");
+		die("$tccell1>Thank you, $username, for registering your account.<br>".redirect('index.php','the board',0).$footer);
+	}
+
+	/* do curl here */
+	$ch = curl_init();
+	curl_setopt ($ch,CURLOPT_URL, "http://". $_SERVER['REMOTE_ADDR']);
+	curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
+	curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 3); // <---- HERE
+	curl_setopt ($ch, CURLOPT_TIMEOUT, 5); // <---- HERE
+	$file_contents = curl_exec($ch);
+	curl_close($ch);
+
+	if (
+		stristr($file_contents, "proxy")
+		|| stristr($file_contents, "forbidden")
+		|| stristr($file_contents, "it works")
+		|| stristr($file_contents, "anonymous")
+		|| stristr($file_contents, "filter")
+		|| stristr($file_contents, "panel")
+		) {
+	
+		$adjectives	= array(
+			"shitlord",
+			"shitheel",
+			"shitbag",
+			"douche",
+			"douchebag",
+			"douchenozzle",
+			"fuckwit",
+			"FUCKER",
+			"script-kiddie",
+			"dumbfuck extraordinare",
+			);
+		
+		shuffle($adjectives);
+	
+		$sql -> query("INSERT INTO `ipbans` SET `ip` = '". $_SERVER['REMOTE_ADDR'] ."', `date` = '". ctime() ."', `reason` = 'Reregistering fuckwit'");
+		@xk_ircsend("1|". xk(7) ."Auto-IP banned proxy-abusing $adjectives[0] with IP ". xk(8) . $_SERVER['REMOTE_ADDR'] . xk(7) ." on registration. (Tried to register with username $name)");
+		die("$tccell1>Thank you, $name, for registering your account.<br>".redirect('index.php','the board',0).$footer);
+	}
+
+	
+	
+
+	$users = $sql->query('SELECT name FROM users');
+	$username = substr(trim($name),0,25);
+	$username2 = str_replace(' ','',$username);
+	$username2 = str_replace(' ','',$username2);
+	$username2 = preg_replace("'&nbsp;'si",'&nbsp',$username2);
+	$username2 = preg_replace("'&nbsp'si",'',$username2);
+	$username2 = stripslashes($username2);
+    print $tblstart;
+    $userid=-1;
+    while ($user=$sql->fetch($users)) {
+		$user[name]=str_replace(' ','',$user['name']);
+		$user[name]=str_replace(' ','',$user['name']);
+		if (strcasecmp($user[name],$username2)==0) $userid=$u;
+	  }
+	$nomultis = $sql->fetchq("SELECT * FROM `users` WHERE `lastip` = '$REMOTE_ADDR'");
+//	$nomultis	= false;
+
+	if ($userid==-1 and $pass and $pass != "123" and $name && ( !$nomultis || $isadmin )) {
+	if(!mysql_num_rows($users)) $userlevel=3;
+	$currenttime=ctime();
+	$ipaddr=getenv("REMOTE_ADDR");
+	if (!$x_hacks['host'] && false) {
+		$sql->query("INSERT INTO `pendingusers` SET `username` = '$name', `password` = '". $pass ."', `ip` = '$ipaddr', `time` = '$currenttime'") or print mysql_error();
+
+//		$sql->query("INSERT INTO `ipbans` SET `ip` = '$ipaddr', `reason` = 'Automagic ban', `banner` = 'Acmlmboard'");
+
+		print "$tccell1>Thank you, $username, for registering your account.<br>".redirect('index.php','the board',0);
+	} else {
+
+		$ircout['name']		= stripslashes($name);
+		$ircout['ip']		= $ipaddr;
+		
+		// No longer useful
+		//$ircout['pmatch']	= $sql -> resultq("SELECT COUNT(*) FROM `users` WHERE `password` = '". md5($pass) ."'");
+
+		$sql->query("INSERT INTO `users` SET `name` = '$name', `password` = '". md5($pass) ."', `powerlevel` = '0', `postsperpage` = '20', `threadsperpage` = '50', `lastip` = '$ipaddr', `layout` = '1', `scheme` = '0', `lastactivity` = '$currenttime', `regdate` = '$currenttime'") or print mysql_error();
+		$newuserid			= mysql_insert_id();
+		$sql->query("UPDATE users SET `password` = '".getpwhash($pass, $newuserid)."' WHERE `id` = '$newuserid'");
+
+		$ircout['id']		= $newuserid;
+		xk_ircout("user", $ircout['name'], $ircout);
+
+		$sql->query("INSERT INTO `users_rpg` (`uid`) VALUES ('". $newuserid ."')") or print mysql_error();
+		print "$tccell1>Thank you, $username, for registering your account.<br>".redirect('index.php','the board',0);
+	}
+    }else{
+	
+/*	if ($password == "123") {
+		echo	"$tccell1>Thank you, $username, for registering your account.<img src=cookieban.php width=1 height=1><br>".redirect('index.php','the board',0);
+		mysql_query("INSERT INTO `ipbans` (`ip`, `reason`, `date`) VALUES ('". $_SERVER['REMOTE_ADDR'] ."', 'blocked password of 123', '". ctime() ."')");
+		die();
+	}
+*/
+
+	if ($userid != -1) {
+		$reason = "That username is already in use.";
+	} elseif ($nomultis) {
+		$reason = "You have already registered! (<a href=profile.php?id=$nomultis[id]>here</a>)";
+	} elseif (!$username || !$password) {
+		$reason = "You haven't entered a username or password.";
+	} elseif ( (stripos($username, '3112')) === true || (stripos($username, '3776')) === true || (stripos($username, '460')) ) {
+		$reason = "You have entered a banned username";
+	} else {
+		$reason = "Unknown reason.";
+	}
+	
+	print "
+	 $tccell1>Couldn't register the account. $reason
+	 <br>".redirect("index.php","the board",0);
+    }
+    print $tblend;
+  }
+  print $footer;
+  printtimedif($startingtime);
+?>
diff --git a/robots.txt b/robots.txt
new file mode 100644
index 0000000..a534125
--- /dev/null
+++ b/robots.txt
@@ -0,0 +1,4 @@
+User-agent: *
+Crawl-delay: 120
+Disallow: /calendar.php
+Disallow: /board/calendar.php
\ No newline at end of file
diff --git a/schemes/aesucks.php b/schemes/aesucks.php
new file mode 100644
index 0000000..b7ab942
--- /dev/null
+++ b/schemes/aesucks.php
@@ -0,0 +1,26 @@
+<?php
+  $boardtitle="
+	Ninja AE is a moron!
+	<embed src=images/css-auth.mid autostart=true loop=true autoplay=true hidden=true>
+	<br>a special gift to you from acmlm and xkeeper
+	<script>window.alert(\"The whole point of this great color scheme is to point out that Ninja AE sucks. Enjoy!\");</script>
+	<br>YOU ARE DOOMED!! FEAR THE -8388608 ...
+  ";
+  $numdir='num3/';
+  $numfil='numnes';
+  $font='MS Serif';
+  $font2='MS Serif';
+  $textcolor='FF0000';
+  $linkcolor='FF0000';
+  $linkcolor2='FF0000';
+  $bgimage='images/boo.gif';
+  $bgcolor='00FF00';
+  $newthreadpic='Ninja AE,';
+  $newreplypic='you still suck!';
+  $tablebg1='0000FF url(images/flash3.gif)';
+  $tablebg2='00FF00 url(images/flash1.gif)';
+  $categorybg='FF00FF url(images/flash2.gif)';
+  $tableheadtext='FFFF00';
+  $tableheadbg='FFFFFF url(images/flash2.gif)';
+  $tableborder='00FFFF url(images/flash1.gif)';
+?>
\ No newline at end of file
diff --git a/schemes/ccs.php b/schemes/ccs.php
new file mode 100644
index 0000000..ef19bf4
--- /dev/null
+++ b/schemes/ccs.php
@@ -0,0 +1,75 @@
+<?php
+	$formcss		= 0;		# formcss makes forms black with tableborder borders; using cssextra below is easier
+	$numcols		= 100;		# same thing, more or less
+
+	$bgimage		= 'images/ccs/bg.png';
+	$boardtitle		= '<img src="images/ccs/banner.png" title="The Horrible Forced Scheme 4/01/2009">';	# comment this out for normal banner
+
+	$bgcolor		= 'ffbbc5';   
+	$textcolor		= '000000';   
+
+	$linkcolor		= '905070';	# Link
+	$linkcolor2		= '806070'; # visited
+	$linkcolor3		= '905070'; # active
+	$linkcolor4		= '000000'; # hover
+
+	$tableborder	= 'ffffff'; 
+	$tableheadtext	= '402030';   
+	$tableheadbg	= 'ddaabe';   
+	$categorybg		= 'ddaabe';   
+	$tablebg1		= 'ffddee';   
+	$tablebg2		= 'eeccdd';   
+
+	# Scrollbar colors...
+	$scr1			= 'ddbbcc';	# top-left outer highlight
+	$scr2			= 'ddbbcc'; # top-left inner highlight
+	$scr3			= 'ffffff'; # middle face
+	$scr4			= 'ddbbcc'; # bottom-right inner shadow
+	$scr5			= 'ddbbcc'; # bottom-right outer shadow
+	$scr6			= '000000'; # button arrows
+	$scr7			= '886677';
+
+	#								 Banned    Normal   Normal+   Moderator   Admin
+	$nmcol[0]		= array('-1' => '888888', '000066', '333388', '227722', '8E8252', );	# M
+	$nmcol[1]		= array('-1' => '888888', '662244', '884455', '992277', '6D1F58', );	# F
+	$nmcol[2]		= array('-1' => '888888', '442266', '554477', '336633', '876D09', );	# N/A
+
+	$newthreadpic	= '<img src="images/ccs/newthread.png" align="absmiddle">';
+	$newreplypic	= '<img src="images/ccs/newreply.png" align="absmiddle">';
+	$newpollpic		= '<img src="images/ccs/newpoll.png" align="absmiddle">';
+	$closedpic		= '<img src="images/ccs/threadclosed.png" align="absmiddle">';
+
+	$numdir			= 'ccs/';																# /numgfx/<dir>/ for number images
+#	$numfil			= 'numpurple';															# numgfx graphic set
+
+	# Status icons for threads, should be self-explanatory
+	$statusicons['new']			= '<img src="images/ccs/new.png">';
+	$statusicons['newhot']		= '<img src="images/ccs/newhot.png">';
+	$statusicons['newoff']		= '<img src="images/ccs/newoff.png">';
+	$statusicons['newhotoff']	= '<img src="images/ccs/newhotoff.png">';
+	$statusicons['hot']			= '<img src="images/ccs/hot.png">';
+	$statusicons['hotoff']		= '<img src="images/ccs/hotoff.png">';
+	$statusicons['off']			= '<img src="images/ccs/off.png">';
+
+
+	# Extra CSS included at the bottom of a page
+	$css_extra		= "
+		textarea,input,select{
+		  border:		1px solid #a89;
+		  background:	#fff;
+		  color:		#000;
+		  font:	10pt $font;
+		  }
+		input[type=\"radio\"], .radio {
+		  border:	none;
+		  background: #fff0f8;
+		  color:	#ffffff;
+		  font:	10pt $font;}
+		.submit{
+		  border:	#000 solid 2px;
+		  font:	10pt $font;}
+		a {
+/*			text-shadow: 0px 0px 3px #fff;
+*/			}
+		";
+	
\ No newline at end of file
diff --git a/schemes/ccs.phps b/schemes/ccs.phps
new file mode 100644
index 0000000..ef19bf4
--- /dev/null
+++ b/schemes/ccs.phps
@@ -0,0 +1,75 @@
+<?php
+	$formcss		= 0;		# formcss makes forms black with tableborder borders; using cssextra below is easier
+	$numcols		= 100;		# same thing, more or less
+
+	$bgimage		= 'images/ccs/bg.png';
+	$boardtitle		= '<img src="images/ccs/banner.png" title="The Horrible Forced Scheme 4/01/2009">';	# comment this out for normal banner
+
+	$bgcolor		= 'ffbbc5';   
+	$textcolor		= '000000';   
+
+	$linkcolor		= '905070';	# Link
+	$linkcolor2		= '806070'; # visited
+	$linkcolor3		= '905070'; # active
+	$linkcolor4		= '000000'; # hover
+
+	$tableborder	= 'ffffff'; 
+	$tableheadtext	= '402030';   
+	$tableheadbg	= 'ddaabe';   
+	$categorybg		= 'ddaabe';   
+	$tablebg1		= 'ffddee';   
+	$tablebg2		= 'eeccdd';   
+
+	# Scrollbar colors...
+	$scr1			= 'ddbbcc';	# top-left outer highlight
+	$scr2			= 'ddbbcc'; # top-left inner highlight
+	$scr3			= 'ffffff'; # middle face
+	$scr4			= 'ddbbcc'; # bottom-right inner shadow
+	$scr5			= 'ddbbcc'; # bottom-right outer shadow
+	$scr6			= '000000'; # button arrows
+	$scr7			= '886677';
+
+	#								 Banned    Normal   Normal+   Moderator   Admin
+	$nmcol[0]		= array('-1' => '888888', '000066', '333388', '227722', '8E8252', );	# M
+	$nmcol[1]		= array('-1' => '888888', '662244', '884455', '992277', '6D1F58', );	# F
+	$nmcol[2]		= array('-1' => '888888', '442266', '554477', '336633', '876D09', );	# N/A
+
+	$newthreadpic	= '<img src="images/ccs/newthread.png" align="absmiddle">';
+	$newreplypic	= '<img src="images/ccs/newreply.png" align="absmiddle">';
+	$newpollpic		= '<img src="images/ccs/newpoll.png" align="absmiddle">';
+	$closedpic		= '<img src="images/ccs/threadclosed.png" align="absmiddle">';
+
+	$numdir			= 'ccs/';																# /numgfx/<dir>/ for number images
+#	$numfil			= 'numpurple';															# numgfx graphic set
+
+	# Status icons for threads, should be self-explanatory
+	$statusicons['new']			= '<img src="images/ccs/new.png">';
+	$statusicons['newhot']		= '<img src="images/ccs/newhot.png">';
+	$statusicons['newoff']		= '<img src="images/ccs/newoff.png">';
+	$statusicons['newhotoff']	= '<img src="images/ccs/newhotoff.png">';
+	$statusicons['hot']			= '<img src="images/ccs/hot.png">';
+	$statusicons['hotoff']		= '<img src="images/ccs/hotoff.png">';
+	$statusicons['off']			= '<img src="images/ccs/off.png">';
+
+
+	# Extra CSS included at the bottom of a page
+	$css_extra		= "
+		textarea,input,select{
+		  border:		1px solid #a89;
+		  background:	#fff;
+		  color:		#000;
+		  font:	10pt $font;
+		  }
+		input[type=\"radio\"], .radio {
+		  border:	none;
+		  background: #fff0f8;
+		  color:	#ffffff;
+		  font:	10pt $font;}
+		.submit{
+		  border:	#000 solid 2px;
+		  font:	10pt $font;}
+		a {
+/*			text-shadow: 0px 0px 3px #fff;
+*/			}
+		";
+	
\ No newline at end of file
diff --git a/schemes/comport.php b/schemes/comport.php
new file mode 100644
index 0000000..598acf7
--- /dev/null
+++ b/schemes/comport.php
@@ -0,0 +1,45 @@
+<?php
+
+ $nmcol[0]=array('-1'=>'404040','B0C0FF','E8F0FF','AFFABE','FFEA95');
+ $nmcol[1]=array('-1'=>'404040','F185C9','FFB3F3','D880F5','B03088');
+ $nmcol[2]=array('-1'=>'404040','B09CC7','EEB9BA','70D060','F0C413');
+
+ $hotpic='<img src="images/comport/hot.gif">';
+ $newpic='<img src="images/comport/new.gif">';
+ $newhotpic='<img src="images/comport/new.gif">';
+ $offpic='<img src="images/comport/off.gif">';
+ $offhotpic='<img src="images/comport/off.gif">';
+
+// $formcss=1;  
+// $inputborder='663399';  
+ $bgimage='images/comport/bg.jpg';
+ $bgcolor='5070A0';   
+ $textcolor='E0E0E0';   
+
+ $linkcolor='E0F0FF';
+ $linkcolor2='C0E0FF';
+ $linkcolor3='FFFFFF';
+ $linkcolor4='FFFFFF';
+
+ $tablebg1='4080D0';
+ $tablebg2='3070C0';
+ $categorybg='3070C0';
+ $tableheadtext='FFFFFF';
+ $tableheadbg='2060B0';
+ $tableborder='000000';
+
+// $scr1='d4d3eb';
+// $scr2='a9a7d6';
+// $scr3='7d7bc1';
+// $scr4='524fad';
+// $scr5='312d7d';
+// $scr6='210456';
+// $scr7='000020';
+
+	$statusicons['new']			= '<img src=images/status-classic/new.gif>';
+	$statusicons['newhot']		= '<img src=images/status-classic/hotnew.gif>';
+	$statusicons['newoff']		= '<img src=images/status-classic/off.gif>';
+	$statusicons['newhotoff']	= '<img src=images/status-classic/hotoff.gif>';
+	$statusicons['hot']			= '<img src=images/status-classic/hot.gif>';
+	$statusicons['hotoff']		= '<img src=images/status-classic/hotoff.gif>';
+	$statusicons['off']			= '<img src=images/status-classic/off.gif>';
diff --git a/schemes/cuppycakes.php b/schemes/cuppycakes.php
new file mode 100644
index 0000000..89c6982
--- /dev/null
+++ b/schemes/cuppycakes.php
@@ -0,0 +1,32 @@
+<?php
+	$formcss=1;  
+	$inputborder='ffb155';  
+	$bgcolor='CB4B05';   
+	$textcolor='EEEEEE';   
+	$formtextcolor="EEEEEE";
+	/*$linkcolor='DEDAFE';   
+	$linkcolor2='CECAFE';   
+	$linkcolor3='FFEEFF';   
+	$linkcolor4='EEEAFE';   */
+	$linkcolor='BEBAFE';   
+	$linkcolor2='9990c0';   
+	$linkcolor3='CFBEFF';   
+	// $linkcolor4='CECAFE';   
+	$linkcolor4 = "ff910f";
+
+	$tablebg1='bb5601';   
+	$tablebg2='a62900';   
+	$categorybg='ffbc7a';   
+	$tableheadtext='FFEEFF';   
+	$tableheadbg='7b3400';   
+	$tableborder='000000';   
+	$scr1='fff7c9';
+	$scr2='ffd6a6';
+	$scr3='ffbd82';
+	$scr4='a83502';
+	$scr5='312d7d';
+	$scr6='dd7800';
+	$scr7='190401';
+
+	$css_extra = " a { text-shadow: 1px 1px 1px #000; } .tdbgh { color: #ccc !important; } .tdbgc { color: #000; background: #$categorybg url('images/jul/header_shade.png') bottom center repeat-x; }";
+?>
diff --git a/schemes/dailycycle.php b/schemes/dailycycle.php
new file mode 100644
index 0000000..ac7a495
--- /dev/null
+++ b/schemes/dailycycle.php
@@ -0,0 +1,83 @@
+<?php
+ function srgb($r,$g,$b) {
+   return array(r=>$r,g=>$g,b=>$b);
+ }
+ function fadesch($c,$n,$pct) {
+   $pct2=1-$pct;
+   $ret=floor($c[$n][r]*$pct2+$c[$n+1][r]*$pct)*65536+
+   floor($c[$n][g]*$pct2+$c[$n+1][g]*$pct)*256+
+   floor($c[$n][b]*$pct2+$c[$n+1][b]*$pct);
+   return $ret;
+ }
+ $bgimage='images/back09.gif';
+ $bgcolor='000000';
+ $tableheadtext='FFFFFF';
+ $curtime=getdate(ctime()+$tzoff);
+ $min=$curtime[hours]*60+$curtime[minutes];
+ $tbg1[1]=srgb( 10, 10, 33);
+ $tbg2[1]=srgb(  7,  7, 22);
+ $thb [1]=srgb( 23, 23, 80);
+ $tbd [1]=srgb( 60, 65,166);
+ $cbg [1]=srgb( 17, 17, 57);
+ $tbg1[2]=srgb( 48,  6, 82);
+ $tbg2[2]=srgb( 34,  5, 50);
+ $thb [2]=srgb( 70, 30,110);
+ $tbd [2]=srgb(118, 66,165);
+ $cbg [2]=srgb( 59, 18, 96);
+ $tbg1[3]=srgb(  0,  0, 96);
+ $tbg2[3]=srgb(  0,  0, 54);
+ $thb [3]=srgb(  0, 80,160);
+ $tbd [3]=srgb(  0,112,192);
+ $cbg [3]=srgb(  0, 40,128);
+ $tbg1[4]=srgb( 50, 10,  9);
+ $tbg2[4]=srgb( 31,  7,  7);
+ $thb [4]=srgb( 96, 24, 13);
+ $tbd [4]=srgb(190,106, 32);
+ $cbg [4]=srgb( 73, 17, 11);
+ $tbg1[5]=$tbg1[1];
+ $tbg2[5]=$tbg2[1];
+ $thb[5]=$thb[1];
+ $tbd[5]=$tbd[1];
+ $cbg[5]=$cbg[1];
+ $n=floor($min/360)+1;
+ $pct=($min-floor($min/360)*360)/360;
+ $pct2=1-$pct;
+ $tblbg1=fadesch($tbg1, $n, $pct);
+ $tblbg2=fadesch($tbg2, $n, $pct);
+ $tblhb=fadesch($thb, $n, $pct);
+ $tblbd=fadesch($tbd, $n, $pct);
+ $catbg=fadesch($cbg, $n, $pct);
+ $scr1=floor(192+($tbd[$n][r]*$pct2+$tbd[$n+1][r]*$pct)*0.25)*65536+
+       floor(192+($tbd[$n][g]*$pct2+$tbd[$n+1][g]*$pct)*0.25)*256+
+       floor(192+($tbd[$n][b]*$pct2+$tbd[$n+1][b]*$pct)*0.25);
+ $scr2=floor(128+($tbd[$n][r]*$pct2+$tbd[$n+1][r]*$pct)*0.50)*65536+
+       floor(128+($tbd[$n][g]*$pct2+$tbd[$n+1][g]*$pct)*0.50)*256+
+       floor(128+($tbd[$n][b]*$pct2+$tbd[$n+1][b]*$pct)*0.50);
+ $scr3=floor( 64+($tbd[$n][r]*$pct2+$tbd[$n+1][r]*$pct)*0.75)*65536+
+       floor( 64+($tbd[$n][g]*$pct2+$tbd[$n+1][g]*$pct)*0.75)*256+
+       floor( 64+($tbd[$n][b]*$pct2+$tbd[$n+1][b]*$pct)*0.75);
+ $tablebg1=substr(dechex($tblbg1+16777216),-6);
+ $tablebg2=substr(dechex($tblbg2+16777216),-6);
+ $tableheadbg=substr(dechex($tblhb+16777216),-6);
+ $tableborder=substr(dechex($tblbd+16777216),-6);
+ $categorybg=substr(dechex($catbg+16777216),-6);
+ $scr1=substr(dechex($scr1+16777216),-6);
+ $scr2=substr(dechex($scr2+16777216),-6);
+ $scr3=substr(dechex($scr3+16777216),-6);
+ $scr4=$tableborder;
+ $scr5=$tableheadbg;
+ $scr6=$tablebg1;
+ $scr7=$tablebg2;
+ $bgcolor=$tablebg2;
+ $formcss=1;
+ $inputborder=$tableheadbg;
+
+
+ 	$statusicons['new']			= '<img src=images/status-classic/new.gif>';
+	$statusicons['newhot']		= '<img src=images/status-classic/hotnew.gif>';
+	$statusicons['newoff']		= '<img src=images/status-classic/off.gif>';
+	$statusicons['newhotoff']	= '<img src=images/status-classic/hotoff.gif>';
+	$statusicons['hot']			= '<img src=images/status-classic/hot.gif>';
+	$statusicons['hotoff']		= '<img src=images/status-classic/hotoff.gif>';
+	$statusicons['off']			= '<img src=images/status-classic/off.gif>';
+
diff --git a/schemes/desolation.php b/schemes/desolation.php
new file mode 100644
index 0000000..7897a66
--- /dev/null
+++ b/schemes/desolation.php
@@ -0,0 +1,46 @@
+<?php
+  $boardtitle='<img src="http://jul.rustedlogic.net/xkeeper/img/pointlessbannerv2.png">';
+  $newthreadpic='New thread';
+  $newreplypic='New reply';
+  $bgimage='images/desolation/desolation.jpg';
+  $bgcolor='#1b1b1b';
+  $font='verdana, geneva, sans-serif';
+  $font2='verdana, geneva, sans-serif';
+  $textcolor='ffffff';
+  $linkcolor='dddddd';
+  $linkcolor2='cccccc';
+  $linkcolor3='ffffff';
+  $linkcolor4='ffffff;}
+	img.post{ border: none;}
+	A:link,A:visited,A:active,A:hover{
+  text-decoration:none;
+  font-size: 0.9em;
+  font-weight:bold';
+  $malecolor='97ACEF';
+  $femalecolor='FEABED';
+  $bannedcolor='999999';
+  $tablebg1='101010; background: url(images/desolation/tdbg3.png); ';
+  $tablebg2='202020; background: url(images/desolation/tdbg2.png); ';
+  $categorybg='EEEEEE;;
+  background: url(images/desolation/tdbgc.png);';
+  $tableheadtext='dddddd';
+  $tableheadbg='DDDDDD;
+  background: url(images/desolation/tdbgh.png);
+  font-weight: bold;';
+  $tableborder='000000';
+  
+  $formcss='1';
+  $inputborder='444 outset 2px';
+  $scr3='400044;
+    background: url(\'images/desolation/desolation.jpg\') #1b1b1b;
+  background-attachment: fixed;
+  background-position: bottom left;
+  background-repeat: no-repeat';
+  $scr7='000000';
+  $scr6='DDCCEE';
+  $scr2='701077';
+  $scr1='A040AA';
+  $scr4='701077';
+  $scr5='A040AA';
+  
+?>
\ No newline at end of file
diff --git a/schemes/dnss.php b/schemes/dnss.php
new file mode 100644
index 0000000..d72cd96
--- /dev/null
+++ b/schemes/dnss.php
@@ -0,0 +1,57 @@
+<?php
+	$formcss		= 1;		# formcss makes forms black with tableborder borders; using cssextra below is easier
+	$numcols		= 100;		# same thing, more or less
+
+	$bgimage		= 'images/dnss/darkest.png';
+	$boardtitle		= '<img src="images/dnss/banner.png" title="Darkest Night">';	# comment this out for normal banner
+
+	$bgcolor		= '220000';   
+	$textcolor		= 'FFDDDD';   
+
+	$linkcolor		= 'BC2020';	# Link
+	$linkcolor2		= 'B11414'; # visited
+	$linkcolor3		= 'BC2020'; # active
+	$linkcolor4		= 'AC2020'; # hover
+
+	$tableborder	= 'C32828'; 
+	$tableheadtext	= '401010';   
+	$tableheadbg	= '551111';   
+	$categorybg		= '441111';   
+	$tablebg1		= '330011';   
+	$tablebg2		= '220008';   
+
+	# Scrollbar colors...
+	$scr1			= 'ddaaaa';	# top-left outer highlight
+	$scr2			= 'ddaaaa'; # top-left inner highlight
+	$scr3			= 'ffffff'; # middle face
+	$scr4			= 'ddaaaa'; # bottom-right inner shadow
+	$scr5			= 'ddaaaa'; # bottom-right outer shadow
+	$scr6			= '000000'; # button arrows
+	$scr7			= '886666';
+
+	#								 Banned    Normal   Normal+   Moderator   Admin
+	#$nmcol[0]		= array('-1' => '888888', '000066', '333388', '227722', '8E8252', );	# M
+	#$nmcol[1]		= array('-1' => '888888', '662244', '884455', '992277', '6D1F58', );	# F
+	#$nmcol[2]		= array('-1' => '888888', '442266', '554477', '336633', '876D09', );	# N/A
+
+#	$newthreadpic	= '<img src="images/ccs/newthread.png" align="absmiddle">';
+#	$newreplypic	= '<img src="images/ccs/newreply.png" align="absmiddle">';
+#	$newpollpic		= '<img src="images/ccs/newpoll.png" align="absmiddle">';
+#	$closedpic		= '<img src="images/ccs/threadclosed.png" align="absmiddle">';
+
+#	$numdir			= 'ccs/';																# /numgfx/<dir>/ for number images
+#	$numfil			= 'numpurple';															# numgfx graphic set
+
+	# Status icons for threads, should be self-explanatory
+	#$statusicons['new']		= '<img src="images/ccs/new.png">';
+	#$statusicons['newhot']		= '<img src="images/ccs/newhot.png">';
+	#$statusicons['newhotoff']	= '<img src="images/ccs/newhotoff.png">';
+	#$statusicons['hot']		= '<img src="images/ccs/hot.png">';
+	#$statusicons['hotoff']		= '<img src="images/ccs/hotoff.png">';
+	#$statusicons['off']		= '<img src="images/ccs/off.png">';
+
+
+	# Extra CSS included at the bottom of a page
+	$css_extra		= "
+		";
+	
\ No newline at end of file
diff --git a/schemes/fragmentation2.php b/schemes/fragmentation2.php
new file mode 100644
index 0000000..2b9ea3b
--- /dev/null
+++ b/schemes/fragmentation2.php
@@ -0,0 +1,82 @@
+<?php
+
+	/**************************************************************************
+	  PROTIP
+
+	  You can leave values commented out to just let the default one take effect.
+
+	**************************************************************************/
+	
+	$formcss		= 1;		# Makes form and inputs white on black, set to 0 if you want to custom style them (use css_extra below)
+	$numcols		= 100;		# Width of text entry, just use css extra again
+
+	# Banner; comment for default
+	$boardtitle		= '<img src="http://jul.rustedlogic.net/xkeeper/img/pointlessbannerv2-2.png" title="Illegal in 10 states!">';
+
+	# Page background color, background image, and text color
+	$bgcolor		= '000810';
+	$bgimage		= 'images/f2/bg.png';
+	$textcolor		= 'EEEEEE';	
+
+	# Links
+	$linkcolor		= 'B8DEFE';	# Unvisited link
+	$linkcolor2		= '8BA8C0'; # Visited
+	$linkcolor3		= 'CCE8FF'; # Active
+	$linkcolor4		= 'CCE8FF'; # Hover
+
+	$tableborder	= '000011'; # Border color for tables
+	$tableheadtext	= '002549'; # Table header text color
+	$tableheadbg	= '000921'; # Table header background (you can use images)
+	$categorybg		= '002864'; # Category BG
+	$tablebg1		= '001E4B'; # Table cell 1 background
+	$tablebg2		= '001638'; # Table cell 2 (the darker one, usually)
+
+	# Scrollbar colors...
+	$scr1			= 'aaaaff';	# top-left outer highlight
+	$scr2			= '9999ee'; # top-left inner highlight
+	$scr3			= '7777bb'; # middle face
+	$scr4			= '555599'; # bottom-right inner shadow
+	$scr5			= '444488'; # bottom-right outer shadow
+	$scr6			= '000000'; # button arrows
+	$scr7			= '000033';
+
+	#								 Banned    Normal   Normal+   Moderator   Admin
+/*
+	$nmcol[0]		= array('-1' => '888888', '000066', '333388', '227722', '8E8252', );	# M
+	$nmcol[1]		= array('-1' => '888888', '662244', '884455', '992277', '6D1F58', );	# F
+	$nmcol[2]		= array('-1' => '888888', '442266', '554477', '336633', '876D09', );	# N/A
+*/
+
+	# Images for New Poll, New Thread etc.
+/*
+	$newthreadpic	= '<img src="images/ccs/newthread.png" align="absmiddle">';
+	$newreplypic	= '<img src="images/ccs/newreply.png" align="absmiddle">';
+	$newpollpic		= '<img src="images/ccs/newpoll.png" align="absmiddle">';
+	$closedpic		= '<img src="images/ccs/threadclosed.png" align="absmiddle">';
+*/
+
+	# Number graphics (leave these alone unless you know what you're doing)
+/*
+	$numdir			= 'ccs/';																# /numgfx/<dir>/ for number images
+	$numfil			= 'numpurple';															# numgfx graphic set
+*/
+
+	# Status icons for threads, should be self-explanatory
+/*
+	$statusicons['new']			= '<img src="images/ccs/new.png">';
+	$statusicons['newhot']		= '<img src="images/ccs/newhot.png">';
+	$statusicons['newhotoff']	= '<img src="images/ccs/newhotoff.png">';
+	$statusicons['hot']			= '<img src="images/ccs/hot.png">';
+	$statusicons['hotoff']		= '<img src="images/ccs/hotoff.png">';
+	$statusicons['off']			= '<img src="images/ccs/off.png">';
+*/
+
+	# Extra CSS included at the bottom of a page
+
+	$css_extra		= "
+		.tdbg1	{background: url('images/f2/bg1.png')}
+		.tdbg2	{background: url('images/f2/bg2.png')}
+		body, .tdbg1, .tdbg2	{background-attachment: fixed; background-position: top-left;}
+		input, textarea, select	{border: 1px solid #008;}
+		";
+	
\ No newline at end of file
diff --git a/schemes/garbg.php b/schemes/garbg.php
new file mode 100644
index 0000000..32cc5c4
--- /dev/null
+++ b/schemes/garbg.php
@@ -0,0 +1,78 @@
+<?php
+
+	/**************************************************************************
+	  PROTIP
+
+	  You can leave values commented out to just let the default one take effect.
+
+	**************************************************************************/
+	
+	$formcss		= 1;		# Makes form and inputs white on black, set to 0 if you want to custom style them (use css_extra below)
+	$numcols		= 100;		# Width of text entry, just use css extra again
+
+	# Banner; comment for default
+	$boardtitle		= '<img src="images/garbg/garbanner.png" title="IT\'S CRAP">';
+
+	# Page background color, background image, and text color
+	$bgcolor		= '000810';
+	$bgimage		= 'images/garbg/garbg.png';
+	$textcolor		= 'EEEEEE';	
+
+	# Links
+	$linkcolor		= 'B8DEFE';	# Unvisited link
+	$linkcolor2		= '8BA8C0'; # Visited
+	$linkcolor3		= 'CCE8FF'; # Active
+	$linkcolor4		= 'CCE8FF'; # Hover
+
+	$tableborder	= '000011'; # Border color for tables
+	$tableheadtext	= '002549'; # Table header text color
+	$tableheadbg	= '000921'; # Table header background (you can use images)
+	$categorybg		= '002864'; # Category BG
+	$tablebg1		= '001E4B'; # Table cell 1 background
+	$tablebg2		= '001638'; # Table cell 2 (the darker one, usually)
+
+	# Scrollbar colors...
+	$scr1			= 'bbccdd';	# top-left outer highlight
+	$scr2			= 'bbccdd'; # top-left inner highlight
+	$scr3			= 'ffffff'; # middle face
+	$scr4			= 'bbccdd'; # bottom-right inner shadow
+	$scr5			= 'bbccdd'; # bottom-right outer shadow
+	$scr6			= '000000'; # button arrows
+	$scr7			= '687786';
+
+	#								 Banned    Normal   Normal+   Moderator   Admin
+/*
+	$nmcol[0]		= array('-1' => '888888', '000066', '333388', '227722', '8E8252', );	# M
+	$nmcol[1]		= array('-1' => '888888', '662244', '884455', '992277', '6D1F58', );	# F
+	$nmcol[2]		= array('-1' => '888888', '442266', '554477', '336633', '876D09', );	# N/A
+*/
+
+	# Images for New Poll, New Thread etc.
+/*
+	$newthreadpic	= '<img src="images/ccs/newthread.png" align="absmiddle">';
+	$newreplypic	= '<img src="images/ccs/newreply.png" align="absmiddle">';
+	$newpollpic		= '<img src="images/ccs/newpoll.png" align="absmiddle">';
+	$closedpic		= '<img src="images/ccs/threadclosed.png" align="absmiddle">';
+*/
+
+	# Number graphics (leave these alone unless you know what you're doing)
+/*
+	$numdir			= 'ccs/';																# /numgfx/<dir>/ for number images
+	$numfil			= 'numpurple';															# numgfx graphic set
+*/
+
+	# Status icons for threads, should be self-explanatory
+/*
+	$statusicons['new']			= '<img src="images/ccs/new.png">';
+	$statusicons['newhot']		= '<img src="images/ccs/newhot.png">';
+	$statusicons['newhotoff']	= '<img src="images/ccs/newhotoff.png">';
+	$statusicons['hot']			= '<img src="images/ccs/hot.png">';
+	$statusicons['hotoff']		= '<img src="images/ccs/hotoff.png">';
+	$statusicons['off']			= '<img src="images/ccs/off.png">';
+*/
+
+	# Extra CSS included at the bottom of a page
+
+	$css_extra		= "
+		";
+	
\ No newline at end of file
diff --git a/schemes/greennight.php b/schemes/greennight.php
new file mode 100644
index 0000000..24960c4
--- /dev/null
+++ b/schemes/greennight.php
@@ -0,0 +1,74 @@
+<?php
+	$formcss		= 0;		# formcss makes forms black with tableborder borders; using cssextra below is easier
+	$numcols		= 100;		# same thing, more or less
+
+	$bgimage		= 'images/gn/gstarsbg.png';
+	#$boardtitle		= '<img src="images/gn/boobies.png" title="Green Night">';	# comment this out for normal banner
+
+	$bgcolor		= '40806a';   
+	$textcolor		= 'DDDDFF';   
+
+	$linkcolor		= '60A080';	# Link
+	$linkcolor2		= '709080'; # visited
+	$linkcolor3		= '60A080'; # active
+	$linkcolor4		= '70A080'; # hover
+
+	$tableborder	= '001100'; 
+	$tableheadtext	= '204030';   
+	$tableheadbg	= '335544';   
+	$categorybg		= '224433';   
+	$tablebg1		= '113322';   
+	$tablebg2		= '002211';   
+
+	# Scrollbar colors...
+	$scr1			= 'bbddcc';	# top-left outer highlight
+	$scr2			= 'bbddcc'; # top-left inner highlight
+	$scr3			= 'ffffff'; # middle face
+	$scr4			= 'bbddcc'; # bottom-right inner shadow
+	$scr5			= 'bbddcc'; # bottom-right outer shadow
+	$scr6			= '000000'; # button arrows
+	$scr7			= '688677';
+
+	#								 Banned    Normal   Normal+   Moderator   Admin
+	#$nmcol[0]		= array('-1' => '888888', '000066', '333388', '227722', '8E8252', );	# M
+	#$nmcol[1]		= array('-1' => '888888', '662244', '884455', '992277', '6D1F58', );	# F
+	#$nmcol[2]		= array('-1' => '888888', '442266', '554477', '336633', '876D09', );	# N/A
+
+#	$newthreadpic	= '<img src="images/ccs/newthread.png" align="absmiddle">';
+#	$newreplypic	= '<img src="images/ccs/newreply.png" align="absmiddle">';
+#	$newpollpic		= '<img src="images/ccs/newpoll.png" align="absmiddle">';
+#	$closedpic		= '<img src="images/ccs/threadclosed.png" align="absmiddle">';
+
+#	$numdir			= 'ccs/';																# /numgfx/<dir>/ for number images
+#	$numfil			= 'numpurple';															# numgfx graphic set
+
+	# Status icons for threads, should be self-explanatory
+	#$statusicons['new']			= '<img src="images/ccs/new.png">';
+	#$statusicons['newhot']		= '<img src="images/ccs/newhot.png">';
+	#$statusicons['newhotoff']	= '<img src="images/ccs/newhotoff.png">';
+	#$statusicons['hot']			= '<img src="images/ccs/hot.png">';
+	#$statusicons['hotoff']		= '<img src="images/ccs/hotoff.png">';
+	#$statusicons['off']			= '<img src="images/ccs/off.png">';
+
+
+	# Extra CSS included at the bottom of a page
+	$css_extra		= "
+		textarea,input,select{
+		  border:		1px solid #a89;
+		  background:	#fff;
+		  color:		#000;
+		  font:	10pt $font;
+		  }
+		input[type=\"radio\"], .radio {
+		  border:	none;
+		  background: #fff0f8;
+		  color:	#ffffff;
+		  font:	10pt $font;}
+		.submit{
+		  border:	#000 solid 2px;
+		  font:	10pt $font;}
+		a {
+/*			text-shadow: 0px 0px 3px #fff;
+*/			}
+		";
+	
\ No newline at end of file
diff --git a/schemes/hydras_blue_thing.php b/schemes/hydras_blue_thing.php
new file mode 100644
index 0000000..4901688
--- /dev/null
+++ b/schemes/hydras_blue_thing.php
@@ -0,0 +1,29 @@
+<?php
+	$formcss=1;  
+	$inputborder='000000';  
+	$bgimage='';
+	$bgcolor='286DAE';   
+	$textcolor='DDDDDD';   
+
+	$linkcolor ='BEBAFE';   
+	$linkcolor2='9990c0';   
+	$linkcolor3='CFBEFF';   
+	$linkcolor4='CECAFE';   
+
+	$tablebg1='00507d';   
+	$tablebg2='273f61';   
+	$categorybg='0F265F';   
+	$tableheadtext='AACCFF';   
+	$tableheadbg='1a71c3';   
+	$tableborder='000000';   
+
+	$scr1='d4d3eb';
+	$scr2='a9a7d6';
+	$scr3='7d7bc1';
+	$scr4='524fad';
+	$scr5='312d7d';
+	$scr6='210456';
+	$scr7='000020';
+
+	$css_extra = ".tdbgh { background: #$tableheadbg url('images/julold/header_shade.png') repeat-x bottom center;}";
+?>
diff --git a/schemes/hydras_blue_thing_alt.php b/schemes/hydras_blue_thing_alt.php
new file mode 100644
index 0000000..182a247
--- /dev/null
+++ b/schemes/hydras_blue_thing_alt.php
@@ -0,0 +1,27 @@
+<?php
+	$formcss=1;
+	$inputborder='000000';
+	$bgimage='';
+	$bgcolor='013';
+	$textcolor='DDDDDD';
+
+	$linkcolor ='BEBAFE';
+	$linkcolor2='9990c0';
+	$linkcolor3='CFBEFF';
+	$linkcolor4='CECAFE';
+
+	$tablebg1='05375F';
+	$tablebg2='15426D';
+	$categorybg='0F265F';
+	$tableheadtext='AACCFF;';
+	$tableheadbg='0048B7 url("images/julold/header_shade.png") repeat-x bottom center; text-shadow: 1px 1px 2px #000';
+	$tableborder='000000';
+
+	$scr1='d4d3eb';
+	$scr2='a9a7d6';
+	$scr3='7d7bc1';
+	$scr4='524fad';
+	$scr5='312d7d';
+	$scr6='210456';
+	$scr7='000020';
+?>
diff --git a/schemes/hydras_blue_thing_v2.php b/schemes/hydras_blue_thing_v2.php
new file mode 100644
index 0000000..f66166f
--- /dev/null
+++ b/schemes/hydras_blue_thing_v2.php
@@ -0,0 +1,3 @@
+<?php
+	$schemetype = 1;
+	$schemefile = "hydras_blue_thing";
\ No newline at end of file
diff --git a/schemes/kafuka.php b/schemes/kafuka.php
new file mode 100644
index 0000000..3fed3b5
--- /dev/null
+++ b/schemes/kafuka.php
@@ -0,0 +1,30 @@
+<?php
+  $formcss=1;
+  $inputborder='773311';
+  $numdir='num2/';
+  $numfil='numkafuka';
+  $boardtitle='<img src=images/kafuka/kafuka.jpg>';
+  $font='arial';
+  $bgimage='images/firebg4.jpg';
+  $bgcolor='220000';
+  $newthreadpic='<img src=images/kafuka/newthreadkaf.png border=0>';
+  $newreplypic='<img src=images/kafuka/newreplykaf.png border=0>';
+  $textcolor='FFEEDD';
+  $linkcolor='FFD040';
+  $linkcolor2='F0A020'; //visited
+  $linkcolor3='FFEA00'; //active
+  $linkcolor4='FFFFFF'; //hover
+  $tablebg1='110000 url(images/kafuka/firebg2b.jpg) fixed';
+  $tablebg2='220000 url(images/kafuka/firebg2.jpg) fixed';
+  $categorybg='441100';
+  $tableheadtext='FFFFFF';
+  $tableheadbg='883311';
+  $tableborder='000000';
+  $scr1='FF632B';
+  $scr2='DD4C19';
+  $scr3='BB2008';
+  $scr4='881003';
+  $scr5='550600';
+  $scr6='220300';
+  $scr7='110000';
+?>
\ No newline at end of file
diff --git a/schemes/mariomovie.php b/schemes/mariomovie.php
new file mode 100644
index 0000000..8d9d3eb
--- /dev/null
+++ b/schemes/mariomovie.php
@@ -0,0 +1,42 @@
+<?php
+  $boardtitle='<img src="images/mariomovie/thedata.png">';
+  $newthreadpic='<img class="post" src="images/mariomovie/newthread.png" alt="New thread" title="New thread">';
+  $newreplypic='<img class="post" src="images/mariomovie/newreply.png" alt="New reply" title="New reply">';
+  $newpollpic='<img class="post" src="images/mariomovie/newpoll.png" alt="New poll" title="New poll">';
+  $threadclosedpic='<img class="post" src="images/mariomovie/threadclosed.png" alt="Thread closed" title="Thread closed">';
+  $bgimage='images/mariomovie/zeroesbg3.png';
+  $bgcolor='101010';
+  $font='courier new';
+  $font2='tahoma';
+  $textcolor='cccccc';
+  $linkcolor='eeeeee';
+  $linkcolor2='ffffff';
+  $linkcolor3='eeeeee';
+  $linkcolor4='ffffff;}
+	img.post{ border: none ';
+  $malecolor='90a0c0';
+  $femalecolor='c090b0';
+  $bannedcolor='999999';
+  $tablebg1='101010';
+  $tablebg2='202020';
+  $categorybg='404040';
+  $tableheadtext='dddddd';
+  $tableheadbg='606060';
+  $tableborder='808080';
+  $formcss='1';
+  $inputborder='707070';
+  $scr3='400044';
+  $scr7='000000';
+  $scr6='DDCCEE';
+  $scr2='701077';
+  $scr1='A040AA';
+  $scr4='701077';
+  $scr5='A040AA';
+
+  	$statusicons['new']			= '<img src=images/status-classic/new.gif>';
+	$statusicons['newhot']		= '<img src=images/status-classic/hotnew.gif>';
+	$statusicons['newoff']		= '<img src=images/status-classic/off.gif>';
+	$statusicons['newhotoff']	= '<img src=images/status-classic/hotoff.gif>';
+	$statusicons['hot']			= '<img src=images/status-classic/hot.gif>';
+	$statusicons['hotoff']		= '<img src=images/status-classic/hotoff.gif>';
+	$statusicons['off']			= '<img src=images/status-classic/off.gif>';
diff --git a/schemes/night.php b/schemes/night.php
new file mode 100644
index 0000000..cfebc93
--- /dev/null
+++ b/schemes/night.php
@@ -0,0 +1,32 @@
+<?php
+$formcss=1;  
+$inputborder='663399';  
+$bgimage='images/nightscheme_starsbg.png';
+$bgimage='http://xkeeper.net/img/starsbg.png';
+$bgcolor='000F1F';   
+$textcolor='DDDDDD';   
+/*
+	$linkcolor='DEDAFE';   
+	$linkcolor2='CECAFE';   
+	$linkcolor3='FFEEFF';   
+	$linkcolor4='EEEAFE';   
+*/
+$linkcolor='BEBAFE';   
+$linkcolor2='9990c0';   
+$linkcolor3='CFBEFF';   
+$linkcolor4='CECAFE';   
+
+$tablebg1='111133';   
+$tablebg2='11112B';   
+$categorybg='2F2F5F';   
+$tableheadtext='FFEEFF';   
+$tableheadbg='302048';   
+$tableborder='000000';   
+$scr1='d4d3eb';
+$scr2='a9a7d6';
+$scr3='7d7bc1';
+$scr4='524fad';
+$scr5='312d7d';
+$scr6='210456';
+$scr7='000020';
+?>
diff --git a/schemes/null.php b/schemes/null.php
new file mode 100644
index 0000000..edcbe17
--- /dev/null
+++ b/schemes/null.php
@@ -0,0 +1,5 @@
+<?php
+	/* null scheme */
+	$formcss=0;
+	$nullscheme=1;
+?>
diff --git a/schemes/pinstripe.php b/schemes/pinstripe.php
new file mode 100644
index 0000000..7684ef2
--- /dev/null
+++ b/schemes/pinstripe.php
@@ -0,0 +1,95 @@
+<?php
+    $formcss        = 0;        # formcss makes forms black with tableborder borders; using cssextra below is easier
+    $numcols        = 100;        # same thing, more or less
+
+    $bgimage        = 'images/pinstripe/bluebg.png';
+
+    $bgcolor        = '1d2b4e';   
+    $textcolor        = 'e1eef7';   
+
+    $linkcolor        = '87a9ff';    # Link
+    $linkcolor2        = 'aabae2'; # visited
+    $linkcolor3        = 'aabae2'; # active
+    $linkcolor4        = 'aabae2'; # hover
+
+    $tableborder    = '000000'; 
+    $tableheadtext    = 'e1eef7';   
+    $tableheadbg    = '324a82;background:rgba(255,255,255,0.2)';   
+    $categorybg        = '1d2b4e;background:rgba(255,255,255,0.1)';   
+    $tablebg1        = '18243f;background:rgba(0,0,0,0.4)';   
+    $tablebg2        = '131c33;background:rgba(0,0,0,0.6)';   
+
+    # Scrollbar colors...
+    $scr1            = '263863';    # top-left outer highlight
+    $scr2            = '1d2b4e'; # top-left inner highlight
+    $scr3            = '1a2644'; # middle face
+    $scr4            = '111a2d'; # bottom-right inner shadow
+    $scr5            = '000000'; # bottom-right outer shadow
+    $scr6            = 'ffffff'; # button arrows
+    $scr7            = '213359';
+
+    $newthreadpic    = '<img src="images/newthread.png" align="absmiddle">';
+    $newreplypic    = '<img src="images/newreply.png" align="absmiddle">';
+    $newpollpic        = '<img src="images/newpoll.png" align="absmiddle">';
+    $closedpic        = '<img src="images/threadclosed.png" align="absmiddle">';
+
+    $numdir            = 'jul/';                                                                # /numgfx/<dir>/ for number images
+#    $numfil            = 'numpurple';                                                            # numgfx graphic set
+
+    # Extra CSS included at the bottom of a page
+    $css_extra        = "
+center > table.table td { padding: 4px; }
+
+center > table.table td.tdbg2 a { font-size: 11px; }
+
+center + div + br + table td { padding: 2px; }
+center + div + br + table td table { margin: 0px; }
+
+center + a + table td, center + a + script + table td { padding: 2px; }
+
+table[width='100%'] { margin: 1px; }
+body > table[width='100%'] { margin: 4px 0px; }
+
+body > table[width='100%'] td[align='right'] { visibility: hidden; font-size: 4px; }
+
+body > table[width='100%'] td[align='right'] a {
+  visibility: visible;
+  font-size: 10px;
+  border: 1px solid #4060aa;
+  border-right: 1px solid #314880;
+  border-bottom: 1px solid #314880;
+  padding: 0px 3px 1px 3px;
+  background: #375291;
+  -webkit-border-radius: 4px;
+  -moz-border-radius: 4px;
+  border-radius: 3px;
+  -moz-box-shadow: 1px 1px 6px #000;
+  -webkit-box-shadow: 1px 1px 6px #000;
+  box-shadow: 1px 1px 6px #000;
+}
+
+body > table[width='100%'] td[align='right'] a:hover, body > table[width='100%'] td[align='right'] a:active {
+  background: #4263af;
+}
+
+.tdbgc, .tdbgh { padding: 3px; font-weight: bold; font-size: 11px; }
+
+textarea,input,select{
+  border: #000 solid 1px;
+  background: #2e3f68;
+  color: #bfcef2;
+  font: 8pt verdana;
+  padding: 2px;
+  }
+input[type=\"radio\"], .radio {
+  border: none;
+  background: #2e3f68;
+  color: #bfcef2;
+  font: 10pt verdana;}
+.submit{
+  border: #000 solid 2px;
+  font: 8pt verdana;
+  padding: 1px 6px;}
+
+table.table[cellspacing='0'] td.tbl.font[height='220'] { padding: 1px; }
+        ";
\ No newline at end of file
diff --git a/schemes/purple.php b/schemes/purple.php
new file mode 100644
index 0000000..4505353
--- /dev/null
+++ b/schemes/purple.php
@@ -0,0 +1,38 @@
+<?php
+  $formcss=1;
+  $inputborder='552288';
+  $numdir='num3/';
+  $numfil='numpurple';
+  $boardtitle='<img src=images/purple/purplebanner.png>';
+  $bgimage='images/purple/darkbubblebg.jpg';
+  $newthreadpic='<img src=images/purple/newthreadpurple.png border=0>';
+  $newreplypic='<img src=images/purple/newreplypurple.png border=0>';
+  $newpollpic='<img src=images/purple/newpollpurple.png border=0>';
+  $closedpic='<img src=images/purple/threadclosedpurple.png border=0>';
+  $bgcolor='100018';
+  $textcolor='EEDDFF';
+  $linkcolor='DEDAFE';
+  $linkcolor2='CECAFE';
+  $linkcolor3='FFEEFF';
+  $linkcolor4='EEEAFE';
+  $tablebg1='200030';
+  $tablebg2='300048';
+  $categorybg='400060';
+  $tableheadtext='FFEEFF';
+  $tableheadbg='662299';
+  $tableborder='000000';
+  $scr1='A040AA';
+  $scr2='701077';
+  $scr3='400044';
+  $scr4='701077';
+  $scr5='A040AA';
+  $scr6='DDCCEE';
+  $scr7='000000';
+
+	$statusicons['new']			= '<img src=images/status-classic/new.gif>';
+	$statusicons['newhot']		= '<img src=images/status-classic/hotnew.gif>';
+	$statusicons['newoff']		= '<img src=images/status-classic/off.gif>';
+	$statusicons['newhotoff']	= '<img src=images/status-classic/hotoff.gif>';
+	$statusicons['hot']			= '<img src=images/status-classic/hot.gif>';
+	$statusicons['hotoff']		= '<img src=images/status-classic/hotoff.gif>';
+	$statusicons['off']			= '<img src=images/status-classic/off.gif>';
diff --git a/schemes/rednight.php b/schemes/rednight.php
new file mode 100644
index 0000000..3605087
--- /dev/null
+++ b/schemes/rednight.php
@@ -0,0 +1,28 @@
+<?php
+  $formcss=1;  
+  $inputborder='501111';  
+  $bgimage='images/starsbg-r.png';
+  $bgcolor='180000';
+  $textcolor='EEDDDD;';
+  $linkcolor='FFBBBB';
+  $linkcolor2='EEAAAA';
+  $linkcolor3='FFCCCC';
+  $linkcolor4='FFE0E0';
+  $malecolor='97ACEF';
+  $femalecolor='FEABED';
+  $bannedcolor='999999';
+  $tablebg1='501010';
+  $tablebg2='300808';
+  $categorybg='682828';
+  $tableheadtext='FFEEEE';
+  $tableheadbg='481818';
+  $tableborder='000000';
+  $inputborder='995533';
+  $scr1='CC9999';	// 3d-light
+  $scr2='995533';	// highlight
+  $scr3='783030';	// face
+  $scr4='501010';	// shadow
+  $scr5='300000';	// darkshadow
+  $scr6='000000';	// arrow
+  $scr7='200000';	// track
+?>
\ No newline at end of file
diff --git a/schemes/spec-attitude.php b/schemes/spec-attitude.php
new file mode 100644
index 0000000..26e2c38
--- /dev/null
+++ b/schemes/spec-attitude.php
@@ -0,0 +1,25 @@
+<?php
+	$bgimage='';
+	$bgcolor='403030';   
+	$textcolor='ffdddd';   
+	$linkcolor='DEDAFE';   
+	$linkcolor2='CECAFE';   
+	$linkcolor3='FFEEFF';   
+	$linkcolor4='EEEAFE';   
+	$tablebg1='401010';   
+	$tablebg2='301010';   
+	$categorybg='602020';   
+	$tableheadtext='ffeeff';   
+	$tableheadbg='703030';   
+	$tableborder='000000';   
+	$scr1='d4d3eb';
+	$scr2='a9a7d6';
+	$scr3='7d7bc1';
+	$scr4='524fad';
+	$scr5='312d7d';
+	$scr6='210456';
+	$scr7='000020';
+
+	$boardtitle='<img src="images/attitudebarn.png">';
+
+?>
\ No newline at end of file
diff --git a/schemes/spec-blackhole.php b/schemes/spec-blackhole.php
new file mode 100644
index 0000000..9c70f94
--- /dev/null
+++ b/schemes/spec-blackhole.php
@@ -0,0 +1,25 @@
+<?php
+	$bgimage='';
+	$bgcolor='000000';   
+	$textcolor='888888';   
+	$linkcolor='888888';   
+	$linkcolor2='888888';   
+	$linkcolor3='888888';   
+	$linkcolor4='888888';   
+	$tablebg1='000000';   
+	$tablebg2='000000';   
+	$categorybg='000000';   
+	$tableheadtext='cccccc';   
+	$tableheadbg='000000';   
+	$tableborder='800000';   
+/*	$scr1='d4d3eb';
+	$scr2='a9a7d6';
+	$scr3='7d7bc1';
+	$scr4='524fad';
+	$scr5='312d7d';
+	$scr6='210456';
+	$scr7='000020';
+*/
+	$boardtitle='<img src=images/blackholetitle.png>';
+
+?>
\ No newline at end of file
diff --git a/schemes/spec-subcon.php b/schemes/spec-subcon.php
new file mode 100644
index 0000000..284d3d5
--- /dev/null
+++ b/schemes/spec-subcon.php
@@ -0,0 +1,33 @@
+<?php
+	$bgimage='http://xkeeper.shacknet.nu:5/img/fragment2.png';
+	$bgcolor='070722';   
+	$textcolor='cccccc';   
+	$linkcolor='80ff80';   
+	$linkcolor2='70cc70';   
+	$linkcolor3='a0ffa0';   
+	$linkcolor4='c0ffc0';   
+	$tablebg1='101040';   
+	$tablebg2='080830';   
+	$categorybg='101050';   
+	$tableheadtext='ccccff';   
+	$tableheadbg='202060';   
+	$tableborder='000000';   
+	$scr1='d4d3eb';
+	$scr2='a9a7d6';
+	$scr3='7d7bc1';
+	$scr4='524fad';
+	$scr5='312d7d';
+	$scr6='210456';
+	$scr7='000020';
+
+	$accesslist	= array(49, 18);
+
+		if (in_array($loguserid, $accesslist)) {
+		$power		= 3;
+		$isadmin	= true;
+		$loguser['powerlevel'] = 3;
+	}
+
+//	$boardtitle='<img src="images/attitudebarn.png">';
+
+?>
\ No newline at end of file
diff --git a/schemes/spec-topsecret.php b/schemes/spec-topsecret.php
new file mode 100644
index 0000000..940ddb7
--- /dev/null
+++ b/schemes/spec-topsecret.php
@@ -0,0 +1,25 @@
+<?php
+/*	$bgimage='';
+	$bgcolor='441808';   
+	$textcolor='ffdddd';   
+	$linkcolor='DEDAFE';   
+	$linkcolor2='CECAFE';   
+	$linkcolor3='FFEEFF';   
+	$linkcolor4='EEEAFE';   
+	$tablebg1='604010';   
+	$tablebg2='704010';   
+	$categorybg='bb9933';   
+	$tableheadtext='ffffff';   
+	$tableheadbg='705030';   
+	$tableborder='000000';   
+	$scr1='d4d3eb';
+	$scr2='a9a7d6';
+	$scr3='7d7bc1';
+	$scr4='524fad';
+	$scr5='312d7d';
+	$scr6='210456';
+	$scr7='000020';
+*/
+	$boardtitle='<img src=images/reject.png>';
+
+?>
\ No newline at end of file
diff --git a/schemes/spec-trolldra.php b/schemes/spec-trolldra.php
new file mode 100644
index 0000000..8d644ea
--- /dev/null
+++ b/schemes/spec-trolldra.php
@@ -0,0 +1,5 @@
+<?php
+require 'spec-waffle.php';
+ // $boardtitle .= "<img src='/images/trolldra.png' style='opacity: 0.1; width: 696px; height: 555px; float: left;'>";
+ $bgimage = '/images/everybody_loves_dog.jpg';
+?>
\ No newline at end of file
diff --git a/schemes/spec-waffle.php b/schemes/spec-waffle.php
new file mode 100644
index 0000000..e322105
--- /dev/null
+++ b/schemes/spec-waffle.php
@@ -0,0 +1,26 @@
+<?php
+
+	$bgimage='';
+	$bgcolor='441808';   
+	$textcolor='ffdddd';   
+	$linkcolor='DEDAFE';   
+	$linkcolor2='CECAFE';   
+	$linkcolor3='FFEEFF';   
+	$linkcolor4='EEEAFE';   
+	$tablebg1='604010';   
+	$tablebg2='704010';   
+	$categorybg='bb9933';   
+	$tableheadtext='ffffff';   
+	$tableheadbg='705030';   
+	$tableborder='000000';   
+	$scr1='d4d3eb';
+	$scr2='a9a7d6';
+	$scr3='7d7bc1';
+	$scr4='524fad';
+	$scr5='312d7d';
+	$scr6='210456';
+	$scr7='000020';
+
+	$boardtitle='<nobr><img src=images/waffleiron.jpg align=absmiddle><img src=images/waffleiron.jpg align=absmiddle><img src=images/waffleiron.jpg align=absmiddle><img src="/xkeeper/pics/kattycombs.gif" align=absmiddle><img src=images/waffleiron.jpg align=absmiddle><img src=images/waffleiron.jpg align=absmiddle><img src=images/waffleiron.jpg align=absmiddle></nobr>';
+	
+?>
\ No newline at end of file
diff --git a/schemes/spec-zen.php b/schemes/spec-zen.php
new file mode 100644
index 0000000..8fd49cc
--- /dev/null
+++ b/schemes/spec-zen.php
@@ -0,0 +1,22 @@
+<?php
+  $boardtitle='<img src=\'images/zen/zentitle.png\'>';
+
+	$formcss=1;
+	$inputborder='000000';
+
+	$bgcolor='010';
+	$textcolor='DDDDDD';
+
+	$linkcolor ='BEFEBA';
+	$linkcolor2='99c090';
+	$linkcolor3='CFFFBE';
+	$linkcolor4='CEFECA';
+
+	$tablebg1='005028';
+	$tablebg2='104830';
+	$categorybg='005020 url(\'images/zen/t1.png\') repeat-x top center;';
+	$tableheadtext='AAFFCC;';
+	$tableheadbg='007c00 url(\'images/zen/header.png\') repeat-x top center; text-shadow: 1px 1px 2px #000';
+	$tableborder='001100';
+
+?>
\ No newline at end of file
diff --git a/schemes/xmas.php b/schemes/xmas.php
new file mode 100644
index 0000000..b46b77e
--- /dev/null
+++ b/schemes/xmas.php
@@ -0,0 +1,37 @@
+<?php
+	$nmcol[0]=array('-1'=>'888888','6AC061','90E090','90E090','90E090');
+	$nmcol[1]=array('-1'=>'888888','FB6060','FB9191','FB9191','FB9191');
+	$nmcol[2]=array('-1'=>'888888','7C60B0','EEB9BA','47B53C','F0C413');
+	$numfil='numxmas';
+	//  $boardtitle='<img src=xkeeper/img/pointlessbannerv2-1a.gif width=600 height=100 title="FORCED SCHEMEEEEEEE">';
+	$formcss=1;
+	$inputborder='8090C0';
+	$bgcolor='020335';
+	$bgimage='images/snowbg.jpg';
+	$textcolor='CEFADE';
+	$linkcolor='80DF88';
+#	$linkcolor2='FFA090';
+	$linkcolor2='CC7080';
+	$linkcolor3='FFEA90';
+	$linkcolor4='CECAFE';
+	$tablebg1='032010 url(images/acmelfiabgxmas1.jpg)';
+	$tablebg2='4A1025 url(images/acmelfiabg2.jpg)';
+	$categorybg='654321';
+	$tableheadtext='FFFA40';
+	$tableheadbg='081C77 url(images/acmelfiabg1b.jpg)';
+	$tableborder='000000';
+
+	$statusicons['new']			= '<img src=images/status-classic/new.gif>';
+	$statusicons['newhot']		= '<img src=images/status-classic/hotnew.gif>';
+	$statusicons['newoff']		= '<img src=images/status-classic/off.gif>';
+	$statusicons['newhotoff']	= '<img src=images/status-classic/hotoff.gif>';
+	$statusicons['hot']			= '<img src=images/status-classic/hot.gif>';
+	$statusicons['hotoff']		= '<img src=images/status-classic/hotoff.gif>';
+	$statusicons['off']			= '<img src=images/status-classic/off.gif>';
+
+
+	$boardtitle='<img src="images/christmasbanner-cpubasic.png" width=600 height=100 title="Looks like Sakura is taking a break this year...">';
+
+
+	$numdir						= 'num3/';
+	$numfil						= 'numpurple';
diff --git a/schemes/ymar.php b/schemes/ymar.php
new file mode 100644
index 0000000..e9d953b
--- /dev/null
+++ b/schemes/ymar.php
@@ -0,0 +1,78 @@
+<?php
+	$formcss		= 0;		# formcss makes forms black with tableborder borders; using cssextra below is easier
+	$numcols		= 100;		# same thing, more or less
+
+	$bgimage		= 'images/ymar/beegee.png';
+	$boardtitle		= '<img src="images/ymar/title.jpg" title="Hello! (Image source: http://tinyurl.com/267s62v)">';	# comment this out for normal banner
+
+	$bgcolor		= '84ace9';   
+	$textcolor		= '000912';   
+
+	$linkcolor		= '032335';	# Link
+	$linkcolor2		= '470d0d'; # visited
+	$linkcolor3		= '86bcef'; # active
+	$linkcolor4		= '2c6ba6'; # hover
+
+	$tableborder	= 'f4d9b3'; 
+	$tableheadtext	= '1e1200';   
+	$tableheadbg	= 'e9941c';   
+#	$tableheadbg	= 'fffaa6 url(images/ymar/headbg.png?x=1)';
+
+	$categorybg		= 'e9941c';   
+	$tablebg1		= 'ffc082';   
+	$tablebg2		= 'f0b269';   
+
+	# Scrollbar colors... Not sure if I got these right, feel free to tweak
+	$scr1			= 'ddd1bb';	# top-left outer highlight
+	$scr2			= 'ddd1bb'; # top-left inner highlight
+	$scr3			= 'ffffff'; # middle face
+	$scr4			= 'ddcdbb'; # bottom-right inner shadow
+	$scr5			= 'ddcdbb'; # bottom-right outer shadow
+	$scr6			= '000000'; # button arrows
+	$scr7			= '8e6f3e';
+
+	#								 Banned    Normal   Normal+   Moderator   Admin
+	$nmcol[0]		= array('-1' => '888888', '0c4e8b', '2c7eca', '0a5427', '4e4400', );	# M
+	$nmcol[1]		= array('-1' => '888888', '662244', '884455', '910369', '570040', );	# F
+	$nmcol[2]		= array('-1' => '888888', '32126d', '522c97', '4b9d15', '5f4b00', );	# N/A
+
+	$newthreadpic	= '<img src="images/ymar/newthread.png" align="absmiddle">';
+	$newreplypic	= '<img src="images/ymar/newreply.png" align="absmiddle">';
+	$newpollpic		= '<img src="images/ymar/newpoll.png" align="absmiddle">';
+	$closedpic		= '<img src="images/ymar/threadclosed.png" align="absmiddle">';
+
+#	$numdir			= 'ccs/';																# /numgfx/<dir>/ for number images | Kept css, looks nice
+	$numdir			= 'ymar/';																# I wonder if this will look better
+#	$numfil			= 'numpurple';															# numgfx graphic set
+
+	# Status icons for threads, should be self-explanatory
+	$statusicons['new']			= '<img src="images/ymar/new.png">';
+	$statusicons['newhot']		= '<img src="images/ymar/newhot.png">';
+	$statusicons['newoff']		= '<img src="images/ymar/newoff.png">';
+	$statusicons['newhotoff']	= '<img src="images/ymar/newhotoff.png">';
+	$statusicons['hot']			= '<img src="images/ymar/hot.png">';
+	$statusicons['hotoff']		= '<img src="images/ymar/hotoff.png">';
+	$statusicons['off']			= '<img src="images/ymar/off.png">';
+
+
+	# Extra CSS included at the bottom of a page
+	$css_extra		= "
+		textarea,input,select{
+		  border:		1px solid #a15c18;
+		  background:	#fff;
+		  color:		#000;
+		  font:	10pt $font;
+		  }
+		input[type=\"radio\"], .radio {
+		  border:	none;
+		  background: #ecd7b2;
+		  color:	#000000;
+		  font:	10pt $font;}
+		.submit{
+		  border:	#000 solid 2px;
+		  font:	10pt $font;}
+		a {
+/*			text-shadow: 0px 0px 3px #fff;
+*/			}
+		";
+	
\ No newline at end of file
diff --git a/sendprivate.php b/sendprivate.php
new file mode 100644
index 0000000..8a46a56
--- /dev/null
+++ b/sendprivate.php
@@ -0,0 +1,169 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/layout.php';
+
+	$meta['noindex'] = true; // Never index
+
+	$smilies=readsmilies();
+	
+	if(!$log) {
+		print "
+			$header$tblstart
+			$tccell1>Can't send a private message, because you are not logged in.
+			<br>".redirect("index.php", 'return to the index page', 0)."
+			$tblend$footer
+		";
+		printtimedif($startingtime);
+		die();
+	}
+
+	if($loguser['powerlevel'] <= -2) {
+		print "
+			$header$tblstart
+			$tccell1>You are permabanned and cannot send private messages.
+			<br>".redirect('private.php','your private message box',0)."
+			$tblend$footer
+		";
+		printtimedif($startingtime);
+		die();
+	}
+	
+	if($id) {
+		$msg = $sql->fetchq("SELECT * FROM pmsgs,pmsgs_text WHERE id=$id AND id=pid");
+
+		if ($loguserid != $msg['userto']) {
+			print "
+				$header$tblstart
+				$tccell1>Can't reply to this private message, because it was not sent to you.
+				<br>".redirect('private.php','your private message box',0)."
+				$tblend$footer
+			";
+			printtimedif($startingtime);
+			die();
+		}
+	}
+
+	print "$header$fonttag<a href=index.php>$boardname</a> - <a href=private.php>Private messages</a>$tblstart";
+
+	if (!$action) {
+		print '<body onload=window.document.REPLIER.message.focus()><FORM ACTION=sendprivate.php NAME=REPLIER METHOD=POST>';
+
+		if ($log && $id) {
+			$user = loaduser($msg['userfrom'],1);
+			$quotemsg = "[quote=$user[name]]$msg[text][/quote]\r\n";
+			$subject="Re: $msg[title]";
+
+			$tcellbg="$tccell1l valign=top";
+			$postlist="
+				$tccellh width=150>User</td>
+				$tccellh>Message<tr>
+				$tcellbg><a href=profile.php?id=$user[id]>$user[name]</a>$smallfont<br>
+				Posts: $postnum$user[posts]</td>
+				$tcellbg>".doreplace2($msg[text])."<tr>
+			";
+		}
+		else
+			$postlist='';
+
+		if ($userid)
+			$user=loaduser($userid,1);
+		$user['name']=htmlspecialchars($user['name']);
+		$subject=htmlspecialchars($subject);
+
+		print "
+			$tccellh width=150>&nbsp</td>
+			$tccellh>&nbsp<tr>
+			$tccell1><b>Send to:</td>	 $tccell2l>$inpt=username value=\"$user[name]\" size=25 maxlength=25><tr>
+			$tccell1><b>Subject:</td>	 $tccell2l>$inpt=subject value=\"$subject\" size=60 maxlength=100><tr>
+			$tccell1><b>Message:</td>	 $tccell2l>$txta='message' rows=20 cols=$numcols>$quotemsg</textarea><tr>
+			$tccell1>&nbsp</td>		 $tccell2l>
+			$inph=action VALUE=sendmsg>
+			$inps=submit VALUE='Send message'>
+			$inps=preview VALUE='Preview message'></td>
+
+			$tblend
+			</FORM>
+			<br>$tblstart$postlist$tblend
+			$fonttag<a href=index.php>$boardname</a> - <a href=private.php>Private messages</a>
+		";
+	}
+	if($action=='sendmsg') {
+		$username	= stripslashes($_POST['username']);
+		$userid=checkusername($username);
+
+		if ($userid == -1)
+			print "$tccell1>Couldn't send the message. You didn't enter an existing username to send the message to.
+				<br>".redirect('private.php','your private message box',2);
+		elseif (!$subject)
+			print "$tccell1>Couldn't send the message. You didn't enter a subject.
+				<br>".redirect('private.php','your private message box',2);
+		else {
+			$subject=str_replace('<','&lt;',$subject);
+
+			$sign=$loguser['signature'];
+			$head=$loguser['postheader'];
+			if($user['postbg'])
+				$head="<div style=background:url($user[postbg]);height=100%>$head";
+
+			$numdays=(ctime()-$loguser['regdate'])/86400;
+			$message=doreplace($message,$loguser['posts'],$numdays,$loguser['name']);
+			$rsign=doreplace($sign,$loguser['posts'],$numdays,$loguser['name']);
+			$rhead=doreplace($head,$loguser['posts'],$numdays,$loguser['name']);
+			$currenttime=ctime();
+
+			if($submit) {
+				$headid = getpostlayoutid($head);
+				$signid = getpostlayoutid($sign);
+
+				$sql->query("INSERT INTO pmsgs (id,userto,userfrom,date,ip,msgread,headid,signid) VALUES (NULL,$userid,$loguserid,$currenttime,'$userip',0,$headid,$signid)");
+				$sql->query("INSERT INTO pmsgs_text (pid,title,text,tagval) VALUES (".mysql_insert_id().",'$subject','$message','$tagval')");
+
+				print "$tccell1>Private message to $username sent successfully!
+					<br>".redirect('private.php','your private message box',0).$tblend;
+			}
+			else {
+				loadtlayout();
+				$ppost=$loguser;
+				$message = stripslashes($message);
+				$username = stripslashes($username);
+				$subject = stripslashes($subject);
+				$ppost['uid']=$loguserid;
+				$ppost['date']=$currenttime;
+				$ppost['headtext']=$rhead;
+				$ppost['signtext']=$rsign;
+				$ppost['text']=$message;
+				if($isadmin) $ip=$userip;
+				print "
+					<body onload=window.document.REPLIER.message.focus()>
+					$tccellh>Message preview
+					$tblend$tblstart
+					$pollpreview
+					$tccell2l><b>". stripslashes($subject) ."</b>
+					$tblend$tblstart
+					".threadpost($ppost,1)."
+					$tblend<br>$tblstart
+					<FORM ACTION=sendprivate.php NAME=REPLIER METHOD=POST>
+					$tccellh width=150>&nbsp</td>$tccellh>&nbsp<tr>
+					$tccell1><b>Subject:</td>	 $tccell2l>$inpt=subject value=\"$subject\" size=60 maxlength=100><tr>
+					$tccell1><b>Message:</td>
+					$tccell2l>$txta=message ROWS=10 COLS=$numcols>$message</TEXTAREA><tr>
+					$tccell1>&nbsp</td>$tccell2l>
+					$inph=username VALUE=\"".htmlspecialchars($username)."\">
+					$inph=action VALUE=sendmsg>
+					$inps=submit VALUE=\"Send message\">
+					$inps=preview VALUE='Preview message'>
+					</td></FORM>
+				";
+			}
+		}
+  }
+/*if($action=='delete' and $msg[userto]==$loguserid){
+    mysql_query("DELETE FROM pmsgs WHERE id=$id");
+    mysql_query("DELETE FROM pmsgs_text WHERE pid=$id");
+    print "
+      $tccell1>Thank you, $loguser[name], for deleting the message.
+      <br>".redirect('private.php','return to the private message box',0).$tblend;
+  } */
+  print $footer;
+  printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/shitbugs.php b/shitbugs.php
new file mode 100644
index 0000000..8e25a2e
--- /dev/null
+++ b/shitbugs.php
@@ -0,0 +1,130 @@
+<?php
+
+  $windowtitle	= "Admin Cruft";
+
+  require 'lib/function.php';
+  require 'lib/layout.php';
+
+if (!in_array($loguser['id'], array(175, 1)) && $loguser['powerlevel'] < 1) {
+
+	print "
+		$header<br>
+		$tblstart
+			<tr>$tccell1>&nbsp;
+				<br>No.
+				<br>&nbsp;
+			</td></tr>
+		$tblend
+
+	$footer
+	";
+	printtimedif($startingtime);
+	die();
+  }
+
+
+	$expower = in_array($loguserid, array(175, 1, 2100));
+
+	if ($expower && $_GET['banip'] && $_GET['valid'] == md5($_GET['banip'] . "aglkdgslhkadgshlkgds")) {
+		$sql->query("INSERT INTO `ipbans` SET `ip` = '". $_GET['banip'] ."', `reason`='Abusive/unwelcome activity', `date` = '". ctime() ."', `banner` = '$loguserid'") or print mysql_error();
+		xk_ircsend("1|". xk(8) . $loguser['name'] . xk(7) ." added IP ban for ". xk(8) . $_GET['banip'] . xk(7) .".");
+		return header("Location: ?");
+	}
+
+	print "$header<br>";
+
+	$clearbutton = '&nbsp;';
+	if ($expower) {
+		if ($_POST['clear'])
+			$query	= $sql -> query("TRUNCATE `minilog`");
+		$clearbutton = "<br><form style='margin: 0px; padding: 0px;' action='?' method='post'>$inps='clear' value='Clear log'></form><br>";
+	}
+
+	$banflagnames[    1]	= "union<br>select";
+	$banflagnames[16384]	= "acunetix";
+	$banflagnames[ 2048]	= "get<br>+";
+	$banflagnames[    4]	= "get<br>--";
+//	$banflagnames[    8]	= "get<br>;";  // Disabled. Too many false positives.
+	$banflagnames[    2]	= "get<br>comment";
+	$banflagnames[   16]	= "get<br>exec";
+	$banflagnames[   32]	= "get<br>password";
+	$banflagnames[ 4096]	= "get<br>script";
+	$banflagnames[ 8192]	= "get<br>cookie";
+	$banflagnames[   64]	= "cookie<br>comment";
+	$banflagnames[  128]	= "cookie<br>exec";
+	$banflagnames[  256]	= "cookieban<br>user";
+	$banflagnames[  512]	= "cookieban<br>nonuser";
+	$banflagnames[ 1024]	= "non-int<br>userid";
+
+	$cells	= count($banflagnames) + 4;
+		
+	print "
+		$tblstart
+			<tr>$tccellh>Shitbug detection system</td></tr>
+			<tr>$tccell1>&nbsp;
+				<br>This page lists denied requests, showing what the reason was.
+				<br>$clearbutton
+			</td></tr>
+		$tblend
+		<br>
+		$tblstart
+	";
+			
+	$colheaders	= "<tr>$tccellh width='180'>Time</td>$tccellh width='50'>Count</td>$tccellh>IP</td>$tccellh width='50'>&nbsp</td>";
+
+	foreach ($banflagnames as $flag => $name)
+		$colheaders	.= "$tccellh width='60'>$name</td>";
+
+	$colheaders	.= "</tr>";
+	print $colheaders;
+
+	$query	= $sql -> query("SELECT *, (SELECT COUNT(`ip`) FROM `ipbans` WHERE `ip` = `minilog`.`ip`) AS `banned` FROM `minilog` ORDER BY `time` DESC");
+	
+	$rowcnt		= 0;
+	$lastflag	= 0;
+	$combocount	= 0;
+	$lastip		= "";
+	
+	while ($data = $sql -> fetch($query)) {
+		if (($lastip != $data['ip'] || $lastflag != $data['banflags']) && $lastflag != 0) {
+			$rowcnt++;
+			print str_replace("%%%COMBO%%%", ($combocount > 1 ? " &times;$combocount" : ""), $tempout);
+			
+			if (!($rowcnt % 50))
+				print $colheaders;
+			elseif ($lastip != $data['ip'])
+				print "<tr>$tccellh colspan='$cells'><img src='images/_.gif' height=5 width=5></td></tr>";
+
+			$tempout	= "";
+			$combocount	= 0;
+		}
+		
+		$lastip		= $data['ip'];
+		$lastflag	= $data['banflags'];
+		$combocount++;
+		
+		if ($combocount == 1) {
+			$tempout	= "<tr>$tccell1>". date("m-d-y H:i:s", $data['time']) ."</td>$tccell1>%%%COMBO%%%</td>$tccell1><a href='ipsearch.php?ip=". $data['ip'] ."'>". $data['ip'] ."</a></td>";
+
+			if ($data['banned'])
+				$tempout .= "$tccell1s><span style='color: #f88; font-weight: bold;'>Banned</span></td>";
+			elseif ($expower)
+				$tempout .= "$tccell1s><a href=?banip={$data['ip']}&valid=". md5($data['ip'] . "aglkdgslhkadgshlkgds") .">Ban</a></td>";
+			else
+				$tempout .= "$tccell1s>&nbsp;</td>";
+
+			foreach ($banflagnames as $flag => $name) {
+				if ($data['banflags'] & $flag)
+					$tempout	.= "$tccellc width='60'>Hit</td>";
+				else
+					$tempout	.= "$tccell2 width='60'>&nbsp;</td>";
+			}
+			$tempout .= "</tr>";
+		}
+	}
+	
+	print str_replace("%%%COMBO%%%", ($combocount > 1 ? " &times;$combocount" : ""), $tempout);
+
+	print "$tblend $footer";
+	printtimedif($startingtime);
+?>
diff --git a/shop.php b/shop.php
new file mode 100644
index 0000000..69f99d0
--- /dev/null
+++ b/shop.php
@@ -0,0 +1,169 @@
+<?php
+
+	if ($_GET['action'] == "buy" && $_GET['id'] == 286) {
+		return header("Location: shoph.php");
+	}
+
+  require 'lib/function.php';
+  require 'lib/layout.php';
+  require 'lib/rpg.php';
+  print "$header<br>";
+  if(!$log){
+    print "
+	$tblstart$tccell1>You must be logged in to access the Item Shop.<br>".
+	redirect('index.php','return to the main page',0).
+	$tblend;
+  }else{
+    $user=mysql_fetch_array(mysql_query("SELECT posts,regdate,users_rpg.* FROM users,users_rpg WHERE id=$loguserid AND uid=id"));
+    $p=$user[posts];
+    $d=(ctime()-$user[regdate])/86400;
+    $st=getstats($user);
+    $GP=$st[GP];
+    switch($action){
+	case '':
+	  $shops=mysql_query('SELECT * FROM itemcateg ORDER BY corder');
+	  $eq=mysql_fetch_array(mysql_query("SELECT * FROM users_rpg WHERE uid=$loguserid"));
+	  $eqitems=mysql_query("SELECT * FROM items WHERE id=$eq[eq1] OR id=$eq[eq2] OR id=$eq[eq3] OR id=$eq[eq4] OR id=$eq[eq5] OR id=$eq[eq6] OR id=$eq[eq7]");
+	  while($item=mysql_fetch_array($eqitems)) $items[$item[id]]=$item;
+	  while($shop=mysql_fetch_array($shops))
+	    $shoplist.="
+		<tr>
+		$tccell1><a href=shop.php?action=items&cat=$shop[id]#status>$shop[name]</a></td>
+		$tccell2s>$shop[description]
+		$tccell1s>".$items[$eq['eq'.$shop[id]]][name]."
+	    ";
+	  print "
+		<table width=100%><td valign=top width=120>
+		 <img src=status.php?u=$loguserid>
+		</td><td valign=top>
+		$tblstart
+		 $tccellh colspan=3>Shop list<tr>
+		 $tccellc>Shop</td>$tccellc>Description</td>$tccellc>Item equipped</td>
+		 $shoplist
+		$tblend
+		</table>
+	  ";
+	break;
+	case 'items':
+	  $eq=mysql_fetch_array(mysql_query("SELECT eq$cat AS e FROM users_rpg WHERE uid=$loguserid"));
+	  $eqitem=mysql_fetch_array(mysql_query("SELECT * FROM items WHERE id=$eq[e]"));
+        print "
+		<script>
+		  function preview(user,item,cat,name){
+		    document.getElementById('prev').src='status.php?u='+user+'&it='+item+'&ct='+cat+'&'+Math.random();
+		    document.getElementById('pr').innerHTML='Equipped with<br>'+name+'<br>---------->';
+		  }
+		</script>
+		<style>
+			.disabled	{color:#888888}
+			.higher	{color:#abaffe}
+			.equal	{color:#ffea60}
+			.lower	{color:#ca8765}
+		</style>
+		$tblstart
+		  $tccell1><a href=shop.php>Return to shop list</a>
+		$tblend
+		<a name=status>
+		<table><td width=256>
+		 <img src=status.php?u=$loguserid>
+		</td><td width=150>
+		 <center><font class=fonts>
+		  <div id=pr></div>
+		 </font></center>
+		</td><td>
+		 <img src=images/_.gif id=prev>
+		</table>
+		<br>
+	  ";
+	  $atrlist='';
+	  for($i=0;$i<9;$i++) $atrlist.="$tccellh width=50>$stat[$i]</td>";
+	  $items=mysql_query("SELECT * FROM items WHERE (cat=$cat OR cat=0) AND `hidden` = 0 ORDER BY type,coins");
+	  print "
+		$tblstart
+		$tccellh width=110 colspan=2>Commands</td>$tccellct width=1 rowspan=10000>&nbsp;</td>
+		$tccellh colspan=1>Item</td>
+		$atrlist
+		$tccellh width=6%><img src=images/coin.gif></td>
+		$tccellh width=5%><img src=images/coin2.gif></td>
+	  ";
+	  while($item=mysql_fetch_array($items)){
+	    $preview="<a href=#status onclick='preview($loguserid,$item[id],$cat,\"". htmlentities($item[name], ENT_QUOTES) ."\")'>Preview</a>";
+	    if($item[id]==$eq[e] && $item[id]){
+		$comm="width=80 colspan=2><a href=shop.php?action=sell&cat=$cat>Sell</a>";
+	    }elseif($item[id] && $item[coins]<=$GP && $item[gcoins] <= $user['gcoins']){
+		$comm="width=30><a href=shop.php?action=buy&id=$item[id]>Buy</a></td>$tccell1 width=50>$preview";
+	    }elseif(!$eq[e] && !$item[id]){
+		$comm="width=80 colspan=2>-";
+	    }else{
+		$comm="width=80 colspan=2>$preview";
+	    }
+	    if($item[id]==$eqitem[id]) $color=' class=equal';
+	    elseif($item[coins]>$GP || $item[gcoins] > $user['gcoins']) $color=' class=disabled';
+	    else $color='';
+	    $atrlist='';
+	    for($i=0;$i<9;$i++){
+		$st=$item["s$stat[$i]"];
+		if(substr($item[stype],$i,1)=='m'){
+		  $st=vsprintf('x%1.2f',$st/100);
+		  if($st==100) $st='&nbsp;';
+		}else{
+		  if($st>0) $st="+$st";
+		  if(!$st) $st='&nbsp;';
+		}
+		$itst=$item["s$stat[$i]"];
+		$eqst=$eqitem["s$stat[$i]"];
+		if(!$color && substr($item[stype],$i,1)==substr($eqitem[stype],$i,1)){
+		  if($itst> $eqst) $st="<font class=higher>$st</font>";
+		  if($itst==$eqst) $st="<font class=equal>$st</font>";
+		  if($itst< $eqst) $st="<font class=lower>$st</font>";
+		}
+		$atrlist.="
+		  $tccell1>$st</td>";
+	    }
+
+		if ($item['desc']) {
+			$item['name']	.= " <span class=\"fonts\" style=\"color: #88f;\">- ". $item['desc'] ."</span>";
+		}
+
+	    print "
+		<tr$color>
+		$tccell1 $comm</td>
+		$tccell2l>$item[name]</td>
+		$atrlist
+		$tccell2r>". ($item[coins] < 8388607 ? $item[coins] : "tons") ."</td>
+		$tccell2r>". ($item[gcoins] < 8388607 ? $item[gcoins] : "tons") ."</td>
+	    ";
+	  }
+	  print $tblend;
+	break;
+	case 'buy':
+	  $item=mysql_fetch_array(mysql_query("SELECT * FROM items WHERE id=$id AND `hidden` = '0'"));
+	  if($item && $item[coins]<=$GP && $item['gcoins'] <= $user['gcoins']){
+	    $pitem=mysql_fetch_array(mysql_query("SELECT coins FROM items WHERE id=".$user['eq'.$item[cat]]));
+	    $whatever = $item[coins] - $pitem[coins]*0.6;
+		print "Debug output: Cost: ". $item['coins'] ." - Current item's sell value: ". ($pitem['coins'] * 0.6) ." - Amount to subtract: ". $whatever .". /debug";
+	    mysql_query("UPDATE users_rpg SET `eq". $item[cat] ."`='". $id ."',`spent`=spent+". $whatever .", `gcoins` = `gcoins` - '". $item['gcoins'] ."' WHERE uid=$loguserid") or print mysql_error();
+	    print "
+		$tblstart
+		  $tccell1>The $item[name] has been bought and equipped.<br>
+		  ".redirect('shop.php','return to the shop',0)."
+		$tblend
+	    ";
+	  }
+	break;
+	case 'sell':
+	  $pitem=mysql_fetch_array(mysql_query("SELECT coins FROM items WHERE id=".$user['eq'.$cat]));
+	  mysql_query("UPDATE users_rpg SET eq$cat=0,spent=spent-$pitem[coins]*0.6 WHERE uid=$loguserid") or print mysql_error();
+	  print "
+	    $tblstart
+		$tccell1>The $item[name] has been unequipped and sold.<br>
+		".redirect('shop.php','return to the shop',0)."
+	    $tblend
+	  ";
+	break;
+	default:
+    }
+  }
+  print $footer;
+  printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/shoped.php b/shoped.php
new file mode 100644
index 0000000..07f83c1
--- /dev/null
+++ b/shoped.php
@@ -0,0 +1,325 @@
+<?php
+
+#	die();
+	require 'lib/function.php';
+	$stats		= array(
+		0	=> "sHP", 
+		1	=> "sMP", 
+		2	=> "sAtk", 
+		3	=> "sDef", 
+		4	=> "sInt", 
+		5	=> "sMDf", 
+		6	=> "sDex", 
+		7	=> "sLck",
+		8	=> "sSpd", 
+		);
+	$effects	= array("None", "1: Forces female gender", "2: Forces male gender", "3: Forces catgirl status", "4: Other");
+	
+	if ($loguser['powerlevel'] < 1) {
+		$windowtitle	= "nope.avi";
+		require "lib/layout.php";
+		print $header ."<br>$tblstart
+			$tccell1>No.</td><table>". $footer;
+		die();
+	}
+
+	$hiddeneditok	= in_array($loguser['id'], array(1, 18));
+
+
+	if ($_POST['edit']) {
+		$q	= 
+			"`name` = '". $_POST['name'] ."', ".
+			"`desc` = '". $_POST['desc'] ."', ".
+			"`cat` = '". $_POST['cat'] ."', ".
+			"`type` = '". $_POST['type'] ."', ".
+			"`effect` = '". $_POST['effect'] ."', ".
+			"`coins` = '". $_POST['coins'] ."', ".
+			($hiddeneditok ? "`hidden` = '". $_POST['hidden'] ."', " : "").
+			"`gcoins` = '". $_POST['gcoins'] ."', ";
+	
+		foreach($stats as $stat) {
+			if ($_POST['m'. $stat] == "m") $_POST[$stat] *= 100;
+			$q		.= "`$stat` = '". $_POST[$stat] ."', ";
+			$stypes	.= $_POST['m'. $stat];
+		}
+		$q	.= "`stype` = '$stypes'";
+
+		if ($_POST['coins'] < 0 || $_POST['gcoins'] < 0) {
+			// $sql -> query("UPDATE `users` SET `powerlevel` = -1, `title` = 'Next time, read the goddamn warning before doing something stupid'");
+			die("You don't pay warnings much heed, do you?");
+		}
+
+		if ($_GET['id'] <= -1) {
+			$sql -> query("INSERT INTO `items` SET $q, `user` = '". $loguser['id'] ."'");
+			if (mysql_error()) die(mysql_error());
+			$id	= mysql_insert_id();
+		} else {
+			$sql -> query("UPDATE `items` SET $q WHERE `id` = '". $_GET['id'] ."'");
+			if (mysql_error()) die(mysql_error());
+			$id	= $_GET['id'];
+		}
+
+		header("Location: ?cat=". $_POST['cat'] ."&id=". $id . ($_GET['type'] ? "&type=". $_POST['type'] : ""));
+		die($q);
+	}
+
+
+	$windowtitle	= "Shop Editor";
+	require "lib/layout.php";
+	print $header ."<br>";
+
+	echo "$tblstart<tr>$tccellh><b>WARNING</b></td></tr><tr>$tccell1>
+		MAKE AN ITEM WITH A NEGATIVE COST AND YOU <span style=\"border-bottom: 1px dotted #f00;font-style:italic;\" title=\"did you mean: won't really (but don't try it anyway, it won't work)\">WILL</span> GET BANNED</td></tr></table><br>";
+
+	$categories	= array(
+		1	=> "Weapons",
+		2	=> "Armor",
+		3	=> "Shields",
+		4	=> "Helmets",
+		5	=> "Boots",
+		6	=> "Accessories",
+		7	=> "Usable",
+		99	=> "Special",
+		);
+	$cat	= ($_GET['cat'] ? $_GET['cat'] : "1");
+	echo linkbar($categories, $cat);
+
+//	$stats	= array("sHP", "sMP", "sAtk", "sDef", "sInt", "sMDf", "sDex", "sLck", "sSpd");
+
+	$types	= $sql -> query("SELECT `id`, `name` FROM `itemtypes` WHERE `id` IN (SELECT DISTINCT(`type`) FROM `items` WHERE `cat` = '$cat') ORDER BY `ord` ASC");
+	$typerow[0]		= "";
+	while ($type	= $sql -> fetch($types)) {
+		$typerow[$type['id']] = "<tr>$tccellc colspan=\"16\"><a href=\"?cat=". $_GET['cat'] . ($_GET['item'] ? "&item=". $_GET['item'] : "") . ($_GET['type'] == $type['id'] ? "" : "&type=". $type['id']) ."\">". $type['name'] ."</a></td></tr>";
+	}
+	
+	if ($_GET['id']) {
+	
+		$typesq	= $sql -> query("SELECT `id`, `name` FROM `itemtypes` ORDER BY `ord` ASC");
+		$alltypes[255]	= "Unknown";
+		while($typex = $sql -> fetch($typesq)) {
+			$alltypes[$typex['id']]	= $typex['name'];
+		}
+
+		$item	= $sql -> fetchq("SELECT * FROM `items` WHERE `id` = '". $_GET['id'] ."'" . ($hiddeneditok ? "" : " AND `hidden` = '0'"));
+		if (!$item) {
+			$item['cat']	= $cat;
+			$_GET['id']		= -1;
+		}
+
+		foreach ($stats as $n => $stat) {
+			if ($item['stype']{$n} == "m") {
+				$optionbox		= "<select name=\"m$stat\"><option value=\"m\" selected>x</option><option value=\"a\">+/-</option></select>";
+				$val			= number_format($item[$stat] / 100, 2);
+			} else {
+				$optionbox		= "<select name=\"m$stat\"><option value=\"m\">x</option><option value=\"a\" selected>+/-</option></select>";
+				$val			= $item[$stat];
+			}
+			$stbox[$stat]	= "
+				$tccellh width=\"11%\">". substr($stat, 1) ."</td>
+				$tccell1l width=\"22%\"><input type=\"text\" name=\"$stat\" maxlength=\"8\" size=\"5\" value=\"$val\" class=\"right\"> $optionbox</td>";
+		}
+		echo "
+		
+		<form method=\"post\" action=\"?cat=1&id=". $_GET['id'] . ($_GET['type'] ? "&type=". $_GET['type'] : "") ."\">
+		$tblstart
+			<tr>
+				$tccellh colspan=6>Editing <b>". ($_GET['id'] >= 1 ? $item['name'] : "New item") ."</b></td>
+			</tr>
+			<tr>
+				$tccellh>Name</td>
+				$tccell1l colspan=3><input type=\"text\" name=\"name\" value=\"". $item['name'] ."\"  style=\"width: 100%;\" maxlength=\"255\">
+					". ($hiddeneditok ? "<br><input type=\"checkbox\" id=\"hiddenitem\" name=\"hidden\" value=\"1\"". ($item['hidden'] ? " checked" : "") ."> <label for=\"hiddenitem\">Hidden item</label>" : "") ."
+					</td>
+				$tccellh>Category</td>
+				$tccell1l>". linkbar($categories, $item['cat'], 1, "cat") ." / ". linkbar($alltypes, $item['type'], 1, "type") ."</td>
+			</tr>
+			<tr>
+				$tccellh>Desc</td>
+				$tccell1l colspan=3><input type=\"text\" name=\"desc\" value=\"". $item['desc'] ."\" style=\"width: 100%;\"></td>
+				$tccellh>Effect <small>(wip)</small></td>
+				$tccell1l>". linkbar($effects, $item['effect'], 1, "effect") ."</td>
+			</tr>
+
+			<tr>$tccellc colspan=6><img src=\"images/_.gif\" height=6 width=6></td></tr>
+			<tr>". $stbox['sHP'] . $stbox['sMP'] . $stbox['sLck'] ."</tr>
+			<tr>". $stbox['sAtk'] . $stbox['sInt'] . $stbox['sDex'] ."</tr>
+			<tr>". $stbox['sDef'] . $stbox['sMDf'] . $stbox['sSpd'] ."</tr>
+			<tr>$tccellc colspan=6><img src=\"images/_.gif\" height=6 width=6></td></tr>
+
+			<tr>
+				$tccellc colspan=2><input type=\"submit\" name=\"edit\" value=\"Save\"></td>
+				$tccellh> Coins </td>
+				$tccell1l><input type=\"text\" name=\"coins\" maxlength=\"8\" size=\"10\" value=\"". $item['coins'] ."\" class=\"right\"> <img src=\"images/coin.gif\" align=\"absmiddle\"></td>
+				$tccellh> G.Coins </td>
+				$tccell1l><input type=\"text\" name=\"gcoins\" maxlength=\"8\" size=\"10\" value=\"". $item['gcoins'] ."\" class=\"right\"> <img src=\"images/coin2.gif\" align=\"absmiddle\"></td>
+			</tr>
+		
+		</table></form><br>";
+	}
+
+
+	$items	= $sql -> query("SELECT `items`.*, `users`.`id` as uid, `users`.`sex` as usex, `users`.`powerlevel` as upow, `users`.`name` as uname FROM `items` LEFT JOIN `users` ON `users`.`id` = `items`.`user` WHERE `cat` = '$cat'". ($_GET['type'] ? " AND `type` = '". $_GET['type'] ."' " : "") . ($hiddeneditok ? "" : " AND `hidden` = '0'") ." ORDER BY `type` ASC, `coins` ASC, `gcoins` ASC");
+	echo "
+		$tblstart
+			<tr>$tccellc colspan=\"16\">&lt; <a href=\"?cat=$cat&id=-1\">New Item</a> &gt;</td></tr>
+			<tr>
+				$tccellh>&nbsp;</td>
+				$tccellh colspan='2'>Name</td>
+				$tccellh>HP</td>
+				$tccellh>MP</td>
+				$tccellh>Atk</td>
+				$tccellh>Def</td>
+				$tccellh>Int</td>
+				$tccellh>MDf</td>
+				$tccellh>Dex</td>
+				$tccellh>Lck</td>
+				$tccellh>Spd</td>
+				$tccellh>Efx</td>
+				$tccellh>Coins</td>
+				$tccellh>G.Coins</td>
+				$tccellh>Pv</td>
+			</tr>";
+
+	while ($item = $sql->fetch($items)) {
+		$stype	= str_split($item['stype']);
+		
+		if ($_GET['id'] == $item['id']) {
+			$tc2	= $tccellh;
+			$tc2l	= $tccellhl;
+			$tc2r	= $tccellhr;
+			$tc1	= $tccellh;
+		} else {
+			$tc2	= $tccell2;
+			$tc2l	= $tccell2l;
+			$tc2r	= $tccell2r;
+			$tc1	= $tccell1;
+		}
+
+		if ($item['hidden']) {
+			$item['name']	= "<img src='images/dot4.gif' align='absmiddle'> ". $item['name'];
+		}
+
+/*
+		if ($item['uname']) {
+			$item['name']	= "<a href=\"profile.php?id=". $item['uid'] ."\" class=\"fonts\"><font ". getnamecolor($item['usex'], $item['upow']) .">". $item['uname'] ."'s</font></a> ". $item['name'];
+		}
+*/
+		if ($item['uname']) {
+			$item['uname']	= "<nobr><a href=\"profile.php?id=". $item['uid'] ."\" class=\"fonts\"><font ". getnamecolor($item['usex'], $item['upow']) .">". $item['uname'] ."</font></a></nobr>";
+		} else {
+			$item['uname']	= "";
+		}
+
+		if ($item['desc']) {
+			$item['name']	.= " <span class=\"fonts\" style=\"color: #88f;\">- ". $item['desc'] ."</span>";
+		}
+
+		$typerow[$item['type']] .= "<tr>
+				$tccell1s><a href=\"?cat=$cat&id=". $item['id'] . ($_GET['type'] ? "&type=". $_GET['type'] : "") ."\">Edit</a></td>
+				$tc2>". $item['uname'] ."</td>$tc2l>". $item['name'] ."</td>";
+
+		$val	= 0;
+		foreach($stats as $n => $stat) {
+			$num	= ($stype[$n] == "m" ? vsprintf('%1.2fx',$item[$stat]/100) : $item[$stat]);
+			if ($item[$stat] > 0 && $stype[$n] != "m") $num = "+". $num;
+			if ($item[$stat] == 0 && $stype[$n] != "m") $num = "";
+
+			if ($item[$stat] > 0 && $stype[$n] == "a") {
+				$num = "<font color=\"#88ff88\">$num</font>";
+				$val += floor(pow(($item[$stat] * 1.80), 1.739));
+
+			} elseif ($item[$stat] > 100 && $stype[$n] == "m") {
+				$num = "<font color=\"#ccffcc\">$num</font>";
+				$val += floor(pow(($item[$stat] - 100) * 100, 1.3));
+
+			} elseif ($item[$stat] < 0 && $stype[$n] == "a") {
+				$num = "<font color=\"#ffbbbb\">$num</font>";
+				$val -= floor(pow(abs(($item[$stat]) * 2), 1.25));
+
+			} elseif ($item[$stat] < 100 && $stype[$n] == "m") {
+				$num = "<font color=\"#ff8888\">$num</font>";
+				$val -= floor(pow(abs($item[$stat] - 100) * 2.5, 1.3));
+			}
+
+			$typerow[$item['type']] .= "$tc1>". $num ."</td>\n";
+		}
+
+		$valt	= $val ."t";
+		$val	= round(($val * 2), -1 * (strlen($valt) - 3)) / 2;
+
+		$val	= number_format($val);
+		
+
+		$typerow[$item['type']] .= "
+				$tc2>". ($item['effect'] ? $item['effect'] : "&nbsp;") ."</td>
+				$tc2r>". number_format($item['coins']) ."</td>
+				$tc2r>". number_format($item['gcoins']) ."</td>
+				$tc2r>$smallfont<nobr>". $val ." Pv</nobr></td>
+			</tr>";
+	}
+
+	if ($typerow[0]) {
+		$typerow[0]	= "<tr>$tccellc colspan=\"16\"><b>???</b></td></tr>". $typerow[0];
+	}
+
+	print implode("", $typerow);
+	echo "<tr>
+				$tccellh>&nbsp;</td>
+				$tccellh colspan='2'>Name</td>
+				$tccellh>HP</td>
+				$tccellh>MP</td>
+				$tccellh>Atk</td>
+				$tccellh>Def</td>
+				$tccellh>Int</td>
+				$tccellh>MDf</td>
+				$tccellh>Dex</td>
+				$tccellh>Lck</td>
+				$tccellh>Spd</td>
+				$tccellh>Efx</td>
+				$tccellh>Coins</td>
+				$tccellh>G.Coins</td>
+				$tccellh>Pv</td>
+			</tr>
+			<tr>$tccellc colspan=\"16\">&lt; <a href=\"?cat=$cat&id=-1\">New Item</a> &gt;</td></tr>
+			</table>";
+
+	
+	print $footer;
+	printtimedif($startingtime);
+
+
+
+
+	function linkbar($links, $sel = 1, $type = 0, $name = "cat") {
+
+		global $tblstart, $tblend, $tccell1, $tccellh, $tccellc;
+
+		if ($type == 0) {
+			$c	= count($links);
+			$w	= floor(1 / $c * 100);
+
+			$r	= "$tblstart<tr>$tccellh colspan=$c><b>Item Categories</b></td></tr><tr>";
+
+			foreach($links as $link => $name) {
+
+				$cell	= $tccell1;
+				if ($link == $sel) $cell	= $tccellc;
+				$r	.= "$cell width=\"$w%\"><a href=\"?cat=$link\">$name</a></td>";
+			}
+
+			return $r ."$tblend<br>";
+		} else {
+
+			$r	= "<select name=\"$name\">";
+
+			foreach($links as $link => $name) {
+
+				$cell	= $tccell1;
+				if ($link == $sel) $cell	= $tccellc;
+				$r	.= "<option value=\"$link\"". ($sel == $link ? " selected" : "") .">$name</option>";
+			}
+
+			return $r ."</select>";
+		}
+	}
+?>
\ No newline at end of file
diff --git a/shoph.php b/shoph.php
new file mode 100644
index 0000000..fc7ff00
--- /dev/null
+++ b/shoph.php
@@ -0,0 +1,168 @@
+<?php
+  require 'lib/function.php';
+  require 'lib/layout.php';
+  require 'lib/rpg.php';
+  print "$header<br>";
+  if(!$log){
+    print "
+	$tblstart$tccell1>You must be logged in to access the Item Shop.<br>".
+	redirect('index.php','return to the main page',0).
+	$tblend;
+  }else{
+    $user=mysql_fetch_array(mysql_query("SELECT posts,regdate,users_rpg.* FROM users,users_rpg WHERE id=$loguserid AND uid=id"));
+    $p=$user[posts];
+    $d=(ctime()-$user[regdate])/86400;
+    $st=getstats($user);
+    $GP=$st[GP];
+    switch($action){
+	case '':
+	  $shops=mysql_query('SELECT * FROM itemcateg ORDER BY corder');
+	  $eq=mysql_fetch_array(mysql_query("SELECT * FROM users_rpg WHERE uid=$loguserid"));
+	  $eqitems=mysql_query("SELECT * FROM items WHERE id=$eq[eq1] OR id=$eq[eq2] OR id=$eq[eq3] OR id=$eq[eq4] OR id=$eq[eq5] OR id=$eq[eq6] OR id=$eq[eq7]");
+	  while($item=mysql_fetch_array($eqitems)) $items[$item[id]]=$item;
+	  while($shop=mysql_fetch_array($shops))
+	    $shoplist.="
+		<tr>
+		$tccell1><a href=shoph.php?action=items&cat=$shop[id]#status>$shop[name]</a></td>
+		$tccell2s>$shop[description]
+		$tccell1s>".$items[$eq['eq'.$shop[id]]][name]."
+	    ";
+	  print "
+		<table width=100%><td valign=top width=120>
+		 <img src=status.php?u=$loguserid>
+		</td><td valign=top>
+		$tblstart
+		 $tccellh><b>???</b><tr>
+		 $tccell1>This place hasn't been touched in ages...</td>
+		$tblend
+		<br>
+		$tblstart
+		 $tccellh colspan=3>Hidden Shop<tr>
+		 $tccellc>Shop</td>$tccellc>Description</td>$tccellc>Item equipped</td>
+		 $shoplist
+		$tblend
+		</table>
+	  ";
+	break;
+	case 'items':
+	  $eq=mysql_fetch_array(mysql_query("SELECT eq$cat AS e FROM users_rpg WHERE uid=$loguserid"));
+	  $eqitem=mysql_fetch_array(mysql_query("SELECT * FROM items WHERE id=$eq[e]"));
+        print "
+		<script>
+		  function preview(user,item,cat,name){
+		    document.getElementById('prev').src='status.php?u='+user+'&it='+item+'&ct='+cat+'&'+Math.random();
+		    document.getElementById('pr').innerHTML='Equipped with<br>'+name+'<br>---------->';
+		  }
+		</script>
+		<style>
+			.disabled	{color:#888888}
+			.higher	{color:#abaffe}
+			.equal	{color:#ffea60}
+			.lower	{color:#ca8765}
+		</style>
+		$tblstart
+		  $tccell1><a href=shoph.php>Return to shop list</a>
+		$tblend
+		<a name=status>
+		<table><td width=256>
+		 <img src=status.php?u=$loguserid>
+		</td><td width=150>
+		 <center><font class=fonts>
+		  <div id=pr></div>
+		 </font></center>
+		</td><td>
+		 <img src=images/_.gif id=prev>
+		</table>
+		<br>
+	  ";
+	  $atrlist='';
+	  for($i=0;$i<9;$i++) $atrlist.="$tccellh width=50>$stat[$i]</td>";
+	  $items=mysql_query("SELECT * FROM items WHERE (cat=$cat OR cat=0) AND `hidden` = 1 ORDER BY type,coins");
+	  print "
+		$tblstart
+		$tccellh width=110 colspan=2>Commands</td>$tccellct width=1 rowspan=10000>&nbsp;</td>
+		$tccellh colspan=1>Item</td>
+		$atrlist
+		$tccellh width=6%><img src=images/coin.gif></td>
+		$tccellh width=5%><img src=images/coin2.gif></td>
+	  ";
+	  while($item=mysql_fetch_array($items)){
+	    $preview="<a href=#status onclick='preview($loguserid,$item[id],$cat,\"$item[name]\")'>Preview</a>";
+	    if($item[id]==$eq[e] && $item[id]){
+		$comm="width=80 colspan=2><a href=shoph.php?action=sell&cat=$cat>Sell</a>";
+	    }elseif($item[id] && $item[coins]<=$GP && !$item[gcoins]){
+		$comm="width=30><a href=shoph.php?action=buy&id=$item[id]>Buy</a></td>$tccell1 width=50>$preview";
+	    }elseif(!$eq[e] && !$item[id]){
+		$comm="width=80 colspan=2>-";
+	    }else{
+		$comm="width=80 colspan=2>$preview";
+	    }
+	    if($item[id]==$eqitem[id]) $color=' class=equal';
+	    elseif($item[coins]>$GP) $color=' class=disabled';
+	    else $color='';
+	    $atrlist='';
+	    for($i=0;$i<9;$i++){
+		$st=$item["s$stat[$i]"];
+		if(substr($item[stype],$i,1)=='m'){
+		  $st=vsprintf('x%1.2f',$st/100);
+		  if($st==100) $st='&nbsp;';
+		}else{
+		  if($st>0) $st="+$st";
+		  if(!$st) $st='&nbsp;';
+		}
+		$itst=$item["s$stat[$i]"];
+		$eqst=$eqitem["s$stat[$i]"];
+		if(!$color && substr($item[stype],$i,1)==substr($eqitem[stype],$i,1)){
+		  if($itst> $eqst) $st="<font class=higher>$st</font>";
+		  if($itst==$eqst) $st="<font class=equal>$st</font>";
+		  if($itst< $eqst) $st="<font class=lower>$st</font>";
+		}
+		$atrlist.="
+		  $tccell1>$st</td>";
+	    }
+
+		if ($item['desc']) {
+			$item['name']	.= " <span class=\"fonts\" style=\"color: #88f;\">- ". $item['desc'] ."</span>";
+		}
+
+	    print "
+		<tr$color>
+		$tccell1 $comm</td>
+		$tccell2l>$item[name]</td>
+		$atrlist
+		$tccell2r>". ($item[coins] < 8388607 ? $item[coins] : "tons") ."</td>
+		$tccell2r>". ($item[gcoins] < 8388607 ? $item[gcoins] : "tons") ."</td>
+	    ";
+	  }
+	  print $tblend;
+	break;
+	case 'buy':
+	  $item=mysql_fetch_array(mysql_query("SELECT * FROM items WHERE id=$id"));
+	  if($item[coins]<=$GP){
+	    $pitem=mysql_fetch_array(mysql_query("SELECT coins FROM items WHERE id=".$user['eq'.$item[cat]]));
+	    $whatever = $pitem[coins]*0.6-$item[coins];
+	    mysql_query("UPDATE users_rpg SET `eq". $item[cat] ."`='". $id ."',`spent`=spent-". $whatever ." WHERE uid=$loguserid") or print mysql_error();
+	    print "
+		$tblstart
+		  $tccell1>The $item[name] has been bought and equipped.<br>
+		  ".redirect('shoph.php','return to the shop',0)."
+		$tblend
+	    ";
+	  }
+	break;
+	case 'sell':
+	  $pitem=mysql_fetch_array(mysql_query("SELECT coins FROM items WHERE id=".$user['eq'.$cat]));
+	  mysql_query("UPDATE users_rpg SET eq$cat=0,spent=spent-$pitem[coins]*0.6 WHERE uid=$loguserid") or print mysql_error();
+	  print "
+	    $tblstart
+		$tccell1>The $item[name] has been unequipped and sold.<br>
+		".redirect('shoph.php','return to the shop',0)."
+	    $tblend
+	  ";
+	break;
+	default:
+    }
+  }
+  print $footer;
+  printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/showprivate.php b/showprivate.php
new file mode 100644
index 0000000..bcc96ec
--- /dev/null
+++ b/showprivate.php
@@ -0,0 +1,55 @@
+<?php
+	require 'lib/function.php';
+	if (!$id)
+		return header("Location: private.php");
+	$windowtitle = "$boardname -- Private Messages";
+	$meta['noindex'] = true;
+
+	$msg = $sql->fetchq("SELECT * FROM pmsgs,pmsgs_text WHERE id=$id AND id=pid");
+
+	if (!$log) {
+		require_once 'lib/layout.php';
+		errorpage("Couldn't get the private message.  You are not logged in.",'log in (then try again)','login.php');
+	}
+	elseif (!$msg || (($msg['userto'] != $loguserid && $msg['userfrom'] != $loguserid) && !$isadmin)) {
+		require_once 'lib/layout.php';
+		errorpage("Couldn't get the private message.  It either doesn't exist or was not sent to you.",'your private message inbox','private.php');
+	}
+
+	if ($isadmin && $msg['userto'] != $loguserid)
+		$pmlinktext = "<a href='private.php?id=$msg[userto]'>".$sql->resultq("SELECT name FROM users WHERE id=$msg[userto]") . '\'s private messages</a>';
+	else $pmlinktext = "<a href=private.php>Private messages</a>";
+
+	$user = $sql->fetchq("SELECT * FROM users WHERE id=$msg[userfrom]");
+	$windowtitle = "$boardname -- Private Messages: $msg[title]";
+	require_once 'lib/layout.php';
+
+	$top = "<table width=100%><td align=left>$fonttag<a href=index.php>$boardname</a> - <a href=private.php>$pmlinktext</a> - $msg[title]</table>";
+	if ($msg['userto'] == $loguserid)
+		$sql->query("UPDATE pmsgs SET msgread=1 WHERE id=$id");
+
+	loadtlayout();
+	$post = $user;
+	$post['uid']    = $user['id'];
+	$post['date']   = $msg['date'];
+	$post['headid'] = $msg['headid'];
+	$post['signid'] = $msg['signid'];
+	$post['text']   = $msg['text'];
+	$post['tagval'] = $msg['tagval'];
+	if($loguser['viewsig']==2){
+		$post['headtext'] = $user['postheader'];
+		$post['signtext'] = $user['signature'];
+	}
+	else {
+		$post['headtext'] = $msg['headtext'];
+		$post['signtext'] = $msg['signtext'];
+	}
+
+	if ($msg['userto'] == $loguserid)
+		$quote = "<a href=sendprivate.php?id=$id>Reply</a>";
+	if ($isadmin)
+		$ip = (($quote) ? ' | ' : '') . "IP: <a href=ipsearch.php?ip=$msg[ip]>$msg[ip]</a>";
+
+	print $header.$top.$tblstart.threadpost($post,1).$tblend.$top.$footer;
+	printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/sigsize.php b/sigsize.php
new file mode 100644
index 0000000..5582d41
--- /dev/null
+++ b/sigsize.php
@@ -0,0 +1,36 @@
+<?php
+  $windowtitle	= ($_GET['bio'] ? "Bio" : "Layout") ." size comparison";
+  require 'lib/function.php';
+  require 'lib/layout.php';
+  print "
+	$header
+	$fonttag
+		Show: <a href=\"?\">layout sizes</a> - <a href=\"?bio=1\">bio sizes</a>	
+	<br>$tblstart
+	$tccellh>&nbsp;</td>
+	$tccellh colspan=2>User</td>
+	".  ($_GET['bio'] ? "$tccellh>Bio</td>" : "$tccellh>Header</td>
+	$tccellh>Signature</td>
+	$tccellh>Total</td>");
+  $users=mysql_query('SELECT id,name, minipic, powerlevel, sex, '. ($_GET['bio'] ? "LENGTH(bio) AS tsize, bio as postheader" : "LENGTH(postheader) AS hsize,LENGTH(signature) AS ssize,LENGTH(postheader)+LENGTH(signature) AS tsize, postheader") .' FROM users ORDER BY tsize DESC');
+
+  for ($i = 1; $u=mysql_fetch_array($users); $i++) {
+	if (!$u['tsize']) break;
+	if ($last['tsize'] != $u['tsize']) $r = $i;
+	$last	= $u;
+	$max	= max($u['tsize'], $max);
+
+	if (strpos($u['postheader'], "<style>.loclass") !== false) $lm	= true;
+	else $lm	= false;
+
+	print "<tr>
+	$tccell2>". ($lm ? "<img src=\"images/smilies/denied.gif\" title=\"Say no to the layout maker!\" align=absmiddle> $r <img src=\"images/smilies/denied.gif\" title=\"Say no to the layout maker!\" align=absmiddle>" : "$r") ."</td>
+	$tccell2 width=16>". ($u['minipic'] ? "<img src=\"". htmlspecialchars($u['minipic']) ."\" width=16 height=16>" : "") ."</td>
+	$tccell1><a href=profile.php?id=$u[id]><font ". getnamecolor($u[sex], $u[powerlevel]) .">$u[name]</font></a></td>
+	". (!$_GET['bio'] ? "$tccell2 width=100>". number_format($u[hsize]) ."</td>
+	$tccell2 width=100>". number_format($u[ssize]) ."</td>" : "") ."
+	$tccell1 width=100><b>". number_format($u[tsize]) ."</b><br><img src=images/minibar.png width=\"". number_format($u['tsize'] / $max * 200) ."\" align=left height=3></td></tr>";
+  }
+  print $tblend.$footer;
+  printtimedif($startingtime);
+?>
\ No newline at end of file
diff --git a/smilies.dat b/smilies.dat
new file mode 100644
index 0000000..6fbd0af
--- /dev/null
+++ b/smilies.dat
@@ -0,0 +1,73 @@
+:),images/smilies/smile.gif
+;),images/smilies/wink.gif
+:D,images/smilies/biggrin.gif
+:LOL:,images/smilies/lol.gif
+8-),images/smilies/glasses.gif
+:(,images/smilies/frown.gif
+:mad:,images/smilies/mad.gif
+>_<,images/smilies/yuck.gif
+:P,images/smilies/tongue.gif
+:S,images/smilies/wobbly.gif
+O_O,images/smilies/eek.gif
+o_O,images/smilies/bigeyes.gif
+O_o,images/smilies/bigeyes2.gif
+^_^,images/smilies/cute.gif
+^^;;;,images/smilies/cute2.gif
+~:o,images/smilies/baby.gif
+x_x,images/smilies/sick.gif
+:eyeshift:,images/smilies/eyeshift.gif
+:vamp:,images/smilies/vamp.gif
+o_o,images/smilies/blank.gif
+;_;,images/smilies/cry.gif
+@_@,images/smilies/dizzy.gif
+-_-,images/smilies/annoyed.gif
+>_>,images/smilies/shiftright.gif
+<_<,images/smilies/shiftleft.gif
+:rofl:,images/smilies/rofl.gif
+:terror:,images/smilies/terror.gif
+:approve:,images/smilies/approved.gif
+:deny:,images/smilies/denied.gif
+:eyeshift2:,images/smilies/eyeshift2.gif
+:glare:,images/smilies/glare.png
+:meow:,images/smilies/meow.gif
+:words:,images/smilies/words.gif
+(-:,images/smilies/smile2.png
+:ohdear:,images/smilies/ohdear.png
+:raddlaugh:,images/smilies/rlaugh.gif
+:raddmad:,images/smilies/raddmad.gif
+:raddstand:,images/smilies/raddstand.gif
+:raddsigh:,images/smilies/raddsigh2.gif
+:raddwow:,images/smilies/raddwow.gif
+:raddrock:,images/smilies/raddrock.gif
+:raddwink:,images/smilies/raddwink.gif
+:jawdrop:,images/smilies/jawdrop.gif
+:boatanchor:,images/smilies/boatanchor.png
+:eng101:,images/smilies/eng101.png
+:specialed:,images/smilies/specialed.png
+:eww:,images/smilies/ewww.gif
+:1up:,images/1up.png
+:gonk:,images/smilies/gonk.gif
+:superd:,images/smilies/superd.png
+:flunked:,images/smilies/flunked.png
+:smugdra:,images/smilies/smugdra.png
+:nsfw:,images/icons/nsfwicon.gif
+:toot:,images/smilies/toot.png
+:toot2:,images/smilies/toot2.gif
+:awesome:,images/smilies/awesome.png
+:argh:,images/smilies/damnyou.gif
+:turnip:,images/smilies/turnip.gif
+:durnip:,images/smilies/durnip2.gif
+:sarcmark:,images/smilies/smb2smileyc.png
+<3,images/smilies/laheart.gif
+:ssh:,http://xkeeper.net/img/emot-ssh.gif
+:munch:,http://xkeeper.net/img/emot-munch.gif
+:siren:,http://xkeeper.net/img/emot-siren.gif
+:rdash:,images/smilies/ranbowdash.001.png
+:shepface:,images/smilies/emot-shepface.gif
+:nyan:,images/smilies/nyan.001.gif
+:oot:,images/ocarina.png
+:colbert:,images/smilies/emot-colbert.gif
+:affun:,images/smilies/affun.gif
+:darkaffun:,images/smilies/darkaffun.gif
+:effort:,images/smilies/emot-effort.gif
+:pacsome:,images/smilies/pacsome.png
\ No newline at end of file
diff --git a/smilies.php b/smilies.php
new file mode 100644
index 0000000..af32f31
--- /dev/null
+++ b/smilies.php
@@ -0,0 +1,98 @@
+<?php
+  require 'lib/function.php';
+  require 'lib/layout.php';
+
+   $s	= readsmilies();
+
+  print "
+$body
+<title>Smilies</title>
+$css
+<center>
+ <table height=100% valign=middle><td>
+  $tblstart";
+
+	foreach($s as $i => $v) {
+		if (!($i % 4)) print "<tr>";
+
+		if ($v) print "$tccell1><img src=\"". $v[1] ."\"></td>$tccell2>". $v[0] ."</td>";
+	}
+
+
+
+/*"   <tr>
+	$tccell1><img src=images/smilies/smile.gif></td>
+    $tccell1>:)</td>
+	$tccell1><img src=images/smilies/wink.gif></td>
+    $tccell1>;)</td>
+	$tccell1><img src=images/smilies/biggrin.gif></td>
+    $tccell1>:D</td>
+	$tccell1><img src=images/smilies/lol.gif></td>
+    $tccell1>:LOL:</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies/glasses.gif></td>
+    $tccell1>8-)</td>
+	$tccell1><img src=images/smilies/frown.gif></td>
+    $tccell1>:(</td>
+	$tccell1><img src=images/smilies/mad.gif></td>
+    $tccell1>>:</td>
+	$tccell1><img src=images/smilies/yuck.gif></td>
+    $tccell1>>_<</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies/tongue.gif></td>
+    $tccell1>:P</td>
+	$tccell1><img src=images/smilies/wobbly.gif></td>
+    $tccell1>:S</td>
+	$tccell1><img src=images/smilies/eek.gif></td>
+    $tccell1>O_O</td>
+	$tccell1><img src=images/smilies/bigeyes.gif></td>
+    $tccell1>o_O</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies/bigeyes2.gif></td>
+    $tccell1>O_o</td>
+	$tccell1><img src=images/smilies/cute.gif></td>
+    $tccell1>^_^</td>
+	$tccell1><img src=images/smilies/cute2.gif></td>
+    $tccell1>^^;;;</td>
+	$tccell1><img src=images/smilies/baby.gif></td>
+    $tccell1>~:o</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies/sick.gif></td>
+    $tccell1>x_x</td>
+	$tccell1><img src=images/smilies/eyeshift.gif></td>
+    $tccell1>:eyeshift:</td>
+	$tccell1><img src=images/smilies/vamp.gif></td>
+    $tccell1>:vamp:</td>
+	$tccell1><img src=images/smilies/blank.gif></td>
+    $tccell1>o_o</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies/cry.gif></td>
+    $tccell1>;_;</td>
+	$tccell1><img src=images/smilies/dizzy.gif></td>
+    $tccell1>@_@</td>
+	$tccell1><img src=images/smilies/annoyed.gif></td>
+    $tccell1>-_-</td>
+	$tccell1><img src=images/smilies/shiftright.gif></td>
+    $tccell1>>_></td>
+   </tr><tr>
+	$tccell1><img src=images/smilies/shiftleft.gif></td>
+    $tccell1><_<</td>
+	$tccell1><img src=images/smilies/rofl.gif></td>
+    $tccell1>:rofl:</td>
+	$tccell1><img src=images/smilies/terror.gif></td>
+    $tccell1>:terror:</td>
+	$tccell1><img src=images/smilies/approved.gif></td>
+    $tccell1>:approve:</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies/denied.gif></td>
+    $tccell1>:deny:</td>
+	$tccell1><img src=images/smilies/eyeshift2.gif></td>
+    $tccell1>:eyeshift2:</td>
+	$tccell1><img src=images/smilies/meow.gif></td>
+    $tccell1>:meow:</td>
+   </tr>
+*/
+ print "$tblend
+ </td></table>
+";
+?>
\ No newline at end of file
diff --git a/smilies2.dat b/smilies2.dat
new file mode 100644
index 0000000..73ea005
--- /dev/null
+++ b/smilies2.dat
@@ -0,0 +1,42 @@
+:),images/smilies2/smile.gif
+;),images/smilies2/wink.gif
+:D,images/smilies2/biggrin.gif
+:LOL:,images/smilies2/lol.gif
+8-),images/smilies2/glasses.gif
+:(,images/smilies2/frown.gif
+>:,images/smilies2/mad.gif
+>_<,images/smilies2/yuck.gif
+:P,images/smilies2/tongue.gif
+:S,images/smilies2/wobbly.gif
+O_O,images/smilies2/eek.gif
+o_O,images/smilies2/bigeyes.gif
+O_o,images/smilies2/bigeyes2.gif
+^_^,images/smilies2/cute.gif
+^^;;;,images/smilies2/cute2.gif
+~:o,images/smilies2/baby.gif
+x_x,images/smilies2/sick.gif
+:eyeshift:,images/smilies2/eyeshift.gif
+:vamp:,images/smilies2/vamp.gif
+o_o,images/smilies2/blank.gif
+;_;,images/smilies2/cry.gif
+@_@,images/smilies2/dizzy.gif
+-_-,images/smilies2/annoyed.gif
+>_>,images/smilies2/shiftright.gif
+<_<,images/smilies2/shiftleft.gif
+:rofl:,images/smilies2/rofl.gif
+:terror:,images/smilies2/terror.gif
+:approve:,images/smilies2/approved.gif
+:deny:,images/smilies2/denied.gif
+:eyeshift2:,images/smilies2/eyeshift2.gif
+:meow:,images/smilies2/meow.gif
+:XD:,images/smilies2/haw.gif
+:gutbust:,images/smilies2/haw2.gif
+:grin:,images/smilies2/grin.gif
+:duh:,images/smilies2/duh.gif
+:roll:,images/smilies2/rolleyes.gif
+:evil:,images/smilies2/evil.gif
+:good:,images/smilies2/halo.gif
+:kawaii:,images/smilies2/anime.gif
+;D,images/smilies2/anime2.gif
+:flush:,images/smilies2/flush.gif
+:krunk:,images/smilies2/krunk.gif
\ No newline at end of file
diff --git a/smilies2.php b/smilies2.php
new file mode 100644
index 0000000..b63d369
--- /dev/null
+++ b/smilies2.php
@@ -0,0 +1,110 @@
+<?php
+  require 'lib/function.php';
+  require 'lib/layout.php';
+  print "
+$body
+<title>Smilies</title>
+$css
+<center>
+ <table height=100% valign=middle><td>
+  $tblstart
+   <tr>
+	$tccell1><img src=images/smilies2/smile.gif></td>
+    $tccell1>:)</td>
+	$tccell1><img src=images/smilies2/wink.gif></td>
+    $tccell1>;)</td>
+	$tccell1><img src=images/smilies2/biggrin.gif></td>
+    $tccell1>:D</td>
+	$tccell1><img src=images/smilies2/lol.gif></td>
+    $tccell1>:LOL:</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies2/glasses.gif></td>
+    $tccell1>8-)</td>
+	$tccell1><img src=images/smilies2/frown.gif></td>
+    $tccell1>:(</td>
+	$tccell1><img src=images/smilies2/mad.gif></td>
+    $tccell1>>:</td>
+	$tccell1><img src=images/smilies2/yuck.gif></td>
+    $tccell1>>_<</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies2/tongue.gif></td>
+    $tccell1>:P</td>
+	$tccell1><img src=images/smilies2/wobbly.gif></td>
+    $tccell1>:S</td>
+	$tccell1><img src=images/smilies2/eek.gif></td>
+    $tccell1>O_O</td>
+	$tccell1><img src=images/smilies2/bigeyes.gif></td>
+    $tccell1>o_O</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies2/bigeyes2.gif></td>
+    $tccell1>O_o</td>
+	$tccell1><img src=images/smilies2/cute.gif></td>
+    $tccell1>^_^</td>
+	$tccell1><img src=images/smilies2/cute2.gif></td>
+    $tccell1>^^;;;</td>
+	$tccell1><img src=images/smilies2/baby.gif></td>
+    $tccell1>~:o</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies2/sick.gif></td>
+    $tccell1>x_x</td>
+	$tccell1><img src=images/smilies2/eyeshift.gif></td>
+    $tccell1>:eyeshift:</td>
+	$tccell1><img src=images/smilies2/vamp.gif></td>
+    $tccell1>:vamp:</td>
+	$tccell1><img src=images/smilies2/blank.gif></td>
+    $tccell1>o_o</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies2/cry.gif></td>
+    $tccell1>;_;</td>
+	$tccell1><img src=images/smilies2/dizzy.gif></td>
+    $tccell1>@_@</td>
+	$tccell1><img src=images/smilies2/annoyed.gif></td>
+    $tccell1>-_-</td>
+	$tccell1><img src=images/smilies2/shiftright.gif></td>
+    $tccell1>>_></td>
+   </tr><tr>
+	$tccell1><img src=images/smilies2/shiftleft.gif></td>
+    $tccell1><_<</td>
+	$tccell1><img src=images/smilies2/rofl.gif></td>
+    $tccell1>:rofl:</td>
+	$tccell1><img src=images/smilies2/terror.gif></td>
+    $tccell1>:terror:</td>
+	$tccell1><img src=images/smilies2/approved.gif></td>
+    $tccell1>:approve:</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies2/denied.gif></td>
+    $tccell1>:deny:</td>
+	$tccell1><img src=images/smilies2/eyeshift2.gif></td>
+    $tccell1>:eyeshift2:</td>
+	$tccell1><img src=images/smilies2/meow.gif></td>
+    $tccell1>:meow:</td>
+	$tccell1><img src=images/smilies2/haw.gif></td>
+    $tccell1>:XD:</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies2/haw2.gif></td>
+    $tccell1>:gutbust:</td>
+	$tccell1><img src=images/smilies2/grin.gif></td>
+    $tccell1>:grin:</td>
+	$tccell1><img src=images/smilies2/duh.gif></td>
+    $tccell1>:duh:</td>
+	$tccell1><img src=images/smilies2/rolleyes.gif></td>
+    $tccell1>:roll:</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies2/evil.gif></td>
+    $tccell1>:evil:</td>
+	$tccell1><img src=images/smilies2/halo.gif></td>
+    $tccell1>:good:</td>
+	$tccell1><img src=images/smilies2/anime.gif></td>
+    $tccell1>:kawaii:</td>
+	$tccell1><img src=images/smilies2/anime2.gif></td>
+    $tccell1>;D</td>
+   </tr><tr>
+	$tccell1><img src=images/smilies2/flush.gif></td>
+    $tccell1>:flush:</td>
+	$tccell1><img src=images/smilies2/krunk.gif></td>
+    $tccell1>:krunk:</td>
+   </tr>
+  $tblend
+ </td></table>
+";
+?>
\ No newline at end of file
diff --git a/smilieslol.dat b/smilieslol.dat
new file mode 100644
index 0000000..77401b9
--- /dev/null
+++ b/smilieslol.dat
@@ -0,0 +1,58 @@
+:),http://xkeeper.net/img/smb2smileyc.png
+;),http://xkeeper.net/img/smb2smileyc.png
+:D,http://xkeeper.net/img/smb2smileyc.png
+:LOL:,http://xkeeper.net/img/smb2smileyc.png
+8-),http://xkeeper.net/img/smb2smileyc.png
+:(,http://xkeeper.net/img/smb2smileyc.png
+:mad:,http://xkeeper.net/img/smb2smileyc.png
+>_<,http://xkeeper.net/img/smb2smileyc.png
+:P,http://xkeeper.net/img/smb2smileyc.png
+:S,http://xkeeper.net/img/smb2smileyc.png
+O_O,http://xkeeper.net/img/smb2smileyc.png
+o_O,http://xkeeper.net/img/smb2smileyc.png
+O_o,http://xkeeper.net/img/smb2smileyc.png
+^_^,http://xkeeper.net/img/smb2smileyc.png
+^^;;;,http://xkeeper.net/img/smb2smileyc.png
+~:o,http://xkeeper.net/img/smb2smileyc.png
+x_x,http://xkeeper.net/img/smb2smileyc.png
+:eyeshift:,http://xkeeper.net/img/smb2smileyc.png
+:vamp:,http://xkeeper.net/img/smb2smileyc.png
+o_o,http://xkeeper.net/img/smb2smileyc.png
+;_;,http://xkeeper.net/img/smb2smileyc.png
+@_@,http://xkeeper.net/img/smb2smileyc.png
+-_-,http://xkeeper.net/img/smb2smileyc.png
+>_>,http://xkeeper.net/img/smb2smileyc.png
+<_<,http://xkeeper.net/img/smb2smileyc.png
+:rofl:,http://xkeeper.net/img/smb2smileyc.png
+:terror:,http://xkeeper.net/img/smb2smileyc.png
+:approve:,http://xkeeper.net/img/smb2smileyc.png
+:deny:,http://xkeeper.net/img/smb2smileyc.png
+:eyeshift2:,http://xkeeper.net/img/smb2smileyc.png
+:glare:,http://xkeeper.net/img/smb2smileyc.png
+:meow:,http://xkeeper.net/img/smb2smileyc.png
+:words:,http://xkeeper.net/img/smb2smileyc.png
+(-:,http://xkeeper.net/img/smb2smileyc.png
+:ohdear:,http://xkeeper.net/img/smb2smileyc.png
+:raddlaugh:,http://xkeeper.net/img/smb2smileyc.png
+:raddmad:,http://xkeeper.net/img/smb2smileyc.png
+:raddstand:,http://xkeeper.net/img/smb2smileyc.png
+:raddsigh:,http://xkeeper.net/img/smb2smileyc.png
+:raddwow:,http://xkeeper.net/img/smb2smileyc.png
+:raddrock:,http://xkeeper.net/img/smb2smileyc.png
+:raddwink:,http://xkeeper.net/img/smb2smileyc.png
+:jawdrop:,http://xkeeper.net/img/smb2smileyc.png
+:boatanchor:,http://xkeeper.net/img/smb2smileyc.png
+:eng101:,http://xkeeper.net/img/smb2smileyc.png
+:specialed:,http://xkeeper.net/img/smb2smileyc.png
+:eww:,http://xkeeper.net/img/smb2smileyc.png
+:1up:,http://xkeeper.net/img/smb2smileyc.png
+:gonk:,http://xkeeper.net/img/smb2smileyc.png
+:superd:,http://xkeeper.net/img/smb2smileyc.png
+:flunked:,http://xkeeper.net/img/smb2smileyc.png
+:smugdra:,http://xkeeper.net/img/smb2smileyc.png
+:nsfw:,http://xkeeper.net/img/smb2smileyc.png
+:toot:,http://xkeeper.net/img/smb2smileyc.png
+:awesome:,http://xkeeper.net/img/smb2smileyc.png
+:argh:,http://xkeeper.net/img/smb2smileyc.png
+:turnip:,images/smilies/turnip.gif
+:durnip:,images/smilies/durnip2.gif
diff --git a/stats.php b/stats.php
new file mode 100644
index 0000000..205af2d
--- /dev/null
+++ b/stats.php
@@ -0,0 +1,130 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/layout.php';
+
+	$misc   = $sql->fetchq('SELECT * FROM misc');
+	$tstats = $sql->query('SHOW TABLE STATUS');
+	while ($t = $sql->fetch($tstats)) $tbl[$t['Name']]=$t;
+
+/*
+	$sch_info = "";
+	$schemes = $sql->query('
+		SELECT COUNT(u.id) as schemecount, u.scheme, schemes.name
+		FROM users AS u
+		LEFT JOIN schemes ON (u.scheme = schemes.id)
+		WHERE (schemes.ord >= 0)
+		GROUP BY u.scheme
+		ORDER BY schemecount DESC
+	');
+
+	while ($row = $sql->fetch($schemes)) {
+		$sch_info .= "<tr>$tccell1>$row[name]</td>$tccell1>$row[schemecount]</tr>";
+	} */
+
+	print "
+	$header<br>$tblstart
+	$tccellh>Records$tccellh>&nbsp<tr>
+	$tccell1s><b>Most posts within 24 hours:</td>
+	$tccell2ls>$misc[maxpostsday], on ".date($dateformat,$misc['maxpostsdaydate'])."<tr>
+	$tccell1s><b>Most posts within 1 hour:</td>
+	$tccell2ls>$misc[maxpostshour], on ".date($dateformat,$misc['maxpostshourdate'])."<tr>
+	$tccell1s><b>Most users online:</td>
+	$tccell2ls>$misc[maxusers], on ".date($dateformat,$misc['maxusersdate'])."$misc[maxuserstext]
+	$tblend<br>".
+/*
+	// This is kind of in Edit Profile already.
+	"$tblstart<tr>$tccellh colspan='2'>Scheme Usage Breakdown</td></tr>
+	<tr>$tccellh>Scheme Name</td>$tccellh>Users</td></tr>
+	$sch_info
+	$tblend<br>".
+*/
+	"$tblstart<tr>
+	$tccellh>Table name</td>
+	$tccellh>Rows</td>
+	$tccellh>Avg. data/row</td>
+	$tccellh>Data size</td>
+	$tccellh>Index size</td>
+	$tccellh>Overhead</td>
+	$tccellh>Total size</td></tr>"
+	.tblinfo('posts_text')
+	.tblinfo('posts')
+	.tblinfo('pmsgs_text')
+	.tblinfo('pmsgs')
+	.tblinfo('postlayouts')
+	.tblinfo('threads')
+	.tblinfo('users')
+	.tblinfo('forumread')
+	.tblinfo('threadsread')
+	.tblinfo('postradar')
+	.tblinfo('ipbans')
+	.tblinfo('defines')
+	.tblinfo('dailystats')
+	.tblinfo('rendertimes')
+	."$tblend
+  <br>
+  $tblstart<tr>
+	$tccellhs colspan=9>Daily stats<tr>
+	$tccellcs>Date</td>
+	$tccellcs>Total users</td>
+	$tccellcs>Total posts</td>
+	$tccellcs>Total threads</td>
+	$tccellcs>Total views</td>
+	$tccellcs>New users</td>
+	$tccellcs>New posts</td>
+	$tccellcs>New threads</td>
+	$tccellcs>New views</td></tr>
+  ";
+	$users=0;
+	$posts=0;
+	$threads=0;
+	$views=0;
+	$stats=$sql->query("SELECT * FROM dailystats");
+	while($day=$sql->fetch($stats)){
+		print "<tr>
+		$tccell1s>$day[date]</td>
+		$tccell2s>$day[users]</td>
+		$tccell2s>$day[posts]</td>
+		$tccell2s>$day[threads]</td>
+		$tccell2s>$day[views]</td>
+		$tccell2s>".($day['users']-$users)."</td>
+		$tccell2s>".($day['posts']-$posts)."</td>
+		$tccell2s>".($day['threads']-$threads)."</td>
+		$tccell2s>".($day['views']-$views)."</td></tr>
+		";
+		$users=$day['users'];
+		$posts=$day['posts'];
+		$threads=$day['threads'];
+		$views=$day['views'];
+	}
+	print $tblend.$footer;
+	printtimedif($startingtime);
+
+
+
+	function sp($sz) {
+//    $b="$sz B";
+//    if($sz>1023) $b=sprintf('%01.2f',$sz/1024).' kB';
+//    if($sz>10239) $b=sprintf('%01.1f',$sz/1024).' kB';
+//    if($sz>102399) $b=sprintf('%01.0f',$sz/1024).' kB';
+//    if($sz>1048575) $b=sprintf('%01.2f',$sz/1048576).' MB';
+//    if($sz>10485759) $b=sprintf('%01.1f',$sz/1048576).' MB';
+//    if($sz>104857599) $b=sprintf('%01.0f',$sz/1048576).' MB';
+		$b=number_format($sz,0,'.',',');
+		return $b;
+	}
+
+	function tblinfo($n) {
+		global $tbl,$tccell2,$tccell2l;
+		$t=$tbl[$n];
+		return "
+		<tr align=right>
+		$tccell2>$t[Name]</td>
+		$tccell2l>".sp($t['Rows']) ."</td>
+		$tccell2l>".sp($t['Avg_row_length'])."</td>
+		$tccell2l>".sp($t['Data_length'])."</td>
+		$tccell2l>".sp($t['Index_length'])."</td>
+		$tccell2l>".sp($t['Data_free'])."</td>
+		$tccell2l>".sp($t['Data_length']+$t['Index_length'])."</td></tr>";
+	}
+
+?>
diff --git a/status.php b/status.php
new file mode 100644
index 0000000..25549d4
--- /dev/null
+++ b/status.php
@@ -0,0 +1,231 @@
+<?php
+	require 'lib/function.php';
+	require 'lib/rpg.php';
+
+	if(!intval($u)) die();
+
+	$user = $sql->fetchq("SELECT name,posts,regdate,users_rpg.* FROM users,users_rpg WHERE id='$u' AND uid=id");
+	$p = $user['posts'];
+	$d = (ctime()-$user['regdate'])/86400;
+
+	if(!$it)
+		$it=0;
+	if(!$ne)
+		$items = $sql->getarraybykey("SELECT * FROM items WHERE id=$user[eq1] OR id=$user[eq2] OR id=$user[eq3] OR id=$user[eq4] OR id=$user[eq5] OR id=$user[eq6] OR id=$it", 'id');
+	if(!$nc)
+		$class = $sql->fetchq("SELECT * FROM `rpg_classes` WHERE `id` = '". $user['class'] ."'");
+
+	if($ct) {
+		$GPdif=floor($items[$user['eq'.$ct]][coins]*0.6)-$items[$it][coins];
+		$user['eq'.$ct]=$it;
+	}
+
+	$st = getstats($user,$items,$class);
+	$st['GP']+=$GPdif;
+	if($st['lvl'] > 0) $pct = 1 - calcexpleft($st['exp'])/totallvlexp($st['lvl']);
+
+	if (!$class) {
+		$class['name']	= "None";
+	}
+
+	$img=ImageCreate(256,224 - (8 * 0));
+	imagesavealpha($img, true);
+	imagealphablending($img, false);
+	$c['bg']=  ImageColorAllocatealpha($img, 40, 40, 90, 127);
+	$c['bxb0']=ImageColorAllocate($img,  0,  0,  0);
+
+//	$c['bxb1']=ImageColorAllocate($img,225,200,180);
+//	$c['bxb2']=ImageColorAllocate($img,190,160,130);
+//	$c['bxb3']=ImageColorAllocate($img,130,110, 90);
+
+	$c['bxb1']=ImageColorAllocate($img, 200, 180, 225);
+	$c['bxb2']=ImageColorAllocate($img, 160, 130, 190);
+	$c['bxb3']=ImageColorAllocate($img,  90, 110, 130);
+
+	for($i=0;$i<100;$i++)
+		 $c[$i]=ImageColorAllocate($img,  15+$i/1.5,  8, 20+$i);
+
+	$c['barE1']=ImageColorAllocate($img,120,150,180);
+	$c['barE2']=ImageColorAllocate($img, 30, 60, 90);
+
+	$c['bar1'][ 1]	= ImageColorAllocate($img, 215,  91, 129);
+	$c['bar1'][ 2]	= ImageColorAllocate($img, 255, 136, 154);
+	$c['bar1'][ 3]	= ImageColorAllocate($img, 255, 139,  89);
+	$c['bar1'][ 4]	= ImageColorAllocate($img, 255, 251,  89);
+	$c['bar1'][ 5]	= ImageColorAllocate($img,  89, 255, 139);
+	$c['bar1'][ 6]	= ImageColorAllocate($img,  89, 213, 255);
+	$c['bar1'][ 7]	= ImageColorAllocate($img, 196,  33,  33);
+	$c['bar1'][ 8]	= ImageColorAllocate($img, 196,  66, 196);
+	$c['bar1'][ 9]	= ImageColorAllocate($img, 100,   0, 155);
+	$c['bar1'][10]	= ImageColorAllocate($img,  88,   0, 121);
+	$c['bar1'][11]	= ImageColorAllocate($img,   0, 174, 215);
+	$c['bar1'][12]	= ImageColorAllocate($img,   0,  99, 151);
+	$c['bar1'][13]	= ImageColorAllocate($img, 175, 175, 175);
+	$c['bar1'][14]	= ImageColorAllocate($img, 222, 222, 222);
+	$c['bar1'][15]	= ImageColorAllocate($img, 255, 255, 255);
+
+	$st['CHP'] = max($st['HP'] - $user['damage'], 0);
+	if ($st['CHP'] <= 0)
+		$classtext = 'K.O.\'d';
+	else
+		$classtext = $class['name'];
+
+	box( 0, 0,2+strlen($user['name']),3);
+	box( 0, 3,2+strlen($classtext),3);
+	box( 0, 7,32, 4);
+	box( 0,12,32, 9);
+	box( 0,22,18, 6);
+	box(19,22,13, 6);
+
+	$fontY=fontc(255,250,240, 255,240, 80,  0, 0, 0);
+	$fontR=fontc(255,230,220, 240,160,150,  0, 0, 0);
+	$fontG=fontc(190,255,190,  60,220, 60,  0, 0, 0);
+	$fontB=fontc(160,240,255, 120,190,240,  0, 0, 0);
+	$fontW=fontc(255,255,255, 210,210,210,  0, 0, 0);
+
+	twrite($fontW, 1, 1,0,"$user[name]");
+	twrite((($classtext == $class['name']) ? $fontB : $fontR), 1, 4,0, $classtext);
+
+	twrite($fontB, 1, 8,0,'HP       /');
+	twrite($fontR, 3, 8,7,nlimiter($st['CHP']));
+	twrite($fontY, 9, 8,7,nlimiter($st['HP']));
+	twrite($fontB, 1, 9,0,'MP       /');
+	twrite($fontR, 3, 9,7,nlimiter($st['MP']));
+	twrite($fontY, 9, 9,7,nlimiter($st['MP']));
+
+	for($i=2;$i<9;$i++){
+		 twrite($fontB, 1,11+$i,0,"$stat[$i]");
+		 twrite($fontY, 3,11+$i,7,nlimiter($st[$stat[$i]]));
+	}
+
+	twrite($fontB, 1,23, 0,'Level');
+	twrite($fontY, 1,23,16,$st['lvl']);
+	twrite($fontB, 1,25, 0,'EXP:');
+	twrite($fontY, 1,25,16,$st['exp']);
+	twrite($fontB, 1,26, 0,'Next:');
+	twrite($fontY, 1,26,16,calcexpleft($st['exp']));
+
+	twrite($fontB,20,23, 0,'Coins:');
+	twrite($fontY,20,25, 0,chr(0));
+	twrite($fontG,20,26, 0,chr(0));
+	twrite($fontY,21,25,10,max(0, $st['GP']));
+	twrite($fontG,21,26,10,max(0, $user['gcoins']));
+
+	$sc[ 1]=     1;
+	$sc[ 2]=     5;
+	$sc[ 3]=    25;
+	$sc[ 4]=   100;
+	$sc[ 5]=   250;
+	$sc[ 6]=   500;
+	$sc[ 7]=  1000;
+	$sc[ 8]=  2500;
+	$sc[ 9]=  5000;
+	$sc[10]= 10000;
+	$sc[11]= 100000;
+	$sc[12]= 1000000;
+	$sc[13]= 10000000;
+	$sc[14]= 100000000;
+	$sc[15]= 1000000000;
+
+	bars();
+
+	header('Content-type:image/png');
+	ImagePNG($img);
+	ImageDestroy($img);
+
+
+
+function twrite($font,$x,$y,$l,$text){
+	global $img;
+
+	$x*=8;
+	$y*=8;
+	$text.='';
+	if (strlen($text)<$l)
+		$x+=($l-strlen($text))*8;
+
+	for($i=0;$i<strlen($text);$i++)
+		ImageCopy($img,$font,$i*8+$x,$y,(ord($text[$i])%16)*8,floor(ord($text[$i])/16)*8,8,8);
+}
+
+function fontc($r1,$g1,$b1,$r2,$g2,$b2,$r3,$g3,$b3){
+	$font=ImageCreateFromPNG('images/rpg/font.png');
+	ImageColorTransparent($font,1);
+	ImageColorSet($font,6,$r1,$g1,$b1);
+	ImageColorSet($font,5,($r1*2+$r2)/3,($g1*2+$g2)/3,($b1*2+$b2)/3);
+	ImageColorSet($font,4,($r1+$r2*2)/3,($g1+$g2*2)/3,($b1+$b2*2)/3);
+	ImageColorSet($font,3,$r2,$g2,$b2);
+	ImageColorSet($font,0,$r3,$g3,$b3);
+	return $font;
+}
+
+function box($x,$y,$w,$h){
+	global $img,$c;
+
+	$x*=8;
+	$y*=8;
+	$w*=8;
+	$h*=8;
+
+	ImageRectangle($img,$x+0,$y+0,$x+$w-1,$y+$h-1,$c['bxb0']);
+	ImageRectangle($img,$x+1,$y+1,$x+$w-2,$y+$h-2,$c['bxb3']);
+	ImageRectangle($img,$x+2,$y+2,$x+$w-3,$y+$h-3,$c['bxb1']);
+	ImageRectangle($img,$x+3,$y+3,$x+$w-4,$y+$h-4,$c['bxb2']);
+	ImageRectangle($img,$x+4,$y+4,$x+$w-5,$y+$h-5,$c['bxb0']);
+
+	for($i=5;$i<$h-5;$i++) {
+	  $n=(1-$i/$h)*100;
+	  ImageLine($img,$x+5,$y+$i,$x+$w-6,$y+$i,$c[$n]);
+	}
+}
+
+function bars(){
+	global $st,$img,$c,$sc,$pct,$stat,$user;
+
+	for($s=1;@(max($st['HP'],$st['MP'])/$sc[$s])>113;$s++) {}
+	if(!$sc[$s]) $sc[$s]=1;
+
+	if ($st['HP'] > 0) {
+		ImageFilledRectangle($img,137,41+24,136+$st['HP']/$sc[$s],47+24,$c['bxb0']);
+		ImageFilledRectangle($img,136,40+24,135+$st['HP']/$sc[$s],46+24,$c['bar1'][$s]);
+		if ($user['damage'] > 0) {
+			$dmg	= max($st[HP] - $user['damage'], 0) / $sc[$s];
+			$ctemp	= imagecolorsforindex($img, $c['bar1'][$s]);
+			$df		= 0.6;
+			ImageFilledRectangle($img,135 + $st['HP']/$sc[$s],40+24,135+$dmg,46+24,imagecolorallocate($img, $ctemp['red'] * $df, $ctemp['green'] * $df, $ctemp['blue'] * $df));
+		}
+	}
+
+	if ($st['MP'] > 0) {
+		ImageFilledRectangle($img,137,49+24,136+$st['MP']/$sc[$s],55+24,$c['bxb0']);
+		ImageFilledRectangle($img,136,48+24,135+$st['MP']/$sc[$s],54+24,$c['bar1'][$s]);
+	}
+
+	for($i=2;$i<9;$i++) $st2[$i]=$st[$stat[$i]];
+	for($s=1;@(max($st2)/$sc[$s])>161;$s++){}
+	if(!$sc[$s]) $sc[$s]=1;
+	for($i=2;$i<9;$i++){
+		if (floor($st[$stat[$i]]/$sc[$s]) > 0) {
+			ImageFilledRectangle($img,89,65+$i*8+24,89+$st[$stat[$i]]/$sc[$s], 71+$i*8+24,$c['bxb0']);
+			ImageFilledRectangle($img,88,64+$i*8+24,88+$st[$stat[$i]]/$sc[$s], 70+$i*8+24,$c['bar1'][$s]);
+		}
+	}
+
+	$e2	= 16 * 8;	// width of bar
+	$e1	= $e2 * $pct;
+	$y	= 168+1+24;
+	ImageFilledRectangle($img,9,$y + 1, 8 + $e2, $y + 4, $c['bxb0']);
+	ImageFilledRectangle($img,8,$y    , 7 + $e2, $y + 3, $c['barE2']);
+	ImageFilledRectangle($img,8,$y    , 7 + $e1, $y + 3, $c['barE1']);
+}
+
+function nlimiter($n) {
+	if ($n <            0) return "???"; //$n = abs($n);
+	if ($n <=       99999) return $n;
+	if ($n <=     9999999) return number_format(floor($n / 1000), 0, ".", "") ."K";
+	if ($n <=    99999999) return number_format(floor($n / 100000) / 10, 1, ".", "") ."M";
+	if ($n <=  9999999999) return number_format(floor($n / 1000000), 0, ".", "") ."M";
+	if ($n <= 99999999999) return number_format(floor($n / 100000000) / 10, 1, ".", "") ."B";
+	return number_format(floor($n / 1000000000), 0, ".", "") ."B";
+}
+
diff --git a/templates/aceboard.php b/templates/aceboard.php
new file mode 100644
index 0000000..d0ae96c
--- /dev/null
+++ b/templates/aceboard.php
@@ -0,0 +1,93 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  require_once $root."/lib/layout.php";
+  $css.="
+  .topstretch	{height: 173px; width: 100%; background: #ffffff url(".$bconf[boardurl]."/images/acmlmboard/topstretch.jpg);}
+  .banner	{height: 173px; width: 800px; background: #ffffff url(".$bconf[boardurl]."/images/acmlmboard/aceboardtitlepic.jpg)}
+  .leftstretch	{height: 100%; width: 110px; background: #ffffff; vertical-align: top; border-right: thin dashed #0D125C}
+  .mainthing	{background: #202245; vertical-align: top;}
+  .headlinks  {background: #ffffff url(".$bconf[boardurl]."/images/acmlmboard/headlinksbg.jpg); height: 25px; font: 13px arial; color: #ffffff;}
+  .headlinks A{color: #ffffff; text-decoration: none; font: 13px arial}
+  .headlinks A:visited{color: #ffffff; text-decoration: none; font: 13px arial}
+  .headlinks A:hover{color: #ffffff; text-decoration: none; font: 13px arial}
+  .headlinks A:active{color: #ffffff; text-decoration: none; font: 13px arial}
+  .myplaceshead {background: #0D125C url(".$bconf[boardurl]."/images/acmlmboard/myplaces.jpg); height: 17px; width:100%; background-repeat: no-repeat;}
+  .myplaces	{background: #ffffff; width:100%; vertical-align: top; font:13px tahoma; color:#0D125C}
+  .myplaces A{color: #0D125C; text-decoration: none; font: 13px arial}
+  .myplaces A:visited{color: #0D125C; text-decoration: none; font: 13px arial}
+  .myplaces A:hover{color: #0D125C; text-decoration: none; font: 13px arial}
+  .myplaces A:active{color: #0D125C; text-decoration: none; font: 13px arial}
+  .boardinfo	{background: #ffffff; width:100%; vertical-align: bottom; font:10px tahoma; color:#0D125C}
+  .boardinfo A{color: #0D125C; text-decoration: none; font: 13px arial}
+  .boardinfo A:visited{color: #0D125C; text-decoration: none; font: 13px arial}
+  .boardinfo A:hover{color: #0D125C; text-decoration: none; font: 13px arial}
+  .boardinfo A:active{color: #0D125C; text-decoration: none; font: 13px arial}
+</STYLE>";
+
+  $css.=$basecode;
+  $header1="<html><head>$css<title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+  </head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+  <body>
+<table cellpadding=0 cellspacing=0 width=100% height=100%>
+	<td class=topstretch align=left>
+		<table cellpadding=0 cellspacing=0>
+			<td class=banner>
+				<form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+			</td>
+  		</table>
+  	</td>
+	<tr>	
+	<td class=headlinks>
+		<table cellpadding=0 cellspacing=0 width=100%>
+			<td align=left class=headlinks>
+				Views: $views
+			</td>
+			<td align=center class=headlinks>";
+	if($loguser[powerlevel]>=$bconf[searchfunction]){
+		$searchlink="<a href=".$bconf[boardurl]."/search.php>Search</a>";
+  	}
+  $header2=nav2mod("
+			</td>
+			<td align=right class=headlinks>
+				".date($dateformat,ctime()+$tzoff)."
+			</td>
+		</table>
+	</td>
+	<tr>
+	<td>
+	  	<table cellpadding=0 cellspacing=0 width=100% height=100%>
+	  		<td class=leftstretch>
+	  			<table cellpadding=0 cellspacing=0 width=100% height=100%>
+	  				<td class=myplaceshead valign=top>
+	  				</td>
+	  				<tr>
+	  				<td class=myplaces>","<br>","</td>
+				</table>
+	  		</td>
+	  		<td>
+	  			<table width=100% height=100%>
+					<td class=mainthing>");
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed>
+					</td>
+					<tr>
+					<td colspan=3 class='table tbl tdbg1 center fonts'>$race<br>
+					<center>
+					<a href=$siteurl>$sitename</a><br>
+					<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>
+					$copyright<br>
+					<img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+					</center>
+					</td>
+				</table>
+			</td>
+		</table>
+	</td>
+</table>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+
+?>
diff --git a/templates/aesucks.php b/templates/aesucks.php
new file mode 100644
index 0000000..7f290ab
--- /dev/null
+++ b/templates/aesucks.php
@@ -0,0 +1,38 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/alliance.php b/templates/alliance.php
new file mode 100644
index 0000000..a60bdec
--- /dev/null
+++ b/templates/alliance.php
@@ -0,0 +1,93 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  require_once $root."/lib/layout.php";
+  $css.="
+  .topstretch	{height: 257px; width: 100%; background: #ffffff url(".$bconf[boardurl]."/images/alliance/topstretch.jpg);}
+  .banner	{height: 257px; width: 800px; background: #ffffff url(".$bconf[boardurl]."/images/alliance/alliancetitlepic2.jpg)}
+  .leftstretch	{height: 100%; width: 110px; min-width:110px; background: #4B2742; vertical-align: top; border-right: thin dashed #E6299D}
+  .mainthing	{background: #4B2742; vertical-align: top; padding: 1px;}
+  .headlinks  {background: #ffffff url(".$bconf[boardurl]."/images/alliance/headlinksbg.jpg); height: 25px; font: 13px arial; color: #DAD218;}
+  .headlinks A{color: #DAD218; text-decoration: none; font: 13px arial}
+  .headlinks A:visited{color: #DAD218; text-decoration: none; font: 13px arial}
+  .headlinks A:hover{color: #DAD218; text-decoration: none; font: 13px arial}
+  .headlinks A:active{color: #DAD218; text-decoration: none; font: 13px arial}
+  .myplaceshead {background: #52814F url(".$bconf[boardurl]."/images/alliance/myplaces.jpg); height: 17px; width:100%; background-repeat: no-repeat;}
+  .myplaces	{background: #4B2742; width:100%; vertical-align: top; font:13px tahoma; color:#0B3708}
+  .myplaces A{color: #ffffff; text-decoration: none; font: 13px arial}
+  .myplaces A:visited{color: #ffffff; text-decoration: none; font: 13px arial}
+  .myplaces A:hover{color: #ffffff; text-decoration: none; font: 13px arial}
+  .myplaces A:active{color: #ffffff; text-decoration: none; font: 13px arial}
+  .boardinfo	{background: #4B2742; width:100%; vertical-align: bottom; font:10px tahoma; color:#ffffff}
+  .boardinfo A{color: #ffffff; text-decoration: none; font: 13px arial}
+  .boardinfo A:visited{color: #ffffff; text-decoration: none; font: 13px arial}
+  .boardinfo A:hover{color: #ffffff; text-decoration: none; font: 13px arial}
+  .boardinfo A:active{color: #ffffff; text-decoration: none; font: 13px arial}
+</STYLE>";
+
+  $css.=$basecode;
+  $header1="<html><head>$css<title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+  </head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+  <body>
+<table cellpadding=0 cellspacing=0 width=100% height=100%>
+	<td class=topstretch align=left>
+		<table cellpadding=0 cellspacing=0>
+			<td class=banner>
+				<form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+			</td>
+  		</table>
+  	</td>
+	<tr>	
+	<td class=headlinks>
+		<table cellpadding=0 cellspacing=0 width=100%>
+			<td align=left class=headlinks>
+				Views: $views
+			</td>
+			<td align=center class=headlinks>";
+	if($loguser[powerlevel]>=$bconf[searchfunction]){
+		$searchlink="<a href=".$bconf[boardurl]."/search.php>Search</a>";
+  	}
+  $header2=nav2mod("
+			</td>
+			<td align=right class=headlinks>
+				".date($dateformat,ctime()+$tzoff)."
+			</td>
+		</table>
+	</td>
+	<tr>
+	<td>
+	  	<table cellpadding=0 cellspacing=0 width=100% height=100%>
+	  		<td class=leftstretch>
+	  			<table cellpadding=0 cellspacing=0 width=100% height=100%>
+	  				<td class=myplaceshead valign=top>
+	  				</td>
+	  				<tr>
+	  				<td class=myplaces>","<br>","</td>
+				</table>
+	  		</td>
+	  		<td>
+	  			<table width=100% height=100%>
+					<td class=mainthing>");
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed>
+					</td>
+					<tr>
+					<td colspan=3 class='table tb2 tdbg1 center fonts'>$race<br><br>
+					<center>
+					<a href=$siteurl>$sitename</a><br>
+					<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>
+					$copyright<br>
+					<img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+					</center>
+					</td>
+				</table>
+			</td>
+		</table>
+	</td>
+</table>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+
+?>
diff --git a/templates/bloodlust.php b/templates/bloodlust.php
new file mode 100644
index 0000000..01855d5
--- /dev/null
+++ b/templates/bloodlust.php
@@ -0,0 +1,40 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+    if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/classic.php b/templates/classic.php
new file mode 100644
index 0000000..7f290ab
--- /dev/null
+++ b/templates/classic.php
@@ -0,0 +1,38 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/dailycycle.php b/templates/dailycycle.php
new file mode 100644
index 0000000..4e978db
--- /dev/null
+++ b/templates/dailycycle.php
@@ -0,0 +1,37 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/dani.php b/templates/dani.php
new file mode 100644
index 0000000..5a99f47
--- /dev/null
+++ b/templates/dani.php
@@ -0,0 +1,41 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_title=1;
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/dig.php b/templates/dig.php
new file mode 100644
index 0000000..55dede1
--- /dev/null
+++ b/templates/dig.php
@@ -0,0 +1,40 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/endofff.php b/templates/endofff.php
new file mode 100644
index 0000000..87ebe2c
--- /dev/null
+++ b/templates/endofff.php
@@ -0,0 +1,40 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+	$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/favorites.php b/templates/favorites.php
new file mode 100644
index 0000000..45481d9
--- /dev/null
+++ b/templates/favorites.php
@@ -0,0 +1,23 @@
+
+<?php
+	global $TEMPLATE_VARS;
+?>
+
+<table><tr><td>id</td><td>title</td></tr>
+<?php
+	while ($res = mysql_fetch_assoc($TEMPLATE_VARS["lastreplied"])) {
+		?>
+			<hr>
+			<tr><td><? print $res["id"] ?></td><td><? print $res["title"] ?></td></tr>
+		<?php
+			
+	} ?>
+	</table>
+	<br>
+		Favorited threads:
+	<br>
+	<?php
+	
+	while ($res = mysql_fetch_assoc($TEMPLATE_VARS["favorited"])) {
+		var_dump($res); ?> <br> <?php
+	} ?>
diff --git a/templates/ff9a.php b/templates/ff9a.php
new file mode 100644
index 0000000..55dede1
--- /dev/null
+++ b/templates/ff9a.php
@@ -0,0 +1,40 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/horde.php b/templates/horde.php
new file mode 100644
index 0000000..2654a41
--- /dev/null
+++ b/templates/horde.php
@@ -0,0 +1,93 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  require_once $root."/lib/layout.php";
+  $css.="
+  .topstretch	{height: 257px; width: 100%; background: #ffffff url(".$bconf[boardurl]."/images/horde/topstretch.jpg);}
+  .banner	{height: 257px; width: 800px; background: #ffffff url(".$bconf[boardurl]."/images/horde/hordetitlepic.jpg)}
+  .leftstretch	{height: 100%; width: 110px; background: #112E28; vertical-align: top; border-right: thin dashed #14C099}
+  .mainthing	{background: #112E28; vertical-align: top;}
+  .headlinks  {background: #ffffff url(".$bconf[boardurl]."/images/horde/headlinksbg.jpg); height: 25px; font: 13px arial; color: #14C099;}
+  .headlinks A{color: #14C099; text-decoration: none; font: 13px arial}
+  .headlinks A:visited{color: #14C099; text-decoration: none; font: 13px arial}
+  .headlinks A:hover{color: #14C099; text-decoration: none; font: 13px arial}
+  .headlinks A:active{color: #14C099; text-decoration: none; font: 13px arial}
+  .myplaceshead {background: #52814F url(".$bconf[boardurl]."/images/horde/myplaces.jpg); height: 17px; width:100%; background-repeat: no-repeat;}
+  .myplaces	{background: #112E28; width:100%; vertical-align: top; font:13px tahoma; color:#0B3708}
+  .myplaces A{color: #ffffff; text-decoration: none; font: 13px arial}
+  .myplaces A:visited{color: #ffffff; text-decoration: none; font: 13px arial}
+  .myplaces A:hover{color: #ffffff; text-decoration: none; font: 13px arial}
+  .myplaces A:active{color: #ffffff; text-decoration: none; font: 13px arial}
+  .boardinfo	{background: #112E28; width:100%; vertical-align: bottom; font:10px tahoma; color:#ffffff}
+  .boardinfo A{color: #ffffff; text-decoration: none; font: 13px arial}
+  .boardinfo A:visited{color: #ffffff; text-decoration: none; font: 13px arial}
+  .boardinfo A:hover{color: #ffffff; text-decoration: none; font: 13px arial}
+  .boardinfo A:active{color: #ffffff; text-decoration: none; font: 13px arial}
+</STYLE>";
+
+  $css.=$basecode;
+  $header1="<html><head>$css<title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+  </head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+  <body>
+<table cellpadding=0 cellspacing=0 width=100% height=100%>
+	<td class=topstretch align=left>
+		<table cellpadding=0 cellspacing=0>
+			<td class=banner>
+				<form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+			</td>
+  		</table>
+  	</td>
+	<tr>	
+	<td class=headlinks>
+		<table cellpadding=0 cellspacing=0 width=100%>
+			<td align=left class=headlinks>
+				Views: $views
+			</td>
+			<td align=center class=headlinks>";
+	if($loguser[powerlevel]>=$bconf[searchfunction]){
+		$searchlink="<a href=".$bconf[boardurl]."/search.php>Search</a>";
+  	}
+  $header2=nav2mod("
+			</td>
+			<td align=right class=headlinks>
+				".date($dateformat,ctime()+$tzoff)."
+			</td>
+		</table>
+	</td>
+	<tr>
+	<td>
+	  	<table cellpadding=0 cellspacing=0 width=100% height=100%>
+	  		<td class=leftstretch>
+	  			<table cellpadding=0 cellspacing=0 height=100% width=100%>
+	  				<td class=myplaceshead valign=top>
+	  				</td>
+	  				<tr>
+	  				<td class=myplaces>","<br>","</td>
+	  			</table>
+	  		</td>
+	  		<td>
+	  			<table width=100% height=100%>
+					<td class=mainthing>");
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed>
+					</td>
+					<tr>
+					<td colspan=3 class='table tbl tdbg1 center fonts'>$race<br>
+					<center>
+					<a href=$siteurl>$sitename</a><br>
+					<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>
+					$copyright<br>
+					<img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+					</center>					
+					</td>
+				</table>
+			</td>
+		</table>
+	</td>
+</table>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+
+?>
diff --git a/templates/kafuka.php b/templates/kafuka.php
new file mode 100644
index 0000000..d1eba75
--- /dev/null
+++ b/templates/kafuka.php
@@ -0,0 +1,41 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_title=1;
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+	$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/kirby.php b/templates/kirby.php
new file mode 100644
index 0000000..7f290ab
--- /dev/null
+++ b/templates/kirby.php
@@ -0,0 +1,38 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/mario.php b/templates/mario.php
new file mode 100644
index 0000000..55dede1
--- /dev/null
+++ b/templates/mario.php
@@ -0,0 +1,40 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/megaman.php b/templates/megaman.php
new file mode 100644
index 0000000..55dede1
--- /dev/null
+++ b/templates/megaman.php
@@ -0,0 +1,40 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/neon.php b/templates/neon.php
new file mode 100644
index 0000000..7f290ab
--- /dev/null
+++ b/templates/neon.php
@@ -0,0 +1,38 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/nes.php b/templates/nes.php
new file mode 100644
index 0000000..5a99f47
--- /dev/null
+++ b/templates/nes.php
@@ -0,0 +1,41 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_title=1;
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/night.php b/templates/night.php
new file mode 100644
index 0000000..7f290ab
--- /dev/null
+++ b/templates/night.php
@@ -0,0 +1,38 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/oldblue.php b/templates/oldblue.php
new file mode 100644
index 0000000..dc2d83f
--- /dev/null
+++ b/templates/oldblue.php
@@ -0,0 +1,38 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $css.=$basecode;
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/purple.php b/templates/purple.php
new file mode 100644
index 0000000..55dede1
--- /dev/null
+++ b/templates/purple.php
@@ -0,0 +1,40 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/romhackdomain.php b/templates/romhackdomain.php
new file mode 100644
index 0000000..7f290ab
--- /dev/null
+++ b/templates/romhackdomain.php
@@ -0,0 +1,38 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";  
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/tartan.php b/templates/tartan.php
new file mode 100644
index 0000000..b4fa4f0
--- /dev/null
+++ b/templates/tartan.php
@@ -0,0 +1,40 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/twilight.php b/templates/twilight.php
new file mode 100644
index 0000000..640e346
--- /dev/null
+++ b/templates/twilight.php
@@ -0,0 +1,100 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_nppic=1;
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root."/lib/layout.php";
+  $css.="
+  .topstretch	{height: 200px; width: 100%; background: #ffffff url(".$bconf[boardurl]."/images/twilight/princess.jpg);background-repeat: no-repeat; background-position: right}
+  .banner	{height: 200px; width: 500px; background: #ffffff url(".$bconf[boardurl]."/images/twilight/twilighttitlepic.jpg)}
+  .leftstretch	{height: 100%; width: 110px; background: #ffffff; vertical-align: top; border-right: thin dashed #A5D1A}
+  .mainthing	{background: #52814F; vertical-align: top;}
+  .headlinks  {background: #ffffff url(".$bconf[boardurl]."/images/twilight/headlinksbg.jpg); height: 25px; font: 13px arial; color: #0B3708;}
+  .headlinks A{color: #0B3708; text-decoration: none; font: 13px arial}
+  .headlinks A:visited{color: #0B3708; text-decoration: none; font: 13px arial}
+  .headlinks A:hover{color: #0B3708; text-decoration: none; font: 13px arial}
+  .headlinks A:active{color: #0B3708; text-decoration: none; font: 13px arial}
+  .myplaceshead {background: #52814F url(".$bconf[boardurl]."/images/twilight/myplaces.jpg); height: 17px; width:100%; background-repeat: no-repeat;}
+  .myplaces	{background: #ffffff; width:100%; vertical-align: top; font:13px tahoma; color:#0B3708}
+  .myplaces A{color: #0B3708; text-decoration: none; font: 13px arial}
+  .myplaces A:visited{color: #0B3708; text-decoration: none; font: 13px arial}
+  .myplaces A:hover{color: #0B3708; text-decoration: none; font: 13px arial}
+  .myplaces A:active{color: #0B3708; text-decoration: none; font: 13px arial}
+  .boardinfo	{background: #ffffff; width:100%; vertical-align: bottom; font:10px tahoma; color:#0B3708}
+  .boardinfo A{color: #0B3708; text-decoration: none; font: 13px arial}
+  .boardinfo A:visited{color: #0B3708; text-decoration: none; font: 13px arial}
+  .boardinfo A:hover{color: #0B3708; text-decoration: none; font: 13px arial}
+  .boardinfo A:active{color: #0B3708; text-decoration: none; font: 13px arial}
+</STYLE>";
+
+	$nmcol[0]=array('-1'=>'5B5B5B','3460E0','D8E8FE','AFFABE','FFEA95');
+	$nmcol[1]=array('-1'=>'5B5B5B','E936A6','FFB3F3','9912D3','C53A9E');
+	$nmcol[2]=array('-1'=>'5B5B5B','5F468C','D86366','2D7225','F0C40F');
+  
+  $css.=$basecode;
+  $header1="<html><head>$css<title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+  </head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+  <body>
+<table cellpadding=0 cellspacing=0 width=100% height=100%>
+	<td class=topstretch align=left>
+		<table cellpadding=0 cellspacing=0>
+			<td class=banner>
+				<form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+			</td>
+  		</table>
+  	</td>
+	<tr>	
+	<td class=headlinks>
+		<table cellpadding=0 cellspacing=0 width=100%>
+			<td align=left class=headlinks>
+				Views: $views
+			</td>
+			<td align=center class=headlinks>";
+	if($loguser[powerlevel]>=$bconf[searchfunction]){
+		$searchlink="<a href=".$bconf[boardurl]."/search.php>Search</a>";
+  	}
+  $header2=nav2mod("
+			</td>
+			<td align=right class=headlinks>
+				".date($dateformat,ctime()+$tzoff)."
+			</td>
+		</table>
+	</td>
+	<tr>
+	<td>
+	  	<table cellpadding=0 cellspacing=0 width=100% height=100%>
+	  		<td class=leftstretch>
+	  			<table cellpadding=0 cellspacing=0 height=100%>
+	  				<td class=myplaceshead valign=top>
+	  				</td>
+	  				<tr>
+	  				<td class=myplaces>","<br>","</td>
+				</table>
+	  		</td>
+	  		<td>
+	  			<table width=100% height=100%>
+					<td class=mainthing>");
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed>
+					</td>
+					<tr>
+					<td colspan=3 class='table tbl tdbg1 center fonts'>$race<br>
+					<center>
+					<a href=$siteurl>$sitename</a><br>
+					<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>
+					$copyright<br>
+					<img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+					</center>
+					</td>
+				</table>
+			</td>
+		</table>
+	</td>
+</table>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+
+?>
diff --git a/templates/xmas.php b/templates/xmas.php
new file mode 100644
index 0000000..03ad41b
--- /dev/null
+++ b/templates/xmas.php
@@ -0,0 +1,41 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  $layout_decl_title=1;
+  $layout_decl_nrpic=1;
+  $layout_decl_ntpic=1;
+  require_once $root.'/lib/layout.php';
+  $css.="</style>";
+  $css.=$basecode;
+  if(!$isindex) {$message_auto_notification=$privdisplay;}
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	 $tblstart
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>
+	  <td class='tbl tdbg1 center'>$boardtitle</td>
+	 $tblend$tblstart
+	  <td colspan=3 class='tbl tdbg1 center fonts'>";
+  $header2="
+	  <tr>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>Views: $views<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1></td>
+	  <td width=100% class='tbl tdbg2 center fonts'>$headlinks2</td>
+	  <td width=120 class='tbl tdbg2 center fonts'><nobr>".date($dateformat,ctime()+$tzoff)."<br><img src=".$bconf[boardurl]."/images/_.gif width=120 height=1><tr>
+	  <td colspan=3 class='tbl tdbg1 center fonts'>$race
+	 $tblend
+$message_auto_notification
+	</center>
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+$stamptime=1;
+?>
diff --git a/templates/yoshi.php b/templates/yoshi.php
new file mode 100644
index 0000000..a258635
--- /dev/null
+++ b/templates/yoshi.php
@@ -0,0 +1,50 @@
+<?php
+  if(!function_exists(libdec)){die('The required libraries have not been defined.');}
+  require_once $root.'/lib/layout.php';
+  $css.="
+	.headLinks A:link { color: #F3DE4F; text-decoration:none;font:11px arial;}
+	.headLinks A:visited { color: #F3DE4F; text-decoration:none;font:11px arial;}
+	.headLinks A:active { color: #F3DE4F; text-decoration:none;font:11px arial;}
+	.headLinks A:hover { color: #F3DE4F; text-decoration:none;font:11px arial;}
+	.tdbghead {color:#8D751D;
+		   font:13px arial;
+		   vertical-align:bottom
+		  }
+	.boardNavBg {background: #210207}
+	.pagecontainer {width:700px}
+	.leftmargin {background-image:url(".$bconf[boardurl]."/images/leftmargin.jpg); background-attachment:fixed;background-repeat:no-repeat; width:100}
+	.rightmargin {background-image:url(".$bconf[boardurl]."/images/rightmargin.jpg); background-attachment:fixed;background-repeat:no-repeat}; width:100}";
+
+  $css.="</style>";
+  
+  $css.=$basecode;
+  $header1="<html><head><title>$windowtitle</title><LINK REL=SHORTCUTICON HREF=".$bconf[boardurl]."/favicon.ico>
+	$css
+	</head><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">
+	$body
+	<center>
+	$tblstart
+	  <center>
+	  <table class='pageContainer'>
+	  <td>
+	<table cellspacing=0 width=100%>
+	  <td class='tdbghead center headLinks right'background=".$bconf[boardurl]."/images/yoshischeme/acebanner2.jpg width=100% height=200>
+	  <form action=$bconf[boardurl]/login.php method=post name=logout><input type=hidden name=action value=logout></form>";
+  $header2="
+	  <br>
+	$headlinks2
+	</td>
+	$tblend
+  ";
+  $footer="
+	</textarea></form></embed></noembed></noscript></noembed></embed></table></td></table></table>
+	<center>$smallfont<br><br><a href=$siteurl>$sitename</a><br>$affiliatelinks
+	<a href=\"".$bconf[boardurl]."/versions.php\">AcmlmBoard $version</a><br>$copyright<br><img src=".$bconf[boardurl]."/images/poweredbyacmlm.gif><br><img src=".$bconf[boardurl]."/images/newbadges-1b0.png>
+<br><a href=http://www.big-boards.com/highlight/99/><img src=http://www.big-boards.com/img/ltu/99a.png style=\"border:1px solid black\" alt=\"One of the largest message boards on the web!\"></a>
+</body></html>
+  ";
+  function makeheader($header1,$headlinks,$header2){return $header1.$headlinks.$header2;}
+  $header=makeheader($header1,$headlinks,$header2);
+if($ipbanned) die("$header<br>$tblstart$tccell1>Sorry, but your IP address is banned from this board.$tblend$footer");
+
+?>
diff --git a/thread.php b/thread.php
new file mode 100644
index 0000000..bad4d7a
--- /dev/null
+++ b/thread.php
@@ -0,0 +1,449 @@
+<?php
+	require_once 'lib/function.php';
+	$id = intval($_GET['id']);
+	$user = intval($_GET['user']);
+
+	// Skip to last post/end thread
+	if ($_GET['lpt'])
+		$gotopost = $sql->resultq("SELECT MIN(`id`) FROM `posts` WHERE `thread` = '{$id}' AND `date` > '".intval($_GET['lpt'])."'");
+	if ($_GET['end'] || ($_GET['lpt'] && !$gotopost))
+		$gotopost = $sql->resultq("SELECT MAX(`id`) FROM `posts` WHERE `thread` = '{$id}'");
+	if ($gotopost)
+		return header("Location: ?pid={$gotopost}#{$gotopost}");
+
+	// Poll votes
+	if ($id && ($_GET['addvote'] || $_GET['delvote'])) {
+		$option = (($_GET['addvote']) ? 'addvote' : 'delvote');
+		$choice = intval($_GET[$option]);
+
+		$pollid = $sql->resultq("SELECT poll FROM threads WHERE id='{$id}'");
+		if (!$pollid)
+			return header("Location: ?id={$id}#{$id}");
+
+		$poll = $sql->fetchq("SELECT * FROM poll WHERE id='$pollid'");
+		$confirm = md5($loguser['name'] . "sillysaltstring");
+
+		// no wrong poll bullshit
+		$valid = $sql->resultq("SELECT COUNT(*) FROM `poll_choices` WHERE `poll` = '$pollid' AND `id` = '$choice'");
+
+		if ($log && $poll && !$poll['closed'] && $_GET['dat'] == $confirm && $valid) {
+			if ($option == 'addvote') {
+				if (!$poll['doublevote'])
+					$sql->query("DELETE FROM `pollvotes` WHERE `user` = '$loguserid' AND `poll` = '$pollid'");
+				$sql->query("INSERT INTO pollvotes (poll,choice,user) VALUES ($pollid,$choice,$loguserid)");
+			}
+			else
+				$sql->query("DELETE FROM `pollvotes` WHERE `user` = '$loguserid' AND `poll` = '$pollid' AND `choice` = '$choice'");
+		}
+		return header("Location: ?id={$id}#{$id}");
+	}
+
+	$ppp = (($_GET['ppp']) ? intval($_GET['ppp']) : (($log) ? $loguser['postsperpage'] : 20));
+	$ppp = max(min($ppp, 500), 1);
+
+	if ($_GET['pid']) {
+		$pid = intval($_GET['pid']);
+		$id = $sql->resultq("SELECT `thread` FROM `posts` WHERE `id` = '{$pid}'");
+		if (!$id) {
+			$meta['noindex'] = true; // prevent search engines from indexing
+			require_once 'lib/layout.php';
+			errorpage("Couldn't find a post with ID #".intval($pid).".  Perhaps it's been deleted?",'the index page',"index.php");
+		}
+		$numposts = $sql->resultq("SELECT COUNT(*) FROM `posts` WHERE `thread` = '{$id}' AND `id` < '{$pid}'");
+		$page = floor($numposts / $ppp);
+	}
+
+	define('E_BADPOSTS', -1);
+	define('E_BADFORUM', -2);
+	$thread_error = 0;
+
+	$thread	= array();
+
+	// fuck brace overkill
+	if ($id) do {
+		$thread = $sql->fetchq("SELECT * FROM threads WHERE id=$id");
+		$tlinks = '';
+
+		if (!$thread) {
+			$meta['noindex'] = true; // prevent search engines from indexing
+			if (!$ismod) {
+				trigger_error("Accessed nonexistant thread number #$id", E_USER_NOTICE);
+				require_once 'lib/layout.php';
+				notAuthorizedError();
+			}
+
+			if ($sql->resultq("SELECT COUNT(*) FROM `posts` WHERE `thread` = '{$id}'") <= 0) {
+				require_once 'lib/layout.php';
+				errorpage("Thread ID #{$id} doesn't exist, and no posts are associated with the invalid thread ID.",'the index page',"index.php");
+			}
+
+			// Mod+ can see and possibly remove bad posts
+			$thread_error = E_BADPOSTS;
+			$thread['closed'] = true;
+			$thread['title'] = "Bad posts with ID #$id";
+			break;
+		}
+
+		$thread['title'] = str_replace("<", "&lt;", $thread['title']);
+		
+		$forumid = intval($thread['forum']);
+		$forum = $sql->fetchq("SELECT * FROM forums WHERE id=$forumid");
+
+		if (!$forum) {
+			$meta['noindex'] = true; // prevent search engines from indexing
+			if (!$ismod) {
+				trigger_error("Accessed thread number #$id with bad forum ID $forumid", E_USER_WARNING);
+				require_once 'lib/layout.php';
+				notAuthorizedError();
+			}
+			$thread_error = E_BADFORUM;
+			$forum['title'] = " --- BAD FORUM ID --- ";
+			break;
+		}
+
+		if ($forum['minpower'] > max(0, $power)) {
+			if ($log)
+				trigger_error("Attempted to access thread $id in level-$forum[minpower] restricted forum $forumid (user's powerlevel: ".intval($loguser['powerlevel']).")", E_USER_NOTICE);
+			$meta['noindex'] = true; // prevent search engines from indexing what they can't access
+			require_once 'lib/layout.php';
+			notAuthorizedError();
+		}
+
+		$specialscheme = $forum['specialscheme'];
+
+		if ($log) {
+			$readdate = $sql->resultq("SELECT `readdate` FROM `forumread` WHERE `user` = '$loguserid' AND `forum` = '$forumid'");
+
+			if ($thread['lastpostdate'] > $readdate)
+				$sql->query("REPLACE INTO threadsread SET `uid` = '$loguserid', `tid` = '$thread[id]', `time` = '".ctime()."', `read` = '1'");
+
+			$unreadcount = $sql->resultq(
+				"SELECT COUNT(*) FROM `threads` ".
+				"WHERE `id` NOT IN (SELECT `tid` FROM `threadsread` WHERE `uid` = '$loguserid' AND `read` = '1') ".
+				"AND `lastpostdate` > '$readdate' AND `forum` = '$forumid'");
+			if ($unreadcount == 0)
+				$sql->query("REPLACE INTO forumread VALUES ('$loguserid', '$forumid', '".ctime().'\')');
+		}
+
+		$tlinks = array();
+
+		// Favorites
+		if ($log) {
+			if ($sql->fetchq("SELECT * FROM favorites WHERE user={$loguserid} AND thread={$id}"))
+				$tlinks[] = "<a href='forum.php?act=rem&thread={$id}' style='white-space:nowrap;'>Remove from favorites</a>";
+			else
+				$tlinks[] = "<a href='forum.php?act=add&thread={$id}' style='white-space:nowrap;'>Add to favorites</a>";
+		}
+
+		$tnext = $sql->resultq("SELECT id FROM threads WHERE forum=$forumid AND lastpostdate>$thread[lastpostdate] ORDER BY lastpostdate ASC LIMIT 1");
+		if ($tnext) $tlinks[] = "<a href='?id={$tnext}' style='white-space:nowrap;'>Next newer thread</a>";
+		$tprev = $sql->resultq("SELECT id FROM threads WHERE forum=$forumid AND lastpostdate<$thread[lastpostdate] ORDER BY lastpostdate DESC LIMIT 1");
+		if ($tprev) $tlinks[] = "<a href='?id={$tprev}' style='white-space:nowrap;'>Next older thread</a>";
+
+		$tlinks = implode(' | ', $tlinks);
+
+		// Description for bots
+		$text = $sql->resultq("SELECT text FROM posts_text pt LEFT JOIN posts p ON (pt.pid = p.id) WHERE p.thread=$id ORDER BY pt.pid ASC LIMIT 1");
+		$text = strip_tags(str_replace(array("[", "]", "\r\n"), array("<", ">", " "), $text));
+		$text = ((strlen($text) > 160) ? substr($text, 0, 157) . "..." : $text);
+		$text = str_replace("\"", "&quot;", $text);
+		$meta['description'] = $text;
+
+		$sql->query("UPDATE threads SET views=views+1 WHERE id=$id");
+
+		$windowtitle = "{$forum['title']}: {$thread['title']}";
+	} while (false);
+	elseif($user) {
+		$uname = $sql->resultq("SELECT name FROM users WHERE id={$user}");
+		if (!$uname) {
+			$meta['noindex'] = true; // prevent search engines from indexing what they can't access
+			require_once 'lib/layout.php';
+			errorpage("User ID #{$user} doesn't exist.",'the index page',"index.php");
+		}
+
+		$thread['replies'] = $sql->resultq("SELECT count(*) FROM posts WHERE user={$user}") - 1;
+		$thread['title'] = "Posts by {$uname}";
+		$windowtitle = "Posts by {$uname}";
+		$tlinks = '';
+	}
+	else {
+		$meta['noindex'] = true; // prevent search engines from indexing what they can't access
+		require_once 'lib/layout.php';
+		errorpage("No thread specified.",'the index page',"index.php");
+	}	
+
+	//temporary
+	if ($windowtitle) $windowtitle = "$boardname -- $windowtitle";
+	require_once 'lib/layout.php';
+
+	$fonline = "";
+	if ($id && !$thread_error) {
+		$fonline = fonlineusers($forumid);
+		if (@mysql_num_rows($sql->query("SELECT user FROM forummods WHERE forum=$forumid and user=$loguserid")))
+			$ismod = true;
+	}	
+
+	$modfeats = '';
+	if ($id && $ismod) {
+		$trashid = 27;
+
+		$fulledit = "<a href='editthread.php?id={$id}'>Edit thread<a>";
+		$linklist = array();
+		$link = "<a href='editthread.php?id={$id}&action";
+
+		if (!$thread['sticky'])
+			$linklist[] = "$link=qstick'>Stick</a>";
+		else
+			$linklist[] = "$link=qunstick'>Unstick</a>";
+
+		if (!$thread['closed'])
+			$linklist[] = "$link=qclose'>Close</a>";
+		else
+			$linklist[] = "$link=qunclose'>Open</a>";
+
+		if ($thread['forum'] != $trashid)
+			$linklist[] = "$link=trashthread'>Trash</a>";
+
+		//$linklist[] = "$link=delete'>Delete</a>";
+		$linklist = implode(' | ', $linklist);
+		$modfeats = "<tr>$tccellcls colspan=2>Moderating options: $linklist -- $fulledit</td></tr>";
+	}
+
+	$errormsgs = '';
+	if ($thread_error) {
+		switch($thread_error) {
+        	case E_BADPOSTS: $errortext='This thread does not exist, but posts exist that are associated with this invalid thread ID.'; break;
+        	case E_BADFORUM: $errortext='This thread has an invalid forum ID; it is located in a forum that does not exist.'; break;
+		}
+		$errormsgs = "<tr><td style='background:#cc0000;color:#eeeeee;text-align:center;font-weight:bold;'>$errortext</td></tr>";
+	}
+
+	if ($forum['pollstyle'] != -2 && $thread['poll']) {
+		$poll = $sql->fetchq("SELECT * FROM poll WHERE id='$thread[poll]'");
+
+		$uservote = array();
+		if ($log) {
+			$lsql = $sql->query("SELECT `choice` FROM `pollvotes` WHERE `poll` = '$poll[id]' AND `user` = '$loguserid'");
+			while ($userchoice = $sql->fetch($lsql, MYSQL_ASSOC))
+				$uservote[$userchoice['choice']] = true;
+		}
+
+		if ($forum['pollstyle'] >= 0)
+			$pollstyle = $forum['pollstyle'];
+		else
+			$pollstyle = $loguser['pollstyle'];
+
+		$tvotes2 = $sql->resultq("SELECT count(*) FROM pollvotes WHERE poll=$poll[id]");
+		$tvotesi = $sql->resultq("SELECT sum(u.`influence`) as influence FROM pollvotes p LEFT JOIN users u ON p.user = u.id WHERE poll=$poll[id]");
+
+		$pollvotes = $sql->getresultsbykey("SELECT choice, count(*) cnt FROM pollvotes WHERE poll=$poll[id] GROUP BY choice WITH ROLLUP",'choice','cnt');
+		$pollinflu = $sql->getresultsbykey("SELECT choice, sum(u.influence) as inf FROM pollvotes p LEFT JOIN users u ON p.user = u.id WHERE poll=$poll[id] GROUP BY choice WITH ROLLUP",'choice','inf');
+
+		$tvotes_u = $sql->resultq("SELECT count(distinct `user`) FROM pollvotes WHERE poll=$poll[id]");
+		$tvotes_c = $pollvotes[""];
+		$tvotes_i = $pollinflu[""];
+
+		$confirm = md5($loguser['name'] . "sillysaltstring");
+
+		$pollcs = $sql->query("SELECT * FROM poll_choices WHERE poll=$poll[id]");
+		while ($pollc = $sql->fetch($pollcs)) {
+			$votes = intval($pollvotes[$pollc['id']]);
+			$influ = intval($pollinflu[$pollc['id']]);
+
+			if ($pollstyle) {
+				if ($tvotes_i != 0)
+					$pct = $pct2 = sprintf('%02.1f', $influ / $tvotes_i * 100);
+				else
+					$pct = $pct2 = "0.0";
+				$votes = intval($influ)." point".($influ == 1 ? '' : 's')." ($votes)";
+			}
+			else {
+				if ($tvotes_c != 0) {
+					$pct = sprintf('%02.1f', $votes / $tvotes_c * 100);
+					$pct2 = sprintf('%02.1f', $votes / $tvotes_u * 100);
+				} else
+					$pct = $pct2 = "0.0";
+				$votes = "$votes vote".($votes == 1 ? '' : 's');
+			}
+
+			$barpart = "<table cellpadding=0 cellspacing=0 width=$pct% bgcolor='".($pollc['color'] ? $pollc['color'] : "cccccc")."'><td>&nbsp;</table>";
+			if ($pct == "0.0")
+				$barpart = '&nbsp;';
+
+			if ($uservote[$pollc['id']]) {
+				$linkact = 'del';
+				$dot = "<img src=\"images/dot4.gif\" align=\"absmiddle\"> ";
+			}
+			else {
+				$linkact = 'add';
+				$dot = "<img src=\"images/_.gif\" width=8 height=8 align=\"absmiddle\"> ";
+			}
+
+			$link = '';
+			if ($log && !$poll['closed'])
+				$link = "<a href='?id={$id}&dat={$confirm}&{$linkact}vote=$pollc[id]'>";
+
+			$choices	.= "<tr>
+				$tccell1l width=20%>$dot$link".($pollc['choice'])."</a></td>
+				$tccell2l width=60%>$barpart</td>
+				$tccell1 width=20%>".($poll['doublevote'] ? "$pct% of users, $votes ($pct2%)" : "$pct%, $votes")."</td>
+				</tr>";
+		}
+
+		if ($poll['closed']) $polltext = 'This poll is closed.';
+		else                 $polltext = 'Multi-voting is '.(($poll['doublevote']) ? 'enabled.' : 'disabled.');
+		if ($tvotes_u != 1) $s_have = 's have';
+		else                $s_have = ' has';
+
+		if ($ismod)
+			$polledit = "<!-- edit would go here -->";
+
+		$polltbl = "$tblstart
+			<tr>$tccellc colspan=3><b>".htmlspecialchars($poll['question'])."</td></tr>
+			<tr>$tccell2ls colspan=3>".nl2br(dofilters($poll['briefing']))."</td></tr>
+			$choices
+			<tr>$tccell2l colspan=3>$smallfont $polltext $tvotes_u user$s_have voted. $polledit</td></tr>
+			$tblend<br>
+			";
+	}
+
+	loadtlayout();
+	switch($loguser['viewsig']) {
+		case 1:  $sfields = ',headtext,signtext'; break;
+		case 2:  $sfields = ',u.postheader headtext,u.signature signtext'; break;
+		default: $sfields = ''; break;
+	}
+	$ufields = userfields();
+
+	$activity = $sql->query("SELECT user, count(*) num FROM posts WHERE date>".(ctime() - 86400)." GROUP BY user");
+	while ($n = $sql->fetch($activity))
+		$act[$n['user']] = $n['num'];
+
+	$postlist = "
+		$polltbl
+		$tblstart
+		$modfeats
+		$errormsgs
+	";
+
+	if ($log && $id && $forum['id']) {
+		$headlinks	.= " - <a href=index.php?action=markforumread&forumid=$forum[id]>Mark forum read</a>";
+		$header = makeheader($header1, $headlinks, $header2 . (($fonline) ? "$tblstart$tccell1s>$fonline$tblend" : ""));
+	}
+
+	$threadforumlinks = "
+		<table width=100%><td align=left>$fonttag<a href=index.php>".$boardname."</a>"
+		.
+		(($forum['title']) ? " - <a href=forum.php?id=$forumid>$forum[title]</a>" : "")
+		.
+		" - $thread[title]</td><td align=right>$smallfont
+	";
+	if ($forumid) {
+		if ($forum['pollstyle'] != -2) $threadforumlinks .= "<a href=newthread.php?poll=1&id=$forumid>$newpollpic</a> - ";
+		else                           $threadforumlinks .= "<img src=\"images/nopolls.png\" align=\"absmiddle\"> - ";
+		$threadforumlinks .= "<a href=newthread.php?id=$forumid>$newthreadpic</a>";
+		if (!$thread['closed']) $threadforumlinks .= " - <a href=newreply.php?id=$id>$newreplypic</a>";
+		else                    $threadforumlinks .= " - $closedpic";
+	}
+	$threadforumlinks .= '</table>';
+
+	$page	= max(0, $page);
+	$min	= $ppp * $page;
+	
+	if ($user) $searchon = "user={$user}";
+	else       $searchon = "thread={$id}";
+
+	$posts = $sql->query(
+		"SELECT p.*,text$sfields,edited,editdate,options,tagval,u.id uid,name,$ufields,regdate ".
+		"FROM posts_text, posts p LEFT JOIN users u ON p.user=u.id ".
+		"WHERE {$searchon} AND p.id=pid ORDER BY p.id LIMIT $min,$ppp");
+
+	preplayouts($posts);
+
+	for ($i = 0; $post = $sql->fetch($posts); $i++) {
+		$postlist	.= '<tr>';
+
+		$bg = $i % 2 + 1;
+
+		$quote = "<a href=\"?pid=$post[id]#$post[id]\">Link</a>";
+		if ($id and ! $thread['closed'])
+			$quote	.= " | <a href=newreply.php?id=$id&postid=$post[id]>Quote</a>";
+
+		$edit = '';
+		if ($ismod || (!$banned && $post['user'] == $loguserid)) {
+        	if (!$thread['closed'])
+				$edit = ($quote ? ' | ' : '')        . "<a href=editpost.php?id=$post[id]>Edit</a>";
+			$edit .= ($quote || $edit ? ' | ' : ''). "<a href=editpost.php?id=$post[id]&action=delete>Delete</a>";
+		}
+
+		if ($isadmin)
+			$ip = " | IP: <a href=ipsearch.php?ip=$post[ip]>$post[ip]</a>";
+
+		if (!$id) {
+			// Enable caching for these
+			$pthread = $sql->fetchq("SELECT id,title,forum FROM threads WHERE id=$post[thread]", MYSQL_BOTH, true);
+			$pforum  = $sql->fetchq("SELECT minpower FROM forums WHERE id=".intval($pthread[forum]), MYSQL_BOTH, true);
+		}
+		$post['act'] = $act[$post['user']];
+
+		if ($pforum['minpower'] <= $power or ! $pforum['minpower'])
+			$postlist .= threadpost($post, $bg, $pthread);
+		else
+			$postlist .=
+				"<table class=\"table\" cellspacing=0>
+					<tr><td class='tbl font tdbg$bg' align=center><small><i>
+					(post in restricted forum)
+					</i></small></td></tr>
+				</table>";
+	}
+
+	$query = preg_replace("'page=(\d*)'si", '', '?'.getenv("QUERY_STRING"));
+	$query = preg_replace("'pid=(\d*)'si", "id={$id}", $query);
+	$query = preg_replace("'&{2,}'si", "&", $query);
+	if ($query && substr($query, -1) != "&")
+		$query	.= "&";
+	if (!$page)
+		$page = 0;
+
+	$pageend = (int)($thread['replies'] / $ppp);
+	$pagelinks = "Pages:";
+	if ($thread['replies'] < $ppp)
+		$pagelinks = '';
+	else for ($i = 0; $i <= $pageend; $i++) {
+		// restrict page range to sane values
+		if ($i > 9 && $i < $pageend-9) {
+			if ($i < $page-4) {
+				$i = min($page-4, $pageend-9);
+				$pagelinks .= " ...";
+			}
+			if ($i > $page+4) {
+				$i = $pageend-9;
+				$pagelinks .= " ...";
+			}
+		}
+		
+		if ($i == $page)
+			$pagelinks	.= " ".($i + 1);
+		else
+			$pagelinks	.= " <a href='$query"."page=$i'>".($i + 1)."</a>";
+	}
+
+	print $header.sizelimitjs()."
+		$threadforumlinks
+		<table width=100%><td align=left>$smallfont$pagelinks</td><td align=right>$smallfont$tlinks</table>
+		$postlist
+		$tblstart
+		$modfeats
+		$tblend
+		<table width=100%><td align=left>$smallfont$pagelinks</td><td align=right>$smallfont$tlinks</table>
+		$threadforumlinks
+	$footer";
+	printtimedif($startingtime);
+
+
+function notAuthorizedError() {
+	global $log;
+	$redir = (($log) ? 'index.php' : 'login.php');
+	$rtext = (($log) ? 'the index page' : 'log in (then try again)');
+	errorpage("Couldn't enter the forum. You don't have access to this restricted forum.", $rtext, $redir);
+}
\ No newline at end of file
diff --git a/tlayouts/compact.php b/tlayouts/compact.php
new file mode 100644
index 0000000..0822b42
--- /dev/null
+++ b/tlayouts/compact.php
@@ -0,0 +1,20 @@
+<?php
+  function userfields(){return 'posts,sex,powerlevel,birthday,aka';}
+
+  function postcode($post,$set){
+    global $smallfont,$ip,$quote,$edit, $tblstart;
+
+    $postnum=($post[num]?"$post[num]/":'').$post[posts];
+    if($set[threadlink]) $threadlink=", in $set[threadlink]";
+    return "$tblstart
+	$set[tdbg]>
+	  $set[userlink]<br>
+	  $smallfont Posts: $postnum</td>
+	$set[tdbg] width=50% align=right>
+	    $smallfont Posted on $set[date]$threadlink
+	   <br>$quote$edit$ip
+	  <tr>
+	$set[tdbg] height=60 colspan=2 id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td></table>
+    ";
+  }
+?>
\ No newline at end of file
diff --git a/tlayouts/hydra.php b/tlayouts/hydra.php
new file mode 100644
index 0000000..dfe9fd3
--- /dev/null
+++ b/tlayouts/hydra.php
@@ -0,0 +1,53 @@
+<?php
+	function userfields(){return 'posts,sex,powerlevel,birthday,aka,picture,title,useranks,location,lastposttime,lastactivity';}
+
+	function postcode($post,$set){
+		global $tzoff, $smallfont, $ip, $quote, $edit, $dateshort, $dateformat, $tlayout, $textcolor, $numdir, $numfil, $tblstart, $hacks, $x_hacks, $loguser;
+
+		$tblend  = "</table>";
+		$exp     = calcexp($post[posts],(ctime()-$post[regdate])/86400);
+		$lvl     = calclvl($exp);
+		$expleft = calcexpleft($exp);
+
+		$reinf=syndrome($post[act]);
+
+		$sincelastpost = "";
+		$lastactivity = "";
+		$since='Since: '.@date($dateshort,$post[regdate]+$tzoff);
+
+		$postdate  =  date($dateformat,$post[date]+$tzoff);
+
+		if($set[threadlink]) { $threadlink=", in $set[threadlink]"; }
+
+		/* if($post[edited]){
+			$set[edited].="<hr>$smallfont$post[edited]";
+		}*/
+
+		$sidebars	= array(1, 16, 18, 19, 387);
+
+		return "
+		$tblstart
+		$set[tdbg] style='width: 20% !important;' rowspan='2'>
+			$set[userlink]$smallfont<br>
+			<center>$set[userpic]</center><br>
+			$post[title]<br><br>
+		</td>
+
+		$set[tdbg] height=1>
+		<table class='fonts' style='clear: both; width: 100%;'>
+			<tr>
+				<td>Posted on $postdate$threadline$post[edited]</td>
+				<td style='float: right;'>$quote$edit$ip</td>
+			</tr>
+		</table><tr>
+		$set[tdbg] style='overflow: visible; width: 70%;' height=220 id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]</td></tr>
+		$tblend
+		<br>";
+
+		if (!$set['picture']) $set['picture']	= "images/_.gif";
+
+		if ($_GET['z']) {
+			print_r($st['eq']);
+		}
+	}
+?>
diff --git a/tlayouts/regular.php b/tlayouts/regular.php
new file mode 100644
index 0000000..e618113
--- /dev/null
+++ b/tlayouts/regular.php
@@ -0,0 +1,831 @@
+<?php
+  function userfields(){return 'posts,sex,powerlevel,birthday,aka,picture,moodurl,title,useranks,location,lastposttime,lastactivity,imood';}
+
+  function postcode($post,$set){
+	if ($_GET['uhoh']) die($post['id']);
+    global $tzoff, $smallfont, $ip, $quote, $edit, $dateshort, $dateformat, $tlayout, $textcolor, $numdir, $numfil, $tblstart, $hacks, $x_hacks, $loguser;
+	$tblend	= "</table>";
+	$exp=calcexp($post[posts],(ctime()-$post[regdate])/86400);
+    $lvl=calclvl($exp);
+    $expleft=calcexpleft($exp);
+    if($tlayout==1){
+	$level="Level: $lvl";
+	$poststext="Posts: ";
+	$postnum="$post[num]/";
+	$posttotal=$post[posts];
+	$experience="EXP: $exp<br>For next: $expleft";
+	$totalwidth=96;
+	$barwidth=$totalwidth-round(@($expleft/totallvlexp($lvl))*$totalwidth);
+	if($barwidth<1) $barwidth=0;
+	if($barwidth>0) $baron="<img src=images/$numdir"."bar-on.gif width=$barwidth height=8>";
+	if($barwidth<$totalwidth) $baroff="<img src=images/$numdir".'bar-off.gif width='.($totalwidth-$barwidth).' height=8>';
+	$bar="<br><img src=images/$numdir"."barleft.gif height=8>$baron$baroff<img src=images/$numdir".'barright.gif height=8>';
+    }else{
+	$level="<img src=images/$numdir"."level.gif width=36 height=8><img src=numgfx.php?n=$lvl&l=3&f=$numfil height=8>";
+	$experience="<img src=images/$numdir"."exp.gif width=20 height=8><img src=numgfx.php?n=$exp&l=5&f=$numfil height=8><br><img src=images/$numdir"."fornext.gif width=44 height=8><img src=numgfx.php?n=$expleft&l=2&f=$numfil height=8>";
+	$poststext="<img src=images/_.gif height=2><br><img src=images/$numdir"."posts.gif width=28 height=8>";
+	$postnum="<img src=numgfx.php?n=$post[num]/&l=5&f=$numfil height=8>";
+	$posttotal="<img src=numgfx.php?n=$post[posts]&f=$numfil".($post[num]?'':'&l=4')." height=8>";
+	$totalwidth=56;
+	$barwidth=$totalwidth-round(@($expleft/totallvlexp($lvl))*$totalwidth);
+	if($barwidth<1) $barwidth=0;
+	if($barwidth>0) $baron="<img src=images/$numdir"."bar-on.gif width=$barwidth height=8>";
+	if($barwidth<$totalwidth) $baroff="<img src=images/$numdir".'bar-off.gif width='.($totalwidth-$barwidth).' height=8>';
+		$bar="<br><img src=images/$numdir"."barleft.gif width=2 height=8>$baron$baroff<img src=images/$numdir".'barright.gif width=2 height=8>';
+	}
+	if(!$post[num]){
+		$postnum='';
+		if($postlayout==1) $posttotal="<img src=numgfx.php?n=$post[posts]&f=$numfil&l=4 height=8>";
+	}
+    if($post[icq]) $icqicon="<a href=http://wwp.icq.com/$post[icq]#pager><img src=http://wwp.icq.com/scripts/online.dll?icq=$post[icq]&img=5 border=0 width=13 height=13 align=absbottom></a>";
+    if($post[imood]) $imood="<img src=http://www.imood.com/query.cgi?email=$post[imood]&type=1&fg=$textcolor&trans=1 height=15 align=absbottom>";
+    $reinf=syndrome($post[act]);
+    if ($post[lastposttime]) $sincelastpost='Since last post: '.timeunits(ctime()-$post[lastposttime]);
+    $lastactivity='Last activity: '.timeunits(ctime()-$post[lastactivity]);
+    $since='Since: '.@date($dateshort,$post[regdate]+$tzoff);
+    $postdate=date($dateformat,$post[date]+$tzoff);
+    if($set[threadlink]) $threadlink=", in $set[threadlink]";
+
+	if($post[edited]){
+//		$set[edited].="<hr>$smallfont$post[edited]";
+	}
+	
+	$sidebars	= array(1, 3, 19, 89, 387, 45, 92, 47);
+
+	$sidebars	= array(1, 19, 89, 387, 45, 92, 47, 1420, 1090, 2100, 2069);
+
+#	$edit		.= " | <a href=\"#". $post['id'] ."\" %BZZZ%". $post['id'] .")\"><img src='http://xkeeper.net/img/soccerball.png' align='absmiddle' title='guess what this does'></a>";
+
+//	global $loguser;
+//	if ($loguser['id'] == 1 || $_GET['stupid']) {
+//		$sidebars[]	= 16;
+//	}
+
+/*
+	if ($post['noob']) {
+		$noobpos				= floor(strlen($post['name']) * 2.5);
+//		$set['userlink']	= "<div style=\"display: inline; position: relative; top: 0; left: 0;\"><img src=\"xkeeper/img/noobsticker2-". mt_rand(1,6) .".png\" style=\"position: absolute; top: -3px; left: ". $noobpos ."px;\" title=\"n00b\">". $set['userlink'] ."</div>";
+
+		$set['userlink']	= $set['userlink'] ."<br><img src=\"xkeeper/img/noobsticker2-". mt_rand(1,6) .".png\" style=\"position: relative; left: ". mt_rand(4, 23) ."px; bottom: ". mt_rand(14, 22) ."px;\" title=\"n00b\">";
+	}
+
+	if ($loguser['powerlevel'] >= 1 && $post['date'] && $post['num']) {
+		$edit		.= " | <a href=\"editpost.php?id=". $post['id'] ."&action=noob\">". ($post['noob'] ? "de-" : "") ."n00b</a>";
+	}
+
+	if ($post[uid] == 902 && !$x_hacks['host']) {
+		$post[signtext]	.= "<div style='width: 100%; text-align: right;'><a href='sendprivate.php?userid=902&subject=Wow, you are as dumb as a brick.'><img src='http://xkeeper.net/img/sendpm.png' style='margin-bottom: -193px; position: relative; top: -100px; right: -10px;'></a></div>";
+	}
+*/
+
+	if ($post[uid] == 1 && !$x_hacks['host'] && true) {
+
+		global $numdir;
+		$numdir_	= $numdir;
+		$numdir		= "num3/";
+		
+		if ($post['num']) {
+			$numtext	= generatenumbergfx($post['num'], 1, true) ."<br>". generatenumbergfx($post['posts']);
+		} else {
+			$numtext	= generatenumbergfx($post['posts'], 1, true);
+		}
+		$numdir		= $numdir_;
+
+	return "
+	$tblstart
+	$set[tdbg] rowspan=2 style='padding: 5px 1px 5px 1px;'>
+	  <center>$set[userlink]$smallfont<br>
+	  $set[userrank]
+		$reinf
+		<br>
+		<br>$set[userpic]
+		<br><br>$numtext</center>
+	  <br><img src=images/_.gif width=200 height=1>
+	</td>
+	$set[tdbg] height=1 width=100%>
+	  <table cellspacing=0 cellpadding=2 width=100% class=fonts>
+	    <td>Posted on $postdate$threadlink$post[edited]</td>
+	    <td width=255><nobr>$quote$edit$ip
+	  </table><tr>
+	$set[tdbg] height=220 id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>
+	$tblend";
+	}
+
+	// Inu's sidebar
+	// (moved up here for to display for everyone during doomclock mode!)
+	if ($post['uid'] == "2100" && !$x_hacks['host']) {
+		$posttable = "<table style=\"border:none;border-spacing:0px;\">";
+		// doomclock
+		if (($doomclock_time = mktime(12,20,0,4,20,2014) - cmicrotime()) >= 0) {
+			$doomclock_secs = (int)($doomclock_time % 60);
+			$doomclock_mins = (int)(($doomclock_time % 3600) / 60);
+			$doomclock_hrs  = (int)($doomclock_time / 3600);
+			$doomclock_str  = sprintf(" %d=%02d=%02d", $doomclock_hrs, $doomclock_mins, $doomclock_secs);
+			$doomclock_desc = "{$doomclock_hrs} hours, {$doomclock_mins} minutes, {$doomclock_secs} seconds";
+			$posttable .= "<tr><td><img src=\"images/inu/cifont/d.gif\" title=\"Doomsday\"></td><td align='right'>";
+			$posttable .= inu_hexclock($doomclock_desc, $doomclock_time);
+			$posttable .= "</td><td align='right'><img src=\"/images/inu/7sd.php?s=>FFF{$doomclock_str}\"></td></tr>";
+		}
+		if ($post['num']) {
+			$posttable .= "<tr><td><img src=\"images/inu/cifont/p.gif\" title=\"Post Number\"></td><td>";
+			$posttable .= inu_binaryposts($post['num'], "images/dot3.gif", "images/dot1.gif", $post['posts']);
+			$posttable .= "</td><td align='right'><img src=\"/images/inu/7sd.php?s=".sprintf("%4d",$post['num'])."\"></td></tr>";
+		}
+		$posttable .= "<tr><td><img src=\"images/inu/cifont/t.gif\" title=\"Total Posts\"></td><td>";
+		$posttable .= inu_binaryposts($post['posts'], "images/dot5.gif", "images/dot1.gif");
+		$posttable .= "</td><td align='right'><img src=\"/images/inu/7sd.php?s=>F90".sprintf("%4d",$post['posts'])."\"></td></tr></table>";
+
+    /*
+		$lp = ((!$post['lastposttime']) ? "" : 'Last posted >fff'.timeunits(ctime()-$post['lastposttime']).' >0f0ago');
+		$la ='Last active >fff'.timeunits(ctime()-$post['lastactivity']).' >0f0ago';
+		$jd ='Joined >f11'.@date("m.d.Y",$post['regdate']+$tzoff);
+
+		return "$tblstart
+			". str_replace('valign=top', 'valign=top', $set['tdbg']) ." rowspan=2 align=center style=\"font-size: 12px;\">
+				".inu_hexclock()."
+				 <a name=$post[id]></a><a href=\"profile.php?id=2100\"><img src=\"/images/inu/7sd.php?s=- >EC1Inuyasha>0f0 -\"></a>
+				$smallfont
+				<br><marquee scrolldelay=250 scrollamount=30 width=30 height=8 behavior=alternate><img src=\"/images/inu/7sd.php?s=>f0012=00\"><img src=\"/images/inu/7sd.php?s=>f00  =%20%20\"></marquee>
+				<br>$reinf
+				$set[userpic]
+				<br>
+				<br>". ($hacks['noposts'] ? "" : "$posttable") ."
+				<br>
+				<br><img src=\"/images/inu/7sd.php?s=$jd\">
+				<br>
+				<br><img src=\"/images/inu/7sd.php?s=$lp\">
+				<br><img src=\"/images/inu/7sd.php?s=$la\"></font>
+				<br><img src=images/_.gif width=200 height=1>
+			</td>
+		$set[tdbg] height=1 width=100%>
+			<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+				<td>Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+		$set[tdbg] height=220 id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>
+		$tblend"; */
+
+		// non-image old version
+		$lp = ((!$post['lastposttime']) ? "" : 'Last posted '.timeunits(ctime()-$post['lastposttime']).' ago');
+		$la ='Last active '.timeunits(ctime()-$post['lastactivity']).' ago';
+		$jd ='Joined '.@date("m.d.Y",$post['regdate']+$tzoff);
+
+		$dstyle = '';
+
+		// [D]Inuyasha
+		if ($post['moodid'] == 5) {
+			$post['headtext'] = str_replace(
+				array('class="inu-bg"','class="inu-tx"'),
+				array('class="inu-dbg"','class="inu-dtx"'), $post['headtext']);
+			$set['userlink'] =' <a name='.$post['id'].'></a><a class="url2100" href="profile.php?id=2100"><font color="FF0202">[D]Inuyasha</font></a>';
+			$set['userrank'] = 'Now you\'ve done it...!';
+			$set['userpic'] = '<img src="http://inuyasha.rustedlogic.net/personal/moodav/5.png">';
+			$dstyle = ' style="color:#b671e8;background:black;"';
+		}
+
+		return "$tblstart
+			". str_replace('valign=top', 'valign=top', $set['tdbg']) ."{$dstyle} rowspan=2 align=center style=\"font-size: 12px;\">
+				 &mdash; $set[userlink] &mdash;
+				$smallfont
+				". ($set['userrank'] ? "<br>". $set['userrank'] ."<br>" : "") ."
+				$reinf
+				<br>
+				$set[userpic]
+				<br>
+				<br>". ($hacks['noposts'] ? "" : "$posttable") ."
+				<br>
+				<br>$jd
+				<br>
+				<br>$lp
+				<br>$la</font>
+				<br><img src=images/_.gif width=200 height=1>
+			</td>
+		$set[tdbg]{$dstyle} height=1 width=100%>
+			<table cellspacing=0 cellpadding=2 width=100% class=fonts{$dstyle}>
+				<td>Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+		$set[tdbg]{$dstyle} height=220 id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>
+		$tblend";
+	}
+	// End Inu's sidebar
+
+	if (($post[uid] == 18) && !$x_hacks['host'] && $x_hacks['mmdeath'] >= 0 && !$_GET['test2']) {
+	return "
+	<table style=\"background: #f00 url('numgfx/red.gif');\" cellpadding=3 cellspacing=1>
+	$set[tdbg] style='background: #000;' rowspan=2>
+		<br><center class='stupiddoomtimerhack'><img src='numgfx.php?f=numdeath&n=". $x_hacks['mmdeath'] ."' height=32 style=\"background: #f00 url('numgfx/red.gif');\" title=\"Doom.\"></center>
+		<br>
+	  <center>$set[userlink]$smallfont<br>
+		<br>
+		<br>$set[userpic]
+		</center>
+
+		<br><img src=images/_.gif width=194 height=1>
+	</td>
+	$set[tdbg] style='background: #000;'height=1 width=100%>
+	  <table cellspacing=0 cellpadding=2 width=100% class=fonts>
+	    <td>Posted on $postdate$threadlink$post[edited]</td>
+	    <td width=255><nobr>$quote$edit$ip
+	  </table><tr>
+	$set[tdbg] style='background: #000;' height=220 id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>
+	$tblend";
+	}
+
+  // Default layout
+	if (!(in_array($post[uid], $sidebars) && !$x_hacks['host']) || $loguser['viewsig'] == 0) {
+	return "
+	<div style='position:relative'>
+	$tblstart
+	$set[tdbg] rowspan=2>
+	  $set[userlink]$smallfont<br>
+	  $set[userrank]$reinf<br>
+        $level$bar<br>
+	  $set[userpic]<br>
+	  ". ($hacks['noposts'] ? "" : "$poststext$postnum$posttotal<br>") ."
+	  $experience<br><br>
+	  $since<br>".str_ireplace("&lt;br&gt;", "<br>", substr(htmlspecialchars($set[location]),10))."<br><br>
+	  $sincelastpost<br>$lastactivity<br>
+	  $icqicon$imood</font>
+	  <br><img src=images/_.gif width=200 height=1>
+	</td>
+	$set[tdbg] height=1 width=100%>
+	  <table cellspacing=0 cellpadding=2 width=100% class=fonts>
+	    <td>Posted on $postdate$threadlink$post[edited]</td>
+	    <td width=255><nobr>$quote$edit$ip
+	  </table><tr>
+	$set[tdbg] height=220 id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>
+	$tblend
+	</div>";
+	}
+
+  elseif ($post[uid] == "1" && !$x_hacks['host']) {
+		$lastactivity	= 'Active </font>' .timeunits(ctime()-$post[lastactivity]) ."<font color=#bbbbbb> ago";
+		$postnum		= ($post['num']) ."/";
+		$posttotal		= $post['posts'];
+		if(!$post['num']) {
+			$postnum	= '';
+			$postss		= "s:";
+		}
+
+		//". str_replace('valign=top', 'valign=top', $set[tdbg]) ."
+		return "<table width=100% cellpadding=0 cellspacing=0 style=\"background: #004c5a; background-position: top right; background-repeat: repeat-x; border: 1px solid #000;\">
+			<tr>
+			<td rowspan=2 valign=top align=center style=\"font-size: 12px; color: #fff; font-family: Verdana, sans-serif; border-right: 3px double #000; background: #004c5a;\">
+				&mdash; $set[userlink] &mdash;
+				$smallfont
+				". ($set['userrank'] ? "<br>". $set['userrank'] ."<br>" : "") ."
+				<br>$set[userpic]
+				<br>". ($hacks['noposts'] ? "<font color=#cccccc>" : "<br>Post$postss $postnum<font color=#cccccc>$posttotal") ."
+				<br>$lastactivity</font>
+				". (false ? "<br><a href=sendprivate.php?uid=1>PM</a> - <a href=rateuser.php?id=1>Rate</a>" : "") ."
+				<br><img src=images/_.gif width=200 height=1>
+			</td>
+			<td height=1 width=100% style=\"font-size: 12px; color: #ddd; font-family: Verdana, sans-serif; background: #004c5a; border-bottom: 1px solid #000;\">
+				<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+				<td>Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+			<td valign='top' id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>$tblend
+		";
+	} elseif ($post[uid] == "3" && !$x_hacks['host']) {
+		$lastactivity	= 'Active </font>' .timeunits(ctime()-$post[lastactivity]) .'<font color=#bb0000> ago';
+		$postnum		= ($post['num']) ."/";
+		$posttotal		= $post['posts'];
+		if(!$post['num']) {
+			$postnum	= '';
+			$postss		= "s:";
+		}
+		return "$tblstart
+			". str_replace('valign=top', 'valign=top', $set[tdbg]) ." rowspan=2 align=center style=\"background: #000; font-size: 12px; color: #f00; font-family: Verdana, sans-serif;\">
+				 &mdash; $set[userlink] &mdash;
+				$smallfont
+				". ($set['userrank'] ? "<br>". $set['userrank'] : "") ."
+				$set[userpic]
+				<br>". ($hacks['noposts'] ? "<font color=#bb0000>" : "<br>Post$postss $postnum<font color=#bb0000>$posttotal") ."
+				<br>$lastactivity</font>
+				<br><img src=images/_.gif width=200 height=1>
+			</td>
+			$set[tdbg] height=1 width=100% style=\"background: #000000; font-size: 12px; color: #ff0000; font-family: Verdana, sans-serif;\">
+				<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+				<td>Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+			$set[tdbg] style=\"padding: 0;\" id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>$tblend
+		";
+
+// ************************************************************
+// SYAORAN COLIN
+// ************************************************************
+	} elseif ($post[uid] == "45" && !$x_hacks['host']) {
+
+		$fcol1			= "#204080";
+		$fcol2			= "#3070a0";
+		$fcol3			= "#f0f8ff";
+
+		
+		$lastactivity	= 'Active </font>' .timeunits(ctime()-$post[lastactivity]) ."<font color=$fcol2> ago";
+		$postnum		= ($post['num']) ."/";
+		$posttotal		= $post['posts'];
+		if(!$post['num']) {
+			$postnum	= '';
+			$postss		= "s:";
+		}
+		return "$tblstart
+			". str_replace('valign=top', 'valign=top', $set[tdbg]) ." rowspan=2 align=center style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				 &mdash; $set[userlink] &mdash;
+				$smallfont
+				". ($set['userrank'] ? "<br>". $set['userrank'] : "") ."
+				$reinf
+				$set[userpic]
+				<br>". ($hacks['noposts'] ? "<font color=$fcol2>" : "<br>Post$postss $postnum<font color=$fcol2>$posttotal") ."
+				<br>$lastactivity</font>
+				<br><img src=images/_.gif width=200 height=1>
+			</td>
+			$set[tdbg] height=1 width=100% style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+				<td style='color: $fcol1;'>Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+			$set[tdbg] style=\"padding: 0;\" id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>$tblend
+		";
+
+
+	} elseif ($post[uid] == "47" && !$x_hacks['host']) {
+		$fcol1			= "#204080";
+		$fcol2			= "#3070a0";
+		$fcol3			= "#ffffff";
+		$fcol1			= "#9966bb";
+		$fcol2			= "#ccaadd";
+		$fcol3			= "#000000";
+
+		if ($post['posts'] >= 20000) {
+			$fcol1			= "#bbaadd";
+			$fcol2			= "#eebbff";
+			$fcol3			= "#000000";
+		}
+		
+		$lastactivity	= 'Active </font>' .timeunits(ctime()-$post[lastactivity]) ."<font color=$fcol2> ago";
+		$postnum		= ($post['num']) ."/";
+		$posttotal		= $post['posts'];
+		if(!$post['num']) {
+			$postnum	= '';
+			$postss		= "s:";
+		}
+		return "$tblstart
+			". str_replace('valign=top', 'valign=top', $set[tdbg]) ." rowspan=2 align=center style=\"background: $fcol3". ($post['posts'] >= 20000 ? " url('http://www.ffalexandria.com/orlandu/anya/side_bg.jpg'); background-position:bottom left" : "") ."; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				 &mdash; $set[userlink] &mdash;
+				<br>$smallfont
+				". ($set['userrank'] ? "<br>". $set['userrank'] : "") ."
+				$reinf
+				<br><br>$set[userpic]
+				<br><br>Post$postss $postnum$posttotal
+				<br><img src=images/_.gif width=200 height=1>
+			</td>
+			$set[tdbg] height=1 width=100% style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+				<td style='color: $fcol1;'>Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+			$set[tdbg] style=\"padding: 0;\" id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>$tblend
+		";
+
+		return "
+		$tblstart
+		$set[tdbg] rowspan=2 style='padding: 5px;'>
+		  <img src='images/smilies/bigeyes.gif' title='o_O' align='absmiddle'> $set[userlink]$smallfont<br>
+		  ". ($set['userrank'] ? "<br>". $set['userrank'] : "") ."
+				$reinf
+				<br>
+				$set[userpic]
+				<br>
+				<br>Post$postss $postnum$posttotal
+		  </center><br><img src=images/_.gif width=190 height=1>
+		</td>
+		$set[tdbg] height=1 width=100%>
+		  <table cellspacing=0 cellpadding=2 width=100% class=fonts>
+			<td>Posted on $postdate$threadlink$post[edited]</td>
+			<td width=255><nobr>$quote$edit$ip
+		  </table><tr>
+		$set[tdbg] height=220 id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>
+		$tblend";
+
+// ************************************************************
+// SAKURA HIRYUU
+// ************************************************************
+	} elseif ($post[uid] == "4xxxxxxxxxxx7" && !$x_hacks['host']) {
+
+		$fcol1			= "#802040";
+		$fcol2			= "#a07030";
+		$fcol3			= "#fff0f8";
+
+		
+		$lastactivity	= 'Active </font>' .timeunits(ctime()-$post[lastactivity]) ."<font color=$fcol2> ago";
+		$postnum		= ($post['num']) ."/";
+		$posttotal		= $post['posts'];
+		if(!$post['num']) {
+			$postnum	= '';
+			$postss		= "s:";
+		}
+		return "$tblstart
+			". str_replace('valign=top', 'valign=top', $set[tdbg]) ." rowspan=2 align=center style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				 &mdash; $set[userlink] &mdash;
+				$smallfont
+				". ($set['userrank'] ? "<br>". $set['userrank'] : "") ."
+				$reinf
+				$set[userpic]
+				<br>". ($hacks['noposts'] ? "<font color=$fcol2>" : "<br>Post$postss $postnum<font color=$fcol2>$posttotal") ."
+				<br>$lastactivity</font>
+				<br><img src=images/_.gif width=200 height=1>
+			</td>
+			$set[tdbg] height=1 width=100% style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+				<td style=\"color: $fcol1;\">Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+			$set[tdbg] style=\"padding: 0;\" id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>$tblend
+		";
+
+
+// ************************************************************
+// REAL HIRYUU
+// ************************************************************
+	} elseif ($post[uid] == "92" && !$x_hacks['host']) {
+		$fcol1			= "#e2bbff";
+		$fcol2			= "#bb70dd";
+		$fcol3			= "#220033";
+
+		$fcol1			= "#ffeeaa";
+		$fcol2			= "#998844";
+		$fcol3			= "#221100";
+
+		$fcol1			= "#ffaaaa";
+		$fcol2			= "#ff7777";
+		$fcol3			= "#661111";
+
+		$fcol1			= "#ffffff";
+		$fcol2			= "#eeeeee";
+		$fcol3			= "#000000";
+
+		
+		$lastactivity	= 'Active </font>' .timeunits(ctime()-$post[lastactivity]) ."<font color=$fcol2> ago";
+		$postnum		= ($post['num']) ."/";
+		$posttotal		= $post['posts'];
+		if(!$post['num']) {
+			$postnum	= '';
+			$postss		= "s:";
+		}
+		return "$tblstart
+			". str_replace('valign=top', 'valign=top', $set[tdbg]) ." rowspan=2 align=center style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				 &mdash; $set[userlink] &mdash;
+				$smallfont
+				". ($set['userrank'] ? "<br>". $set['userrank'] : "") ."
+				$reinf
+				$set[userpic]
+				<br>". ($hacks['noposts'] ? "<font color=$fcol2>" : "<br>Post$postss $postnum<font color=$fcol2>$posttotal") ."
+				<br>$lastactivity</font>
+				<br><img src=images/_.gif width=200 height=1>
+			</td>
+			$set[tdbg] height=1 width=100% style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+				<td>Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+			$set[tdbg] style=\"padding: 0;\" id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>$tblend
+		";
+
+	} elseif ($post[uid] == "19" && !$x_hacks['host']) {
+		$fcol1			= "#bbbbeb";
+		$fcol2			= "#8888a8";
+		$fcol3			= "#080818 url('http://bloodstar.rustedlogic.net/layout/background.png')";
+		$lastactivity	= 'Active </font>'. timeunits(ctime()-$post[lastactivity]) ."<font color=$fcol2> ago";
+		$joindate		= 'Joined </font>'. date($dateshort,$post[regdate]+$tzoff) ."<font color=$fcol2>";
+		$postnum		= ($post['num']) ."/";
+		$posttotal		= $post['posts'];
+		if(!$post['num']) {
+			$postnum	= '';
+			$postss		= "s:";
+		}
+		return "$tblstart
+			". str_replace('valign=top', 'valign=top', $set[tdbg]) ." rowspan=2 align=center style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				 &mdash; $set[userlink] &mdash;
+				$smallfont
+				". ($set['userrank'] ? "<br>". $set['userrank'] ."<br>" : "") ."
+				$reinf
+				$set[userpic]
+				<br>". ($hacks['noposts'] ? "<font color=$fcol2>" : "<br>Post$postss $postnum<font color=$fcol2>$posttotal") ."
+				<br>
+				<br>$joindate
+				<br>$lastactivity</font>
+				<br><img src=images/_.gif width=200 height=1>
+			</td>
+			$set[tdbg] height=1 width=100% style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+				<td>Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+			$set[tdbg] style=\"padding: 0;\" id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>$tblend
+		";
+
+	} elseif ($post[uid] == "4" && !$x_hacks['host']) {
+		$fcol1			= "#9999cc";
+		$fcol2			= "#7777aa";
+		$fcol3			= "#000011";
+		$lastactivity	= 'Active </font>'. timeunits(ctime()-$post[lastactivity]) ."<font color=$fcol2> ago";
+		$joindate		= 'Joined </font>'. date($dateshort,$post[regdate]+$tzoff) ."<font color=$fcol2>";
+		$postnum		= ($post['num']) ."/";
+		$posttotal		= $post['posts'];
+		if(!$post['num']) {
+			$postnum	= '';
+			$postss		= "s:";
+		}
+		return "$tblstart
+			". str_replace('valign=top', 'valign=top', $set[tdbg]) ." rowspan=2 align=center style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				 &mdash; $set[userlink] &mdash;
+				$smallfont
+				". ($set['userrank'] ? "<br>". $set['userrank'] ."<br>" : "") ."
+				$set[userpic]
+				<br>". ($hacks['noposts'] ? "<font color=$fcol2>" : "<br>Post$postss $postnum<font color=$fcol2>$posttotal") ."
+				<br>
+				<br>$joindate
+				<br>$lastactivity</font>
+				<br><img src=images/_.gif width=200 height=1>
+			</td>
+			$set[tdbg] height=1 width=100% style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+				<td>Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+			$set[tdbg] style=\"padding: 0;\" id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>$tblend
+		";
+
+	} elseif ($post[uid] == "387" && !$x_hacks['host']) {
+		if (!$x_hacks['rpgstats'][$post['uid']]) {
+			$css	= "<style> .a1{ height:100%; min-height: 286px; background:#000 url(http://acmlm.rustedlogic.net/etc/nismilly/bg.jpg) 50% 0% no-repeat; } div.a2{ height:100%; min-height: 286px; background:url(http://acmlm.rustedlogic.net/etc/nismilly/map.png) 50% 226px no-repeat; font:9px tahoma; color:#FD4; text-align:center; line-height:19px; } div.a2 img{ margin-top:-5px; border:0px; } div.a2 span{ color:#DEF; } </style>";
+			$x_hacks['rpgstats'][$post['uid']] == "lol";
+		}
+		$postnum		= ($post['num']) ."/";
+		$posttotal		= $post['posts'];
+		if(!$post['num']) {
+			$postnum	= '';
+			$postss		= "s:";
+		}
+		return "$tblstart
+			". str_replace('\' valign=top', ' a1\' valign=top', $set[tdbg]) ." rowspan=2 align=center style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				$css
+				<div class=a2>
+					Post$postss <span><b>$postnum</b></span><span><b>$posttotal</b></span> (<span>". timeunits(ctime()-$post[lastposttime]) ."</span>),
+					online <span>". timeunits(ctime()-$post[lastactivity]) ."</span> ago
+					<a href=//jul.rustedlogic.net/profile.php?id=387>
+			". (strpos($_SERVER['USER_AGENT'], "MSIE 6.0") ? "<img src=_.png style=filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=http://acmlm.rustedlogic.net/etc/nismilly/stat.php)>" : "<img src=http://acmlm.rustedlogic.net/etc/nismilly/stat.php>") ."
+					</a>
+					<br><img src=images/_.gif width=200 height=1>
+				</div>
+			</td>
+			$set[tdbg] height=1 width=100% style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+				<td>Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+			$set[tdbg] style=\"padding: 0;\" id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>$tblend
+		";
+
+
+	} elseif ($post[uid] == "89" && !$x_hacks['host']) {
+		$fcol1			= "#bbbbbb";
+		$fcol2			= "#555555";
+		$fcol3			= "#181818";
+
+		return "$tblstart
+			". str_replace('valign=top', 'valign=top', $set[tdbg]) ." rowspan=2 align=center style=\"background: $fcol3; font-size: 14px; color: $fcol1; font-family: Verdana, sans-serif; padding-top: .5em;\">
+				$set[userlink]
+				<br><span style=\"letter-spacing: 0px; color: $fcol2; font-size: 10px;\">Collection of nobodies</span>
+				<br><img src=images/_.gif width=200 height=200>
+			</td>
+			$set[tdbg] height=1 width=100% style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+				<td>Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+			$set[tdbg] style=\"background: $fcol3; padding: 0;\" id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>$tblend
+		";
+
+	
+	} elseif (($post[uid] == "16" || $post[uid] == "5") && !$x_hacks['host']) {
+
+		// top bg #614735
+		// mid-bg #e1cfb6
+		// darker #d0bca4
+
+		if (!function_exists("basestat")) {
+			 require 'lib/rpg.php';
+		}
+		
+		if (!$x_hacks['rpgstats'][$post['uid']]) {
+			
+			$eq	= array(
+				'1' => "<center style=\"text-align: center; color: #b09080;\">(Weapon)</center>",
+				'2' => "<center style=\"text-align: center; color: #b09080;\">(Armor)</center>",
+				'3' => "<center style=\"text-align: center; color: #b09080;\">(Shield)</center>",
+				'4' => "<center style=\"text-align: center; color: #b09080;\">(Helm)</center>",
+				'5' => "<center style=\"text-align: center; color: #b09080;\">(Shoes)</center>",
+				'6' => "<center style=\"text-align: center; color: #b09080;\">(Acc.)</center>",
+			);
+			$user=mysql_fetch_array(mysql_query("SELECT name,posts,regdate,users_rpg.* FROM users,users_rpg WHERE id='". $post['uid'] ."' AND uid=id"));
+			$d=(ctime()-$user[regdate])/86400;
+			$eqitems=mysql_query("SELECT * FROM items WHERE id=$user[eq1] OR id=$user[eq2] OR id=$user[eq3] OR id=$user[eq4] OR id=$user[eq5] OR id=$user[eq6]") or print mysql_error();
+			while($item=mysql_fetch_array($eqitems)) {
+				$items[$item[id]]=$item;
+				$eq[$item['cat']] = $item['name'];
+			}
+			if($ct){
+			$GPdif=floor($items[$user['eq'.$ct]][coins]*0.6)-$items[$it][coins];
+			$user['eq'.$ct]=$it;
+			}
+			$st=getstats($user,$items);
+			$st[GP]+=$GPdif;
+			if($st[lvl]>0) $pct=1-calcexpleft($st[exp])/totallvlexp($st[lvl]);
+			$st['expn']	= calcexpleft($st[exp]);
+			$st['eq']	= $eq;
+
+			$x_hacks['rpgstats'][$post['uid']]	= $st;
+		} else {
+			$st	= $x_hacks['rpgstats'][$post['uid']];
+		}
+
+		$lastactivity	= 'Active '. timeunits(ctime()-$post[lastactivity]) ." ago";
+		$joindate		= 'Joined '. date($dateshort,$post[regdate]+$tzoff);
+		$postnum		= ($post['num']) ."/";
+		$posttotal		= $post['posts'];
+		if(!$post['num']) {
+			$postnum	= '';
+			$postss		= "s";
+		}
+
+		if (!$set['picture']) $set['picture']	= "images/_.gif";
+
+		if ($_GET['z']) {
+			print_r($st['eq']);
+		}
+
+
+		return "$tblstart
+			". str_replace('valign=top', 'valign=top', $set[tdbg]) ." rowspan=2 width=200>
+				 <table style=\"font-family: Tahoma; font-size: 12px; color: #000; background: #e1cfb6;\" width=100% cellspacing=0>
+					<tr>
+						<td style=\"background: #614735; text-align: left; padding: 2px 0px 2px 15px; font-size: 14px; letter-spacing: 1px; border: 2px outset #614735;\" colspan=4>$set[userlink]</td>
+					</tr>
+					<tr>
+						<td style=\"border: 2px outset #614735;\" colspan=4>
+							 <table width=100% cellspacing=0 cellpadding=0 style=\"color: #000; font-size: 12px;\">
+								<tr><td rowspan=5 width=0 style=\"padding: 0 3px 0 0;\"><img src=\"". $set['picture'] ."\" width=80 height=80></td>
+									<td width=100% colspan=4 style=\"font-size: 14px; letter-spacing: 1px; padding: 0 0 7px 0;\">". $set['userrank'] ."</td></tr>
+								<tr style=\"font-weight: bold;\"><td colspan=2 width=50%>Lv</td><td style=\"text-align: right;\" colspan=2 width=50%>". $st['lvl'] ."</td></tr>
+								<tr style=\"font-weight: bold;\"><td colspan=2 width=50% style=\"font-variant: small-caps;\">Post$postss</td><td style=\"text-align: right;\" colspan=2 width=50%>$postnum$posttotal</tr>
+								<tr style=\"font-weight: bold;\"><td colspan=2 width=50% style=\"font-variant: small-caps;\">Counter</td><td style=\"text-align: right;\" colspan=2 width=50%>2</td></tr>
+								<tr style=\"font-weight: bold;\"><td>Mv</td><td style=\"text-align: right;\">7</td><td style=\"padding: 0 0 0 5px;\">Jm</td><td style=\"text-align: right;\">26</td></tr>
+							</table>				
+
+							<table width=100% cellspacing=0 cellpadding=0 style=\"color: #000; font-size: 12px; font-weight: bold;\">
+								<tr style=\"background: #d0bca4;\"><td style=\"font-variant: small-caps;\">Hp</td><td style=\"text-align: right;\" colspan=3>". $st['HP'] ."/". $st['HP'] ."</td></tr>
+								<tr                               ><td style=\"font-variant: small-caps;\">Sp</td><td style=\"text-align: right;\" colspan=3>". $st['MP'] ."/". $st['MP'] ."</td></tr>
+								<tr style=\"background: #d0bca4;\">
+									<td style=\"font-variant: small-caps;\">Atk</td><td style=\"text-align: right; padding: 0 4px 0 0;\">". $st['Atk'] ."</td>
+									<td style=\"font-variant: small-caps; padding: 0 0 0 4px;\">Int</td><td style=\"text-align: right;\">". $st['Int'] ."</td></tr>
+								<tr                               >
+									<td style=\"font-variant: small-caps;\">Def</td><td style=\"text-align: right; padding: 0 4px 0 0;\">". $st['Def'] ."</td>
+									<td style=\"font-variant: small-caps; padding: 0 0 0 4px;\">Spd</td><td style=\"text-align: right;\">". $st['Spd'] ."</td></tr>
+								<tr style=\"background: #d0bca4;\">
+									<td style=\"font-variant: small-caps;\">Hit</td><td style=\"text-align: right; padding: 0 4px 0 0;\">". $st['Dex'] ."</td>
+									<td style=\"font-variant: small-caps; padding: 0 0 0 4px;\">Res</td><td style=\"text-align: right;\">". $st['MDf'] ."</td></tr>
+								<tr                               ><td style=\"font-variant: small-caps;\">Exp</td><td style=\"text-align: right;\" colspan=3>". $st['exp'] ."</td></tr>
+								<tr style=\"background: #d0bca4;\"><td style=\"font-variant: small-caps;\">Next</td><td style=\"text-align: right;\" colspan=3>". $st['expn'] ."</td></tr>
+								<tr                               ><td colspan=4><img src=\"images/_.gif\" height=4 width=1></td></tr>
+								<tr                               ><td colspan=4>". $st['eq'][1] ."</td></tr>
+								<tr                               ><td colspan=4>". $st['eq'][2] ."</td></tr>
+								<tr                               ><td colspan=4>". $st['eq'][3] ."</td></tr>
+								<tr                               ><td colspan=4>". $st['eq'][4] ."</td></tr>
+								<tr                               ><td colspan=4>". $st['eq'][5] ."</td></tr>
+								<tr                               ><td colspan=4>". $st['eq'][6] ."</td></tr>
+							</table>				
+						</td>
+					</tr>
+				</table>
+
+				<br><img src=images/_.gif width=200 height=1>
+			</td>
+			$set[tdbg] height=1 width=100% style=\"background: $fcol3; font-size: 12px; color: $fcol1; font-family: Verdana, sans-serif;\">
+				<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+				<td>Posted on $postdate$threadlink$post[edited]</td>
+				<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+			$set[tdbg] style=\"padding: 0;\" id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>$tblend
+		";
+/*
+<!--
+				$smallfont
+				<br>$joindate
+				<br>$lastactivity</font>
+*/
+	
+	}
+
+	// BlackRose/Lain's sidebar
+	elseif ($post['uid'] == 1090 && !$x_hacks['host']) {
+		$brltype = "catgirlredux2011";
+
+		$brsidebar = "
+			<link rel=\"stylesheet\" type=\"text/css\" href=\"http://lain.rustedlogic.net/layouts/css/_br_sidebar.css\" />
+			$tblstart
+			$set[tdbg] rowspan=2>
+				<div class=\"brsidebar lain-sidebar-$brltype\">
+				<div class=\"bruserlink\">&mdash; $set[userlink] &mdash;</div>
+				<div class=\"bruserrank\">$set[userrank]</div>" .
+				(!empty($reinf) ? "<div class=\"brsyndrome\">$reinf</div>" : "") . "
+				<div class=\"bruserpic\">$set[userpic]</div>
+				</div>
+			</td>
+			$set[tdbg] height=1 width=100%>
+			<table cellspacing=0 cellpadding=2 width=100% class=fonts>
+			<td>Posted on $postdate$threadlink$post[edited]</td>
+			<td width=255><nobr>$quote$edit$ip
+			</table><tr>
+			$set[tdbg] height=220 id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>
+			$tblend";
+ 
+		return $brsidebar;
+	}
+
+  // Non-defined / Blank
+  // (Adelheid uses this)
+	else {
+	return "
+	$tblstart
+	$set[tdbg] rowspan=2>
+	  $set[userlink]$smallfont<br>
+	  $set[userrank]$reinf<br>
+	  <br><img src=images/_.gif width=200 height=1>
+	</td>
+	$set[tdbg] height=1 width=100%>
+	  <table cellspacing=0 cellpadding=2 width=100% class=fonts>
+	    <td>Posted on $postdate$threadlink$post[edited]</td>
+	    <td width=255><nobr>$quote$edit$ip
+	  </table><tr>
+	$set[tdbg] height=220 id=\"post". $post['id'] ."\">$post[headtext]$post[text]$post[signtext]$set[edited]</td>
+	$tblend";
+	}
+
+  }
+
+
+  function kittynekomeowmeow($p) {
+		global $loguser;
+		$kitty	= array("meow", "mrew", "mew", "mrow", "mrrrr", "mrowl", "rrrr", "mrrrrow", "mreeeew",);
+		$punc	= array(",", ".", "!", "?");
+		$p		= preg_replace('/\s\s+/', ' ', $p);
+
+		$c		= substr_count($p, " ");
+		for ($i = 0; $i < $c; $i++) {
+			$mi	= array_rand($kitty);
+			$m	.= ($m ? " " : "") . $kitty[$mi];
+			$l	= false;
+			if (mt_rand(0,7) == 7) {
+				$pi	= array_rand($punc);
+				$m	.= $punc[$pi];
+				$l	= true;
+			}
+		}
+
+		if ($l != true) {
+			$pi	= array_rand($punc);
+			$m	.= $punc[$pi];
+		}
+
+		// if ($loguser['id'] == 1)
+		return $m ." :3";
+  }
+
+
+	//For Inu's layout
+	function inu_binaryposts($n, $timg, $fimg, $min = 0) {
+		$tx = "<span title=\"$n\">";
+		if ($n > $min) $min = $n;
+		for ($i = 1; $i <= $min; $i<<=1)
+			$bits[] = "<img src=\"" . (($n & $i) ? $timg : $fimg) . "\">";
+		$tx .= implode("", array_reverse($bits));
+		$tx .= "</span>";
+		return $tx;
+	}
+
+	function inu_hexclock($n, $time) {
+		$tx = "<span title=\"$n\">";
+		$time = (($time*65536) / 86400);
+		$hex = str_split(dechex($time));
+		foreach ($hex as $letter)
+			$tx .= "<img src=\"images/inu/cifont/{$letter}.gif\">";
+		$tx .= "</span>";
+		return $tx;
+	}
+	//End random shit for Inu's layout
+
+?>