OSDN Git Service

Another small update.
[idb/iDB.git.git] / inc / members.php
index e17307c..2caa7a7 100644 (file)
@@ -8,15 +8,17 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     Revised BSD License for more details.
 
-    Copyright 2004-2007 Cool Dude 2k - http://intdb.sourceforge.net/
-    Copyright 2004-2007 Game Maker 2k - http://upload.idb.s1.jcink.com/
+    Copyright 2004-2008 Cool Dude 2k - http://idb.berlios.de/
+    Copyright 2004-2008 Game Maker 2k - http://intdb.sourceforge.net/
 
-    $FileInfo: members.php - Last Update: 09/06/2007 SVN 99 - Author: cooldude2k $
+    $FileInfo: members.php - Last Update: 12/12/2008 SVN 215 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="members.php"||$File3Name=="/members.php") {
        require('index.php');
        exit(); }
+if(!is_numeric($_GET['id'])) { $_GET['id'] = null; }
+if(!is_numeric($_GET['page'])) { $_GET['page'] = null; }
 if($_GET['act']=="list") {
 $orderlist = null;
 $orderlist = "order by `ID` asc";
@@ -36,7 +38,9 @@ if($_GET['orderby']=="id") { $orderlist = "order by `ID`"; }
 if($_GET['orderby']=="name") { $orderlist = "order by `Name`"; }
 if($_GET['orderby']=="joined") { $orderlist = "order by `Joined`"; }
 if($_GET['orderby']=="active") { $orderlist = "order by `LastActive`"; }
+if($_GET['orderby']=="post") { $orderlist = "order by `PostCount`"; }
 if($_GET['orderby']=="posts") { $orderlist = "order by `PostCount`"; }
+if($_GET['orderby']=="karma") { $orderlist = "order by `Karma`"; }
 if($_GET['orderby']=="offset") { $orderlist = "order by `TimeZone`"; } }
 if($_GET['ordertype']==null) { 
        if($_GET['sorttype']!=null) { 
@@ -54,13 +58,24 @@ $ggquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `Name`='
 $ggresult=mysql_query($ggquery);
 $GGroup=mysql_result($ggresult,0,"id");
 @mysql_free_result($ggresult);
+//Get SQL LIMIT Number
+$nums = $_GET['page'] * $Settings['max_memlist'];
+$PageLimit = $nums - $Settings['max_memlist'];
+if($PageLimit<0) { $PageLimit = 0; }
+$i=0;
 if($_GET['groupid']==null) {
-$query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `GroupID`<>%i ".$orderlist, array($GGroup)); }
+$query = query("SELECT SQL_CALC_FOUND_ROWS * FROM `".$Settings['sqltable']."members` WHERE `GroupID`<>%i ".$orderlist." LIMIT %i,%i", array($GGroup,$PageLimit,$Settings['max_memlist'])); }
 if($_GET['groupid']!=null) {
-$query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `GroupID`=%i AND `GroupID`<>%i ".$orderlist, array($_GET['groupid'],$GGroup)); }
+$query = query("SELECT SQL_CALC_FOUND_ROWS * FROM `".$Settings['sqltable']."members` WHERE `GroupID`=%i AND `GroupID`<>%i ".$orderlist." LIMIT %i,%i", array($_GET['groupid'],$GGroup,$PageLimit,$Settings['max_memlist'])); }
+$rnquery = query("SELECT FOUND_ROWS();", array(null));
 $result=mysql_query($query);
-$num=mysql_num_rows($result);
-//Start MemberList Page Code (Will be used at later time)
+$rnresult=mysql_query($rnquery);
+$NumberMembers = mysql_result($rnresult,0);
+@mysql_free_result($rnresult);
+if($NumberMembers==null) { 
+       $NumberMembers = 0; }
+$num = $NumberMembers;
+//Start MemberList Page Code
 if(!isset($Settings['max_memlist'])) { $Settings['max_memlist'] = 10; }
 if($_GET['page']==null) { $_GET['page'] = 1; } 
 if($_GET['page']<=0) { $_GET['page'] = 1; }
@@ -68,7 +83,7 @@ $nums = $_GET['page'] * $Settings['max_memlist'];
 if($nums>$num) { $nums = $num; }
 $numz = $nums - $Settings['max_memlist'];
 if($numz<=0) { $numz = 0; }
-$i=$numz;
+//$i=$numz;
 if($nums<$num) { $nextpage = $_GET['page'] + 1; }
 if($nums>=$num) { $nextpage = $_GET['page']; }
 if($numz>=$Settings['max_memlist']) { $backpage = $_GET['page'] - 1; }
@@ -81,29 +96,92 @@ if($pnum>=$Settings['max_memlist']) {
 if($pnum<$Settings['max_memlist']&&$pnum>0) { 
        $pnum = $pnum - $pnum; 
        $Pages[$l] = $l; ++$l; } }
-//End MemberList Page Code (Its not used yet but its still good to have :P )
-$i=0;
+$nums = $_GET['page'] * $Settings['max_memlist'];
+//End MemberList Page Code
+$num=mysql_num_rows($result);
+//List Page Number Code Start
 $pagenum=count($Pages);
-$pagei=1; $pstring = "<div class=\"PageList\">Pages: ";
-while ($pagei <= $pagenum) {
-$pstring = $pstring."<a href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=list&page=".$Pages[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">".$Pages[$pagei]."</a> ";
+if($_GET['page']>$pagenum) {
+       $_GET['page'] = $pagenum; }
+$pagei=0; $pstring = "<div class=\"PageList\"><span class=\"pagelink\">Pages:</span> ";
+if($_GET['page']<4) { $Pagez[0] = null; }
+if($_GET['page']>=4) { $Pagez[0] = "First"; }
+if($_GET['page']>=3) {
+$Pagez[1] = $_GET['page'] - 2; }
+if($_GET['page']<3) {
+$Pagez[1] = null; }
+if($_GET['page']>=2) {
+$Pagez[2] = $_GET['page'] - 1; }
+if($_GET['page']<2) {
+$Pagez[2] = null; }
+$Pagez[3] = $_GET['page'];
+if($_GET['page']<$pagenum) {
+$Pagez[4] = $_GET['page'] + 1; }
+if($_GET['page']>=$pagenum) {
+$Pagez[4] = null; }
+$pagenext = $_GET['page'] + 1;
+if($pagenext<$pagenum) {
+$Pagez[5] = $_GET['page'] + 2; }
+if($pagenext>=$pagenum) {
+$Pagez[5] = null; }
+if($_GET['page']<$pagenum) { $Pagez[6] = "Last"; }
+if($_GET['page']>=$pagenum) { $Pagez[6] = null; }
+$pagenumi=count($Pagez);
+if($NumberMembers==0) {
+$pagenumi = 0;
+$pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=list&orderby=".$_GET['orderby']."&ordertype=".$_GET['ordertype']."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">1</a></span> "; }
+while ($pagei < $pagenumi) {
+if($Pagez[$pagei]!=null&&
+   $Pagez[$pagei]!="First"&&
+   $Pagez[$pagei]!="Last") {
+if($pagei==1&$Pagez[$pagei]!=null&&$Pagez[$pagei]>=2) {
+$Pback = $Pagez[$pagei] - 1;
+$pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=list&orderby=".$_GET['orderby']."&ordertype=".$_GET['ordertype']."&page=".$Pback,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">&lt;</a></span> "; }
+if($pagei!=3) { 
+$pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=list&orderby=".$_GET['orderby']."&ordertype=".$_GET['ordertype']."&page=".$Pagez[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">".$Pagez[$pagei]."</a></span> "; }
+if($pagei==3) { 
+$pstring = $pstring."<span class=\"pagecurrent\"><a href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=list&orderby=".$_GET['orderby']."&ordertype=".$_GET['ordertype']."&page=".$Pagez[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">".$Pagez[$pagei]."</a></span> "; } }
+if($Pagez[$pagei]=="First") {
+$pstring = $pstring."<span class=\"pagelinklast\"><a href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=list&orderby=".$_GET['orderby']."&ordertype=".$_GET['ordertype']."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">&laquo;</a></span> "; }
+if($Pagez[$pagei]=="Last") {
+$ptestnext = $pagenext + 1;
+if($ptestnext<$pagenum) {
+$paget = $pagei - 1;
+$Pnext = $Pagez[$paget] + 1;
+$pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=list&orderby=".$_GET['orderby']."&ordertype=".$_GET['ordertype']."&page=".$Pnext,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">&gt;</a></span> "; }
+$pstring = $pstring."<span class=\"pagelinklast\"><a href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=list&orderby=".$_GET['orderby']."&ordertype=".$_GET['ordertype']."&page=".$pagenum,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">&raquo;</a></span> "; }
        ++$pagei; } $pstring = $pstring."</div>";
 ?>
+<div class="NavLinks"><?php echo $ThemeSet['NavLinkIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">Board index</a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=list&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Member list</a></div>
+<div class="DivNavLinks">&nbsp;</div>
+<?php
+echo $pstring;
+//List Page Number Code end
+?>
+<div class="DivPageLinks">&nbsp;</div>
 <div class="Table1Border">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableRow1">
+<span style="text-align: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=list&orderby=".$_GET['orderby']."&ordertype=".$_GET['ordertype']."&page=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Member List</a>
+</span></div>
+<?php } ?>
 <table class="Table1">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
 <tr class="TableRow1">
-<td class="TableRow1" colspan="7"><span style="float: left;">
-<?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=list",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Member List</a>
-</span><span style="float: right;">&nbsp;</span></td>
-</tr>
+<td class="TableColumn1" colspan="8"><span style="text-align: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=list&orderby=".$_GET['orderby']."&ordertype=".$_GET['ordertype']."&page=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Member List</a>
+</span></td>
+</tr><?php } ?>
 <tr id="Member" class="TableRow2">
-<th class="TableRow2" style="width: 5%;">ID</th>
-<th class="TableRow2" style="width: 28%;">Name</th>
-<th class="TableRow2" style="width: 10%;">Group</th>
-<th class="TableRow2" style="width: 10%;">Posts</th>
-<th class="TableRow2" style="width: 20%;">Joined</th>
-<th class="TableRow2" style="width: 20%;">Last Active</th>
-<th class="TableRow2" style="width: 7%;">Website</th>
+<th class="TableColumn2" style="width: 5%;">ID</th>
+<th class="TableColumn2" style="width: 28%;">Name</th>
+<th class="TableColumn2" style="width: 10%;">Group</th>
+<th class="TableColumn2" style="width: 5%;">Posts</th>
+<th class="TableColumn2" style="width: 5%;">Karma</th>
+<th class="TableColumn2" style="width: 20%;">Joined</th>
+<th class="TableColumn2" style="width: 20%;">Last Active</th>
+<th class="TableColumn2" style="width: 7%;">Website</th>
 </tr>
 <?php
 while ($i < $num) {
@@ -121,35 +199,43 @@ $MemList['LastActive']=GMTimeChange("F j Y, g:i a",$MemList['LastActive'],$_SESS
 $MemList['Website']=mysql_result($result,$i,"Website");
 $MemList['Gender']=mysql_result($result,$i,"Gender");
 $MemList['PostCount']=mysql_result($result,$i,"PostCount");
+$MemList['Karma']=mysql_result($result,$i,"Karma");
 $MemList['TimeZone']=mysql_result($result,$i,"TimeZone");
 $MemList['DST']=mysql_result($result,$i,"DST");
 $MemList['IP']=mysql_result($result,$i,"IP");
-$gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i", array($MemList['GroupID']));
+$gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i LIMIT 1", array($MemList['GroupID']));
 $gresult=mysql_query($gquery);
 $MemList['Group']=mysql_result($gresult,0,"Name");
+$GroupNamePrefix=mysql_result($gresult,0,"NamePrefix");
+$GroupNameSuffix=mysql_result($gresult,0,"NameSuffix");
 @mysql_free_result($gresult);
+if(isset($GroupNamePrefix)&&$GroupNamePrefix!=null) {
+       $MemList['Name'] = $GroupNamePrefix.$MemList['Name']; }
+if(isset($GroupNameSuffix)&&$GroupNameSuffix!=null) {
+       $MemList['Name'] = $MemList['Name'].$GroupNameSuffix; }
 $membertitle = " ".$ThemeSet['TitleDivider']." Member List";
 if($MemList['Group']!=$Settings['GuestGroup']) {
 ?>
 <tr class="TableRow3" id="Member<?php echo $MemList['ID']; ?>">
-<td class="TableRow3" style="text-align: center;"><?php echo $MemList['ID']; ?></td>
-<td class="TableRow3">&nbsp;<a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$MemList['ID'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>"><?php echo $MemList['Name']; ?></a></td>
-<td class="TableRow3" style="text-align: center;"><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=list&gid=".$MemList['GroupID'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>"><?php echo $MemList['Group']; ?></a></td>
-<td class="TableRow3" style="text-align: center;"><?php echo $MemList['PostCount']; ?></td>
-<td class="TableRow3" style="text-align: center;"><?php echo $MemList['Joined']; ?></td>
-<td class="TableRow3" style="text-align: center;"><?php echo $MemList['LastActive']; ?></td>
-<td class="TableRow3" style="text-align: center;"><a href="<?php echo $MemList['Website']; ?>" onclick="window.open(this.href);return false;">Website</a></td>
+<td class="TableColumn3" style="text-align: center;"><?php echo $MemList['ID']; ?></td>
+<td class="TableColumn3">&nbsp;<a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$MemList['ID'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>"><?php echo $MemList['Name']; ?></a></td>
+<td class="TableColumn3" style="text-align: center;"><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=list&gid=".$MemList['GroupID']."&page=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>"><?php echo $MemList['Group']; ?></a></td>
+<td class="TableColumn3" style="text-align: center;"><?php echo $MemList['PostCount']; ?></td>
+<td class="TableColumn3" style="text-align: center;"><?php echo $MemList['Karma']; ?></td>
+<td class="TableColumn3" style="text-align: center;"><?php echo $MemList['Joined']; ?></td>
+<td class="TableColumn3" style="text-align: center;"><?php echo $MemList['LastActive']; ?></td>
+<td class="TableColumn3" style="text-align: center;"><a href="<?php echo $MemList['Website']; ?>" onclick="window.open(this.href);return false;">Website</a></td>
 </tr>
 <?php }
 ++$i; } @mysql_free_result($result);
 ?>
 <tr id="MemEnd" class="TableRow4">
-<td class="TableRow4" colspan="7">&nbsp;</td>
+<td class="TableColumn4" colspan="8">&nbsp;</td>
 </tr>
 </table></div>
 <?php }
 if($_GET['act']=="view") { 
-$query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_GET['id']));
+$query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($_GET['id']));
 $result=mysql_query($query);
 $num=mysql_num_rows($result);
 $i=0;
@@ -173,15 +259,27 @@ $ViewMem['LastActive']=GMTimeChange("M j Y, g:i a",$ViewMem['LastActive'],$_SESS
 $ViewMem['Website']=mysql_result($result,$i,"Website");
 $ViewMem['Gender']=mysql_result($result,$i,"Gender");
 $ViewMem['PostCount']=mysql_result($result,$i,"PostCount");
+$ViewMem['Karma']=mysql_result($result,$i,"Karma");
 $ViewMem['TimeZone']=mysql_result($result,$i,"TimeZone");
 $ViewMem['DST']=mysql_result($result,$i,"DST");
 $ViewMem['IP']=mysql_result($result,$i,"IP");
-$gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i", array($ViewMem['GroupID']));
+$gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i LIMIT 1", array($ViewMem['GroupID']));
 $gresult=mysql_query($gquery);
 $ViewMem['Group']=mysql_result($gresult,0,"Name");
+/*
+$GroupNamePrefix=mysql_result($gresult,0,"NamePrefix");
+$GroupNameSuffix=mysql_result($gresult,0,"NameSuffix");
+*/
 @mysql_free_result($gresult);
+/*
+if(isset($GroupNamePrefix)&&$GroupNamePrefix!=null) {
+       $ViewMem['Name'] = $GroupNamePrefix.$ViewMem['Name']; }
+if(isset($GroupNameSuffix)&&$GroupNameSuffix!=null) {
+       $ViewMem['Name'] = $ViewMem['Name'].$GroupNameSuffix; }
+*/
 $membertitle = " ".$ThemeSet['TitleDivider']." ".$ViewMem['Name'];     
-if ($ViewMem['Avatar']=="http://"||$ViewMem['Avatar']==null) {
+if ($ViewMem['Avatar']=="http://"||$ViewMem['Avatar']==null||
+       strtolower($ViewMem['Avatar'])=="noavatar") {
 $ViewMem['Avatar']=$ThemeSet['NoAvatar'];
 $ViewMem['AvatarSize']=$ThemeSet['NoAvatarSize']; }
 $AvatarSize1=explode("x", $ViewMem['AvatarSize']);
@@ -197,23 +295,33 @@ if($_GET['view']=="website"||$_GET['view']=="homepage") {
        if ($ViewMem['Website']!="http://"&&$ViewMem['Website']!=null) {
        @session_write_close();
        @header("Location: ".$ViewMem['Website']); }
-       if ($ViewMem['Website']=="http://"||$ViewMem['Website']==null) {
+       if ($ViewMem['Website']=="http://"||$ViewMem['Website']==null||
+       strtolower($ViewMem['Avatar'])=="noavatar") {
        @session_write_close();
        @header("Location: ".$BoardURL."index.php?act=view"); } }
 ?>
+<div class="NavLinks"><?php echo $ThemeSet['NavLinkIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">Board index</a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$_GET['id'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Viewing profile</a></div>
+<div class="DivNavLinks">&nbsp;</div>
 <div class="Table1Border">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableRow1">
+<span style="text-align: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$_GET['id'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Viewing profile<?php echo $ThemeSet['NavLinkDivider']; ?><?php echo $ViewMem['Name']; ?></a>
+</span></div>
+<?php } ?>
 <table class="Table1">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
 <tr class="TableRow1">
-<td class="TableRow1" colspan="2"><span style="float: left;">
-<?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$_GET['id'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Viewing Profile</a>
-</span><span style="float: right;">&nbsp;</span></td>
-</tr>
+<td class="TableColumn1" colspan="2"><span style="text-align: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$_GET['id'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Viewing profile<?php echo $ThemeSet['NavLinkDivider']; ?><?php echo $ViewMem['Name']; ?></a>
+</span></td>
+</tr><?php } ?>
 <tr id="Member" class="TableRow2">
-<th class="TableRow2" style="width: 50%;">Avatar</th>
-<th class="TableRow2" style="width: 50%;">User Info</th>
+<th class="TableColumn2" style="width: 50%;">Avatar</th>
+<th class="TableColumn2" style="width: 50%;">User Info</th>
 </tr>
 <tr class="TableRow3" id="MemberProfile">
-<td class="TableRow3">
+<td class="TableColumn3">
 <?php  /* Avatar Table Thanks For SeanJ's Help at http://seanj.jcink.com/ */  ?>
  <table class="AvatarTable" style="width: 100%; height: 100px; text-align: center;">
        <tr class="AvatarRow" style="width: 100px; height: 100px;">
@@ -224,9 +332,12 @@ if($_GET['view']=="website"||$_GET['view']=="homepage") {
  </table>
 <div style="text-align: center;">
 Name: <?php echo $ViewMem['Name']; ?><br />
-Title: <?php echo $ViewMem['Title']; ?></div>
+Title: <?php echo $ViewMem['Title']; ?>
+<?php if($GroupInfo['HasAdminCP']=="yes") { ?>
+<br />User IP: <a onclick="window.open(this.href);return false;" href="http://ip-lookup.net/?<?php echo $ViewMem['IP']; ?>">
+<?php echo $ViewMem['IP']; echo "</a>"; } ?></div>
 </td>
-<td class="TableRow3">
+<td class="TableColumn3">
 &nbsp;User Name: <?php echo $ViewMem['Name']; ?><br />
 &nbsp;User Title: <?php echo $ViewMem['Title']; ?><br />
 &nbsp;User Group: <?php echo $ViewMem['Group']; ?><br />
@@ -235,20 +346,33 @@ Title: <?php echo $ViewMem['Title']; ?></div>
 &nbsp;User Time: <?php echo GMTimeGet("M j Y, g:i a",$ViewMem['TimeZone'],0,$ViewMem['DST']); ?><br />
 &nbsp;User Website: <a href="<?php echo $ViewMem['Website']; ?>" onclick="window.open(this.href);return false;">Website</a><br />
 &nbsp;Post Count: <?php echo $ViewMem['PostCount']; ?><br />
+&nbsp;Karma: <?php echo $ViewMem['Karma']; ?><br />
 &nbsp;Interests: <?php echo $ViewMem['Interests']; ?><br />
 </td>
 </tr>
 <tr class="TableRow4">
-<td class="TableRow4" colspan="2">&nbsp;</td>
+<td class="TableColumn4" colspan="2">&nbsp;</td>
 </tr>
 </table></div>
 <?php } @mysql_free_result($result);
 if($_GET['act']=="logout") {
 @session_unset();
-@setcookie("MemberName", null, GMTimeStamp() - 3600, $basedir);
-@setcookie("UserID", null, GMTimeStamp() - 3600, $basedir);
-@setcookie("SessPass", null, GMTimeStamp() - 3600, $basedir);
-@setcookie(session_name(), "", GMTimeStamp() - 3600, $basedir);
+if($cookieDomain==null) {
+@setcookie("MemberName", null, GMTimeStamp() - 3600, $cbasedir);
+@setcookie("UserID", null, GMTimeStamp() - 3600, $cbasedir);
+@setcookie("SessPass", null, GMTimeStamp() - 3600, $cbasedir);
+@setcookie(session_name(), "", GMTimeStamp() - 3600, $cbasedir); }
+if($cookieDomain!=null) {
+if($cookieSecure===true) {
+@setcookie("MemberName", null, GMTimeStamp() - 3600, $cbasedir, $cookieDomain, 1);
+@setcookie("UserID", null, GMTimeStamp() - 3600, $cbasedir, $cookieDomain, 1);
+@setcookie("SessPass", null, GMTimeStamp() - 3600, $cbasedir, $cookieDomain, 1);
+@setcookie(session_name(), "", GMTimeStamp() - 3600, $cbasedir, $cookieDomain, 1); }
+if($cookieSecure===false) {
+@setcookie("MemberName", null, GMTimeStamp() - 3600, $cbasedir, $cookieDomain);
+@setcookie("UserID", null, GMTimeStamp() - 3600, $cbasedir, $cookieDomain);
+@setcookie("SessPass", null, GMTimeStamp() - 3600, $cbasedir, $cookieDomain);
+@setcookie(session_name(), "", GMTimeStamp() - 3600, $cbasedir, $cookieDomain); } }
 unset($_COOKIE[session_name()]);
 $_SESSION = array();
 @session_unset();
@@ -257,29 +381,43 @@ $_SESSION = array();
 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
 if($_GET['act']=="login") {
+if($_SESSION['UserID']!=0&&$_SESSION['UserID']!=null) { 
+redirect("location",$basedir.url_maker($exfile['member'],$Settings['file_ext'],"act=logout",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'],false));
+ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
+if($_SESSION['UserID']==0||$_SESSION['UserID']==null) {
 $membertitle = " ".$ThemeSet['TitleDivider']." Login";
 ?>
+<div class="NavLinks"><?php echo $ThemeSet['NavLinkIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">Board index</a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=login",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Login</a></div>
+<div class="DivNavLinks">&nbsp;</div>
 <div class="Table1Border">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableRow1">
+<span style="text-align: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=login",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Log in</a>
+</span></div>
+<?php } ?>
 <table class="Table1">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
 <tr class="TableRow1">
-<td class="TableRow1"><span style="float: left;">
-<?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=login",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Log in</a>
-</span><span style="float: right;">&nbsp;</span></td>
-</tr>
+<td class="TableColumn1"><span style="text-align: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=login",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Log in</a>
+</span></td>
+</tr><?php } ?>
 <tr class="TableRow2">
-<th class="TableRow2" style="width: 100%; text-align: left;">&nbsp;Inert your login info: </th>
+<th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Inert your login info: </th>
 </tr>
 <tr class="TableRow3">
-<td class="TableRow3">
-<form method="post" action="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=login_now",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">
+<td class="TableColumn3">
+<form style="display: inline;" method="post" action="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=login_now",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">
 <table style="text-align: left;">
 <tr style="text-align: left;">
        <td style="width: 30%;"><label class="TextBoxLabel" for="username">Enter UserName: </label></td>
-       <td style="width: 70%;"><input maxlength="20" class="TextBox" id="username" type="text" name="username" /></td>
-</tr><tr>
+       <td style="width: 70%;"><input maxlength="24" class="TextBox" id="username" type="text" name="username" /></td>
+</tr><tr style="text-align: left;">
        <td style="width: 30%;"><label class="TextBoxLabel" for="userpass">Enter Password: </label></td>
        <td style="width: 70%;"><input maxlength="30" class="TextBox" id="userpass" type="password" name="userpass" /></td>
-</tr><tr>
+</tr><tr style="text-align: left;">
        <td style="width: 30%;"><label class="TextBoxLabel" title="Store userinfo as a cookie so you dont need to login again." for="storecookie">Store as cookie?</label></td>
        <td style="width: 70%;"><select id="storecookie" name="storecookie" class="TextBox">
 <option value="true">Yes</option>
@@ -296,58 +434,71 @@ $membertitle = " ".$ThemeSet['TitleDivider']." Login";
 </td>
 </tr>
 <tr class="TableRow4">
-<td class="TableRow4">&nbsp;</td>
+<td class="TableColumn4">&nbsp;</td>
 </tr>
 </table></div>
-<?php } if($_POST['act']=="loginmember"&&$_GET['act']=="login_now") {
+<?php } } if($_POST['act']=="loginmember"&&$_GET['act']=="login_now") {
+if($_SESSION['UserID']!=0&&$_SESSION['UserID']!=null) { 
+redirect("location",$basedir.url_maker($exfile['member'],$Settings['file_ext'],"act=logout",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'],false));
+ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
+if($_SESSION['UserID']==0||$_SESSION['UserID']==null) {
 $membertitle = " ".$ThemeSet['TitleDivider']." Login";
 $REFERERurl = parse_url($_SERVER['HTTP_REFERER']);
 $URL['REFERER'] = $REFERERurl['host'];
 $URL['HOST'] = $_SERVER["SERVER_NAME"];
-$REFERERurl = null; unset($REFERERurl);
+$REFERERurl = null;
 ?>
+<div class="NavLinks"><?php echo $ThemeSet['NavLinkIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">Board index</a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=login",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Login</a></div>
+<div class="DivNavLinks">&nbsp;</div>
 <div class="Table1Border">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableRow1">
+<span style="text-align: left;">&nbsp;<a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=login",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Log in</a></span>
+</div>
+<?php } ?>
 <table class="Table1">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
 <tr class="TableRow1">
-<td class="TableRow1">
-<span style="float: left;">&nbsp;<a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=login",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Log in</a></span>
-<span style="float: right;">&nbsp;</span></td>
-</tr>
+<td class="TableColumn1">
+<span style="text-align: left;">&nbsp;<a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=login",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Log in</a></span>
+</td>
+</tr><?php } ?>
 <tr class="TableRow2">
-<th class="TableRow2" style="width: 100%; text-align: left;">&nbsp;Login Message: </th>
+<th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Login Message: </th>
 </tr>
 <tr class="TableRow3">
-<td class="TableRow3">
+<td class="TableColumn3">
 <table style="width: 100%; height: 25%; text-align: center;">
 <?php
-if (strlen($_POST['userpass'])>="30") { $Error="Yes";  ?>
+if (pre_strlen($_POST['userpass'])>="30") { $Error="Yes";  ?>
 <tr>
        <td><span class="TableMessage">
        <br />Your password is too big.<br />
-       </span></td>
+       </span>&nbsp;</td>
 </tr>
-<?php } if (strlen($_POST['username'])>="20") { $Error="Yes";  ?>
+<?php } if (pre_strlen($_POST['username'])>="24") { $Error="Yes";  ?>
 <tr>
        <td><span class="TableMessage">
        <br />Your user name is too big.<br />
-       <span></td>
+       </span>&nbsp;</td>
 </tr>
-<?php } if ($Settings['TestReferer']==true) {
+<?php } if ($Settings['TestReferer']=="on") {
        if ($URL['HOST']!=$URL['REFERER']) { $Error="Yes";  ?>
 <tr>
        <td><span class="TableMessage">
        <br />Sorry the referering url dose not match our host name.<br />
-       <span></td>
+       </span>&nbsp;</td>
 </tr>
-<?php } }
+<?php } } $BanError = null;
 if ($Error=="Yes") {
 @redirect("refresh",$basedir.url_maker($exfile['member'],$Settings['file_ext'],"act=login",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'],false),"4"); }
 if($Error!="Yes"){
-$YourName = stripcslashes(htmlspecialchars($_POST['username'], ENT_QUOTES));
+$YourName = stripcslashes(htmlspecialchars($_POST['username'], ENT_QUOTES, $Settings['charset']));
 //$YourName = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $YourName);
 $YourName = @remove_spaces($YourName);
 $passtype="ODFH";
-$querylog = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `Name`='%s'", array($YourName));
+$querylog = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `Name`='%s' LIMIT 1", array($YourName));
 $resultlog=mysql_query($querylog);
 $numlog=mysql_num_rows($resultlog);
 if($numlog>=1) {
@@ -359,15 +510,19 @@ $HashSalt=mysql_result($resultlog,$i,"Salt");
 $UpdateHash = false;
 if($HashType=="ODFH") { $YourPassword = sha1(md5($_POST['userpass'])); }
 if($HashType=="DF4H") { $YourPassword = b64e_hmac($_POST['userpass'],$JoinedPass,$HashSalt,"sha1"); }
-if($HashType=="iDBH"||$UpdateHash!=true) { $YourPassword = b64e_hmac($_POST['userpass'],$JoinedPass,$HashSalt,"sha1"); }
-if($YourPassword==$YourPassTry) { $passright = false; } 
+if($HashType=="iDBH"||$UpdateHash!==true) { $YourPassword = b64e_hmac($_POST['userpass'],$JoinedPass,$HashSalt,"sha1"); }
+if($YourPassword!=$YourPassTry) { $passright = false; } 
 if($YourPassword==$YourPassTry) { $passright = true;
 $YourIDM=mysql_result($resultlog,$i,"id");
 $YourNameM=mysql_result($resultlog,$i,"Name");
 $YourPassM=mysql_result($resultlog,$i,"Password");
 $PostCount=mysql_result($resultlog,$i,"PostCount");
 $YourGroupM=mysql_result($resultlog,$i,"GroupID");
-$gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i", array($YourGroupM));
+$YourBanTime=mysql_result($resultlog,$i,"BanTime");
+$CGMTime = GMTimeStamp();
+if($YourBanTime!=0&&$YourBanTime!=null) {
+if($YourBanTime>=$CGMTime) { $BanError = "yes"; } }
+$gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i LIMIT 1", array($YourGroupM));
 $gresult=mysql_query($gquery);
 $YourGroupM=mysql_result($gresult,0,"Name");
 @mysql_free_result($gresult);
@@ -379,6 +534,7 @@ $NewHashSalt = salt_hmac();
 $NewPassword = b64e_hmac($_POST['userpass'],$JoinedPass,$NewHashSalt,"sha1");
 $NewDay=GMTimeStamp();
 $NewIP=$_SERVER['REMOTE_ADDR'];
+if($BanError!="yes") {
 $queryup = query("UPDATE `".$Settings['sqltable']."members` SET `Password`='%s',`HashType`='iDBH',`LastActive`=%i,`IP`='%s',`Salt`='%s' WHERE `id`=%i", array($NewPassword,$NewDay,$NewIP,$NewHashSalt,$YourIDM));
 mysql_query($queryup);
 @mysql_free_result($resultlog); @mysql_free_result($queryup);
@@ -391,56 +547,83 @@ $_SESSION['UserGroup']=$YourGroupM;
 $_SESSION['UserDST']=$YourDSTM;
 $_SESSION['UserPass']=$NewPassword;
 $_SESSION['DBName']=$Settings['sqldb'];
-if($_POST['storecookie']==true) {
-setcookie("MemberName", $YourNameM, time() + (7 * 86400), $basedir);
-setcookie("UserID", $YourIDM, time() + (7 * 86400), $basedir);
-setcookie("SessPass", $NewPassword, time() + (7 * 86400), $basedir); }
+if($_POST['storecookie']=="true") {
+if($cookieDomain==null) {
+@setcookie("MemberName", $YourNameM, time() + (7 * 86400), $cbasedir);
+@setcookie("UserID", $YourIDM, time() + (7 * 86400), $cbasedir);
+@setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir); }
+if($cookieDomain!=null) {
+if($cookieSecure===true) {
+@setcookie("MemberName", $YourNameM, time() + (7 * 86400), $cbasedir, $cookieDomain, 1);
+@setcookie("UserID", $YourIDM, time() + (7 * 86400), $cbasedir, $cookieDomain, 1);
+@setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir, $cookieDomain, 1); }
+if($cookieSecure===false) {
+@setcookie("MemberName", $YourNameM, time() + (7 * 86400), $cbasedir, $cookieDomain);
+@setcookie("UserID", $YourIDM, time() + (7 * 86400), $cbasedir, $cookieDomain);
+@setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir, $cookieDomain); } } } }
 } } if($numlog<=0) {
 //echo "Password was not right or user not found!! <_< ";
 } ?>
-<?php if($passright==true) {
+<?php if($passright===true&&$BanError!="yes") {
 @redirect("refresh",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false),"3"); ?>
 <tr>
        <td><span class="TableMessage">
        <br />Welcome to the Board <?php echo $_SESSION['MemberName']; ?>. ^_^<br />
        Click <a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">here</a> to continue to board.<br />&nbsp;
-       </span></td>
+       </span><br /></td>
 </tr>
-<?php } if($passright==false) { ?>
+<?php } if($passright===false||$BanError=="yes"||$numlog<=0) { ?>
 <tr>
        <td><span class="TableMessage">
-       <br />Password was not right or user not found!! &lt;_&lt;<br />
+       <br />Password was not right or user not found or user is banned!! &lt;_&lt;<br />
        Click <a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=login",$Settings['qstr'],$Settings['qsep'],$exqstr['member'],$prexqstr['member']); ?>">here</a> to try again.<br />&nbsp;
-       </span></td>
+       </span><br /></td>
 </tr>
 <?php } } ?>
 </table>
 </td></tr>
 <tr class="TableRow4">
-<td class="TableRow4">&nbsp;</td>
+<td class="TableColumn4">&nbsp;</td>
 </tr>
 </table></div>
-<?php }
-if($_GET['act']=="signup")
-{ 
-$membertitle = " ".$ThemeSet['TitleDivider']." Signing up"; ?>
+<?php } } if($_GET['act']=="signup") { 
+$membertitle = " ".$ThemeSet['TitleDivider']." Signing up"; 
+if($_SESSION['UserID']!=0&&$_SESSION['UserID']!=null) { 
+redirect("location",$basedir.url_maker($exfile['member'],$Settings['file_ext'],"act=logout",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'],false));
+ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
+if($_SESSION['UserID']==0||$_SESSION['UserID']==null) {
+?>
+<div class="NavLinks"><?php echo $ThemeSet['NavLinkIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">Board index</a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=signup",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Signup</a></div>
+<div class="DivNavLinks">&nbsp;</div>
 <div class="Table1Border">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableRow1">
+<span style="text-align: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=signup",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Register</a>
+</span></div>
+<?php } ?>
 <table class="Table1">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
 <tr class="TableRow1">
-<td class="TableRow1"><span style="float: left;">
-<?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=signup",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Register</a>
-</span><span style="float: right;">&nbsp;</span></td>
-</tr>
+<td class="TableColumn1"><span style="text-align: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=signup",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Register</a>
+</span></td>
+</tr><?php } ?>
 <tr class="TableRow2">
-<th class="TableRow2" style="width: 100%; text-align: left;">&nbsp;Inert your user info: </th>
+<th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Inert your user info: </th>
 </tr>
 <tr class="TableRow3">
-<td class="TableRow3">
-<form method="post" action="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=makemember",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">
+<td class="TableColumn3">
+<form style="display: inline;" method="post" action="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=makemember",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">
 <table style="text-align: left;">
 <tr style="text-align: left;">
        <td style="width: 30%;"><label class="TextBoxLabel" for="Name">Insert a UserName:</label></td>
-       <td style="width: 70%;"><input maxlength="20" type="text" class="TextBox" name="Name" size="20" id="Name" /></td>
+       <?php if(!isset($_SESSION['GuestName'])) { ?>
+       <td style="width: 70%;"><input maxlength="24" type="text" class="TextBox" name="Name" size="20" id="Name" /></td>
+       <?php } if(isset($_SESSION['GuestName'])) { ?>
+       <td style="width: 70%;"><input maxlength="24" type="text" class="TextBox" name="Name" size="20" id="Name" value="<?php echo $_SESSION['GuestName']; ?>" /></td>
+       <?php } ?>
 </tr><tr>
        <td style="width: 30%;"><label class="TextBoxLabel" for="Password">Insert a Password:</label></td>
        <td style="width: 70%;"><input maxlength="30" type="password" class="TextBox" name="Password" size="20" id="Password" /></td>
@@ -480,8 +663,8 @@ echo "<option value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n"; }
        <td style="width: 50%;"><select id="MinOffSet" name="MinOffSet" class="TextBox"><?php
 $mini = 0; $minnum = 60;
 while ($mini < $minnum) {
-if(strlen($mini)==2) { $showmin = $mini; }
-if(strlen($mini)==1) { $showmin = "0".$mini; }
+if(pre_strlen($mini)==2) { $showmin = $mini; }
+if(pre_strlen($mini)==1) { $showmin = "0".$mini; }
 if($mini==$TimeZoneArray['minute']) {
 echo "\n<option selected=\"selected\" value=\"".$showmin."\">0:".$showmin." minutes</option>\n"; }
 if($mini!=$TimeZoneArray['minute']) {
@@ -523,68 +706,128 @@ echo "<option value=\"".$showmin."\">0:".$showmin." minutes</option>\n"; }
 <label class="TextBoxLabel" for="TOSBox">TOS - Please read fully and check 'I agree' box ONLY if you agree to terms</label><br />
 <textarea rows="10" cols="58" id="TOSBox" name="TOSBox" class="TextBox" readonly="readonly" accesskey="T"><?php 
        echo file_get_contents("TOS");  ?></textarea><br />
-<input type="checkbox" class="TextBox" name="TOS" value="Agree" id="TOS" /><label class="TextBoxLabel" for="TOS">I Agree</label><br/>
+<input type="checkbox" class="TextBox" name="TOS" value="Agree" id="TOS" /><label class="TextBoxLabel" for="TOS">I Agree</label>
+<?php if($Settings['use_captcha']!="on") { ?><br />
+<?php } if($Settings['use_captcha']=="on") { ?>
+</td></tr>
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<label class="TextBoxLabel" for="signcode"><img src="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=MkCaptcha",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>" alt="CAPTCHA Code" title="CAPTCHA Code" /></label><br />
+<input maxlength="25" type="text" class="TextBox" name="signcode" size="20" id="signcode" value="Enter SignCode" /><br /><?php } ?>
 <input type="hidden" style="display: none;" name="act" value="makemembers" />
 <input type="submit" class="Button" value="Sign UP" />
-</td></tr></table>
+</td></tr>
+</table>
 </form>
 </td>
 </tr>
 <tr class="TableRow4">
-<td class="TableRow4">&nbsp;</td>
+<td class="TableColumn4">&nbsp;</td>
 </tr>
 </table></div>
-<?php } if($_GET['act']=="makemember") {
+<?php } if($_GET['act']=="makemember") {
        if($_POST['act']=="makemembers") {
+if($_SESSION['UserID']!=0&&$_SESSION['UserID']!=null) { 
+redirect("location",$basedir.url_maker($exfile['member'],$Settings['file_ext'],"act=logout",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'],false));
+ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
+if($_SESSION['UserID']==0||$_SESSION['UserID']==null) {
 $membertitle = " ".$ThemeSet['TitleDivider']." Signing up";
 $REFERERurl = parse_url($_SERVER['HTTP_REFERER']);
 $URL['REFERER'] = $REFERERurl['host'];
 $URL['HOST'] = $_SERVER["SERVER_NAME"];
-$REFERERurl = null; unset($REFERERurl);
+$REFERERurl = null;
 if(!isset($_POST['username'])) { $_POST['username'] = null; }
 if(!isset($_POST['TOS'])) { $_POST['TOS'] = null; }
+if($Settings['use_captcha']=="on") {
+require($SettDir['inc']."captcha.php"); }
 ?>
+<div class="NavLinks"><?php echo $ThemeSet['NavLinkIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">Board index</a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=signup",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); ?>">Signup</a></div>
+<div class="DivNavLinks">&nbsp;</div>
 <div class="Table1Border">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableRow1">
+<span style="text-align: left;">
+&nbsp;<a href="<?php echo url_maker($exfile['messenger'],$Settings['file_ext'],"act=signup",$Settings['qstr'],$Settings['qsep'],$prexqstr['messenger'],$exqstr['messenger']); ?>">Register</a></span></div>
+<?php } ?>
 <table class="Table1">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
 <tr class="TableRow1">
-<td class="TableRow1"><span style="float: right;">&nbsp;</span>
-&nbsp;<a href="<?php echo url_maker($exfile['messenger'],$Settings['file_ext'],"act=signup",$Settings['qstr'],$Settings['qsep'],$prexqstr['messenger'],$exqstr['messenger']); ?>">Register</a></td>
-</tr>
+<td class="TableColumn1"><span style="text-align: left;">
+&nbsp;<a href="<?php echo url_maker($exfile['messenger'],$Settings['file_ext'],"act=signup",$Settings['qstr'],$Settings['qsep'],$prexqstr['messenger'],$exqstr['messenger']); ?>">Register</a></span></td>
+</tr><?php } ?>
 <tr class="TableRow2">
-<th class="TableRow2" style="width: 100%; text-align: left;">&nbsp;Signup Message: </th>
+<th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Signup Message: </th>
 </tr>
 <tr class="TableRow3">
-<td class="TableRow3">
+<td class="TableColumn3">
 <table style="width: 100%; height: 25%; text-align: center;">
-<?php if (strlen($_POST['Password'])>="30") { $Error="Yes";  ?>
+<?php if (pre_strlen($_POST['Password'])>="30") { $Error="Yes";  ?>
 <tr>
        <td><span class="TableMessage">
        <br />Your password is too big.<br />
-       </span></td>
+       </span>&nbsp;</td>
 </tr>
-<?php } if (strlen($_POST['username'])>="20") { $Error="Yes";  ?>
+<?php } if (pre_strlen($_POST['username'])>="24") { $Error="Yes";  ?>
 <tr>
        <td><span class="TableMessage">
        <br />Your user name is too big.<br />
-       </span></td>
+       </span>&nbsp;</td>
 </tr>
 <?php } if ($_POST['Password']!=$_POST['RePassword']) { $Error="Yes";  ?>
 <tr>
        <td><span class="TableMessage">
        <br />Your passwords did not match.<br />
-       </span></td>
+       </span>&nbsp;</td>
 </tr>
-<?php } if ($Settings['TestReferer']==true) {
+<?php } if($Settings['use_captcha']=="on") {
+if (PhpCaptcha::Validate($_POST['signcode'])) {
+//echo 'Valid code entered';
+} else { $Error="Yes"; ?>
+<tr>
+       <td><span class="TableMessage">
+       <br />Invalid code entered<br />
+       </span>&nbsp;</td>
+</tr>
+<?php } } if ($Settings['TestReferer']=="on") {
        if ($URL['HOST']!=$URL['REFERER']) { $Error="Yes";  ?>
 <tr>
        <td><span class="TableMessage">
        <br />Sorry the referering url dose not match our host name.<br />
-       </span></td>
+       </span>&nbsp;</td>
 </tr>
 <?php } }
-$Name = stripcslashes(htmlspecialchars($_POST['Name'], ENT_QUOTES));
+$Name = stripcslashes(htmlspecialchars($_POST['Name'], ENT_QUOTES, $Settings['charset']));
 //$Name = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $Name);
 $Name = @remove_spaces($Name);
+$lonewolfqy=query("SELECT * FROM `".$Settings['sqltable']."restrictedwords` WHERE `RestrictedUserName`='yes'", array(null));
+$lonewolfrt=mysql_query($lonewolfqy);
+$lonewolfnm=mysql_num_rows($lonewolfrt);
+$lonewolfs=0; $RMatches = null;
+while ($lonewolfs < $lonewolfnm) {
+$RWord=mysql_result($lonewolfrt,$lonewolfs,"Word");
+$RCaseInsensitive=mysql_result($lonewolfrt,$lonewolfs,"CaseInsensitive");
+if($RCaseInsensitive=="on") { $RCaseInsensitive = "yes"; }
+if($RCaseInsensitive=="off") { $RCaseInsensitive = "no"; }
+if($RCaseInsensitive!="yes"||$RCaseInsensitive!="no") { $RCaseInsensitive = "no"; }
+$RWholeWord=mysql_result($lonewolfrt,$lonewolfs,"WholeWord");
+if($RWholeWord=="on") { $RWholeWord = "yes"; }
+if($RWholeWord=="off") { $RWholeWord = "no"; }
+if($RWholeWord!="yes"||$RWholeWord!="no") { $RWholeWord = "no"; }
+$RWord = preg_quote($RWord, "/");
+if($RCaseInsensitive!="yes"&&$RWholeWord=="yes") {
+$RMatches = preg_match("/\b(".$RWord.")\b/", $Name);
+       if($RMatches==true) { break 1; } }
+if($RCaseInsensitive=="yes"&&$RWholeWord=="yes") {
+$RMatches = preg_match("/\b(".$RWord.")\b/i", $Name);
+       if($RMatches==true) { break 1; } }
+if($RCaseInsensitive!="yes"&&$RWholeWord!="yes") {
+$RMatches = preg_match("/".$RWord."/", $Name);
+       if($RMatches==true) { break 1; } }
+if($RCaseInsensitive=="yes"&&$RWholeWord!="yes") {
+$RMatches = preg_match("/".$RWord."/i", $Name);
+       if($RMatches==true) { break 1; } }
+++$lonewolfs; } @mysql_free_result($lonewolfrt);
 $sql_email_check = mysql_query(query("SELECT `Email` FROM `".$Settings['sqltable']."members` WHERE `Email`='%s'", array($_POST['Email'])));
 $sql_username_check = mysql_query(query("SELECT `Name` FROM `".$Settings['sqltable']."members` WHERE `Name`='%s'", array($Name)));
 $email_check = mysql_num_rows($sql_email_check); 
@@ -594,73 +837,84 @@ if ($_POST['TOS']!="Agree") { $Error="Yes";  ?>
 <tr>
        <td><span class="TableMessage">
        <br />You need to  agree to the tos.<br />
-       </span></td>
+       </span>&nbsp;</td>
 </tr>
 <?php } if ($_POST['Name']==null) { $Error="Yes"; ?>
 <tr>
        <td><span class="TableMessage">
        <br />You need to enter a name.<br />
-       </span></td>
+       </span>&nbsp;</td>
 </tr>
 <?php } if ($_POST['Name']=="ShowMe") { $Error="Yes"; ?>
 <tr>
        <td><span class="TableMessage">
        <br />You need to enter a name.<br />
-       </span></td>
+       </span>&nbsp;</td>
 </tr>
 <?php } if ($_POST['Password']==null) { $Error="Yes"; ?>
 <tr>
        <td><span class="TableMessage">
        <br />You need to enter a password.<br />
-       </span></td>
+       </span>&nbsp;</td>
 </tr>
 <?php } if ($_POST['Email']==null) { $Error="Yes"; ?>
 <tr>
        <td><span class="TableMessage">
        <br />You need to enter a email.<br />
-       </span></td>
+       </span>&nbsp;</td>
 </tr>
 <?php } if($email_check > 0) { $Error="Yes"; ?>
 <tr>
        <td><span class="TableMessage">
        <br />Email address is already used.<br />
-       </span></td>
+       </span>&nbsp;</td>
 </tr>
 <?php } if($username_check > 0) { $Error="Yes"; ?>
 <tr>
        <td><span class="TableMessage">
-       <br />UserName is already used.<br />
-       </span></td>
+       <br />User Name is already used.<br />
+       </span>&nbsp;</td>
+</tr>
+<?php } if($RMatches==true) { $Error="Yes"; ?>
+<tr>
+       <td><span class="TableMessage">
+       <br />This User Name is restricted to use.<br />
+       </span>&nbsp;</td>
 </tr>
 <?php } if ($Error=="Yes") {
-@redirect("refresh",$basedir.url_maker($exfile['member'],$Settings['file_ext'],"act=signup",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'],FALSE),"4"); }
-if ($Error!="Yes") {
+@redirect("refresh",$basedir.url_maker($exfile['member'],$Settings['file_ext'],"act=signup",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'],FALSE),"4"); ?>
+<tr>
+       <td><span class="TableMessage">
+       <br />Click <a href="<?php echo url_maker($exfile['member'],$Settings['file_ext'],"act=signup",$Settings['qstr'],$Settings['qsep'],$exqstr['member'],$prexqstr['member']); ?>">here</a> to try again.<br />&nbsp;
+       </span><br /></td>
+</tr>
+<?php } if ($Error!="Yes") {
 $_POST['UserIP'] = $_SERVER['REMOTE_ADDR'];
 $_POST['Group'] = $Settings['MemberGroup'];
 $_POST['Joined'] = GMTimeStamp(); $_POST['LastActive'] = GMTimeStamp();
 $_POST['Signature'] = ""; $_POST['Interests'] = "";
 $_POST['Title'] = ""; $_POST['PostCount'] = "0";
-if($Settings['AdminValidate']==true||$Settings['AdminValidate']!=false)
+if($Settings['AdminValidate']=="on"||$Settings['AdminValidate']!="off")
 { $ValidateStats="no"; $yourgroup=$Settings['ValidateGroup']; }
-if($Settings['AdminValidate']==false)
+if($Settings['AdminValidate']=="on")
 { $ValidateStats="yes"; $yourgroup=$Settings['MemberGroup']; }
 $HashSalt = salt_hmac(); 
 $NewPassword = b64e_hmac($_POST['Password'],$_POST['Joined'],$HashSalt,"sha1");
 $_GET['YourPost'] = $_POST['Signature'];
 //require( './'.$SettDir['misc'].'HTMLTags.php');
-$_GET['YourPost'] = htmlspecialchars($_GET['YourPost'], ENT_QUOTES);
-$_GET['YourPost'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_GET['YourPost']);
+$_GET['YourPost'] = htmlspecialchars($_GET['YourPost'], ENT_QUOTES, $Settings['charset']);
+//$_GET['YourPost'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_GET['YourPost']);
 $NewSignature = $_GET['YourPost'];
 $_GET['YourPost'] = preg_replace("/\t+/"," ",$_GET['YourPost']);
 $_GET['YourPost'] = preg_replace("/\s\s+/"," ",$_GET['YourPost']);
 $_GET['YourPost'] = remove_bad_entities($_GET['YourPost']);
-$Avatar = stripcslashes(htmlspecialchars($_POST['Avatar'], ENT_QUOTES));
-$Avatar = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $Avatar);
+$Avatar = stripcslashes(htmlspecialchars($_POST['Avatar'], ENT_QUOTES, $Settings['charset']));
+//$Avatar = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $Avatar);
 $Avatar = @remove_spaces($Avatar);
-$Website = stripcslashes(htmlspecialchars($_POST['Website'], ENT_QUOTES));
-$Website = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $Website);
+$Website = stripcslashes(htmlspecialchars($_POST['Website'], ENT_QUOTES, $Settings['charset']));
+//$Website = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $Website);
 $Website = @remove_spaces($Website);
-$gquerys = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `Name`='%s'", array($yourgroup));
+$gquerys = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `Name`='%s' LIMIT 1", array($yourgroup));
 $gresults=mysql_query($gquerys);
 $yourgroup=mysql_result($gresults,0,"id");
 @mysql_free_result($gresults);
@@ -675,9 +929,9 @@ if(!is_numeric($_POST['MinOffSet'])) { $_POST['MinOffSet'] = "00"; }
 if($_POST['MinOffSet']>59) { $_POST['MinOffSet'] = "59"; }
 if($_POST['MinOffSet']<0) { $_POST['MinOffSet'] = "00"; }
 $_POST['YourOffSet'] = $_POST['YourOffSet'].":".$_POST['MinOffSet'];
-$query = query("INSERT INTO `".$Settings['sqltable']."members` VALUES (".$yourid.",'%s','%s','%s','%s','%s','%s',%i,'%s','%s',%i,%i,'0','0','0','%s','%s','%s','%s','%s','%s',%i,'%s','%s','%s','%s','%s')", array($Name,$NewPassword,"iDBH",$_POST['Email'],$yourgroup,$ValidateStats,"0",$_POST['Interests'],$_POST['Title'],$_POST['Joined'],$_POST['LastActive'],$NewSignature,'Your Notes',$Avatar,"100x100",$Website,$_POST['YourGender'],$_POST['PostCount'],$_POST['YourOffSet'],$_POST['DST'],$Settings['DefaultTheme'],$_POST['UserIP'],$HashSalt));
+$query = query("INSERT INTO `".$Settings['sqltable']."members` VALUES (".$yourid.",'%s','%s','%s','%s','%s','%s',%i,'%s','%s',%i,%i,'0','0','0','0','%s','%s','%s','%s','%s','%s',%i,0,0,10,10,10,'%s','%s','%s','%s','%s')", array($Name,$NewPassword,"iDBH",$_POST['Email'],$yourgroup,$ValidateStats,"0",$_POST['Interests'],$_POST['Title'],$_POST['Joined'],$_POST['LastActive'],$NewSignature,'Your Notes',$Avatar,"100x100",$Website,$_POST['YourGender'],$_POST['PostCount'],$_POST['YourOffSet'],$_POST['DST'],$Settings['DefaultTheme'],$_POST['UserIP'],$HashSalt));
 mysql_query($query);
-$querylogr = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `Name`='%s' AND `Password`='%s'", array($Name,$NewPassword));
+$querylogr = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `Name`='%s' AND `Password`='%s' LIMIT 1", array($Name,$NewPassword));
 $resultlogr=mysql_query($querylogr);
 $numlogr=mysql_num_rows($resultlogr);
 if($numlogr>=1) {
@@ -685,7 +939,7 @@ $ir=0;
 $YourIDMr=mysql_result($resultlogr,$ir,"id");
 $YourNameMr=mysql_result($resultlogr,$ir,"Name");
 $YourGroupMr=mysql_result($resultlogr,$ir,"GroupID");
-$gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i", array($YourGroupMr));
+$gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i LIMIT 1", array($YourGroupMr));
 $gresult=mysql_query($gquery);
 $YourGroupMr=mysql_result($gresult,0,"Name");
 @mysql_free_result($gresult);
@@ -701,10 +955,20 @@ $_SESSION['UserDST']=$YourDSTMr;
 $_SESSION['UserGroup']=$YourGroupMr;
 $_SESSION['UserPass']=$NewPassword;
 $_SESSION['DBName']=$Settings['sqldb'];
-if($_POST['storecookie']==true) {
-@setcookie("MemberName", $YourNameM, time() + (7 * 86400), $basedir);
-@setcookie("UserID", $YourIDM, time() + (7 * 86400), $basedir);
-@setcookie("SessPass", $NewPassword, time() + (7 * 86400), $basedir); }
+if($_POST['storecookie']=="true") {
+if($cookieDomain==null) {
+@setcookie("MemberName", $YourNameM, time() + (7 * 86400), $cbasedir);
+@setcookie("UserID", $YourIDM, time() + (7 * 86400), $cbasedir);
+@setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir); }
+if($cookieDomain!=null) {
+if($cookieSecure===true) {
+@setcookie("MemberName", $YourNameM, time() + (7 * 86400), $cbasedir, $cookieDomain, 1);
+@setcookie("UserID", $YourIDM, time() + (7 * 86400), $cbasedir, $cookieDomain, 1);
+@setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir, $cookieDomain, 1); }
+if($cookieSecure===false) {
+@setcookie("MemberName", $YourNameM, time() + (7 * 86400), $cbasedir, $cookieDomain);
+@setcookie("UserID", $YourIDM, time() + (7 * 86400), $cbasedir, $cookieDomain);
+@setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir, $cookieDomain); } } }
 /*
 $SendPMtoID=$_SESSION['UserID'];
 $YourPMID = 1;
@@ -719,15 +983,19 @@ $query = query("INSERT INTO `".$Settings['sqltable']."messenger` VALUES (null,%i
 <tr>
        <td><span class="TableMessage">
        <br />Welcome to the Board <?php echo $_SESSION['MemberName']; ?>. ^_^<br />
-       Click <a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">here</a> to continue to board.<br />&nbsp;
-       </span></td>
+       Click <a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">here</a> to continue to board.<?php echo "\n"; 
+       if($Settings['AdminValidate']=="on"||$Settings['AdminValidate']!="off") {
+       echo "<br />The admin has to validate your account befoure you can post.\n";
+       echo "<br />The admin has been notified of your registration.\n"; } ?>
+       <br />&nbsp;
+       </span><br /></td>
 </tr>
 <?php } ?>
 </table>
 </td></tr>
 <tr class="TableRow4">
-<td class="TableRow4">&nbsp;</td>
+<td class="TableColumn4">&nbsp;</td>
 </tr>
 </table></div>
-<?php } } ?>
-<div>&nbsp;</div>
\ No newline at end of file
+<?php } } ?>
+<div class="DivMembers">&nbsp;</div>
\ No newline at end of file