OSDN Git Service

Add files via upload
authorKazuki Suzuki Przyborowski <kazuki.przyborowski@gmail.com>
Thu, 13 Sep 2018 05:13:02 +0000 (00:13 -0500)
committerGitHub <noreply@github.com>
Thu, 13 Sep 2018 05:13:02 +0000 (00:13 -0500)
admin/categories.php [new file with mode: 0644]
admin/forums.php [new file with mode: 0644]
admin/groups.php [new file with mode: 0644]
admin/members.php [new file with mode: 0644]
versioninfo.php [new file with mode: 0644]

diff --git a/admin/categories.php b/admin/categories.php
new file mode 100644 (file)
index 0000000..282e454
--- /dev/null
@@ -0,0 +1,922 @@
+<?php
+/*
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the Revised BSD License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    Revised BSD License for more details.
+
+    Copyright 2004-2017 iDB Support - http://idb.berlios.de/
+    Copyright 2004-2017 Game Maker 2k - http://gamemaker2k.org/
+
+    $FileInfo: categories.php - Last Update: 09/13/2018 SVN 875 - Author: cooldude2k $
+*/
+$File3Name = basename($_SERVER['SCRIPT_NAME']);
+if ($File3Name=="categories.php"||$File3Name=="/categories.php") {
+       require('index.php');
+       exit(); }
+
+// Check if we can goto admin cp
+if($_SESSION['UserGroup']==$Settings['GuestGroup']||$GroupInfo['HasAdminCP']=="no") {
+redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if(!isset($_POST['update'])) { $_POST['update'] = null; }
+$Error = null; $errorstr = null;
+?>
+<table class="Table3">
+<tr style="width: 100%; vertical-align: top;">
+       <td style="width: 15%; vertical-align: top;">
+<?php 
+require($SettDir['admin'].'table.php'); 
+?>
+</td>
+       <td style="width: 85%; vertical-align: top;">
+<?php if($_GET['act']=="addcategory"&&$_POST['update']!="now") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Adding new Category";
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addcategory",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addcategory",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Adding new Category: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addcategory",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CategoryID">Insert ID for category:</label></td>
+       <td style="width: 50%;"><input type="number" name="CategoryID" class="TextBox" id="CategoryID" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="OrderID">Insert order id category:</label></td>
+       <td style="width: 50%;"><input type="number" name="OrderID" class="TextBox" id="OrderID" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CategoryName">Insert name for category:</label></td>
+       <td style="width: 50%;"><input type="text" name="CategoryName" class="TextBox" id="CategoryName" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CategoryDesc">Insert description for category:</label></td>
+       <td style="width: 50%;"><input type="text" name="CategoryDesc" class="TextBox" id="CategoryDesc" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ShowCategory">Show category:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="ShowCategory" id="ShowCategory">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CategoryType">Insert category type:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CategoryType" id="CategoryType">
+       <option selected="selected" value="category">Category</option>
+       <option value="subcategory">SubCategory</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="InSubCategory">In SubCategory:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="InSubCategory" id="InSubCategory">
+       <option selected="selected" value="0">none</option>
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"InSubCategory\"=0 AND \"CategoryType\"='subcategory' ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$InCategoryID=sql_result($fr,$fi,"id");
+$InCategoryName=sql_result($fr,$fi,"Name");
+$InCategoryType=sql_result($fr,$fi,"CategoryType");
+$AiFiInSubCategory=sql_result($fr,$fi,"InSubCategory");
+if ($AiFiInSubCategory=="0") {
+?>
+       <option value="<?php echo $InCategoryID; ?>"><?php echo $InCategoryName; ?></option>
+<?php } ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NumPostView">Number of posts to view category:</label></td>
+       <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumPostView" id="NumPostView" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NumKarmaView">Amount of karma to view category:</label></td>
+       <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumKarmaView" id="NumKarmaView" /></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="addcategory" style="display: none;" />
+<input type="hidden" name="update" value="now" style="display: none;" />
+<input type="submit" class="Button" value="Add Category" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_POST['act']=="addcategory"&&$_POST['update']=="now"&&$_GET['act']=="addcategory") {
+$_POST['CategoryName'] = stripcslashes(htmlspecialchars($_POST['CategoryName'], ENT_QUOTES, $Settings['charset']));
+//$_POST['CategoryName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['CategoryName']);
+$_POST['CategoryName'] = remove_spaces($_POST['CategoryName']);
+$_POST['CategoryDesc'] = stripcslashes(htmlspecialchars($_POST['CategoryDesc'], ENT_QUOTES, $Settings['charset']));
+//$_POST['CategoryDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['CategoryDesc']);
+$_POST['CategoryDesc'] = remove_spaces($_POST['CategoryDesc']);
+$sql_id_check = sql_query(sql_pre_query("SELECT \"id\" FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i LIMIT 1", array($_POST['CategoryID'])),$SQLStat);
+$sql_order_check = sql_query(sql_pre_query("SELECT \"OrderID\" FROM \"".$Settings['sqltable']."categories\" WHERE \"OrderID\"=%i LIMIT 1", array($_POST['OrderID'])),$SQLStat);
+$id_check = sql_num_rows($sql_id_check); $order_check = sql_num_rows($sql_order_check);
+sql_free_result($sql_id_check); sql_free_result($sql_order_check);
+$errorstr = "";
+if ($_POST['NumPostView']==null||
+       !is_numeric($_POST['NumPostView'])) {
+       $_POST['NumPostView'] = 0; }
+if ($_POST['NumKarmaView']==null||
+       !is_numeric($_POST['NumKarmaView'])) {
+       $_POST['NumKarmaView'] = 0; }
+if ($_POST['CategoryName']==null||
+       $_POST['CategoryName']=="ShowMe") { $Error="Yes";
+$errorstr = $errorstr."You need to enter a category name.<br />\n"; } 
+if ($_POST['CategoryDesc']==null) { $Error="Yes";
+$errorstr = $errorstr."You need to enter a description.<br />\n"; } 
+if ($_POST['CategoryID']==null||
+       !is_numeric($_POST['CategoryID'])) { $Error="Yes";
+$errorstr = $errorstr."You need to enter a category id.<br />\n"; } 
+if($id_check > 0) { $Error="Yes";
+$errorstr = $errorstr."This ID number is already used.<br />\n"; } 
+if($order_check > 0) { $Error="Yes"; 
+$errorstr = $errorstr."This order number is already used.<br />\n"; } 
+if (pre_strlen($_POST['CategoryName'])>"150") { $Error="Yes";
+$errorstr = $errorstr."Your category name is too big.<br />\n"; } 
+if (pre_strlen($_POST['CategoryDesc'])>"300") { $Error="Yes";
+$errorstr = $errorstr."Your category description is too big.<br />\n"; } 
+if ($Error!="Yes") {
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."categories\" (\"id\", \"OrderID\", \"Name\", \"ShowCategory\", \"CategoryType\", \"SubShowForums\", \"InSubCategory\", \"PostCountView\", \"KarmaCountView\", \"Description\") VALUES\n".
+"(%i, %i, '%s', '%s', '%s', 'yes', %i, %i, %i, '%s')", array($_POST['CategoryID'],$_POST['OrderID'],$_POST['CategoryName'],$_POST['ShowCategory'],$_POST['CategoryType'],$_POST['InSubCategory'],$_POST['NumPostView'],$_POST['NumKarmaView'],$_POST['CategoryDesc']));
+sql_query($query,$SQLStat);
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="sqlite"||
+       $Settings['sqltype']=="sqlite3") {
+$getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."catpermissions\" ORDER BY \"PermissionID\" ASC", array(null)); }
+if($Settings['sqltype']=="cubrid") {
+$getperidq = sql_pre_query("SELECT DISTINCT \"permissionid\" FROM \"".$Settings['sqltable']."catpermissions\" ORDER BY \"PermissionID\" ASC", array(null)); }
+$getperidr=sql_query($getperidq,$SQLStat);
+$getperidnum=sql_num_rows($getperidr);
+$getperidi = 0; 
+//$nextperid = sql_get_next_id($Settings['sqltable'],"catpermissions",$SQLStat);
+$nextperid = null;
+while ($getperidi < $getperidnum) {
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
+       $Settings['sqltype']=="sqlite3") {
+$getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
+if($Settings['sqltype']=="sqlite") {
+$getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
+$getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"PermissionID\"=%i", array($getperidID));
+$getperidr2=sql_query($getperidq2,$SQLStat);
+$getperidnum2=sql_num_rows($getperidr2);
+$getperidName=sql_result($getperidr2,0,"Name");
+sql_free_result($getperidr2);
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES (%i, '%s', %i, 'yes')", array($getperidID,$getperidName,$_POST['CategoryID'])); 
+sql_query($query,$SQLStat);
+++$getperidi; /*++$nextperid;*/ }
+sql_free_result($getperidr); } } 
+if($_GET['act']=="deletecategory"&&$_POST['update']!="now") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Deleting a Category";
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addcategory",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addcategory",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Deleting a Category: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=deletecategory",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="DelCategories">Delete all categories in subcategory:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="DelCategories" id="DelCategories">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="DelForums">Delete all forums in (sub)category:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="DelForums" id="DelForums">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="DelTopics">Delete all topics in (sub)category:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="DelTopics" id="DelTopics">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="DelPermission">Delete all permission sets in (sub)category:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="DelPermission" id="DelPermission">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="DelID">Delete Category:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="DelID" id="DelID">
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$InCategoryID=sql_result($fr,$fi,"id");
+$InCategoryName=sql_result($fr,$fi,"Name");
+$InCategoryType=sql_result($fr,$fi,"CategoryType");
+$AiFiInSubCategory=sql_result($fr,$fi,"InSubCategory");
+?>
+       <option value="<?php echo $InCategoryID; ?>"><?php echo $InCategoryName; ?></option>
+<?php ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="deletecategory" style="display: none;" />
+<input type="hidden" name="update" value="now" style="display: none;" />
+<input type="submit" class="Button" value="Delete Category" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_GET['act']=="deletecategory"&&$_POST['update']=="now"&&$_GET['act']=="deletecategory") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i LIMIT 1", array($_POST['DelID']));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+$errorstr = ""; $Error = null;
+if (!is_numeric($_POST['DelID'])) { $Error="Yes";
+$errorstr = $errorstr."You need to enter a forum ID.<br />\n"; } 
+if($prenum>0&&$Error!="Yes") {
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i", array($_POST['DelID']));
+sql_query($dtquery,$SQLStat);
+if($_POST['DelCategories']=="yes") {
+$dscquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."categories\" WHERE \"InSubCategory\"=%i", array($_POST['DelID']));
+sql_query($dscquery,$SQLStat); }
+if($_POST['DelForums']=="yes") {
+$dsfquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."forums\" WHERE \"CategoryID\"=%i", array($_POST['DelID']));
+sql_query($dsfquery,$SQLStat); }
+if($_POST['DelForums']=="yes") {
+$dstquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."topics\" WHERE \"CategoryID\"=%i", array($_POST['DelID']));
+sql_query($dstquery,$SQLStat); }
+if($_POST['DelForums']=="yes") {
+$dstquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."topics\" WHERE \"CategoryID\"=%i", array($_POST['DelID']));
+sql_query($dstquery,$SQLStat);
+$dstquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."posts\" WHERE \"CategoryID\"=%i", array($_POST['DelID']));
+sql_query($dstquery,$SQLStat); }
+if($_POST['DelPermission']=="yes") {
+$apcquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"CategoryID\"=%i ORDER BY \"OrderID\" ASC, \"id\" ASC", array($_POST['DelID']));
+$apcresult=sql_query($apcquery,$SQLStat);
+$apcnum=sql_num_rows($apcresult);
+$apci=0; $apcl=1; if($apcnum>=1) {
+while ($apci < $apcnum) {
+$DelForumID=sql_result($apcresult,$apci,"id");
+if($_POST['DelPermission']=="yes") {
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."permissions\" WHERE \"ForumID\"=%i", array($DelForumID));
+sql_query($dtquery,$SQLStat); }
+++$apci; }
+sql_free_result($apcresult); } }
+if($_POST['DelPermission']=="yes") {
+$apcquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"InSubCategory\"=%i ORDER BY \"OrderID\" ASC, \"id\" ASC", array($_POST['DelID']));
+$apcresult=sql_query($apcquery,$SQLStat);
+$apcnum=sql_num_rows($apcresult);
+$apci=0; $apcl=1; if($apcnum>=1) {
+while ($apci < $apcnum) {
+$DelSubsCategoryID=sql_result($apcresult,$apci,"id");
+if($_POST['DelPermission']=="yes") {
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"CategoryID\"=%i", array($DelSubsCategoryID));
+sql_query($dtquery,$SQLStat); }
+++$apci; }
+sql_free_result($apcresult); } }
+?>
+<?php } } if($_GET['act']=="editcategory"&&$_POST['update']!="now") {
+$admincptitle = " ".$ThemeSet['TitleDivider']." Editing a Category";
+if(!isset($_POST['id'])) {
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editcategory",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editcategory",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Editing a Category: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editcategory",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="id">Category to Edit:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$InCategoryID=sql_result($fr,$fi,"id");
+$InCategoryName=sql_result($fr,$fi,"Name");
+$InCategoryType=sql_result($fr,$fi,"CategoryType");
+$AiFiInSubCategory=sql_result($fr,$fi,"InSubCategory");
+?>
+       <option value="<?php echo $InCategoryID; ?>"><?php echo $InCategoryName; ?></option>
+<?php ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="editcategory" style="display: none;" />
+<input type="submit" class="Button" value="Edit Category" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if(isset($_POST['id'])) { 
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false)); sql_free_result($preresult);
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if($prenum>=1) {
+$CategoryID=sql_result($preresult,0,"id");
+$CategoryOrder=sql_result($preresult,0,"OrderID");
+$CategoryName=sql_result($preresult,0,"Name");
+$ShowCategory=sql_result($preresult,0,"ShowCategory");
+$CategoryType=sql_result($preresult,0,"CategoryType");
+$SubShowForums=sql_result($preresult,0,"SubShowForums");
+$InSubCategory=sql_result($preresult,0,"InSubCategory");
+$CategoryDescription=sql_result($preresult,0,"Description");
+$KarmaCountView=sql_result($preresult,0,"KarmaCountView");
+$PostCountView=sql_result($preresult,0,"PostCountView");
+sql_free_result($preresult);
+$CategoryType = strtolower($CategoryType);
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editcategory",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editcategory",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Editing a Category: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editcategory",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CategoryID">Insert id for category:</label></td>
+       <td style="width: 50%;"><input type="number" name="CategoryID" class="TextBox" id="CategoryID" size="20" value="<?php echo $CategoryID; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="OrderID">Insert order id category:</label></td>
+       <td style="width: 50%;"><input type="number" name="OrderID" class="TextBox" id="OrderID" size="20" value="<?php echo $CategoryOrder; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CategoryName">Insert name for category:</label></td>
+       <td style="width: 50%;"><input type="text" name="CategoryName" class="TextBox" id="CategoryName" size="20" value="<?php echo $CategoryName; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CategoryDesc">Insert description for category:</label></td>
+       <td style="width: 50%;"><input type="text" name="CategoryDesc" class="TextBox" id="CategoryDesc" size="20" value="<?php echo $CategoryDescription; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ShowCategory">Show category:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="ShowCategory" id="ShowCategory">
+       <option <?php if($ShowCategory=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($ShowCategory=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CategoryType">Insert category type:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CategoryType" id="CategoryType">
+       <option <?php if($CategoryType=="category") { echo "selected=\"selected\" "; } ?>value="category">Category</option>
+       <option <?php if($CategoryType=="subcategory") { echo "selected=\"selected\" "; } ?>value="subcategory">SubCategory</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="InSubCategory">In SubCategory:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="InSubCategory" id="InSubCategory">
+       <option selected="selected" value="0">none</option>
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"InSubCategory\"=0 AND \"id\"<>%i AND \"CategoryType\"='subcategory' ORDER BY \"OrderID\" ASC, \"id\" ASC", array($CategoryID));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$InCategoryID=sql_result($fr,$fi,"id");
+$InCategoryName=sql_result($fr,$fi,"Name");
+$InCategoryType=sql_result($fr,$fi,"CategoryType");
+$AiFiInSubCategory=sql_result($fr,$fi,"InSubCategory");
+if ($AiFiInSubCategory=="0") {
+if($InSubCategory==$InCategoryID) {
+?>
+       <option value="<?php echo $InCategoryID; ?>" selected="selected"><?php echo $InCategoryName; ?></option>
+<?php } if($InSubCategory!=$InCategoryID) { ?>
+       <option value="<?php echo $InCategoryID; ?>"><?php echo $InCategoryName; ?></option>
+<?php } } ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NumPostView">Number of posts to view categories:</label></td>
+       <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumPostView" id="NumPostView" value="<?php echo $PostCountView; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NumKarmaView">Amount of karma to view categories:</label></td>
+       <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumKarmaView" id="NumKarmaView" value="<?php echo $KarmaCountView; ?>" /></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="editcategory" style="display: none;" />
+<input type="hidden" name="update" value="now" style="display: none;" />
+<input type="hidden" name="id" value="<?php echo $CategoryID; ?>" style="display: none;" />
+<input type="submit" class="Button" value="Edit Category" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } } } if($_POST['act']=="editcategory"&&$_POST['update']=="now"&&$_GET['act']=="editcategory"&&
+       isset($_POST['id'])) {
+$_POST['CategoryName'] = stripcslashes(htmlspecialchars($_POST['CategoryName'], ENT_QUOTES, $Settings['charset']));
+//$_POST['CategoryName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['CategoryName']);
+$_POST['CategoryName'] = remove_spaces($_POST['CategoryName']);
+$_POST['CategoryDesc'] = stripcslashes(htmlspecialchars($_POST['CategoryDesc'], ENT_QUOTES, $Settings['charset']));
+//$_POST['CategoryDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['CategoryDesc']);
+$_POST['CategoryDesc'] = remove_spaces($_POST['CategoryDesc']);
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false)); sql_free_result($preresult);
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if($prenum>=1) {
+$OldID=sql_result($preresult,0,"id");
+$OldOrder=sql_result($preresult,0,"OrderID");
+sql_free_result($preresult);
+$sql_id_check = sql_query(sql_pre_query("SELECT \"id\" FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i LIMIT 1", array($_POST['ForumID'])),$SQLStat);
+$sql_order_check = sql_query(sql_pre_query("SELECT \"OrderID\" FROM \"".$Settings['sqltable']."categories\" WHERE \"OrderID\"=%i LIMIT 1", array($_POST['OrderID'])),$SQLStat);
+$id_check = sql_num_rows($sql_id_check); $order_check = sql_num_rows($sql_order_check);
+sql_free_result($sql_id_check); sql_free_result($sql_order_check);
+if ($_POST['NumPostView']==null||
+       !is_numeric($_POST['NumPostView'])) {
+       $_POST['NumPostView'] = 0; }
+if ($_POST['NumKarmaView']==null||
+       !is_numeric($_POST['NumKarmaView'])) {
+       $_POST['NumKarmaView'] = 0; }
+if ($_POST['CategoryName']==null||
+       $_POST['CategoryName']=="ShowMe") { $Error="Yes";
+$errorstr = $errorstr."You need to enter a category name.<br />\n"; } 
+if ($_POST['CategoryDesc']==null) { $Error="Yes";
+$errorstr = $errorstr."You need to enter a description.<br />\n"; } 
+if ($_POST['CategoryID']==null||
+       !is_numeric($_POST['CategoryID'])) { $Error="Yes";
+$errorstr = $errorstr."You need to enter a category ID.<br />\n"; } 
+if($id_check > 0&&$_POST['CategoryID']!=$OldID) { $Error="Yes";
+$errorstr = $errorstr."This ID number is already used.<br />\n"; } 
+if($order_check > 0&&$_POST['OrderID']!=$OldOrder) { $Error="Yes"; 
+$errorstr = $errorstr."This order number is already used.<br />\n"; } 
+if (pre_strlen($_POST['CategoryName'])>"150") { $Error="Yes";
+$errorstr = $errorstr."Your category name is too big.<br />\n"; } 
+if (pre_strlen($_POST['CategoryDesc'])>"300") { $Error="Yes";
+$errorstr = $errorstr."Your category description is too big.<br />\n"; } 
+if ($Error!="Yes") {
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."categories\" SET \"id\"=%i,\"OrderID\"=%i,\"Name\"='%s',\"ShowCategory\"='%s',\"CategoryType\"='%s',\"InSubCategory\"=%i,\"Description\"='%s',\"PostCountView\"=%i,\"KarmaCountView\"=%i WHERE \"id\"=%i", array($_POST['CategoryID'],$_POST['OrderID'],$_POST['CategoryName'],$_POST['ShowCategory'],$_POST['CategoryType'],$_POST['InSubCategory'],$_POST['CategoryDesc'],$_POST['NumPostView'],$_POST['NumKarmaView'],$_POST['id']));
+sql_query($query,$SQLStat); 
+$queryz = sql_pre_query("UPDATE \"".$Settings['sqltable']."catpermissions\" SET \"CategoryID\"=%i WHERE \"CategoryID\"=%i", array($_POST['CategoryID'],$_POST['id']));
+sql_query($queryz,$SQLStat); 
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"CategoryID\"=%i WHERE \"CategoryID\"=%i", array($_POST['CategoryID'],$_POST['id']));
+sql_query($query,$SQLStat);
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"CategoryID\"=%i,\"OldCategoryID\"=%i WHERE \"CategoryID\"=%i", array($_POST['CategoryID'],$_POST['CategoryID'],$_POST['id']));
+sql_query($query,$SQLStat);
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."posts\" SET \"CategoryID\"=%i WHERE \"CategoryID\"=%i", array($_POST['CategoryID'],$_POST['id']));
+sql_query($query,$SQLStat); } } } 
+if($_GET['act']=="cpermissions"&&$_POST['update']!="now") {
+$admincptitle = " ".$ThemeSet['TitleDivider']." Category Permissions Manager";
+if(!isset($_POST['id'])) {
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=cpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=cpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Category Permissions Manager: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=cpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="id">Permission to view:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
+<?php 
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="sqlite"||
+       $Settings['sqltype']=="sqlite3") {
+$getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."catpermissions\"", array(null)); }
+if($Settings['sqltype']=="cubrid") {
+$getperidq = sql_pre_query("SELECT DISTINCT \"permissionid\" FROM \"".$Settings['sqltable']."catpermissions\"", array(null)); }
+$getperidr=sql_query($getperidq,$SQLStat);
+$getperidnum=sql_num_rows($getperidr);
+$getperidi = 0;
+while ($getperidi < $getperidnum) {
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
+       $Settings['sqltype']=="sqlite3") {
+$getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
+if($Settings['sqltype']=="sqlite") {
+$getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
+$getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"PermissionID\"=%i ORDER BY \"CategoryID\" ASC", array($getperidID));
+$getperidr2=sql_query($getperidq2,$SQLStat);
+$getperidnum2=sql_num_rows($getperidr2);
+$getperidName=sql_result($getperidr2,0,"Name");
+sql_free_result($getperidr2);
+?>
+       <option value="<?php echo $getperidID; ?>"><?php echo $getperidName; ?></option>
+<?php ++$getperidi; }
+sql_free_result($getperidr); ?>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="cpermissions" style="display: none;" />
+<input type="submit" class="Button" value="View Permission" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if(isset($_POST['id'])&&$_POST['subact']==null) { ?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=cpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=cpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Category Permissions Manager: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$InCategoryID=sql_result($fr,$fi,"id");
+$InCategoryName=sql_result($fr,$fi,"Name");
+$getperidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"PermissionID\"=%i AND \"CategoryID\"=%i LIMIT 1", array($_POST['id'],$InCategoryID));
+$getperidr=sql_query($getperidq,$SQLStat);
+$getperidnum=sql_num_rows($getperidr);
+$getperidNumz = null;
+$getperidID = null;
+if($getperidnum>0) {
+$getperidNumz=sql_result($getperidr,0,"id");
+$getperidID=sql_result($getperidr,0,"PermissionID"); }
+?>
+<form style="display: inline;" method="post" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=cpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<?php if($getperidnum>0) { ?>
+Permissions for <?php echo $InCategoryName; ?> are set: <br />
+<input type="hidden" name="act" value="cpermissions" style="display: none;" />
+<input type="hidden" name="subact" value="edit" style="display: none;" />
+<input type="hidden" name="id" value="<?php echo $getperidNumz; ?>" style="display: none;" />
+<input type="submit" class="Button" value="Edit Permissions" name="Apply_Changes" />
+<?php } if($getperidnum<=0) { ?>
+Permissions for <?php echo $InCategoryName; ?> are not set: <br />
+<input type="hidden" name="act" value="cpermissions" style="display: none;" />
+<input type="hidden" name="subact" value="create" style="display: none;" />
+<input type="hidden" name="permid" value="<?php echo $_POST['id']; ?>" style="display: none;" />
+<input type="hidden" name="id" value="<?php echo $InCategoryID; ?>" style="display: none;" />
+<input type="submit" class="Button" value="Create Permissions" name="Apply_Changes" />
+<?php } ?>
+</td></tr></table>
+</form>
+<?php 
+sql_free_result($getperidr);
+++$fi; }
+sql_free_result($fr); ?>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if(isset($_POST['id'])&&$_POST['subact']=="edit") {
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false)); sql_free_result($preresult);
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if($prenum>=1) {
+$PermissionNum=sql_result($preresult,0,"id"); 
+$PermissionID=sql_result($preresult,0,"PermissionID"); 
+$PermissionName=sql_result($preresult,0,"Name"); 
+$PermissionCategoryID=sql_result($preresult,0,"CategoryID"); 
+$CanViewCategory=sql_result($preresult,0,"CanViewCategory");
+sql_free_result($preresult); }
+$PermissionName = stripcslashes(htmlspecialchars($PermissionName, ENT_QUOTES, $Settings['charset']));
+//$_POST['CategoryName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['CategoryName']);
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=cpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=cpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Editing Category Permissions: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=cpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewCategory">Can view Category:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewCategory" id="CanViewCategory">
+       <option <?php if($CanViewCategory=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanViewCategory=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+</table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="cpermissions" style="display: none;" />
+<input type="hidden" name="subact" value="editnow" style="display: none;" />
+<input type="hidden" name="id" value="<?php echo $PermissionNum; ?>" style="display: none;" />
+<input type="submit" class="Button" value="Edit Permissions" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if(isset($_POST['id'])&&$_POST['subact']=="editnow") {
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."catpermissions\" SET \"CanViewCategory\"='%s' WHERE \"id\"=%i", array($_POST['CanViewCategory'], $_POST['id']));
+sql_query($query,$SQLStat); } if(isset($_POST['id'])&&$_POST['subact']=="create") { 
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=cpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=cpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Editing Category Permissions: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=cpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewCategory">Can view category:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewCategory" id="CanViewCategory">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="cpermissions" style="display: none;" />
+<input type="hidden" name="subact" value="makenow" style="display: none;" />
+<input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" style="display: none;" />
+<input type="hidden" name="permid" value="<?php echo $_POST['permid']; ?>" style="display: none;" />
+<input type="submit" class="Button" value="Create Permissions" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") {
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"id\"=%i LIMIT 1", array($_POST['permid']));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false)); sql_free_result($preresult);
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if($prenum>=1) {
+$PermissionName=sql_result($preresult,0,"Name"); 
+sql_free_result($preresult); }
+//$nextidnum = sql_get_next_id($Settings['sqltable'],"catpermissions",$SQLStat);
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES\n".
+"(%i, '%s', %i, '%s')", array($_POST['permid'], $PermissionName, $_POST['id'], $_POST['CanViewCategory'])); 
+sql_query($query,$SQLStat); } } $doupdate = false;
+if(isset($_POST['id'])&&$_POST['subact']=="editnow") { 
+       $doupdate = true; }
+if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") { 
+       $doupdate = true; }
+if($_POST['act']=="addcategory"&&$_POST['update']=="now"&&$_GET['act']=="addcategory") { 
+       $doupdate = true; }
+if($_GET['act']=="deletecategory"&&$_POST['update']=="now"&&$_GET['act']=="deletecategory") { 
+       $doupdate = true; }
+if($_POST['act']=="editcategory"&&$_POST['update']=="now"&&$_GET['act']=="editcategory"&&
+       isset($_POST['id'])) { 
+       $doupdate = true; }
+if($doupdate===true&&$Error!="Yes") { ?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr id="ProfileTitle" class="TableMenuRow2">
+<th class="TableMenuColumn2">Updating Settings</th>
+</tr>
+<tr class="TableMenuRow3" id="ProfileUpdate">
+<td class="TableMenuColumn3">
+<?php if(isset($_POST['id'])&&$_POST['subact']=="editnow") { ?>
+<div style="text-align: center;">
+       <br />The permission was edited successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") { ?>
+<div style="text-align: center;">
+       <br />The permission was created successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } if($_POST['act']=="addcategory"&&$_POST['update']=="now"&&$_GET['act']=="addcategory") { ?>
+<div style="text-align: center;">
+       <br />The category was created successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } if($_GET['act']=="deletecategory"&&$_POST['update']=="now"&&$_GET['act']=="deletecategory") { ?>
+<div style="text-align: center;">
+       <br />The category was deleted successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } if($_POST['act']=="editcategory"&&$_POST['update']=="now"&&$_GET['act']=="editcategory"&&
+       isset($_POST['id'])) { ?>
+<div style="text-align: center;">
+       <br />The category was edited successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } ?>
+</td></tr>
+<tr id="ProfileTitleEnd" class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr></table></div>
+<?php } if ($_GET['act']!=null&&$Error=="Yes") {
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr id="ProfileTitle" class="TableMenuRow2">
+<th class="TableMenuColumn2">Updating Settings</th>
+</tr>
+<tr class="TableMenuRow3" id="ProfileUpdate">
+<td class="TableMenuColumn3">
+<div style="text-align: center;">
+       <br /><?php echo $errorstr; ?>
+       <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
+       </div>
+</td></tr>
+<tr id="ProfileTitleEnd" class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr></table></div>
+<?php } ?>
+</td></tr>
+</table>
+<div>&nbsp;</div>
diff --git a/admin/forums.php b/admin/forums.php
new file mode 100644 (file)
index 0000000..4b6bed4
--- /dev/null
@@ -0,0 +1,1559 @@
+<?php
+/*
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the Revised BSD License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    Revised BSD License for more details.
+
+    Copyright 2004-2017 iDB Support - http://idb.berlios.de/
+    Copyright 2004-2017 Game Maker 2k - http://gamemaker2k.org/
+
+    $FileInfo: forums.php - Last Update: 09/13/2018 SVN 875 - Author: cooldude2k $
+*/
+$File3Name = basename($_SERVER['SCRIPT_NAME']);
+if ($File3Name=="forums.php"||$File3Name=="/forums.php") {
+       require('index.php');
+       exit(); }
+
+// Check if we can goto admin cp
+if($_SESSION['UserGroup']==$Settings['GuestGroup']||$GroupInfo['HasAdminCP']=="no") {
+redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if(!isset($_POST['update'])) { $_POST['update'] = null; }
+$Error = null; $errorstr = null;
+?>
+<table class="Table3">
+<tr style="width: 100%; vertical-align: top;">
+       <td style="width: 15%; vertical-align: top;">
+<?php 
+require($SettDir['admin'].'table.php'); 
+?>
+</td>
+       <td style="width: 85%; vertical-align: top;">
+<?php if($_GET['act']=="retopics") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Recounting Topics";
+$query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
+$result=sql_query($query,$SQLStat);
+$num=sql_num_rows($result);
+$i=0;
+while ($i < $num) {
+$ForumID=sql_result($result,$i,"id");
+$tquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"ForumID\"=%i ORDER BY \"Pinned\" DESC, \"LastUpdate\" DESC", array($ForumID));
+$tresult=sql_query($tquery,$SQLStat);
+$tnum=sql_num_rows($tresult);
+$rquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"ForumID\"=%i ORDER BY \"TimeStamp\" ASC", array($ForumID));
+$rresult=sql_query($rquery,$SQLStat);
+$rnum=sql_num_rows($rresult);
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumPosts\"=%i,\"NumTopics\"=%i WHERE \"id\"=%i", array($rnum,$tnum,$ForumID));
+sql_query($query,$SQLStat);
+sql_free_result($tresult);
+sql_free_result($rresult);
+++$i; }
+sql_free_result($result);
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Recounting Topics</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Recounting Topics</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Recounting Topics: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<div style="text-align: center;">
+       <br />Forums Topics &amp; Posts stats recounted.<br />
+       <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
+</div>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_GET['act']=="rereplies") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Recounting Replies";
+$query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" ORDER BY \"Pinned\" DESC, \"LastUpdate\" DESC", array(null));
+$result=sql_query($query,$SQLStat);
+$num=sql_num_rows($result);
+$i=0;
+while ($i < $num) {
+$TopicID=sql_result($result,$i,"id");
+$rquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" ASC", array($TopicID));
+$rresult=sql_query($rquery,$SQLStat);
+$rnum=sql_num_rows($rresult);
+$Nrnum = $rnum - 1;
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"NumReply\"=%i WHERE \"id\"=%i", array($Nrnum,$TopicID));
+sql_query($query,$SQLStat);
+sql_free_result($rresult);
+++$i; }
+sql_free_result($result);
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Recounting Replies</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Recounting Replies</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Recounting Replies: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<div style="text-align: center;">
+       <br />Topics Replys stats recounted.<br />
+       <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
+</div>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_GET['act']=="fixtnames") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Fixing Topic User Names";
+$query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" ORDER BY \"TimeStamp\" ASC", array(null));
+$result=sql_query($query,$SQLStat);
+$num=sql_num_rows($result);
+$i=0;
+while ($i < $num) {
+$TopicID=sql_result($result,$i,"id");
+$UsersID=sql_result($result,$i,"UserID");
+$GuestsName=sql_result($result,$i,"GuestName");
+$NewUserID = $UsersID;
+$NewGuestsName = $GuestsName;
+$NewGuestsName = GetUserName($NewUserID,$Settings['sqltable']);
+$NewGuestsName = $NewGuestsName['Name'];
+if($UsersID==-1&&$GuestsName!=null) { $NewGuestsName = $GuestsName; }
+if($NewGuestsName==null&&$GuestsName!=null&&$UsersID!==0) {
+$NewUserID = -1; $NewGuestsName = $GuestsName; }
+if($UsersID==-1&&$GuestsName==null) {
+$NewUserID = -1; $NewGuestsName = "Guest"; }
+if($UsersID===0&&$GuestsName!=null) {
+$NewUserID = -1; $NewGuestsName = "Guest"; }
+if($UsersID===0&&$GuestsName==null) {
+$NewUserID = -1; $NewGuestsName = "Guest"; }
+if($UsersID==$NewUserID&&$GuestsName==$NewGuestsName) {
+$NewUserID = $UsersID; $NewGuestsName = $GuestsName; }
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"UserID\"=%i,\"GuestName\"='%s' WHERE \"id\"=%i", array($NewUserID,$NewGuestsName,$TopicID));
+sql_query($query,$SQLStat);
+++$i; }
+sql_free_result($result);
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Fixing Topic User Names</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Fixing Topic User Names</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Fixing Topic User Names: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<div style="text-align: center;">
+       <br />Topic User Names fixed.<br />
+       <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
+</div>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_GET['act']=="fixrnames") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Fixing Reply User Names";
+$query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" ORDER BY \"TimeStamp\" ASC", array(null));
+$result=sql_query($query,$SQLStat);
+$num=sql_num_rows($result);
+$i=0;
+while ($i < $num) {
+$PostID=sql_result($result,$i,"id");
+$UsersID=sql_result($result,$i,"UserID");
+$GuestsName=sql_result($result,$i,"GuestName");
+$NewUserID = $UsersID;
+$NewGuestsName = $GuestsName;
+$NewGuestsName = GetUserName($NewUserID,$Settings['sqltable']);
+$NewGuestsName = $NewGuestsName['Name'];
+if($UsersID==-1&&$GuestsName!=null) { $NewGuestsName = $GuestsName; }
+if($NewGuestsName==null&&$GuestsName!=null&&$UsersID!==0) {
+$NewUserID = -1; $NewGuestsName = $GuestsName; }
+if($UsersID==-1&&$GuestsName==null) {
+$NewUserID = -1; $NewGuestsName = "Guest"; }
+if($UsersID===0&&$GuestsName!=null) {
+$NewUserID = -1; $NewGuestsName = "Guest"; }
+if($UsersID===0&&$GuestsName==null) {
+$NewUserID = -1; $NewGuestsName = "Guest"; }
+if($UsersID==$NewUserID&&$GuestsName==$NewGuestsName) {
+$NewUserID = $UsersID; $NewGuestsName = $GuestsName; }
+$EditUserID=sql_result($result,$i,"EditUser");
+$EditUserName=sql_result($result,$i,"EditUserName");
+$NewEditUserID = $EditUserID;
+$NewEditUserName = $EditUserName;
+$NewEditUserName = GetUserName($NewEditUserID,$Settings['sqltable']);
+$NewEditUserName = $NewEditUserName['Name'];
+if($EditUserID==-1&&$EditUserName!=null) { $NewEditUserName = $EditUserName; }
+if($NewEditUserName==null&&$EditUserName!=null&&$EditUserID!==0) {
+$NewEditUserID = -1; $NewEditUserName = $EditUserName; }
+if($EditUserID==-1&&$EditUserName==null) {
+$NewEditUserID = -1; $NewEditUserName = "Guest"; }
+if($EditUserID===0&&$EditUserName!=null) {
+$NewEditUserID = "0"; $NewEditUserName = null; }
+if($EditUserID===0&&$EditUserName==null) {
+$NewEditUserID = "0"; $NewEditUserName = null; }
+if($EditUserID==$NewEditUserID&&$EditUserName==$NewEditUserName) {
+$NewEditUserID = $EditUserID; $NewEditUserName = $EditUserName; }
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."posts\" SET \"UserID\"=%i,\"GuestName\"='%s',\"EditUser\"=%i,\"EditUserName\"='%s' WHERE \"id\"=%i", array($NewUserID,$NewGuestsName,$NewEditUserID,$NewEditUserName,$PostID));
+sql_query($query,$SQLStat);
+++$i; }
+sql_free_result($result);
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Fixing Reply User Names</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Fixing Reply User Names</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Fixing Reply User Names: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<div style="text-align: center;">
+       <br />Reply User Names fixed.<br />
+       <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
+</div>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_GET['act']=="addforum"&&$_POST['update']!="now") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Adding new Forum";
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Adding new Forum: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ForumID">Insert ID for forum:</label></td>
+       <td style="width: 50%;"><input type="number" name="ForumID" class="TextBox" id="ForumID" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="OrderID">Insert order id forum:</label></td>
+       <td style="width: 50%;"><input type="number" name="OrderID" class="TextBox" id="OrderID" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ForumCatID">Select category for forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="ForumCatID" id="ForumCatID">
+<?php 
+$cq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
+$cr=sql_query($cq,$SQLStat);
+$eu=sql_num_rows($cr);
+$nu=0;
+while ($nu < $eu) {
+$InCatID=sql_result($cr,$nu,"id");
+$InCatName=sql_result($cr,$nu,"Name");
+$EuNuMai = "Eu nu mai vreau";
+?>
+       <option value="<?php echo $InCatID; ?>"><?php echo $InCatName; ?></option>
+<?php ++$nu; }
+sql_free_result($cr); ?>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ForumName">Insert name for forum:</label></td>
+       <td style="width: 50%;"><input type="text" name="ForumName" class="TextBox" id="ForumName" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ForumDesc">Insert description for forum:</label></td>
+       <td style="width: 50%;"><input type="text" name="ForumDesc" class="TextBox" id="ForumDesc" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ShowForum">Show forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="ShowForum" id="ShowForum">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ForumType">Insert forum type:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="ForumType" id="ForumType">
+       <option selected="selected" value="forum">Forum</option>
+       <option value="subforum">SubForum</option>
+       <option value="redirect">Redirect</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="RedirectURL">Insert Redirect URL for redirect forum:</label></td>
+       <td style="width: 50%;"><input type="url" name="RedirectURL" class="TextBox" id="RedirectURL" size="20" value="" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="InSubForum">In SubForum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="InSubForum" id="InSubForum">
+       <option selected="selected" value="0">none</option>
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"InSubForum\"=0 AND \"ForumType\"='subforum' ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$InForumID=sql_result($fr,$fi,"id");
+$InForumName=sql_result($fr,$fi,"Name");
+$InForumType=sql_result($fr,$fi,"ForumType");
+$AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
+if ($InForumType!="redirect"&&$AiFiInSubForum=="0") {
+?>
+       <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
+<?php } ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="PostCountAdd">Add to post count:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="PostCountAdd" id="PostCountAdd">
+       <option selected="selected" value="on">yes</option>
+       <option value="off">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NumPostView">Number of posts to view forum:</label></td>
+       <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumPostView" id="NumPostView" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NumKarmaView">Amount of karma to view forum:</label></td>
+       <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumKarmaView" id="NumKarmaView" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanHaveTopics">Allow topics in forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanHaveTopics" id="CanHaveTopics">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NumPostHotTopic">Number of posts for hot topic:</label></td>
+       <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumPostHotTopic" id="NumPostHotTopic" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CPermissions">Copy permissions from:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CPermissions" id="CPermissions">
+       <option selected="selected" value="0">none</option>
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$InForumID=sql_result($fr,$fi,"id");
+$InForumName=sql_result($fr,$fi,"Name");
+$InForumType=sql_result($fr,$fi,"ForumType");
+$AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
+?>
+       <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
+<?php ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="addforum" style="display: none;" />
+<input type="hidden" name="update" value="now" style="display: none;" />
+<input type="submit" class="Button" value="Add Forum" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_POST['act']=="addforum"&&$_POST['update']=="now"&&$_GET['act']=="addforum") {
+if($_POST['RedirectURL']=="") { $_POST['RedirectURL'] = "http://"; }
+$_POST['ForumName'] = stripcslashes(htmlspecialchars($_POST['ForumName'], ENT_QUOTES, $Settings['charset']));
+//$_POST['ForumName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumName']);
+$_POST['ForumName'] = remove_spaces($_POST['ForumName']);
+$_POST['ForumDesc'] = stripcslashes(htmlspecialchars($_POST['ForumDesc'], ENT_QUOTES, $Settings['charset']));
+//$_POST['ForumDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumDesc']);
+$_POST['ForumDesc'] = remove_spaces($_POST['ForumDesc']);
+$sql_id_check = sql_query(sql_pre_query("SELECT \"id\" FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['ForumID'])),$SQLStat);
+$sql_order_check = sql_query(sql_pre_query("SELECT \"OrderID\" FROM \"".$Settings['sqltable']."forums\" WHERE \"OrderID\"=%i AND \"CategoryID\"=%i AND \"InSubForum\"=%i LIMIT 1", array($_POST['OrderID'],$_POST['ForumCatID'],$_POST['InSubForum'])),$SQLStat);
+$id_check = sql_num_rows($sql_id_check); $order_check = sql_num_rows($sql_order_check);
+sql_free_result($sql_id_check); sql_free_result($sql_order_check);
+$errorstr = "";
+if ($_POST['NumPostView']==null||
+       !is_numeric($_POST['NumPostView'])) {
+       $_POST['NumPostView'] = 0; }
+if ($_POST['NumKarmaView']==null||
+       !is_numeric($_POST['NumKarmaView'])) {
+       $_POST['NumKarmaView'] = 0; }
+if ($Settings['hot_topic_num']==null||
+       !is_numeric($Settings['hot_topic_num'])) {
+       $Settings['hot_topic_num'] = 10; }
+if ($_POST['NumPostHotTopic']==null||
+       !is_numeric($_POST['NumPostHotTopic'])) {
+       $_POST['NumPostHotTopic'] = $Settings['hot_topic_num']; }
+if ($_POST['ForumName']==null||
+       $_POST['ForumName']=="ShowMe") { $Error="Yes";
+$errorstr = $errorstr."You need to enter a forum name.<br />\n"; } 
+if ($_POST['ForumDesc']==null) { $Error="Yes";
+$errorstr = $errorstr."You need to enter a description.<br />\n"; } 
+if ($_POST['ForumID']==null||
+       !is_numeric($_POST['ForumID'])) { $Error="Yes";
+$errorstr = $errorstr."You need to enter a forum ID.<br />\n"; } 
+if($id_check > 0) { $Error="Yes";
+$errorstr = $errorstr."This ID number is already used.<br />\n"; } 
+if($order_check > 0) { $Error="Yes"; 
+$errorstr = $errorstr."This order number is already used.<br />\n"; } 
+if (pre_strlen($_POST['ForumName'])>"150") { $Error="Yes";
+$errorstr = $errorstr."Your Forum Name is too big.<br />\n"; } 
+if (pre_strlen($_POST['ForumDesc'])>"300") { $Error="Yes";
+$errorstr = $errorstr."Your Forum Description is too big.<br />\n"; } 
+if ($Error!="Yes") {
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."forums\" (\"id\", \"CategoryID\", \"OrderID\", \"Name\", \"ShowForum\", \"ForumType\", \"InSubForum\", \"RedirectURL\", \"Redirects\", \"NumViews\", \"Description\", \"PostCountAdd\", \"PostCountView\", \"KarmaCountView\", \"CanHaveTopics\", \"HotTopicPosts\", \"NumPosts\", \"NumTopics\") VALUES\n".
+"(%i, %i, %i, '%s', '%s', '%s', %i, '%s', 0, 0, '%s', '%s', %i, %i, '%s', %i, 0, 0)", array($_POST['ForumID'],$_POST['ForumCatID'],$_POST['OrderID'],$_POST['ForumName'],$_POST['ShowForum'],$_POST['ForumType'],$_POST['InSubForum'],$_POST['RedirectURL'],$_POST['ForumDesc'],$_POST['PostCountAdd'],$_POST['NumPostView'],$_POST['NumKarmaView'],$_POST['CanHaveTopics'],$_POST['NumPostHotTopic']));
+sql_query($query,$SQLStat);
+if(!is_numeric($_POST['CPermissions'])) { $_POST['CPermissions'] = "0"; }
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="sqlite"||
+       $Settings['sqltype']=="sqlite3") {
+$getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."permissions\" ORDER BY \"PermissionID\" ASC", array(null)); }
+if($Settings['sqltype']=="cubrid") {
+$getperidq = sql_pre_query("SELECT DISTINCT \"permissionid\" FROM \"".$Settings['sqltable']."permissions\" ORDER BY \"PermissionID\" ASC", array(null)); }
+$getperidr=sql_query($getperidq,$SQLStat);
+$getperidnum=sql_num_rows($getperidr);
+$getperidi = 0; 
+$nextperid = null;
+/*
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
+       $Settings['sqltype']=="sqlite3") {
+$nextperid = sql_get_next_id($Settings['sqltable'],"permissions",$SQLStat); }
+if($Settings['sqltype']=="sqlite") {
+$nextperid = sql_get_next_id($Settings['sqltable'],"\"permissions\"",$SQLStat); }
+*/
+while ($getperidi < $getperidnum) {
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
+       $Settings['sqltype']=="sqlite3") {
+$getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
+if($Settings['sqltype']=="sqlite") {
+$getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
+if($_POST['CPermissions']=="0") {
+$getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i", array($getperidID)); }
+if($_POST['CPermissions']!="0") {
+$getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i AND \"ForumID\"=%i", array($getperidID,$_POST['CPermissions'])); }
+$getperidr2=sql_query($getperidq2,$SQLStat);
+$getperidnum2=sql_num_rows($getperidr2);
+$PermissionNum=sql_result($getperidr2,0,"id"); 
+$PermissionID=sql_result($getperidr2,0,"PermissionID"); 
+$PermissionName=sql_result($getperidr2,0,"Name"); 
+$PermissionForumID=sql_result($getperidr2,0,"ForumID"); 
+$CanViewForum=sql_result($getperidr2,0,"CanViewForum"); 
+$CanMakePolls=sql_result($getperidr2,0,"CanMakePolls");
+$CanMakeTopics=sql_result($getperidr2,0,"CanMakeTopics"); 
+$CanMakeReplys=sql_result($getperidr2,0,"CanMakeReplys"); 
+$CanMakeReplysCT=sql_result($getperidr2,0,"CanMakeReplysCT"); 
+$CanEditTopics=sql_result($getperidr2,0,"CanEditTopics"); 
+$CanEditTopicsCT=sql_result($getperidr2,0,"CanEditTopicsCT"); 
+$CanEditReplys=sql_result($getperidr2,0,"CanEditReplys"); 
+$CanEditReplysCT=sql_result($getperidr2,0,"CanEditReplysCT"); 
+$CanDeleteTopics=sql_result($getperidr2,0,"CanDeleteTopics"); 
+$CanDeleteTopicsCT=sql_result($getperidr2,0,"CanDeleteTopicsCT"); 
+$CanDeleteReplys=sql_result($getperidr2,0,"CanDeleteReplys"); 
+$CanDeleteReplysCT=sql_result($getperidr2,0,"CanDeleteReplysCT"); 
+$CanCloseTopics=sql_result($getperidr2,0,"CanCloseTopics"); 
+$CanPinTopics=sql_result($getperidr2,0,"CanPinTopics"); 
+$CanExecPHP=sql_result($getperidr2,0,"CanExecPHP"); 
+$CanDoHTML=sql_result($getperidr2,0,"CanDoHTML"); 
+$CanUseBBTags=sql_result($getperidr2,0,"CanUseBBTags"); 
+$CanModForum=sql_result($getperidr2,0,"CanModForum"); 
+sql_free_result($getperidr2);
+if($_POST['CPermissions']=="0") {
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES (%i, '%s', %i, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no')", array($PermissionID,$PermissionName,$_POST['ForumID'])); }
+if($_POST['CPermissions']!="0") {
+if($getperidnum2>0) {
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES (%i, '%s', %i, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", array($PermissionID,$PermissionName,$_POST['ForumID'],$CanViewForum,$CanMakePolls,$CanMakeTopics,$CanMakeReplys,$CanMakeReplysCT,$CanEditTopics,$CanEditTopicsCT,$CanEditReplys,$CanEditReplysCT,$CanDeleteTopics,$CanDeleteTopicsCT,$CanDeleteReplys,$CanDeleteReplysCT,$CanCloseTopics,$CanPinTopics,$CanExecPHP,$CanDoHTML,$CanUseBBTags,$CanModForum)); }
+if($getperidnum2<=0) {
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES (%i, '%s', %i, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no')", array($PermissionID,$PermissionName,$_POST['ForumID'])); } }
+sql_query($query,$SQLStat);
+++$getperidi; /*++$nextperid;*/ }
+sql_free_result($getperidr); } } 
+if($_GET['act']=="deleteforum"&&$_POST['update']!="now") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Deleting a Forum";
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Deleting a Forum: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=deleteforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="DelForums">Delete all forums in subforum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="DelForums" id="DelForums">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="DelTopics">Delete all topics in (sub)forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="DelTopics" id="DelTopics">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="DelPermission">Delete all permission sets in (sub)forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="DelPermission" id="DelPermission">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="DelID">Delete Forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="DelID" id="DelID">
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$InForumID=sql_result($fr,$fi,"id");
+$InForumName=sql_result($fr,$fi,"Name");
+$InForumType=sql_result($fr,$fi,"ForumType");
+$AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
+?>
+       <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
+<?php ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="deleteforum" style="display: none;" />
+<input type="hidden" name="update" value="now" style="display: none;" />
+<input type="submit" class="Button" value="Delete Forum" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_GET['act']=="deleteforum"&&$_POST['update']=="now"&&$_GET['act']=="deleteforum") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['DelID']));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+$errorstr = ""; $Error = null;
+if (!is_numeric($_POST['DelID'])) { $Error="Yes";
+$errorstr = $errorstr."You need to enter a forum ID.<br />\n"; } 
+if($prenum>0&&$Error!="Yes") {
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i", array($_POST['DelID']));
+sql_query($dtquery,$SQLStat);
+if($_POST['DelForums']=="yes") {
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."topics\" WHERE \"ForumID\"=%i", array($_POST['DelID']));
+sql_query($dtquery,$SQLStat);
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."posts\" WHERE \"ForumID\"=%i", array($_POST['DelID']));
+sql_query($dtquery,$SQLStat); }
+if($_POST['DelPermission']=="yes") {
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."permissions\" WHERE \"ForumID\"=%i", array($_POST['DelID']));
+sql_query($dtquery,$SQLStat); }
+if($_POST['DelForums']=="yes") {
+$apcquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"InSubForum\"=%i ORDER BY \"OrderID\" ASC, \"id\" ASC", array($_POST['DelID']));
+$apcresult=sql_query($apcquery,$SQLStat);
+$apcnum=sql_num_rows($apcresult);
+$apci=0; $apcl=1; if($apcnum>=1) {
+while ($apci < $apcnum) {
+$DelSubsForumID=sql_result($apcresult,$apci,"id");
+if($_POST['DelForums']=="yes") {
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."topics\" WHERE \"ForumID\"=%i", array($DelSubsForumID));
+sql_query($dtquery,$SQLStat);
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."posts\" WHERE \"ForumID\"=%i", array($DelSubsForumID));
+sql_query($dtquery,$SQLStat); }
+if($_POST['DelPermission']=="yes") {
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."permissions\" WHERE \"ForumID\"=%i", array($DelSubsForumID));
+sql_query($dtquery,$SQLStat); }
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i", array($DelSubsForumID));
+sql_query($dtquery,$SQLStat);
+++$apci; }
+sql_free_result($apcresult); } }
+?>
+<?php } } if($_GET['act']=="editforum"&&$_POST['update']!="now") {
+$admincptitle = " ".$ThemeSet['TitleDivider']." Editing a Forum";
+if(!isset($_POST['id'])) {
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Editing a Forum: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="id">Forum to Edit:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"id\" ASC, \"OrderID\" ASC", array(null));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$InForumID=sql_result($fr,$fi,"id");
+$InForumName=sql_result($fr,$fi,"Name");
+$InForumType=sql_result($fr,$fi,"ForumType");
+$AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
+?>
+       <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
+<?php ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="editforum" style="display: none;" />
+<input type="submit" class="Button" value="Edit Forum" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if(isset($_POST['id'])) { 
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false)); sql_free_result($preresult);
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if($prenum>=1) {
+$ForumID=sql_result($preresult,0,"id");
+$ForumCatID=sql_result($preresult,0,"CategoryID");
+$ForumOrder=sql_result($preresult,0,"OrderID");
+$ForumName=sql_result($preresult,0,"Name");
+$ShowForum=sql_result($preresult,0,"ShowForum");
+$ForumType=sql_result($preresult,0,"ForumType");
+$InSubForum=sql_result($preresult,0,"InSubForum");
+$RedirectURL=sql_result($preresult,0,"RedirectURL");
+if($RedirectURL=="http://") { $RedirectURL = ""; }
+$RedirectTimes=sql_result($preresult,0,"Redirects");
+$NumberViews=sql_result($preresult,0,"NumViews");
+$ForumDescription=sql_result($preresult,0,"Description");
+$PostCountAdd=sql_result($preresult,0,"PostCountAdd");
+$PostCountView=sql_result($preresult,0,"PostCountView");
+$KarmaCountView=sql_result($preresult,0,"KarmaCountView");
+$CanHaveTopics=sql_result($preresult,0,"CanHaveTopics");
+$HotTopicPosts=sql_result($preresult,0,"HotTopicPosts");
+$NumberPosts=sql_result($preresult,0,"NumPosts");
+$NumberTopics=sql_result($preresult,0,"NumTopics");
+sql_free_result($preresult);
+$ForumType = strtolower($ForumType); $CanHaveTopics = strtolower($CanHaveTopics);
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Editing a Forum: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ForumID">Insert ID for forum:</label></td>
+       <td style="width: 50%;"><input type="number" name="ForumID" class="TextBox" id="ForumID" size="20" value="<?php echo $ForumID; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="OrderID">Insert order id forum:</label></td>
+       <td style="width: 50%;"><input type="number" name="OrderID" class="TextBox" id="OrderID" size="20" value="<?php echo $ForumOrder; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ForumCatID">Select category for forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="ForumCatID" id="ForumCatID">
+<?php 
+$cq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
+$cr=sql_query($cq,$SQLStat);
+$eu=sql_num_rows($cr);
+$nu=0;
+while ($nu < $eu) {
+$InCatID=sql_result($cr,$nu,"id");
+$InCatName=sql_result($cr,$nu,"Name");
+$EuNuMai = "Eu nu mai vreau";
+if($ForumCatID==$InCatID) {
+?>
+       <option value="<?php echo $InCatID; ?>" selected="selected"><?php echo $InCatName; ?></option>
+<?php } if($ForumCatID!=$InCatID) { ?>
+       <option value="<?php echo $InCatID; ?>"><?php echo $InCatName; ?></option>
+<?php } ++$nu; }
+sql_free_result($cr); ?>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ForumName">Insert name for forum:</label></td>
+       <td style="width: 50%;"><input type="text" name="ForumName" class="TextBox" id="ForumName" size="20" value="<?php echo $ForumName; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ForumDesc">Insert description for forum:</label></td>
+       <td style="width: 50%;"><input type="text" name="ForumDesc" class="TextBox" id="ForumDesc" size="20" value="<?php echo $ForumDescription; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ShowForum">Show forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="ShowForum" id="ShowForum">
+       <option <?php if($ShowForum=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($ShowForum=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ForumType">Insert forum type:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="ForumType" id="ForumType">
+       <option <?php if($ForumType=="forum") { echo "selected=\"selected\" "; } ?>value="forum">Forum</option>
+       <option <?php if($ForumType=="subforum") { echo "selected=\"selected\" "; } ?>value="subforum">SubForum</option>
+       <option <?php if($ForumType=="redirect") { echo "selected=\"selected\" "; } ?>value="redirect">Redirect</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="RedirectURL">Insert Redirect URL for redirect forum:</label></td>
+       <td style="width: 50%;"><input type="url" name="RedirectURL" class="TextBox" id="RedirectURL" size="20" value="<?php echo htmlentities($RedirectURL, ENT_QUOTES, $Settings['charset']); ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="InSubForum">In SubForum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="InSubForum" id="InSubForum">
+       <option selected="selected" value="0">none</option>
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"InSubForum\"=0 AND \"id\"<>%i AND \"ForumType\"='subforum' ORDER BY \"id\" ASC, \"OrderID\" ASC", array($ForumID));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$InForumID=sql_result($fr,$fi,"id");
+$InForumName=sql_result($fr,$fi,"Name");
+$InForumType=sql_result($fr,$fi,"ForumType");
+$AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
+if ($InForumType!="redirect"&&$AiFiInSubForum=="0") {
+if($InSubForum==$InForumID) {
+?>
+       <option value="<?php echo $InForumID; ?>" selected="selected"><?php echo $InForumName; ?></option>
+<?php } if($InSubForum!=$InForumID) { ?>
+       <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
+<?php } } ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="PostCountAdd">Add to post count:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="PostCountAdd" id="PostCountAdd">
+       <option <?php if($PostCountAdd=="on") { echo "selected=\"selected\" "; } ?>value="on">yes</option>
+       <option <?php if($PostCountAdd=="off") { echo "selected=\"selected\" "; } ?>value="off">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NumPostView">Number of posts to view forum:</label></td>
+       <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumPostView" id="NumPostView" value="<?php echo $PostCountView; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NumKarmaView">Amount of karma to view forum:</label></td>
+       <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumKarmaView" id="NumKarmaView" value="<?php echo $KarmaCountView; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanHaveTopics">Allow topics in forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanHaveTopics" id="CanHaveTopics">
+       <option <?php if($CanHaveTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanHaveTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NumPostHotTopic">Number of posts for hot topic:</label></td>
+       <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumPostHotTopic" id="NumPostHotTopic" value="<?php echo $HotTopicPosts; ?>" /></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="editforum" style="display: none;" />
+<input type="hidden" name="update" value="now" style="display: none;" />
+<input type="hidden" name="id" value="<?php echo $ForumID; ?>" style="display: none;" />
+<input type="submit" class="Button" value="Edit Forum" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } } } if($_POST['act']=="editforum"&&$_POST['update']=="now"&&$_GET['act']=="editforum"&&
+       isset($_POST['id'])) {
+if($_POST['RedirectURL']=="") { $_POST['RedirectURL'] = "http://"; }
+$_POST['ForumName'] = stripcslashes(htmlspecialchars($_POST['ForumName'], ENT_QUOTES, $Settings['charset']));
+//$_POST['ForumName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumName']);
+$_POST['ForumName'] = remove_spaces($_POST['ForumName']);
+$_POST['ForumDesc'] = stripcslashes(htmlspecialchars($_POST['ForumDesc'], ENT_QUOTES, $Settings['charset']));
+//$_POST['ForumDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumDesc']);
+$_POST['ForumDesc'] = remove_spaces($_POST['ForumDesc']);
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false)); sql_free_result($preresult);
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if($prenum>=1) {
+$OldID=sql_result($preresult,0,"id");
+$OldOrder=sql_result($preresult,0,"OrderID");
+sql_free_result($preresult);
+$sql_id_check = sql_query(sql_pre_query("SELECT \"id\" FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['ForumID'])),$SQLStat);
+$sql_order_check = sql_query(sql_pre_query("SELECT \"OrderID\" FROM \"".$Settings['sqltable']."forums\" WHERE \"OrderID\"=%i AND \"CategoryID\"=%i AND \"InSubForum\"=%i LIMIT 1", array($_POST['OrderID'],$_POST['ForumCatID'],$_POST['InSubForum'])),$SQLStat);
+$id_check = sql_num_rows($sql_id_check); $order_check = sql_num_rows($sql_order_check);
+sql_free_result($sql_id_check); sql_free_result($sql_order_check);
+if ($_POST['NumPostView']==null||
+       !is_numeric($_POST['NumPostView'])) {
+       $_POST['NumPostView'] = 0; }
+if ($_POST['NumKarmaView']==null||
+       !is_numeric($_POST['NumKarmaView'])) {
+       $_POST['NumKarmaView'] = 0; }
+if ($Settings['hot_topic_num']==null||
+       !is_numeric($Settings['hot_topic_num'])) {
+       $Settings['hot_topic_num'] = 10; }
+if ($_POST['NumPostHotTopic']==null||
+       !is_numeric($_POST['NumPostHotTopic'])) {
+       $_POST['NumPostHotTopic'] = $Settings['hot_topic_num']; }
+if ($_POST['ForumName']==null||
+       $_POST['ForumName']=="ShowMe") { $Error="Yes";
+$errorstr = $errorstr."You need to enter a forum name.<br />\n"; } 
+if ($_POST['ForumDesc']==null) { $Error="Yes";
+$errorstr = $errorstr."You need to enter a description.<br />\n"; } 
+if ($_POST['ForumID']==null||
+       !is_numeric($_POST['ForumID'])) { $Error="Yes";
+$errorstr = $errorstr."You need to enter a forum ID.<br />\n"; } 
+if($id_check > 0&&$_POST['ForumID']!=$OldID) { $Error="Yes";
+$errorstr = $errorstr."This ID number is already used.<br />\n"; } 
+if($order_check > 0&&$_POST['OrderID']!=$OldOrder) { $Error="Yes"; 
+$errorstr = $errorstr."This order number is already used.<br />\n"; } 
+if (pre_strlen($_POST['ForumName'])>"150") { $Error="Yes";
+$errorstr = $errorstr."Your Forum Name is too big.<br />\n"; } 
+if (pre_strlen($_POST['ForumDesc'])>"300") { $Error="Yes";
+$errorstr = $errorstr."Your Forum Description is too big.<br />\n"; } 
+if ($Error!="Yes") {
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"id\"=%i,\"CategoryID\"=%i,\"OrderID\"=%i,\"Name\"='%s',\"ShowForum\"='%s',\"ForumType\"='%s',\"InSubForum\"=%i,\"RedirectURL\"='%s',\"Description\"='%s',\"PostCountAdd\"='%s',\"PostCountView\"=%i,\"KarmaCountView\"=%i,\"CanHaveTopics\"='%s',\"HotTopicPosts\"=%i WHERE \"id\"=%i", array($_POST['ForumID'],$_POST['ForumCatID'],$_POST['OrderID'],$_POST['ForumName'],$_POST['ShowForum'],$_POST['ForumType'],$_POST['InSubForum'],$_POST['RedirectURL'],$_POST['ForumDesc'],$_POST['PostCountAdd'],$_POST['NumPostView'],$_POST['NumKarmaView'],$_POST['CanHaveTopics'],$_POST['NumPostHotTopic'],$_POST['id']));
+sql_query($query,$SQLStat);
+if($_POST['ForumID']!=$_POST['id']) { 
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"InSubForum\"=%i WHERE \"InSubForum\"=%i", array($_POST['ForumID'],$_POST['id']));
+sql_query($query,$SQLStat);
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"ForumID\"=%i,\"OldForumID\"=%i WHERE \"ForumID\"=%i", array($_POST['ForumID'],$_POST['ForumID'],$_POST['id']));
+sql_query($query,$SQLStat);
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."posts\" SET \"ForumID\"=%i WHERE \"ForumID\"=%i", array($_POST['ForumID'],$_POST['id']));
+sql_query($query,$SQLStat); }
+$queryz = sql_pre_query("UPDATE \"".$Settings['sqltable']."permissions\" SET \"ForumID\"=%i WHERE \"ForumID\"=%i", array($_POST['ForumID'],$_POST['id']));
+sql_query($queryz,$SQLStat); } } } 
+if($_GET['act']=="fpermissions"&&$_POST['update']!="now") {
+$admincptitle = " ".$ThemeSet['TitleDivider']." Forum Permissions Manager";
+if(!isset($_POST['id'])) {
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Forum Permissions Manager: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="id">Permission to view:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
+<?php 
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="sqlite"||
+       $Settings['sqltype']=="sqlite3") {
+$getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."permissions\"", array(null)); }
+if($Settings['sqltype']=="cubrid") {
+$getperidq = sql_pre_query("SELECT DISTINCT \"permissionid\" FROM \"".$Settings['sqltable']."permissions\"", array(null)); }
+$getperidr=sql_query($getperidq,$SQLStat);
+$getperidnum=sql_num_rows($getperidr);
+$getperidi = 0;
+while ($getperidi < $getperidnum) {
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
+       $Settings['sqltype']=="sqlite3") {
+$getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
+if($Settings['sqltype']=="sqlite") {
+$getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
+$getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i ORDER BY \"ForumID\" ASC", array($getperidID));
+$getperidr2=sql_query($getperidq2,$SQLStat);
+$getperidnum2=sql_num_rows($getperidr2);
+$getperidName=sql_result($getperidr2,0,"Name");
+sql_free_result($getperidr2);
+?>
+       <option value="<?php echo $getperidID; ?>"><?php echo $getperidName; ?></option>
+<?php ++$getperidi; }
+sql_free_result($getperidr); ?>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="fpermissions" style="display: none;" />
+<input type="submit" class="Button" value="View Permission" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if(isset($_POST['id'])&&$_POST['subact']==null) { ?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Forum Permissions Manager: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"id\" ASC, \"OrderID\" ASC", array(null));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$InForumID=sql_result($fr,$fi,"id");
+$InForumName=sql_result($fr,$fi,"Name");
+$getperidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i AND \"ForumID\"=%i LIMIT 1", array($_POST['id'],$InForumID));
+$getperidr=sql_query($getperidq,$SQLStat);
+$getperidnum=sql_num_rows($getperidr);
+$getperidNumz = null;
+$getperidID = null;
+if($getperidnum>0) {
+$getperidNumz=sql_result($getperidr,0,"id");
+$getperidID=sql_result($getperidr,0,"PermissionID"); }
+?>
+<form style="display: inline;" method="post" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<?php if($getperidnum>0) { ?>
+Permissions for <?php echo $InForumName; ?> are set: <br />
+<input type="hidden" name="act" value="fpermissions" style="display: none;" />
+<input type="hidden" name="subact" value="edit" style="display: none;" />
+<input type="hidden" name="id" value="<?php echo $getperidNumz; ?>" style="display: none;" />
+<input type="submit" class="Button" value="Edit Permissions" name="Apply_Changes" />
+<?php } if($getperidnum<=0) { ?>
+Permissions for <?php echo $InForumName; ?> are not set: <br />
+<input type="hidden" name="act" value="fpermissions" style="display: none;" />
+<input type="hidden" name="subact" value="create" style="display: none;" />
+<input type="hidden" name="permid" value="<?php echo $_POST['id']; ?>" style="display: none;" />
+<input type="hidden" name="id" value="<?php echo $InForumID; ?>" style="display: none;" />
+<input type="submit" class="Button" value="Create Permissions" name="Apply_Changes" />
+<?php } ?>
+</td></tr></table>
+</form>
+<?php 
+sql_free_result($getperidr);
+++$fi; }
+sql_free_result($fr); ?>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if(isset($_POST['id'])&&$_POST['subact']=="edit") {
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false)); sql_free_result($preresult);
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if($prenum>=1) {
+$PermissionNum=sql_result($preresult,0,"id"); 
+$PermissionID=sql_result($preresult,0,"PermissionID"); 
+$PermissionName=sql_result($preresult,0,"Name"); 
+$PermissionForumID=sql_result($preresult,0,"ForumID"); 
+$CanViewForum=sql_result($preresult,0,"CanViewForum"); 
+$CanMakePolls=sql_result($preresult,0,"CanMakePolls");
+$CanMakeTopics=sql_result($preresult,0,"CanMakeTopics"); 
+$CanMakeReplys=sql_result($preresult,0,"CanMakeReplys"); 
+$CanMakeReplysCT=sql_result($preresult,0,"CanMakeReplysCT"); 
+$CanEditTopics=sql_result($preresult,0,"CanEditTopics"); 
+$CanEditTopicsCT=sql_result($preresult,0,"CanEditTopicsCT"); 
+$CanEditReplys=sql_result($preresult,0,"CanEditReplys"); 
+$CanEditReplysCT=sql_result($preresult,0,"CanEditReplysCT"); 
+$CanDeleteTopics=sql_result($preresult,0,"CanDeleteTopics"); 
+$CanDeleteTopicsCT=sql_result($preresult,0,"CanDeleteTopicsCT"); 
+$CanDeleteReplys=sql_result($preresult,0,"CanDeleteReplys"); 
+$CanDeleteReplysCT=sql_result($preresult,0,"CanDeleteReplysCT"); 
+$CanCloseTopics=sql_result($preresult,0,"CanCloseTopics"); 
+$CanPinTopics=sql_result($preresult,0,"CanPinTopics"); 
+$CanExecPHP=sql_result($preresult,0,0,"CanExecPHP");
+$CanDoHTML=sql_result($preresult,0,"CanDoHTML"); 
+$CanUseBBTags=sql_result($preresult,0,"CanUseBBTags"); 
+$CanModForum=sql_result($preresult,0,"CanModForum"); 
+sql_free_result($preresult); }
+$PermissionName = stripcslashes(htmlspecialchars($PermissionName, ENT_QUOTES, $Settings['charset']));
+//$_POST['ForumName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumName']);
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Editing Forum Permissions: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewForum">Can view forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewForum" id="CanViewForum">
+       <option <?php if($CanViewForum=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanViewForum=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeTopics">Can make topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeTopics" id="CanMakeTopics">
+       <option <?php if($CanMakeTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanMakeTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakePolls">Can make polls:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakePolls" id="CanMakePolls">
+       <option <?php if($CanMakePolls=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanMakePolls=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeReplys">Can make replys in own:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeReplys" id="CanMakeReplys">
+       <option <?php if($CanMakeReplys=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanMakeReplys=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeReplysCT">Can make replys other users topic:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeReplysCT" id="CanMakeReplysCT">
+       <option <?php if($CanMakeReplysCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanMakeReplysCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditTopics">Can edit own topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditTopics" id="CanEditTopics">
+       <option <?php if($CanEditTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanEditTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditTopicsCT">Can edit other users topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditTopicsCT" id="CanEditTopicsCT">
+       <option <?php if($CanEditTopicsCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanEditTopicsCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditReplys">Can edit own replys:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditReplys" id="CanEditReplys">
+       <option <?php if($CanEditReplys=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanEditReplys=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditReplysCT">Can edit other users replys:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditReplysCT" id="CanEditReplysCT">
+       <option <?php if($CanEditReplysCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanEditReplysCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteTopics">Can delete own topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteTopics" id="CanDeleteTopics">
+       <option <?php if($CanDeleteTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanDeleteTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="Can delete other users topics">Can delete other users topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteTopicsCT" id="CanDeleteTopicsCT">
+       <option <?php if($CanDeleteTopicsCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanDeleteTopicsCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteReplys">Can delete own replys:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteReplys" id="CanDeleteReplys">
+       <option <?php if($CanDeleteReplys=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanDeleteReplys=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteReplysCT">Can delete other users replys:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteReplysCT" id="CanDeleteReplysCT">
+       <option <?php if($CanDeleteReplysCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanDeleteReplysCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanCloseTopics">Can close topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanCloseTopics" id="CanCloseTopics">
+       <option <?php if($CanCloseTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanCloseTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanPinTopics">Can pin topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanPinTopics" id="CanPinTopics">
+       <option <?php if($CanPinTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanPinTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanDoHTML">Can DoHTML:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDoHTML" id="CanDoHTML">
+       <option <?php if($CanDoHTML=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanDoHTML=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanUseBBTags">Can use BBTags:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanUseBBTags" id="CanUseBBTags">
+       <option <?php if($CanUseBBTags=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanUseBBTags=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanModForum">Can moderate forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanModForum" id="CanModForum">
+       <option <?php if($CanModForum=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanModForum=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="fpermissions" style="display: none;" />
+<input type="hidden" name="subact" value="editnow" style="display: none;" />
+<input type="hidden" name="id" value="<?php echo $PermissionNum; ?>" style="display: none;" />
+<input type="submit" class="Button" value="Edit Permissions" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if(isset($_POST['id'])&&$_POST['subact']=="editnow") {
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."permissions\" SET \"CanViewForum\"='%s', \"CanMakePolls\"='%s', \"CanMakeTopics\"='%s', \"CanMakeReplys\"='%s', \"CanMakeReplysCT\"='%s', \"CanEditTopics\"='%s', \"CanEditTopicsCT\"='%s', \"CanEditReplys\"='%s', \"CanEditReplysCT\"='%s', \"CanDeleteTopics\"='%s', \"CanDeleteTopicsCT\"='%s', \"CanDeleteReplys\"='%s', \"CanDeleteReplysCT\"='%s', \"CanCloseTopics\"='%s', \"CanPinTopics\"='%s', \"CanDoHTML\"='%s', \"CanUseBBTags\"='%s', \"CanModForum\"='%s' WHERE \"id\"=%i", array($_POST['CanViewForum'], $_POST['CanMakePolls'], $_POST['CanMakeTopics'], $_POST['CanMakeReplys'], $_POST['CanMakeReplysCT'], $_POST['CanEditTopics'], $_POST['CanEditTopicsCT'], $_POST['CanEditReplys'], $_POST['CanEditReplysCT'], $_POST['CanDeleteTopics'], $_POST['CanDeleteTopicsCT'], $_POST['CanDeleteReplys'], $_POST['CanDeleteReplysCT'], $_POST['CanCloseTopics'], $_POST['CanPinTopics'], $_POST['CanDoHTML'], $_POST['CanUseBBTags'], $_POST['CanModForum'], $_POST['id']));
+sql_query($query,$SQLStat); } if(isset($_POST['id'])&&$_POST['subact']=="create") { 
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Editing Forum Permissions: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewForum">Can view forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewForum" id="CanViewForum">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakePolls">Can make polls:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakePolls" id="CanMakePolls">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr>
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeTopics">Can make topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeTopics" id="CanMakeTopics">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeReplys">Can make replys in own:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeReplys" id="CanMakeReplys">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeReplysCT">Can make replys other users topic:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeReplysCT" id="CanMakeReplysCT">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditTopics">Can edit own topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditTopics" id="CanEditTopics">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditTopicsCT">Can edit other users topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditTopicsCT" id="CanEditTopicsCT">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditReplys">Can edit own replys:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditReplys" id="CanEditReplys">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditReplysCT">Can edit other users replys:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditReplysCT" id="CanEditReplysCT">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteTopics">Can delete own topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteTopics" id="CanDeleteTopics">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="Can delete other users topics">Can delete other users topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteTopicsCT" id="CanDeleteTopicsCT">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteReplys">Can delete own replys:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteReplys" id="CanDeleteReplys">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteReplysCT">Can delete other users replys:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteReplysCT" id="CanDeleteReplysCT">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanCloseTopics">Can close topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanCloseTopics" id="CanCloseTopics">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanPinTopics">Can pin topics:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanPinTopics" id="CanPinTopics">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanDoHTML">Can DoHTML:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDoHTML" id="CanDoHTML">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanUseBBTags">Can use BBTags:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanUseBBTags" id="CanUseBBTags">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr> 
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanModForum">Can moderate forum:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanModForum" id="CanModForum">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="fpermissions" style="display: none;" />
+<input type="hidden" name="subact" value="makenow" style="display: none;" />
+<input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" style="display: none;" />
+<input type="hidden" name="permid" value="<?php echo $_POST['permid']; ?>" style="display: none;" />
+<input type="submit" class="Button" value="Create Permissions" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") {
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"id\"=%i LIMIT 1", array($_POST['permid']));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false)); sql_free_result($preresult);
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if($prenum>=1) {
+$PermissionName=sql_result($preresult,0,"Name"); 
+sql_free_result($preresult); }
+//$nextidnum = sql_get_next_id($Settings['sqltable'],"permissions",$SQLStat);
+$nextidnum = null;
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES\n".
+"(%i, '%s', %i, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 'no', '%s', '%s', '%s')", array($_POST['permid'], $PermissionName, $_POST['id'], $_POST['CanViewForum'], $_POST['CanMakePolls'], $_POST['CanMakeTopics'], $_POST['CanMakeReplys'], $_POST['CanMakeReplysCT'], $_POST['CanEditTopics'], $_POST['CanEditTopicsCT'], $_POST['CanEditReplys'], $_POST['CanEditReplysCT'], $_POST['CanDeleteTopics'], $_POST['CanDeleteTopicsCT'], $_POST['CanDeleteReplys'], $_POST['CanDeleteReplysCT'], $_POST['CanCloseTopics'], $_POST['CanPinTopics'], $_POST['CanDoHTML'], $_POST['CanUseBBTags'], $_POST['CanModForum'])); 
+sql_query($query,$SQLStat); } } 
+$doupdate = false;
+if(isset($_POST['id'])&&$_POST['subact']=="editnow") { 
+       $doupdate = true; }
+if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") { 
+       $doupdate = true; }
+if($_POST['act']=="addforum"&&$_POST['update']=="now"&&$_GET['act']=="addforum") { 
+       $doupdate = true; }
+if($_GET['act']=="deleteforum"&&$_POST['update']=="now"&&$_GET['act']=="deleteforum") { 
+       $doupdate = true; }
+if($_POST['act']=="editforum"&&$_POST['update']=="now"&&$_GET['act']=="editforum"&&
+       isset($_POST['id'])) { 
+       $doupdate = true; }
+if($doupdate===true&&$Error!="Yes") { ?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr id="ProfileTitle" class="TableMenuRow2">
+<th class="TableMenuColumn2">Updating Settings</th>
+</tr>
+<tr class="TableMenuRow3" id="ProfileUpdate">
+<td class="TableMenuColumn3">
+<?php if(isset($_POST['id'])&&$_POST['subact']=="editnow") { ?>
+<div style="text-align: center;">
+       <br />The permission was edited successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") { ?>
+<div style="text-align: center;">
+       <br />The permission was created successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } if($_POST['act']=="addforum"&&$_POST['update']=="now"&&$_GET['act']=="addforum") { ?>
+<div style="text-align: center;">
+       <br />The forum was created successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } if($_GET['act']=="deleteforum"&&$_POST['update']=="now"&&$_GET['act']=="deleteforum") { ?>
+<div style="text-align: center;">
+       <br />The forum was deleted successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } if($_POST['act']=="editforum"&&$_POST['update']=="now"&&$_GET['act']=="editforum"&&
+       isset($_POST['id'])) { ?>
+<div style="text-align: center;">
+       <br />The forum was edited successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } ?>
+</td></tr>
+<tr id="ProfileTitleEnd" class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr></table></div>
+<?php } if ($_GET['act']!=null&&$Error=="Yes") {
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr id="ProfileTitle" class="TableMenuRow2">
+<th class="TableMenuColumn2">Updating Settings</th>
+</tr>
+<tr class="TableMenuRow3" id="ProfileUpdate">
+<td class="TableMenuColumn3">
+<div style="text-align: center;">
+       <br /><?php echo $errorstr; ?>
+       <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
+       </div>
+</td></tr>
+<tr id="ProfileTitleEnd" class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr></table></div>
+<?php } ?>
+</td></tr>
+</table>
+<div>&nbsp;</div>
diff --git a/admin/groups.php b/admin/groups.php
new file mode 100644 (file)
index 0000000..0603e3f
--- /dev/null
@@ -0,0 +1,842 @@
+<?php
+/*
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the Revised BSD License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    Revised BSD License for more details.
+
+    Copyright 2004-2017 iDB Support - http://idb.berlios.de/
+    Copyright 2004-2017 Game Maker 2k - http://gamemaker2k.org/
+
+    $FileInfo: groups.php - Last Update: 09/13/2018 SVN 875 - Author: cooldude2k $
+*/
+$File3Name = basename($_SERVER['SCRIPT_NAME']);
+if ($File3Name=="groups.php"||$File3Name=="/groups.php") {
+       require('index.php');
+       exit(); }
+
+// Check if we can goto admin cp
+if($_SESSION['UserGroup']==$Settings['GuestGroup']||$GroupInfo['HasAdminCP']=="no") {
+redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if(!isset($_POST['update'])) { $_POST['update'] = null; }
+$Error = null; $errorstr = null;
+?>
+<table class="Table3">
+<tr style="width: 100%; vertical-align: top;">
+       <td style="width: 15%; vertical-align: top;">
+<?php 
+require($SettDir['admin'].'table.php'); 
+?>
+</td>
+       <td style="width: 85%; vertical-align: top;">
+<?php if($_GET['act']=="addgroup"&&$_POST['update']!="now") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Adding new Group";
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Adding new Group: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="GroupName">Insert name for group:</label></td>
+       <td style="width: 50%;"><input type="text" name="GroupName" class="TextBox" id="GroupName" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="GroupPerm">Copy Permissions from:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="GroupPerm" id="GroupPerm">
+       <option selected="selected" value="0">none</option>
+<?php 
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="sqlite"||
+       $Settings['sqltype']=="sqlite3") {
+$getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."permissions\"", array(null)); }
+if($Settings['sqltype']=="cubrid") {
+$getperidq = sql_pre_query("SELECT DISTINCT \"permissionid\" FROM \"".$Settings['sqltable']."permissions\"", array(null)); }
+$getperidr=sql_query($getperidq,$SQLStat);
+$getperidnum=sql_num_rows($getperidr);
+$getperidi = 0;
+while ($getperidi < $getperidnum) {
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
+       $Settings['sqltype']=="sqlite3") {
+$getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
+if($Settings['sqltype']=="sqlite") {
+$getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
+$getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i ORDER BY \"ForumID\" ASC", array($getperidID));
+$getperidr2=sql_query($getperidq2,$SQLStat);
+$getperidnum2=sql_num_rows($getperidr2);
+$getperidName=sql_result($getperidr2,0,"Name");
+sql_free_result($getperidr2);
+?>
+       <option value="<?php echo $getperidID; ?>"><?php echo $getperidName; ?></option>
+<?php ++$getperidi; }
+sql_free_result($getperidr); ?>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="PermissionID">Permission ID:</label></td>
+       <td style="width: 50%;"><input type="number" name="PermissionID" class="TextBox" id="PermissionID" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NamePrefix">Name Prefix:</label></td>
+       <td style="width: 50%;"><input type="text" name="NamePrefix" class="TextBox" id="NamePrefix" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NameSuffix">Name Subfix:</label></td>
+       <td style="width: 50%;"><input type="text" name="NameSuffix" class="TextBox" id="NameSuffix" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewBoard">Can View Board:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewBoard" id="CanViewBoard">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewOffLine">Can View OffLine Board:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewOffLine" id="CanViewOffLine">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditProfile">Can Edit Profile:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditProfile" id="CanEditProfile">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanAddEvents">Can Add Events:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanAddEvents" id="CanAddEvents">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanPM">Can PM:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanPM" id="CanPM">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanSearch">Can Search:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanSearch" id="CanSearch">
+       <option selected="selected" value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanDoHTML">Can DoHTML:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDoHTML" id="CanDoHTML">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanUseBBTags">Can use BBTags:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanUseBBTags" id="CanUseBBTags">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="FloodControl">Flood Control in seconds:</label></td>
+       <td style="width: 50%;"><input type="text" name="FloodControl" class="TextBox" id="FloodControl" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="SearchFlood">Search Flood Control in seconds:</label></td>
+       <td style="width: 50%;"><input type="text" name="SearchFlood" class="TextBox" id="SearchFlood" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="PromoteTo">Promote To Group:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="PromoteTo" id="PromoteTo">
+       <option selected="selected" value="0">none</option>
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" ORDER BY \"id\" ASC", array(null));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$ProGroupID=sql_result($fr,$fi,"id");
+$ProGroupName=sql_result($fr,$fi,"Name");
+?>
+       <option value="<?php echo $ProGroupID; ?>"><?php echo $ProGroupName; ?></option>
+<?php ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="PromotePosts">Amount of Posts needed:</label></td>
+       <td style="width: 50%;"><input type="number" name="PromotePosts" class="TextBox" id="PromotePosts" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="PromoteKarma">Amount of Karma needed:</label></td>
+       <td style="width: 50%;"><input type="number" name="PromoteKarma" class="TextBox" id="PromoteKarma" size="20" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="HasModCP">Can view Mod CP:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="HasModCP" id="HasModCP">
+       <option selected="selected" value="off">no</option>
+       <option value="on">yes</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="HasAdminCP">Can view Admin CP:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="HasAdminCP" id="HasAdminCP">
+       <option selected="selected" value="off">no</option>
+       <option value="on">yes</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewIPAddress">Can view IP Address:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewIPAddress" id="CanViewIPAddress">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewUserAgent">Can view user agent:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewUserAgent" id="CanViewUserAgent">
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ViewDBInfo">Can view Database info:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="ViewDBInfo" id="ViewDBInfo">
+       <option selected="selected" value="off">no</option>
+       <option value="on">yes</option>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="addgroup" style="display: none;" />
+<input type="hidden" name="update" value="now" style="display: none;" />
+<input type="submit" class="Button" value="Add Group" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_POST['act']=="addgroup"&&$_POST['update']=="now"&&$_GET['act']=="addgroup") {
+$_POST['GroupName'] = stripcslashes(htmlspecialchars($_POST['GroupName'], ENT_QUOTES, $Settings['charset']));
+//$_POST['GroupName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GroupName']);
+$_POST['GroupName'] = remove_spaces($_POST['GroupName']);
+$_POST['NamePrefix'] = stripcslashes(htmlspecialchars($_POST['NamePrefix'], ENT_QUOTES, $Settings['charset']));
+//$_POST['NamePrefix'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['NamePrefix']);
+$_POST['NamePrefix'] = remove_spaces($_POST['NamePrefix']);
+$_POST['NameSuffix'] = stripcslashes(htmlspecialchars($_POST['NameSuffix'], ENT_QUOTES, $Settings['charset']));
+//$_POST['NameSuffix'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['NameSuffix']);
+$_POST['NameSuffix'] = remove_spaces($_POST['NameSuffix']);
+$sql_name_check = sql_query(sql_pre_query("SELECT \"Name\" FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s'", array($_POST['GroupName'])),$SQLStat);
+$sql_id_check = sql_query(sql_pre_query("SELECT \"id\" FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i LIMIT 1", array($_POST['PermissionID'])),$SQLStat);
+$name_check = sql_num_rows($sql_name_check); $id_check = sql_num_rows($sql_id_check);
+sql_free_result($sql_name_check);
+$errorstr = "";
+if (!isset($_POST['PromotePosts'])) {
+       $_POST['PromotePosts'] = 0; }
+if ($_POST['PromotePosts']==null||
+       !is_numeric($_POST['PromotePosts'])) {
+       $_POST['PromotePosts'] = 0; }
+if (!isset($_POST['PromoteKarma'])) {
+       $_POST['PromoteKarma'] = 0; }
+if ($_POST['PromoteKarma']==null||
+       !is_numeric($_POST['PromoteKarma'])) {
+       $_POST['NPromoteKarma'] = 0; }
+if ($_POST['GroupName']==null||
+       $_POST['GroupName']=="ShowMe") { $Error="Yes";
+$errorstr = $errorstr."You need to enter a forum name.<br />\n"; } 
+if($id_check > 0) { $Error="Yes";
+$errorstr = $errorstr."This ID number is already used.<br />\n"; } 
+if($name_check > 0) { $Error="Yes";
+$errorstr = $errorstr."This Group Name is already used.<br />\n"; } 
+if (pre_strlen($_POST['GroupName'])>"150") { $Error="Yes";
+$errorstr = $errorstr."Your Group Name is too big.<br />\n"; } 
+if ($Error!="Yes") {
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."groups\" (\"Name\", \"PermissionID\", \"NamePrefix\", \"NameSuffix\", \"CanViewBoard\", \"CanViewOffLine\", \"CanEditProfile\", \"CanAddEvents\", \"CanPM\", \"CanSearch\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\", \"CanViewIPAddress\", \"CanViewUserAgent\", \"FloodControl\", \"SearchFlood\", \"PromoteTo\", \"PromotePosts\", \"PromoteKarma\", \"HasModCP\", \"HasAdminCP\", \"ViewDBInfo\") VALUES\n".
+"('%s', %i, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 'no', '%s', '%s', '%s', '%s', '%s', %i, %i, %i, %i, %i, '%s', '%s', '%s')", array($_POST['GroupName'],$_POST['PermissionID'],$_POST['NamePrefix'],$_POST['NameSuffix'],$_POST['CanViewBoard'],$_POST['CanViewOffLine'],$_POST['CanEditProfile'],$_POST['CanAddEvents'],$_POST['CanPM'],$_POST['CanSearch'],$_POST['CanDoHTML'],$_POST['CanUseBBTags'],$_POST['HasModCP'],$_POST['CanViewIPAddress'],$_POST['CanViewUserAgent'],$_POST['FloodControl'],$_POST['SearchFlood'],$_POST['PromoteTo'],$_POST['PromotePosts'],$_POST['PromoteKarma'],$_POST['HasModCP'],$_POST['HasAdminCP'],$_POST['ViewDBInfo']));
+sql_query($query,$SQLStat);
+if(!is_numeric($_POST['GroupPerm'])) { $_POST['GroupPerm'] = "0"; }
+$getperidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"id\" ASC", array(null));
+$getperidr=sql_query($getperidq,$SQLStat);
+$getperidnum=sql_num_rows($getperidr);
+$getperidi = 0; 
+$nextperid = null;
+/*
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
+       $Settings['sqltype']=="sqlite3") {
+$nextperid = sql_get_next_id($Settings['sqltable'],"permissions",$SQLStat); }
+if($Settings['sqltype']=="sqlite") {
+$nextperid = sql_get_next_id($Settings['sqltable'],"\"permissions\"",$SQLStat); }
+*/
+while ($getperidi < $getperidnum) {
+$getperidID=sql_result($getperidr,$getperidi,"id");
+if($_POST['GroupPerm']!="0") {
+$getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i AND \"ForumID\"=%i", array($_POST['GroupPerm'],$getperidID));
+$getperidr2=sql_query($getperidq2,$SQLStat);
+$getperidnum2=sql_num_rows($getperidr2);
+$PermissionNum=sql_result($getperidr2,0,"id"); 
+$PermissionID=$_POST['PermissionID']; 
+$PermissionName=$_POST['GroupName']; 
+$PermissionForumID=sql_result($getperidr2,0,"ForumID"); 
+$CanViewForum=sql_result($getperidr2,0,"CanViewForum");
+$CanMakePolls=sql_result($getperidr2,0,"CanMakePolls");
+$CanMakeTopics=sql_result($getperidr2,0,"CanMakeTopics"); 
+$CanMakeReplys=sql_result($getperidr2,0,"CanMakeReplys"); 
+$CanMakeReplysCT=sql_result($getperidr2,0,"CanMakeReplysCT"); 
+$CanEditTopics=sql_result($getperidr2,0,"CanEditTopics"); 
+$CanEditTopicsCT=sql_result($getperidr2,0,"CanEditTopicsCT"); 
+$CanEditReplys=sql_result($getperidr2,0,"CanEditReplys"); 
+$CanEditReplysCT=sql_result($getperidr2,0,"CanEditReplysCT"); 
+$CanDeleteTopics=sql_result($getperidr2,0,"CanDeleteTopics"); 
+$CanDeleteTopicsCT=sql_result($getperidr2,0,"CanDeleteTopicsCT"); 
+$CanDeleteReplys=sql_result($getperidr2,0,"CanDeleteReplys"); 
+$CanDeleteReplysCT=sql_result($getperidr2,0,"CanDeleteReplysCT"); 
+$CanCloseTopics=sql_result($getperidr2,0,"CanCloseTopics"); 
+$CanPinTopics=sql_result($getperidr2,0,"CanPinTopics"); 
+$CanExecPHP=sql_result($getperidr2,0,"CanExecPHP"); 
+$CanDoHTML=sql_result($getperidr2,0,"CanDoHTML"); 
+$CanUseBBTags=sql_result($getperidr2,0,"CanUseBBTags"); 
+$CanModForum=sql_result($getperidr2,0,"CanModForum"); 
+sql_free_result($getperidr2); }
+if($_POST['GroupPerm']=="0") {
+$PermissionID=$_POST['PermissionID']; 
+$PermissionName=$_POST['GroupName']; 
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES (%i, '%s', %i, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no')", array($PermissionID,$PermissionName,$getperidID)); }
+if($_POST['GroupPerm']!="0") {
+if($getperidnum2>0) {
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES (%i, '%s', %i, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", array($PermissionID,$PermissionName,$getperidID,$CanViewForum,$CanMakePolls,$CanMakeTopics,$CanMakeReplys,$CanMakeReplysCT,$CanEditTopics,$CanEditTopicsCT,$CanEditReplys,$CanEditReplysCT,$CanDeleteTopics,$CanDeleteTopicsCT,$CanDeleteReplys,$CanDeleteReplysCT,$CanCloseTopics,$CanPinTopics,$CanExecPHP,$CanDoHTML,$CanUseBBTags,$CanModForum)); }
+if($getperidnum2<=0) {
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES (%i, '%s', %i, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no')", array($PermissionID,$PermissionName,$getperidID)); } }
+sql_query($query,$SQLStat);
+++$getperidi; /*++$nextperid;*/ }
+sql_free_result($getperidr);
+if(!is_numeric($_POST['GroupPerm'])) { $_POST['GroupPerm'] = "0"; }
+$getperidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"id\" ASC", array(null));
+$getperidr=sql_query($getperidq,$SQLStat);
+$getperidnum=sql_num_rows($getperidr);
+$getperidi = 0; 
+$nextperid = null;
+/*
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
+       $Settings['sqltype']=="sqlite3") {
+$nextperid = sql_get_next_id($Settings['sqltable'],"permissions",$SQLStat); }
+if($Settings['sqltype']=="sqlite") {
+$nextperid = sql_get_next_id($Settings['sqltable'],"\"permissions\"",$SQLStat); }
+*/
+while ($getperidi < $getperidnum) {
+$getperidID=sql_result($getperidr,$getperidi,"id");
+if($_POST['GroupPerm']!="0") {
+$getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"PermissionID\"=%i AND \"CategoryID\"=%i", array($_POST['GroupPerm'],$getperidID));
+$getperidr2=sql_query($getperidq2,$SQLStat);
+$getperidnum2=sql_num_rows($getperidr2);
+$PermissionNum=sql_result($getperidr2,0,"id"); 
+$PermissionID=$_POST['PermissionID']; 
+$PermissionName=$_POST['GroupName']; 
+$PermissionCatID=sql_result($getperidr2,0,"CategoryID"); 
+$CanViewCategory=sql_result($getperidr2,0,"CanViewCategory"); 
+sql_free_result($getperidr2); }
+if($_POST['GroupPerm']=="0") {
+$PermissionID=$_POST['PermissionID']; 
+$PermissionName=$_POST['GroupName']; 
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES (%i, '%s', %i, 'yes')", array($PermissionID,$PermissionName,$getperidID)); }
+if($_POST['GroupPerm']!="0") {
+if($getperidnum2>0) {
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES (%i, '%s', %i, '%s')", array($PermissionID,$PermissionName,$getperidID,$CanViewCategory)); }
+if($getperidnum2<=0) {
+$query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES (%i, '%s', %i, 'yes')", array($PermissionID,$PermissionName,$getperidID)); } }
+sql_query($query,$SQLStat);
+++$getperidi; /*++$nextperid;*/ }
+sql_free_result($getperidr); } } 
+if($_GET['act']=="deletegroup"&&$_POST['update']!="now") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Deleting a Forum";
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Deleting a Group: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=deletegroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="DelID">Delete Group:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="DelID" id="DelID">
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE (\"Name\"<>'%s' AND \"Name\"<>'%s' AND \"Name\"<>'%s' AND \"Name\"<>'%s') ORDER BY \"id\" ASC", array($Settings['GuestGroup'],$Settings['MemberGroup'],$Settings['ValidateGroup'],"Admin"));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$GroupID=sql_result($fr,$fi,"id");
+$GroupName=sql_result($fr,$fi,"Name");
+?>
+       <option value="<?php echo $GroupID; ?>"><?php echo $GroupName; ?></option>
+<?php ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="deletegroup" style="display: none;" />
+<input type="hidden" name="update" value="now" style="display: none;" />
+<input type="submit" class="Button" value="Delete Group" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_GET['act']=="deletegroup"&&$_POST['update']=="now"&&$_GET['act']=="deletegroup") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i AND (\"Name\"<>'%s' AND \"Name\"<>'%s' AND \"Name\"<>'%s' AND \"Name\"<>'%s') LIMIT 1", array($_POST['DelID'],$Settings['GuestGroup'],$Settings['MemberGroup'],$Settings['ValidateGroup'],"Admin"));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+$GroupName=sql_result($preresult,0,"Name");
+$errorstr = ""; $Error = null;
+if (!is_numeric($_POST['DelID'])) { $Error="Yes";
+$errorstr = $errorstr."You need to enter a group ID.<br />\n"; } 
+if($prenum>0&&$Error!="Yes") {
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i", array($_POST['DelID']));
+sql_query($dtquery,$SQLStat);
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"Name\"='%s'", array($GroupName));
+sql_query($dtquery,$SQLStat);
+$dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."permissions\" WHERE \"Name\"='%s'", array($GroupName));
+sql_query($dtquery,$SQLStat);
+$gquerys = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['MemberGroup']));
+$gresults=sql_query($gquerys,$SQLStat);
+$MemGroup=sql_result($gresults,0,"id");
+sql_free_result($gresults);
+$dtquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"GroupID\"=%i WHERE \"GroupID\"=%i", array($MemGroup,$_POST['DelID']));
+sql_query($dtquery,$SQLStat); } }
+if($_GET['act']=="editgroup"&&$_POST['update']!="now") {
+$admincptitle = " ".$ThemeSet['TitleDivider']." Editing a Group";
+if(!isset($_POST['id'])) {
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Editing a Group: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="id">Group to Edit:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" ORDER BY \"id\" ASC", array(null));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$GroupID=sql_result($fr,$fi,"id");
+$GroupName=sql_result($fr,$fi,"Name");
+?>
+       <option value="<?php echo $GroupID; ?>"><?php echo $GroupName; ?></option>
+<?php ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="editgroup" style="display: none;" />
+<input type="submit" class="Button" value="Edit Group" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if(isset($_POST['id'])) { 
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false)); sql_free_result($preresult);
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if($prenum>=1) {
+$GroupID = sql_result($preresult,0,"id");
+$GroupName = sql_result($preresult,0,"Name");
+$PermissionID = sql_result($preresult,0,"PermissionID");
+$NamePrefix = sql_result($preresult,0,"NamePrefix");
+$NameSuffix = sql_result($preresult,0,"NameSuffix");
+$CanViewBoard = sql_result($preresult,0,"CanViewBoard");
+$CanViewOffLine = sql_result($preresult,0,"CanViewOffLine");
+$CanEditProfile = sql_result($preresult,0,"CanEditProfile");
+$CanAddEvents = sql_result($preresult,0,"CanAddEvents");
+$CanPM = sql_result($preresult,0,"CanPM");
+$CanSearch = sql_result($preresult,0,"CanSearch");
+$CanDoHTML = sql_result($preresult,0,"CanDoHTML");
+$CanUseBBTags = sql_result($preresult,0,"CanUseBBTags");
+$CanViewIPAddress = sql_result($preresult,0,"CanViewIPAddress");
+$CanViewUserAgent = sql_result($preresult,0,"CanViewUserAgent");
+$FloodControl = sql_result($preresult,0,"FloodControl");
+$SearchFlood = sql_result($preresult,0,"SearchFlood");
+$PromoteTo = sql_result($preresult,0,"PromoteTo");
+$PromotePosts = sql_result($preresult,0,"PromotePosts");
+$PromoteKarma = sql_result($preresult,0,"PromoteKarma");
+$HasModCP = sql_result($preresult,0,"HasModCP");
+$HasAdminCP = sql_result($preresult,0,"HasAdminCP");
+$ViewDBInfo = sql_result($preresult,0,"ViewDBInfo");
+sql_free_result($preresult);
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Editing a Group: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="GroupName">Insert name for group:</label></td>
+       <td style="width: 50%;"><input type="text" name="GroupName" class="TextBox" id="GroupName" size="20" value="<?php echo $GroupName; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NamePrefix">Name Prefix:</label></td>
+       <td style="width: 50%;"><input type="text" name="NamePrefix" class="TextBox" id="NamePrefix" size="20" value="<?php echo $NamePrefix; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="NameSuffix">Name Subfix:</label></td>
+       <td style="width: 50%;"><input type="text" name="NameSuffix" class="TextBox" id="NameSuffix" size="20" value="<?php echo $NameSuffix; ?>" /></td>
+<?php if($GroupID!=1) { ?>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewBoard">Can View Board:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewBoard" id="CanViewBoard">
+       <option selected="selected" value="<?php echo $CanViewBoard; ?>">Old Value (<?php echo $CanViewBoard; ?>)</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewOffLine">Can View OffLine Board:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewOffLine" id="CanViewOffLine">
+       <option selected="selected" value="<?php echo $CanViewOffLine; ?>">Old Value (<?php echo $CanViewOffLine; ?>)</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditProfile">Can Edit Profile:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditProfile" id="CanEditProfile">
+       <option selected="selected" value="<?php echo $CanEditProfile; ?>">Old Value (<?php echo $CanEditProfile; ?>)</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanAddEvents">Can Add Events:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanAddEvents" id="CanAddEvents">
+       <option selected="selected" value="<?php echo $CanAddEvents; ?>">Old Value (<?php echo $CanAddEvents; ?>)</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanPM">Can PM:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanPM" id="CanPM">
+       <option selected="selected" value="<?php echo $CanPM; ?>">Old Value (<?php echo $CanPM; ?>)</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanSearch">Can Search:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanSearch" id="CanSearch">
+       <option selected="selected" value="<?php echo $CanSearch; ?>">Old Value (<?php echo $CanSearch; ?>)</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+<?php } ?>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanDoHTML">Can DoHTML:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDoHTML" id="CanDoHTML">
+       <option <?php if($CanDoHTML=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanDoHTML=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanUseBBTags">Can use BBTags:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanUseBBTags" id="CanUseBBTags">
+       <option <?php if($CanUseBBTags=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($CanUseBBTags=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="FloodControl">Flood Control in seconds:</label></td>
+       <td style="width: 50%;"><input type="text" name="FloodControl" class="TextBox" id="FloodControl" size="20" value="<?php echo $FloodControl; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="SearchFlood">Search Flood Control in seconds:</label></td>
+       <td style="width: 50%;"><input type="text" name="SearchFlood" class="TextBox" id="SearchFlood" size="20" value="<?php echo $SearchFlood; ?>" /></td>
+<?php if($GroupID!=1) { ?>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="PromoteTo">Promote To Group:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="PromoteTo" id="PromoteTo">
+       <option selected="selected" value="<?php echo $PromoteTo; ?>">Old Value (<?php echo $PromoteTo; ?>)</option>
+       <option value="0">none</option>
+<?php 
+$fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" ORDER BY \"id\" ASC", array(null));
+$fr=sql_query($fq,$SQLStat);
+$ai=sql_num_rows($fr);
+$fi=0;
+while ($fi < $ai) {
+$ProGroupID=sql_result($fr,$fi,"id");
+$ProGroupName=sql_result($fr,$fi,"Name");
+?>
+       <option value="<?php echo $ProGroupID; ?>"><?php echo $ProGroupName; ?></option>
+<?php ++$fi; }
+sql_free_result($fr); ?>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="PromotePosts">Amount of Posts needed:</label></td>
+       <td style="width: 50%;"><input type="number" name="PromotePosts" class="TextBox" id="PromotePosts" size="20" value="<?php echo $PromotePosts; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="PromoteKarma">Amount of Karma needed:</label></td>
+       <td style="width: 50%;"><input type="number" name="PromoteKarma" class="TextBox" id="PromoteKarma" size="20" value="<?php echo $PromoteKarma; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="HasModCP">Can view Mod CP:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="HasModCP" id="HasModCP">
+       <option selected="selected" value="<?php echo $HasModCP; ?>">Old Value (<?php echo $HasModCP; ?>)</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="HasAdminCP">Can view Admin CP:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="HasAdminCP" id="HasAdminCP">
+       <option selected="selected" value="<?php echo $HasAdminCP; ?>">Old Value (<?php echo $HasAdminCP; ?>)</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewIPAddress">Can view IP Address:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewIPAddress" id="CanViewIPAddress">
+       <option selected="selected" value="<?php echo $CanViewIPAddress; ?>">Old Value (<?php echo $CanViewIPAddress; ?>)</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewUserAgent">Can view user agent:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewUserAgent" id="CanViewUserAgent">
+       <option selected="selected" value="<?php echo $CanViewUserAgent; ?>">Old Value (<?php echo $CanViewUserAgent; ?>)</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ViewDBInfo">Can view Database info:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="ViewDBInfo" id="ViewDBInfo">
+       <option selected="selected" value="<?php echo $ViewDBInfo; ?>">Old Value (<?php echo $ViewDBInfo; ?>)</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+<?php } ?>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="editgroup" style="display: none;" />
+<input type="hidden" name="update" value="now" style="display: none;" />
+<input type="hidden" name="id" value="<?php echo $GroupID; ?>" style="display: none;" />
+<input type="submit" class="Button" value="Edit Group" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } } } if($_POST['act']=="editgroup"&&$_POST['update']=="now"&&$_GET['act']=="editgroup"&&
+       isset($_POST['id'])) {
+$_POST['GroupName'] = stripcslashes(htmlspecialchars($_POST['GroupName'], ENT_QUOTES, $Settings['charset']));
+//$_POST['GroupName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GroupName']);
+$_POST['GroupName'] = remove_spaces($_POST['GroupName']);
+$_POST['NamePrefix'] = stripcslashes(htmlspecialchars($_POST['NamePrefix'], ENT_QUOTES, $Settings['charset']));
+//$_POST['NamePrefix'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['NamePrefix']);
+$_POST['NamePrefix'] = remove_spaces($_POST['NamePrefix']);
+$_POST['NameSuffix'] = stripcslashes(htmlspecialchars($_POST['NameSuffix'], ENT_QUOTES, $Settings['charset']));
+//$_POST['NameSuffix'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['NameSuffix']);
+$_POST['NameSuffix'] = remove_spaces($_POST['NameSuffix']);
+$name_check = 0;
+$prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
+$preresult=sql_query($prequery,$SQLStat);
+$prenum=sql_num_rows($preresult);
+if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false)); sql_free_result($preresult);
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if($prenum>=1) {
+$OldGroupName=sql_result($preresult,0,"Name");
+sql_free_result($preresult);
+if($_POST['GroupName']!=$OldGroupName) {
+$sql_name_check = sql_query(sql_pre_query("SELECT \"Name\" FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s'", array($_POST['GroupName'])),$SQLStat);
+$name_check = sql_num_rows($sql_name_check);
+sql_free_result($sql_name_check); }
+$errorstr = "";
+if (!isset($_POST['PromotePosts'])) {
+       $_POST['PromotePosts'] = 0; }
+if ($_POST['PromotePosts']==null||
+       !is_numeric($_POST['PromotePosts'])) {
+       $_POST['PromotePosts'] = 0; }
+if (!isset($_POST['PromoteKarma'])) {
+       $_POST['PromoteKarma'] = 0; }
+if ($_POST['PromoteKarma']==null||
+       !is_numeric($_POST['PromoteKarma'])) {
+       $_POST['NPromoteKarma'] = 0; }
+if ($_POST['GroupName']==null||
+       $_POST['GroupName']=="ShowMe") { $Error="Yes";
+$errorstr = $errorstr."You need to enter a forum name.<br />\n"; } 
+if($name_check > 0) { $Error="Yes";
+$errorstr = $errorstr."This Group Name is already used.<br />\n"; } 
+if (pre_strlen($_POST['GroupName'])>"150") { $Error="Yes";
+$errorstr = $errorstr."Your Group Name is too big.<br />\n"; } 
+if ($Error!="Yes") {
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+if($_POST['GroupName']!=$OldGroupName) {
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."permissions\" SET \"Name\"='%s' WHERE \"Name\"='%s'", array($_POST['GroupName'],$OldGroupName));
+sql_query($query,$SQLStat);
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."catpermissions\" SET \"Name\"='%s' WHERE \"Name\"='%s'", array($_POST['GroupName'],$OldGroupName));
+sql_query($query,$SQLStat); }
+if($_POST['id']!=1) {
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."groups\" SET \"Name\"='%s',\"NamePrefix\"='%s',\"NameSuffix\"='%s',\"CanViewBoard\"='%s',\"CanViewOffLine\"='%s',\"CanEditProfile\"='%s',\"CanAddEvents\"='%s',\"CanPM\"='%s',\"CanSearch\"='%s',\"CanDoHTML\"='%s',\"CanUseBBTags\"='%s',CanViewIPAddress='%s',CanViewUserAgent='%s',\"FloodControl\"=%i,\"SearchFlood\"=%i,\"PromoteTo\"=%i,\"PromotePosts\"=%i,\"PromoteKarma\"=%i,\"HasModCP\"='%s',\"HasAdminCP\"='%s',\"ViewDBInfo\"='%s' WHERE \"id\"=%i", array($_POST['GroupName'],$_POST['NamePrefix'],$_POST['NameSuffix'],$_POST['CanViewBoard'],$_POST['CanViewOffLine'],$_POST['CanEditProfile'],$_POST['CanAddEvents'],$_POST['CanPM'],$_POST['CanSearch'],$_POST['CanDoHTML'],$_POST['CanUseBBTags'],$_POST['CanViewIPAddress'],$_POST['CanViewUserAgent'],$_POST['FloodControl'],$_POST['SearchFlood'],$_POST['PromoteTo'],$_POST['PromotePosts'],$_POST['PromoteKarma'],$_POST['HasModCP'],$_POST['HasAdminCP'],$_POST['ViewDBInfo'],$_POST['id'])); }
+if($_POST['id']==1) {
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."groups\" SET \"Name\"='%s',\"NamePrefix\"='%s',\"NameSuffix\"='%s',\"CanDoHTML\"='%s',\"CanUseBBTags\"='%s',\"FloodControl\"=%i,\"SearchFlood\"=%i WHERE \"id\"=%i", array($_POST['GroupName'],$_POST['NamePrefix'],$_POST['NameSuffix'],$_POST['CanDoHTML'],$_POST['CanUseBBTags'],$_POST['FloodControl'],$_POST['SearchFlood'],$_POST['id'])); }
+sql_query($query,$SQLStat); } } }  
+$doupdate = false;
+if(isset($_POST['id'])&&$_POST['subact']=="editnow") { 
+       $doupdate = true; }
+if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") { 
+       $doupdate = true; }
+if($_POST['act']=="addgroup"&&$_POST['update']=="now"&&$_GET['act']=="addgroup") { 
+       $doupdate = true; }
+if($_GET['act']=="deletegroup"&&$_POST['update']=="now"&&$_GET['act']=="deletegroup") { 
+       $doupdate = true; }
+if($_POST['act']=="editgroup"&&$_POST['update']=="now"&&$_GET['act']=="editgroup"&&
+       isset($_POST['id'])) { 
+       $doupdate = true; }
+if($doupdate===true&&$Error!="Yes") { ?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr id="ProfileTitle" class="TableMenuRow2">
+<th class="TableMenuColumn2">Updating Settings</th>
+</tr>
+<tr class="TableMenuRow3" id="ProfileUpdate">
+<td class="TableMenuColumn3">
+<?php if($_POST['act']=="addgroup"&&$_POST['update']=="now"&&$_GET['act']=="addgroup") { ?>
+<div style="text-align: center;">
+       <br />The group was created successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } if($_GET['act']=="deletegroup"&&$_POST['update']=="now"&&$_GET['act']=="deletegroup") { ?>
+<div style="text-align: center;">
+       <br />The group was deleted successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } if($_POST['act']=="editgroup"&&$_POST['update']=="now"&&$_GET['act']=="editgroup"&&
+       isset($_POST['id'])) { ?>
+<div style="text-align: center;">
+       <br />The group was edited successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
+       </div>
+<?php } ?>
+</td></tr>
+<tr id="ProfileTitleEnd" class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr></table></div>
+<?php } if ($_GET['act']!=null&&$Error=="Yes") {
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+$admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr id="ProfileTitle" class="TableMenuRow2">
+<th class="TableMenuColumn2">Updating Settings</th>
+</tr>
+<tr class="TableMenuRow3" id="ProfileUpdate">
+<td class="TableMenuColumn3">
+<div style="text-align: center;">
+       <br /><?php echo $errorstr; ?>
+       <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
+       </div>
+</td></tr>
+<tr id="ProfileTitleEnd" class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr></table></div>
+<?php } ?>
+</td></tr>
+</table>
+<div>&nbsp;</div>
diff --git a/admin/members.php b/admin/members.php
new file mode 100644 (file)
index 0000000..5509f7d
--- /dev/null
@@ -0,0 +1,816 @@
+<?php
+/*
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the Revised BSD License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    Revised BSD License for more details.
+
+    Copyright 2004-2017 iDB Support - http://idb.berlios.de/
+    Copyright 2004-2017 Game Maker 2k - http://gamemaker2k.org/
+
+    $FileInfo: members.php - Last Update: 09/13/2018 SVN 875 - Author: cooldude2k $
+*/
+$File3Name = basename($_SERVER['SCRIPT_NAME']);
+if ($File3Name=="members.php"||$File3Name=="/members.php") {
+       require('index.php');
+       exit(); }
+
+// Check if we can goto admin cp
+if($_SESSION['UserGroup']==$Settings['GuestGroup']||$GroupInfo['HasAdminCP']=="no") {
+redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if(!isset($_POST['update'])) { $_POST['update'] = null; }
+if(!isset($_POST['gid'])) { $_POST['gid'] = "0"; }
+if(!isset($_POST['search'])) { $_POST['search'] = "%"; }
+if(!is_numeric($_POST['gid'])) { $_POST['gid'] = "0"; }
+$Error = null; $errorstr = null;
+?>
+<table class="Table3">
+<tr style="width: 100%; vertical-align: top;">
+       <td style="width: 15%; vertical-align: top;">
+<?php 
+require($SettDir['admin'].'table.php'); 
+?>
+</td>
+       <td style="width: 85%; vertical-align: top;">
+<?php if($_POST['act']=="validate"&&$_POST['update']=="now"&&$_GET['act']=="validate"&&$_POST['id']=="0") {
+       $_POST['act'] = null; $_POST['update'] = null; }
+if($_GET['act']=="validate"&&$_POST['update']!="now") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Validating Members";
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=validate",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Validating Members Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=validate",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Validating Members Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Validating Members Manager: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=validate",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="id">Member to validate:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
+<?php 
+$gquerys = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['ValidateGroup']));
+$gresults=sql_query($gquerys,$SQLStat);
+$VGroupID=sql_result($gresults,0,"id");
+sql_free_result($gresults);
+$getmemidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE (\"GroupID\"=%i AND \"id\"<>-1) OR (\"Validated\"='no' AND \"id\"<>-1)", array($VGroupID));
+$getmemidr=sql_query($getmemidq,$SQLStat);
+$getmemidnum=sql_num_rows($getmemidr);
+$getmemidi = 0;
+if($getmemidnum<1) { ?>
+       <option value="0">None</option>
+<?php }
+while ($getmemidi < $getmemidnum) {
+$getmemidID=sql_result($getmemidr,$getmemidi,"id");
+$getmemidName=sql_result($getmemidr,$getmemidi,"Name");
+?>
+<option value="<?php echo $getmemidID; ?>"><?php echo $getmemidName; ?></option>
+<?php ++$getmemidi; }
+sql_free_result($getmemidr); ?>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="validate" style="display: none;" />
+<input type="hidden" name="update" value="now" style="display: none;" />
+<input type="submit" class="Button" value="Validate Member" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_POST['act']=="validate"&&$_POST['update']=="now"&&$_GET['act']=="validate"&&$_POST['id']!="0") { 
+$mguerys = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['MemberGroup']));
+$mgresults=sql_query($mguerys,$SQLStat);
+$MGroupID=sql_result($mgresults,0,"id");
+sql_free_result($mgresults);
+$gquerys = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['ValidateGroup']));
+$gresults=sql_query($gquerys,$SQLStat);
+$VGroupID=sql_result($gresults,0,"id");
+sql_free_result($gresults);
+$query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
+$result=sql_query($query,$SQLStat);
+$num=sql_num_rows($result);
+$i=0;
+$VMemName=sql_result($result,$i,"Name");
+$VMemGroup=sql_result($result,$i,"GroupID");
+$VMemValidated=sql_result($result,$i,"Validated");
+$admincptitle = " ".$ThemeSet['TitleDivider']." Validating Members";
+redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=members",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
+if($VMemGroup==$VGroupID) {
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"GroupID\"='%s', \"Validated\"='%s' WHERE \"id\"=%i", array($MGroupID, "yes", $_POST['id']));
+sql_query($query,$SQLStat); }
+if($VMemGroup!=$VGroupID&&$VMemValidated=="no") {
+$query = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"Validated\"='%s' WHERE \"id\"=%i", array("yes", $_POST['id']));
+sql_query($query,$SQLStat); }
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=members",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=members",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr id="ProfileTitle" class="TableMenuRow2">
+<th class="TableMenuColumn2">Updating Settings</th>
+</tr>
+<tr class="TableMenuRow3" id="ProfileUpdate">
+<td class="TableMenuColumn3">
+<div style="text-align: center;">
+       <br /><?php echo $VMemName; ?> was validated successfully.<br /> <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=members",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
+       </div>
+</td></tr>
+<tr id="ProfileTitleEnd" class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr></table></div>
+<?php } if($_POST['act']=="deletemember"&&$_POST['update']=="now"&&$_GET['act']=="deletemember"&&
+       ($_POST['id']=="0"||$_POST['id']=="1"||$_POST['id']=="-1")) {
+       $_POST['act'] = null; $_POST['update'] = null; }
+if($_GET['act']=="deletemember"&&$_POST['update']!="now") { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Deleting Members";
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=deletemember",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Deleting Members Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=deletemember",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Deleting Members Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Deleting Members Manager: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=deletemember",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="id">Member to delete:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
+<?php 
+$getmemidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE (\"id\"<>-1 AND \"id\"<>1)", array(null));
+$getmemidr=sql_query($getmemidq,$SQLStat);
+$getmemidnum=sql_num_rows($getmemidr);
+$getmemidi = 0;
+if($getmemidnum<1) { ?>
+       <option value="0">None</option>
+<?php }
+while ($getmemidi < $getmemidnum) {
+$getmemidID=sql_result($getmemidr,$getmemidi,"id");
+$getmemidName=sql_result($getmemidr,$getmemidi,"Name");
+?>
+<option value="<?php echo $getmemidID; ?>"><?php echo $getmemidName; ?></option>
+<?php ++$getmemidi; }
+sql_free_result($getmemidr); ?>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="deletemember" style="display: none;" />
+<input type="hidden" name="update" value="now" style="display: none;" />
+<input type="submit" class="Button" value="Delete Member" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_POST['act']=="deletemember"&&$_POST['update']=="now"&&$_GET['act']=="deletemember"&&
+       ($_POST['id']!="0"||$_POST['id']!="1"||$_POST['id']!="-1")) { 
+$DMemName = GetUserName($_POST['id'],$Settings['sqltable']);
+$DMemName = $DMemName['Name'];
+if($DMemName!==null&&($_POST['id']!="0"||$_POST['id']!="1"||$_POST['id']!="-1")) { 
+$dmquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i", array($_POST['id']));
+sql_query($dmquery,$SQLStat);
+$dmquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."mempermissions\" WHERE \"id\"=%i", array($_POST['id']));
+sql_query($dmquery,$SQLStat); 
+$dmgquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."events\" SET \"GuestName\"='%s',\"UserID\"=-1 WHERE \"UserID\"=%i", array($DMemName,$_POST['id']));
+sql_query($dmgquery,$SQLStat);
+$dmgquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."messenger\" SET \"GuestName\"='%s',\"SenderID\"=-1 WHERE \"SenderID\"=%i", array($DMemName,$_POST['id']));
+sql_query($dmgquery,$SQLStat);
+$dmgquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."posts\" SET \"GuestName\"='%s',\"UserID\"=-1 WHERE \"UserID\"=%i", array($DMemName,$_POST['id']));
+sql_query($dmgquery,$SQLStat);
+$dmgquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"GuestName\"='%s',\"UserID\"=-1 WHERE \"UserID\"=%i", array($DMemName,$_POST['id']));
+sql_query($dmgquery,$SQLStat); }
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=members",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=members",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr id="ProfileTitle" class="TableMenuRow2">
+<th class="TableMenuColumn2">Updating Settings</th>
+</tr>
+<tr class="TableMenuRow3" id="ProfileUpdate">
+<td class="TableMenuColumn3">
+<div style="text-align: center;">
+       <br /><?php echo $DMemName; ?> was deleted successfully.<br /> <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=members",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
+       </div>
+</td></tr>
+<tr id="ProfileTitleEnd" class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr></table></div>
+<?php } if($_POST['act']=="editmember"&&$_POST['update']=="now"&&$_GET['act']=="editmember"&&
+       ($_POST['id']=="0"||$_POST['id']=="-1")) {
+       $_POST['act'] = null; $_POST['update'] = null; }
+if($_GET['act']=="editmember"&&$_POST['update']!="now"&&!isset($_POST['id'])) { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Editing Members";
+$_POST['search'] = stripcslashes(htmlspecialchars($_POST['search'], ENT_QUOTES, $Settings['charset']));
+//$_POST['search'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['search']);
+$_POST['search'] = remove_spaces($_POST['search']);
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editmember",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Editing Members Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editmember",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Editing Members Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Editing Members Manager: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acpstool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editmember",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="search">Search for member name:</label></td>
+       <td style="width: 50%;"><input type="text" name="search" class="TextBox" id="search" size="20" value="<?php echo $_POST['search']; ?>" /></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="submit" class="Button" value="Search" name="Apply_Changes" />
+</td></tr></table>
+</form>
+<?php if(isset($_POST['search'])) { ?>
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editmember",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="id">Member to edit:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
+<?php 
+$getmemidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"Name\" LIKE '%s' AND (\"id\"<>-1)", array($_POST['search']));
+$getmemidr=sql_query($getmemidq,$SQLStat);
+$getmemidnum=sql_num_rows($getmemidr);
+$getmemidi = 0;
+if($getmemidnum<1) { ?>
+       <option value="0">None</option>
+<?php }
+while ($getmemidi < $getmemidnum) {
+$getmemidID=sql_result($getmemidr,$getmemidi,"id");
+$getmemidName=sql_result($getmemidr,$getmemidi,"Name");
+?>
+<option value="<?php echo $getmemidID; ?>"><?php echo $getmemidName; ?></option>
+<?php ++$getmemidi; }
+sql_free_result($getmemidr); ?>
+       </select></td>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="editmember" style="display: none;" />
+<input type="submit" class="Button" value="Edit Member" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form><?php } ?>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_POST['act']=="editmember"&&$_POST['update']!="now"&&$_GET['act']=="editmember"&&
+       ($_POST['id']!="0"||$_POST['id']!="-1")) { 
+$admincptitle = " ".$ThemeSet['TitleDivider']." Editing Members";
+$query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
+$result=sql_query($query,$SQLStat);
+$num=sql_num_rows($result);
+if($num<1) {
+redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=editmember",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false));
+ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+$EditMem['ID']=sql_result($result,0,"id");
+$EditMem['Name']=sql_result($result,0,"Name");
+$EditMem['Email']=sql_result($result,0,"Email");
+$EditMem['GroupID']=sql_result($result,0,"GroupID");
+$gquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($EditMem['GroupID']));
+$gresult=sql_query($gquery,$SQLStat);
+$EditMem['Group']=sql_result($gresult,0,"Name");
+sql_free_result($gresult);
+$EditMem['LevelID']=sql_result($result,0,"LevelID");
+$lquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."levels\" WHERE \"id\"=%i LIMIT 1", array($EditMem['LevelID']));
+$lresult=sql_query($lquery,$SQLStat);
+$EditMem['Level']=sql_result($lresult,0,"Name");
+sql_free_result($lresult);
+$EditMem['Validated']=sql_result($result,0,"Validated");
+$EditMem['HiddenMember']=sql_result($result,0,"HiddenMember");
+$EditMem['WarnLevel']=sql_result($result,0,"WarnLevel");
+$EditMem['BanTime']=sql_result($result,0,"BanTime");
+if($EditMem['BanTime']!=""&&$EditMem['BanTime']>1) {
+$tmpusrcurtime = new DateTime();
+$tmpusrcurtime->setTimestamp($EditMem['BanTime']);
+$tmpusrcurtime->setTimezone($utctz);
+$BanMonth=$tmpusrcurtime->format("m");
+$BanDay=$tmpusrcurtime->format("d");
+$BanYear=$tmpusrcurtime->format("Y");
+$EditMem['BanTime'] = $BanMonth."/".$BanDay."/".$BanYear; }
+$EditMem['Interests']=sql_result($result,0,"Interests");
+$EditMem['Signature']=sql_result($result,0,"Signature");
+$EditMem['Avatar']=sql_result($result,0,"Avatar");
+$EditMem['AvatarSize']=sql_result($result,0,"AvatarSize");
+$EditMem['Title']=sql_result($result,0,"Title");
+$EditMem['Website']=sql_result($result,0,"Website");
+$EditMem['Gender']=sql_result($result,0,"Gender");
+$EditMem['PostCount']=sql_result($result,0,"PostCount");
+$EditMem['Karma']=sql_result($result,0,"Karma");
+$EditMem['TimeZone']=sql_result($result,0,"TimeZone");
+$EditMem['DST']=sql_result($result,0,"DST");
+$EditMem['IP']=sql_result($result,0,"IP");
+$mpquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."mempermissions\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
+$mpresult=sql_query($mpquery,$SQLStat);
+$mpnum=sql_num_rows($mpresult);
+$EditMemPerm['PermissionID'] = sql_result($mpresult,0,"PermissionID");
+$EditMemPerm['CanViewBoard'] = sql_result($mpresult,0,"CanViewBoard");
+$EditMemPerm['CanViewOffLine'] = sql_result($mpresult,0,"CanViewOffLine");
+$EditMemPerm['CanEditProfile'] = sql_result($mpresult,0,"CanEditProfile");
+$EditMemPerm['CanAddEvents'] = sql_result($mpresult,0,"CanAddEvents");
+$EditMemPerm['CanPM'] = sql_result($mpresult,0,"CanPM");
+$EditMemPerm['CanSearch'] = sql_result($mpresult,0,"CanSearch");
+$EditMemPerm['CanDoHTML'] = sql_result($mpresult,0,"CanDoHTML");
+$EditMemPerm['CanUseBBTags'] = sql_result($mpresult,0,"CanUseBBTags");
+$EditMemPerm['CanViewIPAddress'] = sql_result($mpresult,0,"CanViewIPAddress");
+$EditMemPerm['CanViewUserAgent'] = sql_result($mpresult,0,"CanViewUserAgent");
+$EditMemPerm['FloodControl'] = sql_result($mpresult,0,"FloodControl");
+$EditMemPerm['SearchFlood'] = sql_result($mpresult,0,"SearchFlood");
+$EditMemPerm['HasModCP'] = sql_result($mpresult,0,"HasModCP");
+$EditMemPerm['HasAdminCP'] = sql_result($mpresult,0,"HasAdminCP");
+$EditMemPerm['ViewDBInfo'] = sql_result($mpresult,0,"ViewDBInfo");
+$MemIPList[0] = $EditMem['IP'];
+$MemIPArrayNum = 1;
+$MemPostIP = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"UserID\"=%i ORDER BY \"TimeStamp\" ASC ", array($EditMem['ID']));
+$mppresult = sql_query($MemPostIP,$SQLStat);
+$mppnum = sql_num_rows($mppresult);
+$mppi = 0;
+while ($mppi < $mppnum) {
+$MemPostCheckIP=sql_result($mppresult,$mppi,"IP");
+if(!in_array($MemPostCheckIP, $MemIPList)) {
+$MemIPList[$MemIPArrayNum] = $MemPostCheckIP;
+++$MemIPArrayNum; }
+$MemPostCheckEditIP=sql_result($mppresult,$mppi,"EditIP");
+if(!in_array($MemPostCheckEditIP, $MemIPList) && $MemPostCheckEditIP!="0") {
+$MemIPList[$MemIPArrayNum] = $MemPostCheckEditIP;
+++$MemIPArrayNum; }
+++$mppi; }
+sql_free_result($mppresult);
+$MemEventIP = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"UserID\"=%i ORDER BY \"TimeStamp\" ASC ", array($EditMem['ID']));
+$mepresult = sql_query($MemEventIP,$SQLStat);
+$mepnum = sql_num_rows($mepresult);
+$mepi = 0;
+while ($mepi < $mepnum) {
+$MemEventCheckIP=sql_result($mepresult,$mepi,"IP");
+if(!in_array($MemEventCheckIP, $MemIPList)) {
+$MemIPList[$MemIPArrayNum] = $MemEventCheckIP;
+++$MemIPArrayNum; }
+++$mepi; }
+sql_free_result($mepresult);
+$fullistnum = count($MemIPList);
+$fullisti = 0;
+$fulliplist = null;
+while($fullisti < $fullistnum) {
+$fulliplist = $fulliplist." <a onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$MemIPList[$fullisti])."\">".$MemIPList[$fullisti]."</a>";
+++$fullisti; }
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editmember",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Editing Members Manager</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editmember",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Editing Members Manager</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr class="TableMenuRow2">
+<th class="TableMenuColumn2" style="width: 100%; text-align: left;">
+<span style="float: left;">&nbsp;Editing Members Manager: </span>
+<span style="float: right;">&nbsp;</span>
+</th>
+</tr>
+<tr class="TableMenuRow3">
+<td class="TableMenuColumn3">
+<form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editmember",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
+<table style="text-align: left;">
+<?php if($GroupInfo['CanViewIPAddress']=="yes") { ?>
+<tr style="text-align: left;">
+       <td style="width: 50%;"><span class="TextBoxLabel">Members IP:</span></td>
+       <td style="width: 50%;"><a onclick="window.open(this.href);return false;" href="<?php echo sprintf($IPCheckURL,$EditMem['IP']); ?>"><?php echo $EditMem['IP']; ?></a></td>
+</tr>
+<?php if($fulliplist!=null && $fullistnum>1) { ?>
+<tr style="text-align: left;">
+       <td style="width: 50%;"><span class="TextBoxLabel">Members Old IPs:</span></td>
+       <td style="width: 50%;"><?php echo $fulliplist; ?></td>
+</tr><?php } } ?><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="MemName">Members Name:</label></td>
+       <td style="width: 50%;"><input type="text" name="MemName" class="TextBox" id="MemName" size="20" value="<?php echo $EditMem['Name']; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="MemEmail">Members Email:</label></td>
+       <td style="width: 50%;"><input type="email" name="MemEmail" class="TextBox" id="MemEmail" size="20" value="<?php echo $EditMem['Email']; ?>" /></td>
+<?php if($EditMem['ID']!=1) { ?>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="gid">New Group for Member:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="gid" id="gid">
+<?php 
+$getgrpidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE (\"Name\"<>'%s' AND \"Name\"<>'%s')", array($Settings['GuestGroup'],$Settings['ValidateGroup']));
+$getgrpidr=sql_query($getgrpidq,$SQLStat);
+$getgrpidnum=sql_num_rows($getgrpidr);
+$getgrpidi = 0;
+if($getgrpidnum<1) { ?>
+       <option value="0">None</option>
+<?php }
+while ($getgrpidi < $getgrpidnum) {
+$getgrpidID=sql_result($getgrpidr,$getgrpidi,"id");
+$getgrpidName=sql_result($getgrpidr,$getgrpidi,"Name");
+$GIDselected = null;
+if($getgrpidID==$EditMem['GroupID']) { 
+       $GIDselected = " selected=\"selected\""; }
+?>
+<option value="<?php echo $getgrpidID; ?>"<?php echo $GIDselected; ?>><?php echo $getgrpidName; ?></option>
+<?php ++$getgrpidi; }
+sql_free_result($getgrpidr); ?>
+       </select></td>
+<?php /*}*/ ?>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="lid">New Level for Member:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="lid" id="lid">
+<?php 
+$getlevidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."levels\" WHERE (\"Name\"<>'%s' AND \"id\"<>%i)", array("Guest",-1));
+$getlevidr=sql_query($getlevidq,$SQLStat);
+$getlevidnum=sql_num_rows($getlevidr);
+$getlevidi = 0;
+if($getlevidnum<1) { ?>
+       <option value="0">None</option>
+<?php }
+while ($getlevidi < $getlevidnum) {
+$getlevidID=sql_result($getlevidr,$getlevidi,"id");
+$getlevidName=sql_result($getlevidr,$getlevidi,"Name");
+$LIDselected = null;
+if($getlevidID==$EditMem['LevelID']) { 
+       $LIDselected = " selected=\"selected\""; }
+?>
+<option value="<?php echo $getlevidID; ?>"<?php echo $LIDselected; ?>><?php echo $getlevidName; ?></option>
+<?php ++$getlevidi; }
+sql_free_result($getlevidr); ?>
+       </select></td>
+<?php } ?>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="MemHidden">Hidden Member:</label></td>
+       <td style="width: 50%;"><select id="MemHidden" name="MemHidden" class="TextBox">
+<option selected="selected" value="<?php echo $EditMem['HiddenMember']; ?>">Old Value (<?php echo $EditMem['HiddenMember']; ?>)</option>
+<option value="no">No</option>
+<option value="yes">Yes</option>
+</select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="MemWarnLevel">Members Warn Level:</label></td>
+       <td style="width: 50%;"><input type="number" name="MemWarnLevel" class="TextBox" id="MemWarnLevel" size="20" value="<?php echo $EditMem['WarnLevel']; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="MemBanTime" title="Enter date till user is banned in MM/DD/YYYY format. 0 means no ban and -1 means permanent ban.">Members Ban Time:</label></td>
+       <td style="width: 50%;"><input type="date" name="MemBanTime" class="TextBox" id="MemBanTime" size="20" value="<?php echo preg_replace("/([0-9]{2})\/([0-9]{2})\/([0-9]{4})/", "$3-$1-$2", $EditMem['BanTime']); ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="MemPostCount">Members Post Count:</label></td>
+       <td style="width: 50%;"><input type="number" name="MemPostCount" class="TextBox" id="MemPostCount" size="20" value="<?php echo $EditMem['PostCount']; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="MemKarma">Members Karma Count:</label></td>
+       <td style="width: 50%;"><input type="number" name="MemKarma" class="TextBox" id="MemKarma" size="20" value="<?php echo $EditMem['Karma']; ?>" /></td>
+<?php if($EditMem['ID']!=1) { ?>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="MemPermID">Members Permission ID:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="MemPermID" id="MemPermID">
+       <option <?php if($EditMemPerm['PermissionID']=="0") { echo "selected=\"selected\" "; } ?>value="0">use group info</option>
+<?php 
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="sqlite"||
+       $Settings['sqltype']=="sqlite3") {
+$getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."permissions\"", array(null)); }
+if($Settings['sqltype']=="cubrid") {
+$getperidq = sql_pre_query("SELECT DISTINCT \"permissionid\" FROM \"".$Settings['sqltable']."permissions\"", array(null)); }
+$getperidr=sql_query($getperidq,$SQLStat);
+$getperidnum=sql_num_rows($getperidr);
+$getperidi = 0;
+while ($getperidi < $getperidnum) {
+if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
+       $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
+       $Settings['sqltype']=="sqlite3") {
+$getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
+if($Settings['sqltype']=="sqlite") {
+$getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
+$getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i ORDER BY \"PermissionID\" ASC", array($getperidID));
+$getperidr2=sql_query($getperidq2,$SQLStat);
+$getperidnum2=sql_num_rows($getperidr2);
+$getperidName=sql_result($getperidr2,0,"Name");
+sql_free_result($getperidr2);
+?>
+       <option <?php if($EditMemPerm['PermissionID']==$getperidID) { echo "selected=\"selected\" "; } ?>value="<?php echo $getperidID; ?>"><?php echo $getperidName; ?></option>
+<?php ++$getperidi; }
+sql_free_result($getperidr); ?>
+       </select></td>
+<?php } if($EditMem['ID']!=1) { ?>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewBoard">Can View Board:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewBoard" id="CanViewBoard">
+       <option selected="selected" value="<?php echo $EditMemPerm['CanViewBoard']; ?>">Old Value (<?php echo $EditMemPerm['CanViewBoard']; ?>)</option>
+       <option value="group">use group info</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewOffLine">Can View OffLine Board:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewOffLine" id="CanViewOffLine">
+       <option selected="selected" value="<?php echo $EditMemPerm['CanViewOffLine']; ?>">Old Value (<?php echo $EditMemPerm['CanViewOffLine']; ?>)</option>
+       <option value="group">use group info</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditProfile">Can Edit Profile:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditProfile" id="CanEditProfile">
+       <option selected="selected" value="<?php echo $EditMemPerm['CanEditProfile']; ?>">Old Value (<?php echo $EditMemPerm['CanEditProfile']; ?>)</option>
+       <option value="group">use group info</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanAddEvents">Can Add Events:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanAddEvents" id="CanAddEvents">
+       <option selected="selected" value="<?php echo $EditMemPerm['CanAddEvents']; ?>">Old Value (<?php echo $EditMemPerm['CanAddEvents']; ?>)</option>
+       <option value="group">use group info</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanPM">Can PM:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanPM" id="CanPM">
+       <option selected="selected" value="<?php echo $EditMemPerm['CanPM']; ?>">Old Value (<?php echo $EditMemPerm['CanPM']; ?>)</option>
+       <option value="group">use group info</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanSearch">Can Search:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanSearch" id="CanSearch">
+       <option selected="selected" value="<?php echo $EditMemPerm['CanSearch']; ?>">Old Value (<?php echo $EditMemPerm['CanSearch']; ?>)</option>
+       <option value="group">use group info</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+<?php } ?>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanDoHTML">Can DoHTML:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanDoHTML" id="CanDoHTML">
+       <option <?php if($EditMemPerm['CanDoHTML']=="group") { echo "selected=\"selected\" "; } ?>value="group">use group info</option>
+       <option <?php if($EditMemPerm['CanDoHTML']=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($EditMemPerm['CanDoHTML']=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanUseBBTags">Can use BBTags:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanUseBBTags" id="CanUseBBTags">
+       <option <?php if($EditMemPerm['CanUseBBTags']=="group") { echo "selected=\"selected\" "; } ?>value="group">use group info</option>
+       <option <?php if($EditMemPerm['CanUseBBTags']=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($EditMemPerm['CanUseBBTags']=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+<?php if($EditMem['ID']!=1) { ?>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewIPAddress">Can view IP Address:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewIPAddress" id="CanViewIPAddress">
+       <option <?php if($EditMemPerm['CanViewIPAddress']=="group") { echo "selected=\"selected\" "; } ?>value="group">use group info</option>
+       <option <?php if($EditMemPerm['CanViewIPAddress']=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($EditMemPerm['CanViewIPAddress']=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewUserAgent">Can view user agent:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewUserAgent" id="CanViewUserAgent">
+       <option <?php if($EditMemPerm['CanViewUserAgent']=="group") { echo "selected=\"selected\" "; } ?>value="group">use group info</option>
+       <option <?php if($EditMemPerm['CanViewUserAgent']=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
+       <option <?php if($EditMemPerm['CanViewUserAgent']=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
+       </select></td>
+<?php } ?>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="FloodControl">Flood Control in seconds:</label></td>
+       <td style="width: 50%;"><input type="text" name="FloodControl" class="TextBox" id="FloodControl" size="20" value="<?php echo $EditMemPerm['FloodControl']; ?>" /></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="SearchFlood">Search Flood Control in seconds:</label></td>
+       <td style="width: 50%;"><input type="text" name="SearchFlood" class="TextBox" id="SearchFlood" size="20" value="<?php echo $EditMemPerm['SearchFlood']; ?>" /></td>
+<?php if($EditMem['ID']!=1) { ?>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="HasModCP">Can view Mod CP:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="HasModCP" id="HasModCP">
+       <option selected="selected" value="<?php echo $EditMemPerm['HasModCP']; ?>">Old Value (<?php echo $EditMemPerm['HasModCP']; ?>)</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="HasAdminCP">Can view Admin CP:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="HasAdminCP" id="HasAdminCP">
+       <option selected="selected" value="<?php echo $EditMemPerm['HasAdminCP']; ?>">Old Value (<?php echo $EditMemPerm['HasAdminCP']; ?>)</option>
+       <option value="group">use group info</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+</tr><tr style="text-align: left;">
+       <td style="width: 50%;"><label class="TextBoxLabel" for="ViewDBInfo">Can view Database info:</label></td>
+       <td style="width: 50%;"><select size="1" class="TextBox" name="ViewDBInfo" id="ViewDBInfo">
+       <option selected="selected" value="<?php echo $EditMemPerm['ViewDBInfo']; ?>">Old Value (<?php echo $EditMemPerm['ViewDBInfo']; ?>)</option>
+       <option value="group">use group info</option>
+       <option value="yes">yes</option>
+       <option value="no">no</option>
+       </select></td>
+<?php } ?>
+</tr></table>
+<table style="text-align: left;">
+<tr style="text-align: left;">
+<td style="width: 100%;">
+<input type="hidden" name="act" value="editmember" style="display: none;" />
+<input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" style="display: none;" />
+<input type="hidden" name="update" value="now" style="display: none;" />
+<input type="submit" class="Button" value="Edit Member" name="Apply_Changes" />
+<input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
+</td></tr></table>
+</form>
+</td>
+</tr>
+<tr class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr>
+</table>
+</div>
+<?php } if($_POST['act']=="editmember"&&$_POST['update']=="now"&&$_GET['act']=="editmember"&&
+       ($_POST['id']!="0"||$_POST['id']!="-1")) { 
+$ggidquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['GuestGroup']));
+$ggidresult=sql_query($ggidquery,$SQLStat);
+$GuestGroupID=sql_result($ggidresult,0,"id");
+sql_free_result($ggidresult);
+$vgidquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['ValidateGroup']));
+$vgidresult=sql_query($vgidquery,$SQLStat);
+$ValidateGroupID=sql_result($vgidresult,0,"id");
+sql_free_result($vgidresult);
+$DMemName = GetUserName($_POST['id'],$Settings['sqltable']);
+$DMemName = $DMemName['Name'];
+$_POST['MemName'] = stripcslashes(htmlspecialchars($_POST['MemName'], ENT_QUOTES, $Settings['charset']));
+//$_POST['MemName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['MemName']);
+$_POST['MemName'] = remove_spaces($_POST['MemName']);
+$_POST['MemEmail'] = remove_spaces($_POST['MemEmail']);
+$username_check = null;
+if($_POST['MemName']!=$DMemName) {
+$tquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"GuestName\"='%s' WHERE \"UserID\"=%i", array($_POST['MemName'],$_POST['id']));
+sql_query($tquery,$SQLStat);
+$r1query = sql_pre_query("UPDATE \"".$Settings['sqltable']."posts\" SET \"GuestName\"='%s' WHERE \"UserID\"=%i", array($_POST['MemName'],$_POST['id']));
+sql_query($r1query,$SQLStat);
+$r2query = sql_pre_query("UPDATE \"".$Settings['sqltable']."posts\" SET \"EditUserName\"='%s' WHERE \"EditUser\"=%i", array($_POST['MemName'],$_POST['id']));
+sql_query($r2query,$SQLStat);
+$sql_username_check = sql_query(sql_pre_query("SELECT \"Name\" FROM \"".$Settings['sqltable']."members\" WHERE \"Name\"='%s'", array($_POST['MemName'])),$SQLStat);
+$username_check = sql_num_rows($sql_username_check);
+sql_free_result($sql_username_check); }
+if($_POST['MemHidden']!="yes"&&$_POST['MemHidden']!="no") {
+       $_POST['MemHidden'] = "no"; }
+if(!is_numeric($_POST['MemWarnLevel'])) { $_POST['MemWarnLevel'] = "0"; }
+if(!is_numeric($_POST['MemPostCount'])) { $_POST['MemPostCount'] = "0"; }
+if(!is_numeric($_POST['MemKarma'])) { $_POST['MemKarma'] = "0"; }
+if(preg_match("/([0-9]{4})\-([0-9]{2})\-([0-9]{2})/", $_POST['MemBanTime'])) { $_POST['MemBanTime'] = preg_replace("/([0-9]{4})\-([0-9]{2})\-([0-9]{2})/", "$2/$3/$1", $_POST['MemBanTime']); }
+       if($_POST['MemBanTime']!=null&&$_POST['MemBanTime']>1) {
+       $BirthExpl = explode("/",$_POST['MemBanTime']);
+       if(count($BirthExpl)!="3") { 
+       $_POST['MemBanTime'] = "0"; $BirthExpl[0] = "0"; $BirthExpl[1] = "0"; $BirthExpl[2] = "0"; }
+       if(!is_numeric($BirthExpl[0])) { $BirthExpl[0] = "0"; }
+       if(!is_numeric($BirthExpl[1])) { $BirthExpl[1] = "0"; }
+       if(!is_numeric($BirthExpl[2])) { $BirthExpl[2] = "0"; }
+       if(count($BirthExpl)=="3"&&checkdate($BirthExpl[0],$BirthExpl[1],$BirthExpl[2])===true) {
+       if(is_numeric($BirthExpl[0])&&is_numeric($BirthExpl[1])&&is_numeric($BirthExpl[2])) {
+       if(pre_strlen($BirthExpl[0])=="1") { $BirthExpl[0] = "0".$BirthExpl[0]; }
+       if(pre_strlen($BirthExpl[1])=="1") { $BirthExpl[1] = "0".$BirthExpl[1]; }
+       if(pre_strlen($BirthExpl[0])=="2"&&pre_strlen($BirthExpl[1])=="2"&&pre_strlen($BirthExpl[2])=="4") {
+       $BirthIn = mktime(12,12,12,$BirthExpl[0],$BirthExpl[1],$BirthExpl[2]);
+       $tmpusrcurtime = new DateTime();
+       $tmpusrcurtime->setTimestamp($BirthIn);
+       $tmpusrcurtime->setTimezone($utctz);
+       $BirthMonth=$tmpusrcurtime->format("m");
+       $BirthDay=$tmpusrcurtime->format("d");
+       $BirthYear=$tmpusrcurtime->format("Y"); 
+       $_POST['MemBanTime'] = $BirthIn; }
+       if(pre_strlen($BirthExpl[0])!="2"||pre_strlen($BirthExpl[1])!="2"||pre_strlen($BirthExpl[2])!="4") { 
+               $_POST['MemBanTime'] = "0"; $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
+       if (!is_numeric($BirthExpl[0])||!is_numeric($BirthExpl[1])||!is_numeric($BirthExpl[2])) { 
+               $_POST['MemBanTime'] = "0"; $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
+       if(count($BirthExpl)=="3"&&
+       checkdate($BirthExpl[0],$BirthExpl[1],$BirthExpl[2])===false) {
+       $_POST['MemBanTime'] = "0"; $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; }
+       if(count($BirthExpl)!="3") { 
+       $_POST['MemBanTime'] = "0"; $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
+if($DMemName!==null&&($_POST['id']!="0"||$_POST['id']!="-1")&&
+       ($_POST['gid']!=$GuestGroupID||$_POST['gid']!=$ValidateGroupID)) { 
+if($_POST['MemName']==$DMemName||$username_check>=1) {
+if($_POST['id']!=1) {
+if(!is_numeric($_POST['MemPermID'])) { $_POST['MemPermID'] = "0"; }
+$dmquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"GroupID\"=%i,\"LevelID\"=%i,\"HiddenMember\"='%s',\"WarnLevel\"=%i,\"BanTime\"=%i,\"PostCount\"=%i,\"Karma\"=%i WHERE \"id\"=%i", array($_POST['gid'],$_POST['lid'],$_POST['MemHidden'],$_POST['MemWarnLevel'],$_POST['MemBanTime'],$_POST['MemPostCount'],$_POST['MemKarma'],$_POST['id'])); 
+$dpmquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."mempermissions\" SET \"PermissionID\"=%i,\"CanViewBoard\"='%s',\"CanViewOffLine\"='%s',\"CanEditProfile\"='%s',\"CanAddEvents\"='%s',\"CanPM\"='%s',\"CanSearch\"='%s',\"CanDoHTML\"='%s',\"CanUseBBTags\"='%s',\"CanViewIPAddress\"='%s',\"CanViewUserAgent\"='%s',\"FloodControl\"=%i,\"SearchFlood\"=%i,\"HasModCP\"='%s',\"HasAdminCP\"='%s',\"ViewDBInfo\"='%s' WHERE \"id\"=%i", array($_POST['MemPermID'],$_POST['CanViewBoard'],$_POST['CanViewOffLine'],$_POST['CanEditProfile'],$_POST['CanAddEvents'],$_POST['CanPM'],$_POST['CanSearch'],$_POST['CanDoHTML'],$_POST['CanUseBBTags'],$_POST['CanViewIPAddress'],$_POST['CanViewUserAgent'],$_POST['FloodControl'],$_POST['SearchFlood'],$_POST['HasModCP'],$_POST['HasAdminCP'],$_POST['ViewDBInfo'],$_POST['id'])); }
+if($_POST['id']==1) {
+$dmquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"HiddenMember\"='%s',\"WarnLevel\"=%i,\"BanTime\"=%i,\"PostCount\"=%i,\"Karma\"=%i WHERE \"id\"=%i", array($_POST['MemHidden'],$_POST['MemWarnLevel'],$_POST['MemBanTime'],$_POST['MemPostCount'],$_POST['MemKarma'],$_POST['id'])); 
+$dpmquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."mempermissions\" SET \"CanDoHTML\"='%s',\"CanUseBBTags\"='%s',\"FloodControl\"=%i,\"SearchFlood\"=%i WHERE \"id\"=%i", array($_POST['CanDoHTML'],$_POST['CanUseBBTags'],$_POST['FloodControl'],$_POST['SearchFlood'],$_POST['id'])); } }
+if($_POST['MemName']!=$DMemName&&$username_check<1) {
+if($_POST['id']!=1) {
+if(!is_numeric($_POST['MemPermID'])) { $_POST['MemPermID'] = "0"; }
+$dmquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"Name\"='%s',\"GroupID\"=%i,\"LevelID\"=%i,\"HiddenMember\"='%s',\"WarnLevel\"=%i,\"BanTime\"=%i,\"PostCount\"=%i,\"Karma\"=%i WHERE \"id\"=%i", array($_POST['MemName'],$_POST['gid'],$_POST['lid'],$_POST['MemHidden'],$_POST['MemWarnLevel'],$_POST['MemBanTime'],$_POST['MemPostCount'],$_POST['MemKarma'],$_POST['id'])); 
+$dpmquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."mempermissions\" SET \"PermissionID\"=%i,\"CanViewBoard\"='%s',\"CanViewOffLine\"='%s',\"CanEditProfile\"='%s',\"CanAddEvents\"='%s',\"CanPM\"='%s',\"CanSearch\"='%s',\"CanDoHTML\"='%s',\"CanUseBBTags\"='%s',\"CanViewIPAddress\"='%s',\"CanViewUserAgent\"='%s',\"FloodControl\"=%i,\"SearchFlood\"=%i,\"HasModCP\"='%s',\"HasAdminCP\"='%s',\"ViewDBInfo\"='%s' WHERE \"id\"=%i", array($_POST['MemPermID'],$_POST['CanViewBoard'],$_POST['CanViewOffLine'],$_POST['CanEditProfile'],$_POST['CanAddEvents'],$_POST['CanPM'],$_POST['CanSearch'],$_POST['CanDoHTML'],$_POST['CanUseBBTags'],$_POST['CanViewIPAddress'],$_POST['CanViewUserAgent'],$_POST['FloodControl'],$_POST['SearchFlood'],$_POST['HasModCP'],$_POST['HasAdminCP'],$_POST['ViewDBInfo'],$_POST['id'])); } 
+if($_POST['id']==1) {
+$dmquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"Name\"='%s',\"HiddenMember\"='%s',\"WarnLevel\"=%i,\"BanTime\"=%i,\"PostCount\"=%i,\"Karma\"=%i WHERE \"id\"=%i", array($_POST['MemName'],$_POST['MemHidden'],$_POST['MemWarnLevel'],$_POST['MemBanTime'],$_POST['MemPostCount'],$_POST['MemKarma'],$_POST['id'])); 
+$dpmquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."mempermissions\" SET \"CanViewBoard\"='%s',\"CanViewOffLine\"='%s',\"CanEditProfile\"='%s',\"CanAddEvents\"='%s',\"CanPM\"='%s',\"CanSearch\"='%s',\"CanDoHTML\"='%s',\"CanUseBBTags\"='%s',\"CanViewIPAddress\"='%s',\"CanViewUserAgent\"='%s',\"FloodControl\"=%i,\"SearchFlood\"=%i WHERE \"id\"=%i", array($_POST['CanViewBoard'],$_POST['CanViewOffLine'],$_POST['CanEditProfile'],$_POST['CanAddEvents'],$_POST['CanPM'],$_POST['CanSearch'],$_POST['CanDoHTML'],$_POST['CanUseBBTags'],$_POST['CanViewIPAddress'],$_POST['CanViewUserAgent'],$_POST['FloodControl'],$_POST['SearchFlood'],$_POST['id'])); } }
+sql_query($dmquery,$SQLStat);
+sql_query($dpmquery,$SQLStat); }
+?>
+<div class="TableMenuBorder">
+<?php if($ThemeSet['TableStyle']=="div") { ?>
+<div class="TableMenuRow1">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=members",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a></div>
+<?php } ?>
+<table class="TableMenu" style="width: 100%;">
+<?php if($ThemeSet['TableStyle']=="table") { ?>
+<tr class="TableMenuRow1">
+<td class="TableMenuColumn1"><span style="float: left;">
+<?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=members",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a>
+</span><span style="float: right;">&nbsp;</span></td>
+</tr><?php } ?>
+<tr id="ProfileTitle" class="TableMenuRow2">
+<th class="TableMenuColumn2">Updating Settings</th>
+</tr>
+<tr class="TableMenuRow3" id="ProfileUpdate">
+<td class="TableMenuColumn3">
+<div style="text-align: center;">
+       <br /><?php echo $DMemName; ?>&#39;s member info was changed successfully.<br /> <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=members",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
+       </div>
+</td></tr>
+<tr id="ProfileTitleEnd" class="TableMenuRow4">
+<td class="TableMenuColumn4">&nbsp;</td>
+</tr></table></div>
+<?php } ?>
+</td></tr>
+</table>
+<div>&nbsp;</div>
diff --git a/versioninfo.php b/versioninfo.php
new file mode 100644 (file)
index 0000000..b596a22
--- /dev/null
@@ -0,0 +1,141 @@
+<?php\r
+/*\r
+    This program is free software; you can redistribute it and/or modify\r
+    it under the terms of the Revised BSD License.\r
+\r
+    This program is distributed in the hope that it will be useful,\r
+    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+    Revised BSD License for more details.\r
+\r
+    Copyright 2004-2017 iDB Support - http://idb.berlios.de/\r
+    Copyright 2004-2017 Game Maker 2k - http://gamemaker2k.org/\r
+\r
+    $FileInfo: versioninfo.php - Last Update: 09/13/2018 SVN 875 - Author: cooldude2k $\r
+*/\r
+$File3Name = basename($_SERVER['SCRIPT_NAME']);\r
+if ($File3Name=="versioninfo.php"||$File3Name=="/versioninfo.php") {\r
+       require('index.php');\r
+       exit(); }\r
+       $rssurlon = "off";\r
+// Version info stuff. :P \r
+function version_info($proname,$subver,$ver,$supver,$reltype,$svnver,$showsvn) {\r
+       $return_var = $proname." ".$reltype." ".$subver.".".$ver.".".$supver;\r
+       if($showsvn===false) { $showsvn = null; }\r
+       if($showsvn===true) { $return_var .= " SVN ".$svnver; }\r
+       if($showsvn!==true&&$showsvn!==null) { $return_var .= " ".$showsvn." ".$svnver; }\r
+       return $return_var; }\r
+// Version number and date stuff. :P\r
+$VER1[0] = 0; $VER1[1] = 5; $VER1[2] = 0; $VERFull[1] = $VER1[0].".".$VER1[1].".".$VER1[2];\r
+$VER2[0] = "Alpha"; $VER2[1] = "Al"; $VER2[2] = "SVN"; $SubVerN = 875;\r
+$SVNDay[0] = 9; $SVNDay[1] = 13; $SVNDay[2] = 2018; $SVNDay[3] = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2];\r
+$AltName = "DF2k"; $AltName2 = "DF2k"; $RName = "iDB"; $SFName = "IntDB";\r
+$RFullName = "Internet Discussion Boards"; $AltFullName = "Discussion Forums 2k"; $AltGM2k = "Game Maker 2k";\r
+$VerCheckName = "iDB"; $AltVerCheckName = "DF2k"; $AltiDBHome = "http://df2k.gamemaker2k.org/";\r
+$AltGM2kHome = "http://df2k.gamemaker2k.org/"; $AltGM2kURL = "<a href=\"".$AltGM2kHome."\" title=\"".$AltGM2k."\" onclick=\"window.open(this.href);return false;\">".$AltGM2k."</a>";\r
+$iDBTheme = "iDB"; $AltiDBTheme = "Gray"; \r
+$UserAgentName = "iDB-Forum"; $AltUserAgentName = "DF2k-Forum";\r
+if(!isset($Settings['usealtname'])) { $Settings['usealtname'] = "no"; }\r
+if(isset($Settings['usealtname'])&&$Settings['usealtname']=="yes") {\r
+if(isset($iDBAltName['VER1'][0])) { $VER1[0] = $iDBAltName['VER1'][0]; }\r
+if(isset($iDBAltName['VER1'][1])) { $VER1[1] = $iDBAltName['VER1'][1]; }\r
+if(isset($iDBAltName['VER1'][2])) { $VER1[2] = $iDBAltName['VER1'][2]; }\r
+if(isset($iDBAltName['VER1'][0])&&\r
+       isset($iDBAltName['VER1'][1])&&\r
+       isset($iDBAltName['VER1'][2])) { \r
+       $VERFull[1] = $VER1[0].".".$VER1[1].".".$VER1[2]; }\r
+if(isset($iDBAltName['VER2'][0])) { $VER2[0] = $iDBAltName['VER2'][0]; }\r
+if(isset($iDBAltName['VER2'][1])) { $VER2[1] = $iDBAltName['VER2'][1]; }\r
+if(isset($iDBAltName['VER2'][2])) { $VER2[2] = $iDBAltName['VER2'][2]; }\r
+if(isset($iDBAltName['SubVerN'])) { $SubVerN = $iDBAltName['SubVerN']; }\r
+if(isset($iDBAltName['SVNDay'][0])) { $SVNDay[0] = $iDBAltName['SVNDay'][0]; }\r
+if(isset($iDBAltName['SVNDay'][1])) { $SVNDay[1] = $iDBAltName['SVNDay'][1]; }\r
+if(isset($iDBAltName['SVNDay'][2])) { $SVNDay[2] = $iDBAltName['SVNDay'][2]; }\r
+if(isset($iDBAltName['SVNDay'][0])&&\r
+       isset($iDBAltName['SVNDay'][1])&&\r
+       isset($iDBAltName['SVNDay'][2])) { \r
+       $SVNDay[3] = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2]; }\r
+if(isset($iDBAltName['AltName'])) { $AltName = $iDBAltName['AltName']; }\r
+if(isset($iDBAltName['AltName2'])) { $AltName2 = $iDBAltName['AltName2']; }\r
+if(isset($iDBAltName['AltFullName'])) { $AltFullName = $iDBAltName['AltFullName']; } \r
+if(isset($iDBAltName['AltVerCheckName'])) { $AltVerCheckName = $iDBAltName['AltVerCheckName']; } \r
+if(isset($iDBAltName['AltUserAgentName'])) { $AltUserAgentName = $iDBAltName['AltUserAgentName']; } \r
+if(isset($iDBAltName['AltiDBHome'])) { $AltiDBHome = $iDBAltName['AltiDBHome']; } \r
+if(isset($iDBAltName['AltGM2k'])) { $AltGM2k = $iDBAltName['AltGM2k']; } \r
+if(isset($iDBAltName['AltGM2kHome'])) { $AltGM2kHome = $iDBAltName['AltGM2kHome']; } \r
+if(isset($iDBAltName['AltGM2kURL'])) { $AltGM2kURL = $iDBAltName['AltGM2kURL']; } \r
+if(isset($iDBAltName['AltiDBTheme'])) { $AltiDBTheme = $iDBAltName['AltiDBTheme']; } \r
+if(isset($iDBAltName['VerCheckURL'])) { $Settings['VerCheckURL'] = $iDBAltName['VerCheckURL']; } }\r
+if(isset($Settings['usealtname'])&&$Settings['usealtname']=="yes") {\r
+       $RName = $AltName2; $SFName = $AltName; $RFullName = $AltFullName; $VerCheckName = $AltVerCheckName; $UserAgentName = $AltUserAgentName; }\r
+$VerInfo['iDB_Ver'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[1],$SubVerN,false);\r
+$VerInfo['iDB_Ver_SVN'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[1],$SubVerN,$VER2[2]);\r
+$VerInfo['iDB_Full_Ver'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[0],$SubVerN,false);\r
+$VerInfo['iDB_Full_Ver_SVN'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[0],$SubVerN,$VER2[2]);\r
+$VerInfo['iDB_Ver_Show'] = $VerInfo['iDB_Ver_SVN']; $VerInfo['iDB_Full_Ver_Show'] = $VerInfo['iDB_Full_Ver_SVN'];\r
+define("_iDB_Ver_", $VerInfo['iDB_Ver']); define("_iDB_Ver_SVN_", $VerInfo['iDB_Ver_SVN']);\r
+define("_iDB_Full_Ver_", $VerInfo['iDB_Full_Ver']); define("_iDB_Full_Ver_SVN_", $VerInfo['iDB_Full_Ver_SVN']);\r
+define("_iDB_Ver_Show_", $VerInfo['iDB_Ver_Show']); define("_iDB_Full_Ver_Show_", $VerInfo['iDB_Full_Ver_Show']);\r
+/* \r
+URLs and names and stuff. :P \r
+$KSP = "Kazuki Suzuki Przyborowski";\r
+$KSPAlt = "Kazuki Suzuki Przyborowski";\r
+*/\r
+$iDBHome = "http://ja.gamemaker2k.org/"; $DF2kHome = "http://df2k.gamemaker2k.org/"; \r
+$OrgName = "iDB"; $AltOrgName = "DF2k"; $AltiDB = "Discussion Forums 2k";\r
+$AltSQLDumper = null;\r
+if(isset($Settings['usealtname'])&&$Settings['usealtname']=="yes") {\r
+if(isset($iDBAltName['AltOrgName'])) { $AltOrgName = $iDBAltName['AltOrgName']; }\r
+if(isset($iDBAltName['AltiDB'])) { $AltiDB = $iDBAltName['AltiDB']; }\r
+if(isset($iDBAltName['AltSQLDumperName'])) { $AltSQLDumper = $iDBAltName['AltSQLDumperName']; } }\r
+if(!isset($Settings['VerCheckURL'])||\r
+       $Settings['VerCheckURL']==="") {\r
+$VerCheckURL = $iDBHome."?act=vercheck"; }\r
+if(isset($Settings['VerCheckURL'])&&\r
+       $Settings['VerCheckURL']!=="") {\r
+$VerCheckURL = $Settings['VerCheckURL']; }\r
+$VerCheckQuery = parse_url($VerCheckURL);\r
+$VerCheckQuery = $VerCheckQuery['query'];\r
+if($VerCheckQuery=="") { $VerCheckURL = $VerCheckURL."?"; }\r
+if(!isset($Settings['IPCheckURL'])||\r
+       $Settings['IPCheckURL']==="") {\r
+$IPCheckURL = 'http://cqcounter.com/whois/?query=%s'; }\r
+if(isset($Settings['IPCheckURL'])&&\r
+       $Settings['IPCheckURL']!=="") {\r
+$IPCheckURL = $Settings['IPCheckURL']; }\r
+$CD2k = "Kazuki Przyborowski"; $CD2k_Full = "Kazuki Suzuki Przyborowski";\r
+$GM2k = "Game Maker 2k"; $iDB_Author = "Kazuki";\r
+$iDB = "Internet Discussion Boards"; $iTB = "Internet Tag Boards"; \r
+$DF2k = "Discussion Forums 2k"; $TB2k = "Tag Boards 2k";\r
+$TheProgrammerNaps = "The programmer has a nap. \nHold out! Programmer! ";\r
+if(isset($Settings['usealtname'])&&$Settings['usealtname']=="yes") { \r
+       $iDB = $AltiDB; $OrgName = $AltOrgName; $iDBTheme = $AltiDBTheme; }\r
+$iDBURL1 = "<a href=\"".$iDBHome."\" onclick=\"window.open(this.href);return false;\">"; $iDBURL2 = $iDBURL1.$iDB."</a>";\r
+$DF2kURL1 = "<a href=\"".$DF2kHome."\" onclick=\"window.open(this.href);return false;\">"; $DF2kURL2 = $DF2kURL1.$DF2k."</a>";\r
+$GM2kHome = $iDBHome."support/category.php?act=view&amp;id=2";\r
+$GM2kURL = "<a href=\"".$GM2kHome."\" title=\"".$GM2k."\" onclick=\"window.open(this.href);return false;\">".$GM2k."</a>";\r
+$iDBURL3 = "<a href=\"".$iDBHome."\" title=\"".$iDB."\" onclick=\"window.open(this.href);return false;\">".$iDB."</a>";\r
+$PHPQA = "PHP-Quick-Arcade|http://quickarcade.jcink.com/"; $TFBB = "TextFileBB|https://launchpad.net/tfbb";\r
+$PHPQA = explode("|",$PHPQA); $TFBB = explode("|",$TFBB);\r
+$PHPQA = "<a href=\"".$PHPQA[1]."\" title=\"".$PHPQA[0]."\" onclick=\"window.open(this.href);return false;\">".$PHPQA[0]."</a>";\r
+$TFBB = "<a href=\"".$TFBB[1]."\" title=\"".$TFBB[0]."\" onclick=\"window.open(this.href);return false;\">".$TFBB[0]."</a>";\r
+if(isset($Settings['usealtname'])&&$Settings['usealtname']=="yes") { \r
+       $iDBHome = $AltiDBHome; $GM2k = $AltGM2k; $GM2kHome = $AltGM2kHome; $GM2kURL = $AltGM2kURL; }\r
+$PHPV1 = phpversion(); $PHPV2 = "PHP ".$PHPV1; $OSType = @php_uname("s"); $OSType .= " ".@php_uname("r");\r
+$OSType .= " ".@php_uname("m"); if($OSType==""||!isset($OSType)) { $OSType = PHP_OS; } // Check OS Name\r
+if($OSType=="WINNT") { $OSType="Windows NT"; } if($OSType=="WIN32") { $OSType="Windows 9x"; }\r
+$OSType2 = $PHPV2." / ".$OSType; $ZENDV1 = zend_version(); $ZENDV2 = "Zend engine ".$ZENDV1;\r
+// Show or hide the version number\r
+if($Settings['showverinfo']=="on") {\r
+//header("X-".$RName."-Powered-By: ".$VerInfo['iDB_Ver_Show']);\r
+header("Generator: ".$VerInfo['iDB_Ver_Show']); }\r
+if($Settings['showverinfo']!="on") {\r
+//header("X-".$RName."-Powered-By: ".$RName);\r
+//header("X-Powered-By: PHP");\r
+header("Generator: ".$RName); }\r
+if(!isset($Settings['hideverinfohttp'])) {\r
+       $Settings['hideverinfohttp'] = "off"; }\r
+if($Settings['hideverinfohttp']=="on") {\r
+header("X-Powered-By: ");\r
+header("Generator: "); }\r
+?>\r