Changeset 282

Show
Ignore:
Timestamp:
01/13/12 20:20:28 (4 months ago)
Author:
this_is_junk
Message:

MODIFIED: Separated ACP into smaller files. (admin.php)
ADDED: admin/admin_accounts_lib.php.
ADDED: admin/admin_databases_lib.php.
ADDED: admin/admin_forum_lib.php.
ADDED: admin/admin_general_lib.php.
ADDED: admin/admin_menus_lib.php.
ADDED: admin/admin_pointsystem_lib.php.
ADDED: admin/admin_servers_lib.php.

Files:
7 added
1 modified

Legend:

Unmodified
Added
Removed
  • admin.php

    r280 r282  
    7474require_once("admin/header.php"); 
    7575 
    76 function database() 
    77 { 
    78   global $output, $corem_db; 
    79  
    80   $sqlm = new SQL; 
    81   $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); 
    82  
    83   $dbc_db = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_dbc_database")); 
    84   $logon_db = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_logon_database")); 
    85   $char_dbs = $sqlm->query("SELECT * FROM config_character_databases"); 
    86   $world_dbs = $sqlm->query("SELECT * FROM config_world_databases"); 
    87  
    88   $output .= ' 
    89         <span style="color:red">'.lang("admin", "db_warn").'</span> 
    90         <form name="form" action="admin.php" method="get"> 
    91           <input type="hidden" name="section" value="databases" /> 
    92           <input type="hidden" name="action" value="savedbs" /> 
    93           <table> 
    94             <tr> 
    95               <td> 
    96                 <fieldset class="admin_editdb_field"> 
    97                   <legend>'.lang("admin", "host").'</legend> 
    98                   <table> 
    99                     <tr> 
    100                       <td colspan="4"> 
    101                         <span style="color:red">'.lang("admin", "host_info").'</span> 
    102                       </td> 
    103                     </tr> 
    104                     <tr> 
    105                       <td width="75px">'.lang("admin", "host").': </td> 
    106                       <td> 
    107                         <input type="text" name="host" value="'.$dbc_db["Address"].'" size="10%" /> 
    108                       </td> 
    109                       <td width="75px">'.lang("admin", "port").': </td> 
    110                       <td> 
    111                         <input type="text" name="port" value="'.$dbc_db["Port"].'" size="10%" /> 
    112                       </td> 
    113                     </tr> 
    114                     <tr> 
    115                       <td width="75px">'.lang("admin", "user").': </td> 
    116                       <td> 
    117                         <input type="text" name="user" value="'.$dbc_db["User"].'" size="10%" /> 
    118                       </td> 
    119                       <td width="75px">'.lang("admin", "pass").': </td> 
    120                       <td> 
    121                         <input type="text" name="pass" value="'.$dbc_db["Password"].'" size="10%" /> 
    122                       </td> 
    123                     </tr> 
    124                   </table> 
    125                 </fieldset> 
    126               </td> 
    127             </tr> 
    128             <tr> 
    129               <td colspan="2"> 
    130                 <hr /> 
    131               </td> 
    132             </tr> 
    133             <tr> 
    134               <td> 
    135                 <fieldset class="admin_editdb_field"> 
    136                   <legend>'.lang("admin", "arcm").'</legend> 
    137                   <table> 
    138                     <!-- tr> 
    139                       <td width="75px">'.lang("admin", "host").': </td> 
    140                       <td> 
    141                         <input type="text" name="dbc_host" value="'.$dbc_db["Address"].'" size="10%" /> 
    142                       </td> 
    143                       <td width="75px">'.lang("admin", "port").': </td> 
    144                       <td> 
    145                         <input type="text" name="dbc_port" value="'.$dbc_db["Port"].'" size="10%" /> 
    146                       </td> 
    147                     </tr> 
    148                     <tr> 
    149                       <td width="75px">'.lang("admin", "user").': </td> 
    150                       <td> 
    151                         <input type="text" name="dbc_user" value="'.$dbc_db["User"].'" size="10%" /> 
    152                       </td> 
    153                       <td width="75px">'.lang("admin", "pass").': </td> 
    154                       <td> 
    155                         <input type="text" name="dbc_pass" value="'.$dbc_db["Password"].'" size="10%" /> 
    156                       </td> 
    157                     </tr --> 
    158                     <tr> 
    159                       <td width="75px">'.lang("admin", "name").': </td> 
    160                       <td> 
    161                         <input type="text" name="dbc_name" value="'.$dbc_db["Name"].'" size="10%" /> 
    162                       </td> 
    163                       <td width="75px">'.lang("admin", "db_enc").': </td> 
    164                       <td> 
    165                         <input type="text" name="dbc_encoding" value="'.$dbc_db["Encoding"].'" size="10%" /> 
    166                       </td> 
    167                     </tr> 
    168                   </table> 
    169                 </fieldset> 
    170               </td> 
    171               <td> 
    172                 <fieldset class="admin_editdb_field"> 
    173                   <legend>'.lang("admin", "logon").'</legend> 
    174                   <table> 
    175                     <!-- tr> 
    176                       <td width="75px">'.lang("admin", "host").': </td> 
    177                       <td> 
    178                         <input type="text" name="logon_host" value="'.$logon_db["Address"].'" size="10%" /> 
    179                       </td> 
    180                       <td width="75px">'.lang("admin", "port").': </td> 
    181                       <td> 
    182                         <input type="text" name="logon_port" value="'.$logon_db["Port"].'" size="10%" /> 
    183                       </td> 
    184                     </tr> 
    185                     <tr> 
    186                       <td width="75px">'.lang("admin", "user").': </td> 
    187                       <td> 
    188                         <input type="text" name="logon_user" value="'.$logon_db["User"].'" size="10%" /> 
    189                       </td> 
    190                       <td width="75px">'.lang("admin", "pass").': </td> 
    191                       <td> 
    192                         <input type="text" name="logon_pass" value="'.$logon_db["Password"].'" size="10%" /> 
    193                       </td> 
    194                     </tr --> 
    195                     <tr> 
    196                       <td width="75px">'.lang("admin", "name").': </td> 
    197                       <td> 
    198                         <input type="text" name="logon_name" value="'.$logon_db["Name"].'" size="10%" /> 
    199                       </td> 
    200                       <td width="75px">'.lang("admin", "db_enc").': </td> 
    201                       <td> 
    202                         <input type="text" name="logon_encoding" value="'.$logon_db["Encoding"].'" size="10%" /> 
    203                       </td> 
    204                     </tr> 
    205                   </table> 
    206                 </fieldset> 
    207               </td> 
    208             </tr> 
    209             <tr> 
    210               <td colspan="2"> 
    211                 <hr /> 
    212               </td> 
    213             </tr> 
    214             <tr> 
    215               <td colspan="2"> 
    216                 <span style="color:red">'.lang("admin", "realm_info").'</span> 
    217               </td> 
    218             </tr> 
    219             <tr>'; 
    220   while ( $char = $sqlm->fetch_assoc($char_dbs) ) 
    221   { 
    222     $output .= ' 
    223               <td> 
    224                 <input type="hidden" name="char_realm[]" value="'.$char["Index"].'" /> 
    225                 <fieldset class="admin_editdb_field"> 
    226                   <legend>'.lang("admin", "char").' ('.lang("admin", "realm").' '.$char["Index"].')</legend> 
    227                   <table> 
    228                     <!-- tr> 
    229                       <td width="75px">'.lang("admin", "host").': </td> 
    230                       <td> 
    231                         <input type="text" name="char_host[]" value="'.$char["Address"].'" size="10%" /> 
    232                       </td> 
    233                       <td width="75px">'.lang("admin", "port").': </td> 
    234                       <td> 
    235                         <input type="text" name="char_port[]" value="'.$char["Port"].'" size="10%" /> 
    236                       </td> 
    237                     </tr> 
    238                     <tr> 
    239                       <td width="75px">'.lang("admin", "user").': </td> 
    240                       <td> 
    241                         <input type="text" name="char_user[]" value="'.$char["User"].'" size="10%" /> 
    242                       </td> 
    243                       <td width="75px">'.lang("admin", "pass").': </td> 
    244                       <td> 
    245                         <input type="text" name="char_pass[]" value="'.$char["Password"].'" size="10%" /> 
    246                       </td> 
    247                     </tr --> 
    248                     <tr> 
    249                       <td width="75px">'.lang("admin", "name").': </td> 
    250                       <td> 
    251                         <input type="text" name="char_name[]" value="'.$char["Name"].'" size="10%" /> 
    252                       </td> 
    253                       <td width="75px">'.lang("admin", "db_enc").': </td> 
    254                       <td> 
    255                         <input type="text" name="char_encoding[]" value="'.$char["Encoding"].'" size="10%" /> 
    256                       </td> 
    257                     </tr> 
    258                     <tr> 
    259                       <td width="75px">'.lang("admin", "realm").': </td> 
    260                       <td> 
    261                         <input type="text" name="char_new_realm[]" value="'.$char["Index"].'" size="10%" /> 
    262                       </td> 
    263                       <td colspan="2"> 
    264                         <a href="admin.php?section=databases&amp;action=savedbs&amp;remove_char[]='.$char["Index"].'"> 
    265                           <img src="img/aff_cross.png" alt="" /> '.lang("admin", "remove").' 
    266                         </a> 
    267                       </td> 
    268                     </tr> 
    269                   </table> 
    270                 </fieldset> 
    271               </td>'; 
    272   } 
    273   $output .= ' 
    274             </tr> 
    275             <tr> 
    276               <td> 
    277                 <a href="admin.php?section=databases&amp;action=savedbs&amp;addchar=addchar"> 
    278                   <img src="img/add.png" alt="" /> <b>'.lang("admin", "addchar").'</b> 
    279                 </a> 
    280               </td> 
    281             </tr> 
    282             <tr>'; 
    283   while ( $world = $sqlm->fetch_assoc($world_dbs) ) 
    284   { 
    285     $output .= ' 
    286               <td> 
    287                 <input type="hidden" name="world_realm[]" value="'.$world["Index"].'" /> 
    288                 <fieldset class="admin_editdb_field"> 
    289                   <legend>'.lang("admin", "world").' ('.lang("admin", "realm").' '.$world["Index"].')</legend> 
    290                   <table> 
    291                     <!-- tr> 
    292                       <td width="75px">'.lang("admin", "host").': </td> 
    293                       <td> 
    294                         <input type="text" name="world_host[]" value="'.$world["Address"].'" size="10%" /> 
    295                       </td> 
    296                       <td width="75px">'.lang("admin", "port").': </td> 
    297                       <td> 
    298                         <input type="text" name="world_port[]" value="'.$world["Port"].'" size="10%" /> 
    299                       </td> 
    300                     </tr> 
    301                     <tr> 
    302                       <td width="75px">'.lang("admin", "user").': </td> 
    303                       <td> 
    304                         <input type="text" name="world_user[]" value="'.$world["User"].'" size="10%" /> 
    305                       </td> 
    306                       <td>'.lang("admin", "pass").': </td> 
    307                       <td> 
    308                         <input type="text" name="world_pass[]" value="'.$world["Password"].'" size="10%" /> 
    309                       </td> 
    310                     </tr --> 
    311                     <tr> 
    312                       <td width="75px">'.lang("admin", "name").': </td> 
    313                       <td> 
    314                         <input type="text" name="world_name[]" value="'.$world["Name"].'" size="10%" /> 
    315                       </td> 
    316                       <td width="75px">'.lang("admin", "db_enc").': </td> 
    317                       <td> 
    318                         <input type="text" name="world_encoding[]" value="'.$world["Encoding"].'" size="10%" /> 
    319                       </td> 
    320                     </tr> 
    321                     <tr> 
    322                       <td width="75px">'.lang("admin", "realm").': </td> 
    323                       <td> 
    324                         <input type="text" name="world_new_realm[]" value="'.$world["Index"].'" size="10%" /> 
    325                       </td> 
    326                       <td colspan="2"> 
    327                         <a href="admin.php?section=databases&amp;action=savedbs&amp;remove_world[]='.$world["Index"].'"> 
    328                           <img src="img/aff_cross.png" alt="" /> '.lang("admin", "remove").' 
    329                         </a> 
    330                       </td> 
    331                     </tr> 
    332                   </table> 
    333                 </fieldset> 
    334               </td>'; 
    335   } 
    336   $output .= ' 
    337             </tr> 
    338             <tr> 
    339               <td> 
    340                 <a href="admin.php?section=databases&amp;action=savedbs&amp;addworld=addworld"> 
    341                   <img src="img/add.png" alt="" /> <b>'.lang("admin", "addworld").'</b> 
    342                 </a> 
    343               </td> 
    344             </tr> 
    345           </table> 
    346           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    347         </form>'; 
    348 } 
    349  
    350 function savedbs() 
    351 { 
    352   global $output, $corem_db; 
    353  
    354   $sqlm = new SQL; 
    355   $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); 
    356  
    357   if ( isset($_GET["addchar"]) ) 
    358   { 
    359     // Add new Character Database 
    360     // get highest index 
    361     $i_query = "SELECT IFNULL(MAX(`Index`), 0) AS MaxID FROM config_character_databases"; 
    362     $i_result = $sqlm->query($i_query); 
    363     $i_result = $sqlm->fetch_assoc($i_result); 
    364     $max_index = $i_result["MaxID"]; 
    365  
    366     $result_addchar = $sqlm->query("INSERT INTO config_character_databases (`Index`, Encoding) VALUES ('".($max_index+1)."', 'utf8')"); 
    367   } 
    368  
    369   if ( isset($_GET["addworld"]) ) 
    370   { 
    371     // Add new World Database 
    372     // get highest index 
    373     $i_query = "SELECT IFNULL(MAX(`Index`), 0) AS MaxID FROM config_world_databases"; 
    374     $i_result = $sqlm->query($i_query); 
    375     $i_result = $sqlm->fetch_assoc($i_result); 
    376     $max_index = $i_result["MaxID"]; 
    377  
    378     $result_addworld = $sqlm->query("INSERT INTO config_world_databases (`Index`, Encoding) VALUES ('".($max_index+1)."', 'utf8')"); 
    379   } 
    380  
    381   if ( isset($_GET["dbc_name"]) ) 
    382   { 
    383     $dbc_host = $sqlm->quote_smart($_GET["host"]); 
    384     $dbc_port = $sqlm->quote_smart($_GET["port"]); 
    385     $dbc_user = $sqlm->quote_smart($_GET["user"]); 
    386     $dbc_pass = $sqlm->quote_smart($_GET["pass"]); 
    387     $dbc_name = $sqlm->quote_smart($_GET["dbc_name"]); 
    388     $dbc_encoding = $sqlm->quote_smart($_GET["dbc_encoding"]); 
    389  
    390     $dbc_count = $sqlm->fetch_assoc($sqlm->query("SELECT COUNT(*) FROM config_dbc_database")); 
    391  
    392     if ( $dbc_count["COUNT(*)"] == 1 ) 
    393     { 
    394       $dbc_upper = $sqlm->fetch_assoc($sqlm->query("SELECT MAX(`Index`) FROM config_dbc_database")); 
    395       $result = $sqlm->query("UPDATE config_dbc_database SET Address='".$dbc_host."', Port='".$dbc_port."', Name='".$dbc_name."', User='".$dbc_user."', Password='".$dbc_pass."', Encoding='".$dbc_encoding."' WHERE `Index`='".$dbc_upper["MAX(`Index`)"]."'"); 
    396     } 
    397     elseif ( $dbc_count["COUNT(*)"] > 1 ) 
    398     { 
    399       $result = $sqlm->query("TRUNCATE TABLE config_dbc_database"); 
    400       $result = $sqlm->query("INSERT INTO config_dbc_database (Address, Port, User, Name, Password, Encoding) VALUES ('".$dbc_host."', '".$dbc_port."', '".$dbc_user."', '".$dbc_name."', '".$dbc_pass."', '".$dbc_encoding."')"); 
    401     } 
    402     else 
    403     { 
    404       $result = $sqlm->query("INSERT INTO config_dbc_database (Address, Port, User, Name, Password, Encoding) VALUES ('".$dbc_host."', '".$dbc_port."', '".$dbc_user."', '".$dbc_name."', '".$dbc_pass."', '".$dbc_encoding."')"); 
    405     } 
    406   } 
    407  
    408   if ( isset($_GET["logon_name"]) ) 
    409   { 
    410     $logon_host = $sqlm->quote_smart($_GET["host"]); 
    411     $logon_port = $sqlm->quote_smart($_GET["port"]); 
    412     $logon_user = $sqlm->quote_smart($_GET["user"]); 
    413     $logon_pass = $sqlm->quote_smart($_GET["pass"]); 
    414     $logon_name = $sqlm->quote_smart($_GET["logon_name"]); 
    415     $logon_encoding = $sqlm->quote_smart($_GET["logon_encoding"]); 
    416  
    417     $result_logon = $sqlm->query("UPDATE config_logon_database SET Address='".$logon_host."', Port='".$logon_port."', User='".$logon_user."', Password='".$logon_pass."', Name='".$logon_name."', Encoding='".$logon_encoding."' WHERE `Index`=1"); 
    418   } 
    419  
    420   if ( isset($_GET["char_realm"]) ) 
    421   { 
    422     $char_realms = ( ( isset($_GET["char_realm"]) ) ? $sqlm->quote_smart($_GET["char_realm"]) : NULL ); 
    423     $char_new_realms = ( ( isset($_GET["char_new_realm"]) ) ? $sqlm->quote_smart($_GET["char_new_realm"]) : NULL ); 
    424     $char_hosts = ( ( isset($_GET["host"]) ) ? $sqlm->quote_smart($_GET["host"]) : NULL ); 
    425     $char_ports = ( ( isset($_GET["port"]) ) ? $sqlm->quote_smart($_GET["port"]) : NULL ); 
    426     $char_users = ( ( isset($_GET["user"]) ) ? $sqlm->quote_smart($_GET["user"]) : NULL ); 
    427     $char_passes = ( ( isset($_GET["pass"]) ) ? $sqlm->quote_smart($_GET["pass"]) : NULL ); 
    428     $char_names = ( ( isset($_GET["char_name"]) ) ? $sqlm->quote_smart($_GET["char_name"]) : NULL ); 
    429     $char_encodings = ( ( isset($_GET["char_encoding"]) ) ? $sqlm->quote_smart($_GET["char_encoding"]) : NULL ); 
    430  
    431     for ( $i = 0; $i <= count($char_hosts); $i++ ) 
    432     { 
    433       $result_char = $sqlm->query("UPDATE config_character_databases SET `Index`='".$char_new_realms[$i]."', Address='".$char_hosts."', Port='".$char_ports."', User='".$char_users."', Password='".$char_passes."', Name='".$char_names[$i]."', Encoding='".$char_encodings[$i]."' WHERE `Index`='".$char_realms[$i]."'"); 
    434     } 
    435   } 
    436  
    437   if ( isset($_GET["remove_char"]) ) 
    438   { 
    439     $remove_chars = ( ( isset($_GET["remove_char"]) ) ? $sqlm->quote_smart($_GET["remove_char"]) : NULL ); 
    440  
    441     for ( $i = 0; $i <= count($remove_chars); $i++ ) 
    442     { 
    443       $result_char = $sqlm->query("DELETE FROM config_character_databases WHERE `Index`='".$remove_chars[$i]."'"); 
    444     } 
    445   } 
    446  
    447   if ( isset($_GET["world_realm"]) ) 
    448   { 
    449     $world_realms = ( ( isset($_GET["world_realm"]) ) ? $sqlm->quote_smart($_GET["world_realm"]) : NULL ); 
    450     $world_new_realms = ( ( isset($_GET["world_new_realm"]) ) ? $sqlm->quote_smart($_GET["world_new_realm"]) : NULL ); 
    451     $world_hosts = ( ( isset($_GET["host"]) ) ? $sqlm->quote_smart($_GET["host"]) : NULL ); 
    452     $world_ports = ( ( isset($_GET["port"]) ) ? $sqlm->quote_smart($_GET["port"]) : NULL ); 
    453     $world_users = ( ( isset($_GET["user"]) ) ? $sqlm->quote_smart($_GET["user"]) : NULL ); 
    454     $world_passes = ( ( isset($_GET["pass"]) ) ? $sqlm->quote_smart($_GET["pass"]) : NULL ); 
    455     $world_names = ( ( isset($_GET["world_name"]) ) ? $sqlm->quote_smart($_GET["world_name"]) : NULL ); 
    456     $world_encodings = ( ( isset($_GET["world_encoding"]) ) ? $sqlm->quote_smart($_GET["world_encoding"]) : NULL ); 
    457  
    458     for ( $i = 0; $i <= count($world_hosts); $i++ ) 
    459     { 
    460       $result_world = $sqlm->query("UPDATE config_world_databases SET `Index`='".$world_new_realms[$i]."', Address='".$world_hosts."', Port='".$world_ports."', User='".$world_users."', Password='".$world_passes."', Name='".$world_names[$i]."', Encoding='".$world_encodings[$i]."' WHERE `Index`='".$world_realms[$i]."'"); 
    461     } 
    462   } 
    463  
    464   if ( isset($_GET["remove_world"]) ) 
    465   { 
    466     $remove_worlds = ( ( isset($_GET["remove_world"]) ) ? $sqlm->quote_smart($_GET["remove_world"]) : NULL ); 
    467  
    468     for ( $i = 0; $i <= count($remove_worlds); $i++ ) 
    469     { 
    470       $remove_query = "DELETE FROM config_world_databases WHERE `Index`='".$remove_worlds[$i]."'"; 
    471       $result_world = $sqlm->query($remove_query); 
    472     } 
    473   } 
    474  
    475   redirect("admin.php?section=databases"); 
    476 } 
    477  
    478 function general() 
    479 { 
    480   global $output, $corem_db, $core; 
    481  
    482   // we need $core to be set 
    483   if ( $core == 0 ) 
    484     $core = detectcore(); 
    485  
    486   $sqlm = new SQL; 
    487   $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); 
    488  
    489   $subsection = ( ( isset($_GET["subsection"]) ) ? $sqlm->quote_smart($_GET["subsection"]) : 1 ); 
    490  
    491   $output .= ' 
    492         <table id="sidebar"> 
    493           <tr> 
    494             <td '.( ( $subsection == "more" ) ? 'class="current"' : '' ).'> 
    495               <a href="admin.php?section=general&amp;subsection=more">'.lang("admin", "more").'</a> 
    496             </td> 
    497           </tr> 
    498           <tr> 
    499             <td '.( ( $subsection == "version" ) ? 'class="current"' : '' ).'> 
    500               <a href="admin.php?section=general&amp;subsection=version">'.lang("admin", "version").'</a> 
    501             </td> 
    502           </tr> 
    503           <tr> 
    504             <td '.( ( $subsection == "mail" ) ? 'class="current"' : '' ).'> 
    505               <a href="admin.php?section=general&amp;subsection=mail">'.lang("admin", "mail").'</a> 
    506             </td> 
    507           </tr> 
    508           <tr> 
    509             <td '.( ( $subsection == "irc" ) ? 'class="current"' : '' ).'> 
    510               <a href="admin.php?section=general&amp;subsection=irc">'.lang("admin", "irc").'</a> 
    511             </td> 
    512           </tr> 
    513           <tr> 
    514             <td '.( ( $subsection == "proxy" ) ? 'class="current"' : '' ).'> 
    515               <a href="admin.php?section=general&amp;subsection=proxy">'.lang("admin", "proxy").'</a> 
    516             </td> 
    517           </tr> 
    518           <tr> 
    519             <td '.( ( $subsection == "datasite" ) ? 'class="current"' : '' ).'> 
    520               <a href="admin.php?section=general&amp;subsection=datasite">'.lang("admin", "datasite").'</a> 
    521             </td> 
    522           </tr> 
    523           <tr> 
    524             <td '.( ( $subsection == "acctcreation" ) ? 'class="current"' : '' ).'> 
    525               <a href="admin.php?section=general&amp;subsection=acctcreation">'.lang("admin", "acct_creation").'</a> 
    526             </td> 
    527           </tr> 
    528           <tr> 
    529             <td '.( ( $subsection == "guests" ) ? 'class="current"' : '' ).'> 
    530               <a href="admin.php?section=general&amp;subsection=guests">'.lang("admin", "guests").'</a> 
    531             </td> 
    532           </tr> 
    533           <tr> 
    534             <td '.( ( $subsection == "extratools" ) ? 'class="current"' : '' ).'> 
    535               <a href="admin.php?section=general&amp;subsection=extratools">'.lang("admin", "extra_tools").'</a> 
    536             </td> 
    537           </tr> 
    538           <tr> 
    539             <td '.( ( $subsection == "internalmap" ) ? 'class="current"' : '' ).'> 
    540               <a href="admin.php?section=general&amp;subsection=internalmap">'.lang("admin", "internal_map").'</a> 
    541             </td> 
    542           </tr> 
    543           <tr> 
    544             <td '.( ( $subsection == "validip" ) ? 'class="current"' : '' ).'> 
    545               <a href="admin.php?section=general&amp;subsection=validip">'.lang("admin", "validip").'</a> 
    546             </td> 
    547           </tr> 
    548           <tr> 
    549             <td '.( ( $subsection == "ads" ) ? 'class="current"' : '' ).'> 
    550               <a href="admin.php?section=general&amp;subsection=ads">'.lang("admin", "ads").'</a> 
    551             </td> 
    552           </tr> 
    553           <tr> 
    554             <td '.( ( $subsection == "gmlevels" ) ? 'class="current"' : '' ).'> 
    555               <a href="admin.php?section=general&amp;subsection=gmlevels">'.lang("admin", "gm_levels").'</a> 
    556             </td> 
    557           </tr> 
    558         </table>'; 
    559  
    560   if ( isset($_GET["error"]) ) 
    561     $output .= ' 
    562       <div id="misc_error">'; 
    563   else 
    564     $output .= ' 
    565       <div id="misc">'; 
    566  
    567   $sub_action = ( ( isset($_GET["subaction"]) ) ? $_GET["subaction"] : '' ); 
    568  
    569   switch ( $subsection ) 
    570   { 
    571     case "version": 
    572     { 
    573       if ( !$sub_action ) 
    574       { 
    575         $show_version_show = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_Show'")); 
    576         $show_version_version = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_Version'")); 
    577         $show_version_version_lvl = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_Version_Lvl'")); 
    578         $show_version_revision = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_SVNRev'")); 
    579         $show_version_revision_lvl = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_SVNRev_Lvl'")); 
    580         $output .= ' 
    581         <form name="form" action="admin.php" method="get"> 
    582           <input type="hidden" name="section" value="general" /> 
    583           <input type="hidden" name="subaction" value="saveversion" /> 
    584           <input type="hidden" name="subsection" value="version" /> 
    585           <table class="simple"> 
    586             <tr> 
    587               <td class="help"> 
    588                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "show_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "show").'</a>: 
    589               </td> 
    590               <td> 
    591                 <select name="showversion" id="admin_showversion_field"> 
    592                   <option value="0" '.( ( $show_version_show["Value"] == 0 ) ? 'selected="selected"' : '' ).'>'.lang("admin", "dontshow").'</option> 
    593                   <option value="1" '.( ( $show_version_show["Value"] == 1 ) ? 'selected="selected"' : '' ).'disabled="disabled">'.lang("admin", "version").'</option> 
    594                   <option value="2"'.( ( $show_version_show["Value"] == 2 ) ? 'selected="selected"' : '' ).'>'.lang("admin", "verrev").'</option> 
    595                 </select> 
    596               </td> 
    597             </tr> 
    598             <tr> 
    599               <td class="help"> 
    600                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "version_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "version").'</a>: 
    601               </td> 
    602               <td> 
    603                 <input type="text" name="version" value="'.$show_version_version["Value"].'" readonly="readonly" /> 
    604               </td> 
    605             </tr> 
    606             <tr> 
    607               <td class="help"> 
    608                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "versionlvl_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "versionlvl").'</a>: 
    609               </td> 
    610               <td> 
    611                 <input type="text" name="versionlvl" value="'.$show_version_version_lvl["Value"].'" readonly="readonly" /> 
    612               </td> 
    613             </tr> 
    614             <tr> 
    615               <td class="help"> 
    616                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "revision_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "revision").'</a>: 
    617               </td> 
    618               <td> 
    619                 <input type="text" name="revision" value="'.$show_version_revision["Value"].'" readonly="readonly" /> 
    620               </td> 
    621             </tr> 
    622             <tr> 
    623               <td class="help"> 
    624                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "revisionlvl_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "revisionlvl").'</a>: 
    625               </td> 
    626               <td> 
    627                 <input type="text" name="revisionlvl" value="'.$show_version_revision_lvl["Value"].'" /> 
    628               </td> 
    629             </tr> 
    630           </table> 
    631           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    632         </form>'; 
    633       } 
    634       else 
    635       { 
    636         $show_version = $sqlm->quote_smart($_GET["showversion"]); 
    637         $version = $sqlm->quote_smart($_GET["version"]); 
    638         $version_lvl = $sqlm->quote_smart($_GET["versionlvl"]); 
    639         $revision = $sqlm->quote_smart($_GET["revision"]); 
    640         $revision_lvl = $sqlm->quote_smart($_GET["revisionlvl"]); 
    641  
    642         $result = $sqlm->query("UPDATE config_misc SET Value='".$show_version."' WHERE `Key`='Show_Version_Show'"); 
    643         $result = $sqlm->query("UPDATE config_misc SET Value='".$version."' WHERE `Key`='Show_Version_Version'"); 
    644         $result = $sqlm->query("UPDATE config_misc SET Value='".$version_lvl."' WHERE `Key`='Show_Version_Version_Lvl'"); 
    645         $result = $sqlm->query("UPDATE config_misc SET Value='".$revision."' WHERE `Key`='Show_Version_SVNRev'"); 
    646         $result = $sqlm->query("UPDATE config_misc SET Value='".$revision_lvl."' WHERE `Key`='Show_Version_SVNRev_Lvl'"); 
    647  
    648         redirect("admin.php?section=general&subsection=version"); 
    649       } 
    650       break; 
    651     } 
    652     case "mail": 
    653     { 
    654       if ( !$sub_action ) 
    655       { 
    656         $mail_admin_email = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Mail_Admin_Email'")); 
    657         $mail_mailer_type = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Mail_Mailer_Type'")); 
    658         $mail_from_email = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Mail_From_Email'")); 
    659         $mail_gmailsender = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Mail_GMailSender'")); 
    660         $format_mail_html = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Format_Mail_HTML'")); 
    661         $smtp_host = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='SMTP_Host'")); 
    662         $smtp_port = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='SMTP_Port'")); 
    663         $smtp_user = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='SMTP_User'")); 
    664         $smtp_pass = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='SMTP_Pass'")); 
    665         $pm_from_char = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='PM_From_Char'")); 
    666         $pm_stationary = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='PM_Stationary'")); 
    667         $output .= ' 
    668         <form name="form" action="admin.php" method="get"> 
    669           <input type="hidden" name="section" value="general" /> 
    670           <input type="hidden" name="subaction" value="savemail" /> 
    671           <input type="hidden" name="subsection" value="mail" /> 
    672           <table class="simple"> 
    673             <tr> 
    674               <td colspan="2"><b>'.lang("admin", "email").'</b></td> 
    675             </tr> 
    676             <tr> 
    677               <td class="help"> 
    678                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "adminemail_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "adminemail").'</a>: 
    679               </td> 
    680               <td> 
    681                 <input type="text" name="adminemail" value="'.$mail_admin_email["Value"].'" /> 
    682               </td> 
    683             </tr> 
    684             <tr> 
    685               <td class="help"> 
    686                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "mailertype_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "mailertype").'</a>: 
    687               </td> 
    688               <td> 
    689                 <select name="mailertype" id="admin_mailertype_field"> 
    690                   <option value="mail" '.( ( $mail_mailer_type["Value"] == "mail" ) ? 'selected="selected" ' : '' ).'>'.lang("admin", "mail").'</option> 
    691                   <option value="sendmail" '.( ( $mail_mailer_type["Value"] == "sendmail" ) ? 'selected="selected" ' : '' ).'>'.lang("admin", "sendmail").'</option> 
    692                   <option value="smtp"'.( ( $mail_mailer_type["Value"] == "smtp" ) ? 'selected="selected" ' : '' ).'>'.lang("admin", "smtp").'</option> 
    693                   <option value="gmailsmtp"'.( ( $mail_gmailsender["Value"] == 1 ) ? 'selected="selected" ' : '' ).'>'.lang("admin", "gmailsmtp").'</option> 
    694                 </select> 
    695               </td> 
    696             </tr> 
    697             <tr> 
    698               <td class="help"> 
    699                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "fromemail_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "fromemail").'</a>: 
    700               </td> 
    701               <td> 
    702                 <input type="text" name="fromemail" value="'.$mail_from_email["Value"].'" /> 
    703               </td> 
    704             </tr> 
    705             <!-- tr> 
    706               <td class="help"> 
    707                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "usegmail_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "usegmail").'</a>: 
    708               </td> 
    709               <td> 
    710                 <input type="checkbox" name="gmail" '.( ( $mail_gmailsender["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    711               </td> 
    712             </tr --> 
    713             <tr> 
    714               <td class="help"> 
    715                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "formathtml_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "formathtml").'</a>: 
    716               </td> 
    717               <td> 
    718                 <input type="checkbox" name="usehtml" '.( ( $format_mail_html["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    719               </td> 
    720             </tr> 
    721             <tr> 
    722               <td colspan="2"> 
    723                 <b>'.lang("admin", "smtp").'</b> 
    724               </td> 
    725             </tr> 
    726             <tr> 
    727               <td class="help"> 
    728                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "smtphost_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "smtphost").'</a>: 
    729               </td> 
    730               <td> 
    731                 <input type="text" name="smtphost" value="'.$smtp_host["Value"].'" /> 
    732               </td> 
    733             </tr> 
    734             <tr> 
    735               <td class="help"> 
    736                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "smtpport_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "smtpport").'</a>: 
    737               </td> 
    738               <td> 
    739                 <input type="text" name="smtpport" value="'.$smtp_port["Value"].'" /> 
    740               </td> 
    741             </tr> 
    742             <tr> 
    743               <td class="help"> 
    744                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "smtpuser_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "smtpuser").'</a>: 
    745               </td> 
    746               <td> 
    747                 <input type="text" name="smtpuser" value="'.$smtp_user["Value"].'" /> 
    748               </td> 
    749             </tr> 
    750             <tr> 
    751               <td class="help"> 
    752                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "smtppass_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "smtppass").'</a>: 
    753               </td> 
    754               <td> 
    755                 <input type="text" name="smtppass" value="'.$smtp_pass["Value"].'" /> 
    756               </td> 
    757             </tr>'; 
    758  
    759         if ( $core == 1 ) 
    760           $output .= ' 
    761             <tr> 
    762               <td colspan="2"> 
    763                 <b>'.lang("admin", "pm").'</b> 
    764               </td> 
    765             </tr> 
    766             <tr> 
    767               <td class="help"> 
    768                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "pmfrom_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "pmfrom").'</a>: 
    769               </td> 
    770               <td> 
    771                 <input type="text" name="fromchar" value="'.$pm_from_char["Value"].'" /> 
    772               </td> 
    773             </tr> 
    774             <tr> 
    775               <td class="help"> 
    776                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "pmstation_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "pmstation").'</a>: 
    777               </td> 
    778               <td> 
    779                 <input type="text" name="stationary" value="'.$pm_stationary["Value"].'" /> 
    780               </td> 
    781             </tr>'; 
    782  
    783         $output .= ' 
    784           </table> 
    785           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    786         </form>'; 
    787       } 
    788       else 
    789       { 
    790         $mail_admin_email = $sqlm->quote_smart($_GET["adminemail"]); 
    791         $mail_mailer_type = $sqlm->quote_smart($_GET["mailertype"]); 
    792         $mail_from_email = $sqlm->quote_smart($_GET["fromemail"]); 
    793  
    794         if ( $mail_mailer_type == "gmailsmtp" ) 
    795           $mail_gmailsender = 1; 
    796         else 
    797           $mail_gmailsender = 0; 
    798  
    799         $format_mail_html = ( ( isset($_GET["usehtml"]) ) ? 1 : 0 ); 
    800         $smtp_host = $sqlm->quote_smart($_GET["smtphost"]); 
    801         $smtp_port = $sqlm->quote_smart($_GET["smtpport"]); 
    802         $smtp_user = $sqlm->quote_smart($_GET["smtpuser"]); 
    803         $smtp_pass = $sqlm->quote_smart($_GET["smtppass"]); 
    804         $pm_from_char = ( ( isset($_GET["fromchar"]) ) ? $sqlm->quote_smart($_GET["fromchar"]) : 1 ); 
    805         $pm_stationary = ( ( isset($_GET["stationary"]) ) ? $sqlm->quote_smart($_GET["stationary"]) : 41 ); 
    806  
    807         $result = $sqlm->query("UPDATE config_misc SET Value='".$mail_admin_email."' WHERE `Key`='Mail_Admin_Email'"); 
    808         $result = $sqlm->query("UPDATE config_misc SET Value='".$mail_mailer_type."' WHERE `Key`='Mail_Mailer_Type'"); 
    809         $result = $sqlm->query("UPDATE config_misc SET Value='".$mail_from_email."' WHERE `Key`='Mail_From_Email'"); 
    810         $result = $sqlm->query("UPDATE config_misc SET Value='".$mail_gmailsender."' WHERE `Key`='Mail_GMailSender'"); 
    811         $result = $sqlm->query("UPDATE config_misc SET Value='".$format_mail_html."' WHERE `Key`='Format_Mail_HTML'"); 
    812         $result = $sqlm->query("UPDATE config_misc SET Value='".$smtp_host."' WHERE `Key`='SMTP_Host'"); 
    813         $result = $sqlm->query("UPDATE config_misc SET Value='".$smtp_port."' WHERE `Key`='SMTP_Port'"); 
    814         $result = $sqlm->query("UPDATE config_misc SET Value='".$smtp_user."' WHERE `Key`='SMTP_User'"); 
    815         $result = $sqlm->query("UPDATE config_misc SET Value='".$smtp_pass."' WHERE `Key`='SMTP_Pass'"); 
    816         $result = $sqlm->query("UPDATE config_misc SET Value='".$pm_from_char."' WHERE `Key`='PM_From_Char'"); 
    817         $result = $sqlm->query("UPDATE config_misc SET Value='".$pm_stationary."' WHERE `Key`='PM_Stationary'"); 
    818  
    819         redirect("admin.php?section=general&subsection=mail"); 
    820       } 
    821       break; 
    822     } 
    823     case "irc": 
    824     { 
    825       if ( !$sub_action ) 
    826       { 
    827         $irc_host = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='IRC_Server'")); 
    828         $irc_port = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='IRC_Port'")); 
    829         $irc_channel = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='IRC_Channel'")); 
    830         $irc_helppage = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='IRC_HelpPage'")); 
    831         $output .= ' 
    832         <form name="form" action="admin.php" method="get"> 
    833           <input type="hidden" name="section" value="general" /> 
    834           <input type="hidden" name="subaction" value="saveirc" /> 
    835           <input type="hidden" name="subsection" value="irc" /> 
    836           <table class="simple"> 
    837             <tr> 
    838               <td class="help"> 
    839                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "irchost_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "irchost").'</a>: 
    840               </td> 
    841               <td> 
    842                 <input type="text" name="irchost" value="'.$irc_host["Value"].'" /> 
    843               </td> 
    844             </tr> 
    845             <tr> 
    846               <td class="help"> 
    847                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "ircport_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "ircport").'</a>: 
    848               </td> 
    849               <td> 
    850                 <input type="text" name="ircport" value="'.$irc_port["Value"].'" /> 
    851               </td> 
    852             </tr> 
    853             <tr> 
    854               <td class="help"> 
    855                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "ircchannel_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "ircchannel").'</a>: 
    856               </td> 
    857               <td> 
    858                 <input type="text" name="ircchannel" value="'.$irc_channel["Value"].'" /> 
    859               </td> 
    860             </tr> 
    861             <tr> 
    862               <td class="help"> 
    863                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "irchelppage_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "irchelppage").'</a>: 
    864               </td> 
    865               <td> 
    866                 <input type="text" name="irchelppage" value="'.$irc_helppage["Value"].'" readonly="readonly" /> 
    867               </td> 
    868             </tr> 
    869           </table> 
    870           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    871         </form>'; 
    872       } 
    873       else 
    874       { 
    875         $irc_host = $sqlm->quote_smart($_GET["irchost"]); 
    876         $irc_port = $sqlm->quote_smart($_GET["ircport"]); 
    877         $irc_channel = $sqlm->quote_smart($_GET["ircchannel"]); 
    878         $irc_helppage = $sqlm->quote_smart($_GET["irchelppage"]); 
    879  
    880         $result = $sqlm->query("UPDATE config_misc SET Value='".$irc_host."' WHERE `Key`='IRC_Server'"); 
    881         $result = $sqlm->query("UPDATE config_misc SET Value='".$irc_port."' WHERE `Key`='IRC_Port'"); 
    882         $result = $sqlm->query("UPDATE config_misc SET Value='".$irc_channel."' WHERE `Key`='IRC_Channel'"); 
    883         $result = $sqlm->query("UPDATE config_misc SET Value='".$irc_helppage."' WHERE `Key`='IRC_HelpPage'"); 
    884  
    885         redirect("admin.php?section=general&subsection=irc"); 
    886       } 
    887       break; 
    888     } 
    889     case "proxy": 
    890     { 
    891       if ( !$sub_action ) 
    892       { 
    893         $proxy_host = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Proxy_Addr'")); 
    894         $proxy_port = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Proxy_Port'")); 
    895         $proxy_user = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Proxy_User'")); 
    896         $proxy_pass = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Proxy_Pass'")); 
    897         $output .= ' 
    898         <form name="form" action="admin.php" method="get"> 
    899           <input type="hidden" name="section" value="general" /> 
    900           <input type="hidden" name="subaction" value="saveproxy" /> 
    901           <input type="hidden" name="subsection" value="proxy" /> 
    902           <table class="simple"> 
    903             <tr> 
    904               <td class="help"> 
    905                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "proxyhost_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "proxyhost").'</a>: 
    906               </td> 
    907               <td> 
    908                 <input type="text" name="proxyhost" value="'.$proxy_host["Value"].'" /> 
    909               </td> 
    910             </tr> 
    911             <tr> 
    912               <td class="help"> 
    913                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "proxyport_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "proxyport").'</a>: 
    914               </td> 
    915               <td> 
    916                 <input type="text" name="proxyport" value="'.$proxy_port["Value"].'" /> 
    917               </td> 
    918             </tr> 
    919             <tr> 
    920               <td class="help"> 
    921                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "proxyuser_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "proxyuser").'</a>: 
    922               </td> 
    923               <td> 
    924                 <input type="text" name="proxyuser" value="'.$proxy_user["Value"].'" /> 
    925               </td> 
    926             </tr> 
    927             <tr> 
    928               <td class="help"> 
    929                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "proxypass_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "proxypass").'</a>: 
    930               </td> 
    931               <td> 
    932                 <input type="text" name="proxypass" value="'.$proxy_pass["Value"].'" /> 
    933               </td> 
    934             </tr> 
    935           </table> 
    936           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    937         </form>'; 
    938       } 
    939       else 
    940       { 
    941         $proxy_host = $sqlm->quote_smart($_GET["proxyhost"]); 
    942         $proxy_port = $sqlm->quote_smart($_GET["proxyport"]); 
    943         $proxy_user = $sqlm->quote_smart($_GET["proxyuser"]); 
    944         $proxy_pass = $sqlm->quote_smart($_GET["proxypass"]); 
    945  
    946         $result = $sqlm->query("UPDATE config_misc SET Value='".$proxy_host."' WHERE `Key`='Proxy_Addr'"); 
    947         $result = $sqlm->query("UPDATE config_misc SET Value='".$proxy_port."' WHERE `Key`='Proxy_Port'"); 
    948         $result = $sqlm->query("UPDATE config_misc SET Value='".$proxy_user."' WHERE `Key`='Proxy_User'"); 
    949         $result = $sqlm->query("UPDATE config_misc SET Value='".$proxy_pass."' WHERE `Key`='Proxy_Pass'"); 
    950  
    951         redirect("admin.php?section=general&subsection=proxy"); 
    952       } 
    953       break; 
    954     } 
    955     case "datasite": 
    956     { 
    957       if ( !$sub_action ) 
    958       { 
    959         $datasite_base = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Base'")); 
    960         $datasite_name = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Name'")); 
    961         $datasite_item = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Item'")); 
    962         $datasite_quest = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Quest'")); 
    963         $datasite_creature = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Creature'")); 
    964         $datasite_spell = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Spell'")); 
    965         $datasite_skill = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Skill'")); 
    966         $datasite_go = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_GO'")); 
    967         $datasite_achieve = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Achievement'")); 
    968         $output .= ' 
    969         <form name="form" action="admin.php" method="get"> 
    970           <input type="hidden" name="section" value="general" /> 
    971           <input type="hidden" name="subaction" value="savedatasite" /> 
    972           <input type="hidden" name="subsection" value="datasite" /> 
    973           <table class="simple" id="admin_datasite"> 
    974             <tr> 
    975               <td class="help"> 
    976                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "datasitebase_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "datasitebase").'</a>: 
    977               </td> 
    978               <td> 
    979                 <input type="text" name="datasitebase" value="'.$datasite_base["Value"].'" size="50" /> 
    980               </td> 
    981             </tr> 
    982             <tr> 
    983               <td class="help"> 
    984                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "datasitename_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "datasitename").'</a>: 
    985               </td> 
    986               <td> 
    987                 <input type="text" name="datasitename" value="'.$datasite_name["Value"].'" size="50" /> 
    988               </td> 
    989             </tr> 
    990             <tr> 
    991               <td class="help"> 
    992                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "datasiteitem_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "datasiteitem").'</a>: 
    993               </td> 
    994               <td> 
    995                 <input type="text" name="datasiteitem" value="'.$datasite_item["Value"].'" size="50" /> 
    996               </td> 
    997             </tr> 
    998             <tr> 
    999               <td class="help"> 
    1000                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "datasitequest_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "datasitequest").'</a>: 
    1001               </td> 
    1002               <td> 
    1003                 <input type="text" name="datasitequest" value="'.$datasite_quest["Value"].'" size="50" /> 
    1004               </td> 
    1005             </tr> 
    1006             <tr> 
    1007               <td class="help"> 
    1008                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "datasitecreature_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "datasitecreature").'</a>: 
    1009               </td> 
    1010               <td> 
    1011                 <input type="text" name="datasitecreature" value="'.$datasite_creature["Value"].'" size="50" /> 
    1012               </td> 
    1013             </tr> 
    1014             <tr> 
    1015               <td class="help"> 
    1016                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "datasitespell_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "datasitespell").'</a>: 
    1017               </td> 
    1018               <td> 
    1019                 <input type="text" name="datasitespell" value="'.$datasite_spell["Value"].'" size="50" /> 
    1020               </td> 
    1021             </tr> 
    1022             <tr> 
    1023               <td class="help"> 
    1024                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "datasiteskill_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "datasiteskill").'</a>: 
    1025               </td> 
    1026               <td> 
    1027                 <input type="text" name="datasiteskill" value="'.$datasite_skill["Value"].'" size="50" /> 
    1028               </td> 
    1029             </tr> 
    1030             <tr> 
    1031               <td class="help"> 
    1032                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "datasitego_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "datasitego").'</a>: 
    1033               </td> 
    1034               <td> 
    1035                 <input type="text" name="datasitego" value="'.$datasite_go["Value"].'" size="50" /> 
    1036               </td> 
    1037             </tr> 
    1038             <tr> 
    1039               <td class="help"> 
    1040                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "datasiteachieve_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "datasiteachieve").'</a>: 
    1041               </td> 
    1042               <td> 
    1043                 <input type="text" name="datasiteachieve" value="'.$datasite_achieve["Value"].'" size="50" /> 
    1044               </td> 
    1045             </tr> 
    1046           </table> 
    1047           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    1048         </form>'; 
    1049       } 
    1050       else 
    1051       { 
    1052         $datasite_base = $sqlm->quote_smart($_GET["datasitebase"]); 
    1053         $datasite_name = $sqlm->quote_smart($_GET["datasitename"]); 
    1054         $datasite_item = $sqlm->quote_smart($_GET["datasiteitem"]); 
    1055         $datasite_quest = $sqlm->quote_smart($_GET["datasitequest"]); 
    1056         $datasite_creature = $sqlm->quote_smart($_GET["datasitecreature"]); 
    1057         $datasite_spell = $sqlm->quote_smart($_GET["datasitespell"]); 
    1058         $datasite_skill = $sqlm->quote_smart($_GET["datasiteskill"]); 
    1059         $datasite_go = $sqlm->quote_smart($_GET["datasitego"]); 
    1060         $datasite_achieve = $sqlm->quote_smart($_GET["datasiteachieve"]); 
    1061  
    1062         $result = $sqlm->query("UPDATE config_misc SET Value='".$datasite_base."' WHERE `Key`='Datasite_Base'"); 
    1063         $result = $sqlm->query("UPDATE config_misc SET Value='".$datasite_name."' WHERE `Key`='Datasite_Name'"); 
    1064         $result = $sqlm->query("UPDATE config_misc SET Value='".$datasite_item."' WHERE `Key`='Datasite_Item'"); 
    1065         $result = $sqlm->query("UPDATE config_misc SET Value='".$datasite_quest."' WHERE `Key`='Datasite_Quest'"); 
    1066         $result = $sqlm->query("UPDATE config_misc SET Value='".$datasite_creature."' WHERE `Key`='Datasite_Creature'"); 
    1067         $result = $sqlm->query("UPDATE config_misc SET Value='".$datasite_spell."' WHERE `Key`='Datasite_Spell'"); 
    1068         $result = $sqlm->query("UPDATE config_misc SET Value='".$datasite_skill."' WHERE `Key`='Datasite_Skill'"); 
    1069         $result = $sqlm->query("UPDATE config_misc SET Value='".$datasite_go."' WHERE `Key`='Datasite_GO'"); 
    1070         $result = $sqlm->query("UPDATE config_misc SET Value='".$datasite_achieve."' WHERE `Key`='Datasite_Achievement'"); 
    1071  
    1072         redirect("admin.php?section=general&subsection=datasite"); 
    1073       } 
    1074       break; 
    1075     } 
    1076     case "acctcreation": 
    1077     { 
    1078       if ( !$sub_action ) 
    1079       { 
    1080         $disable_acc_creation = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Disable_Acc_Creation'")); 
    1081         $invite_only = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Invitation_Only'")); 
    1082         $disable_reg_invite = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Disable_Invitation'")); 
    1083         $expansion_select = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Expansion_Select'")); 
    1084         $default_expansion = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Default_Expansion'")); 
    1085         $enabled_captcha = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Enabled_Captcha'")); 
    1086         $using_recaptcha = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Use_Recaptcha'")); 
    1087         $publickey = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Recaptcha_Public_Key'")); 
    1088         $privatekey = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Recaptcha_Private_Key'")); 
    1089         $send_mail_on_creation = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Send_Mail_On_Creation'")); 
    1090         $send_confirmation_mail_on_creation = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Send_Confirmation_Mail_On_Creation'")); 
    1091         $validate_mail_host = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Validate_Mail_Host'")); 
    1092         $limit_acc_per_ip = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Limit_Acc_Per_IP'")); 
    1093         $output .= ' 
    1094         <form name="form" action="admin.php" method="get"> 
    1095           <input type="hidden" name="section" value="general" /> 
    1096           <input type="hidden" name="subaction" value="saveacctcreation" /> 
    1097           <input type="hidden" name="subsection" value="acctcreation" /> 
    1098           <table class="simple" id="admin_acct_creation"> 
    1099             <tr> 
    1100               <td class="help"> 
    1101                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "disableacccreation_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "disableacccreation").'</a>: 
    1102               </td> 
    1103               <td> 
    1104                 <input type="checkbox" name="disableacccreation" '.( ( $disable_acc_creation["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1105               </td> 
    1106             </tr> 
    1107             <tr> 
    1108               <td class="help"> 
    1109                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "inviteonly_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "inviteonly").'</a>: 
    1110               </td> 
    1111               <td> 
    1112                 <input type="checkbox" name="inviteonly" '.( ( $invite_only["Value"] == 1 ) ? 'checked="checked"' : '' ).' '.( ( $disable_acc_creation["Value"] == 1 ) ? '' : 'disabled="disabled"' ).' /> 
    1113               </td> 
    1114             </tr> 
    1115             <tr> 
    1116               <td class="help"> 
    1117                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "disablereginvite_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "disablereginvite").'</a>: 
    1118               </td> 
    1119               <td> 
    1120                 <input type="checkbox" name="disablereginvite" '.( ( $disable_reg_invite["Value"] == 1 ) ? 'checked="checked"' : '' ).' '.( ( $invite_only["Value"] == 0 ) ? '' : 'disabled="disabled"' ).' /> 
    1121               </td> 
    1122             </tr> 
    1123             <tr> 
    1124               <td class="help"> 
    1125                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "expansionselect_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "expansionselect").'</a>: 
    1126               </td> 
    1127               <td> 
    1128                 <input type="checkbox" name="expansionselect" '.( ( $expansion_select["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1129               </td> 
    1130             </tr> 
    1131             <tr> 
    1132               <td class="help"> 
    1133                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "defaultexpansion_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "defaultexpansion").'</a>: 
    1134               </td> 
    1135               <td> 
    1136                 <select name="defaultexpansion">'; 
    1137         if ( $core == 1 ) 
    1138           $output .= ' 
    1139                   <option value="0" '.( ( $default_expansion["Value"] == 0 ) ? 'selected="selected"' : '' ).'>Classic</option> 
    1140                   <option value="8" '.( ( $default_expansion["Value"] == 8 ) ? 'selected="selected"' : '' ).'>BC</option> 
    1141                   <option value="16" '.( ( $default_expansion["Value"] == 16 ) ? 'selected="selected"' : '' ).'>WotLK</option> 
    1142                   <option value="24" '.( ( $default_expansion["Value"] == 24 ) ? 'selected="selected"' : '' ).'>WotLK+BC</option>'; 
    1143         else 
    1144           $output .= ' 
    1145                   <option value="0" '.( ( $default_expansion["Value"] == 0 ) ? 'selected="selected"' : '' ).'>Classic</option> 
    1146                   <option value="1" '.( ( $default_expansion["Value"] == 1 ) ? 'selected="selected"' : '' ).'>BC</option> 
    1147                   <option value="2" '.( ( $default_expansion["Value"] == 2 ) ? 'selected="selected"' : '' ).'>WotLK+BC</option>'; 
    1148         $output .= ' 
    1149                 </select> 
    1150               </td> 
    1151             </tr> 
    1152             <tr> 
    1153               <td class="help"> 
    1154                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "enabledcaptcha_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "enabledcaptcha").'</a>: 
    1155               </td> 
    1156               <td> 
    1157                 <input type="checkbox" name="enabledcaptcha" '.( ( $enabled_captcha["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1158               </td> 
    1159             </tr> 
    1160             <tr> 
    1161               <td class="help"> 
    1162                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "userecaptcha_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "userecaptcha").'</a>: 
    1163               </td> 
    1164               <td> 
    1165                 <input type="checkbox" name="userecaptcha" '.( ( $using_recaptcha["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1166               </td> 
    1167             </tr> 
    1168             <tr> 
    1169               <td class="help"> 
    1170                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "publickey_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "publickey").'</a>: 
    1171               </td> 
    1172               <td> 
    1173                 <input type="text" name="publickey" value="'.$publickey["Value"].'" size="52" /> 
    1174               </td> 
    1175             </tr> 
    1176             <tr> 
    1177               <td class="help"> 
    1178                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "privatekey_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "privatekey").'</a>: 
    1179               </td> 
    1180               <td> 
    1181                 <input type="text" name="privatekey" value="'.$privatekey["Value"].'" size="52" /> 
    1182               </td> 
    1183             </tr> 
    1184             <tr> 
    1185               <td class="help"> 
    1186                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "sendmailoncreation_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "sendmailoncreation").'</a>: 
    1187               </td> 
    1188               <td> 
    1189                 <input type="checkbox" name="sendmailoncreation" '.( ( $send_mail_on_creation["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1190               </td> 
    1191             </tr> 
    1192             <tr> 
    1193               <td class="help"> 
    1194                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "sendconfirmmailoncreation_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "sendconfirmmailoncreation").'</a>: 
    1195               </td> 
    1196               <td> 
    1197                 <input type="checkbox" name="sendconfirmmailoncreation" '.( ( $send_confirmation_mail_on_creation["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1198               </td> 
    1199             </tr> 
    1200             <tr> 
    1201               <td class="help"> 
    1202                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "validatemailhost_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "validatemailhost").'</a>: 
    1203               </td> 
    1204               <td> 
    1205                 <input type="checkbox" name="validatemailhost" '.( ( $validate_mail_host["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1206               </td> 
    1207             </tr> 
    1208             <tr> 
    1209               <td class="help"> 
    1210                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "limitaccperip_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "limitaccperip").'</a>: 
    1211               </td> 
    1212               <td> 
    1213                 <input type="checkbox" name="limitaccperip" '.( ( $limit_acc_per_ip["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1214               </td> 
    1215             </tr> 
    1216           </table> 
    1217           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    1218         </form>'; 
    1219       } 
    1220       else 
    1221       { 
    1222         $disable_acc_creation = ( ( isset($_GET["disableacccreation"]) ) ? 1 : 0 ); 
    1223         $invite_only = ( ( isset($_GET["inviteonly"]) ) ? 1 : 0 ); 
    1224         $disable_reg_invite = ( ( isset($_GET["disablereginvite"]) ) ? 1 : 0 ); 
    1225         $expansion_select = ( ( isset($_GET["expansionselect"]) ) ? 1 : 0 ); 
    1226         $default_expansion = $sqlm->quote_smart($_GET["defaultexpansion"]); 
    1227         $enabled_captcha = ( ( isset($_GET["enabledcaptcha"]) ) ? 1 : 0 ); 
    1228         $using_recaptcha = ( ( isset($_GET["userecaptcha"]) ) ? 1 : 0 ); 
    1229         $publickey = $sqlm->quote_smart($_GET["publickey"]); 
    1230         $privatekey = $sqlm->quote_smart($_GET["privatekey"]); 
    1231         $send_mail_on_creation = ( ( isset($_GET["sendmailoncreation"]) ) ? 1 : 0 ); 
    1232         $send_confirmation_mail_on_creation = ( ( isset($_GET["sendconfirmmailoncreation"]) ) ? 1 : 0 ); 
    1233         $validate_mail_host = ( ( isset($_GET["validatemailhost"]) ) ? 1 : 0 ); 
    1234         $limit_acc_per_ip = ( ( isset($_GET["limitaccperip"]) ) ? 1 : 0 ); 
    1235  
    1236         $result = $sqlm->query("UPDATE config_misc SET Value='".$disable_acc_creation."' WHERE `Key`='Disable_Acc_Creation'"); 
    1237         $result = $sqlm->query("UPDATE config_misc SET Value='".$invite_only."' WHERE `Key`='Invitation_Only'"); 
    1238         $result = $sqlm->query("UPDATE config_misc SET Value='".$disable_reg_invite."' WHERE `Key`='Disable_Invitation'"); 
    1239         $result = $sqlm->query("UPDATE config_misc SET Value='".$expansion_select."' WHERE `Key`='Expansion_Select'"); 
    1240         $result = $sqlm->query("UPDATE config_misc SET Value='".$default_expansion."' WHERE `Key`='Default_Expansion'"); 
    1241         $result = $sqlm->query("UPDATE config_misc SET Value='".$enabled_captcha."' WHERE `Key`='Enabled_Captcha'"); 
    1242         $result = $sqlm->query("UPDATE config_misc SET Value='".$using_recaptcha."' WHERE `Key`='Use_Recaptcha'"); 
    1243         $result = $sqlm->query("UPDATE config_misc SET Value='".$publickey."' WHERE `Key`='Recaptcha_Public_Key'"); 
    1244         $result = $sqlm->query("UPDATE config_misc SET Value='".$privatekey."' WHERE `Key`='Recaptcha_Private_Key'"); 
    1245         $result = $sqlm->query("UPDATE config_misc SET Value='".$send_mail_on_creation."' WHERE `Key`='Send_Mail_On_Creation'"); 
    1246         $result = $sqlm->query("UPDATE config_misc SET Value='".$send_confirmation_mail_on_creation."' WHERE `Key`='Send_Confirmation_Mail_On_Creation'"); 
    1247         $result = $sqlm->query("UPDATE config_misc SET Value='".$validate_mail_host."' WHERE `Key`='Validate_Mail_Host'"); 
    1248         $result = $sqlm->query("UPDATE config_misc SET Value='".$limit_acc_per_ip."' WHERE `Key`='Limit_Acc_Per_IP'"); 
    1249  
    1250         redirect("admin.php?section=general&subsection=acctcreation"); 
    1251       } 
    1252       break; 
    1253     } 
    1254     case "guests": 
    1255     { 
    1256       if ( !$sub_action ) 
    1257       { 
    1258         $acp_allow_anony = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Allow_Anony'")); 
    1259         $acp_anony_name = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Anony_Name'")); 
    1260         $acp_anony_realm_id = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Anony_Realm_ID'")); 
    1261         $output .= ' 
    1262         <form name="form" action="admin.php" method="get"> 
    1263           <input type="hidden" name="section" value="general" /> 
    1264           <input type="hidden" name="subaction" value="saveguests" /> 
    1265           <input type="hidden" name="subsection" value="guests" /> 
    1266           <table class="simple"> 
    1267             <tr> 
    1268               <td class="help"> 
    1269                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "allowanony_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "allowanony").'</a>: 
    1270               </td> 
    1271               <td> 
    1272                 <input type="checkbox" name="allowanony" '.( ( $acp_allow_anony["Value"] == 1 ) ? 'checked="checked"' : '' ).' disabled="disabled" /> 
    1273               </td> 
    1274             </tr> 
    1275             <tr> 
    1276               <td class="help"> 
    1277                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "anonyname_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "anonyname").'</a>: 
    1278               </td> 
    1279               <td> 
    1280                 <input type="text" name="anonyname" value="'.$acp_anony_name["Value"].'" /> 
    1281               </td> 
    1282             </tr> 
    1283             <tr> 
    1284               <td class="help"> 
    1285                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "anonyrealmid_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "anonyrealmid").'</a>: 
    1286               </td> 
    1287               <td> 
    1288                 <input type="text" name="anonyrealmid" value="'.$acp_anony_realm_id["Value"].'" /> 
    1289               </td> 
    1290             </tr> 
    1291           </table> 
    1292           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    1293         </form>'; 
    1294       } 
    1295       else 
    1296       { 
    1297         // Allow Anonymous is disabled but must stay checked 
    1298         $acp_allow_anony = 1; 
    1299         $acp_anony_name = $sqlm->quote_smart($_GET["anonyname"]); 
    1300         $acp_anony_realm_id = $sqlm->quote_smart($_GET["anonyrealmid"]); 
    1301  
    1302         $result = $sqlm->query("UPDATE config_misc SET Value='".$acp_allow_anony."' WHERE `Key`='Allow_Anony'"); 
    1303         $result = $sqlm->query("UPDATE config_misc SET Value='".$acp_anony_name."' WHERE `Key`='Anony_Name'"); 
    1304         $result = $sqlm->query("UPDATE config_misc SET Value='".$acp_anony_realm_id."' WHERE `Key`='Anony_Realm_ID'"); 
    1305  
    1306         redirect("admin.php?section=general&subsection=guests"); 
    1307       } 
    1308       break; 
    1309     } 
    1310     case "extratools": 
    1311     { 
    1312       if ( !$sub_action ) 
    1313       { 
    1314         $quest_item_vendor_level_mul = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Quest_Item_Vendor_Level_Mul'")); 
    1315         $quest_item_vendor_rew_mul = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Quest_Item_Vendor_Rew_Mul'")); 
    1316         $ultra_vendor_mult_0 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_0'")); 
    1317         $ultra_vendor_mult_1 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_1'")); 
    1318         $ultra_vendor_mult_2 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_2'")); 
    1319         $ultra_vendor_mult_3 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_3'")); 
    1320         $ultra_vendor_mult_4 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_4'")); 
    1321         $ultra_vendor_mult_5 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_5'")); 
    1322         $ultra_vendor_mult_6 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_6'")); 
    1323         $ultra_vendor_mult_7 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_7'")); 
    1324         $ultra_vendor_base = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Base'")); 
    1325         $output .= ' 
    1326         <form name="form" action="admin.php" method="get"> 
    1327           <input type="hidden" name="section" value="general" /> 
    1328           <input type="hidden" name="subaction" value="saveextratools" /> 
    1329           <input type="hidden" name="subsection" value="extratools" /> 
    1330           <table class="simple"> 
    1331             <tr> 
    1332               <td colspan="2"> 
    1333                 <b>'.lang("admin", "questitemvendor").'</b> 
    1334               </td> 
    1335             </tr> 
    1336             <tr> 
    1337               <td class="help"> 
    1338                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "questitemvendorlevelmul_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "questitemvendorlevelmul").'</a>: 
    1339               </td> 
    1340               <td> 
    1341                 <input type="text" name="questitemvendorlevelmul" value="'.$quest_item_vendor_level_mul["Value"].'" /> 
    1342               </td> 
    1343             </tr> 
    1344             <tr> 
    1345               <td class="help"> 
    1346                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "questitemvendorrewmul_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "questitemvendorrewmul").'</a>: 
    1347               </td> 
    1348               <td> 
    1349                 <input type="text" name="questitemvendorrewmul" value="'.$quest_item_vendor_rew_mul["Value"].'" /> 
    1350               </td> 
    1351             </tr> 
    1352             <tr> 
    1353               <td colspan="2"> 
    1354                 <b>'.lang("admin", "ultravendor").'</b> 
    1355               </td> 
    1356             </tr> 
    1357             <tr> 
    1358               <td class="help"> 
    1359                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "ultravendormult0_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "ultravendormult0").'</a>: 
    1360               </td> 
    1361               <td> 
    1362                 <input type="text" name="ultravendormult0" value="'.$ultra_vendor_mult_0["Value"].'" /> 
    1363               </td> 
    1364             </tr> 
    1365             <tr> 
    1366               <td class="help"> 
    1367                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "ultravendormult1_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "ultravendormult1").'</a>: 
    1368               </td> 
    1369               <td> 
    1370                 <input type="text" name="ultravendormult1" value="'.$ultra_vendor_mult_1["Value"].'" /> 
    1371               </td> 
    1372             </tr> 
    1373             <tr> 
    1374               <td class="help"> 
    1375                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "ultravendormult2_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "ultravendormult2").'</a>: 
    1376               </td> 
    1377               <td> 
    1378                 <input type="text" name="ultravendormult2" value="'.$ultra_vendor_mult_2["Value"].'" /> 
    1379               </td> 
    1380             </tr> 
    1381             <tr> 
    1382               <td class="help"> 
    1383                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "ultravendormult3_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "ultravendormult3").'</a>: 
    1384               </td> 
    1385               <td> 
    1386                 <input type="text" name="ultravendormult3" value="'.$ultra_vendor_mult_3["Value"].'" /> 
    1387               </td> 
    1388             </tr> 
    1389             <tr> 
    1390               <td class="help"> 
    1391                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "ultravendormult4_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "ultravendormult4").'</a>: 
    1392               </td> 
    1393               <td> 
    1394                 <input type="text" name="ultravendormult4" value="'.$ultra_vendor_mult_4["Value"].'" /> 
    1395               </td> 
    1396             </tr> 
    1397             <tr> 
    1398               <td class="help"> 
    1399                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "ultravendormult5_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "ultravendormult5").'</a>: 
    1400               </td> 
    1401               <td> 
    1402                 <input type="text" name="ultravendormult5" value="'.$ultra_vendor_mult_5["Value"].'" /> 
    1403               </td> 
    1404             </tr> 
    1405             <tr> 
    1406               <td class="help"> 
    1407                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "ultravendormult6_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "ultravendormult6").'</a>: 
    1408               </td> 
    1409               <td> 
    1410                 <input type="text" name="ultravendormult6" value="'.$ultra_vendor_mult_6["Value"].'" /> 
    1411               </td> 
    1412             </tr> 
    1413             <tr> 
    1414               <td class="help"> 
    1415                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "ultravendormult7_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "ultravendormult7").'</a>: 
    1416               </td> 
    1417               <td> 
    1418                 <input type="text" name="ultravendormult7" value="'.$ultra_vendor_mult_7["Value"].'" /> 
    1419               </td> 
    1420             </tr> 
    1421             <tr> 
    1422               <td class="help"> 
    1423                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "ultravendorbase_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "ultravendorbase").'</a>: 
    1424               </td> 
    1425               <td> 
    1426                 <input type="text" name="ultravendorbase" value="'.$ultra_vendor_base["Value"].'" /> 
    1427               </td> 
    1428             </tr> 
    1429           </table> 
    1430           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    1431         </form>'; 
    1432       } 
    1433       else 
    1434       { 
    1435         $quest_item_vendor_level_mul = $sqlm->quote_smart($_GET["questitemvendorlevelmul"]); 
    1436         $quest_item_vendor_rew_mul = $sqlm->quote_smart($_GET["questitemvendorrewmul"]); 
    1437         $ultra_vendor_mult_0 = $sqlm->quote_smart($_GET["ultravendormult0"]); 
    1438         $ultra_vendor_mult_1 = $sqlm->quote_smart($_GET["ultravendormult1"]); 
    1439         $ultra_vendor_mult_2 = $sqlm->quote_smart($_GET["ultravendormult2"]); 
    1440         $ultra_vendor_mult_3 = $sqlm->quote_smart($_GET["ultravendormult3"]); 
    1441         $ultra_vendor_mult_4 = $sqlm->quote_smart($_GET["ultravendormult4"]); 
    1442         $ultra_vendor_mult_5 = $sqlm->quote_smart($_GET["ultravendormult5"]); 
    1443         $ultra_vendor_mult_6 = $sqlm->quote_smart($_GET["ultravendormult6"]); 
    1444         $ultra_vendor_mult_7 = $sqlm->quote_smart($_GET["ultravendormult7"]); 
    1445         $ultra_vendor_base = $sqlm->quote_smart($_GET["ultravendorbase"]); 
    1446  
    1447         $result = $sqlm->query("UPDATE config_misc SET Value='".$quest_item_vendor_level_mul."' WHERE `Key`='Quest_Item_Vendor_Level_Mul'"); 
    1448         $result = $sqlm->query("UPDATE config_misc SET Value='".$quest_item_vendor_rew_mul."' WHERE `Key`='Quest_Item_Vendor_Rew_Mul'"); 
    1449         $result = $sqlm->query("UPDATE config_misc SET Value='".$ultra_vendor_mult_0."' WHERE `Key`='Ultra_Vendor_Mult_0'"); 
    1450         $result = $sqlm->query("UPDATE config_misc SET Value='".$ultra_vendor_mult_1."' WHERE `Key`='Ultra_Vendor_Mult_1'"); 
    1451         $result = $sqlm->query("UPDATE config_misc SET Value='".$ultra_vendor_mult_2."' WHERE `Key`='Ultra_Vendor_Mult_2'"); 
    1452         $result = $sqlm->query("UPDATE config_misc SET Value='".$ultra_vendor_mult_3."' WHERE `Key`='Ultra_Vendor_Mult_3'"); 
    1453         $result = $sqlm->query("UPDATE config_misc SET Value='".$ultra_vendor_mult_4."' WHERE `Key`='Ultra_Vendor_Mult_4'"); 
    1454         $result = $sqlm->query("UPDATE config_misc SET Value='".$ultra_vendor_mult_5."' WHERE `Key`='Ultra_Vendor_Mult_5'"); 
    1455         $result = $sqlm->query("UPDATE config_misc SET Value='".$ultra_vendor_mult_6."' WHERE `Key`='Ultra_Vendor_Mult_6'"); 
    1456         $result = $sqlm->query("UPDATE config_misc SET Value='".$ultra_vendor_mult_7."' WHERE `Key`='Ultra_Vendor_Mult_7'"); 
    1457         $result = $sqlm->query("UPDATE config_misc SET Value='".$ultra_vendor_base."' WHERE `Key`='Ultra_Vendor_Base'"); 
    1458  
    1459         redirect("admin.php?section=general&subsection=extratools"); 
    1460       } 
    1461       break; 
    1462     } 
    1463     case "internalmap": 
    1464     { 
    1465       if ( !$sub_action ) 
    1466       { 
    1467         $map_gm_show_online_only_gmoff = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_GM_Show_Online_Only_GMOff'")); 
    1468         $map_gm_show_online_only_gmvisible = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_GM_Show_Online_Only_GMVisible'")); 
    1469         $map_gm_add_suffix = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_GM_Add_Suffix'")); 
    1470         $map_status_gm_include_all = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Status_GM_Include_All'")); 
    1471         $map_show_status = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Show_Status'")); 
    1472         $map_show_timer = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Show_Timer'")); 
    1473         $map_timer = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Timer'")); 
    1474         $map_show_online = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Show_Online'")); 
    1475         $map_time_to_show_uptime = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Time_To_Show_Uptime'")); 
    1476         $map_time_to_show_maxonline = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Time_To_Show_MaxOnline'")); 
    1477         $map_time_to_show_gmonline = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Time_To_Show_GMOnline'")); 
    1478         $output .= ' 
    1479         <form name="form" action="admin.php" method="get"> 
    1480           <input type="hidden" name="section" value="general" /> 
    1481           <input type="hidden" name="subaction" value="saveinternalmap" /> 
    1482           <input type="hidden" name="subsection" value="internalmap" /> 
    1483           <table class="simple"> 
    1484             <tr> 
    1485               <td class="help"> 
    1486                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "statusgmincludeall_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "statusgmincludeall").'</a>: 
    1487               </td> 
    1488               <td> 
    1489                 <input type="checkbox" name="statusgmincludeall" '.( ( $map_status_gm_include_all["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1490               </td> 
    1491             </tr> 
    1492             <!-- tr> 
    1493               <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "gmshowonlineonlygmoff_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "gmshowonlineonlygmoff").'</a>: </td> 
    1494               <td><input type="checkbox" name="gmshowonlineonlygmoff" '.( ( $map_gm_show_online_only_gmoff["Value"] == 1 ) ? 'checked="checked"' : '' ).' /></td> 
    1495             </tr> 
    1496             <tr> 
    1497               <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "gmshowonlineonlygmvisible_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "gmshowonlineonlygmvisible").'</a>: </td> 
    1498               <td><input type="checkbox" name="gmshowonlineonlygmvisible" '.( ( $map_gm_show_online_only_gmvisible["Value"] == 1 ) ? 'checked="checked"' : '' ).' disabled="disabled" /></td> 
    1499             </tr --> 
    1500             <tr> 
    1501               <td class="help"> 
    1502                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "gmaddsuffix_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "gmaddsuffix").'</a>: 
    1503               </td> 
    1504               <td> 
    1505                 <input type="checkbox" name="gmaddsuffix" '.( ( $map_gm_add_suffix["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1506               </td> 
    1507             </tr> 
    1508             <!-- tr> 
    1509               <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "showstatus_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "showstatus").'</a>: </td> 
    1510               <td><input type="checkbox" name="showstatus" '.( ( $map_show_status["Value"] == 1 ) ? 'checked="checked"' : '' ).' disabled="disabled" /></td> 
    1511             </tr> 
    1512             <tr> 
    1513               <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "showtimer_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "showtimer").'</a>: </td> 
    1514               <td><input type="checkbox" name="showtimer" '.( ( $map_show_timer["Value"] == 1 ) ? 'checked="checked"' : '' ).' disabled="disabled" /></td> 
    1515             </tr> 
    1516             <tr> 
    1517               <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "timer_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "timer").'</a>: </td> 
    1518               <td><input type="text" name="timer" value="'.$map_timer["Value"].'" readonly="readonly" /></td> 
    1519             </tr> 
    1520             <tr> 
    1521               <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "showonline_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "showonline").'</a>: </td> 
    1522               <td><input type="checkbox" name="showonline" '.( ( $map_show_online["Value"] == 1 ) ? 'checked="checked"' : '' ).' disabled="disabled" /></td> 
    1523             </tr> 
    1524             <tr> 
    1525               <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "timetoshowuptime_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "timetoshowuptime").'</a>: </td> 
    1526               <td><input type="text" name="timetoshowuptime" value="'.$map_time_to_show_uptime["Value"].'" readonly="readonly" /></td> 
    1527             </tr> 
    1528             <tr> 
    1529               <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "timetoshowmaxonline_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "timetoshowmaxonline").'</a>: </td> 
    1530               <td><input type="text" name="timetoshowmaxonline" value="'.$map_time_to_show_maxonline["Value"].'" readonly="readonly" /></td> 
    1531             </tr> 
    1532             <tr> 
    1533               <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "timetoshowgmonline_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "timetoshowgmonline").'</a>: </td> 
    1534               <td><input type="text" name="timetoshowgmonline" value="'.$map_time_to_show_gmonline["Value"].'" readonly="readonly" /></td> 
    1535             </tr --> 
    1536           </table> 
    1537           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    1538         </form>'; 
    1539       } 
    1540       else 
    1541       { 
    1542         $map_gm_show_online_only_gmoff = ( ( isset($_GET["gmshowonlineonlygmoff"]) ) ? 1 : 0 ); 
    1543         $map_gm_show_online_only_gmvisible = ( ( isset($_GET["gmshowonlineonlygmvisible"]) ) ? 1 : 0 ); 
    1544         $map_gm_add_suffix = ( ( isset($_GET["gmaddsuffix"]) ) ? 1 : 0 ); 
    1545         $map_status_gm_include_all = ( ( isset($_GET["statusgmincludeall"]) ) ? 1 : 0 ); 
    1546         $map_show_status = ( ( isset($_GET["showstatus"]) ) ? 1 : 0 ); 
    1547         $map_show_timer = ( ( isset($_GET["showtimer"]) ) ? 1 : 0 ); 
    1548         $map_timer = $sqlm->quote_smart($_GET["timer"]); 
    1549         $map_show_online = ( ( isset($_GET["showonline"]) ) ? 1 : 0 ); 
    1550         $map_time_to_show_uptime = $sqlm->quote_smart($_GET["timetoshowuptime"]); 
    1551         $map_time_to_show_maxonline = $sqlm->quote_smart($_GET["timetoshowmaxonline"]); 
    1552         $map_time_to_show_gmonline = $sqlm->quote_smart($_GET["timetoshowgmonline"]); 
    1553  
    1554         $result = $sqlm->query("UPDATE config_misc SET Value='".$map_gm_show_online_only_gmoff."' WHERE `Key`='Map_GM_Show_Online_Only_GMOff'"); 
    1555         $result = $sqlm->query("UPDATE config_misc SET Value='".$map_gm_show_online_only_gmvisible."' WHERE `Key`='Map_GM_Show_Online_Only_GMVisible'"); 
    1556         $result = $sqlm->query("UPDATE config_misc SET Value='".$map_gm_add_suffix."' WHERE `Key`='Map_GM_Add_Suffix'"); 
    1557         $result = $sqlm->query("UPDATE config_misc SET Value='".$map_status_gm_include_all."' WHERE `Key`='Map_Status_GM_Include_All'"); 
    1558         $result = $sqlm->query("UPDATE config_misc SET Value='".$map_show_status."' WHERE `Key`='Map_Show_Status'"); 
    1559         $result = $sqlm->query("UPDATE config_misc SET Value='".$map_gm_add_suffix."' WHERE `Key`='Map_Show_Timer'"); 
    1560         $result = $sqlm->query("UPDATE config_misc SET Value='".$map_timer."' WHERE `Key`='Map_Timer'"); 
    1561         $result = $sqlm->query("UPDATE config_misc SET Value='".$map_show_online."' WHERE `Key`='Map_Show_Online'"); 
    1562         $result = $sqlm->query("UPDATE config_misc SET Value='".$map_time_to_show_uptime."' WHERE `Key`='Map_Time_To_Show_Uptime'"); 
    1563         $result = $sqlm->query("UPDATE config_misc SET Value='".$map_time_to_show_maxonline."' WHERE `Key`='Map_Time_To_Show_MaxOnline'"); 
    1564         $result = $sqlm->query("UPDATE config_misc SET Value='".$map_time_to_show_gmonline."' WHERE `Key`='Map_Time_To_Show_GMOnline'"); 
    1565  
    1566         redirect("admin.php?section=general&subsection=internalmap"); 
    1567       } 
    1568       break; 
    1569     } 
    1570     case "validip": 
    1571     { 
    1572       if ( !$sub_action ) 
    1573       { 
    1574         $masks_query = $sqlm->query("SELECT * FROM config_valid_ip_mask"); 
    1575         $output .= ' 
    1576         <form name="form" action="admin.php" method="get"> 
    1577           <input type="hidden" name="section" value="general" /> 
    1578           <input type="hidden" name="subaction" value="editvalidip" /> 
    1579           <input type="hidden" name="subsection" value="validip" /> 
    1580           <table class="simple"> 
    1581             <tr> 
    1582               <th width="10%">&nbsp;</th> 
    1583               <th width="20%"> 
    1584                 <center>'.lang("admin", "index").'</center> 
    1585               </th> 
    1586               <th>'.lang("admin", "validipmask").'</th> 
    1587             </tr>'; 
    1588         while ( $mask = $sqlm->fetch_assoc($masks_query) ) 
    1589         { 
    1590           $output .= ' 
    1591             <tr> 
    1592               <td> 
    1593                 <input type="radio" name="index" value="'.$mask["Index"].'" /> 
    1594               </td> 
    1595               <td> 
    1596                 <center>'.$mask["Index"].'</center> 
    1597               </td> 
    1598               <td>'.$mask["ValidIPMask"].'</td> 
    1599             </tr>'; 
    1600         } 
    1601         $output .= ' 
    1602           </table> 
    1603           <input type="submit" name="edit" value="'.lang("admin", "editipmask").'" /> 
    1604           <input type="submit" name="add" value="'.lang("admin", "addipmask").'" /> 
    1605           <input type="submit" name="delete" value="'.lang("admin", "deleteipmask").'" /> 
    1606         </form>'; 
    1607       } 
    1608       elseif ( $sub_action == "editvalidip" ) 
    1609       { 
    1610         if ( isset($_GET["add"]) ) 
    1611         { 
    1612           $lim = $sqlm->fetch_assoc($sqlm->query("SELECT MAX(`Index`) FROM config_valid_ip_mask")); 
    1613           $lim = $lim["MAX(`Index`)"] + 1; 
    1614           $sqlm->query("INSERT INTO config_valid_ip_mask SET `Index`='".$lim."', ValidIPMask=''"); 
    1615           redirect("admin.php?section=general&subsection=validip"); 
    1616         } 
    1617         elseif ( isset($_GET["delete"]) ) 
    1618         { 
    1619           $index = $sqlm->quote_smart($_GET["index"]); 
    1620           if ( !is_numeric($index) ) 
    1621             redirect("admin.php?section=general&subsection=validip&error=1"); 
    1622  
    1623           $result = $sqlm->query("DELETE FROM config_valid_ip_mask WHERE `Index`='".$index."'"); 
    1624           redirect("admin.php?section=general&subsection=validip"); 
    1625         } 
    1626         else 
    1627         { 
    1628           $index = $sqlm->quote_smart($_GET["index"]); 
    1629           if ( !is_numeric($index) ) 
    1630             redirect("admin.php?section=general&subsection=validip&error=1"); 
    1631  
    1632           $mask = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_valid_ip_mask WHERE `Index`='".$index."'")); 
    1633           $output .= ' 
    1634         <form name="form" action="admin.php" method="get"> 
    1635           <input type="hidden" name="section" value="general" /> 
    1636           <input type="hidden" name="subaction" value="savevalidip" /> 
    1637           <input type="hidden" name="subsection" value="validip" /> 
    1638           <input type="hidden" name="index" value="'.$mask["Index"].'" /> 
    1639           <table class="simple"> 
    1640             <tr> 
    1641               <th width="20%"> 
    1642                 <center>'.lang("admin", "index").'</center> 
    1643               </th> 
    1644               <th class="help"> 
    1645                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "validipmask_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "validipmask").'</a> 
    1646               </th> 
    1647             </tr> 
    1648             <tr> 
    1649               <td> 
    1650                 <center>'.$mask["Index"].'</center> 
    1651               </td> 
    1652               <td> 
    1653                 <input type="text" name="mask" value="'.$mask["ValidIPMask"].'" /> 
    1654               </td> 
    1655             </tr> 
    1656           </table> 
    1657           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    1658         </form>'; 
    1659         } 
    1660       } 
    1661       else 
    1662       { 
    1663         $index = $sqlm->quote_smart($_GET["index"]); 
    1664         $mask = $sqlm->quote_smart($_GET["mask"]); 
    1665         $result = $sqlm->query("UPDATE config_valid_ip_mask SET ValidIPMask='".$mask."' WHERE `Index`='".$index."'"); 
    1666  
    1667         redirect("admin.php?section=general&subsection=validip"); 
    1668       } 
    1669       break; 
    1670     } 
    1671     case "ads": 
    1672     { 
    1673       if ( !$sub_action ) 
    1674       { 
    1675         $enable_bottom_ad = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Enable_Page_Bottom_Ad'")); 
    1676         $bottom_ad_content = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Page_Bottom_Ad_Content'")); 
    1677         $output .= ' 
    1678         <form name="form" action="admin.php" method="get"> 
    1679           <input type="hidden" name="section" value="general" /> 
    1680           <input type="hidden" name="subaction" value="saveads" /> 
    1681           <input type="hidden" name="subsection" value="ads" /> 
    1682           <table class="simple" id="admin_more"> 
    1683             <tr> 
    1684               <td class="help"> 
    1685                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "enablebottomad_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "enablebottomad").'</a>: 
    1686               </td> 
    1687               <td> 
    1688                 <input type="checkbox" name="enablebottomad" '.( ( $enable_bottom_ad["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1689               </td> 
    1690             </tr> 
    1691             <tr> 
    1692               <td class="help"> 
    1693                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "bottomadcontent_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "bottomadcontent").'</a>: 
    1694               </td> 
    1695               <td> 
    1696                 <textarea name="bottomadcontent" rows="5" cols="40">'.$bottom_ad_content["Value"].'</textarea> 
    1697               </td> 
    1698             </tr> 
    1699           </table> 
    1700           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    1701         </form>'; 
    1702       } 
    1703       else 
    1704       { 
    1705         $page_bottom_ad = ( ( isset($_GET["enablebottomad"]) ) ? 1 : 0 ); 
    1706         $page_bottom_ad_content = $sqlm->quote_smart($_GET["bottomadcontent"]); 
    1707  
    1708         $result = $sqlm->query("UPDATE config_misc SET Value='".$page_bottom_ad."' WHERE `Key`='Enable_Page_Bottom_Ad'"); 
    1709         $result = $sqlm->query("UPDATE config_misc SET Value='".$page_bottom_ad_content."' WHERE `Key`='Page_Bottom_Ad_Content'"); 
    1710  
    1711         redirect("admin.php?section=general&subsection=ads"); 
    1712       } 
    1713       break; 
    1714     } 
    1715     case "more": 
    1716     { 
    1717       if ( !$sub_action ) 
    1718       { 
    1719         $sql_search_limit = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='SQL_Search_Limit'")); 
    1720         $item_icons = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Item_Icons'")); 
    1721         $remember_me_checked = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Remember_Me_Checked'")); 
    1722         $site_title = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Site_Title'")); 
    1723         $item_per_page = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Item_Per_Page'")); 
    1724         $show_country_flags = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Country_Flags'")); 
    1725         $default_theme = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Default_Theme'")); 
    1726         $default_language = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Default_Language'")); 
    1727         $timezone = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Timezone'")); 
    1728         $timezone_offset = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Timezone_Offset'")); 
    1729         $player_online = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Player_Online'")); 
    1730         $gm_online = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='GM_Online'")); 
    1731         $gm_online_count = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='GM_Online_Count'")); 
    1732         $hide_uptime = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hide_Uptime'")); 
    1733         $hide_max_players = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hide_Max_Players'")); 
    1734         $hide_avg_latency = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hide_Avg_Latency'")); 
    1735         $hide_server_mem = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hide_Server_Mem'")); 
    1736         $hide_plr_latency = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hide_Plr_Latency'")); 
    1737         $hide_coupons = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hide_Coupons_Main_Page'")); 
    1738         $backup_dir = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Backup_Dir'")); 
    1739         $debug = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Debug'")); 
    1740         $test_mode = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Test_Mode'")); 
    1741         $multi_realm = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Multi_Realm'")); 
    1742         $show_emblem = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Guild_Emblem'")); 
    1743         $language_locales_search_option = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Language_Locales_Search_Option'")); 
    1744         $language_site_encoding = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Language_Site_Encoding'")); 
    1745         $show_newest_user = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Newest_User'")); 
    1746         $send_on_email = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Send_Mail_On_Email_Change'")); 
    1747         $use_custom_logo = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Use_Custom_Logo'")); 
    1748         $custom_logo = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Custom_Logo'")); 
    1749         $allow_caching = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Allow_Logo_Caching'")); 
    1750         $index_show_realms = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Index_Show_Realms'")); 
    1751  
    1752         $custom_logos_result = $sqlm->query("SELECT * FROM custom_logos"); 
    1753         $custom_logo_count = $sqlm->num_rows($custom_logos_result); 
    1754         $custom_logos = array(); 
    1755         while ( $row = $sqlm->fetch_assoc($custom_logos_result) ) 
    1756         { 
    1757           $custom_logos[] = $row; 
    1758         } 
    1759  
    1760         $output .= ' 
    1761         <form name="form" action="admin.php" method="get" enctype="multipart/form-data"> 
    1762           <input type="hidden" name="section" value="general" /> 
    1763           <input type="hidden" name="subaction" value="savemore" /> 
    1764           <input type="hidden" name="subsection" value="more" /> 
    1765           <table class="simple" id="admin_more"> 
    1766             <tr> 
    1767               <td class="help"> 
    1768                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "sqlsearchlimit_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "sqlsearchlimit").'</a>: 
    1769               </td> 
    1770               <td> 
    1771                 <input type="text" name="sqlsearchlimit" value="'.$sql_search_limit["Value"].'" /> 
    1772               </td> 
    1773             </tr> 
    1774             <tr> 
    1775               <td class="help"> 
    1776                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "itemicons_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "itemicons").'</a>: 
    1777               </td> 
    1778               <td> 
    1779                 <input type="text" name="itemicons" value="'.$item_icons["Value"].'" /> 
    1780               </td> 
    1781             </tr> 
    1782             <tr> 
    1783               <td class="help"> 
    1784                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "remembermechecked_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "remembermechecked").'</a>: 
    1785               </td> 
    1786               <td> 
    1787                 <input type="checkbox" name="remembermechecked" '.( ( $remember_me_checked["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1788               </td> 
    1789             </tr> 
    1790             <tr> 
    1791               <td class="help"> 
    1792                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "sitetitle_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "sitetitle").'</a>: 
    1793               </td> 
    1794               <td> 
    1795                 <input type="text" name="sitetitle" value="'.$site_title["Value"].'" size="50"/> 
    1796               </td> 
    1797             </tr> 
    1798             <tr> 
    1799               <td class="help"> 
    1800                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "itemperpage_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "itemperpage").'</a>: 
    1801               </td> 
    1802               <td> 
    1803                 <input type="text" name="itemperpage" value="'.$item_per_page["Value"].'" /> 
    1804               </td> 
    1805             </tr> 
    1806             <tr> 
    1807               <td class="help"> 
    1808                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "showcountryflags_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "showcountryflags").'</a>: 
    1809               </td> 
    1810               <td> 
    1811                 <input type="checkbox" name="showcountryflags" '.( ( $show_country_flags["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1812               </td> 
    1813             </tr> 
    1814             <tr> 
    1815               <td class="help"> 
    1816                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "defaulttheme_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "defaulttheme").'</a>: 
    1817               </td> 
    1818               <td> 
    1819                 <input type="text" name="defaulttheme" value="'.$default_theme["Value"].'" /> 
    1820               </td> 
    1821             </tr> 
    1822             <tr> 
    1823               <td class="help"> 
    1824                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "defaultlanguage_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "defaultlanguage").'</a>: 
    1825               </td> 
    1826               <td> 
    1827                 <select name="defaultlanguage">'; 
    1828         if ( is_dir("./lang") ) 
    1829         { 
    1830           if ( $dh = opendir("./lang") ) 
    1831           { 
    1832             while ( ( $file = readdir($dh) ) == true ) 
    1833             { 
    1834               $lang_temp = explode(".", $file); 
    1835               if ( isset($lang_temp[1]) && ( $lang_temp[1] == "php" ) ) 
    1836               { 
    1837                 $output .= ' 
    1838                       <option value="'.$lang_temp[0].'"'.( ( $default_language["Value"] == $lang_temp[0] ) ? ' selected="selected" ' : '' ).'>'.lang("edit", $lang_temp[0]).'</option>'; 
    1839               } 
    1840             } 
    1841             closedir($dh); 
    1842           } 
    1843         } 
    1844         $output .= ' 
    1845                 </select> 
    1846               </td> 
    1847             </tr> 
    1848             <tr> 
    1849               <td class="help"> 
    1850                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "timezone_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "timezone").'</a>: 
    1851               </td> 
    1852               <td> 
    1853                 <select name="timezone"> 
    1854                   <option value="-12.0" '.( ( $timezone["Value"] == "-12.0" ) ? 'selected="selected"' : '' ).'>(UTC -12:00) Eniwetok, Kwajalein</option> 
    1855                   <option value="-11.0" '.( ( $timezone["Value"] == "-11.0" ) ? 'selected="selected"' : '' ).'>(UTC -11:00) Midway Island, Samoa</option> 
    1856                   <option value="-10.0" '.( ( $timezone["Value"] == "-10.0" ) ? 'selected="selected"' : '' ).'>(UTC -10:00) Hawaii</option> 
    1857                   <option value="-9.0" '.( ( $timezone["Value"] == "-9.0" ) ? 'selected="selected"' : '' ).'>(UTC -9:00) Alaska</option> 
    1858                   <option value="-8.0" '.( ( $timezone["Value"] == "-8.0" ) ? 'selected="selected"' : '' ).'>(UTC -8:00) Pacific Time (US &amp; Canada)</option> 
    1859                   <option value="-7.0" '.( ( $timezone["Value"] == "-7.0" ) ? 'selected="selected"' : '' ).'>(UTC -7:00) Mountain Time (US &amp; Canada)</option> 
    1860                   <option value="-6.0" '.( ( $timezone["Value"] == "-6.0" ) ? 'selected="selected"' : '' ).'>(UTC -6:00) Central Time (US &amp; Canada), Mexico City</option> 
    1861                   <option value="-5.0" '.( ( $timezone["Value"] == "-5.0" ) ? 'selected="selected"' : '' ).'>(UTC -5:00) Eastern Time (US &amp; Canada), Bogota, Lima</option> 
    1862                   <option value="-4.5" '.( ( $timezone["Value"] == "-4.5" ) ? 'selected="selected"' : '' ).'>(UTC -4:30) Caracas</option> 
    1863                   <option value="-4.0" '.( ( $timezone["Value"] == "-4.0" ) ? 'selected="selected"' : '' ).'>(UTC -4:00) Atlantic Time (Canada), La Paz</option> 
    1864                   <option value="-3.5" '.( ( $timezone["Value"] == "-3.5" ) ? 'selected="selected"' : '' ).'>(UTC -3:30) Newfoundland</option> 
    1865                   <option value="-3.0" '.( ( $timezone["Value"] == "-3.0" ) ? 'selected="selected"' : '' ).'>(UTC -3:00) Brazil, Buenos Aires, Georgetown</option> 
    1866                   <option value="-2.0" '.( ( $timezone["Value"] == "-2.0" ) ? 'selected="selected"' : '' ).'>(UTC -2:00) Mid-Atlantic</option> 
    1867                   <option value="-1.0" '.( ( $timezone["Value"] == "-1.0" ) ? 'selected="selected"' : '' ).'>(UTC -1:00) Azores, Cape Verde Islands</option> 
    1868                   <option value="0.0" '.( ( $timezone["Value"] == "0.0" ) ? 'selected="selected"' : '' ).'>(UTC) Western Europe Time, London, Lisbon, Casablanca</option> 
    1869                   <option value="1.0" '.( ( $timezone["Value"] == "1.0" ) ? 'selected="selected"' : '' ).'>(UTC +1:00) Brussels, Copenhagen, Madrid, Paris</option> 
    1870                   <option value="2.0" '.( ( $timezone["Value"] == "2.0" ) ? 'selected="selected"' : '' ).'>(UTC +2:00) Kaliningrad, South Africa</option> 
    1871                   <option value="3.0" '.( ( $timezone["Value"] == "3.0" ) ? 'selected="selected"' : '' ).'>(UTC +3:00) Baghdad, Riyadh, Moscow, St. Petersburg</option> 
    1872                   <option value="3.5" '.( ( $timezone["Value"] == "3.5" ) ? 'selected="selected"' : '' ).'>(UTC +3:30) Tehran</option> 
    1873                   <option value="4.0" '.( ( $timezone["Value"] == "4.0" ) ? 'selected="selected"' : '' ).'>(UTC +4:00) Abu Dhabi, Muscat, Baku, Tbilisi</option> 
    1874                   <option value="4.5" '.( ( $timezone["Value"] == "4.5" ) ? 'selected="selected"' : '' ).'>(UTC +4:30) Kabul</option> 
    1875                   <option value="5.0" '.( ( $timezone["Value"] == "5.0" ) ? 'selected="selected"' : '' ).'>(UTC +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent</option> 
    1876                   <option value="5.5" '.( ( $timezone["Value"] == "5.5" ) ? 'selected="selected"' : '' ).'>(UTC +5:30) Bombay, Calcutta, Madras, New Delhi</option> 
    1877                   <option value="5.75" '.( ( $timezone["Value"] == "5.75" ) ? 'selected="selected"' : '' ).'>(UTC +5:45) Kathmandu</option> 
    1878                   <option value="6.0" '.( ( $timezone["Value"] == "6.0" ) ? 'selected="selected"' : '' ).'>(UTC +6:00) Almaty, Dhaka, Colombo</option> 
    1879                   <option value="7.0" '.( ( $timezone["Value"] == "7.0" ) ? 'selected="selected"' : '' ).'>(UTC +7:00) Bangkok, Hanoi, Jakarta</option> 
    1880                   <option value="8.0" '.( ( $timezone["Value"] == "8.0" ) ? 'selected="selected"' : '' ).'>(UTC +8:00) Beijing, Perth, Singapore, Hong Kong</option> 
    1881                   <option value="9.0" '.( ( $timezone["Value"] == "9.0" ) ? 'selected="selected"' : '' ).'>(UTC +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</option> 
    1882                   <option value="9.5" '.( ( $timezone["Value"] == "9.5" ) ? 'selected="selected"' : '' ).'>(UTC +9:30) Adelaide, Darwin</option> 
    1883                   <option value="10.0" '.( ( $timezone["Value"] == "10.0" ) ? 'selected="selected"' : '' ).'>(UTC +10:00) Eastern Australia, Guam, Vladivostok</option> 
    1884                   <option value="11.0" '.( ( $timezone["Value"] == "11.0" ) ? 'selected="selected"' : '' ).'>(UTC +11:00) Magadan, Solomon Islands, New Caledonia</option> 
    1885                   <option value="12.0" '.( ( $timezone["Value"] == "12.0" ) ? 'selected="selected"' : '' ).'>(UTC +12:00) Auckland, Wellington, Fiji, Kamchatka</option> 
    1886                 </select> 
    1887               </td> 
    1888             </tr> 
    1889             <tr> 
    1890               <td class="help"> 
    1891                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "timezone_offset_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "timezone_offset").'</a>: 
    1892               </td> 
    1893               <td> 
    1894                 <input type="text" name="timezone_offset" value="'.$timezone_offset["Value"].'" /> 
    1895               </td> 
    1896             </tr> 
    1897             <tr> 
    1898               <td class="help"> 
    1899                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "playeronline_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "playeronline").'</a>: 
    1900               </td> 
    1901               <td> 
    1902                 <select name="playeronline">'; 
    1903  
    1904         $sl_query = "SELECT * FROM config_gm_level_names"; 
    1905         $sl_result = $sqlm->query($sl_query); 
    1906  
    1907         while ( $row = $sqlm->fetch_assoc($sl_result) ) 
    1908         { 
    1909           $output .= ' 
    1910                           <option value="'.$row["Security_Level"].'" '.( ( $player_online["Value"] == $row["Security_Level"] ) ? 'selected="selected"' : '' ).'>'.$row["Full_Name"].' ('.$row["Security_Level"].')</option>'; 
    1911         } 
    1912  
    1913         $output .= ' 
    1914                 </select> 
    1915                 <!-- input type="checkbox" name="playeronline" '.( ( $player_online["Value"] == 1 ) ? 'checked="checked"' : '' ).' / --> 
    1916               </td> 
    1917             </tr> 
    1918             <tr> 
    1919               <td class="help"> 
    1920                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "gmonline_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "gmonline").'</a>: 
    1921               </td> 
    1922               <td> 
    1923                 <input type="checkbox" name="gmonline" '.( ( $gm_online["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1924               </td> 
    1925             </tr> 
    1926             <tr> 
    1927               <td class="help"> 
    1928                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "gmonlinecount_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "gmonlinecount").'</a>: 
    1929               </td> 
    1930               <td> 
    1931                 <input type="checkbox" name="gmonlinecount" '.( ( $gm_online_count["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1932               </td> 
    1933             </tr> 
    1934             <tr> 
    1935               <td class="help"> 
    1936                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "hideuptime_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "hideuptime").'</a>: 
    1937               </td> 
    1938               <td> 
    1939                 <input type="checkbox" name="hideuptime" '.( ( $hide_uptime["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1940               </td> 
    1941             </tr> 
    1942             <tr> 
    1943               <td class="help"> 
    1944                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "hidemaxplayers_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "hidemaxplayers").'</a>: 
    1945               </td> 
    1946               <td> 
    1947                 <input type="checkbox" name="hidemaxplayers" '.( ( $hide_max_players["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1948               </td> 
    1949             </tr> 
    1950             <tr> 
    1951               <td class="help"> 
    1952                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "hideavglatency_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "hideavglatency").'</a>: 
    1953               </td> 
    1954               <td> 
    1955                 <input type="checkbox" name="hideavglatency" '.( ( $hide_avg_latency["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1956               </td> 
    1957             </tr>'; 
    1958  
    1959         if ( $core == 1 ) 
    1960           $output .= ' 
    1961             <tr> 
    1962               <td class="help"> 
    1963                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "hideservermem_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "hideservermem").'</a>: 
    1964               </td> 
    1965               <td> 
    1966                 <select name="hideservermem"> 
    1967                   <option value="0" '.( ( $hide_server_mem["Value"] == 0 ) ? 'selected="selected"' : '' ).'>'.lang("admin", "hide").'</option> 
    1968                   <option value="1" '.( ( $hide_server_mem["Value"] == 1 ) ? 'selected="selected"' : '' ).'>'.lang("admin", "showtogmsonly").'</option> 
    1969                   <option value="2" '.( ( $hide_server_mem["Value"] == 2 ) ? 'selected="selected"' : '' ).'>'.lang("admin", "showall").'</option> 
    1970                 </select> 
    1971               </td> 
    1972             </tr>'; 
    1973  
    1974         $output .= ' 
    1975             <tr> 
    1976               <td class="help"> 
    1977                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "hideplrlatency_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "hideplrlatency").'</a>: 
    1978               </td> 
    1979               <td> 
    1980                 <input type="checkbox" name="hideplrlatency" '.( ( $hide_plr_latency["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1981               </td> 
    1982             </tr> 
    1983             <tr> 
    1984               <td class="help"> 
    1985                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "hidecoupons_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "hidecoupons").'</a>: 
    1986               </td> 
    1987               <td> 
    1988                 <input type="checkbox" name="hidecoupons" '.( ( $hide_coupons["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    1989               </td> 
    1990             </tr> 
    1991             <tr> 
    1992               <td class="help"> 
    1993                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "backupdir_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "backupdir").'</a>: 
    1994               </td> 
    1995               <td> 
    1996                 <input type="text" name="backupdir" value="'.$backup_dir["Value"].'" readonly="readonly" /> 
    1997               </td> 
    1998             </tr> 
    1999             <tr> 
    2000               <td class="help"> 
    2001                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "debug_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "debug").'</a>: 
    2002               </td> 
    2003               <td> 
    2004                 <input type="text" name="debug" value="'.$debug["Value"].'" /> 
    2005               </td> 
    2006             </tr> 
    2007             <tr> 
    2008               <td class="help"> 
    2009                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "testmode_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "testmode").'</a>: 
    2010               </td> 
    2011               <td> 
    2012                 <input type="text" name="testmode" value="'.$test_mode["Value"].'" readonly="readonly" /> 
    2013               </td> 
    2014             </tr> 
    2015             <tr> 
    2016               <td class="help"> 
    2017                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "multirealm_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "multirealm").'</a>: 
    2018               </td> 
    2019               <td> 
    2020                 <input type="text" name="multirealm" value="'.$multi_realm["Value"].'" readonly="readonly" /> 
    2021               </td> 
    2022             </tr> 
    2023             <tr> 
    2024               <td class="help"> 
    2025                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "showemblem_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "showemblem").'</a>: 
    2026               </td> 
    2027               <td> 
    2028                 <input type="checkbox" name="showemblem" '.( ( $show_emblem["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    2029               </td> 
    2030             </tr> 
    2031             <tr> 
    2032               <td class="help"> 
    2033                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "shownewuser_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "shownewuser").'</a>: 
    2034               </td> 
    2035               <td> 
    2036                 <input type="checkbox" name="shownewuser" '.( ( $show_newest_user["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    2037               </td> 
    2038             </tr> 
    2039             <tr> 
    2040               <td class="help"> 
    2041                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "sendonemail_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "sendonemail").'</a>: 
    2042               </td> 
    2043               <td> 
    2044                 <input type="checkbox" name="sendonemail" '.( ( $send_on_email["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    2045               </td> 
    2046             </tr> 
    2047             <tr> 
    2048               <td class="help"> 
    2049                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "indexshowrealms_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "indexshowrealms").'</a>: 
    2050               </td> 
    2051               <td> 
    2052                 <input type="checkbox" name="indexshowrealms" '.( ( $index_show_realms["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    2053               </td> 
    2054             </tr> 
    2055             <tr> 
    2056               <td colspan="2"> 
    2057                 <b>'.lang("admin", "customlogos").'</b> 
    2058               </td> 
    2059             </tr> 
    2060             <tr> 
    2061               <td class="help"> 
    2062                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "usecustomlogo_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "usecustomlogo").'</a>: 
    2063               </td> 
    2064               <td> 
    2065                 <input type="checkbox" name="usecustomlogo" '.( ( $use_custom_logo["Value"] == 1 ) ? 'checked="checked"' : '' ).' '.( ( $custom_logo_count > 0 ) ? '' : 'disabled="disabled"' ).' /> 
    2066               </td> 
    2067             </tr> 
    2068             <tr> 
    2069               <td class="help"> 
    2070                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "customlogo_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "customlogo").'</a>: 
    2071               </td> 
    2072               <td> 
    2073                 <select name="customlogo" '.( ( $custom_logo_count > 0 ) ? '' : 'disabled="disabled"' ).'>'; 
    2074         foreach ( $custom_logos as $row ) 
    2075         { 
    2076           $output .= ' 
    2077                       <option value="'.$row["id"].'" '.( ( $row["id"] == $custom_logo["Value"] ) ? 'selected="selected"' : '' ).'>'.$row["filename"].'</option>'; 
    2078         } 
    2079         $output .= ' 
    2080                 </select> 
    2081               </td> 
    2082             </tr> 
    2083             <tr> 
    2084               <td class="help"> 
    2085                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "deleteselectedlogo_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "deleteselectedlogo").'</a>: 
    2086               </td> 
    2087               <td> 
    2088                 <input type="checkbox" name="deleteselectedlogo" '.( ( $custom_logo_count > 0 ) ? '' : 'disabled="disabled"' ).' /> 
    2089               </td> 
    2090             </tr> 
    2091             <tr> 
    2092               <td class="help"> 
    2093                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "uploadlogo_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "uploadlogo").'</a>: 
    2094               </td> 
    2095               <td> 
    2096                 <a href="admin.php?section=general&amp;subsection=upload_logo">'.lang("admin", "upload").'</a> 
    2097               </td> 
    2098             </tr> 
    2099             <tr> 
    2100               <td class="help"> 
    2101                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "allowcaching_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "allowcaching").'</a>: 
    2102               </td> 
    2103               <td> 
    2104                 <input type="checkbox" name="allowcaching" '.( ( $allow_caching["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    2105               </td> 
    2106             </tr> 
    2107             <tr> 
    2108               <td colspan="2"> 
    2109                 <b>'.lang("admin", "language").'</b> 
    2110               </td> 
    2111             </tr> 
    2112             <tr> 
    2113               <td class="help"> 
    2114                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "languagelocalessearchoption_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "languagelocalessearchoption").'</a>: 
    2115               </td> 
    2116               <td> 
    2117                 <select name="languagelocalessearchoption"> 
    2118                   <option value="0" '.( ( $language_locales_search_option["Value"] == 0 ) ? 'selected="selected" ' : '' ).'>'.lang("global", "language_0").'</option> 
    2119                   <option value="1" '.( ( $language_locales_search_option["Value"] == 1 ) ? 'selected="selected" ' : '' ).'>'.lang("global", "language_1").'</option> 
    2120                   <option value="2" '.( ( $language_locales_search_option["Value"] == 2 ) ? 'selected="selected" ' : '' ).'>'.lang("global", "language_2").'</option> 
    2121                   <option value="3" '.( ( $language_locales_search_option["Value"] == 3 ) ? 'selected="selected" ' : '' ).'>'.lang("global", "language_3").'</option> 
    2122                   <option value="4" '.( ( $language_locales_search_option["Value"] == 4 ) ? 'selected="selected" ' : '' ).'>'.lang("global", "language_4").'</option> 
    2123                   <option value="5" '.( ( $language_locales_search_option["Value"] == 5 ) ? 'selected="selected" ' : '' ).'>'.lang("global", "language_5").'</option> 
    2124                   <option value="6" '.( ( $language_locales_search_option["Value"] == 6 ) ? 'selected="selected" ' : '' ).'>'.lang("global", "language_6").'</option> 
    2125                   <option value="7" '.( ( $language_locales_search_option["Value"] == 7 ) ? 'selected="selected" ' : '' ).'>'.lang("global", "language_7").'</option> 
    2126                   <option value="8" '.( ( $language_locales_search_option["Value"] == 8 ) ? 'selected="selected" ' : '' ).'>'.lang("global", "language_8").'</option> 
    2127                 </select> 
    2128               </td> 
    2129             </tr> 
    2130             <tr> 
    2131               <td class="help"> 
    2132                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "languagesiteencoding_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "languagesiteencoding").'</a>: 
    2133               </td> 
    2134               <td> 
    2135                 <input type="text" name="languagesiteencoding" value="'.$language_site_encoding["Value"].'" /> 
    2136               </td> 
    2137             </tr> 
    2138           </table> 
    2139           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    2140         </form>'; 
    2141       } 
    2142       else 
    2143       { 
    2144         $sql_search_limit = $sqlm->quote_smart($_GET["sqlsearchlimit"]); 
    2145         $item_icons = $sqlm->quote_smart($_GET["itemicons"]); 
    2146         $remember_me_checked = ( ( isset($_GET["remembermechecked"]) ) ? 1 : 0 ); 
    2147         $site_title = $sqlm->quote_smart($_GET["sitetitle"]); 
    2148         $item_per_page = $sqlm->quote_smart($_GET["itemperpage"]); 
    2149         $show_country_flags = ( ( isset($_GET["showcountryflags"]) ) ? 1 : 0 ); 
    2150         $default_theme = $sqlm->quote_smart($_GET["defaulttheme"]); 
    2151         $default_language = $sqlm->quote_smart($_GET["defaultlanguage"]); 
    2152         $timezone = $sqlm->quote_smart($_GET["timezone"]); 
    2153         $timezone_offset = $sqlm->quote_smart($_GET["timezone_offset"]); 
    2154         $player_online = $sqlm->quote_smart($_GET["playeronline"]); 
    2155         $gm_online = ( ( isset($_GET["gmonline"]) ) ? 1 : 0 ); 
    2156         $gm_online_count = ( ( isset($_GET["gmonlinecount"]) ) ? 1 : 0 ); 
    2157         $hide_uptime = ( ( isset($_GET["hideuptime"]) ) ? 1 : 0 ); 
    2158         $hide_max_players = ( ( isset($_GET["hidemaxplayers"]) ) ? 1 : 0 ); 
    2159         $hide_avg_latency = ( ( isset($_GET["hideavglatency"]) ) ? 1 : 0 ); 
    2160         $hide_plr_latency = ( ( isset($_GET["hideplrlatency"]) ) ? 1 : 0 ); 
    2161         $hide_coupons = ( ( isset($_GET["hidecoupons"]) ) ? 1 : 0 ); 
    2162         $backup_dir = $sqlm->quote_smart($_GET["backupdir"]); 
    2163         $debug = $sqlm->quote_smart($_GET["debug"]); 
    2164         $test_mode = $sqlm->quote_smart($_GET["testmode"]); 
    2165         $multi_realm = $sqlm->quote_smart($_GET["multirealm"]); 
    2166         $show_emblem = ( ( isset($_GET["showemblem"]) ) ? 1 : 0 ); 
    2167         $language_locales_search_option = $sqlm->quote_smart($_GET["languagelocalessearchoption"]); 
    2168         $language_site_encoding = $sqlm->quote_smart($_GET["languagesiteencoding"]); 
    2169         $hide_server_mem = $sqlm->quote_smart($_GET["hideservermem"]); 
    2170         $show_newest_user = ( ( isset($_GET["shownewuser"]) ) ? 1 : 0 ); 
    2171         $send_on_email = ( ( isset($_GET["sendonemail"]) ) ? 1 : 0 ); 
    2172         $index_show_realms = ( ( isset($_GET["indexshowrealms"]) ) ? 1 : 0 ); 
    2173         $use_custom_logo = ( ( isset($_GET["usecustomlogo"]) ) ? 1 : 0 ); 
    2174         $custom_logo = ( ( isset($_GET["customlogo"]) ) ? $sqlm->quote_smart($_GET["customlogo"]) : NULL ); 
    2175         $delete_selected = ( ( isset($_GET["deleteselectedlogo"]) ) ? 1 : 0 ); 
    2176         $allow_caching = ( ( isset($_GET["allowcaching"]) ) ? 1 : 0 ); 
    2177  
    2178         $result = $sqlm->query("UPDATE config_misc SET Value='".$sql_search_limit."' WHERE `Key`='SQL_Search_Limit'"); 
    2179         $result = $sqlm->query("UPDATE config_misc SET Value='".$item_icons."' WHERE `Key`='Item_Icons'"); 
    2180         $result = $sqlm->query("UPDATE config_misc SET Value='".$remember_me_checked."' WHERE `Key`='Remember_Me_Checked'"); 
    2181         $result = $sqlm->query("UPDATE config_misc SET Value='".$site_title."' WHERE `Key`='Site_Title'"); 
    2182         $result = $sqlm->query("UPDATE config_misc SET Value='".$item_per_page."' WHERE `Key`='Item_Per_Page'"); 
    2183         $result = $sqlm->query("UPDATE config_misc SET Value='".$show_country_flags."' WHERE `Key`='Show_Country_Flags'"); 
    2184         $result = $sqlm->query("UPDATE config_misc SET Value='".$default_theme."' WHERE `Key`='Default_Theme'"); 
    2185         $result = $sqlm->query("UPDATE config_misc SET Value='".$default_language."' WHERE `Key`='Default_Language'"); 
    2186         $result = $sqlm->query("UPDATE config_misc SET Value='".$timezone."' WHERE `Key`='Timezone'"); 
    2187         $result = $sqlm->query("UPDATE config_misc SET Value='".$timezone_offset."' WHERE `Key`='Timezone_Offset'"); 
    2188         $result = $sqlm->query("UPDATE config_misc SET Value='".$player_online."' WHERE `Key`='Player_Online'"); 
    2189         $result = $sqlm->query("UPDATE config_misc SET Value='".$gm_online."' WHERE `Key`='GM_Online'"); 
    2190         $result = $sqlm->query("UPDATE config_misc SET Value='".$gm_online_count."' WHERE `Key`='GM_Online_Count'"); 
    2191         $result = $sqlm->query("UPDATE config_misc SET Value='".$hide_uptime."' WHERE `Key`='Hide_Uptime'"); 
    2192         $result = $sqlm->query("UPDATE config_misc SET Value='".$hide_max_players."' WHERE `Key`='Hide_Max_Players'"); 
    2193         $result = $sqlm->query("UPDATE config_misc SET Value='".$hide_avg_latency."' WHERE `Key`='Hide_Avg_Latency'"); 
    2194         $result = $sqlm->query("UPDATE config_misc SET Value='".$hide_server_mem."' WHERE `Key`='Hide_Server_Mem'"); 
    2195         $result = $sqlm->query("UPDATE config_misc SET Value='".$hide_plr_latency."' WHERE `Key`='Hide_Plr_Latency'"); 
    2196         $result = $sqlm->query("UPDATE config_misc SET Value='".$hide_coupons."' WHERE `Key`='Hide_Coupons_Main_Page'"); 
    2197         $result = $sqlm->query("UPDATE config_misc SET Value='".$backup_dir."' WHERE `Key`='Backup_Dir'"); 
    2198         $result = $sqlm->query("UPDATE config_misc SET Value='".$debug."' WHERE `Key`='Debug'"); 
    2199         $result = $sqlm->query("UPDATE config_misc SET Value='".$test_mode."' WHERE `Key`='Test_Mode'"); 
    2200         $result = $sqlm->query("UPDATE config_misc SET Value='".$multi_realm."' WHERE `Key`='Multi_Realm'"); 
    2201         $result = $sqlm->query("UPDATE config_misc SET Value='".$show_emblem."' WHERE `Key`='Show_Guild_Emblem'"); 
    2202         $result = $sqlm->query("UPDATE config_misc SET Value='".$language_locales_search_option."' WHERE `Key`='Language_Locales_Search_Option'"); 
    2203         $result = $sqlm->query("UPDATE config_misc SET Value='".$language_site_encoding."' WHERE `Key`='Language_Site_Encoding'"); 
    2204         $result = $sqlm->query("UPDATE config_misc SET Value='".$show_newest_user."' WHERE `Key`='Show_Newest_User'"); 
    2205         $result = $sqlm->query("UPDATE config_misc SET Value='".$send_on_email."' WHERE `Key`='Send_Mail_On_Email_Change'"); 
    2206         $result = $sqlm->query("UPDATE config_misc SET Value='".$index_show_realms."' WHERE `Key`='Index_Show_Realms'"); 
    2207  
    2208         if ( $delete_selected ) 
    2209         { 
    2210           $result = $sqlm->query("DELETE FROM custom_logos WHERE id='".$custom_logo."'"); 
    2211  
    2212           // if we have no more logos, then we don't want Use Custom Logos checked. 
    2213           $result = $sqlm->query("SELECT * FROM custom_logos"); 
    2214           $logo_count = $sqlm->num_rows($result); 
    2215  
    2216           if ( $logo_count == 0 ) 
    2217             $use_custom_logo = 0; 
    2218           else 
    2219           { 
    2220             // we don't want the Custom_Logo field set to the one we just deleted 
    2221             // so we'll set it to the first one on the list 
    2222             $temp = $sqlm->fetch_assoc($result); 
    2223             $custom_logo = $temp["id"]; 
    2224           } 
    2225         } 
    2226  
    2227         $result = $sqlm->query("UPDATE config_misc SET Value='".$use_custom_logo."' WHERE `Key`='Use_Custom_Logo'"); 
    2228         $result = $sqlm->query("UPDATE config_misc SET Value='".$custom_logo."' WHERE `Key`='Custom_Logo'"); 
    2229         $result = $sqlm->query("UPDATE config_misc SET Value='".$allow_caching."' WHERE `Key`='Allow_Logo_Caching'"); 
    2230  
    2231         redirect("admin.php?section=general&subsection=more"); 
    2232       } 
    2233       break; 
    2234     } 
    2235     case "upload_logo": 
    2236     { 
    2237       if ( !$sub_action ) 
    2238       { 
    2239         $upload_err = ( ( isset($_GET["up_err"]) ) ? $_GET["up_err"] : NULL ); 
    2240  
    2241         $output .= ' 
    2242         <form name="form" action="admin.php?section=general&subsection=upload_logo&subaction=upload" method="post" enctype="multipart/form-data"> 
    2243           <table class="simple" id="admin_more">'; 
    2244  
    2245         if ( isset($upload_err) ) 
    2246         { 
    2247           $msg = lang("admin", "uploaderror".abs($upload_err)); 
    2248  
    2249           $output .= ' 
    2250             <td colspan="2"> 
    2251               <span class="error" style="display: block; width: 100%; text-align: center;">'.$msg.'</span> 
    2252             </td>'; 
    2253         } 
    2254  
    2255         $output .= ' 
    2256             <tr> 
    2257               <td class="help"> 
    2258                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "uploadlogo_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "uploadlogo").'</a>: 
    2259               </td> 
    2260               <td> 
    2261                 <input type="file" name="image" /> 
    2262               </td> 
    2263             </tr> 
    2264           </table> 
    2265           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    2266           <input type="button" name="cancel" value="'.lang("admin", "cancel").'" onclick="window.location=\'admin.php?section=general&subsection=more\'"/> 
    2267         </form>'; 
    2268       } 
    2269       else 
    2270       { 
    2271         if ( !array_key_exists("image", $_FILES) ) 
    2272           redirect("admin.php?section=general&subsection=upload_logo&error=1"); 
    2273  
    2274         $image = $_FILES["image"]; 
    2275  
    2276         $err = checkValidUpload($image["error"]); 
    2277  
    2278         if ( $err < 0 ) 
    2279           redirect("admin.php?section=general&subsection=upload_logo&up_err=".$err); 
    2280         else 
    2281         { 
    2282           if ( !is_uploaded_file($image["tmp_name"]) ) 
    2283             redirect("admin.php?section=general&subsection=upload_logo&up_err=-8"); 
    2284  
    2285           $info = getImageSize($image["tmp_name"]); 
    2286  
    2287           if ( !$info ) 
    2288             redirect("admin.php?section=general&subsection=upload_logo&up_err=-9"); 
    2289  
    2290           $name = $sqlm->quote_smart($image["name"]); 
    2291           $mime = $sqlm->quote_smart($info["mime"]); 
    2292           $data = $sqlm->quote_smart(file_get_contents($image["tmp_name"])); 
    2293  
    2294           $upload_query = "INSERT INTO custom_logos (filename, mime_type, file_size, file_data) VALUES ('".$name."', '".$mime."', '".$image['size']."', '".$data."')"; 
    2295           $sqlm->query($upload_query); 
    2296  
    2297           redirect("admin.php?section=general&subsection=more"); 
    2298         } 
    2299       } 
    2300       break; 
    2301     } 
    2302     case "gmlevels": 
    2303     { 
    2304       if ( !$sub_action ) 
    2305       { 
    2306         $gm_lvls = $sqlm->query("SELECT * FROM config_gm_level_names"); 
    2307  
    2308         if ( !isset($_GET["edit_btn"]) ) 
    2309         { 
    2310           $output .= ' 
    2311         <center> 
    2312           <form name="form" action="admin.php" method="get"> 
    2313             <input type="hidden" name="section" value="general" /> 
    2314             <input type="hidden" name="subsection" value="gmlevels" /> 
    2315             <input type="hidden" name="edit_btn" value="edit" /> 
    2316             <table class="simple"> 
    2317               <tr> 
    2318                 <th>'.lang("admin", "edit").'</th> 
    2319                 <th>'.lang("admin", "remove").'</th> 
    2320                 <th>'.lang("admin", "seclvl").'</th> 
    2321                 <th>'.lang("admin", "fullname").'</th> 
    2322                 <th>'.lang("admin", "shortname").'</th> 
    2323               </tr>'; 
    2324  
    2325           $color = "#EEEEEE"; 
    2326  
    2327           while( $gm_lvl = $sqlm->fetch_assoc($gm_lvls) ) 
    2328           { 
    2329             $output .= ' 
    2330               <tr> 
    2331                 <td style="background-color:'.$color.'"> 
    2332                   <center> 
    2333                     <a href="admin.php?section=general&amp;subsection=gmlevels&amp;edit='.$gm_lvl["Index"].'&amp;edit_btn=Edit"> 
    2334                       <img src="img/edit.png" alt="" /> 
    2335                     </a> 
    2336                   </center> 
    2337                 </td> 
    2338                 <td style="background-color:'.$color.'"> 
    2339                   <center> 
    2340                     <a href="admin.php?section=general&amp;subsection=gmlevels&amp;delrow=deleterow&amp;edit='.$gm_lvl["Index"].'&amp;edit_btn=Edit"> 
    2341                       <img src="img/aff_cross.png" alt="" /> 
    2342                     </a> 
    2343                   </center> 
    2344                 </td> 
    2345                 <td style="background-color:'.$color.'">'.$gm_lvl["Security_Level"].'</td> 
    2346                 <td style="background-color:'.$color.'">'.$gm_lvl["Full_Name"].'</td> 
    2347                 <td style="background-color:'.$color.'">'.$gm_lvl["Short_Name"].'</td> 
    2348               </tr>'; 
    2349  
    2350             if ( $color == "#EEEEEE" ) 
    2351               $color = "#FFFFFF"; 
    2352             else 
    2353               $color = "#EEEEEE"; 
    2354           } 
    2355           $output .= ' 
    2356               <tr> 
    2357                 <td style="background-color:'.$color.'"> 
    2358                   <center> 
    2359                     <a href="admin.php?section=general&amp;subsection=gmlevels&amp;edit_btn=Edit&amp;addrow=addrow"> 
    2360                       <img src="img/add.png" alt="" /> 
    2361                     </a> 
    2362                   </center> 
    2363                 </td> 
    2364                 <td style="background-color:'.$color.'" colspan="4"> 
    2365                   <a href="admin.php?section=general&amp;subsection=gmlevels&amp;edit_btn=Edit&amp;addrow=addrow">'.lang("admin", "addrow").'</a> 
    2366                 </td> 
    2367               </tr>'; 
    2368  
    2369           $output .= ' 
    2370             </table> 
    2371             <!-- input type="checkbox" name="addrow">'.lang("admin", "addrow").' 
    2372             <input type="checkbox" name="delrow">'.lang("admin", "delrow").' 
    2373             <br /> 
    2374             <input type="submit" name="addrow" value="'.lang("admin", "addrow").'" --> 
    2375           </form> 
    2376         </center>'; 
    2377         } 
    2378         else 
    2379         { 
    2380           if ( !isset($_GET["edit"]) ) 
    2381             if ( !isset($_GET["addrow"]) ) 
    2382               redirect("admin.php?section=general&subsection=gmlevels"); 
    2383  
    2384           $del_row = ( ( isset($_GET["delrow"]) ) ? $_GET["delrow"] : "" ); 
    2385           $add_row = ( ( isset($_GET["addrow"]) ) ? $_GET["addrow"] : "" ); 
    2386           $edit_row = $sqlm->quote_smart($_GET["edit"]); 
    2387  
    2388           if ( $add_row ) 
    2389           { 
    2390             $add_result = $sqlm->query("INSERT INTO config_gm_level_names (Security_Level) VALUES ('-1')"); 
    2391             redirect("admin.php?section=general&subsection=gmlevels"); 
    2392           } 
    2393  
    2394           if ( $del_row ) 
    2395           { 
    2396             $del_result = $sqlm->query("DELETE FROM config_gm_level_names WHERE `Index`='".$edit_row."'"); 
    2397             redirect("admin.php?section=general&subsection=gmlevels"); 
    2398           } 
    2399  
    2400           $gm_level = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_gm_level_names WHERE `Index`='".$edit_row."'")); 
    2401           $output .= ' 
    2402         <center> 
    2403           <form name="form" action="admin.php" method="get"> 
    2404             <input type="hidden" name="section" value="general" /> 
    2405             <input type="hidden" name="subsection" value="gmlevels" /> 
    2406             <input type="hidden" name="subaction" value="savegms" /> 
    2407             <input type="hidden" name="index" value="'.$gm_level["Index"].'" /> 
    2408             <fieldset id="admin_gm_level"> 
    2409             <table> 
    2410               <tr> 
    2411                 <td class="help"> 
    2412                   <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "seclvl_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "seclvl").'</a>: 
    2413                 </td> 
    2414                 <td> 
    2415                   <input type="text" name="seclvl" value="'.$gm_level["Security_Level"].'" /> 
    2416                 </td> 
    2417               </tr> 
    2418               <tr> 
    2419                 <td>'.lang("admin", "fullname").': </td> 
    2420                 <td> 
    2421                   <input type="text" name="fullname" value="'.$gm_level["Full_Name"].'" /> 
    2422                 </td> 
    2423               </tr> 
    2424               <tr> 
    2425                 <td>'.lang("admin", "shortname").': </td> 
    2426                 <td> 
    2427                   <input type="text" name="shortname" value="'.$gm_level["Short_Name"].'" /> 
    2428                 </td> 
    2429               </tr> 
    2430             </table> 
    2431             </fieldset> 
    2432             <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    2433           </form> 
    2434         </center>'; 
    2435         } 
    2436       } 
    2437       else 
    2438       { 
    2439         $index = $sqlm->quote_smart($_GET["index"]); 
    2440         $sec_lvl = $sqlm->quote_smart($_GET["seclvl"]); 
    2441         $full_name = $sqlm->quote_smart($_GET["fullname"]); 
    2442         $short_name = $sqlm->quote_smart($_GET["shortname"]); 
    2443  
    2444         $result = $sqlm->query("UPDATE config_gm_level_names SET Security_Level='".$sec_lvl."', Full_Name='".$full_name."', Short_Name='".$short_name."' WHERE `Index`='".$index."'"); 
    2445         redirect("admin.php?section=general&subsection=gmlevels"); 
    2446       } 
    2447       break; 
    2448     } 
    2449   } 
    2450  
    2451   $output .= ' 
    2452       </div>'; 
    2453 } 
    2454  
    2455 function servers() 
    2456 { 
    2457   global $output, $corem_db, $get_icon_type, $get_timezone_type, $core; 
    2458  
    2459   // we need $core to be set 
    2460   if ( $core == 0 ) 
    2461     $core = detectcore(); 
    2462  
    2463   $sqlm = new SQL; 
    2464   $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); 
    2465  
    2466   $result = $sqlm->query("SELECT * FROM config_servers"); 
    2467  
    2468   $server_action = 0; 
    2469   if ( isset($_GET["editserver"]) ) 
    2470     $server_action = "edit"; 
    2471   if ( isset($_GET["delserver"]) ) 
    2472     $server_action = "del"; 
    2473   if ( isset($_GET["addserver"]) ) 
    2474     $server_action = "add"; 
    2475  
    2476   if ( !$server_action ) 
    2477   { 
    2478     $output .= ' 
    2479         <center> 
    2480           <span style="color:red">'.lang("admin", "server_warn").'</span> 
    2481           <form name="form" action="admin.php" method="get"> 
    2482             <input type="hidden" name="section" value="servers" /> 
    2483             <table class="simple" id="admin_servers"> 
    2484               <tr> 
    2485                 <th width="5%">'.lang("admin", "edit").'</th> 
    2486                 <th width="5%">'.lang("admin", "remove").'</th> 
    2487                 <th width="10%">'.lang("admin", "realm").'</th> 
    2488                 <th width="10%">'.lang("admin", "name").'</th> 
    2489                 <th width="20%">'.lang("admin", "hosti").'</th> 
    2490                 <th width="20%">'.lang("admin", "hostp").'</th> 
    2491                 <th width="1%">'.lang("admin", "port").'</th> 
    2492                 <th width="10%">'.lang("admin", "icon").'</th> 
    2493                 <th width="10%">'.lang("admin", "timezone").'</th> 
    2494                 <th width="10%">'.lang("admin", "bothfactions").'</th>'; 
    2495     if ( $core == 1 ) 
    2496       $output .= ' 
    2497                 <th width="40%">'.lang("admin", "statsxml").'</th>'; 
    2498     $output .= ' 
    2499               </tr>'; 
    2500     $color = "#EEEEEE"; 
    2501     while ( $server = $sqlm->fetch_assoc($result) ) 
    2502     { 
    2503       $output .= ' 
    2504               <tr> 
    2505                 <td style="background-color:'.$color.'"> 
    2506                   <center> 
    2507                     <a href="admin.php?section=servers&amp;sel_server='.$server["Index"].'&amp;editserver=editserver"> 
    2508                       <img src="img/edit.png" alt="" /> 
    2509                     </a> 
    2510                   </center> 
    2511                 </td> 
    2512                 <td style="background-color:'.$color.'"> 
    2513                   <center> 
    2514                     <a href="admin.php?section=servers&amp;sel_server='.$server["Index"].'&amp;delserver=deleteserver"> 
    2515                       <img src="img/aff_cross.png" alt="" /> 
    2516                     </a> 
    2517                   </center> 
    2518                 </td> 
    2519                 <td style="background-color:'.$color.'"> 
    2520                   <center>'.$server["Index"].'</center> 
    2521                 </td> 
    2522                 <td style="background-color:'.$color.'"> 
    2523                   <center>'.$server["Name"].'</center> 
    2524                 </td> 
    2525                 <td style="background-color:'.$color.'"> 
    2526                   <center>'.$server["Address"].'</center> 
    2527                 </td> 
    2528                 <td style="background-color:'.$color.'"> 
    2529                   <center>'.$server["External_Address"].'</center> 
    2530                 </td> 
    2531                 <td style="background-color:'.$color.'"> 
    2532                   <center>'.$server["Port"].'</center> 
    2533                 </td>'; 
    2534  
    2535       $icon = $get_icon_type[$server["Icon"]]; 
    2536       $timezone = $get_timezone_type[$server["Timezone"]]; 
    2537       $output .= ' 
    2538                 <td style="background-color:'.$color.'"> 
    2539                   <center>'.lang("realm", $icon[1]).'</center> 
    2540                 </td> 
    2541                 <td style="background-color:'.$color.'"> 
    2542                   <center>'.lang("realm", $timezone[1]).'</center> 
    2543                 </td> 
    2544                 <td style="background-color:'.$color.'"> 
    2545                   <center>'.( ( $server["Both_Factions"] ) ? lang("global", "yes_low") : lang("global", "no_low") ).'</center> 
    2546                 </td>'; 
    2547       if ( $core == 1 ) 
    2548         $output .= ' 
    2549                 <td style="background-color:'.$color.'"> 
    2550                   <center>'.$server["Stats_XML"].'</center> 
    2551                 </td>'; 
    2552       $output .= ' 
    2553               </tr>'; 
    2554  
    2555       $color = ( ( $color == "#EEEEEE" ) ? "#FFFFFF" : "#EEEEEE" ); 
    2556     } 
    2557     $output .= ' 
    2558               <tr> 
    2559                 <td style="background-color:'.$color.'"> 
    2560                   <a href="admin.php?section=servers&amp;addserver=addserver"> 
    2561                     <img src="img/add.png" alt="" /> 
    2562                   </a> 
    2563                 </td> 
    2564                 <td style="background-color:'.$color.'" colspan="'.( ( $core == 1 ) ? '10' : '9' ).'"> 
    2565                   <a href="admin.php?section=servers&amp;addserver=addserver">'.lang("admin", "addserver").'</a> 
    2566                 </td> 
    2567               </tr> 
    2568             </table> 
    2569             <!-- input type="submit" name="editserver" value="'.lang("admin", "editserver").'"> 
    2570             <input type="submit" name="addserver" value="'.lang("admin", "addserver").'"> 
    2571             <input type="submit" name="delserver" value="'.lang("admin", "delserver").'" --> 
    2572           </form> 
    2573         </center>'; 
    2574   } 
    2575   else 
    2576   { 
    2577     if ( $server_action == "edit" ) 
    2578     { 
    2579       $server_id = $sqlm->quote_smart($_GET["sel_server"]); 
    2580       if ( is_numeric($server_id) ) 
    2581       { 
    2582         $server = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_servers WHERE `Index`='".$server_id."'")); 
    2583         $output .= ' 
    2584         <center> 
    2585           <form name="form" action="admin.php" method="get"> 
    2586             <fieldset id="admin_edit_server"> 
    2587               <input type="hidden" name="section" value="servers" /> 
    2588               <input type="hidden" name="action" value="saveserver" /> 
    2589               <input type="hidden" name="index" value="'.$server["Index"].'" /> 
    2590               <table> 
    2591                 <tr> 
    2592                   <td width="45%">'.lang("admin", "realm").': </td> 
    2593                   <td> 
    2594                     <input type="text" name="new_index" value="'.$server["Index"].'" /> 
    2595                   </td> 
    2596                 </tr> 
    2597                 <tr> 
    2598                   <td width="45%">'.lang("admin", "name").': </td> 
    2599                   <td> 
    2600                     <input type="text" name="server_name" value="'.$server["Name"].'" /> 
    2601                   </td> 
    2602                 </tr> 
    2603                 <tr> 
    2604                   <td width="45%" class="help"> 
    2605                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "hosti_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "hosti").'</a>: 
    2606                   </td> 
    2607                   <td> 
    2608                     <input type="text" name="server_hosti" value="'.$server["Address"].'" /> 
    2609                   </td> 
    2610                 </tr> 
    2611                 <tr> 
    2612                   <td width="45%" class="help"> 
    2613                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "hostp_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "hostp").'</a>: 
    2614                   </td> 
    2615                   <td> 
    2616                     <input type="text" name="server_hostp" value="'.$server["External_Address"].'" /> 
    2617                   </td> 
    2618                 </tr> 
    2619                 <tr> 
    2620                   <td>'.lang("admin", "port").': </td> 
    2621                   <td> 
    2622                     <input type="text" name="server_port" value="'.$server["Port"].'" /> 
    2623                   </td> 
    2624                 </tr>'; 
    2625         if ( $core != 1 ) 
    2626           $output .= ' 
    2627                 <tr> 
    2628                   <td>'.lang("admin", "telnetport_tip").':</td> 
    2629                   <td> 
    2630                     <input type="text" name="server_telnet_port" value="'.$server["Telnet_Port"].'" /> 
    2631                   </td> 
    2632                 </tr> 
    2633                 <tr> 
    2634                   <td>'.lang("admin", "telnetuser_tip").':</td> 
    2635                   <td> 
    2636                     <input type="text" name="server_telnet_user" value="'.$server["Telnet_User"].'" /> 
    2637                   </td> 
    2638                 </tr> 
    2639                 <tr> 
    2640                   <td>'.lang("admin", "telnetpass_tip").':</td> 
    2641                   <td> 
    2642                     <input type="text" name="server_telnet_pass" value="'.$server["Telnet_Pass"].'" /> 
    2643                   </td> 
    2644                 </tr>'; 
    2645         $output .= ' 
    2646                 <tr> 
    2647                   <td>'.lang("admin", "icon").': </td> 
    2648                   <td> 
    2649                     <select name="server_type">'; 
    2650         foreach ( $get_icon_type as $type ) 
    2651         { 
    2652           $output .= ' 
    2653                       <option value="'.$type[0].'" '.( ( $server["Icon"] == $type[0] ) ? 'selected="selected"' : '' ).'>'.lang("realm", $type[1]).'</option>'; 
    2654         } 
    2655         $output .= ' 
    2656                     </select> 
    2657                   </td> 
    2658                 </tr> 
    2659                 <tr> 
    2660                   <td>'.lang("admin", "color").': </td> 
    2661                   <td> 
    2662                     <input type="text" name="server_color" value="'.$server["Color"].'" /> 
    2663                   </td> 
    2664                 </tr> 
    2665                 <tr> 
    2666                   <td>'.lang("admin", "timezone").': </td> 
    2667                   <td> 
    2668                     <select name="server_timezone">'; 
    2669         foreach ( $get_timezone_type as $zone ) 
    2670         { 
    2671           $output .= ' 
    2672                       <option value="'.$zone[0].'" '.( ( $server["Timezone"] == $zone[0] ) ? 'selected="selected"' : '' ).'>'.lang("realm", $zone[1]).'</option>'; 
    2673         } 
    2674         $output .= ' 
    2675                     </select> 
    2676                   </td> 
    2677                 </tr> 
    2678                 <tr> 
    2679                   <td class="help"> 
    2680                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "bothfactions_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "bothfactions").'</a>: 
    2681                   </td> 
    2682                   <td> 
    2683                     <input type="checkbox" name="server_both" value="1" '.( ( $server["Both_Factions"] ) ? 'checked="checked"' : '' ).' /> 
    2684                   </td> 
    2685                 </tr>'; 
    2686         if ( $core == 1 ) 
    2687           $output .= ' 
    2688                 <tr> 
    2689                   <td class="help"> 
    2690                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "statsxml_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "statsxml").'</a>: 
    2691                   </td> 
    2692                   <td> 
    2693                     <input type="text" name="server_stats" value="'.$server["Stats_XML"].'" /> 
    2694                   </td> 
    2695                 </tr>'; 
    2696         $output .= ' 
    2697               </table> 
    2698             </fieldset> 
    2699             <input type="submit" name="saveserver" value="'.lang("admin", "save").'" /> 
    2700           </form> 
    2701         </center>'; 
    2702       } 
    2703       else 
    2704         redirect("admin.php?section=servers&error=1"); 
    2705     } 
    2706     elseif ( $server_action == "del" ) 
    2707     { 
    2708       $server_id = $sqlm->quote_smart($_GET["sel_server"]); 
    2709       if ( is_numeric($server_id) ) 
    2710       { 
    2711         $result = $sqlm->query("DELETE FROM config_servers WHERE `Index`='".$server_id."'"); 
    2712         redirect("admin.php?section=servers"); 
    2713       } 
    2714       else 
    2715         redirect("admin.php?section=servers&error=1"); 
    2716     } 
    2717     else 
    2718     { 
    2719       switch ( $core ) 
    2720       { 
    2721         case 1: 
    2722         { 
    2723           $name = "ArcEmu"; 
    2724           $port = "8129"; 
    2725           break; 
    2726         } 
    2727         case 2: 
    2728         { 
    2729           $name = "MaNGOS"; 
    2730           $port = "8085"; 
    2731           break; 
    2732         } 
    2733         case 3: 
    2734         { 
    2735           $name = "Trinity"; 
    2736           $port = "8085"; 
    2737           break; 
    2738         } 
    2739       } 
    2740  
    2741       // get highest server index 
    2742       $i_query = "SELECT IFNULL(MAX(`Index`), 0) AS MaxID FROM config_servers"; 
    2743       $i_result = $sqlm->query($i_query); 
    2744       $i_result = $sqlm->fetch_assoc($i_result); 
    2745       $max_index = $i_result["MaxID"]; 
    2746  
    2747       $result = $sqlm->query("INSERT INTO config_servers (`Index`, Port, Name, Both_Factions, Telnet_Port, Address) VALUES ('".($max_index+1)."', '".$port."', '".$name."', 1, 0, '127.0.0.1')"); 
    2748  
    2749       redirect("admin.php?section=servers"); 
    2750     } 
    2751   } 
    2752 } 
    2753  
    2754 function saveserver() 
    2755 { 
    2756   global $corem_db; 
    2757  
    2758   $sqlm = new SQL; 
    2759   $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); 
    2760  
    2761   $server_id = $sqlm->quote_smart($_GET["index"]); 
    2762   $new_server_id = $sqlm->quote_smart($_GET["new_index"]); 
    2763   $server_name = $sqlm->quote_smart($_GET["server_name"]); 
    2764   $server_hosti = $sqlm->quote_smart($_GET["server_hosti"]); 
    2765   $server_hostp = $sqlm->quote_smart($_GET["server_hostp"]); 
    2766   $server_port = $sqlm->quote_smart($_GET["server_port"]); 
    2767   $server_telnet_port = ( ( isset($_GET["server_telnet_port"]) ) ? $sqlm->quote_smart($_GET["server_telnet_port"]) : NULL ); 
    2768   $server_telnet_user = ( ( isset($_GET["server_telnet_user"]) ) ? strtoupper($sqlm->quote_smart($_GET["server_telnet_user"])) : NULL ); 
    2769   $server_telnet_pass = ( ( isset($_GET["server_telnet_pass"]) ) ? $sqlm->quote_smart($_GET["server_telnet_pass"]) : NULL ); 
    2770   $server_type = $sqlm->quote_smart($_GET["server_type"]); 
    2771   $server_color = $sqlm->quote_smart($_GET["server_color"]); 
    2772   $server_timezone = $sqlm->quote_smart($_GET["server_timezone"]); 
    2773   $server_factions = ( ( isset($_GET["server_both"]) ) ? 1 : 0 ); 
    2774   $server_stats = ( ( isset($_GET["server_stats"]) ) ? $sqlm->quote_smart($_GET["server_stats"]) : NULL ); 
    2775  
    2776   $result = $sqlm->query("UPDATE config_servers SET `Index`='".$new_server_id."', Address='".$server_hosti."', Port='".$server_port."', Telnet_Port='".$server_telnet_port."', Telnet_User='".$server_telnet_user."', Telnet_Pass='".$server_telnet_pass."', Both_Factions='".$server_factions."', Stats_XML='".$server_stats."', Name='".$server_name."', External_Address='".$server_hostp."', Port='".$server_port."', Icon='".$server_type."', Color='".$server_color."', Timezone='".$server_timezone."' WHERE `Index`='".$server_id."'"); 
    2777   redirect("admin.php?section=servers"); 
    2778 } 
    2779  
    2780 function menus() 
    2781 { 
    2782   global $output, $corem_db; 
    2783  
    2784   $sqlm = new SQL; 
    2785   $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); 
    2786  
    2787   $menu_action = "start"; 
    2788   if ( isset($_GET["editmenu"]) ) 
    2789     $menu_action = "edit"; 
    2790   if ( isset($_GET["delmenu"]) ) 
    2791     $menu_action = "delmenu"; 
    2792   if ( isset($_GET["addmenu"]) ) 
    2793     $menu_action = "addmenu"; 
    2794   if ( isset($_GET["editmenu_item"]) ) 
    2795     $menu_action = "edititem"; 
    2796   if ( isset($_GET["delmenu_item"]) ) 
    2797     $menu_action = "delitem"; 
    2798   if ( isset($_GET["addmenu_item"]) ) 
    2799     $menu_action = "additem"; 
    2800   if ( isset($_GET["savemenu"]) ) 
    2801     $menu_action = "savemenu"; 
    2802  
    2803   switch ( $menu_action ) 
    2804   { 
    2805     case "start"; 
    2806     { 
    2807       $top_menus = $sqlm->query("SELECT * FROM config_top_menus"); 
    2808       $output .= ' 
    2809         <center> 
    2810           <form name="form" action="admin.php" method="get"> 
    2811             <input type="hidden" name="section" value="menus" /> 
    2812             <table class="simple" id="admin_top_menus"> 
    2813               <tr> 
    2814                 <th>'.lang("admin", "edit").'</th> 
    2815                 <th>'.lang("admin", "remove").'</th> 
    2816                 <th>'.lang("admin", "internalname").'</th> 
    2817                 <th>'.lang("admin", "action").'</th> 
    2818                 <th>'.lang("admin", "enabled").'</th> 
    2819               </tr>'; 
    2820       $color = "#EEEEEE"; 
    2821       while ( $top_menu = $sqlm->fetch_assoc($top_menus) ) 
    2822       { 
    2823         $output .= ' 
    2824               <tr> 
    2825                 <td style="background-color:'.$color.'"> 
    2826                   <center> 
    2827                     <a href="admin.php?section=menus&amp;top_menu='.$top_menu["Index"].'&amp;editmenu=editmenu"> 
    2828                       <img src="img/edit.png" alt="" /> 
    2829                     </a> 
    2830                   </center> 
    2831                 </td> 
    2832                 <td style="background-color:'.$color.'"> 
    2833                   <center> 
    2834                     <a href="admin.php?section=menus&amp;top_menu='.$top_menu["Index"].'&amp;delmenu=delmenu"> 
    2835                       <img src="img/aff_cross.png" alt="" /> 
    2836                     </a> 
    2837                   </center> 
    2838                 </td> 
    2839                 <td style="background-color:'.$color.'"> 
    2840                   <center>'.$top_menu["Name"].'</center> 
    2841                 </td> 
    2842                 <td style="background-color:'.$color.'"> 
    2843                   <center>'.$top_menu["Action"].'</center> 
    2844                 </td> 
    2845                 <td style="background-color:'.$color.'"> 
    2846                   <center><img src="img/'.( ( $top_menu["Enabled"] ) ? 'up' : 'down' ).'.gif" alt="" /></center> 
    2847                 </td> 
    2848               </tr>'; 
    2849         $color = ( ( $color == "#EEEEEE" ) ? "#FFFFFF" : "#EEEEEE" ); 
    2850       } 
    2851       $output .= ' 
    2852               <tr> 
    2853                 <td style="background-color:'.$color.'"> 
    2854                   <center> 
    2855                     <a href="admin.php?section=menus&amp;addmenu=addmenu"> 
    2856                       <img src="img/add.png" alt="" /> 
    2857                     </a> 
    2858                   </center> 
    2859                 </td> 
    2860                 <td style="background-color:'.$color.'" colspan="4"> 
    2861                   <a href="admin.php?section=menus&amp;addmenu=addmenu">'.lang("admin", "addmenu").'</a> 
    2862                 </td> 
    2863               </tr> 
    2864             </table> 
    2865             <!-- input type="submit" name="editmenu" value="'.lang("admin", "editmenu").'"> 
    2866             <input type="submit" name="addmenu" value="'.lang("admin", "addmenu").'"> 
    2867             <input type="submit" name="delmenu" value="'.lang("admin", "delmenu").'" --> 
    2868           </form> 
    2869         </center>'; 
    2870       break; 
    2871     } 
    2872     case "edit": 
    2873     { 
    2874       $top_menu = $sqlm->quote_smart($_GET["top_menu"]); 
    2875       $top = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_top_menus WHERE `Index`='".$top_menu."'")); 
    2876       $output .= ' 
    2877         <center> 
    2878           <form name="form" action="admin.php" method="get"> 
    2879             <input type="hidden" name="section" value="menus" /> 
    2880             <input type="hidden" name="top_index" value="'.$top_menu.'" />'; 
    2881  
    2882       if ( ( $top["Name"] == "main" ) || ( $top["Name"] == "invisible" ) ) 
    2883         $output .= ' 
    2884             <input type="hidden" name="enabled" value="1" />'; 
    2885  
    2886       $output .= ' 
    2887             <table class="simple" id="admin_edit_top_menu_nameaction"> 
    2888               <tr> 
    2889                 <th colspan="2">'.lang("admin", "top_menu").'</th> 
    2890               </tr> 
    2891               <tr> 
    2892                 <td>'.lang("admin", "internalname2").': </td> 
    2893                 <td> 
    2894                   <input type="text" name="top_name" value="'.$top["Name"].'" class="admin_edit_top_menu_action" /> 
    2895                 </td> 
    2896               </tr> 
    2897               <tr> 
    2898                 <td>'.lang("admin", "action").': </td> 
    2899                 <td> 
    2900                   <textarea name="menu_action" class="admin_edit_top_menu_action" rows="2" cols="32">'.$top["Action"].'</textarea> 
    2901                 </td> 
    2902               </tr> 
    2903               <tr> 
    2904                 <td>'.lang("admin", "enabled").': </td> 
    2905                 <td>'; 
    2906  
    2907       if ( ( $top["Name"] != "main" ) && ( $top["Name"] != "invisible" ) ) 
    2908         $output .= ' 
    2909                   <input type="checkbox" name="enabled"'.( ( $top["Enabled"] ) ? ' checked="checked"' : '' ).' />'; 
    2910       else 
    2911         $output .= '<img src="img/lock.png" alt="" /> ('.lang("admin", "nodisable").')'; 
    2912  
    2913       $output .= ' 
    2914                 </td> 
    2915               </tr> 
    2916             </table> 
    2917             <table class="simple" id="admin_edit_top_menu_submenus"> 
    2918               <tr> 
    2919                 <th>'.lang("admin", "edit").'</th> 
    2920                 <th>'.lang("admin", "remove").'</th> 
    2921                 <th>'.lang("admin", "order").'</th> 
    2922                 <th>'.lang("admin", "internalname").'</th> 
    2923                 <th>'.lang("admin", "action").'</th> 
    2924                 <th>'.lang("admin", "view").'</th> 
    2925                 <th>'.lang("admin", "insert").'</th> 
    2926                 <th>'.lang("admin", "update").'</th> 
    2927                 <th>'.lang("admin", "delete").'</th> 
    2928                 <th>'.lang("admin", "enabled").'</th> 
    2929               </tr>'; 
    2930       $menus = $sqlm->query("SELECT * FROM config_menus WHERE Menu='".$top_menu."'"); 
    2931       $color = "#EEEEEE"; 
    2932       while ( $menu = $sqlm->fetch_assoc($menus) ) 
    2933       { 
    2934         $output .= ' 
    2935               <tr> 
    2936                 <td style="background-color:'.$color.'"> 
    2937                   <center> 
    2938                     <a href="admin.php?section=menus&amp;top_index='.$top_menu.'&amp;menu_item='.$menu["Index"].'&amp;editmenu_item=editmenuitem"> 
    2939                       <img src="img/edit.png" alt="" /> 
    2940                     </a> 
    2941                   </center> 
    2942                 </td> 
    2943                 <td style="background-color:'.$color.'"> 
    2944                   <center> 
    2945                     <a href="admin.php?section=menus&amp;top_index='.$top_menu.'&amp;menu_item='.$menu["Index"].'&amp;delmenu_item=delmenuitem"> 
    2946                       <img src="img/aff_cross.png" alt="" /> 
    2947                     </a> 
    2948                   </center> 
    2949                 </td> 
    2950                 <td style="background-color:'.$color.'"> 
    2951                   <center>'.$menu["Order"].'</center> 
    2952                 </td> 
    2953                 <td width="15%" style="background-color:'.$color.'"> 
    2954                   <center>'.$menu["Name"].'</center> 
    2955                 </td> 
    2956                 <td width="25%" style="background-color:'.$color.'"> 
    2957                   <center>'.$menu["Action"].'</center> 
    2958                 </td> 
    2959                 <td style="background-color:'.$color.'"> 
    2960                   <center>'.sec_level_name($menu["View"]).' ('.$menu["View"].')'.'</center> 
    2961                 </td> 
    2962                 <td style="background-color:'.$color.'"> 
    2963                   <center>'.sec_level_name($menu["Insert"]).' ('.$menu["Insert"].')'.'</center> 
    2964                 </td> 
    2965                 <td style="background-color:'.$color.'"> 
    2966                   <center>'.sec_level_name($menu["Update"]).' ('.$menu["Update"].')'.'</center> 
    2967                 </td> 
    2968                 <td style="background-color:'.$color.'"> 
    2969                   <center>'.sec_level_name($menu["Delete"]).' ('.$menu["Delete"].')'.'</center> 
    2970                 </td> 
    2971                 <td style="background-color:'.$color.'"> 
    2972                   <center> 
    2973                     <img src="img/'.( ( $menu["Enabled"] ) ? 'up' : 'down' ).'.gif" alt="" /> 
    2974                   </center> 
    2975                 </td> 
    2976               </tr>'; 
    2977         $color = ( ( $color == "#EEEEEE" ) ? "#FFFFFF" : "#EEEEEE" ); 
    2978       } 
    2979       $output .= ' 
    2980               <tr> 
    2981                 <td style="background-color:'.$color.'"> 
    2982                   <center> 
    2983                     <a href="admin.php?section=menus&amp;top_index='.$top_menu.'&amp;addmenu_item=addmenuitem"> 
    2984                       <img src="img/add.png" alt="" /> 
    2985                     </a> 
    2986                   </center> 
    2987                 </td> 
    2988                 <td style="background-color:'.$color.'" colspan="8"> 
    2989                   <a href="admin.php?section=menus&amp;top_index='.$top_menu.'&amp;addmenu_item=addmenuitem">'.lang("admin", "addmenu_item").'</a> 
    2990                 </td> 
    2991               </tr> 
    2992             </table> 
    2993             <!-- input type="submit" name="editmenu_item" value="'.lang("admin", "editmenu_item").'"> 
    2994             <input type="submit" name="addmenu_item" value="'.lang("admin", "addmenu_item").'" --> 
    2995             <input type="submit" name="savemenu" value="'.lang("admin", "save").'" /> 
    2996             <!-- input type="submit" name="delmenu_item" value="'.lang("admin", "delmenu_item").'" --> 
    2997           </form> 
    2998         </center>'; 
    2999       break; 
    3000     } 
    3001     case "edititem": 
    3002     { 
    3003       $menu_item = $sqlm->quote_smart($_GET["menu_item"]); 
    3004       $menu = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_menus WHERE `Index`='".$menu_item."'")); 
    3005       $sec_list = sec_level_list(); 
    3006       $top_menu_query = "SELECT * FROM config_top_menus"; 
    3007       $top_menu_result = $sqlm->query($top_menu_query); 
    3008  
    3009       $output .= ' 
    3010         <center> 
    3011           <form name="form" action="admin.php" method="get"> 
    3012             <input type="hidden" name="section" value="menus" /> 
    3013             <input type="hidden" name="action" value="savemenu" /> 
    3014             <input type="hidden" name="menu_item" value="'.$menu_item.'" /> 
    3015             <fieldset id="admin_edit_menu_field"> 
    3016               <table class="help" id="admin_edit_menu"> 
    3017                 <tr> 
    3018                   <td> 
    3019                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "menu_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "menu").'</a>: 
    3020                   </td> 
    3021                   <td> 
    3022                     <select name="menu">'; 
    3023                     //<input type="text" name="menu" value="'.$menu["Menu"].'" id="admin_edit_menu_fields"> 
    3024       while ( $row = $sqlm->fetch_assoc($top_menu_result) ) 
    3025       { 
    3026         $output .= ' 
    3027                       <option value="'.$row["Index"].'" '.( ( $row["Index"] == $menu["Menu"] ) ? 'selected="selected"' : '').' class="admin_edit_menu_fields">'.$row["Name"].'</option>'; 
    3028       } 
    3029       $output .= ' 
    3030                     </select> 
    3031                   </td> 
    3032                 </tr> 
    3033                 <tr> 
    3034                   <td> 
    3035                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "order_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "order").'</a>: 
    3036                   </td> 
    3037                   <td> 
    3038                     <input type="text" name="order" value="'.$menu["Order"].'" class="admin_edit_menu_fields" /> 
    3039                   </td> 
    3040                 </tr> 
    3041                 <tr> 
    3042                   <td> 
    3043                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "menuname_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "internalname2").'</a>: 
    3044                   </td> 
    3045                   <td> 
    3046                     <input type="text" name="name" value="'.$menu["Name"].'" class="admin_edit_menu_fields" /> 
    3047                   </td> 
    3048                 </tr> 
    3049                 <tr> 
    3050                   <td> 
    3051                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "action_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "action").'</a>: 
    3052                   </td> 
    3053                   <td> 
    3054                     <textarea name="menu_action" style="width:260px" rows="2" cols="32">'.$menu["Action"].'</textarea> 
    3055                   </td> 
    3056                 </tr> 
    3057                 <tr> 
    3058                   <td> 
    3059                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "view_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "view").'</a>: 
    3060                   </td> 
    3061                   <td> 
    3062                     <select name="view">'; 
    3063       foreach ( $sec_list as $row ) 
    3064       { 
    3065         $output .= ' 
    3066                       <option value="'.$row["Sec"].'" '.( ( $row["Sec"] == $menu["View"] ) ? 'selected="selected"' : '' ).'>'.$row["Name"].' ('.$row["Sec"].')</option>'; 
    3067       } 
    3068       $output .= ' 
    3069                     </select> 
    3070                   </td> 
    3071                 </tr> 
    3072                 <tr> 
    3073                   <td> 
    3074                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "insert").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "insert").'</a>: 
    3075                   </td> 
    3076                   <td> 
    3077                     <select name="insert">'; 
    3078       foreach ( $sec_list as $row ) 
    3079       { 
    3080         $output .= ' 
    3081                       <option value="'.$row["Sec"].'" '.( ( $row["Sec"] == $menu["Insert"] ) ? 'selected="selected"' : '' ).'>'.$row["Name"].' ('.$row["Sec"].')</option>'; 
    3082       } 
    3083       $output .= ' 
    3084                     </select> 
    3085                   </td> 
    3086                 </tr> 
    3087                 <tr> 
    3088                   <td> 
    3089                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "update_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "update").'</a>: 
    3090                   </td> 
    3091                   <td> 
    3092                     <select name="update">'; 
    3093       foreach ( $sec_list as $row ) 
    3094       { 
    3095         $output .= ' 
    3096                       <option value="'.$row["Sec"].'" '.( ( $row["Sec"] == $menu["Update"] ) ? 'selected="selected"' : '' ).'>'.$row["Name"].' ('.$row["Sec"].')</option>'; 
    3097       } 
    3098       $output .= ' 
    3099                     </select> 
    3100                   </td> 
    3101                 </tr> 
    3102                 <tr> 
    3103                   <td> 
    3104                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "delete").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "delete").'</a>: 
    3105                   </td> 
    3106                   <td> 
    3107                     <select name="delete">'; 
    3108       foreach ( $sec_list as $row ) 
    3109       { 
    3110         $output .= ' 
    3111                       <option value="'.$row["Sec"].'" '.( ( $row["Sec"] == $menu["Delete"] ) ? 'selected="selected"' : '' ).'>'.$row["Name"].' ('.$row["Sec"].')</option>'; 
    3112       } 
    3113       $output .= ' 
    3114                     </select> 
    3115                   </td> 
    3116                 </tr>'; 
    3117       if ( $menu_item <> 8 ) 
    3118         $output .= ' 
    3119                 <tr> 
    3120                   <td> 
    3121                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "enabled_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "enabled").'</a>: 
    3122                   </td> 
    3123                   <td> 
    3124                     <input type="checkbox" name="enabled" '.( ( $menu["Enabled"] ) ? 'checked="checked"' : '' ).' /> 
    3125                   </td> 
    3126                 </tr>'; 
    3127       else 
    3128         $output .= ' 
    3129                 <tr> 
    3130                   <td> 
    3131                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "enabled_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "enabled").'</a>: 
    3132                   </td> 
    3133                   <td> 
    3134                     <input type="checkbox" name="enabled" '.( ( $menu["Enabled"] ) ? 'checked="checked' : '' ).' disabled="disabled" /> 
    3135                   </td> 
    3136                 </tr>'; 
    3137       $output .= ' 
    3138               </table> 
    3139             </fieldset> 
    3140             <input type="submit" name="save_menu_item" value="'.lang("admin", "save").'" /> 
    3141           </form> 
    3142         </center>'; 
    3143       break; 
    3144     } 
    3145     case "addmenu": 
    3146     { 
    3147       $max = $sqlm->fetch_assoc($sqlm->query("SELECT MAX(`Index`) FROM config_top_menus")); 
    3148       $max = $max["MAX(`Index`)"] + 1; 
    3149       $result = $sqlm->query("INSERT INTO config_top_menus (`Index`, Action, Name, Enabled) VALUES ('".$max."', '', '', '0')"); 
    3150       redirect("admin.php?section=menus"); 
    3151       break; 
    3152     } 
    3153     case "delmenu": 
    3154     { 
    3155       $top_menu = $sqlm->quote_smart($_GET["top_menu"]); 
    3156       if ( is_numeric($top_menu) ) 
    3157       { 
    3158         $result = $sqlm->query("DELETE FROM config_top_menus WHERE `Index`='".$top_menu."'"); 
    3159         redirect("admin.php?section=menus"); 
    3160       } 
    3161       else 
    3162         redirect("admin.php?section=menus&error=1"); 
    3163       break; 
    3164     } 
    3165     case "savemenu": 
    3166     { 
    3167       $top_index = $sqlm->quote_smart($_GET["top_index"]); 
    3168       $top_name = $sqlm->quote_smart($_GET["top_name"]); 
    3169       $top_action = $sqlm->quote_smart($_GET["menu_action"]); 
    3170       $enabled = ( ( isset($_GET["enabled"]) ) ? 1 : 0 ); 
    3171       $result = $sqlm->query("UPDATE config_top_menus SET Name='".$top_name."', Action='".$top_action."', Enabled='".$enabled."' WHERE `Index`='".$top_index."'"); 
    3172       redirect("admin.php?section=menus"); 
    3173       break; 
    3174     } 
    3175     case "additem": 
    3176     { 
    3177       $top_index = $sqlm->quote_smart($_GET["top_index"]); 
    3178       $result = $sqlm->query("INSERT INTO config_menus (Menu, Action, Name) VALUES ('".$top_index."', '','')"); 
    3179       redirect("admin.php?section=menus&top_menu=".$top_index."&editmenu=editmenu"); 
    3180       break; 
    3181     } 
    3182     case "delitem": 
    3183     { 
    3184       $menu_item = $sqlm->quote_smart($_GET["menu_item"]); 
    3185       $top_index = $sqlm->quote_smart($_GET["top_index"]); 
    3186       if ( is_numeric($menu_item) ) 
    3187       { 
    3188         $result = $sqlm->query("DELETE FROM config_menus WHERE `Index`='".$menu_item."'"); 
    3189         redirect("admin.php?section=menus&top_menu=".$top_index."&editmenu=editmenu"); 
    3190       } 
    3191       else 
    3192         redirect("admin.php?section=menus&error=1"); 
    3193       break; 
    3194     } 
    3195     default: 
    3196       redirect("admin.php?section=menus&error=1"); 
    3197       break; 
    3198   } 
    3199 } 
    3200  
    3201 function savemenu() 
    3202 { 
    3203   global $corem_db; 
    3204  
    3205   $sqlm = new SQL; 
    3206   $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); 
    3207  
    3208   $menu_item = $sqlm->quote_smart($_GET["menu_item"]); 
    3209   $menu = $sqlm->quote_smart($_GET["menu"]); 
    3210   $order = $sqlm->quote_smart($_GET["order"]); 
    3211   $name = $sqlm->quote_smart($_GET["name"]); 
    3212   $action = $sqlm->quote_smart($_GET["menu_action"]); 
    3213   $view = $sqlm->quote_smart($_GET["view"]); 
    3214   $insert = $sqlm->quote_smart($_GET["insert"]); 
    3215   $update = $sqlm->quote_smart($_GET["update"]); 
    3216   $delete = $sqlm->quote_smart($_GET["delete"]); 
    3217   $enabled = ( ( isset($_GET["enabled"]) ) ? 1 : 0 ); 
    3218  
    3219   if ( empty($order) || !isset($order) ) 
    3220     redirect("admin.php?section=menus&error=1"); 
    3221    
    3222  
    3223   $result = $sqlm->query("SELECT * FROM config_menus WHERE `Index`='".$menu_item."'"); 
    3224   if ( $sqlm->num_rows($result) ) 
    3225     $result = $sqlm->query("UPDATE config_menus SET Menu='".$menu."', `Order`='".$order."', Name='".$name."', Action='".$action."', View='".$view."', `Insert`='".$insert."', `Update`='".$update."', `Delete`='".$delete."', Enabled='".$enabled."' WHERE `Index`='".$menu_item."'"); 
    3226   else 
    3227     $result = $sqlm->query("INSERT INTO config_menus (Menu, `Order`, Name, Action, View, Insert, Update, Delete, Enabled) VALUES ('".$menu."', '".$order."', '".$name."', '".$action."', '".$view."', '".$insert."', '".$update."', '".$delete."', '".$enabled."')"); 
    3228  
    3229   redirect("admin.php?section=menus"); 
    3230 } 
    3231  
    3232 function forum() 
    3233 { 
    3234   global $output, $corem_db; 
    3235  
    3236   $sqlm = new SQL; 
    3237   $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); 
    3238  
    3239   $forum_action = "start"; 
    3240   if ( isset($_GET["editforum"]) ) 
    3241     $forum_action = "edit"; 
    3242   if ( isset($_GET["delforum"]) ) 
    3243     $forum_action = "delforum"; 
    3244   if ( isset($_GET["addforum"]) ) 
    3245     $forum_action = "addforum"; 
    3246   if ( isset($_GET["editforum_item"]) ) 
    3247     $forum_action = "edititem"; 
    3248   if ( isset($_GET["delforum_item"]) ) 
    3249     $forum_action = "delitem"; 
    3250   if ( isset($_GET["addforum_item"]) ) 
    3251     $forum_action = "additem"; 
    3252   if ( isset($_GET["saveforum"]) ) 
    3253     $forum_action = "saveforum"; 
    3254  
    3255   switch ( $forum_action ) 
    3256   { 
    3257     case "start"; 
    3258     { 
    3259       $cats = $sqlm->query("SELECT * FROM config_forum_categories"); 
    3260       $output .= ' 
    3261         <center> 
    3262           <form name="form" action="admin.php" method="get"> 
    3263             <input type="hidden" name="section" value="forum" /> 
    3264             <table class="simple admin_top_menus"> 
    3265               <tr> 
    3266                 <th colspan="2">'.lang("admin", "cats").'</th> 
    3267               </tr> 
    3268             </table> 
    3269             <table class="simple admin_top_menus"> 
    3270               <tr> 
    3271                 <th width="15%">'.lang("admin", "edit").'</th> 
    3272                 <th width="5%">'.lang("admin", "remove").'</th> 
    3273                 <th>'.lang("admin", "name").'</th> 
    3274               </tr>'; 
    3275       $color = "#EEEEEE"; 
    3276       while ( $cat = $sqlm->fetch_assoc($cats) ) 
    3277       { 
    3278         $output .= ' 
    3279               <tr> 
    3280                 <td style="background-color:'.$color.'"> 
    3281                   <center> 
    3282                     <a href="admin.php?section=forum&amp;category='.$cat["Index"].'&amp;editforum=editforum"> 
    3283                       <img src="img/edit.png" alt="" /> 
    3284                     </a> 
    3285                   </center> 
    3286                 </td> 
    3287                 <td style="background-color:'.$color.'"> 
    3288                   <center> 
    3289                     <a href="admin.php?section=forum&amp;category='.$cat["Index"].'&amp;delforum=delforum"> 
    3290                       <img src="img/aff_cross.png" alt="" /> 
    3291                     </a> 
    3292                   </center> 
    3293                 </td> 
    3294                 <td style="background-color:'.$color.'"> 
    3295                   <center>'.$cat["Name"].'</center> 
    3296                 </td> 
    3297               </tr>'; 
    3298         $color = ( ( $color == "#EEEEEE" ) ? "#FFFFFF" : "#EEEEEE" ); 
    3299       } 
    3300       $output .= ' 
    3301               <tr> 
    3302                 <td style="background-color:'.$color.'"> 
    3303                   <center> 
    3304                     <a href="admin.php?section=forum&amp;addforum=addforum"> 
    3305                       <img src="img/add.png" alt="" /> 
    3306                     </a> 
    3307                   </center> 
    3308                 </td> 
    3309                 <td style="background-color:'.$color.'" colspan="2"> 
    3310                   <a href="admin.php?section=forum&amp;addforum=addforum">'.lang("admin", "addforum").'</a> 
    3311                 </td> 
    3312               </tr> 
    3313             </table> 
    3314             <!-- input type="submit" name="editforum" value="'.lang("admin", "editforum").'"> 
    3315             <input type="submit" name="addforum" value="'.lang("admin", "addforum").'"> 
    3316             <input type="submit" name="delforum" value="'.lang("admin", "delforum").'" --> 
    3317           </form> 
    3318         </center>'; 
    3319       break; 
    3320     } 
    3321     case "edit": 
    3322     { 
    3323       $cat_id = $sqlm->quote_smart($_GET["category"]); 
    3324       $cat = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_forum_categories WHERE `Index`='".$cat_id."'")); 
    3325       $sec_levels = sec_level_list(); 
    3326       $output .= ' 
    3327         <center> 
    3328           <form name="form" action="admin.php" method="get"> 
    3329             <input type="hidden" name="section" value="forum" /> 
    3330             <input type="hidden" name="category" value="'.$cat_id.'" /> 
    3331             <table class="simple" id="admin_edit_top_menu_nameaction"> 
    3332               <tr> 
    3333                 <th colspan="2">'.lang("admin", "cat").'</th> 
    3334               </tr> 
    3335               <tr> 
    3336                 <td>'.lang("admin", "name").': </td> 
    3337                 <td> 
    3338                   <input type="text" name="cat_name" value="'.$cat["Name"].'" id="admin_edit_top_menu_action" /> 
    3339                 </td> 
    3340               </tr> 
    3341             </table> 
    3342             <table class="simple" id="admin_edit_top_menu_submenus"> 
    3343               <tr> 
    3344                 <th>'.lang("admin", "edit").'</th> 
    3345                 <th>'.lang("admin", "remove").'</th> 
    3346                 <th>'.lang("admin", "name").'</th> 
    3347                 <th>'.lang("admin", "desc").'</th> 
    3348                 <th>'.lang("admin", "sideaccess").'</th> 
    3349                 <th>'.lang("admin", "secread").'</th> 
    3350                 <th>'.lang("admin", "secpost").'</th> 
    3351                 <th>'.lang("admin", "sectopic").'</th> 
    3352               </tr>'; 
    3353       $forums = $sqlm->query("SELECT * FROM config_forums WHERE Category='".$cat_id."'"); 
    3354       $color = "#EEEEEE"; 
    3355       while ( $forum = $sqlm->fetch_assoc($forums) ) 
    3356       { 
    3357         $output .= ' 
    3358               <tr> 
    3359                 <td style="background-color:'.$color.'"> 
    3360                   <center> 
    3361                     <a href="admin.php?section=forum&amp;category='.$cat_id.'&amp;forum_item='.$forum["Index"].'&amp;editforum_item=editforumsection"> 
    3362                       <img src="img/edit.png" alt="" /> 
    3363                     </a> 
    3364                   </center> 
    3365                 </td> 
    3366                 <td style="background-color:'.$color.'"> 
    3367                   <center> 
    3368                     <a href="admin.php?section=forum&amp;category='.$cat_id.'&amp;forum_item='.$forum["Index"].'&amp;delforum_item=delforumsection"> 
    3369                       <img src="img/aff_cross.png" alt="" /> 
    3370                     </a> 
    3371                   </center> 
    3372                 </td> 
    3373                 <td width="25%" style="background-color:'.$color.'"> 
    3374                 <center>'.$forum["Name"].'</center> 
    3375                 </td> 
    3376                 <td width="25%" style="background-color:'.$color.'"> 
    3377                   <center>'.$forum["Desc"].'</center> 
    3378                 </td> 
    3379                 <td style="background-color:'.$color.'"> 
    3380                   <center>'.$forum["Side_Access"].'</center> 
    3381                 </td> 
    3382                 <td style="background-color:'.$color.'"> 
    3383                   <center>'.sec_level_name($forum["Min_Security_Level_Read"]).'</center> 
    3384                 </td> 
    3385                 <td style="background-color:'.$color.'"> 
    3386                   <center>'.sec_level_name($forum["Min_Security_Level_Post"]).'</center> 
    3387                 </td> 
    3388                 <td style="background-color:'.$color.'"> 
    3389                   <center>'.sec_level_name($forum["Min_Security_Level_Create_Topic"]).'</center> 
    3390                 </td> 
    3391               </tr>'; 
    3392         $color = ( ( $color == "#EEEEEE" ) ? "#FFFFFF" : "#EEEEEE" ); 
    3393       } 
    3394       $output .= ' 
    3395               <tr> 
    3396                 <td style="background-color:'.$color.'"> 
    3397                   <center> 
    3398                     <a href="admin.php?section=forum&amp;category='.$cat_id.'&amp;addforum_item=addforumsection"> 
    3399                       <img src="img/add.png" alt="" /> 
    3400                     </a> 
    3401                   </center> 
    3402                 </td> 
    3403                 <td style="background-color:'.$color.'" colspan="7"> 
    3404                   <a href="admin.php?section=forum&amp;category='.$cat_id.'&amp;addforum_item=addforumsection">'.lang("admin", "addforum_item").'</a> 
    3405                 </td> 
    3406               </tr> 
    3407             </table> 
    3408             <!-- input type="submit" name="editforum_item" value="'.lang("admin", "editforum_item").'"> 
    3409             <input type="submit" name="addforum_item" value="'.lang("admin", "addforum_item").'" --> 
    3410             <input type="submit" name="saveforum" value="'.lang("admin", "save").'" /> 
    3411             <!-- input type="submit" name="delforum_item" value="'.lang("admin", "delforum_item").'" --> 
    3412           </form> 
    3413         </center>'; 
    3414       break; 
    3415     } 
    3416     case "edititem": 
    3417     { 
    3418       $forum_item = $sqlm->quote_smart($_GET["forum_item"]); 
    3419       $forum = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_forums WHERE `Index`='".$forum_item."'")); 
    3420       $sec_list = sec_level_list(); 
    3421       $cat_list_query = "SELECT * FROM config_forum_categories"; 
    3422       $cat_list_result = $sqlm->query($cat_list_query); 
    3423  
    3424       $output .= ' 
    3425         <center> 
    3426           <form name="form" action="admin.php" method="get"> 
    3427             <input type="hidden" name="section" value="forum" /> 
    3428             <input type="hidden" name="action" value="saveforum" /> 
    3429             <input type="hidden" name="forum_item" value="'.$forum_item.'" /> 
    3430             <fieldset id="admin_edit_forum_field"> 
    3431               <table class="help" id="admin_edit_forum_item"> 
    3432                 <tr> 
    3433                   <td> 
    3434                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "cat_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "cat").'</a>: 
    3435                   </td> 
    3436                   <td> 
    3437                     <select name="category">'; 
    3438                     //<input type="text" name="category" value="'.$forum["Category"].'" id="admin_edit_menu_fields"> 
    3439       while ( $row = $sqlm->fetch_assoc($cat_list_result) ) 
    3440       { 
    3441         $output .= ' 
    3442                       <option value="'.$row["Index"].'" '.( ( $row["Index"] == $forum["Category"] ) ? 'selected="selected"' : '').' class="admin_edit_menu_fields">'.$row["Name"].'</option>'; 
    3443       } 
    3444       $output .= ' 
    3445                     </select> 
    3446                   </td> 
    3447                 </tr> 
    3448                 <tr> 
    3449                   <td> 
    3450                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "forumname_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "name").'</a>: 
    3451                   </td> 
    3452                   <td> 
    3453                     <input type="text" name="name" value="'.$forum["Name"].'" class="admin_edit_menu_fields" /> 
    3454                   </td> 
    3455                 </tr> 
    3456                 <tr> 
    3457                   <td> 
    3458                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "desc_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "desc").'</a>: 
    3459                   </td> 
    3460                   <td> 
    3461                     <input type="text" name="desc" value="'.$forum["Desc"].'" class="admin_edit_menu_fields" /> 
    3462                   </td> 
    3463                 </tr> 
    3464                 <tr> 
    3465                   <td> 
    3466                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "sideaccess_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "sideaccess2").'</a>: 
    3467                   </td> 
    3468                   <td> 
    3469                     <input type="text" name="sideaccess" value="'.$forum["Side_Access"].'" class="admin_edit_menu_fields" /> 
    3470                   </td> 
    3471                 </tr> 
    3472                 <tr> 
    3473                   <td> 
    3474                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "secread_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "secread2").'</a>: 
    3475                   </td> 
    3476                   <td> 
    3477                     <select name="min_security_level_read">'; 
    3478       foreach ( $sec_list as $row ) 
    3479       { 
    3480         $output .= ' 
    3481                       <option value="'.$row["Sec"].'" '.( ( $row["Sec"] == $forum["Min_Security_Level_Read"] ) ? 'selected="selected"' : '' ).'>'.$row["Name"].' ('.$row["Sec"].')</option>'; 
    3482       } 
    3483       $output .= ' 
    3484                     </select> 
    3485                   </td> 
    3486                 </tr> 
    3487                 <tr> 
    3488                   <td> 
    3489                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "secpost_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "secpost2").'</a>: 
    3490                   </td> 
    3491                   <td> 
    3492                     <select name="min_security_level_post">'; 
    3493       foreach ( $sec_list as $row ) 
    3494       { 
    3495         $output .= ' 
    3496                       <option value="'.$row["Sec"].'" '.( ( $row["Sec"] == $forum["Min_Security_Level_Post"] ) ? 'selected="selected"' : '' ).'>'.$row["Name"].' ('.$row["Sec"].')</option>'; 
    3497       } 
    3498       $output .= ' 
    3499                     </select> 
    3500                   </td> 
    3501                 </tr> 
    3502                 <tr> 
    3503                   <td> 
    3504                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "sectopic_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "sectopic2").'</a>: 
    3505                   </td> 
    3506                   <td> 
    3507                     <select name="min_security_level_create_topic">'; 
    3508       foreach ( $sec_list as $row ) 
    3509       { 
    3510         $output .= ' 
    3511                       <option value="'.$row["Sec"].'" '.( ( $row["Sec"] == $forum["Min_Security_Level_Create_Topic"] ) ? 'selected="selected"' : '' ).'>'.$row["Name"].' ('.$row["Sec"].')</option>'; 
    3512       } 
    3513       $output .= ' 
    3514                     </select> 
    3515                   </td> 
    3516                 </tr> 
    3517               </table> 
    3518             </fieldset> 
    3519             <input type="submit" name="save_forum_item" value="'.lang("admin", "save").'" /> 
    3520           </form> 
    3521         </center>'; 
    3522       break; 
    3523     } 
    3524     case "addforum": 
    3525     { 
    3526       $max = $sqlm->fetch_assoc($sqlm->query("SELECT MAX(`Index`) FROM config_forum_categories")); 
    3527       $max = $max["MAX(`Index`)"] + 1; 
    3528       $result = $sqlm->query("INSERT INTO config_forum_categories (`Index`, Name) VALUES ('".$max."', '')"); 
    3529       redirect("admin.php?section=forum"); 
    3530       break; 
    3531     } 
    3532     case "delforum": 
    3533     { 
    3534       $category = $sqlm->quote_smart($_GET["category"]); 
    3535       if ( is_numeric($category) ) 
    3536       { 
    3537         $result = $sqlm->query("DELETE FROM config_forum_categories WHERE `Index`='".$category."'"); 
    3538         redirect("admin.php?section=forum"); 
    3539       } 
    3540       else 
    3541         redirect("admin.php?section=forum&error=1"); 
    3542       break; 
    3543     } 
    3544     case "saveforum": 
    3545     { 
    3546       $category = $sqlm->quote_smart($_GET["category"]); 
    3547       $category_name = $sqlm->quote_smart($_GET["top_name"]); 
    3548       $result = $sqlm->query("UPDATE config_forum_categories SET Name='".$category_name."' WHERE `Index`='".$category."'"); 
    3549       redirect("admin.php?section=forum"); 
    3550       break; 
    3551     } 
    3552     case "additem": 
    3553     { 
    3554       $category = $sqlm->quote_smart($_GET["category"]); 
    3555       $result = $sqlm->query("INSERT INTO config_forums (Category, Name, `Desc`, Side_Access) VALUES ('".$category."', '', '', '')"); 
    3556       redirect("admin.php?section=forum&category=".$category."&editforum=editforum"); 
    3557       break; 
    3558     } 
    3559     case "delitem": 
    3560     { 
    3561       $category = $sqlm->quote_smart($_GET["category"]); 
    3562       $forum_item = $sqlm->quote_smart($_GET["forum_item"]); 
    3563       if ( is_numeric($forum_item) ) 
    3564       { 
    3565         $result = $sqlm->query("DELETE FROM config_forums WHERE `Index`='".$forum_item."'"); 
    3566         redirect("admin.php?section=forum&category=".$category."&editforum=editforum"); 
    3567       } 
    3568       else 
    3569         redirect("admin.php?section=forum&error=1"); 
    3570       break; 
    3571     } 
    3572     default: 
    3573       redirect("admin.php?section=forum&error=1"); 
    3574       break; 
    3575   } 
    3576 } 
    3577  
    3578 function saveforum() 
    3579 { 
    3580   global $corem_db; 
    3581  
    3582   $sqlm = new SQL; 
    3583   $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); 
    3584  
    3585   $forum_item = $sqlm->quote_smart($_GET["forum_item"]); 
    3586   $forum = $sqlm->quote_smart($_GET["category"]); 
    3587   $name = $sqlm->quote_smart($_GET["name"]); 
    3588   $desc = $sqlm->quote_smart($_GET["desc"]); 
    3589   $sideaccess = $sqlm->quote_smart($_GET["sideaccess"]); 
    3590   $min_security_level_read = $sqlm->quote_smart($_GET["min_security_level_read"]); 
    3591   $min_security_level_post = $sqlm->quote_smart($_GET["min_security_level_post"]); 
    3592   $min_security_level_create_topic = $sqlm->quote_smart($_GET["min_security_level_create_topic"]); 
    3593  
    3594   $result = $sqlm->query("SELECT * FROM config_forums WHERE `Index`='".$forum_item."'"); 
    3595   if ( $sqlm->num_rows($result) ) 
    3596     $result = $sqlm->query("UPDATE config_forums SET Category='".$forum."', Name='".$name."', `Desc`='".$desc."', Side_Access='".$sideaccess."', Min_Security_Level_Read='".$min_security_level_read."', Min_Security_Level_Post='".$min_security_level_post."', Min_Security_Level_Create_Topic='".$min_security_level_create_topic."' WHERE `Index`='".$forum_item."'"); 
    3597   else 
    3598     $result = $sqlm->query("INSERT INTO config_forums (Category, Name, Desc, Side_Access, Min_Security_Level_Read, Min_Security_Level_Post, Min_Security_Level_Create_Topic) VALUES ('".$forum."', '".$name."', '".$desc."', '".$sideaccess."', '".$min_security_level_read."', '".$min_security_level_post."', '".$min_security_level_create_topic."')"); 
    3599  
    3600   redirect("admin.php?section=forum"); 
    3601 } 
    3602  
    3603 function accounts() 
    3604 { 
    3605   global $output, $corem_db, $logon_db, $itemperpage, $core; 
    3606  
    3607   // we need $core to be set 
    3608   if ( $core == 0 ) 
    3609     $core = detectcore(); 
    3610  
    3611   $sqlm = new SQL; 
    3612   $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); 
    3613  
    3614   $sqll = new SQL; 
    3615   $sqll->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]); 
    3616  
    3617   $start = ( ( isset($_GET["start"]) ) ? $sqll->quote_smart($_GET["start"]) : 0 ); 
    3618   if ( !is_numeric($start) ) 
    3619     $start = 0; 
    3620  
    3621   $order_by = ( ( isset($_GET["order_by"]) ) ? $sqll->quote_smart($_GET["order_by"]) : "acct" ); 
    3622   if ( $order_by == "login" ) 
    3623   { 
    3624     if ( $core == 1 ) 
    3625       $order_by = "login"; 
    3626     else 
    3627       $order_by = "username"; 
    3628   } 
    3629  
    3630   $dir = ( ( isset($_GET["dir"]) ) ? $sqll->quote_smart($_GET["dir"]) : 1 ); 
    3631   if ( !preg_match('/^[01]{1}$/', $dir) ) 
    3632     $dir = 1; 
    3633  
    3634   $accts_per_page = ( ( isset($_GET["perpage"]) ) ? $sqll->quote_smart($_GET["perpage"]) : $itemperpage ); 
    3635   if ( !is_numeric($accts_per_page) ) 
    3636     $accts_per_page = $itemperpage; 
    3637  
    3638   $order_dir = ( ( $dir ) ? "ASC" : "DESC" ); 
    3639   $dir = ( ( $dir ) ? 0 : 1 ); 
    3640  
    3641   $search_value = ( ( isset($_GET["search_value"]) ) ? $sqll->quote_smart($_GET["search_value"]) : "" ); 
    3642   $search_by = ( ( isset($_GET["search_by"]) ) ? $sqll->quote_smart($_GET["search_by"]) : "" ); 
    3643  
    3644   if ( $core == 1 ) 
    3645     $search_menu = array( 
    3646       array("login",          "by_name"), 
    3647       array("acct",           "by_id"), 
    3648       array("ScreenName",     "by_sn"), 
    3649       array("SecurityLevel",  "by_sl"), 
    3650       array("WebAdmin",       "by_web")); 
    3651   else 
    3652     $search_menu = array( 
    3653       array("username",       "by_name"), 
    3654       array("id",             "by_id"), 
    3655       array("ScreenName",     "by_sn"), 
    3656       array("SecurityLevel",  "by_sl"), 
    3657       array("WebAdmin",       "by_web")); 
    3658  
    3659   $search = ""; 
    3660   if ( ( $search_value != "" ) && ( $search_by != "" ) ) 
    3661   { 
    3662     if ( $search_by == "WebAdmin" ) 
    3663       $search = "WHERE SecurityLevel>='1073741824'"; // WebAdmin column removed r197 
    3664     else 
    3665       $search = "WHERE ".$search_by." LIKE '%".$search_value."%'"; 
    3666   } 
    3667  
    3668   if ( $core == 1 ) 
    3669   { 
    3670     $query = "SELECT *, (SecurityLevel & 1073741824) AS WebAdmin 
    3671               FROM accounts 
    3672                 LEFT JOIN `".$corem_db["name"]."`.config_accounts ON accounts.login=`".$corem_db["name"]."`.config_accounts.Login COLLATE utf8_general_ci 
    3673               ".$search." 
    3674               ORDER BY ".$order_by." ".$order_dir." LIMIT ".$start.", ".$accts_per_page; 
    3675     $count_query = "SELECT COUNT(*) FROM accounts 
    3676                       LEFT JOIN `".$corem_db["name"]."`.config_accounts ON accounts.login=`".$corem_db["name"]."`.config_accounts.Login COLLATE utf8_general_ci 
    3677                     ".$search; 
    3678   } 
    3679   else 
    3680   { 
    3681     $query = "SELECT *, id AS acct, username AS login, (SecurityLevel & 1073741824) AS WebAdmin 
    3682               FROM account 
    3683                 LEFT JOIN `".$corem_db["name"]."`.config_accounts ON account.username=`".$corem_db["name"]."`.config_accounts.Login 
    3684               ".$search." 
    3685               ORDER BY ".$order_by." ".$order_dir." LIMIT ".$start.", ".$accts_per_page; 
    3686     $count_query = "SELECT COUNT(*) FROM account 
    3687                       LEFT JOIN `".$corem_db["name"]."`.config_accounts ON account.username=`".$corem_db["name"]."`.config_accounts.Login 
    3688                     ".$search; 
    3689   } 
    3690  
    3691   $result = $sqll->query($query); 
    3692  
    3693   $count_result = $sqll->query($count_query); 
    3694   $all_record = $sqll->result($count_result, 0); 
    3695  
    3696   $accounts_action = 0; 
    3697   if ( isset($_GET["editacct"]) ) 
    3698     $accounts_action = "edit"; 
    3699  
    3700   if ( !$accounts_action ) 
    3701   { 
    3702     $output .= ' 
    3703         <center> 
    3704           <table class="hidden"> 
    3705             <tr> 
    3706               <td> 
    3707                 <form action="admin.php" method="get" name="form"> 
    3708                   <input type="hidden" name="section" value="accounts" /> 
    3709                   <input type="text" size="24" maxlength="50" name="search_value" value="'.$search_value.'" /> 
    3710                   <select name="search_by">'; 
    3711   foreach ( $search_menu as $row ) 
    3712   { 
    3713     $output .= ' 
    3714                             <option value="'.$row[0].'"'.( ( $search_by === $row[0] ) ? ' selected="selected"' : '' ).'>'.lang("admin", $row[1]).'</option>'; 
    3715   } 
    3716   $output .= ' 
    3717                   </select> 
    3718                   <input type="submit" name="search" value="'.lang("global", "search").'" /> 
    3719                 </form> 
    3720               </td> 
    3721             </tr> 
    3722           </table>'; 
    3723  
    3724     $output .= ' 
    3725           <a href="admin.php?section=accounts&amp;order_by='.$order_by.'&amp;start='.$start.'&amp;dir='.( ( $dir ) ? 0 : 1 ).'&perpage='.$accts_per_page.'">'.lang("admin", "clearsearch").'</a> 
    3726           <br /> 
    3727           <br />'; 
    3728  
    3729     if ( $order_by == "username" ) 
    3730       $order_by = "login"; 
    3731  
    3732     $output .= ' 
    3733           <table class="hidden admin_accounts"> 
    3734             <tr> 
    3735               <td colspan="2" align="left"> 
    3736                 '.lang("admin", "per_page").': '; 
    3737     $per_page_choices = array(25, 50, 100, 200); 
    3738  
    3739     for ( $i = 0; $i < count($per_page_choices); $i++ ) 
    3740     { 
    3741       if ( $accts_per_page != $per_page_choices[$i] ) 
    3742         $output .= '<a href="admin.php?section=accounts&amp;order_by='.$order_by.'&amp;start='.$start.'&amp;dir='.( ( $dir ) ? 0 : 1 ).( $search_value && $search_by ? '&amp;search_by='.$search_by.'&amp;search_value='.$search_value.'' : '' ).'&amp;perpage='.$per_page_choices[$i].'">'.$per_page_choices[$i].'</a>'; 
    3743       else 
    3744         $output .= $per_page_choices[$i]; 
    3745  
    3746       if ( $i < (count($per_page_choices)-1) ) 
    3747         $output .= ',&nbsp;'; 
    3748     } 
    3749     $output .= ' 
    3750               </td> 
    3751             </tr> 
    3752             <tr> 
    3753               <td align="left">'.lang("admin", "total").': '.$all_record.'</td> 
    3754               <td align="right">'; 
    3755  
    3756     $output .= generate_pagination('admin.php?section=accounts&amp;order_by='.$order_by.'&amp;start='.$start.'&amp;dir='.( ( $dir ) ? 0 : 1 ).( $search_value && $search_by ? '&amp;search_by='.$search_by.'&amp;search_value='.$search_value.'' : '' ).'&amp;perpage='.$accts_per_page, $all_record, $accts_per_page, $start); 
    3757  
    3758     $output .= ' 
    3759               </td> 
    3760             </tr> 
    3761           </table> 
    3762           <form name="form" action="admin.php" method="get"> 
    3763             <input type="hidden" name="section" value="accounts" /> 
    3764             <table class="simple admin_accounts"> 
    3765               <tr> 
    3766                 <th width="10%">'.lang("admin", "edit").'</th> 
    3767                 <th> 
    3768                   <a href="admin.php?section=accounts&amp;order_by=acct&amp;start='.$start.( ( $search_value && $search_by ) ? '&amp;search_by='.$search_by.'&amp;search_value='.$search_value.'' : '' ).'&amp;dir='.$dir.'&amp;perpage='.$accts_per_page.'"'.( ( $order_by == 'acct' ) ? ' class="'.$order_dir.'"' : '' ).'>'.lang("user", "acct").'</a> 
    3769                 </th> 
    3770                 <th> 
    3771                   <a href="admin.php?section=accounts&amp;order_by=login&amp;start='.$start.( ( $search_value && $search_by ) ? '&amp;search_by='.$search_by.'&amp;search_value='.$search_value.'' : '' ).'&amp;dir='.$dir.'&amp;perpage='.$accts_per_page.'"'.( ( $order_by == 'login' ) ? ' class="'.$order_dir.'"' : '' ).'>'.lang("admin", "login").'</a> 
    3772                 </th> 
    3773                 <th> 
    3774                   <a href="admin.php?section=accounts&amp;order_by=ScreenName&amp;start='.$start.( ( $search_value && $search_by ) ? '&amp;search_by='.$search_by.'&amp;search_value='.$search_value.'' : '' ).'&amp;dir='.$dir.'&amp;perpage='.$accts_per_page.'"'.( ( $order_by == 'ScreenName' ) ? ' class="'.$order_dir.'"' : '' ).'>'.lang("admin", "screenname").'</a> 
    3775                 </th> 
    3776                 <th width="20%"> 
    3777                   <a href="admin.php?section=accounts&amp;order_by=SecurityLevel&amp;start='.$start.( ( $search_value && $search_by ) ? '&amp;search_by='.$search_by.'&amp;search_value='.$search_value.'' : '' ).'&amp;dir='.$dir.'&amp;perpage='.$accts_per_page.'"'.( ( $order_by == 'SecurityLevel' ) ? ' class="'.$order_dir.'"' : '' ).'>'.lang("admin", "seclvl").'</a> 
    3778                 </th> 
    3779                 <th width="15%"> 
    3780                   <a href="admin.php?section=accounts&amp;order_by=WebAdmin&amp;start='.$start.( ( $search_value && $search_by ) ? '&amp;search_by='.$search_by.'&amp;search_value='.$search_value.'' : '' ).'&amp;dir='.$dir.'&amp;perpage='.$accts_per_page.'"'.( ( $order_by == 'WebAdmin' ) ? ' class="'.$order_dir.'"' : '' ).'>'.lang("admin", "acpaccess").'</a> 
    3781                 </th> 
    3782               </tr>'; 
    3783     $color = "#EEEEEE"; 
    3784     while ( $acct = $sqll->fetch_assoc($result) ) 
    3785     { 
    3786       $acct["SecurityLevel"] = ( ( isset($acct["SecurityLevel"]) ) ? $acct["SecurityLevel"] : 0 ); 
    3787       $acct["WebAdmin"] = ( ( isset($acct["WebAdmin"]) ) ? $acct["WebAdmin"] : 0 ); 
    3788       $acct["ScreenName"] = ( ( isset($acct["ScreenName"]) ) ? $acct["ScreenName"] : "" ); 
    3789  
    3790       if ( $acct["SecurityLevel"] >= 1073741824 ) 
    3791         $acct["SecurityLevel"] -= 1073741824; 
    3792  
    3793       $sl_query = "SELECT * FROM config_gm_level_names WHERE Security_Level='".$acct["SecurityLevel"]."'"; 
    3794       $sl_result = $sqlm->query($sl_query); 
    3795       $sl = $sqlm->fetch_assoc($sl_result); 
    3796  
    3797       $output .= ' 
    3798               <tr> 
    3799                 <td style="background-color:'.$color.'"> 
    3800                   <center> 
    3801                     <a href="admin.php?section=accounts&amp;acct='.$acct["login"].'&amp;editacct=editaccount"> 
    3802                       <img src="img/edit.png" alt="" /> 
    3803                     </a> 
    3804                   </center> 
    3805                 </td> 
    3806                 <td style="background-color:'.$color.'"> 
    3807                   <center>'.$acct["acct"].'</center> 
    3808                 </td> 
    3809                 <td style="background-color:'.$color.'"> 
    3810                   <center>'.ucfirst(strtolower($acct["login"])).'</center> 
    3811                 </td> 
    3812                 <td style="background-color:'.$color.'"> 
    3813                   <center>'.$acct["ScreenName"].'</center> 
    3814                 </td> 
    3815                 <td style="background-color:'.$color.'"> 
    3816                   <center>'.$sl["Full_Name"].' ('.$acct["SecurityLevel"].')</center> 
    3817                 </td> 
    3818                 <td style="background-color:'.$color.'"> 
    3819                   <center> 
    3820                     <img src="img/'.( ( $acct["WebAdmin"] ) ? 'up' : 'down' ).'.gif" alt="" /> 
    3821                   </center> 
    3822                 </td> 
    3823               </tr>'; 
    3824       $color = ( ( $color == "#EEEEEE" ) ? "#FFFFFF" : "#EEEEEE" ); 
    3825     } 
    3826     $output .= ' 
    3827             </table> 
    3828             <!-- input type="submit" name="editacct" value="'.lang("admin", "editacct").'" --> 
    3829           </form> 
    3830         </center>'; 
    3831   } 
    3832   else 
    3833   { 
    3834     if ( isset($_GET["acct"]) ) 
    3835       $acct = $sqlm->quote_smart($_GET["acct"]); 
    3836     else 
    3837       redirect("admin.php?section=accounts&error=1"); 
    3838  
    3839     if ( $core == 1 ) 
    3840       $logon_acct = $sqll->fetch_assoc($sqll->query("SELECT * FROM accounts WHERE login='".$acct."'")); 
    3841     else 
    3842       $logon_acct = $sqll->fetch_assoc($sqll->query("SELECT *, username AS login FROM account WHERE username='".$acct."'")); 
    3843  
    3844     $sl_query = "SELECT * FROM config_gm_level_names"; 
    3845     $sl_result = $sqlm->query($sl_query); 
    3846  
    3847     $sn_acct = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_accounts WHERE Login='".$acct."'")); 
    3848  
    3849     $sec_level_only = ( ( $sn_acct["SecurityLevel"] ) ? $sn_acct["SecurityLevel"] : 0 ); 
    3850     if ( $sec_level_only >= 1073741824 ) 
    3851       $sec_level_only -= 1073741824; 
    3852  
    3853     $web_admin_only = ($sn_acct["SecurityLevel"] & 1073741824); 
    3854  
    3855     $output .= ' 
    3856         <center> 
    3857           <form name="form" action="admin.php" method="get"> 
    3858             <input type="hidden" name="section" value="accounts" /> 
    3859             <input type="hidden" name="action" value="saveacct" /> 
    3860             <fieldset id="admin_edit_account"> 
    3861               <table> 
    3862                 <tr> 
    3863                   <td width="50%">'.lang("admin", "login").': </td> 
    3864                   <td> 
    3865                     <input type="text" readonly="readonly" name="login" value="'.$logon_acct["login"].'" /> 
    3866                   </td> 
    3867                 </tr> 
    3868                 <tr> 
    3869                   <td>'.lang("admin", "screenname").': </td> 
    3870                   <td> 
    3871                     <input type="text" name="sn" value="'.$sn_acct["ScreenName"].'" /> 
    3872                   </td> 
    3873                 </tr> 
    3874                 <tr> 
    3875                   <td>'.lang("admin", "seclvl").': </td> 
    3876                   <td> 
    3877                     <select name="sec">'; 
    3878     while ( $row = $sqlm->fetch_assoc($sl_result) ) 
    3879     { 
    3880       $output .= ' 
    3881                       <option value="'.$row["Security_Level"].'" '.( ( $sec_level_only == $row["Security_Level"] ) ? 'selected="selected"' : '' ).'>'.$row["Full_Name"].' ('.$row["Security_Level"].')</option>'; 
    3882     } 
    3883     $output .= ' 
    3884                     </select> 
    3885                   </td> 
    3886                 </tr> 
    3887                 <tr> 
    3888                   <td class="help"> 
    3889                     <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "acpaccess_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "acpaccess").'</a>: 
    3890                   </td> 
    3891                   <td> 
    3892                     <input type="checkbox" name="acp" '.($web_admin_only ? 'checked' : '').' /> 
    3893                   </td> 
    3894                 </tr> 
    3895               </table> 
    3896             </fieldset> 
    3897             <input type="submit" name="saveacct" value="'.lang("admin", "save").'" /> 
    3898           </form> 
    3899         </center>'; 
    3900   } 
    3901 } 
    3902  
    3903 function saveacct() 
    3904 { 
    3905   global $corem_db; 
    3906  
    3907   $sqlm = new SQL; 
    3908   $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); 
    3909  
    3910   $acct = $sqlm->quote_smart($_GET["login"]); 
    3911   $sn = $sqlm->quote_smart($_GET["sn"]); 
    3912   $sec = ( ( isset($_GET["sec"]) ) ? $sqlm->quote_smart($_GET["sec"]) : 0 ); 
    3913   $acp = ( ( isset($_GET["acp"]) ) ? 1 : 0 ); 
    3914  
    3915   if ( $acp ) 
    3916     $sec += 1073741824; 
    3917  
    3918   $result = $sqlm->query("SELECT * FROM config_accounts WHERE Login='".$acct."'"); 
    3919   if ( $sqlm->num_rows($result) ) 
    3920     $result = $sqlm->query("UPDATE config_accounts SET ScreenName='".$sn."', SecurityLevel='".$sec."' WHERE Login='".$acct."'"); 
    3921   else 
    3922     $result = $sqlm->query("INSERT INTO config_accounts (Login, ScreenName, SecurityLevel) VALUES ('".$acct."', '".$sn."', '".$sec."')"); 
    3923  
    3924   redirect("admin.php?section=accounts"); 
    3925 } 
    3926  
    3927 function pointsystem() 
    3928 { 
    3929   global $output, $corem_db, $logon_db, $get_timezone_type, $core; 
    3930  
    3931   // we need $core to be set 
    3932   if ( $core == 0 ) 
    3933     $core = detectcore(); 
    3934  
    3935   $sqlm = new SQL; 
    3936   $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); 
    3937  
    3938   $subsection = ( ( isset($_GET["subsection"]) ) ? $sqlm->quote_smart($_GET["subsection"]) : 1 ); 
    3939  
    3940   $output .= ' 
    3941         <table id="sidebar"> 
    3942           <tr> 
    3943             <td '.( ( $subsection == "basic" ) ? 'class="current"' : '' ).'> 
    3944               <a href="admin.php?section=pointsystem&amp;subsection=basic">'.lang("admin", "basic").'</a> 
    3945             </td> 
    3946           </tr> 
    3947           <tr> 
    3948             <td '.( ( $subsection == "coupons" ) ? 'class="current"' : '' ).'> 
    3949               <a href="admin.php?section=pointsystem&amp;subsection=coupons">'.lang("admin", "coupons").'</a> 
    3950             </td> 
    3951           </tr> 
    3952           <tr> 
    3953             <td '.( ( $subsection == "raffles" ) ? 'class="current"' : '' ).'> 
    3954               <a href="admin.php?section=pointsystem&amp;subsection=raffles">'.lang("admin", "raffles").'</a> 
    3955             </td> 
    3956           </tr> 
    3957           <tr> 
    3958             <td '.( ( $subsection == "bags" ) ? 'class="current"' : '' ).'> 
    3959               <a href="admin.php?section=pointsystem&amp;subsection=bags">'.lang("admin", "bags").'</a> 
    3960             </td> 
    3961           </tr> 
    3962           <tr> 
    3963             <td '.( ( $subsection == "achieve" ) ? 'class="current"' : '' ).'> 
    3964               <a href="admin.php?section=pointsystem&amp;subsection=achieve">'.lang("admin", "achieve").'</a> 
    3965             </td> 
    3966           </tr> 
    3967         </table>'; 
    3968  
    3969   $sub_action = ( ( isset($_GET["subaction"]) ) ? $_GET["subaction"] : '' ); 
    3970  
    3971   if ( isset($_GET["error"]) ) 
    3972     $output .= ' 
    3973       <div id="misc_error">'; 
    3974   else 
    3975     $output .= ' 
    3976       <div id="misc">'; 
    3977  
    3978   switch ( $subsection ) 
    3979   { 
    3980     case "basic": 
    3981     { 
    3982       if ( !$sub_action ) 
    3983       { 
    3984         $allow_fractional = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Credits_Fractional'")); 
    3985         $credits_per_recruit = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Credits_Per_Recruit'")); 
    3986         $recruit_reward_auto = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Recruit_Reward_Auto'")); 
    3987         $initial_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='New_Account_Credits'")); 
    3988         $qiv_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='QIV_Credits'")); 
    3989         $qiv_gold = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='QIV_Gold'")); 
    3990         $uv_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='UV_Credits'")); 
    3991         $uv_gold = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='UV_Gold'")); 
    3992  
    3993         // extract gold/silver/copper from single gold number 
    3994         $qiv_gold["Value"] = str_pad($qiv_gold["Value"], 4, "0", STR_PAD_LEFT); 
    3995         $qiv_g = substr($qiv_gold["Value"],  0, -4); 
    3996         if ( $qiv_g == '' ) 
    3997           $qiv_g = 0; 
    3998         $qiv_s = substr($qiv_gold["Value"], -4,  2); 
    3999         if ( ( $qiv_s == '' ) || ( $qiv_s == '00' ) ) 
    4000           $qiv_s = 0; 
    4001         $qiv_c = substr($qiv_gold["Value"], -2); 
    4002         if ( ( $qiv_c == '' ) || ( $qiv_c == '00' ) ) 
    4003           $qiv_c = 0; 
    4004  
    4005         // extract gold/silver/copper from single gold number 
    4006         $uv_gold["Value"] = str_pad($uv_gold["Value"], 4, "0", STR_PAD_LEFT); 
    4007         $uv_g = substr($uv_gold["Value"],  0, -4); 
    4008         if ( $uv_g == '' ) 
    4009           $uv_g = 0; 
    4010         $uv_s = substr($uv_gold["Value"], -4,  2); 
    4011         if ( ( $uv_s == '' ) || ( $uv_s == '00' ) ) 
    4012           $uv_s = 0; 
    4013         $uv_c = substr($uv_gold["Value"], -2); 
    4014         if ( ( $uv_c == '' ) || ( $uv_c == '00' ) ) 
    4015           $uv_c = 0; 
    4016  
    4017         $name_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Name_Change_Credits'")); 
    4018         $race_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Race_Change_Credits'")); 
    4019         $trans_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Transfer_Credits'")); 
    4020         $hearth_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hearthstone_Credits'")); 
    4021  
    4022         $output .= ' 
    4023         <form name="form" action="admin.php" method="get"> 
    4024           <input type="hidden" name="section" value="pointsystem" /> 
    4025           <input type="hidden" name="subaction" value="savepoints" /> 
    4026           <input type="hidden" name="subsection" value="basic" /> 
    4027           <table class="simple" id="admin_more"> 
    4028             <tr> 
    4029               <td class="help"> 
    4030                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "fractional_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "fractional").'</a>: 
    4031               </td> 
    4032               <td> 
    4033                 <input type="checkbox" name="allowfractional" '.( ( $allow_fractional["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    4034               </td> 
    4035             </tr> 
    4036             <tr> 
    4037               <td colspan="2"> 
    4038                 <b>'.lang("admin", "recruitment").'</b> 
    4039               </td> 
    4040             </tr> 
    4041             <tr> 
    4042               <td class="help"> 
    4043                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "credits_per_recruit_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "credits_per_recruit").'</a>: 
    4044               </td> 
    4045               <td> 
    4046                 <input type="text" name="creditsperrecruit" value="'.$credits_per_recruit["Value"].'"/> 
    4047               </td> 
    4048             </tr> 
    4049             <tr> 
    4050               <td class="help"> 
    4051                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "recruit_reward_auto_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "recruit_reward_auto").'</a>: 
    4052               </td> 
    4053               <td> 
    4054                 <input type="checkbox" name="recruitrewardauto" '.( ( $recruit_reward_auto["Value"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    4055               </td> 
    4056             </tr> 
    4057             <tr> 
    4058               <td colspan="2"> 
    4059                 <b>'.lang("admin", "newaccounts").'</b> 
    4060               </td> 
    4061             </tr> 
    4062             <tr> 
    4063               <td class="help"> 
    4064                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "initial_credits_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "initial_credits").'</a>: 
    4065               </td> 
    4066               <td> 
    4067                 <input type="text" name="initialcredits" value="'.$initial_credits["Value"].'"/> 
    4068               </td> 
    4069             </tr> 
    4070             <tr> 
    4071               <td colspan="2"> 
    4072                 <b>'.lang("admin", "tool_qiv").'</b> 
    4073               </td> 
    4074             </tr> 
    4075             <tr> 
    4076               <td class="help"> 
    4077                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "qiv_credits_per_gold_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "qiv_credits_per_gold").'</a>: 
    4078               </td> 
    4079               <td> 
    4080                 <input type="text" name="qiv_creditspergold_credits" value="'.$qiv_credits["Value"].'" size="6"/> 
    4081                 '.lang("admin", "credits").'&nbsp;=&nbsp; 
    4082                 <input type="text" name="qiv_creditspergold_gold" value="'.$qiv_g.'" size="6"/> 
    4083                 <img src="../img/gold.gif" alt="gold" /> 
    4084                 <input type="text" name="qiv_creditspergold_silver" value="'.$qiv_s.'" maxlength="2" size="6"/> 
    4085                 <img src="../img/silver.gif" alt="gold" /> 
    4086                 <input type="text" name="qiv_creditspergold_copper" value="'.$qiv_c.'" maxlength="2" size="6"/> 
    4087                 <img src="../img/copper.gif" alt="gold" /> 
    4088               </td> 
    4089             </tr> 
    4090             <tr> 
    4091               <td colspan="2"> 
    4092                 <b>'.lang("admin", "tool_uv").'</b> 
    4093               </td> 
    4094             </tr> 
    4095             <tr> 
    4096               <td class="help"> 
    4097                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "uv_credits_per_gold_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "uv_credits_per_gold").'</a>: 
    4098               </td> 
    4099               <td> 
    4100                 <input type="text" name="uv_creditspergold_credits" value="'.$uv_credits["Value"].'" size="6"/> 
    4101                 '.lang("admin", "credits").'&nbsp;=&nbsp; 
    4102                 <input type="text" name="uv_creditspergold_gold" value="'.$uv_g.'" size="6"/> 
    4103                 <img src="../img/gold.gif" alt="gold" /> 
    4104                 <input type="text" name="uv_creditspergold_silver" value="'.$uv_s.'" maxlength="2" size="6"/> 
    4105                 <img src="../img/silver.gif" alt="gold" /> 
    4106                 <input type="text" name="uv_creditspergold_copper" value="'.$uv_c.'" maxlength="2" size="6"/> 
    4107                 <img src="../img/copper.gif" alt="gold" /> 
    4108               </td> 
    4109             </tr> 
    4110             <tr> 
    4111               <td colspan="2"> 
    4112                 <b>'.lang("admin", "tool_name").'</b> 
    4113               </td> 
    4114             </tr> 
    4115             <tr> 
    4116               <td class="help"> 
    4117                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "name_credits_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "name_credits").'</a>: 
    4118               </td> 
    4119               <td> 
    4120                 <input type="text" name="namecredits" value="'.$name_credits["Value"].'"/> 
    4121               </td> 
    4122             </tr> 
    4123             <tr> 
    4124               <td colspan="2"> 
    4125                 <b>'.lang("admin", "tool_race").'</b> 
    4126               </td> 
    4127             </tr> 
    4128             <tr> 
    4129               <td class="help"> 
    4130                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "race_credits_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "race_credits").'</a>: 
    4131               </td> 
    4132               <td> 
    4133                 <input type="text" name="racecredits" value="'.$race_credits["Value"].'"/> 
    4134               </td> 
    4135             </tr> 
    4136             <tr> 
    4137               <td colspan="2"> 
    4138                 <b>'.lang("admin", "tool_trans").'</b> 
    4139               </td> 
    4140             </tr> 
    4141             <tr> 
    4142               <td class="help"> 
    4143                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "trans_credits_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "trans_credits").'</a>: 
    4144               </td> 
    4145               <td> 
    4146                 <input type="text" name="transcredits" value="'.$trans_credits["Value"].'"/> 
    4147               </td> 
    4148             </tr> 
    4149             <tr> 
    4150               <td colspan="2"> 
    4151                 <b>'.lang("admin", "tool_hearth").'</b> 
    4152               </td> 
    4153             </tr> 
    4154             <tr> 
    4155               <td class="help"> 
    4156                 <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "hearth_credits_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "hearth_credits").'</a>: 
    4157               </td> 
    4158               <td> 
    4159                 <input type="text" name="hearthcredits" value="'.$hearth_credits["Value"].'"/> 
    4160               </td> 
    4161             </tr> 
    4162           </table> 
    4163           <input type="submit" name="save" value="'.lang("admin", "save").'" /> 
    4164         </form>'; 
    4165       } 
    4166       else 
    4167       { 
    4168         $allow_fractional = ( ( isset($_GET["allowfractional"]) ) ? 1 : 0 ); 
    4169         $credits_per_recruit = $sqlm->quote_smart($_GET["creditsperrecruit"]); 
    4170         $recruit_reward_auto = ( ( isset($_GET["recruitrewardauto"]) ) ? 1 : 0 ); 
    4171         $initial_credits = $sqlm->quote_smart($_GET["initialcredits"]); 
    4172         $qiv_credits = $sqlm->quote_smart($_GET["qiv_creditspergold_credits"]); 
    4173         $qiv_gold = $sqlm->quote_smart($_GET["qiv_creditspergold_gold"]); 
    4174         $qiv_silver = $sqlm->quote_smart($_GET["qiv_creditspergold_silver"]); 
    4175         $qiv_copper = $sqlm->quote_smart($_GET["qiv_creditspergold_copper"]); 
    4176         $uv_credits = $sqlm->quote_smart($_GET["uv_creditspergold_credits"]); 
    4177         $uv_gold = $sqlm->quote_smart($_GET["uv_creditspergold_gold"]); 
    4178         $uv_silver = $sqlm->quote_smart($_GET["uv_creditspergold_silver"]); 
    4179         $uv_copper = $sqlm->quote_smart($_GET["uv_creditspergold_copper"]); 
    4180  
    4181         // pad 
    4182         $qiv_silver = str_pad($qiv_silver, 2, "0", STR_PAD_LEFT); 
    4183         $qiv_copper = str_pad($qiv_copper, 2, "0", STR_PAD_LEFT); 
    4184         $uv_silver = str_pad($uv_silver, 2, "0", STR_PAD_LEFT); 
    4185         $uv_copper = str_pad($uv_copper, 2, "0", STR_PAD_LEFT); 
    4186  
    4187         // combine 
    4188         $qiv_money = $qiv_gold.$qiv_silver.$qiv_copper; 
    4189         $uv_money = $uv_gold.$uv_silver.$uv_copper; 
    4190  
    4191         $name_credits = $sqlm->quote_smart($_GET["namecredits"]); 
    4192         $race_credits = $sqlm->quote_smart($_GET["racecredits"]); 
    4193         $trans_credits = $sqlm->quote_smart($_GET["transcredits"]); 
    4194         $hearth_credits = $sqlm->quote_smart($_GET["hearthcredits"]); 
    4195  
    4196         $result = $sqlm->query("UPDATE config_misc SET Value='".$allow_fractional."' WHERE `Key`='Credits_Fractional'"); 
    4197         $result = $sqlm->query("UPDATE config_misc SET Value='".$credits_per_recruit."' WHERE `Key`='Credits_Per_Recruit'"); 
    4198         $result = $sqlm->query("UPDATE config_misc SET Value='".$recruit_reward_auto."' WHERE `Key`='Recruit_Reward_Auto'"); 
    4199         $result = $sqlm->query("UPDATE config_misc SET Value='".$initial_credits."' WHERE `Key`='New_Account_Credits'"); 
    4200         $result = $sqlm->query("UPDATE config_misc SET Value='".$qiv_credits."' WHERE `Key`='QIV_Credits'"); 
    4201         $result = $sqlm->query("UPDATE config_misc SET Value='".$qiv_money."' WHERE `Key`='QIV_Gold'"); 
    4202         $result = $sqlm->query("UPDATE config_misc SET Value='".$uv_credits."' WHERE `Key`='UV_Credits'"); 
    4203         $result = $sqlm->query("UPDATE config_misc SET Value='".$uv_money."' WHERE `Key`='UV_Gold'"); 
    4204         $result = $sqlm->query("UPDATE config_misc SET Value='".$name_credits."' WHERE `Key`='Name_Change_Credits'"); 
    4205         $result = $sqlm->query("UPDATE config_misc SET Value='".$race_credits."' WHERE `Key`='Race_Change_Credits'"); 
    4206         $result = $sqlm->query("UPDATE config_misc SET Value='".$trans_credits."' WHERE `Key`='Transfer_Credits'"); 
    4207         $result = $sqlm->query("UPDATE config_misc SET Value='".$hearth_credits."' WHERE `Key`='Hearthstone_Credits'"); 
    4208  
    4209         redirect("admin.php?section=pointsystem&subsection=basic"); 
    4210       } 
    4211       break; 
    4212     } 
    4213     case "coupons": 
    4214     { 
    4215       $query = "SELECT * FROM point_system_coupons"; 
    4216       $result = $sqlm->query($query); 
    4217  
    4218       $coupon_action = 0; 
    4219       if ( isset($_GET["editcoupon"]) ) 
    4220         $coupon_action = "edit"; 
    4221       if ( isset($_GET["delcoupon"]) ) 
    4222         $coupon_action = "del"; 
    4223       if ( isset($_GET["addcoupon"]) ) 
    4224         $coupon_action = "add"; 
    4225  
    4226       $sub_action = ( ( isset($_GET["subaction"]) ) ? $_GET["subaction"] : '' ); 
    4227  
    4228       $sqll = new SQL; 
    4229       $sqll->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]); 
    4230  
    4231       if ( !$coupon_action ) 
    4232       { 
    4233         $output .= ' 
    4234         <form name="form" action="admin.php" method="get"> 
    4235           <input type="hidden" name="section" value="pointsystem" /> 
    4236           <input type="hidden" name="subsection" value="coupons" /> 
    4237           <table class="simple" id="admin_point_coupon_list"> 
    4238             <tr> 
    4239               <th width="1%"></th> 
    4240               <th width="1%"></th> 
    4241               <th width="3%">'.lang("admin", "coupon_id").'</th> 
    4242               <th width="15%">'.lang("admin", "coupon_title").'</th> 
    4243               <th width="15%">'.lang("admin", "coupon_target").'</th> 
    4244               <th width="15%">'.lang("admin", "coupon_issued").'</th> 
    4245               <!-- th width="15%">'.lang("admin", "coupon_expiration").'</th --> 
    4246               <th width="10%">'.lang("admin", "coupon_credits").'</th> 
    4247               <th width="5%">'.lang("admin", "coupon_money").'</th> 
    4248               <th width="5%">'.lang("admin", "coupon_item").'</th> 
    4249               <th width="5%">'.lang("admin", "coupon_count").'</th> 
    4250               <th width="5%">'.lang("admin", "coupon_raffle").'</th> 
    4251               <th width="5%">'.lang("admin", "coupon_usage").'</th> 
    4252               <th width="5%">'.lang("admin", "enabled").'</th> 
    4253             </tr>'; 
    4254         $color = "#EEEEEE"; 
    4255         while ( $coupon = $sqlm->fetch_assoc($result) ) 
    4256         { 
    4257           // determine target 
    4258           if ( $coupon["target"] != 0 ) 
    4259           { 
    4260             if ( $core == 1 ) 
    4261               $target_query = "SELECT login FROM accounts WHERE acct='".$coupon["target"]."'"; 
    4262             else 
    4263               $target_query = "SELECT username AS login FROM account WHERE id='".$coupon["target"]."'"; 
    4264  
    4265             $target_result = $sqll->query($target_query); 
    4266             $target_result = $sqll->fetch_assoc($target_result); 
    4267             $target = $target_result["login"]; 
    4268           } 
    4269           else 
    4270             $target = lang("admin", "coupon_public"); 
    4271  
    4272           // determine usage 
    4273           $usage_query = "SELECT COUNT(*) FROM point_system_coupon_usage WHERE coupon='".$coupon["entry"]."'"; 
    4274           $usage_result = $sqlm->query($usage_query); 
    4275           $usage_result = $sqlm->fetch_assoc($usage_result); 
    4276           $times_used = $usage_result["COUNT(*)"]; 
    4277  
    4278           if ( $coupon["usage_limit"] > -1 ) 
    4279             $usage = $times_used."/".$coupon["usage_limit"]; 
    4280           else 
    4281             $usage = $times_used; 
    4282  
    4283           $output .= ' 
    4284             <tr> 
    4285               <td style="background-color:'.$color.'"> 
    4286                 <center> 
    4287                   <a href="admin.php?section=pointsystem&amp;subsection=coupons&amp;sel_coupon='.$coupon["entry"].'&amp;editcoupon=editcoupon" onmouseover="oldtoolTip(\''.lang("admin", "edit").'\', \'info_tooltip\')" onmouseout="oldtoolTip()"> 
    4288                     <img src="img/edit.png" alt="" /> 
    4289                   </a> 
    4290                 </center> 
    4291               </td> 
    4292               <td style="background-color:'.$color.'"> 
    4293                 <center> 
    4294                   <a href="admin.php?section=pointsystem&amp;subsection=coupons&amp;sel_coupon='.$coupon["entry"].'&amp;delcoupon=deletecoupon" onmouseover="oldtoolTip(\''.lang("admin", "remove").'\', \'info_tooltip\')" onmouseout="oldtoolTip()"> 
    4295                     <img src="img/aff_cross.png" alt="" /> 
    4296                   </a> 
    4297                 </center> 
    4298               </td> 
    4299               <td style="background-color:'.$color.'"> 
    4300                 <center>'.$coupon["entry"].'</center> 
    4301               </td> 
    4302               <td style="background-color:'.$color.'"> 
    4303                 <center>'.$coupon["title"].'</center> 
    4304               </td> 
    4305               <td style="background-color:'.$color.'"> 
    4306                 <center>'.$target.'</center> 
    4307               </td> 
    4308               <td style="background-color:'.$color.'"> 
    4309                 <center>'.$coupon["date_issued"].'</center> 
    4310               </td> 
    4311               <!-- td style="background-color:'.$color.'"> 
    4312                 <center>'.$coupon["expiration"].'</center> 
    4313               </td --> 
    4314               <td style="background-color:'.$color.'"> 
    4315                 <center>'.$coupon["credits"].'</center> 
    4316               </td> 
    4317               <td style="background-color:'.$color.'"> 
    4318                 <center>'.$coupon["money"].'</center> 
    4319               </td> 
    4320               <td style="background-color:'.$color.'"> 
    4321                 <center>'.$coupon["item_id"].'</center> 
    4322               </td> 
    4323               <td style="background-color:'.$color.'"> 
    4324                 <center>'.$coupon["item_count"].'</center> 
    4325               </td> 
    4326               <td style="background-color:'.$color.'"> 
    4327                 <center>'.$coupon["raffle_id"].'</center> 
    4328               </td> 
    4329               <td style="background-color:'.$color.'"> 
    4330                 <center>'.$usage.'</center> 
    4331               </td> 
    4332               <td style="background-color:'.$color.'"> 
    4333                 <center><img src="img/'.( ( $coupon["enabled"] ) ? 'up' : 'down' ).'.gif" alt="" /></center> 
    4334               </td> 
    4335             </tr>'; 
    4336  
    4337           $color = ( ( $color == "#EEEEEE" ) ? "#FFFFFF" : "#EEEEEE" ); 
    4338         } 
    4339         $output .= ' 
    4340               <tr> 
    4341                 <td style="background-color:'.$color.'"> 
    4342                   <a href="admin.php?section=pointsystem&amp;subsection=coupons&amp;addcoupon=addcoupon"> 
    4343                     <img src="img/add.png" alt="" /> 
    4344                   </a> 
    4345                 </td> 
    4346                 <td style="background-color:'.$color.'" colspan="13"> 
    4347                   <a href="admin.php?section=pointsystem&amp;subsection=coupons&amp;addcoupon=addcoupon">'.lang("admin", "addcoupon").'</a> 
    4348                 </td> 
    4349               </tr> 
    4350           </table> 
    4351         </form>'; 
    4352       } 
    4353       else 
    4354       { 
    4355         if ( $coupon_action == "edit" ) 
    4356         { 
    4357           $coupon_id = $sqlm->quote_smart($_GET["sel_coupon"]); 
    4358           if ( is_numeric($coupon_id) ) 
    4359           { 
    4360             if ( !$sub_action ) 
    4361             { 
    4362               $coupon = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM point_system_coupons WHERE `entry`='".$coupon_id."'")); 
    4363  
    4364               // extract gold/silver/copper from single gold number 
    4365               $coupon["money"] = str_pad($coupon["money"], 4, "0", STR_PAD_LEFT); 
    4366               $coupon_g = substr($coupon["money"],  0, -4); 
    4367               if ( $coupon_g == '' ) 
    4368                 $coupon_g = 0; 
    4369               $coupon_s = substr($coupon["money"], -4,  2); 
    4370               if ( ( $coupon_s == '' ) || ( $coupon_s == '00' ) ) 
    4371                 $coupon_s = 0; 
    4372               $coupon_c = substr($coupon["money"], -2); 
    4373               if ( ( $coupon_c == '' ) || ( $coupon_c == '00' ) ) 
    4374                 $coupon_c = 0; 
    4375  
    4376               if ( $core == 1 ) 
    4377               { 
    4378                 $accounts_query = "SELECT * 
    4379                           FROM accounts 
    4380                             LEFT JOIN `".$corem_db["name"]."`.config_accounts ON accounts.login=`".$corem_db["name"]."`.config_accounts.Login COLLATE utf8_general_ci"; 
    4381               } 
    4382               else 
    4383               { 
    4384                 $accounts_query = "SELECT *, id AS acct, username AS login 
    4385                           FROM account 
    4386                             LEFT JOIN `".$corem_db["name"]."`.config_accounts ON account.username=`".$corem_db["name"]."`.config_accounts.Login"; 
    4387               } 
    4388  
    4389               $accounts_result = $sqll->query($accounts_query); 
    4390  
    4391               $output .= ' 
    4392               <center> 
    4393                 <form name="form" action="admin.php" method="get"> 
    4394                   <fieldset id="admin_edit_coupon"> 
    4395                     <input type="hidden" name="section" value="pointsystem" /> 
    4396                     <input type="hidden" name="subsection" value="coupons" /> 
    4397                     <input type="hidden" name="editcoupon" value="editcoupon" /> 
    4398                     <input type="hidden" name="subaction" value="savecoupon" /> 
    4399                     <input type="hidden" name="sel_coupon" value="'.$coupon["entry"].'" /> 
    4400                     <input type="hidden" name="oldcreation" value="'.$coupon["date_issued"].'" /> 
    4401                     <table> 
    4402                       <tr> 
    4403                         <td>'.lang("admin", "coupon_id").': </td> 
    4404                         <td>'.$coupon["entry"].'</td> 
    4405                       </tr> 
    4406                       <tr> 
    4407                         <td>'.lang("admin", "coupon_target").': </td> 
    4408                         <td> 
    4409                           <select name="coupon_target"> 
    4410                             <option value="0">'.lang("admin", "coupon_public").'</option> 
    4411                             <option value="-1" disabled="disabled">-</option>'; 
    4412  
    4413               while ( $row = $sqll->fetch_assoc($accounts_result) ) 
    4414               { 
    4415                 $output .= ' 
    4416                             <option value="'.$row["acct"].'" '.( ( $row["acct"] == $coupon["target"] ) ? 'selected="selected"' : '' ).'>'.$row["ScreenName"].' ('.$row["login"].')</option>'; 
    4417               } 
    4418  
    4419               $output .= ' 
    4420                           </select> 
    4421                         </td> 
    4422                       </tr> 
    4423                       <tr> 
    4424                         <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "coupon_issued_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "coupon_issued").'</a>: </td> 
    4425                         <td>'.$coupon["date_issued"].'</td> 
    4426                       </tr> 
    4427                       <tr> 
    4428                         <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "coupon_usage_limit_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "coupon_usage_limit").'</a>: </td> 
    4429                         <td> 
    4430                           <input type="text" name="coupon_usage_limit" value="'.$coupon["usage_limit"].'" class="admin_edit_coupon_fields" /> 
    4431                         </td> 
    4432                       </tr> 
    4433                       <!-- tr> 
    4434                         <td width="45%" class="help"> 
    4435                           <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "coupon_expiration_tip").'\', \'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "coupon_expiration").'</a>: 
    4436                         </td> 
    4437                         <td> 
    4438                           <input type="text" name="coupon_expiration" value="'.$coupon["expiration"].'" /> 
    4439                         </td> 
    4440                       </tr --> 
    4441                       <tr> 
    4442                         <td colspan="2"> 
    4443                           <hr /> 
    4444                         </td> 
    4445                       </tr> 
    4446                       <tr> 
    4447                         <td colspan="2"> 
    4448                           <b>'.lang("admin", "coupon_prize").'</b> 
    4449                         </td> 
    4450                       </tr> 
    4451                       <tr> 
    4452                         <td>'.lang("admin", "coupon_credits").'</a>: </td> 
    4453                         <td> 
    4454                           <input type="text" name="coupon_credits" value="'.$coupon["credits"].'" class="admin_edit_coupon_fields" /> 
    4455                         </td> 
    4456                       </tr> 
    4457                       <tr> 
    4458                         <td>'.lang("admin", "coupon_money").': </td> 
    4459                         <td> 
    4460                           <input type="text" name="coupon_money_gold" value="'.$coupon_g.'" maxlength="6" size="6"/> 
    4461                           <img src="../img/gold.gif" alt="gold" /> 
    4462                           <input type="text" name="coupon_money_silver" value="'.$coupon_s.'" maxlength="2" size="6"/> 
    4463                           <img src="../img/silver.gif" alt="gold" /> 
    4464                           <input type="text" name="coupon_money_copper" value="'.$coupon_c.'" maxlength="2" size="6"/> 
    4465                           <img src="../img/copper.gif" alt="gold" /> 
    4466                         </td> 
    4467                       </tr> 
    4468                       <tr> 
    4469                         <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "coupon_item_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "coupon_item").':</td> 
    4470                         <td> 
    4471                           <input type="text" name="coupon_item" value="'.$coupon["item_id"].'" class="admin_edit_coupon_fields" /> 
    4472                         </td> 
    4473                       </tr> 
    4474                       <tr> 
    4475                         <td>'.lang("admin", "coupon_count").':</td> 
    4476                         <td> 
    4477                           <input type="text" name="coupon_count" value="'.$coupon["item_count"].'" class="admin_edit_coupon_fields" /> 
    4478                         </td> 
    4479                       </tr> 
    4480                       <tr> 
    4481                         <td colspan="2"> 
    4482                           <hr /> 
    4483                         </td> 
    4484                       </tr> 
    4485                       <tr> 
    4486                         <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "coupon_raffle_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "coupon_raffle").'</a>:</td> 
    4487                         <td> 
    4488                           <input type="text" name="coupon_raffle_id" value="'.$coupon["raffle_id"].'" class="admin_edit_coupon_fields" /> 
    4489                         </td> 
    4490                       </tr> 
    4491                       <tr> 
    4492                         <td>'.lang("admin", "coupon_redemption_option").': </td> 
    4493                         <td> 
    4494                           <input type="radio" name="coupon_method" value="0" '.( ( $coupon["redemption_option"] == 0 ) ? 'checked="checked"' : '' ).' />'.lang("admin", "coupon_redemption_option_both").'<br /> 
    4495                           <input type="radio" name="coupon_method" value="1" '.( ( $coupon["redemption_option"] == 1 ) ? 'checked="checked"' : '' ).'/>'.lang("admin", "coupon_redemption_option_single").' 
    4496                         </td> 
    4497                       </tr> 
    4498                       <tr> 
    4499                         <td colspan="2"> 
    4500                           <hr /> 
    4501                         </td> 
    4502                       </tr> 
    4503                       <tr> 
    4504                         <td>'.lang("admin", "coupon_title").':</td> 
    4505                         <td> 
    4506                           <input type="text" name="coupon_title" value="'.$coupon["title"].'" class="admin_edit_coupon_fields" /> 
    4507                         </td> 
    4508                       </tr> 
    4509                       <tr> 
    4510                         <td>'.lang("admin", "coupon_text").': </td> 
    4511                         <td> 
    4512                           <textarea name="coupon_text" rows="2" cols="32">'.$coupon["text"].'</textarea> 
    4513                         </td> 
    4514                       </tr> 
    4515                       <tr> 
    4516                         <td colspan="2"> 
    4517                           <hr /> 
    4518                         </td> 
    4519                       </tr> 
    4520                       <tr> 
    4521                         <td>'.lang("admin", "enabled").': </td> 
    4522                         <td> 
    4523                           <input type="checkbox" name="coupon_enabled" value="1" '.( ( $coupon["enabled"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    4524                         </td> 
    4525                       </tr> 
    4526                     </table> 
    4527                   </fieldset> 
    4528                   <input type="submit" name="savecoupon" value="'.lang("admin", "save").'" /> 
    4529                 </form> 
    4530               </center>'; 
    4531             } 
    4532             else 
    4533             { 
    4534               // save coupon 
    4535               $coupon = $sqlm->quote_smart($_GET["sel_coupon"]); 
    4536               $coupon_target = $sqlm->quote_smart($_GET["coupon_target"]); 
    4537               $coupon_usage_limit = $sqlm->quote_smart($_GET["coupon_usage_limit"]); 
    4538               $coupon_old_creation = $sqlm->quote_smart($_GET["oldcreation"]); 
    4539               //$coupon_expiration = $sqlm->quote_smart($_GET["coupon_expiration"]); 
    4540               $coupon_credits = $sqlm->quote_smart($_GET["coupon_credits"]); 
    4541               $coupon_money_gold = $sqlm->quote_smart($_GET["coupon_money_gold"]); 
    4542               $coupon_money_silver = $sqlm->quote_smart($_GET["coupon_money_silver"]); 
    4543               $coupon_money_copper = $sqlm->quote_smart($_GET["coupon_money_copper"]); 
    4544               $coupon_item = $sqlm->quote_smart($_GET["coupon_item"]); 
    4545               $coupon_count = $sqlm->quote_smart($_GET["coupon_count"]); 
    4546               $coupon_raffle_id = $sqlm->quote_smart($_GET["coupon_raffle_id"]); 
    4547               $coupon_method = $sqlm->quote_smart($_GET["coupon_method"]); 
    4548               $coupon_title = $sqlm->quote_smart($_GET["coupon_title"]); 
    4549               $coupon_text = $sqlm->quote_smart($_GET["coupon_text"]); 
    4550               $coupon_enabled = ( ( isset($_GET["coupon_enabled"]) ) ? 1 : 0 ); 
    4551  
    4552               // pad 
    4553               $coupon_money_silver = str_pad($coupon_money_silver, 2, "0", STR_PAD_LEFT); 
    4554               $coupon_money_copper = str_pad($coupon_money_copper, 2, "0", STR_PAD_LEFT); 
    4555  
    4556               // combine 
    4557               $coupon_money = $coupon_money_gold.$coupon_money_silver.$coupon_money_copper; 
    4558  
    4559               if ( $coupon_old_creation == "0000-00-00 00:00:00" ) 
    4560                 $coupon_not_enabled = 1; 
    4561  
    4562               $query = "UPDATE point_system_coupons 
    4563                           SET target='".$coupon_target."', ".( ( $coupon_enabled && $coupon_not_enabled ) ? "date_issued=NOW()," : "" )." usage_limit='".$coupon_usage_limit."', 
    4564                           expiration=NOW(), credits='".$coupon_credits."', money='".$coupon_money."', 
    4565                           item_id='".$coupon_item."', item_count='".$coupon_count."', raffle_id='".$coupon_raffle_id."', 
    4566                           redemption_option='".$coupon_method."', title='".$coupon_title."', text='".$coupon_text."', 
    4567                           enabled='".$coupon_enabled."' 
    4568                         WHERE entry='".$coupon."'"; 
    4569  
    4570               $sqlm->query($query); 
    4571               redirect("admin.php?section=pointsystem&subsection=coupons&editcoupon=editcoupon&sel_coupon=".$coupon); 
    4572             } 
    4573           } 
    4574           else 
    4575             redirect("admin.php?section=pointsystem&subsection=coupons&error=1"); 
    4576         } 
    4577         elseif ( $coupon_action == "del" ) 
    4578         { 
    4579           $coupon_id = $sqlm->quote_smart($_GET["sel_coupon"]); 
    4580           if ( is_numeric($coupon_id) ) 
    4581           { 
    4582             $result = $sqlm->query("DELETE FROM point_system_coupons WHERE `entry`='".$coupon_id."'"); 
    4583             redirect("admin.php?section=pointsystem&subsection=coupons"); 
    4584           } 
    4585           else 
    4586             redirect("admin.php?section=pointsystem&subsection=coupons&error=1"); 
    4587         } 
    4588         else 
    4589         { 
    4590           $result = $sqlm->query("INSERT INTO point_system_coupons (target, credits, money, item_id, item_count, title, text, usage_limit, redemption_option, raffle_id, enabled) VALUES ('0', '0', '0', '0', '0', '', '', '1', '0', '0', '0')"); 
    4591  
    4592           redirect("admin.php?section=pointsystem&subsection=coupons"); 
    4593         } 
    4594       } 
    4595       break; 
    4596     } 
    4597     case "raffles": 
    4598     { 
    4599       $query = "SELECT * FROM point_system_raffles"; 
    4600       $result = $sqlm->query($query); 
    4601  
    4602       $raffle_action = 0; 
    4603       if ( isset($_GET["editraffle"]) ) 
    4604         $raffle_action = "edit"; 
    4605       if ( isset($_GET["delraffle"]) ) 
    4606         $raffle_action = "del"; 
    4607       if ( isset($_GET["addraffle"]) ) 
    4608         $raffle_action = "add"; 
    4609  
    4610       $sub_action = ( ( isset($_GET["subaction"]) ) ? $_GET["subaction"] : '' ); 
    4611  
    4612       $sqll = new SQL; 
    4613       $sqll->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]); 
    4614  
    4615       if ( !$raffle_action ) 
    4616       { 
    4617         $output .= ' 
    4618         <form name="form" action="admin.php" method="get"> 
    4619           <input type="hidden" name="section" value="pointsystem" /> 
    4620           <input type="hidden" name="subsection" value="raffle" /> 
    4621           <table class="simple" id="admin_point_coupon_list"> 
    4622             <tr> 
    4623               <th width="1%"></th> 
    4624               <th width="1%"></th> 
    4625               <th width="3%">'.lang("admin", "raffle_id").'</th> 
    4626               <th width="15%">'.lang("admin", "raffle_title").'</th> 
    4627               <th width="15%">'.lang("admin", "raffle_drawing").'</th> 
    4628               <th width="10%">'.lang("admin", "raffle_credits").'</th> 
    4629               <th width="5%">'.lang("admin", "raffle_money").'</th> 
    4630               <th width="5%">'.lang("admin", "raffle_item").'</th> 
    4631               <th width="5%">'.lang("admin", "raffle_count").'</th> 
    4632               <th width="5%">'.lang("admin", "raffle_usage").'</th> 
    4633               <th width="5%">'.lang("admin", "enabled").'</th> 
    4634               <th width="5%">'.lang("admin", "raffle_completed").'</th> 
    4635             </tr>'; 
    4636         $color = "#EEEEEE"; 
    4637         while ( $raffle = $sqlm->fetch_assoc($result) ) 
    4638         { 
    4639           // determine usage 
    4640           $tickets_query = "SELECT COUNT(*) FROM point_system_raffle_tickets WHERE raffle='".$raffle["entry"]."'"; 
    4641           $tickets_result = $sqlm->query($tickets_query); 
    4642           $tickets_result = $sqlm->fetch_assoc($tickets_result); 
    4643           $tickets_sold = $tickets_result["COUNT(*)"]; 
    4644  
    4645           $output .= ' 
    4646             <tr> 
    4647               <td style="background-color:'.$color.'"> 
    4648                 <center> 
    4649                   <a href="admin.php?section=pointsystem&amp;subsection=raffles&amp;sel_raffle='.$raffle["entry"].'&amp;editraffle=editraffle" onmouseover="oldtoolTip(\''.lang("admin", "edit").'\', \'info_tooltip\')" onmouseout="oldtoolTip()"> 
    4650                     <img src="img/edit.png" alt="" /> 
    4651                   </a> 
    4652                 </center> 
    4653               </td> 
    4654               <td style="background-color:'.$color.'"> 
    4655                 <center> 
    4656                   <a href="admin.php?section=pointsystem&amp;subsection=raffles&amp;sel_raffle='.$raffle["entry"].'&amp;delraffle=deleteraffle" onmouseover="oldtoolTip(\''.lang("admin", "remove").'\', \'info_tooltip\')" onmouseout="oldtoolTip()"> 
    4657                     <img src="img/aff_cross.png" alt="" /> 
    4658                   </a> 
    4659                 </center> 
    4660               </td> 
    4661               <td style="background-color:'.$color.'"> 
    4662                 <center>'.$raffle["entry"].'</center> 
    4663               </td> 
    4664               <td style="background-color:'.$color.'"> 
    4665                 <center>'.$raffle["title"].'</center> 
    4666               </td> 
    4667               <td style="background-color:'.$color.'"> 
    4668                 <center>'.$raffle["drawing"].'</center> 
    4669               </td> 
    4670               <td style="background-color:'.$color.'"> 
    4671                 <center>'.$raffle["credits"].'</center> 
    4672               </td> 
    4673               <td style="background-color:'.$color.'"> 
    4674                 <center>'.$raffle["money"].'</center> 
    4675               </td> 
    4676               <td style="background-color:'.$color.'"> 
    4677                 <center>'.$raffle["item_id"].'</center> 
    4678               </td> 
    4679               <td style="background-color:'.$color.'"> 
    4680                 <center>'.$raffle["item_count"].'</center> 
    4681               </td> 
    4682               <td style="background-color:'.$color.'"> 
    4683                 <center>'.$tickets_sold.'</center> 
    4684               </td> 
    4685               <td style="background-color:'.$color.'"> 
    4686                 <center><img src="img/'.( ( $raffle["enabled"] ) ? 'up' : 'down' ).'.gif" alt="" /></center> 
    4687               </td> 
    4688               <td style="background-color:'.$color.'"> 
    4689                 <center><img src="img/'.( ( $raffle["completed"] ) ? 'aff_tick.png' : '' ).'" alt="" /></center> 
    4690               </td> 
    4691             </tr>'; 
    4692  
    4693           $color = ( ( $color == "#EEEEEE" ) ? "#FFFFFF" : "#EEEEEE" ); 
    4694         } 
    4695         $output .= ' 
    4696               <tr> 
    4697                 <td style="background-color:'.$color.'"> 
    4698                   <a href="admin.php?section=pointsystem&amp;subsection=raffles&amp;addraffle=addraffle"> 
    4699                     <img src="img/add.png" alt="" /> 
    4700                   </a> 
    4701                 </td> 
    4702                 <td style="background-color:'.$color.'" colspan="13"> 
    4703                   <a href="admin.php?section=pointsystem&amp;subsection=raffles&amp;addraffle=addraffle">'.lang("admin", "addraffle").'</a> 
    4704                 </td> 
    4705               </tr> 
    4706           </table> 
    4707         </form>'; 
    4708       } 
    4709       else 
    4710       { 
    4711         if ( $raffle_action == "edit" ) 
    4712         { 
    4713           $raffle_id = $sqlm->quote_smart($_GET["sel_raffle"]); 
    4714           if ( is_numeric($raffle_id) ) 
    4715           { 
    4716             if ( !$sub_action ) 
    4717             { 
    4718               $raffle = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM point_system_raffles WHERE `entry`='".$raffle_id."'")); 
    4719  
    4720               // prize: extract gold/silver/copper from single gold number 
    4721               $raffle["money"] = str_pad($raffle["money"], 4, "0", STR_PAD_LEFT); 
    4722               $raffle_g = substr($raffle["money"],  0, -4); 
    4723               if ( $raffle_g == '' ) 
    4724                 $raffle_g = 0; 
    4725               $raffle_s = substr($raffle["money"], -4,  2); 
    4726               if ( ( $raffle_s == '' ) || ( $raffle_s == '00' ) ) 
    4727                 $raffle_s = 0; 
    4728               $raffle_c = substr($raffle["money"], -2); 
    4729               if ( ( $raffle_c == '' ) || ( $raffle_c == '00' ) ) 
    4730                 $raffle_c = 0; 
    4731  
    4732               // cost: extract gold/silver/copper from single gold number 
    4733               $raffle["cost_money"] = str_pad($raffle["cost_money"], 4, "0", STR_PAD_LEFT); 
    4734               $raffle_cost_g = substr($raffle["cost_money"],  0, -4); 
    4735               if ( $raffle_cost_g == '' ) 
    4736                 $raffle_cost_g = 0; 
    4737               $raffle_cost_s = substr($raffle["cost_money"], -4,  2); 
    4738               if ( ( $raffle_cost_s == '' ) || ( $raffle_cost_s == '00' ) ) 
    4739                 $raffle_cost_s = 0; 
    4740               $raffle_cost_c = substr($raffle["cost_money"], -2); 
    4741               if ( ( $raffle_cost_c == '' ) || ( $raffle_cost_c == '00' ) ) 
    4742                 $raffle_cost_c = 0; 
    4743  
    4744               $drawing = strtotime($raffle["drawing"]); 
    4745               $drawing_year = date("Y", $drawing); 
    4746               $drawing_month = date("m", $drawing); 
    4747               $drawing_day = date("d", $drawing); 
    4748               $drawing_hour = date("H", $drawing); 
    4749               $drawing_minute = date("i", $drawing); 
    4750  
    4751               if ( $drawing_year == 1969 ) 
    4752                 $drawing_year = date("Y"); 
    4753  
    4754               $output .= ' 
    4755               <center> 
    4756                 <form name="form" action="admin.php" method="get"> 
    4757                   <fieldset id="admin_edit_coupon"> 
    4758                     <input type="hidden" name="section" value="pointsystem" /> 
    4759                     <input type="hidden" name="subsection" value="raffles" /> 
    4760                     <input type="hidden" name="editraffle" value="editraffle" /> 
    4761                     <input type="hidden" name="subaction" value="saveraffle" /> 
    4762                     <input type="hidden" name="sel_raffle" value="'.$raffle["entry"].'" /> 
    4763                     <table> 
    4764                       <tr> 
    4765                         <td>'.lang("admin", "raffle_id").': </td> 
    4766                         <td>'.$raffle["entry"].'</td> 
    4767                       </tr> 
    4768                       <tr> 
    4769                         <td colspan="2"> 
    4770                           <hr /> 
    4771                         </td> 
    4772                       </tr> 
    4773                       <tr> 
    4774                         <td>'.lang("admin", "raffle_drawing").': </td> 
    4775                         <td>'.$raffle["drawing"].'</td> 
    4776                       </tr> 
    4777                       <tr> 
    4778                         <td>'.lang("admin", "raffle_drawing_year").'-'.lang("admin", "raffle_drawing_month").'-'.lang("admin", "raffle_drawing_day").': </td> 
    4779                         <td> 
    4780                           <input type="text" name="drawing_year" value="'.$drawing_year.'" maxlength="4" size="4" />&nbsp;-&nbsp; 
    4781                           <input type="text" name="drawing_month" value="'.$drawing_month.'" maxlength="2" size="2" />&nbsp;-&nbsp; 
    4782                           <input type="text" name="drawing_day" value="'.$drawing_day.'" maxlength="2" size="2" /> 
    4783                         </td> 
    4784                       </tr> 
    4785                       <tr> 
    4786                         <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "raffle_time_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "raffle_drawing_hour").'&nbsp;:&nbsp;'.lang("admin", "raffle_drawing_minute").'</a>: </td> 
    4787                         <td> 
    4788                           <input type="text" name="drawing_hour" value="'.$drawing_hour.'" maxlength="4" size="4" />&nbsp;:&nbsp; 
    4789                           <input type="text" name="drawing_minute" value="'.$drawing_minute.'" maxlength="2" size="2" /> 
    4790                         </td> 
    4791                       </tr> 
    4792                       <tr> 
    4793                         <td colspan="2"> 
    4794                           <hr /> 
    4795                         </td> 
    4796                       </tr> 
    4797                       <tr> 
    4798                         <td colspan="2"> 
    4799                           <b>'.lang("admin", "raffle_prize").'</b> 
    4800                         </td> 
    4801                       </tr> 
    4802                       <tr> 
    4803                         <td>'.lang("admin", "raffle_credits").': </td> 
    4804                         <td> 
    4805                           <input type="text" name="raffle_credits" value="'.$raffle["credits"].'" size="6" /> 
    4806                         </td> 
    4807                       </tr> 
    4808                       <tr> 
    4809                         <td>'.lang("admin", "raffle_money").': </td> 
    4810                         <td> 
    4811                           <input type="text" name="raffle_money_gold" value="'.$raffle_g.'" maxlength="6" size="6"/> 
    4812                           <img src="../img/gold.gif" alt="gold" /> 
    4813                           <input type="text" name="raffle_money_silver" value="'.$raffle_s.'" maxlength="2" size="6"/> 
    4814                           <img src="../img/silver.gif" alt="gold" /> 
    4815                           <input type="text" name="raffle_money_copper" value="'.$raffle_c.'" maxlength="2" size="6"/> 
    4816                           <img src="../img/copper.gif" alt="gold" /> 
    4817                         </td> 
    4818                       </tr> 
    4819                       <tr> 
    4820                         <td class="help"><a href="#" onmouseover="oldtoolTip(\''.lang("admin", "coupon_item_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()">'.lang("admin", "raffle_item").':</td> 
    4821                         <td> 
    4822                           <input type="text" name="raffle_item" value="'.$raffle["item_id"].'" size="6" /> 
    4823                         </td> 
    4824                       </tr> 
    4825                       <tr> 
    4826                         <td>'.lang("admin", "raffle_count").':</td> 
    4827                         <td> 
    4828                           <input type="text" name="raffle_count" value="'.$raffle["item_count"].'" size="6" /> 
    4829                         </td> 
    4830                       </tr> 
    4831                       <tr> 
    4832                         <td colspan="2"> 
    4833                           <hr /> 
    4834                         </td> 
    4835                       </tr> 
    4836                       <tr> 
    4837                         <td colspan="2" class="help"> 
    4838                           <a href="#" onmouseover="oldtoolTip(\''.lang("admin", "raffle_cost_tip").'\',\'info_tooltip\')" onmouseout="oldtoolTip()"><b>'.lang("admin", "raffle_cost").'</b></a> 
    4839                         </td> 
    4840                       </tr> 
    4841                       <tr> 
    4842                         <td>'.lang("admin", "raffle_credits").': </td> 
    4843                         <td> 
    4844                           <input type="text" name="raffle_cost_credits" value="'.$raffle["cost_credits"].'" size="6" /> 
    4845                         </td> 
    4846                       </tr> 
    4847                       <tr> 
    4848                         <td>'.lang("admin", "raffle_money").': </td> 
    4849                         <td> 
    4850                           <input type="text" name="raffle_cost_gold" value="'.$raffle_cost_g.'" maxlength="6" size="6"/> 
    4851                           <img src="../img/gold.gif" alt="gold" /> 
    4852                           <input type="text" name="raffle_cost_silver" value="'.$raffle_cost_s.'" maxlength="2" size="6"/> 
    4853                           <img src="../img/silver.gif" alt="gold" /> 
    4854                           <input type="text" name="raffle_cost_copper" value="'.$raffle_cost_c.'" maxlength="2" size="6"/> 
    4855                           <img src="../img/copper.gif" alt="gold" /> 
    4856                         </td> 
    4857                       </tr> 
    4858                       <tr> 
    4859                         <td colspan="2"> 
    4860                           <hr /> 
    4861                         </td> 
    4862                       </tr> 
    4863                       <tr> 
    4864                         <td>'.lang("admin", "raffle_title").':</td> 
    4865                         <td> 
    4866                           <input type="text" name="raffle_title" value="'.$raffle["title"].'" class="admin_edit_coupon_fields" /> 
    4867                         </td> 
    4868                       </tr> 
    4869                       <tr> 
    4870                         <td>'.lang("admin", "raffle_text").': </td> 
    4871                         <td> 
    4872                           <textarea name="raffle_text" rows="2" cols="32">'.$raffle["text"].'</textarea> 
    4873                         </td> 
    4874                       </tr> 
    4875                       <tr> 
    4876                         <td colspan="2"> 
    4877                           <hr /> 
    4878                         </td> 
    4879                       </tr> 
    4880                       <tr> 
    4881                         <td>'.lang("admin", "raffle_ticket_limit").':</td> 
    4882                         <td> 
    4883                           <input type="text" name="raffle_ticket_limit" value="'.$raffle["ticket_limit"].'" size="6" /> 
    4884                         </td> 
    4885                       </tr> 
    4886                       <tr> 
    4887                         <td>'.lang("admin", "raffle_per_user").': </td> 
    4888                         <td> 
    4889                           <input type="text" name="raffle_per_user" value="'.$raffle["tickets_per_user"].'" size="6" /> 
    4890                         </td> 
    4891                       </tr> 
    4892                       <tr> 
    4893                         <td colspan="2"> 
    4894                           <hr /> 
    4895                         </td> 
    4896                       </tr> 
    4897                       <tr> 
    4898                         <td>'.lang("admin", "raffle_announce_acct").':</td> 
    4899                         <td> 
    4900                           <input type="text" name="raffle_announce_acct" value="'.$raffle["announce_acct"].'" size="6" /> 
    4901                         </td> 
    4902                       </tr> 
    4903                       <tr> 
    4904                         <td colspan="2"> 
    4905                           <hr /> 
    4906                         </td> 
    4907                       </tr> 
    4908                       <tr> 
    4909                         <td>'.lang("admin", "enabled").': </td> 
    4910                         <td> 
    4911                           <input type="checkbox" name="raffle_enabled" value="1" '.( ( $raffle["enabled"] == 1 ) ? 'checked="checked"' : '' ).' /> 
    4912                         </td> 
    4913                       </tr> 
    4914                       <tr> 
    4915                         <td>'.lang("admin", "raffle_completed").': </td> 
    4916                         <td><img src="img/'.( ( $raffle["completed"] ) ? 'aff_tick.png' : 'aff_cross.png' ).'" alt="" /></td> 
    4917                       </tr> 
    4918                     </table> 
    4919                   </fieldset> 
    4920                   <input type="submit" name="saveraffle" value="'.lang("admin", "save").'" /> 
    4921                 </form> 
    4922               </center>'; 
    4923             } 
    4924             else 
    4925             { 
    4926               // save raffle 
    4927               $raffle = $sqlm->quote_smart($_GET["sel_raffle"]); 
    4928               $raffle_credits = $sqlm->quote_smart($_GET["raffle_credits"]); 
    4929               $raffle_money_gold = $sqlm->quote_smart($_GET["raffle_money_gold"]); 
    4930               $raffle_money_silver = $sqlm->quote_smart($_GET["raffle_money_silver"]); 
    4931               $raffle_money_copper = $sqlm->quote_smart($_GET["raffle_money_copper"]); 
    4932               $raffle_item = $sqlm->quote_smart($_GET["raffle_item"]); 
    4933               $raffle_count = $sqlm->quote_smart($_GET["raffle_count"]); 
    4934               $raffle_cost_credits = $sqlm->quote_smart($_GET["raffle_cost_credits"]); 
    4935               $raffle_cost_gold = $sqlm->quote_smart($_GET["raffle_cost_gold"]); 
    4936               $raffle_cost_silver = $sqlm->quote_smart($_GET["raffle_cost_silver"]); 
    4937               $raffle_cost_copper = $sqlm->quote_smart($_GET["raffle_cost_copper"]); 
    4938               $raffle_title = $sqlm->quote_smart($_GET["raffle_title"]); 
    4939               $raffle_text = $sqlm->quote_smart($_GET["raffle_text"]); 
    4940               $raffle_ticket_limit = $sqlm->quote_smart($_GET["raffle_ticket_limit"]); 
    4941               $raffle_per_user = $sqlm->quote_smart($_GET["raffle_per_user"]); 
    4942               $raffle_announce_acct = $sqlm->quote_smart($_GET["raffle_announce_acct"]); 
    4943               $raffle_enabled = ( ( isset($_GET["raffle_enabled"]) ) ? 1 : 0 ); 
    4944  
    4945               // drawing 
    4946               $year = $sqlm->quote_smart($_GET["drawing_year"]); 
    4947               $month = $sqlm->quote_smart($_GET["drawing_month"]); 
    4948               $day = $sqlm->quote_smart($_GET["drawing_day"]); 
    4949               $hour = $sqlm->quote_smart($_GET["drawing_hour"]); 
    4950               $minute = $sqlm->quote_smart($_GET["drawing_minute"]); 
    4951  
    4952               $drawing = $year."-".$month."-".$day." ".$hour.":".$minute.":00"; 
    4953  
    4954               // prize 
    4955               // pad 
    4956               $raffle_money_silver = str_pad($raffle_money_silver, 2, "0", STR_PAD_LEFT); 
    4957               $raffle_money_copper = str_pad($raffle_money_copper, 2, "0", STR_PAD_LEFT); 
    4958  
    4959               // combine 
    4960               $raffle_money = $raffle_money_gold.$raffle_money_silver.$raffle_money_copper; 
    4961  
    4962               // cost 
    4963               // pad 
    4964               $raffle_cost_silver = str_pad($raffle_cost_silver, 2, "0", STR_PAD_LEFT); 
    4965               $raffle_cost_copper = str_pad($raffle_cost_copper, 2, "0", STR_PAD_LEFT); 
    4966  
    4967               // combine 
    4968               $raffle_cost = $raffle_cost_gold.$raffle_cost_silver.$raffle_cost_copper; 
    4969  
    4970               $query = "UPDATE point_system_raffles 
    4971                           SET drawing='".$drawing."', credits='".$raffle_credits."', money='".$raffle_money."', 
    4972                           item_id='".$raffle_item."', item_count='".$raffle_count."', 
    4973                           title='".$raffle_title."', text='".$raffle_text."', 
    4974                           cost_credits='".$raffle_cost_credits."', cost_money='".$raffle_cost."', 
    4975                           ticket_limit='".$raffle_ticket_limit."', tickets_per_user='".$raffle_per_user."', 
    4976                           announce_acct='".$raffle_announce_acct."', enabled='".$raffle_enabled."' 
    4977                         WHERE entry='".$raffle."'"; 
    4978  
    4979               $sqlm->query($query); 
    4980               redirect("admin.php?section=pointsystem&subsection=raffles&editraffle=editraffle&sel_raffle=".$raffle); 
    4981             } 
    4982           } 
    4983           else 
    4984             redirect("admin.php?section=pointsystem&subsection=raffles&error=1"); 
    4985         } 
    4986         elseif ( $raffle_action == "del" ) 
    4987         { 
    4988           $raffle_id = $sqlm->quote_smart($_GET["sel_raffle"]); 
    4989           if ( is_numeric($raffle_id) ) 
    4990           { 
    4991             $result = $sqlm->query("DELETE FROM point_system_raffles WHERE `entry`='".$raffle_id."'"); 
    4992             redirect("admin.php?section=pointsystem&subsection=raffles"); 
    4993           } 
    4994           else 
    4995             redirect("admin.php?section=pointsystem&subsection=raffles&error=1"); 
    4996         } 
    4997         else 
    4998         { 
    4999           $result = $sqlm->query("INSERT INTO point_system_raffles (credits, money, item_id, item_count, title, text, cost_credits, cost_money, tickets_per_user, ticket_limit, announce_acct, winner, enabled, completed) VALUES ('0', '0', '0', '0', '', '', '0', '0', '1', '1', '1', '0', '0', '0')"); 
    5000  
    5001           redirect("admin.php?section=pointsystem&subsection=raffles"); 
    5002         } 
    5003       } 
    5004       break; 
    5005     } 
    5006     case "bags": 
    5007     { 
    5008       $query = "SELECT * FROM point_system_prize_bags"; 
    5009       $result = $sqlm->query($query); 
    5010  
    5011       $bag_action = 0; 
    5012       if ( isset($_GET["editbag"]) ) 
    5013         $bag_action = "edit"; 
    5014       if ( isset($_GET["delbag"]) ) 
    5015         $bag_action = "del"; 
    5016       if ( isset($_GET["addbag"]) ) 
    5017         $bag_action = "add"; 
    5018  
    5019       $sub_action = ( ( isset($_GET["subaction"]) ) ? $_GET["subaction"] : '' ); 
    5020  
    5021       $sqll = new SQL; 
    5022       $sqll->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]); 
    5023  
    5024       if ( !$bag_action ) 
    5025       { 
    5026         $output .= ' 
    5027         <form name="form" action="admin.php" method="get"> 
    5028           <input type="hidden" name="section" value="pointsystem" /> 
    5029           <input type="hidden" name="subsection" value="raffle" /> 
    5030           <table class="simple" id="admin_point_bag_list"> 
    5031             <tr> 
    5032               <th width="1%"></th> 
    5033               <th width="1%"></th> 
    5034               <th width="4%">'.lang("admin", "bag_id").'</th> 
    5035               <th width="47%">'.lang("admin", "bag_slots").'</th> 
    5036               <th width="47%">'.lang("admin", "bag_owner").'</th> 
    5037             </tr>'; 
    5038         $color = "#EEEEEE"; 
    5039         while ( $bag = $sqlm->fetch_assoc($result) ) 
    5040         { 
    5041           if ( $core == 1 ) 
    5042             $owner_query = "SELECT login FROM accounts WHERE acct='".$bag["owner"]."'"; 
    5043           else 
    5044             $owner_query = "SELECT username AS login FROM account WHERE id='".$bag["owner"]."'"; 
    5045  
    5046           $owner_result = $sqll->query($owner_query); 
    5047  
    5048           if ( $sqll->num_rows($owner_result) > 0 ) 
    5049           { 
    5050             $owner_result = $sqll->fetch_assoc($owner_result); 
    5051             $owner = $owner_result["login"]; 
    5052           } 
    5053           else 
    5054             $owner = '<b>'.lang("admin", "bag_no_owner").'</b>'; 
    5055  
    5056           $output .= ' 
    5057             <tr> 
    5058               <td style="background-color:'.$color.'"> 
    5059                 <center> 
    5060                   <a href="admin.php?section=pointsystem&amp;subsection=bags&amp;sel_bag='.$bag["entry"].'&amp;editbag=editbag" onmouseover="oldtoolTip(\''.lang("admin", "edit").'\', \'info_tooltip\')" onmouseout="oldtoolTip()"> 
    5061                     <img src="img/edit.png" alt="" /> 
    5062                   </a> 
    5063                 </center> 
    5064               </td> 
    5065               <td style="background-color:'.$color.'"> 
    5066                 <center> 
    5067                   <a href="admin.php?section=pointsystem&amp;subsection=bags&amp;sel_bag='.$bag["entry"].'&amp;delbag=deletebag" onmouseover="oldtoolTip(\''.lang("admin", "remove").'\', \'info_tooltip\')" onmouseout="oldtoolTip()"> 
    5068                     <img src="img/aff_cross.png" alt="" /> 
    5069                   </a> 
    5070                 </center> 
    5071               </td> 
    5072               <td style="background-color:'.$color.'"> 
    5073                 <center>'.$bag["entry"].'</center> 
    5074               </td> 
    5075               <td style="background-color:'.$color.'"> 
    5076                 <center>'.$bag["slots"].'</center> 
    5077               </td> 
    5078               <td style="background-color:'.$color.'"> 
    5079                 <center>'.$owner.'</center> 
    5080               </td> 
    5081             </tr>'; 
    5082  
    5083           $color = ( ( $color == "#EEEEEE" ) ? "#FFFFFF" : "#EEEEEE" ); 
    5084         } 
    5085         $output .= ' 
    5086               <tr> 
    5087                 <td style="background-color:'.$color.'"> 
    5088                   <a href="admin.php?section=pointsystem&amp;subsection=bags&amp;addbag=addbag"> 
    5089                     <img src="img/add.png" alt="" /> 
    5090                   </a> 
    5091                 </td> 
    5092                 <td style="background-color:'.$color.'" colspan="13"> 
    5093                   <a href="admin.php?section=pointsystem&amp;subsection=bags&amp;addbag=addbag">'.lang("admin", "addbag").'</a> 
    5094                 </td> 
    5095               </tr> 
    5096           </table> 
    5097         </form>'; 
    5098       } 
    5099       else 
    5100       { 
    5101         if ( $bag_action == "edit" ) 
    5102         { 
    5103           $bag_id = $sqlm->quote_smart($_GET["sel_bag"]); 
    5104           if ( is_numeric($bag_id) ) 
    5105           { 
    5106             if ( !$sub_action ) 
    5107             { 
    5108               $bag = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM point_system_prize_bags WHERE `entry`='".$bag_id."'")); 
    5109  
    5110               if ( $core == 1 ) 
    5111                 $owner_query = "SELECT login FROM accounts WHERE acct='".$bag["owner"]."'"; 
    5112               else 
    5113                 $owner_query = "SELECT username AS login FROM account WHERE id='".$bag["owner"]."'"; 
    5114  
    5115               $owner_result = $sqll->query($owner_query); 
    5116  
    5117               if ( $sqll->num_rows($owner_result) > 0 ) 
    5118               { 
    5119                 $owner_result = $sqll->fetch_assoc($owner_result); 
    5120                 $owner = $owner_result["login"]; 
    5121               } 
    5122               else 
    5123                 $owner = '<b>'.lang("admin", "bag_no_owner").'</b>'; 
    5124  
    5125               $output .= ' 
    5126               <center> 
    5127                 <form name="form" action="admin.php" method="get"> 
    5128                   <fieldset id="admin_edit_coupon"> 
    5129                     <input type="hidden" name="section" value="pointsystem" /> 
    5130                     <input type="hidden" name="subsection" value="bags" /> 
    5131                     <input type="hidden" name="editbag" value="editbag" /> 
    5132                     <input type="hidden" name="subaction" value="savebag" /> 
    5133                     <input type="hidden" name="sel_bag" value="'.$bag["entry"].'" /> 
    5134                     <table> 
    5135                       <tr> 
    5136                         <td>'.lang("admin", "bag_id").': </td> 
    5137                         <td>'.$bag["entry"].'</td> 
    5138                       </tr> 
    5139                       <tr> 
    5140                         <td>'.lang("admin", "bag_owner").': </td> 
    5141                         <td>'.$owner.'</td> 
    5142                       </tr> 
    5143                       <tr> 
    5144                         <td colspan="2"> 
    5145                           <hr /> 
    5146                         </td> 
    5147                       </tr> 
    5148                       <tr> 
    5149                         <td>'.lang("admin", "bag_slots").': </td> 
    5150                         <td> 
    5151                           <select name="slots"> 
    5152                             <option value="4" '.( ( $bag["slots"] == 4 ) ? 'selected="selected"' : '' ).'>4</option> 
    5153                             <option value="6" '.( ( $bag["slots"] == 6 ) ? 'selected="selected"' : '' ).'>6</option> 
    5154                             <option value="8" '.( ( $bag["slots"] == 8 ) ? 'selected="selected"' : '' ).'>8</option> 
    5155                             <option value="10" '.( ( $bag["slots"] == 10 ) ? 'selected="selected"' : '' ).'>10</option> 
    5156                             <option value="12" '.( ( $bag["slots"] == 12 ) ? 'selected="selected"' : '' ).'>12</option> 
    5157                             <option value="14" '.( ( $bag["slots"] == 14 ) ? 'selected="selected"' : '' ).'>14</option> 
    5158                             <option value="16" '.( ( $bag["slots"] == 16 ) ? 'selected="selected"' : '' ).'>16</option> 
    5159                             <option value="18" '.( ( $bag["slots"] == 18 ) ? 'selected="selected"' : '' ).'>18</option> 
    5160                             <option value="20" '.( ( $bag["slots"] == 20 ) ? 'selected="selected"' : '' ).'>20</option> 
    5161                             <option value="22" '.( ( $bag["slots"] == 22 ) ? 'selected="selected"' : '' ).'>22</option> 
    5162                             <option value="24" '.( ( $bag["slots"] == 24 ) ? 'selected="selected"' : '' ).'>24</option> 
    5163                             <option value="26" '.( ( $bag["slots"] == 26 ) ? 'selected="selected"' : '' ).'>26</option> 
    5164                             <option value="28" '.( ( $bag["slots"] == 28 ) ? 'selected="selected"' : '' ).'>28</option> 
    5165                             <option value="30" '.( ( $bag["slots"] == 30 ) ? 'selected="selected"' : '' ).'>30</option> 
    5166                             <option value="32" '.( ( $bag["slots"] == 32 ) ? 'selected="selected"' : '' ).'>32</option> 
    5167                             <option value="34" '.( ( $bag["slots"] == 34 ) ? 'selected="selected"' : '' ).'>34</option> 
    5168                             <option value="36" '.( ( $bag["slots"] == 36 ) ? 'selected="selected"' : '' ).'>36</option> 
    5169                           </select> 
    5170                         </td> 
    5171                       </tr> 
    5172                       <tr> 
    5173                         <td colspan="2"> 
    5174                           <hr /> 
    5175                         </td> 
    5176                       </tr> 
    5177                       <tr> 
    5178                         <td valign="top" align="center"> 
    5179                           <span>'.lang("admin", "bag_simulation").'</span> 
    5180                           <div class="bag" style="width:'.(4*43).'px;height:'.(ceil($bag["slots"]/4)*41).'px;">'; 
    5181  
    5182               $dsp = $bag["slots"]%4; 
    5183  
    5184               if ( $dsp ) 
    5185                 $output .= ' 
    5186                             <div class="no_slot"></div>'; 
    5187  
    5188               // get bag items 
    5189               $items_query = "SELECT item_id, slot, item_count FROM point_system_prize_bag_items WHERE `bag`='".$bag_id."'"; 
    5190               $items_result = $sqlm->query($items_query); 
    5191  
    5192               // create a empty bag array and fill it with nothing 
    5193               $items = array(); 
    5194               for ( $i = 0; $i < $bag["slots"]; $i++ ) 
    5195                 $items[] = array("item_id" => 0, "slot" => 0, "item_count" => 0); 
    5196  
    5197               while ( $item = $sqlm->fetch_assoc($items_result) ) 
    5198               { 
    5199                 $item["item_count"] = ( ( $item["item_count"] == 1 ) ? "" : $item["item_count"] ); 
    5200                 // this_is_junk: style left hardcoded because it's calculated. 
    5201                 $output .= ' 
    5202                             <div class="bag_slot" style="left:'.(($item["slot"]+$dsp)%4*44).'px;top:'.((floor(($item["slot"]+$dsp)/4)*41)+3).'px;"> 
    5203                               <img src="'.get_item_icon($item["item_id"]).'" alt="" class="item_img" />'; 
    5204                 $output .= ' 
    5205                               <div class="points_bag_quantity_shadow">'.$item["item_count"].'</div> 
    5206                               <div class="points_bag_quantity">'.$item["item_count"].'</div>'; 
    5207                 $output .= ' 
    5208                             </div>'; 
    5209  
    5210                 $item["item_count"] = ( ( $item["item_count"] == "" ) ? 1 : $item["item_count"] ); 
    5211  
    5212                 $items[$item["slot"]] = $item; 
    5213               } 
    5214  
    5215               $output .= ' 
    5216                           </div> 
    5217                         </td> 
    5218                         <td> 
    5219                           <table> 
    5220                             <tr> 
    5221                               <td>'.lang("admin", "bag_slot").'</td> 
    5222                               <td align="center">'.lang("admin", "bag_item").'</td> 
    5223                               <td align="center">'.lang("admin", "bag_item_count").'</td> 
    5224                             </tr>'; 
    5225  
    5226               for ( $i = 0; $i < $bag["slots"]; $i++ ) 
    5227               { 
    5228                 $output .= ' 
    5229                             <tr> 
    5230                               <td>'.($i + 1).': </td> 
    5231                               <td> 
    5232                                 <input type="text" name="slot_'.$i.'" value="'.$items[$i]["item_id"].'" size="7" /> 
    5233                               </td> 
    5234                               <td> 
    5235                                 <input type="text" name="slot_count_'.$i.'" value="'.$items[$i]["item_count"].'" size="7" /> 
    5236                               </td> 
    5237                             </tr>'; 
    5238               } 
    5239  
    5240               $output .= ' 
    5241                           </table> 
    5242                         </td> 
    5243                       </tr> 
    5244                     </table> 
    5245                   </fieldset> 
    5246                   <input type="submit" name="savebag" value="'.lang("admin", "save").'" /> 
    5247                 </form> 
    5248               </center>'; 
    5249             } 
    5250             else 
    5251             { 
    5252               // save prize bag & items 
    5253               $bag_id = $_GET["sel_bag"]; 
    5254               $slots = $_GET["slots"]; 
    5255  
    5256               $items = array(); 
    5257               $item_counts = array(); 
    5258               for ( $i = 0; $i < $slots; $i++ ) 
    5259               { 
    5260                 if ( $_GET["slot_".$i] != 0 ) 
    5261                 { 
    5262                   $items[] = $_GET["slot_".$i]; 
    5263                   $item_counts[] = $_GET["slot_count_".$i]; 
    5264                 } 
    5265               } 
    5266  
    5267               // update bag 
    5268               $query = "UPDATE point_system_prize_bags SET slots='".$slots."' WHERE entry='".$bag_id."'"; 
    5269               $sqlm->query($query); 
    5270                
    5271  
    5272               // delete existing items 
    5273               $query = "DELETE FROM point_system_prize_bag_items WHERE bag='".$bag_id."'"; 
    5274               $sqlm->query($query); 
    5275  
    5276               for ( $i = 0; $i < count($items); $i++ ) 
    5277               { 
    5278                 $query = "INSERT INTO point_system_prize_bag_items (bag, slot, item_id, item_count) VALUES ('".$bag_id."', '".$i."', '".$items[$i]."', '".$item_counts[$i]."')"; 
    5279                 $sqlm->query($query); 
    5280               } 
    5281  
    5282               redirect("admin.php?section=pointsystem&subsection=bags&editbag=editbag&sel_bag=".$bag_id); 
    5283             } 
    5284           } 
    5285           else 
    5286             redirect("admin.php?section=pointsystem&subsection=bags&error=1"); 
    5287         } 
    5288         elseif ( $bag_action == "del" ) 
    5289         { 
    5290           $bag_id = $sqlm->quote_smart($_GET["sel_bag"]); 
    5291           if ( is_numeric($bag_id) ) 
    5292           { 
    5293             $result = $sqlm->query("DELETE FROM point_system_prize_bags WHERE `entry`='".$bag_id."'"); 
    5294             $result = $sqlm->query("DELETE FROM point_system_prize_bag_items WHERE `bag`='".$bag_id."'"); 
    5295             redirect("admin.php?section=pointsystem&subsection=bags"); 
    5296           } 
    5297           else 
    5298             redirect("admin.php?section=pointsystem&subsection=bags&error=1"); 
    5299         } 
    5300         else 
    5301         { 
    5302           $result = $sqlm->query("INSERT INTO point_system_prize_bags (slots, owner) VALUES ('4', '0')"); 
    5303  
    5304           redirect("admin.php?section=pointsystem&subsection=bags"); 
    5305         } 
    5306       } 
    5307       break; 
    5308     } 
    5309     case "achieve": 
    5310     { 
    5311       $output .= 'TO DO'; 
    5312     } 
    5313   } 
    5314  
    5315   $output .= ' 
    5316       </div>'; 
    5317 } 
    5318  
    531976 
    532077//############################################################################# 
     
    5394151{ 
    5395152  case "savedbs": 
     153    require_once("admin/admin_databases_lib.php"); 
    5396154    savedbs(); 
    5397155    break; 
    5398   case "savegms": 
    5399     savegms(); 
    5400     break; 
    5401156  case "saveserver": 
     157    require_once("admin/admin_servers_lib.php"); 
    5402158    saveserver(); 
    5403159    break; 
    5404160  case "saveacct": 
     161    require_once("admin/admin_accounts_lib.php"); 
    5405162    saveacct(); 
    5406163    break; 
    5407164  case "savemenu": 
     165    require_once("admin/admin_menus_lib.php"); 
    5408166    savemenu(); 
    5409167    break; 
    5410168  case "saveforum": 
     169    require_once("admin/admin_forum_lib.php"); 
    5411170    saveforum(); 
    5412171    break; 
     
    5418177{ 
    5419178  case "databases": 
     179    require_once("admin/admin_databases_lib.php"); 
    5420180    database(); 
    5421181    break; 
    5422182  case "servers": 
     183    require_once("admin/admin_servers_lib.php"); 
    5423184    servers(); 
    5424185    break; 
    5425186  case "menus": 
     187    require_once("admin/admin_menus_lib.php"); 
    5426188    menus(); 
    5427189    break; 
    5428190  case "forum": 
     191    require_once("admin/admin_forum_lib.php"); 
    5429192    forum(); 
    5430193    break; 
    5431194  case "accounts": 
     195    require_once("admin/admin_accounts_lib.php"); 
    5432196    accounts(); 
    5433197    break; 
    5434198  case "pointsystem": 
     199    require_once("admin/admin_pointsystem_lib.php"); 
    5435200    pointsystem(); 
    5436201    break; 
    5437202  default: 
     203    require_once("admin/admin_general_lib.php"); 
    5438204    general(); 
    5439205    break;