Ir para conteúdo
  • Cadastre-se

Posts Recomendados

galera me ajuda a desbugar meu site?? é de grande importancia pra mim, agradeço desde ja e dou rep++ eu sei que é pedir de mais, mais eu preciso muito mesmo... eu vou deixar o site upado em winrar para que se voces quiserem baixar para me ajudar

 

download do meu site >> http://www.mediafire.com/file/8a4ialpbr14uh2u/Site Do Emanueldk Tibiaking.rar

eu nao sei como bota o scan dos download, desculpa

 

Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: group_id_of_acc_logged in C:\xampp\htdocs\accountmanagement.php on line 2
Notice: Undefined variable: main_content in C:\xampp\htdocs\accountmanagement.php on line 9

Notice: Undefined variable: news_content in C:\xampp\htdocs\layouts\tibiacom\layout.php on line 777
Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\createaccount.php on line 5

Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\ajax\check_account.php on line 49

Notice: Undefined variable: p in C:\xampp\htdocs\layouts\tibiacom\layout.phpon line 853
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\layouts\tibiacom\layout.phpon line 853
Notice: Undefined variable: group_id_of_acc_logged in C:\xampp\htdocs\layouts\tibiacom\layout.phpon line 866

Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\latestnews.php on line 34
Notice: Undefined variable: group_id_of_acc_logged in C:\xampp\htdocs\latestnews.php on line 197

Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\downloads.php on line 2
Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined index: name in C:\xampp\htdocs\characters.php on line 2
Notice: Undefined variable: main_content in C:\xampp\htdocs\characters.php on line 4

Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\whoisonline.php on line 94
Notice: Undefined variable: cached in C:\xampp\htdocs\whoisonline.php on line 152

Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined index: list in C:\xampp\htdocs\highscores.php on line 2
Notice: Undefined index: page in C:\xampp\htdocs\highscores.php on line 3
Notice: Undefined index: world in C:\xampp\htdocs\highscores.php on line 55
Notice: Undefined variable: idd in C:\xampp\htdocs\highscores.php on line 55
Notice: Undefined variable: idd in C:\xampp\htdocs\highscores.php on line 57
Notice: Undefined variable: world_n in C:\xampp\htdocs\highscores.php on line 58
Notice: Undefined variable: main_content in C:\xampp\htdocs\highscores.php on line 73
Notice: Undefined variable: show_link_to_next_page in C:\xampp\htdocs\highscores.php on line 112
Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\killstatistics.php on line 63

Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\wars.php on line 8
Notice: Undefined variable: stats in C:\xampp\htdocs\wars.php on line 90
Notice: Undefined variable: invi in C:\xampp\htdocs\wars.php on line 165
Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\bans.php on line 6

Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\guilds.php on line 29
Notice: Undefined index: world in C:\xampp\htdocs\guilds.php on line 39

Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\topguilds.php on line 4

Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\calendario.php on line 3
Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\task.php on line 2
Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\boss.php on line 90
Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\team.php on line 15

Notice: Undefined variable: group_id_of_acc_logged in C:\xampp\htdocs\layouts\tibiacom\layout.phpon line 758
Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\buypoints.php on line 6
Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\shopsystem.php on line 208
Notice: Undefined index: vipdays in C:\xampp\htdocs\shopsystem.php on line 211
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\shopsystem.php on line 211
Notice: Undefined index: container in C:\xampp\htdocs\shopsystem.php on line 245
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\shopsystem.php on line 245
Notice: Undefined index: itemlogout in C:\xampp\htdocs\shopsystem.php on line 255
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\shopsystem.php on line 255
Notice: Undefined index: pacc in C:\xampp\htdocs\shopsystem.php on line 268
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\shopsystem.php on line 268
Notice: Undefined index: sqliteDatabase in C:\xampp\htdocs\config-and-functions.php on line 30
Notice: Undefined variable: file_data in C:\xampp\htdocs\config-and-functions.php on line 455
Notice: Undefined index: action in C:\xampp\htdocs\index.php on line 14
Notice: Undefined index: account_login in C:\xampp\htdocs\index.php on line 36
Notice: Undefined index: password_login in C:\xampp\htdocs\index.php on line 37
Notice: Undefined variable: main_content in C:\xampp\htdocs\confirmacao.php on line 2

 

config-and-functons.php

<?PHP
// ###################### CONFIG ########################
//load page config file
$config['site'] = parse_ini_file('config/config.ini');
include('config/config.php');
//check install
if($config['site']['install'] != "no")
{
header("Location: install.php");
exit;
}
//load server config
$config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
if(isset($config['server']['mysqlHost']))
{
//new (0.2.6+) ots config.lua file
$mysqlhost = $config['server']['mysqlHost'];
$mysqluser = $config['server']['mysqlUser'];
$mysqlpass = $config['server']['mysqlPass'];
$mysqldatabase = $config['server']['mysqlDatabase'];
}
elseif(isset($config['server']['sqlHost']))
{
//old (0.2.4) ots config.lua file
$mysqlhost = $config['server']['sqlHost'];
$mysqluser = $config['server']['sqlUser'];
$mysqlpass = $config['server']['sqlPass'];
$mysqldatabase = $config['server']['sqlDatabase'];
}
$sqlitefile = $config['server']['sqliteDatabase'];
$passwordency = '';
if(strtolower($config['server']['encryptionType']) == 'md5')
$passwordency = 'md5';
if(strtolower($config['server']['encryptionType']) == 'sha1')
$passwordency = 'sha1';
// loads #####POT mainfile#####
include('pot/OTS.php');
// PDO and POT connects to database
$ots = POT::getInstance();
if(strtolower($config['server']['sqlType']) == "mysql")
{
//connect to MySQL database
try
{
$ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase) );
}
catch(PDOException $error)
{
echo 'Database error - can\'t connect to MySQL database. Possible reasons:<br>1. MySQL server is not running on host.<br>2. MySQL user, password, database or host isn\'t configured in: <b>'.$config['site']['server_path'].'config.lua</b> .<br>3. MySQL user, password, database or host is wrong.';
exit;
}
}
elseif(strtolower($config['server']['sqlType']) == "sqlite")
{
//connect to SQLite database
$link_to_sqlitedatabase = $config['site']['server_path'].$sqlitefile;
try
{
$ots->connect(POT::DB_SQLITE, array('database' => $link_to_sqlitedatabase));
}
catch(PDOException $error)
{
echo 'Database error - can\'t open SQLite database. Possible reasons:<br><b>'.$link_to_sqlitedatabase.'</b> - file isn\'t valid SQLite database.<br><b>'.$link_to_sqlitedatabase.'</b> - doesn\'t exist.<br><font color="red">Wrong PHP configuration. Default PHP does not work with SQLite databases!</font>';
exit;
}
}
else
{
echo 'Database error. Unknown database type in <b>'.$config['site']['server_path'].'config.lua</b> . Must be equal to: "<b>mysql</b>" or "<b>sqlite</b>". Now is: "<b>'.strtolower($config['server']['sqlType']).'"</b>';
exit;
}

$SQL = POT::getInstance()->getDBHandle();
$layout_name = "layouts/".$layout_name = $config['site']['layout'];;
$layout_ini = parse_ini_file($layout_name.'/layout_config.ini');
foreach($layout_ini as $key => $value)
$config['site'][$key] = $value;
//###################### FUNCTIONS ######################
function isPremium($premdays, $lastday)
{
return ($premdays - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $lastday))) - date("z", $lastday)) > 0);
}
//save config in ini file
function saveconfig_ini($config)
{
$file = fopen("config/config.ini", "w");
foreach($config as $param => $data)
{
$file_data .= $param.' = "'.str_replace('"', '', $data).'"
';
}
rewind($file);
fwrite($file, $file_data);
fclose($file);
}
//return password to db
function password_ency($password)
{
$ency = $GLOBALS['passwordency'];
if($ency == 'sha1')
return sha1($password);
elseif($ency == 'md5')
return md5($password);
elseif($ency == '')
return $password;
}
//delete player with name
function delete_player($name) {
$SQL = $GLOBALS['SQL'];
$player = new OTS_Player();
$player->find($name);
if($player->isLoaded()) {
try { $SQL->query("DELETE FROM player_skills WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
try { $SQL->query("DELETE FROM guild_invites WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
try { $SQL->query("DELETE FROM player_items WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
try { $SQL->query("DELETE FROM player_depotitems WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
try { $SQL->query("DELETE FROM player_spells WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
try { $SQL->query("DELETE FROM player_storage WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
try { $SQL->query("DELETE FROM player_viplist WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
try { $SQL->query("DELETE FROM player_deaths WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
try { $SQL->query("DELETE FROM player_deaths WHERE killed_by = '".$player->getId()."';"); } catch(PDOException $error) {}
$rank = $player->getRank();
if(!empty($rank)) {
$guild = $rank->getGuild();
if($guild->getOwner()->getId() == $player->getId()) {
$rank_list = $guild->getGuildRanksList();
if(count($rank_list) > 0) {
$rank_list->orderBy('level');
foreach($rank_list as $rank_in_guild) {
$players_with_rank = $rank_in_guild->getPlayersList();
$players_with_rank->orderBy('name');
$players_with_rank_number = count($players_with_rank);
if($players_with_rank_number > 0) {
foreach($players_with_rank as $player_in_guild) {
$player_in_guild->setRank();
$player_in_guild->save();
}
}
$rank_in_guild->delete();
}
$guild->delete();
}
}
}
$player->delete();
return TRUE;
}
}

//delete guild with id
function delete_guild($id) {
$guild = new OTS_Guild();
$guild->load($id);
if($guild->isLoaded()) {
$rank_list = $guild->getGuildRanksList();
if(count($rank_list) > 0) {
$rank_list->orderBy('level');
foreach($rank_list as $rank_in_guild) {
$players_with_rank = $rank_in_guild->getPlayersList();
if(count($players_with_rank) > 0) {
foreach($players_with_rank as $player_in_guild) {
$player_in_guild->setRank();
$player_in_guild->save();
}
}
$rank_in_guild->delete();
}
}
$guild->delete();
return TRUE;
}
else
return FALSE;
}

//is it valid nick?
function check_name($name)//sprawdza name
{
$temp = strspn("$name", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- [ ] '");
if ($temp != strlen($name)) {
return false;
}
else
{
$ok = "/[a-zA-Z ']{1,25}/";
return (preg_match($ok, $name))? true: false;
}
}

//is it valid nick?
function check_account_name($name)//sprawdza name
{
$temp = strspn("$name", "QWERTYUIOPASDFGHJKLZXCVBNM0123456789");
if ($temp != strlen($name))
return false;
if(strlen($name) > 32)
return false;
else
{
$ok = "/[A-Z0-9]/";
return (preg_match($ok, $name))? true: false;
}
}

//is it valid nick for new char?
function check_name_new_char($name)//sprawdza name
{
$name_to_check = strtolower($name);
//first word can't be:
//names blocked:
$names_blocked = array('gm','cm', 'god', 'tutor');
$first_words_blocked = array('gm ','cm ', 'god ','tutor ', "'", '-');
//name can't contain:
$words_blocked = array('gamemaster', 'game master', 'game-master', "game'master", '--', "''","' ", " '", '- ', ' -', "-'", "'-", 'fuck', 'sux', 'suck', 'noob', 'tutor');
foreach($first_words_blocked as $word)
if($word == substr($name_to_check, 0, strlen($word)))
return false;
if(substr($name_to_check, -1) == "'" || substr($name_to_check, -1) == "-")
return false;
if(substr($name_to_check, 1, 1) == ' ')
return false;
if(substr($name_to_check, -2, 1) == " ")
return false;
foreach($names_blocked as $word)
if($word == $name_to_check)
return false;
foreach($GLOBALS['config']['site']['monsters'] as $word)
if($word == $name_to_check)
return false;
foreach($GLOBALS['config']['site']['npc'] as $word)
if($word == $name_to_check)
return false;
for($i = 0; $i < strlen($name_to_check); $i++)
if($name_to_check[$i-1] == ' ' && $name_to_check[$i+1] == ' ')
return false;
foreach($words_blocked as $word)
if (!(strpos($name_to_check, $word) === false))
return false;
for($i = 0; $i < strlen($name_to_check); $i++)
if($name_to_check[$i] == $name_to_check[($i+1)] && $name_to_check[$i] == $name_to_check[($i+2)])
return false;
for($i = 0; $i < strlen($name_to_check); $i++)
if($name_to_check[$i-1] == ' ' && $name_to_check[$i+1] == ' ')
return false;
$temp = strspn("$name", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '");
if ($temp != strlen($name))
return false;
else
{
$ok = "/[a-zA-Z ']{1,25}/";
return (preg_match($ok, $name))? true: false;
}
}

//is rank name valid?
function check_rank_name($name)//sprawdza name
{
$temp = strspn("$name", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789-[ ] ");
if ($temp != strlen($name)) {
return false;
}
else
{
$ok = "/[a-zA-Z ]{1,60}/";
return (preg_match($ok, $name))? true: false;
}
}
//is guild name valid?
function check_guild_name($name)
{
$temp = strspn("$name", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789- ");
if ($temp != strlen($name)) {
return false;
}
else
{
$ok = "/[a-zA-Z ]{1,60}/";
return (preg_match($ok, $name))? true: false;
}
}
//is it valid password?
function check_password($pass)//sprawdza haslo
{
$temp = strspn("$pass", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890");
if ($temp != strlen($pass)) {
return false;
}
else
{
$ok = "/[a-zA-Z0-9]{1,40}/";
return (preg_match($ok, $pass))? true: false;
}
}
//is it valid e-mail?
function check_mail($email)//sprawdza mail
{
$ok = "/[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}/";
return (preg_match($ok, $email))? true: false;
}

function items_on_player($characterid, $pid)
{
global $SQL;
$item = $SQL->query("SELECT `itemtype` FROM `player_items` WHERE `pid` = '".$pid."' AND `player_id` = '".$characterid."'")->fetch();
return '<img src="images/items/' . $item['itemtype'] . '.gif" />';
}

function showCommentsCount( $date )
{
global $SQL;
$result = $SQL->query("SELECT COUNT(*) as `count` FROM `z_news_comments` WHERE `news_date` = " . (int)$date . ";")->fetch();
return (int)$result['count'];
}

function getReason($reasonId)
{
switch($reasonId)
{
case 0:
return "Offensive Name";
case 1:
return "Invalid Name Format";
case 2:
return "Unsuitable Name";
case 3:
return "Name Inciting Rule Violation";
case 4:
return "Offensive Statement";
case 5:
return "Spamming";
case 6:
return "Illegal Advertising";
case 7:
return "Off-Topic Public Statement";
case 8:
return "Non-English Public Statement";
case 9:
return "Inciting Rule Violation";
case 10:
return "Bug Abuse";
case 11:
return "Game Weakness Abuse";
case 12:
return "Using Unofficial Software to Play";
case 13:
return "Hacking";
case 14:
return "Multi-Clienting";
case 15:
return "Account Trading or Sharing";
case 16:
return "Threatening Gamemaster";
case 17:
return "Pretending to Have Influence on Rule Enforcement";
case 18:
return "False Report to Gamemaster";
case 19:
return "Destructive Behaviour";
case 20:
return "Excessive Unjustified Player Killing";
case 21:
return "Invalid Payment";
case 22:
return "Spoiling Auction";
default:
break;
}
return "Unknown Reason";
}

//################### DISPLAY FUNCTIONS #####################
//return shorter text (news ticker)
function short_text($text, $chars_limit)
{
if (strlen($text) > $chars_limit)
return substr($text, 0, strrpos(substr($text, 0, $chars_limit), " ")).'...';
else return $text;
}
//return text to news msg
function news_place() {
if($GLOBALS['subtopic'] == "latestnews") {
//add tickers to site - without it tickers will not be showed
//$news .= $GLOBALS['news_content'];
/*
//featured article
$layout_name = $GLOBALS['layout_name'];
$news .= ' <div id="featuredarticle" class="Box">
<div class="Corner-tl" style="background-image:url('.$layout_name.'/images/content/corner-tl.gif);"></div>
<div class="Corner-tr" style="background-image:url('.$layout_name.'/images/content/corner-tr.gif);"></div>
<div class="Border_1" style="background-image:url('.$layout_name.'/images/content/border-1.gif);"></div>
<div class="BorderTitleText" style="background-image:url('.$layout_name.'/images/content/title-background-green.gif);"></div>
<img class="Title" src="'.$layout_name.'/images/strings/headline-featuredarticle.gif" alt="Contentbox headline" />
<div class="Border_2">
<div class="Border_3">
<div class="BoxContent" style="background-image:url('.$layout_name.'/images/content/scroll.gif);">
<div id=\'TeaserThumbnail\'><img src="'.$layout_name.'/images/news/features.jpg" width=150 height=100 border=0 alt="" /></div><div id=\'TeaserText\'><div style="position: relative; top: -2px; margin-bottom: 2px;" >
<b>Tutaj wpisz tytul</b></div>
tutaj wpisz tresc newsa<br>
zdjecie laduje sie w <i>tibiacom/images/news/features.jpg</i><br>
skad sie laduje mozesz zmienic linijke ponad komentarzem
</div> </div>
</div>
</div>
<div class="Border_1" style="background-image:url('.$layout_name.'/images/content/border-1.gif);"></div>
<div class="CornerWrapper-b"><div class="Corner-bl" style="background-image:url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
<div class="CornerWrapper-b"><div class="Corner-br" style="background-image:url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
</div>';
*/
}
return $news;
}
//set monster of week
function logo_monster() {
return str_replace(" ", "", trim(mb_strtolower($GLOBALS['layout_ini']['logo_monster'])));
}
$statustimeout = 1;
foreach(explode("*", str_replace(" ", "", $config['server']['statusTimeout'])) as $status_var)
if($status_var > 0)
$statustimeout = $statustimeout * $status_var;
$statustimeout = $statustimeout / 1000;
$config['status'] = parse_ini_file('config/serverstatus');
if($config['status']['serverStatus_lastCheck']+$statustimeout < time())
{
$config['status']['serverStatus_checkInterval'] = $statustimeout+3;
$config['status']['serverStatus_lastCheck'] = time();
$info = chr(6).chr(0).chr(255).chr(255).'info';
$sock = @fsockopen($config['server']['ip'], $config['server']['statusPort'], $errno, $errstr, 1);
if ($sock)
{
fwrite($sock, $info);
$data='';
while (!feof($sock))
$data .= fgets($sock, 1024);
fclose($sock);
preg_match('/players online="(\d+)" max="(\d+)"/', $data, $matches);
$config['status']['serverStatus_online'] = 1;
$config['status']['serverStatus_players'] = $matches[1];
$config['status']['serverStatus_playersMax'] = $matches[2];
preg_match('/uptime="(\d+)"/', $data, $matches);
$h = floor($matches[1] / 3600);
$m = floor(($matches[1] - $h*3600) / 60);
$config['status']['serverStatus_uptime'] = $h.'h '.$m.'m';
preg_match('/monsters total="(\d+)"/', $data, $matches);
$config['status']['serverStatus_monsters'] = $matches[1];
}
else
{
$config['status']['serverStatus_online'] = 0;
$config['status']['serverStatus_players'] = 0;
$config['status']['serverStatus_playersMax'] = 0;
}
$file = fopen("config/serverstatus", "w");
foreach($config['status'] as $param => $data)
{
$file_data .= $param.' = "'.str_replace('"', '', $data).'"
';
}
rewind($file);
fwrite($file, $file_data);
fclose($file);
}

//PAGE VIEWS COUNTER :)
$views_counter = "usercounter.dat";
// checking if the file exists
if (file_exists($views_counter)) {
// het bestand bestaat, waarde + 1
$actie = fopen($views_counter, "r+");
$page_views = fgets($actie, 9);
$page_views++;
rewind($actie);
fputs($actie, $page_views, 9);
fclose($actie);
}
else
{
// the file doesn't exist, creating a new one with value 1
$actie = fopen($views_counter, "w");
$page_views = 1;
fputs($actie, $page_views, 9);
fclose($actie);
}

function makeOrder($arr, $order, $default) {
// Function by Colandus!
$type = 'asc';
if(isset($_GET['order'])) {
$v = explode('_', strrev($_GET['order']), 2);
if(count($v) == 2)
if($orderBy = $arr[strrev($v[1])])
$default = $orderBy;
$type = (strrev($v[0]) == 'asc' ? 'desc' : 'asc');
}

return 'ORDER BY ' . $default . ' ' . $type;
}

function getOrder($arr, $order, $this) {
// Function by Colandus!
$type = 'asc';
if($orderBy = $arr[$this])
if(isset($_GET[$order])) {
$v = explode('_', strrev($_GET[$order]), 2);
if(strrev($v[1]) == $this)
$type = (strrev($v[0]) == 'asc' ? 'desc' : 'asc');
}

return $this . '_' . $type;
}

// Parse smiley bbcode into HTML images
function parsesmileys($message)
{
    foreach(array(
        "/\:\)/si" => "<img src='images/smiley/smile.gif' title='Smile'>",
        "/\;\)/si" => "<img src='images/smiley/wink.gif' title='Wink'>",
        "/\:\(/si" => "<img src='images/smiley/sad.gif' title='Sad'>",
        "/\:\|/si" => "<img src='images/smiley/frown.gif' title='Frown'>",
        "/\:o/si" => "<img src='images/smiley/shock.gif' title='Shock'>",
        "/\:p/si" => "<img src='images/smiley/pfft.gif' title='Pfft!'>",
        "/b\)/si" => "<img src='images/smiley/cool.gif' title='Cool...'>",
        "/\:d/si" => "<img src='images/smiley/grin.gif' title='Grin'>",
        "/\:@/si" => "<img src='images/smiley/angry.gif' title='Angry'>",
        "/\:rol:/si" => "<img title='Rolleyes...' src='images/smiley/roll.gif'>",
        "/\:uhoh:/si" => "<img title='Uh-Oh!' src='images/smiley/uhoh.gif'>",
        "/\:no:/si" => "<img title='Nope' src='images/smiley/no.gif'>",
        "/\:shy:/si" => "<img title='Shy' src='images/smiley/shy.gif'>",
        "/\:lol:/si" => "<img title='Laugh' src='images/smiley/laugh.gif'>",
        "/\:rip:/si" => "<img title='Dead...' src='images/smiley/dead.gif'>",
        "/\:yes:/si" => "<img title='Yeah' src='images/smiley/yes.gif'>",
        "/\:mad:/si" => "<img title='Mad' src='images/smiley/mad.gif'>",
        "/\:bigeek:/si" => "<img title='Big eek!' src='images/smiley/bigeek.gif'>",
        "/\:bigrazz:/si" => "<img title='Big razz' src='images/smiley/bigrazz.gif'>",
        "/\:smilewinkgrin:/si" => "<img title='Smile-Wink-Grin' src='images/smiley/smilewinkgrin.gif'>",
        "/\:sourgrapes:/si" => "<img title='Sour Grapes' src='images/smiley/sourgrapes.gif'>",
        "/\:confused:/si" => "<img title='Confused?' src='images/smiley/confused.gif'>",
        "/\:upset:/si" => "<img title='Upset' src='images/smiley/upset.gif'>",
        "/\:sleep:/si" => "<img title='Sleep' src='images/smiley/sleep.gif'>",
        "/\:yupi:/si" => "<img title='Yupi!' src='images/smiley/jupi.gif'>"
    ) as $key => $img)
        $message = preg_replace($key, $img, $message);

    return $message;
}

// Parse bbcode into HTML code
function parseubb($text)
{
    global $account_logged;
    $text = preg_replace('#\[b\](.*?)\[/b\]#si', '<b>\1</b>', $text);

    $text = preg_replace('#\[i\](.*?)\[/i\]#si', '<i>\1</i>', $text);
    $text = preg_replace('#\[u\](.*?)\[/u\]#si', '<u>\1</u>', $text);
    $text = preg_replace('#\[s\](.*?)\[/s\]#si', '<s>\1</s>', $text);
    $text = preg_replace('#\[center\](.*?)\[/center\]#si', '<center>\1</center>', $text);

    $text = preg_replace('#\[url\]([\r\n\s]*)(http://|ftp://|https://|ftps://)([^\s\'\"\+\(\)]*?)([\r\n\s]*)\[/url\]#sie', "'<a href=\''.str_replace('<br>', '', '\\2\\3').'\' target=\'_blank\' title=\''.str_replace('<br>', '', '\\2\\3').'\'>\\2\\3</a>'", $text);
    $text = preg_replace('#\[url\] ([\r\n]*)([^\s\'\"\+\(\)]*?)([\r\n]*) \[/url\]#sie', "'<a href=\'http://'.str_replace('<br>', '', '\\2').'\' target=\'_blank\' title=\''.str_replace('<br>', '', '\\2').'\'>\\2</a>'", $text);
    $text = preg_replace('#\*)(http://|ftp://|https://|ftps://)([^\s\'\"\+\(\)]*?)\](.*?)([\r\n]*)\[/url\]#sie', "'<a href=\''.str_replace('<br>', '', '\\2\\3').'\' target=\'_blank\' title=\''.str_replace('<br>', '', '\\2\\3').'\'>\\4</a>'", $text);
    $text = preg_replace('#\*)([^\s\'\"\+\(\)]*?)\](.*?)([\r\n]*)\[/url\]#sie', "'<a href=\'http://'.str_replace('<br>', '', '\\2').'\' target=\'_blank\' title=\''.str_replace('<br>', '', '\\2').'\'>\\3</a>'", $text);

    $text = preg_replace('#\[mail\]([\r\n]*)([^\s\'\";:\+]*?)([\r\n]*)\[/mail\]#si', '<a href=\'mailto:\2\'>\2</a>', $text);
    $text = preg_replace('#\[mail=([\r\n]*)([^\s\'\";:\+]*?)\](.*?)([\r\n]*)\[/mail\]#si', '<a href=\'mailto:\2\'>\2</a>', $text);

    $text = preg_replace('#\[small\](.*?)\[/small\]#si', '<small>\1</small>', $text);
    $text = preg_replace('#\(.*?)\[/color\]#si', '<span style=\'color:\1\'>\2</span>', $text);

    if($account_logged)
        $text = preg_replace('#\[hide\](.*?)\[/hide\]#si', '\1', $text);

    $text = preg_replace('#\(.*?)\[/size\]#si', '<span style=\'font-size: \1;\'>\2</span>', $text);
    $text = preg_replace('#\[marquee\](.*?)\[/marquee\]#si', '<marquee>\1</marquee>', $text);
    $text = preg_replace('#\[marquee=(left|down|up|right)\](.*?)\[/marquee\]#si', '<marquee direction=\'\1\'>\2</marquee>', $text);
    $text = preg_replace('#\[marquee=(left|down|up|right):(scroll|slide|alternate)\](.*?)\[/marquee\]#si', '<marquee direction=\'\1\' behavior=\'\2\'>\3</marquee>', $text);

    $text = preg_replace('#\[flash width=([0-9]*?) height=([0-9]*?)\]([^\s\'\";:\+]*?)(\.swf)\[/flash\]#si', '<object classid=\'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\' codebase=\'http://active.macromedia.com/flash6/cabs/swflash.cab#version=6,0,0,0\' id=\'\3\4\' width=\'\1\' height=\'\2\'><param name=movie value=\'\3\4\'><param name=\'quality\' value=\'high\'><param name=\'bgcolor\' value=\'#ffffff\'><embed src=\'\3\4\' quality=\'high\' bgcolor=\'#ffffff\' width=\'\1\' height=\'\2\' type=\'application/x-shockwave-flash\' pluginspage=\'http://www.macromedia.com/go/getflashplayer\'></embed></object>', $text);
    $text = preg_replace("#\[img\]((http|ftp|https|ftps)://)(.*?)(\.(jpg|jpeg|gif|png|JPG|JPEG|GIF|PNG))\[/img\]#sie","'<img src=\'\\1'.str_replace(array('.php','?','&','='),'','\\3').'\\4\' style=\'border:0px\' alt=\'\'>'",$text);

    $qcount = substr_count($text, "

");


    for($i=0;$i<$qcount;$i++)
        $text = preg_replace('#\[quote\](.*?)\[/quote\]#si', '<div class=\'quote\'>\1</div>', $text);

    $ccount = substr_count($text, "

");
    for($i=0;$i<$ccount;$i++)
        $text = preg_replace('#\[code\](.*?)\[/code\]#si', '<div class=\'quote\' style=\'width:400px;white-space:nowrap;overflow:auto\'><code style=\'white-space:nowrap\'>\1<br><br><br></code></div>', $text);

    return descript($text, false);
}

function descript($text, $striptags = true)
{
    // Convert problematic ascii characters to their true values
    $search = array("40","41","58","65","66","67","68","69","70",
        "71","72","73","74","75","76","77","78","79","80","81",
        "82","83","84","85","86","87","88","89","90","97","98",
        "99","100","101","102","103","104","105","106","107",
        "108","109","110","111","112","113","114","115","116",
        "117","118","119","120","121","122"
        );
    $replace = array("(",")",":","a","b","c","d","e","f","g","h",
        "i","j","k","l","m","n","o","p","q","r","s","t","u",
        "v","w","x","y","z","a","b","c","d","e","f","g","h",
        "i","j","k","l","m","n","o","p","q","r","s","t","u",
        "v","w","x","y","z"
        );

    $entities = count($search);
    for($i=0;$i<$entities;$i++)
        $text = preg_replace("#(&\#)(0*".$search[$i]."+);*#si", $replace[$i], $text);

    // kill hexadecimal characters completely
    $text = preg_replace('#(&\#x)([0-9A-F]+);*#si', "", $text);
    // remove any attribute starting with "on" or xmlns
    $text = preg_replace('#(<[^>]+[\\"\'\s])(onmouseover|onmousedown|onmouseup|onmouseout|onmousemove|onclick|ondblclick|onload|xmlns)[^>]*>#iU', ">", $text);
    // remove javascript: and vbscript: protocol
    $text = preg_replace('#([a-z]*)=([\`\'\"]*)script:#iU', '$1=$2nojscript...', $text);
    $text = preg_replace('#([a-z]*)=([\`\'\"]*)javascript:#iU', '$1=$2nojavascript...', $text);
    $text = preg_replace('#([a-z]*)=([\'\"]*)vbscript:#iU', '$1=$2novbscript...', $text);
        //<span style="width: expression(alert('Ping!'));"></span> (only affects ie...)
    $text = preg_replace('#(<[^>]+)style=([\`\'\"]*).*expression\([^>]*>#iU', "$1>", $text);
    $text = preg_replace('#(<[^>]+)style=([\`\'\"]*).*behaviour\([^>]*>#iU', "$1>", $text);
    if(!$striptags)
        return $text;

    do
    {
        $tmp = $text;
        $text = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $text);
    } while($tmp != $text);
    return $text;
}

function verifyimage($file)
{
    $txt = file_get_contents($file);
    if(preg_match("#([a-z]*)=([\`\'\"]*)script:#iU", $txt)) return false;
    if(preg_match("#([a-z]*)=([\`\'\"]*)javascript:#iU", $txt)) return false;
    if(preg_match("#([a-z]*)=([\'\"]*)vbscript:#iU", $txt)) return false;
    if(preg_match("#(<[^>]+)style=([\`\'\"]*).*expression\([^>]*>#iU", $txt)) return false;
    if(preg_match("#(<[^>]+)style=([\`\'\"]*).*behaviour\([^>]*>#iU", $txt)) return false;
    if(preg_match("#</*(applet|body|head|html|link|style|script|iframe|frame|frameset)[^>]*>#i", $txt)) return false;
    return true;
}

?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

index.php

<?PHP
date_default_timezone_set('Europe/Berlin');
session_start();
ob_start("ob_gzhandler");
//require('./exaBD.php');
function microtime_float() {
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();

//##### CONFIG #####
include('config-and-functions.php');
$action = $_REQUEST['action'];

//##### LOGOUT #####
if($action == "logout") {
    unset($_SESSION['account']);
    unset($_SESSION['password']);
}

//##### LOGIN #####
$logged = FALSE;
if(isset($_SESSION['account'])) {
    $account_logged = $ots->createObject('Account');
    $account_logged->load($_SESSION['account']);
    if($account_logged->isLoaded() && $account_logged->getPassword() == $_SESSION['password']) {
        $logged = TRUE;
        $group_id_of_acc_logged = $account_logged->getPageAccess();
    } else {
        $logged = FALSE;
        unset($_SESSION['account']);
        unset($account_logged);
    }
}
$login_account = strtoupper(trim($_POST['account_login']));
$login_password = trim($_POST['password_login']);
if(!$logged && !empty($login_account) && !empty($login_password)) {
    $login_password = password_ency($login_password);
    $account_logged = $ots->createObject('Account');
    $account_logged->find($login_account);
    if($account_logged->isLoaded()) {
        if($login_password == $account_logged->getPassword()) {
            $_SESSION['account'] = $account_logged->getId();
            $_SESSION['password'] = $login_password;
            $logged = TRUE;
            $account_logged->setCustomField("page_lastday", time());
            $group_id_of_acc_logged = $account_logged->getPageAccess();
        } else
            $logged = FALSE;
    }
}

//#### LOAD PAGE ##########
if(empty($_REQUEST['subtopic'])) {
    $_REQUEST['subtopic'] = "latestnews";
    $subtopic = "latestnews";
}
switch($_REQUEST['subtopic']) {

        case "latestnews":
                $topic = "Ultimas Noticias";
                $subtopic = "latestnews";
                include("latestnews.php");
        break;
        
        case "live";
            $subtopic = "live";
            $topic = "Cast ON";
            include("live.php");
        break;
        
    case "foot";
            $topic = "Football Tops";
           $subtopic = "foot";
           include("foot.php");
        break;

    case "promotions":
                $topic = "Promo&ccedil;&otilde;es";
                $subtopic = "promotions";
                include("promotions.php");
        break;
        
        case "calendario":
                $topic = "Calend&aacute;rio";
                $subtopic = "calendario";
                include("calendario.php");
        break;
        
        case "dota":
                $topic = "Dota";
                $subtopic = "dota";
                include("dota.php");
        break;
        
        case "coliseum":
                $topic = "Coliseum";
                $subtopic = "coliseum";
                include("coliseum.php");
        break;
        
                case "mount":
                $topic = "Mount";
                $subtopic = "mount";
                include("mount.php");
        break;
        
                        case "cassino":
                $topic = "Cassino";
                $subtopic = "cassino";
                include("cassino.php");
        break;
        
                                case "forj":
                $topic = "Forjamento";
                $subtopic = "forj";
                include("forj.php");
        break;

    

    case "suport":
                $topic = "Suport Online";
                $subtopic = "suportonline";
                include("suport.php");
        break;

    case "boss":
                $topic = "Bosses";
                $subtopic = "boss";
                include("boss.php");
        break;

    case "present":
                $topic = "Present Diary";
                $subtopic = "present";
                include("present.php");
        break;
        
        case "tunneltuto":
                $topic = "Tibia Tunnel Tutorial";
                $subtopic = "tunneltuto";
                include("tunneltuto.php");
        break;
        
        case "tunnel":
                $topic = "Falconia Tibia Tunnel";
                $subtopic = "tunnel";
                include("tunnel.php");
        break;
        
        case "task":
                $topic = "Task Quest";
                $subtopic = "task";
                include("task.php");
        break;

    

    case "powergamers";
                $topic = "Powergamers";
                $subtopic = "powergamers";
                include("powergamers.php");
        break;

    case "onlinetime";
            $topic = "Onlinetime";
            $subtopic = "onlinetime";
            include("onlinetime.php");
        break;

    case "domain":
                $topic = "domain";
                $subtopic = "domain";
                include("domain.php");
        break;

        case "vip":
                $topic = "VIP";
                $subtopic = "vip";
                include("vip.php");
        break; 

    case "chat";
            $topic = "chat";
            $subtopic = "chat";
            include("chat.php");
        break; 

    case "exphist";
            $subtopic = "exphist";
            $topic = "Powergamers";
            include("exphist.php");
        break;  

    case "featured":
                $topic = "Featured Article";
                $subtopic = "article";
                include("featured.php");
        break;

    case "viplist";
                $subtopic = "viplist";
                $topic = "Jogadores Vip";
                include("viplist.php");
        break;

    case "home";
                $subtopic = "home";
                $topic = "home";
                include("home.php");
        break;

        case "addons":
                $topic = "Addons";
                $subtopic = "addons";
                include("addons.php");
        break;

    
    case "detalhe";
                $topic = "Detalhes";
                $subtopic = "detalhe";
                include("detalhe.php");
        break;
        

        case "buypoints":
                $topic = "Comprar Pontos";
                $subtopic = "buypoints";
                include("buypoints.php");
        break;

        case "tradeoff";
                $topic = "Trade Off";
                $subtopic = "tradeoff";
                include("tradeoff.php");
        break;

        case "lottery";
            $subtopic = "lottery";
            $topic = "Lottery";
            include("lottery.php");
        break;

        case "wars":
                $topic = "Guild Wars";
                $subtopic = "wars";
                include("wars.php");
        break;
       
        case "creatures";
                $topic = "Monstros";
                $subtopic = "creatures";
                include("creatures.php");
        break;

        case "about";
                $topic = "Sobre o Server";
                $subtopic = "about";
                include("about.php");
        break;
       
        case "spells";
                $topic = "Magias";
                $subtopic = "spells";
                include("spells.php");
        break;
       
     case "bugtracker";
              $topic = "Bug Tracker";
             $subtopic = "bugtracker";
             include("bug.php");
    break;  

        case "experiencetable";
                $topic = "Tabela de Experiência";
                $subtopic = "experiencetable";
                include("experiencetable.php");
        break;
       
        case "characters";
                $topic = "Players";
                $subtopic = "characters";
                include("characters.php");
        break;
       
        case "whoisonline";
                $topic = "Players Online";
                $subtopic = "whoisonline";
                include("whoisonline.php");
        break;
       
        case "highscores";
                $topic = "Ranking";
                $subtopic = "highscores";
                include("highscores.php");
        break;
       
        case "killstatistics";
                $topic = "Últimas Mortes";
                $subtopic = "killstatistics";
                include("killstatistics.php");
        break;
       
        case "guilds";
                $topic = "Guilds";
                $subtopic = "guilds";
                include("guilds.php");
        break;
       
        case "accountmanagement";
                $topic = "Editar Conta";
                $subtopic = "accountmanagement";
                include("accountmanagement.php");
        break;
       
        case "createaccount";
                $topic = "Criar Conta";
                $subtopic = "createaccount";
                include("createaccount.php");
        break;
       
        case "lostaccount";
                $topic = "Perdeu sua conta?";
                $subtopic = "lostaccount";
                include("lostaccount.php");
        break;

        case "tibiarules";
                $topic = "Regras do Server";
                $subtopic = "tibiarules";
                include("tibiarules.php");
        break;

        case "adminpanel":
                $topic = "Painel do Admin";
                $subtopic = "adminpanel";
                include("adminpanel.php");
        break;

    case "admin";
           $subtopic = "admin";
           $topic = "Advanced Admin Panel";
           include("adminpro.php");
      break;  

        case "confirmacao":
                $topic = "Confirmação";
                $subtopic = "confirmacao";
                include("confirmacao.php");
        break;

        case "vantagens":
                $topic = "Vantagens";
                $subtopic = "vantagens";
                include("vantagens.php");
        break;
       
        case "forum":
                $topic = "Forum";
                $subtopic = "forum";
                include("forum.php");
        break;
       
        case "team";
                $subtopic = "Membros da Staff";
                $topic = "Support List";
                include("team.php");
        break;

        case "downloads";
                $subtopic = "Downloads";
                $topic = "Downloads";
                include("downloads.php");
        break;

        case "serverinfo";
                $subtopic = "Info do Server";
                $topic = "Server Info";
                include("serverinfo.php");
        break;

        case "shopsystem";
                $subtopic = "Loja do Server";
                $topic = "Shop Offerts";
                include("shopsystem.php");
        break;
       
        case "doacao";
                $subtopic = "doação";
                $topic = "Doacao";
                include("doacao.php");
        break;

        case "gallery";
                $subtopic = "gallery";
                $topic = "Gallery";
                include("gallery.php");
        break;
       
        case "namelock";
                $subtopic = "namelock";
                $topic = "Namelock Manager";
                include("namelocks.php");
        break;
       
        case "archive";
                $subtopic = "archive";
                $topic = "News Archives";
                include("archive.php");
        break;
       
        case "mail";
                $subtopic = "mail";
                $topic = "Mass emails sender";
                include("mail.php");
        break;

    case "shopadmin";
        $subtopic = "Loja do Admin";
        $topic = "Shop Admin";
        include("shopadmin.php");
    break;

    case "records";
        $subtopic = "Record de Players ON";
        $topic = "Players Online Records";
        include("records.php");
    break;

    case "restarter";
        $subtopic = "restarter";
        $topic = "Restarter";
        include("restarter.php");
    break;
     
    case "bans";
        $subtopic = "Banidos";
        $topic = "Ban List";
        include("bans.php");
    break;

      case "polls";
        $topic = "Enquetes";
        $subtopic = "polls";
        include("polls.php");
    break;     

    case "changelog";
            $topic = "Changelog";
           $subtopic = "changelog";
           include("changelog.php");
    break; 
    
    case "fragers";
            $topic = "Top Fragers";
           $subtopic = "fragers";
           include("fragers.php");
    break;

        case "topguild";
                 $topic = "Top Guild";
                 $subtopic = "Top Guilds";
                 include("topguilds.php");
        break;
        
        case "cast";
                 $topic = "Cast ON";
                 $subtopic = "Cast ON";
                 include("live.php");
        break;

}

if(empty($topic)) {
    $title = $GLOBALS['config']['server']["serverName"]." - OTS";
    $main_content .= 'Invalid subtopic. Can\'t load page.';
} else {
    $title = $GLOBALS['config']['server']["serverName"]." - ".$topic;
}

//#####LAYOUT#####
$layout_header = '<script type=\'text/javascript\'>
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function MouseOverBigButton(source)
{
  source.firstChild.style.visibility = "visible";
}
function MouseOutBigButton(source)
{
  source.firstChild.style.visibility = "hidden";
}
function BigButtonAction(path)
{
  window.location = path;
}
var';
if($logged) { $layout_header .= "loginStatus=1; loginStatus='true';"; } else { $layout_header .= "loginStatus=0; loginStatus='false';"; };
$layout_header .= " var activeSubmenuItem='".$subtopic."';</script>";
include($layout_name."/layout.php");
ob_end_flush();
?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

accountmanagement.php

<?PHP
if($group_id_of_acc_logged == 2)
$main_content .= '<h1>Account Manager Bloqueado.';
else
if(!$logged)
        if($action == "logout")
                $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Logout Successful</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>You have logged out of your '.$config['server']['serverName'].' account. In order to view your account you need to <a href="?subtopic=accountmanagement" >log in</a> again.</td></tr>          </table>        </div>  </table></div></td></tr>';
        else
                $main_content .= 'Please enter your account name and your password.<br/><a href="?subtopic=createaccount" >Create an account</a> if you do not have one yet.<br/><br/><form action="?subtopic=accountmanagement" method="post" ><div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Account Login</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td class="LabelV" ><span >Account Name:</span></td><td style="width:100%;" ><input type="password" name="account_login" SIZE="10" maxlength="10" ></td></tr><tr><td class="LabelV" ><span >Password:</span></td><td><input type="password" name="password_login" size="30" maxlength="29" ></td></tr>          </table>        </div>  </table></div></td></tr><br/><table width="100%" ><tr align="center" ><td><table border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=lostaccount" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Account lost?" alt="Account lost?" src="'.$layout_name.'/images/buttons/_sbutton_accountlost.gif" ></div></div></td></tr></form></table></td></tr></table>';
else
{
        if($action == "")
        {
                $account_reckey = $account_logged->getRecoveryKey();
                if(!$account_logged->isPremium())
                        $account_status = '<b><font color="red">Free Account</font></b>';
                else
                        $account_status = '<b><font color="green">Premium Account, '.$account_logged->getPremDays().' days left</font></b>';
                if(empty($account_reckey))
                        $account_registred = '<b><font color="red">No</font></b>';
                else
                        if($config['site']['generate_new_reckey'] && $config['site']['send_emails'])
                                $account_registred = '<b><font color="green">Yes ( <a href="?subtopic=accountmanagement&action=newreckey"> Buy new Rec key </a> )</font></b>';
                        else
                                $account_registred = '<b><font color="green">Yes</font></b>';
                $account_created = $account_logged->getCreated();
                $account_email = $account_logged->getEMail();
                $account_email_new_time = $account_logged->getCustomField("email_new_time");
                if($account_email_new_time > 1)
                        $account_email_new = $account_logged->getCustomField("email_new");
                $account_rlname = $account_logged->getRLName();
                $account_location = $account_logged->getLocation();
                if($account_logged->isBanned())
                        if($account_logged->getBanTime() > 0)
                                $welcome_msg = '<font color="red">Your account is banished until '.date("j F Y, G:i:s", $account_logged->getBanTime()).'!</font>';
                        else
                                $welcome_msg = '<font color="red">Your account is banished FOREVER!</font>';
                else
                        $welcome_msg = 'Welcome to your account!';
                $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" ><div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div><div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div><div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div><div class="Message" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div><div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div><table><td width="100%" align=center>';
if($config['site']['worldtransfer'] == 1)
$main_content .= '<a href="?subtopic=accountmanagement&action=charactertransfer">Character World Transfer</a>';
$main_content .= '</td><td width=50%><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=logout" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Logout" alt="Logout" src="'.$layout_name.'/images/buttons/_sbutton_logout.gif" ></div></div></td></tr></form></table></td></tr></table>    </div><div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/><center><table><tr><td><img src="'.$layout_name.'/images/content/headline-bracer-left.gif" /></td><td style="text-align:center;vertical-align:middle;horizontal-align:center;font-size:17px;font-weight:bold;" >'.$welcome_msg.'<br/></td><td><img src="'.$layout_name.'/images/content/headline-bracer-right.gif" /></td></tr></table><br/></center>';
                //if account dont have recovery key show hint
                if(empty($account_reckey))
                        $main_content .= '<div class="SmallBox" ><div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div><div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div><div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div><div class="Message" ><div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div><div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div><table><tr><td class="LabelV" >Hint:</td><td style="width:100%;" >You can register your account for increased protection. Click on "Register Account" and get your free recovery key today!</td></tr></table><div align="center" ><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=registeraccount" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Register Account" alt="Register Account" src="'.$layout_name.'/images/buttons/_sbutton_registeraccount.gif" ></div></div></td></tr></form></table></div></div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div><div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div><div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/>';
                if($account_email_new_time > 1)
                        if($account_email_new_time < time())
                                $account_email_change = '<br>(You can accept <b>'.$account_email_new.'</b> as a new email.)';
                        else
                        {
                                $account_email_change = ' <br>You can accept <b>new e-mail after '.date("j F Y", $account_email_new_time).".</b>";
                                $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="Message" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div><table><tr><td class="LabelV" >Note:</td><td style="width:100%;" >A request has been submitted to change the email address of this account to <b>'.$account_email_new.'</b>. After <b>'.date("j F Y, G:i:s", $account_email_new_time).'</b> you can accept the new email address and finish the process. Please cancel the request if you do not want your email address to be changed! Also cancel the request if you have no access to the new email address!</td></tr></table><div align="center" ><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=changeemail" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Edit" alt="Edit" src="'.$layout_name.'/images/buttons/_sbutton_edit.gif" ></div></div></td></tr></form></table></div>    </div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/><br/>';
                        }
                $main_content .= '<a name="General+Information" ></a><div class="TopButtonContainer" ><div class="TopButton" ><a href="#top" >  <image style="border:0px;" src="'.$layout_name.'/images/content/back-to-top.gif" /></a></div></div><div class="TableContainer" ><table class="Table3" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span><span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span><div class="Text" >General Information</div><span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span><span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span><span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span></div>    </div><tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td><div class="TableShadowContainerRightTop" >  <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div></div><div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" ><div class="TableContentContainer" >    <table class="TableContent" width="100%" ><tr style="background-color:'.$config['site']['darkborder'].';" ><td class="LabelV" >Email Address:</td><td style="width:90%;" >'.$account_email.''.$account_email_change.'</td></tr><tr style="background-color:'.$config['site']['lightborder'].';" ><td class="LabelV" >Created:</td><td>'.date("j F Y, G:i:s", $account_created).'</td></td><tr style="background-color:'.$config['site']['darkborder'].';" ><td class="LabelV" >Last Login:</td><td>'.date("j F Y, G:i:s", time()).'</td></tr><tr style="background-color:'.$config['site']['lightborder'].';" ><td class="LabelV" >Account Status:</td><td>'.$account_status.'</td></tr><tr style="background-color:'.$config['site']['darkborder'].';" ><td class="LabelV" >Registered:</td><td>'.$account_registred.'</td></tr></table></div></div><div class="TableShadowContainer" ><div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" ><div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div><div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>  </div></div></td></tr><tr><td><table class="InnerTableButtonRow" cellpadding="0" cellspacing="0" ><tr><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=changepassword" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Change Password" alt="Change Password" src="'.$layout_name.'/images/buttons/_sbutton_changepassword.gif" ></div></div></td></tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=changeemail" method="post" ><tr><td style="border:0px;" ><input type="hidden" name=newemail value="" ><input type="hidden" name=newemaildate value=0 ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Change Email" alt="Change Email" src="'.$layout_name.'/images/buttons/_sbutton_changeemail.gif" ></div></div></td></tr></form>      </table></td><td width="100%"></td>';
                //show button "register account"
                if(empty($account_reckey))
                        $main_content .= '<td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=registeraccount" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Register Account" alt="Register Account" src="'.$layout_name.'/images/buttons/_sbutton_registeraccount.gif" ></div></div></td></tr></form></table></td>';
                $main_content .= '</tr></table></td></tr></table></div></table></div></td></tr><br/><a name="Public+Information" ></a><div class="TopButtonContainer" ><div class="TopButton" ><a href="#top" ><image style="border:0px;" src="'.$layout_name.'/images/content/back-to-top.gif" /></a></div></div><div class="TableContainer" >  <table class="Table5" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" ><span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span><span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span><div class="Text" >Public Information</div><span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span><span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span><span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span></div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td><div class="TableShadowContainerRightTop" >  <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div></div><div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" ><div class="TableContentContainer" >    <table class="TableContent" width="100%" ><tr><td><table style="width:100%;"><tr><td class="LabelV" >Real Name:</td><td style="width:90%;" >'.$account_rlname.'</td></tr><tr><td class="LabelV" >Location:</td><td style="width:90%;" >'.$account_location.'</td></tr></table></td><td align=right><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=changeinfo" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Edit" alt="Edit" src="'.$layout_name.'/images/buttons/_sbutton_edit.gif" ></div></div></td></tr></form></table></td></tr>    </table>  </div></div><div class="TableShadowContainer" >  <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >    <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>    <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>  </div></div></td></tr>          </table>        </div>  </table></div></td></tr><br/><br/>';
                $main_content .= '<a name="Characters" ></a><div class="TopButtonContainer" ><div class="TopButton" ><a href="#top" ><image style="border:0px;" src="'.$layout_name.'/images/content/back-to-top.gif" /></a></div></div><div class="TableContainer" >  <table class="Table3" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" ><div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span><span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span><div class="Text" >Characters</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span><span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span><span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span></div>    </div>   <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td><div class="TableShadowContainerRightTop" ><div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);" ></div></div><div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);" ><div class="TableContentContainer" >    <table class="TableContent" width="100%" ><tr class="LabelH" ><td style="width:65%" >Name</td><td style="width:15%" >Level</td><td style="width:7%">Status</td><td style="width:5%">&#160;</td></tr>';
                $account_players = $account_logged->getPlayersList();
                $account_players->orderBy('name');
                //show list of players on account
                foreach($account_players as $account_player)
                {
                        $player_number_counter++;
                        $main_content .= '<tr style="background-color:';
                        if(is_int($player_number_counter / 2))
                                $main_content .= $config['site']['darkborder'];
                        else
                                $main_content .= $config['site']['lightborder'];
                        $main_content .= ';" ><td><NOBR>'.$player_number_counter.'.&#160;'.$account_player->getName();
                        if($account_player->isDeleted())
                                $main_content .= '<font color="red"><b> [ DELETED ] </b> <a href="?subtopic=accountmanagement&action=undelete&name='.urlencode($account_player->getName()).'">>> UNDELETE <<</a></font>';
                        if($account_player->isNameLocked())
                                if($account_player->getOldName())
                                        $main_content .= '<font color="red"><b> [ NAMELOCK:</b> Wait for GM, new name: <b>'.$account_player->getOldName().' ]</b></font>';
                                else
                                        $main_content .= '<font color="red"><b> [ NAMELOCK: <form action="" method="GET"><input name="subtopic" type="hidden" value="accountmanagement" /><input name="action" type="hidden" value="newnick" /><input name="name" type="hidden" value="'.$account_player->getName().'" /><input name="name_new" type="text" value="Enter here new nick" size="16" /><input type="submit" value="Set new nick" /></form> ]</b></font>';
                        $main_content .= '</NOBR></td><td><NOBR>'.$account_player->getLevel().' '.$vocation_name[$account_player->getWorld()][$account_player->getPromotion()][$account_player->getVocation()].'</NOBR></td>';
                        if(!$account_player->isOnline())
                                $main_content .= '<td><font color="red"><b>Offline</b></font></td>';
                        else
                                $main_content .= '<td><font color="green"><b>Online</b></font></td>';
                        $main_content .= '<td>[<a href="?subtopic=accountmanagement&action=changecomment&name='.urlencode($account_player->getName()).'" >Edit</a>]</td></tr>';
                }
                $main_content .= '</table>  </div></div><div class="TableShadowContainer" >  <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);" >    <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);" ></div>    <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);" ></div>  </div></div></td></tr><tr><td><table class="InnerTableButtonRow" cellpadding="0" cellspacing="0" ><tr><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=createcharacter" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Create Character" alt="Create Character" src="'.$layout_name.'/images/buttons/_sbutton_createcharacter.gif" ></div></div></td></tr></form></table></td><td style="width:100%;" ></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=deletecharacter" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Delete Character" alt="Delete Character" src="'.$layout_name.'/images/buttons/_sbutton_deletecharacter.gif" ></div></div></td></tr></form></table></td></tr></table></td></tr>          </table>        </div>  </table></div></td></tr><br/><br/>';
        }
//########### CHANGE PASSWORD ##########
        if($action == "changepassword") {
                $new_password = trim($_POST['newpassword']);
                $new_password2 = trim($_POST['newpassword2']);
                $old_password = trim($_POST['oldpassword']);
                if(empty($new_password) && empty($new_password2) && empty($old_password)) {
                        $main_content .= 'Please enter your current password and a new password. For your security, please enter the new password twice.<br/><br/><form action="?subtopic=accountmanagement&action=changepassword" method="post" ><div class="TableContainer" ><table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" ><div class="CaptionInnerContainer" ><span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span><span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span><div class="Text" >Change Password</div><span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span><span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span><span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span></div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td class="LabelV" ><span >New Password:</span></td><td style="width:90%;" ><input type="password" name="newpassword" size="30" maxlength="29" ></td></tr><tr><td class="LabelV" ><span >New Password Again:</span></td><td><input type="password" name="newpassword2" size="30" maxlength="29" ></td></tr><tr><td class="LabelV" ><span >Current Password:</span></td><td><input type="password" name="oldpassword" size="30" maxlength="29" ></td></tr></table>        </div>  </table></div></td></tr><br/><table style="width:100%;" ><tr align="center"><td><table border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></td></tr></table>';
                }
                else
                {
                        if(empty($new_password) || empty($new_password2) || empty($old_password)){
                                $show_msgs[] = "Please fill in form.";
                        }
                        if($new_password != $new_password2) {
                                $show_msgs[] = "The new passwords do not match!";
                        }
                        if(empty($show_msgs)) {
                                if(!check_password($new_password)) {
                                        $show_msgs[] = "New password contains illegal chars (a-z, A-Z and 0-9 only!) or lenght.";
                                }
                                $old_password = password_ency($old_password);
                                if($old_password != $account_logged->getPassword()) {
                                        $show_msgs[] = "Current password is incorrect!";
                                }
                        }
                        if(!empty($show_msgs)){
                                //show errors
                                $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
                                foreach($show_msgs as $show_msg) {
                                        $main_content .= '<li>'.$show_msg;
                                }
                                $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/>';
                                //show form
                                $main_content .= 'Please enter your current password and a new password. For your security, please enter the new password twice.<br/><br/><form action="?subtopic=accountmanagement&action=changepassword" method="post" ><div class="TableContainer" ><table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" ><div class="CaptionInnerContainer" ><span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span><span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span><div class="Text" >Change Password</div><span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span><span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span><span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span></div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td class="LabelV" ><span >New Password:</span></td><td style="width:90%;" ><input type="password" name="newpassword" size="30" maxlength="29" ></td></tr><tr><td class="LabelV" ><span >New Password Again:</span></td><td><input type="password" name="newpassword2" size="30" maxlength="29" ></td></tr><tr><td class="LabelV" ><span >Current Password:</span></td><td><input type="password" name="oldpassword" size="30" maxlength="29" ></td></tr></table>        </div>  </table></div></td></tr><br/><table style="width:100%;" ><tr align="center"><td><table border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></td></tr></table>';
                        }
                        else
                        {
                                $org_pass = $new_password;
                                $new_password = password_ency($new_password);
                                $account_logged->setPassword($new_password);
                                $account_logged->save();
                                $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Password Changed</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Your password has been changed.';
                                if($config['site']['send_emails'] && $config['site']['send_mail_when_change_password'])
                                {
                                        $mailBody = '<html>
                                        <body>
                                        <h3>Password to account changed!</h3>
                                        <p>You or someone else changed password to your account on server <a href="'.$config['server']['url'].'"><b>'.$config['server']['serverName'].'</b></a>.</p>
                                        <p>New password: <b>'.$org_pass.'</b></p>
                                        </body>
                                        </html>

---------------------------------------------------------------------------------------------------------------------------------------------------------

 

layout.php

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<script type="text/javascript">
/*
Snow Fall 1 - no images - Java Script
Visit http://rainbow.arch.scriptmania.com/scripts/
  for this script and many more
*/

// Set the number of snowflakes (more than 30 - 40 not recommended)
var snowmax=35

// Set the colors for the snow. Add as many colors as you like
var snowcolor=new Array("#AAAACC","#DDDDFF","#CCCCDD","#F3F3F3","#F0FFFF")

// Set the fonts, that create the snowflakes. Add as many fonts as you like
var snowtype=new Array("Arial Black","Arial Narrow","Times","Comic Sans MS")

// Set the letter that creates your snowflake (recommended: * )
var snowletter="*"

// Set the speed of sinking (recommended values range from 0.3 to 2)
var sinkspeed=0.6

// Set the maximum-size of your snowflakes
var snowmaxsize=22

// Set the minimal-size of your snowflakes
var snowminsize=8

// Set the snowing-zone
// Set 1 for all-over-snowing, set 2 for left-side-snowing 
// Set 3 for center-snowing, set 4 for right-side-snowing
var snowingzone=1

  /*
   //   * NO CONFIGURATION BELOW HERE *
*/

// Do not edit below this line
var snow=new Array()
var marginbottom
var marginright
var timer
var i_snow=0
var x_mv=new Array();
var crds=new Array();
var lftrght=new Array();
var browserinfos=navigator.userAgent 
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all
var opera=browserinfos.match(/Opera/)  
var browserok=ie5||ns6||opera

function randommaker(range) {        
    rand=Math.floor(range*Math.random())
    return rand
}

function initsnow() {
    if (ie5 || opera) {
        marginbottom = document.body.clientHeight
        marginright = document.body.clientWidth
    }
    else if (ns6) {
        marginbottom = window.innerHeight
        marginright = window.innerWidth
    }
    var snowsizerange=snowmaxsize-snowminsize
    for (i=0;i<=snowmax;i++) {
        crds[i] = 0;                      
        lftrght[i] = Math.random()*15;         
        x_mv[i] = 0.03 + Math.random()/10;
        snow[i]=document.getElementById("s"+i)
        snow[i].style.fontFamily=snowtype[randommaker(snowtype.length)]
        snow[i].size=randommaker(snowsizerange)+snowminsize
        snow[i].style.fontSize=snow[i].size
        snow[i].style.color=snowcolor[randommaker(snowcolor.length)]
        snow[i].sink=sinkspeed*snow[i].size/5
        if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)}
        if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)}
        if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
        if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
        snow[i].posy=randommaker(2*marginbottom-marginbottom-2*snow[i].size)
        snow[i].style.left=snow[i].posx
        snow[i].style.top=snow[i].posy
    }
    movesnow()
}

function movesnow() {
    for (i=0;i<=snowmax;i++) {
        crds[i] += x_mv[i];
        snow[i].posy+=snow[i].sink
        snow[i].style.left=snow[i].posx+lftrght[i]*Math.sin(crds[i]);
        snow[i].style.top=snow[i].posy
        
        if (snow[i].posy>=marginbottom-2*snow[i].size || parseInt(snow[i].style.left)>(marginright-3*lftrght[i])){
            if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)}
            if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)}
            if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
            if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
            snow[i].posy=0
        }
    }
    var timer=setTimeout("movesnow()",50)
}

for (i=0;i<=snowmax;i++) {
    document.write("<span id='s"+i+"' style='position:absolute;top:-"+snowmaxsize+"'>"+snowletter+"</span>")
}
if (browserok) {
    window.onload=initsnow
}
</SCRIPT>

<?php header("Content-Type: text/html; charset=ISO-8859-1",true); ?>
  <title><?PHP echo $title ?></title>
  <meta name="description" content="Tibia is a free massive multiplayer online role playing game (MMORPG)." />
  <meta name="author" content="Gesior | Modified by [ADM]DaNgeR" />
  <meta http-equiv="content-language" content="en" />
  <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  <meta name="keywords" content="free online game, free multiplayer game, ots, open tibia server" />
  <link rel="shortcut icon" href="<?PHP echo $layout_name; ?>/images/server.ico" type="image/x-icon">
  <link rel="icon" href="<?PHP echo $layout_name; ?>/images/server.ico" type="image/x-icon">
  <?PHP echo $layout_header; ?>
  <link href="<?PHP echo $layout_name; ?>/basic.css" rel="stylesheet" type="text/css">
  <script type='text/javascript'> var IMAGES=0; IMAGES='<?PHP echo $layout_name; ?>/images'; var g_FormField='';  var LINK_ACCOUNT=0; LINK_ACCOUNT='';</script>
  <script type="text/javascript" src="<?PHP echo $layout_name; ?>/initialize.js"></script>
  <SCRIPT TYPE="text/javascript">
  <!-- // Framekiller
  setTimeout ("changePage()", 6000);
  function changePage()
  {
    if (parent.frames.length > 2) {
      if (browserTyp == "ie") {
        parent.location=document.location;
      } else {
        self.top.location=document.location;
      }
    }
  }
  // -->
  </SCRIPT>
<?
header("Content-Type: text/html; charset=ISO-8859-1",true);
?>
</head>
<body onBeforeUnLoad="SaveMenu();" onUnload="SaveMenu();">
<a name="top"></a>
  <div id="ArtworkHelper" style="background-image:url(<?PHP echo $layout_name; ?>/images/header/background-artwork.jpg);" >
    <div id="Bodycontainer">
      <div id="ContentRow">
        <div id="MenuColumn">
          <div id="LeftArtwork">
            <img id="Statue_1" src="<?PHP echo $layout_name; ?>/images/header/animated-statue.gif" alt="logoartwork" />
            <img id="TibiaLogoArtworkTop" src="<?PHP echo $layout_name; ?>/images/header/tibia-logo-artwork-top.gif" onClick="window.location = '?subtopic=latestnews';" alt="logoartwork" />
            <img id="TibiaLogoArtworkBottom" src="<?PHP echo $layout_name; ?>/images/header/tibia-logo-artwork-bottom.gif" alt="logoartwork" />
            <img id="Statue_2" src="<?PHP echo $layout_name; ?>/images/header/animated-statue.gif" alt="logoartwork" />
          </div>
          
  <div id="Loginbox" >
    <div id="LoginTop" style="background-image:url(<?PHP echo $layout_name; ?>/images/general/box-top.gif)" ></div>
    <div id="BorderLeft" class="LoginBorder" style="background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif)" ></div>
    <div class="Loginstatus" style="background-image:url(<?PHP echo $layout_name; ?>/images/loginbox/loginbox-textfield-background.gif)" >
      <div id="LoginstatusText_1" class="LoginstatusText" style="background-image:url(<?PHP echo $layout_name; ?>/images/loginbox/loginbox-font-you-are-not-logged-in.gif)" ></div>
    </div>
    <div id="LoginButtonContainer" style="background-image:url(<?PHP echo $layout_name; ?>/images/loginbox/loginbox-textfield-background.gif)" >
      <div id="LoginButton" style="background-image:url(<?PHP echo $layout_name; ?>/images/buttons/sbutton.gif)" > 
        <div onClick="LoginButtonAction();" onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);"><div class="Button" style="background-image:url(<?PHP echo $layout_name; ?>/images/buttons/sbutton_over.gif)" ></div>
          <div id="ButtonText" ></div>
        </div>
      </div>
    </div>
    <div style="clear:both" ></div>
    <div class="Loginstatus" style="background-image:url(<?PHP echo $layout_name; ?>/images/loginbox/loginbox-textfield-background.gif)" >
      <div id="LoginstatusText_2" onClick="LoginstatusTextAction(this);" onMouseOver="MouseOverLoginBoxText(this);" onMouseOut="MouseOutLoginBoxText(this);" ><div id="LoginstatusText_2_1" class="LoginstatusText" style="background-image:url(<?PHP echo $layout_name; ?>/images/loginbox/loginbox-font-create-account.gif)" ></div><div id="LoginstatusText_2_2" class="LoginstatusText" style="background-image:url(<?PHP echo $layout_name; ?>/images/loginbox/loginbox-font-create-account-over.gif)" ></div></div>
    </div>
     <div id="BorderRight" class="LoginBorder" style="background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif)" ></div>
    <div id="LoginBottom" class="Loginstatus" style="background-image:url(<?PHP echo $layout_name; ?>/images/general/box-bottom.gif)" ></div>
  </div>

<div id='Menu'>
<div id='MenuTop' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/box-top.gif);'></div>

<div id='news' class='menuitem'>
<span onClick="MenuItemAction('news')">
  <div class='MenuButton' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/button-background.gif);'>
    <div onMouseOver='MouseOverMenuItem(this);' onMouseOut='MouseOutMenuItem(this);'><div class='Button' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/button-background-over.gif);'></div>
      <span id='news_Lights' class='Lights'>
        <div class='light_lu' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
        <div class='light_ld' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>

        <div class='light_ru' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
      </span>
      <div id='news_Icon' class='Icon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-news.gif);'></div>
      <div id='news_Label' class='Label' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/label-news.gif);'></div>
      <div id='news_Extend' class='Extend' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/plus.gif);'></div>
    </div>
  </div>
</span>
<div id='news_Submenu' class='Submenu'>
<a href='?subtopic=latestnews'>
  <div id='submenu_latestnews' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_latestnews' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Ultimas Noticias</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=live'>
  <div id='submenu_live' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_latestnews' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color='#00FF09'>Cast ON</font></div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>

<?PHP
if($config['site']['download_page'] == 1)
echo "<a href='?subtopic=downloads'>
  <div id='submenu_downloads' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_downloads' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color='#FF0033'>Downloads</font></div>
    <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>";
?>
</div>
</div>


<div id='library' class='menuitem'>
<span onClick="MenuItemAction('library')">
  <div class='MenuButton' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/button-background.gif);'>
    <div onMouseOver='MouseOverMenuItem(this);' onMouseOut='MouseOutMenuItem(this);'><div class='Button' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/button-background-over.gif);'></div>
      <span id='library_Lights' class='Lights'>
        <div class='light_lu' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
        <div class='light_ld' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
        <div class='light_ru' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
      </span>
      <div id='library_Icon' class='Icon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-library.gif);'></div>
      <div id='library_Label' class='Label' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/label-library.gif);'></div>
      <div id='library_Extend' class='Extend' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/plus.gif);'></div>
    </div>
  </div>
</span>
<div id='library_Submenu' class='Submenu'>
<a href='?subtopic=creatures'>
  <div id='submenu_creatures' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_creatures' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Monstros</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>

<a href='?subtopic=addons'>
  <div id='submenu_addons' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_creatures' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Addons</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=spells'>
  <div id='submenu_spells' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_spells' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Magias</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<?PHP
if($config['site']['gallery_page'] == 1) 
echo "<a href='?subtopic=gallery'>
  <div id='submenu_gallery' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_gallery' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Galeria</div>
    <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>";
if($config['site']['serverinfo_page'] == 1)
echo "<a href='?subtopic=serverinfo'>
  <div id='submenu_serverinfo' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_serverinfo' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Info do Server</div>
    <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>";
?>
<a href='?subtopic=experiencetable'>
  <div id='submenu_experiencetable' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_experiencetable' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Tabela de Experiência</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
</div>
</div>


<div id='community' class='menuitem'>
<span onClick="MenuItemAction('community')">
  <div class='MenuButton' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/button-background.gif);'>
    <div onMouseOver='MouseOverMenuItem(this);' onMouseOut='MouseOutMenuItem(this);'><div class='Button' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/button-background-over.gif);'></div>
      <span id='community_Lights' class='Lights'>
        <div class='light_lu' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
        <div class='light_ld' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
        <div class='light_ru' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
      </span>
      <div id='community_Icon' class='Icon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-community.gif);'></div>
      <div id='community_Label' class='Label' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/label-community.gif);'></div>
      <div id='community_Extend' class='Extend' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/plus.gif);'></div>

    </div>
  </div>
</span>
<div id='community_Submenu' class='Submenu'>
<a href='?subtopic=characters'>
  <div id='submenu_characters' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_characters' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Procurar Players</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>

  </div>
</a>
<a href='?subtopic=whoisonline'>
  <div id='submenu_whoisonline' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_whoisonline' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Quem Está Online?</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=highscores'>
  <div id='submenu_highscores' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_highscores' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Ranking</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=killstatistics'>
  <div id='submenu_killstatistics' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_killstatistics' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Ultimas Mortes</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=tradeoff'>
  <div id='submenu_tradeoff' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_bans' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color=yellow>Trade OFF<font></div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>

<a href='?subtopic=wars'>
  <div id='submenu_wars' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_polls' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color=red>Guilds Wars</font></div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>


<a href='?subtopic=records'>
  <div id='submenu_records' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_bans' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color=blue>Record Players On<font></div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>

<a href='?subtopic=fragers'>
  <div id='submenu_fragers' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_houses' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color=red> Ranks Matadores </font></div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=bans'>
  <div id='submenu_bans' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_bans' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Players Banidos</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=guilds'>
  <div id='submenu_guilds' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>

    <div id='ActiveSubmenuItemIcon_guilds' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Guilds</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>

<a href='index.php?subtopic=topguild'>
  <div id='submenu_wars' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_wars' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color="red"> Top Guilds </font></div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>

<a href='?subtopic=polls'>
  <div id='submenu_polls' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_polls' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Enquetes</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>

</div>
</div>

<div id='events' class='menuitem'>
<span onClick="MenuItemAction('events')">
  <div class='MenuButton' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/button-background.gif);'>
    <div onMouseOver='MouseOverMenuItem(this);' onMouseOut='MouseOutMenuItem(this);'><div class='Button' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/button-background-over.gif);'></div>
      <span id='events_Lights' class='Lights'>
        <div class='light_lu' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
        <div class='light_ld' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
        <div class='light_ru' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
      </span>
      <div id='events_Icon' class='Icon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-events.gif);'></div>
      <div id='events_Label' class='Label' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/label-events.gif);'></div>
      <div id='events_Extend' class='Extend' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/plus.gif);'></div>
    </div>
  </div>
</span>
<div id='events_Submenu' class='Submenu'>
<a href='?subtopic=calendario'>
  <div id='submenu_calendario' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_calendario' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Calend&aacute;rio</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<!-- <a href='?subtopic=domain'>
  <div id='submenu_domain' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_domain' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Castle Domain</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=dota'>
  <div id='submenu_dota' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_dota' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Dota</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=coliseum'>
  <div id='submenu_coliseum' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_coliseum' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Coliseum</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a> -->
<a href='?subtopic=lottery'>
  <div id='submenu_lottery' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_lottery' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Lottery</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=task'>
  <div id='submenu_task' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_task' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Task</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=boss'>
  <div id='submenu_boss' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_boss' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Boss</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<!-- <a href='?subtopic=present'>
  <div id='submenu_present' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_present' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Presence diary</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a> -->
</div>
</div>

<?PHP
echo "<div id='forum' class='menuitem'>
         <span onClick=\"MenuItemAction('forum')\">
     <div class='MenuButton' style='background-image:url(".$layout_name."/images/menu/button-background.gif);'>
         <div onMouseOver='MouseOverMenuItem(this);' onMouseOut='MouseOutMenuItem(this);'><div class='Button' style='background-image:url(".$layout_name."/images/menu/button-background-over.gif);'></div>
               <span id='forum_Lights' class='Lights'>
                <div class='light_lu' style='background-image:url(".$layout_name."/images/menu/green-light.gif);'></div>
                <div class='light_ld' style='background-image:url(".$layout_name."/images/menu/green-light.gif);'></div>
                <div class='light_ru' style='background-image:url(".$layout_name."/images/menu/green-light.gif);'></div>
               </span>
               <div id='forum_Icon' class='Icon' style='background-image:url(".$layout_name."/images/menu/icon-forum.gif);'></div>
               <div id='forum_Label' class='Label' style='background-image:url(".$layout_name."/images/menu/label-forum.gif);'></div>
               <div id='forum_Extend' class='Extend' style='background-image:url(".$layout_name."/images/general/plus.gif);'></div>
             </div>
           </div>
          </span>
       <div id='forum_Submenu' class='Submenu'>
          <a href='?subtopic=forum'>
           <div id='submenu_forum' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
             <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
             <div id='ActiveSubmenuItemIcon_forum' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
             <div class='SubmenuitemLabel'>Server Forum</div>
             <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
           </div>
          </a>
        </div>  
       </div>";
?>


<div id='account' class='menuitem'>
<span onClick="MenuItemAction('account')">
  <div class='MenuButton' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/button-background.gif);'>
    <div onMouseOver='MouseOverMenuItem(this);' onMouseOut='MouseOutMenuItem(this);'><div class='Button' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/button-background-over.gif);'></div>
      <span id='account_Lights' class='Lights'>
        <div class='light_lu' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
        <div class='light_ld' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
        <div class='light_ru' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/green-light.gif);'></div>
      </span>
      <div id='account_Icon' class='Icon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-account.gif);'></div>
      <div id='account_Label' class='Label' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/label-account.gif);'></div>
      <div id='account_Extend' class='Extend' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/plus.gif);'></div>
    </div>
  </div>
</span>
<div id='account_Submenu' class='Submenu'>
<a href='?subtopic=accountmanagement'>
  <div id='submenu_accountmanagement' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_accountmanagement' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Acessar Sua Conta</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=createaccount'>
  <div id='submenu_createaccount' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_createaccount' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Criar Conta</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>

<?PHP
if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
echo "<a href='?subtopic=adminpanel'>
  <div id='submenu_adminpanel' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_adminpanel' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color=\"red\">! Painel do Admin !</font></div>
    <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>";
if($group_id_of_acc_logged > 0)
echo "<a href='?subtopic=namelock'>
  <div id='submenu_namelock' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_namelock' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color=\"red\">! Nomes Bloqueados !</font></div>
    <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>";
if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
echo "<a href='?subtopic=polls'>
  <div id='submenu_polls' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_polls' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color=\"red\">! Edite as Enquetes !</font></div>
    <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>";
?>
</div>
</div>


<div id='support' class='menuitem'> 
                            <span onClick="MenuItemAction('support')"> 
                                <div class='MenuButton' style='background-image:url(layouts/tibiacom/images/menu/button-background.gif);'> 
                                    <div onMouseOver='MouseOverMenuItem(this);' onMouseOut='MouseOutMenuItem(this);'> 
                                        <div class='Button' style='background-image:url(layouts/tibiacom/images/menu/button-background-over.gif);'></div> 
                                        <span id='support_Lights' class='Lights'> 
                                            <div class='light_lu' style='background-image:url(layouts/tibiacom/images/menu/green-light.gif);'></div> 
                                            <div class='light_ld' style='background-image:url(layouts/tibiacom/images/menu/green-light.gif);'></div> 
                                            <div class='light_ru' style='background-image:url(layouts/tibiacom/images/menu/green-light.gif);'></div> 
                                        </span> 
                                        <div id='support_Icon' class='Icon' style='background-image:url(layouts/tibiacom/images/menu/icon-support.gif);'></div> 
                                        <div id='support_Label' class='Label' style='background-image:url(layouts/tibiacom/images/menu/label-support.gif);'></div> 
                                        <div id='support_Extend' class='Extend' style='background-image:url(layouts/tibiacom/images/general/plus.gif);'></div> 
                                    </div> 
                                </div> 
                            </span> 

                            
                            <div id='support_Submenu' class='Submenu'> 
                                <a href='?subtopic=tibiarules'> 
                                    <div id='submenu_tibiarules' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'> 
                                        <div class='LeftChain' style='background-image:url(layouts/tibiacom/images/general/chain.gif);'></div> 
                                        <div id='ActiveSubmenuItemIcon_tibiarules' class='ActiveSubmenuItemIcon' style='background-image:url(layouts/tibiacom/images/menu/icon-activesubmenu.gif);'></div> 
                                        <div class='SubmenuitemLabel'>Regras do Server</div> 
                                        <div class='RightChain' style='background-image:url(layouts/tibiacom/images/general/chain.gif);'></div> 
                                    </div> 
                                </a>
                                
                                
                                <a href='?subtopic=team'> 
                                    <div id='submenu_team' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'> 
                                        <div class='LeftChain' style='background-image:url(layouts/tibiacom/images/general/chain.gif);'></div> 
                                        <div id='ActiveSubmenuItemIcon_team' class='ActiveSubmenuItemIcon' style='background-image:url(layouts/tibiacom/images/menu/icon-activesubmenu.gif);'></div> 
                                        <div class='SubmenuitemLabel'>Membros da Equipe</div> 
                                        <div class='RightChain' style='background-image:url(layouts/tibiacom/images/general/chain.gif);'></div> 
                                    </div> 
                                </a> 
                            </div> 
                        </div> 

<?PHP
if($config['site']['shop_system'] == 1) {
echo "<div id='shops' class='menuitem'>
<span onClick=\"MenuItemAction('shops')\">
  <div class='MenuButton' style='background-image:url(".$layout_name."/images/menu/button-background.gif);'>
    <div onMouseOver='MouseOverMenuItem(this);' onMouseOut='MouseOutMenuItem(this);'><div class='Button' style='background-image:url(".$layout_name."/images/menu/button-background-over.gif);'></div>
      <span id='shops_Lights' class='Lights'>
        <div class='light_lu' style='background-image:url(".$layout_name."/images/menu/green-light.gif);'></div>
        <div class='light_ld' style='background-image:url(".$layout_name."/images/menu/green-light.gif);'></div>
        <div class='light_ru' style='background-image:url(".$layout_name."/images/menu/green-light.gif);'></div>
      </span>
      <div id='shops_Icon' class='Icon' style='background-image:url(".$layout_name."/images/menu/icon-shops.gif);'></div>
      <div id='shops_Label' class='Label' style='background-image:url(".$layout_name."/images/menu/label-shops.gif);'></div>
      <div id='shops_Extend' class='Extend' style='background-image:url(".$layout_name."/images/general/plus.gif);'></div>
    </div>
  </div>
</span>
</div>
<div id='shops_Submenu' class='Submenu'> 
<a href='?subtopic=buypoints'>
  <div id='submenu_doacao' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_doacao' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color=red><blink>Comprar Pontos</blink></font></div>
    <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>
<a href='?subtopic=shopsystem'>
  <div id='submenu_shopsystem' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_shopsystem' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><div style=\"color: green;\">Loja do Server</div></div>
    <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>

<a href='?subtopic=confirmacao'>
  <div id='submenu_buypoints' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_buypoints' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color=yellow>Confirmar Doação</font></div>
    <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>

<a href='?subtopic=vantagens'>
  <div id='submenu_vantagens' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_beneficiospremium' class='ActiveSubmenuItemIcon' style='background-image:url(http://i55.tinypic.com/2uqj9kx.jpg);'></div>
    <div class='SubmenuitemLabel'><font color=blue>Benefícios</font></div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>
</a>";
if($logged)
echo "<a href='?subtopic=shopsystem&action=show_history'>
  <div id='submenu_show_history' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_show_history' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color=orange>Suas Transações</font></div>
    <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>";
if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) 
echo "<a href='?subtopic=shopadmin'>
  <div id='submenu_shopadmin' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_shopadmin' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color=red>! Loja do Admin !</font></div>
    <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>";
echo "</div>";
}
?>

<div id='MenuBottom' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/box-bottom.gif);'></div>
</div>
  <script type='text/javascript'>InitializePage();</script></div>
        <div id="ContentColumn">
          <div class="Content">
            <div id="ContentHelper"><script type="text/javascript" src="<?PHP echo $layout_name; ?>/newsticker.js"></script>
        <?PHP echo $news_content; ?>
    <div id="<?PHP echo $subtopic; ?>" class="Box">
    <div class="Corner-tl" style="background-image:url(<?PHP echo $layout_name; ?>/images/content/corner-tl.gif);"></div>
    <div class="Corner-tr" style="background-image:url(<?PHP echo $layout_name; ?>/images/content/corner-tr.gif);"></div>
    <div class="Border_1" style="background-image:url(<?PHP echo $layout_name; ?>/images/content/border-1.gif);"></div>
    <div class="BorderTitleText" style="background-image:url(<?PHP echo $layout_name; ?>/images/content/title-background-green.gif);"></div>
    <img class="Title"  src="headline.php?text=<?php echo $topic ?>" alt="Contentbox headline" />
    <div class="Border_2">
      <div class="Border_3">
        <div class="BoxContent" style="background-image:url(<?PHP echo $layout_name; ?>/images/content/scroll.gif);">
    <?PHP echo $main_content; ?> 
      </div>
      </div>
    </div>
    <div class="Border_1" style="background-image:url(<?PHP echo $layout_name; ?>/images/content/border-1.gif);"></div>

    <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image:url(<?PHP echo $layout_name; ?>/images/content/corner-bl.gif);"></div></div>
    <div class="CornerWrapper-b"><div class="Corner-br" style="background-image:url(<?PHP echo $layout_name; ?>/images/content/corner-br.gif);"></div></div>
  </div>
           </div>
          </div>
          <div id="Footer">
<?PHP
$time_end = microtime_float();
$time = $time_end - $time_start;
?>
             Account Maker made by Gesior. Layout by CipSoft GmbH.<br/>Page has been viewed <?PHP echo $page_views; ?> times. Load time: <?PHP echo round($time, 4); ?> seconds<br/>


        </div>
              </div>

    
        <div id="ThemeboxesColumn">
                  <div id="RightArtwork">
                    <img src="images/monsters/piratebuccaneer.gif" alt="Monster of the Week" name="Monster" id="Monster" onClick="window.location = '?subtopic=creatures&amp;creature=pirate buccaneer';" />
                    <img id="PedestalAndOnline" src="<?PHP echo $layout_name; ?>/images/header/pedestal-and-online.gif" alt="Monster Pedestal and Players Online Box"/>
    <?PHP
    if(count($config['site']['worlds']) > 1)
         $whoisonlineworld = '?subtopic=whoisonline';
    else
         $whoisonlineworld = '?subtopic=whoisonline&world=0';
    ?>
                         <div id="PlayersOnline" onClick="window.location='<?PHP echo $whoisonlineworld; ?>'">
    <?PHP
   if($config['status']['serverStatus_online'] >= 0)
    echo $config['status']['serverStatus_players'].'/'.$config['status']['serverStatus_playersMax'].'<br />Uptime: '.$config['status']['serverStatus_uptime'].'<br />';
   else
    echo '<font color="red"><b>Server<br />OFFLINE</b></font>';
    ?></div>
            </div>
  <div id="Themeboxes">
   
    <?php include($layout_name.'/widget_rank.php'); ?>
   
  <div id="NewcomerBox" class="Themebox" style="background-image:url(<?PHP echo $layout_name; ?>/images/themeboxes/newcomer/premiumbox.gif);">
    <div class="ThemeboxButton" onClick="BigButtonAction('?subtopic=buypoints')" onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" style="background-image:url(<?PHP echo $layout_name; ?>/images/buttons/sbutton.gif);"><div class="BigButtonOver" style="background-image:url(<?PHP echo $layout_name; ?>/images/buttons/sbutton_over.gif);"></div>
      <div class="ButtonText" style="background-image:url(<?PHP echo $layout_name; ?>/images/buttons/_sbutton_donator.gif);"></div>
    </div>
    <div class="Bottom" style="background-image:url(<?PHP echo $layout_name; ?>/images/general/box-bottom.gif);"></div>
  </div>
 

<?PHP
if($config['site']['screenoftheday'] == 1) 
echo '<div id="ScreenshotBox" class="Themebox" style="background-image:url('.$layout_name.'/images/themeboxes/screenshot/screenshotbox.gif);">
      <a href="?subtopic=gallery" >
        <img id="ScreenshotContent" class="ThemeboxContent" src="images/screenshotoftheday.gif" alt="Screenshot of the Day" /></a>
    <div class="Bottom" style="background-image:url('.$layout_name.'/images/general/box-bottom.gif);"></div>
    </div>';
?>
<?PHP
$time = time();
$viewpoll = $SQL->query('SELECT * FROM z_polls where end > '.$time.' ORDER BY id DESC LIMIT 1');
foreach($viewpoll as $p)
$polls .= '<center>'.$p['question'].'</center>';
    if(count($p['id']) > 0)
     echo '<div id="CurrentPollBox" class="Themebox" style="background-image:url('.$layout_name.'/images/themeboxes/current-poll/currentpollbox.gif);">
      <div id="CurrentPollText">'.$polls.'</div>
      <a class="ThemeboxButton" href="?subtopic=polls&id= '.$p['id'].'" onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
        <div class="ButtonText" style="background-image:url('.$layout_name.'/images/buttons/_sbutton_votenow.gif);"></div>
      </a>
    <div class="Bottom" style="background-image:url('.$layout_name.'/images/general/box-bottom.gif);"></div>
    </div>';
?>

<?PHP
if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) 
echo '<div id="CurrentPollBox" class="Themebox" style="background-image:url('.$layout_name.'/images/themeboxes/admin/admin.gif);">
      <div id="CurrentPollText">
    <b><a href="?subtopic=adminpanel"><b>Admin Panel</b></a><b><br>
    <b><a href="?subtopic=namelock"><b>Namelocks</b></a><b><br>
    <b><a href="?subtopic=polls"><b>Manage Polls</b></a><b><br>
    <b><a href="?subtopic=shopadmin"><b>Shop Admin</b></a><b></div>
    <div class="Bottom" style="background-image:url('.$layout_name.'/images/general/box-bottom.gif);"></div>
    </div>';
?>
        </div>
      </div>
     </div>
    </div>
  </div>


</body>
</html>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

createaccount.php

<?PHP
//CREATE ACCOUNT FORM PAGE
if($action == "")
{
    $main_content .= '<script type="text/javascript">

var accountHttp;

//sprawdza czy dane konto istnieje czy nie
function checkAccount()
{
    if(document.getElementById("account_name").value=="")
    {
        document.getElementById("acc_name_check").innerHTML = \'<b><font color="red">Por favor escolha sua conta.</font></b>\';
        return;
    }
    accountHttp=GetXmlHttpObject();
    if (accountHttp==null)
    {
        return;
    }
    var account = document.getElementById("account_name").value;
    var url="ajax/check_account.php?account=" + account + "&uid="+Math.random();
    accountHttp.onreadystatechange=AccountStateChanged;
    accountHttp.open("GET",url,true);
    accountHttp.send(null);

function AccountStateChanged() 

    if (accountHttp.readyState==4)
    { 
        document.getElementById("acc_name_check").innerHTML=accountHttp.responseText;
    }
}

var emailHttp;

//sprawdza czy dane konto istnieje czy nie
function checkEmail()
{
    if(document.getElementById("email").value=="")
    {
        document.getElementById("email_check").innerHTML = \'<b><font color="red">Por favor escolha seu e-mail.</font></b>\';
        return;
    }
    emailHttp=GetXmlHttpObject();
    if (emailHttp==null)
    {
        return;
    }
    var email = document.getElementById("email").value;
    var url="ajax/check_email.php?email=" + email + "&uid="+Math.random();
    emailHttp.onreadystatechange=EmailStateChanged;
    emailHttp.open("GET",url,true);
    emailHttp.send(null);

function EmailStateChanged() 

    if (emailHttp.readyState==4)
    { 
        document.getElementById("email_check").innerHTML=emailHttp.responseText;
    }
}

    function validate_required(field,alerttxt)
    {
    with (field)
    {
    if (value==null||value==""||value==" ")
      {alert(alerttxt);return false;}
    else {return true}
    }
    }

    function validate_email(field,alerttxt)
    {
    with (field)
    {
    apos=value.indexOf("@");
    dotpos=value.lastIndexOf(".");
    if (apos<1||dotpos-apos<2) 
      {alert(alerttxt);return false;}
    else {return true;}
    }
    }

    function validate_form(thisform)
    {
    with (thisform)
    {
    if (validate_required(account_name,"Escolha sua conta!")==false)
      {account_name.focus();return false;}
    if (validate_required(email,"Escolha seu e-mail!")==false)
      {email.focus();return false;}
    if (validate_email(email,"E-mail invalido!")==false)
      {email.focus();return false;}
    if (verifpass==1) {
    if (validate_required(passor,"Escolha sua senha!")==false)
      {passor.focus();return false;}
    if (validate_required(passor2,"Repita sua Senha!")==false)
      {passor2.focus();return false;}
    if (passor2.value!=passor.value)
      {alert(\'Senha Repetida não bate com a primeira!\');return false;}
    }
    if (verifya==1) {
    if (validate_required(verify,"Digite o código de verificação!")==false)
      {verify.focus();return false;}
    }
    if(rules.checked==false)
      {alert(\'Para criar conta você tem que aceitar as regras do server!\');return false;}
    }
    }
    </script>';
    $main_content .= 'Para jogar no '.$config['server']['serverName'].' Você precisa de uma conta. 
                         Tudo que você precisa fazer para criar sua nova conta é seu endereço de e-mail, senha para o novo código de verificação de contas, de imagem e para concordar com os termos apresentados abaixo. Se você tiver feito isso, o nome da conta, senha e e-mail será mostrado na página seguinte e sua conta e senha será enviado para seu endereço de e-mail junto com instruções adicionais.<BR><BR>
                        <FORM ACTION="?subtopic=createaccount&action=saveaccount" onsubmit="return validate_form(this)" METHOD=post>
                        <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
                        <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Criar uma '.$config['server']['serverName'].' Conta</B></TD></TR>
                        <TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLSPACING=8 CELLPADDING=0>
                          <TR><TD>
                            <TABLE BORDER=0 CELLSPACING=5 CELLPADDING=0>';
    $main_content .= '<TR><TD width="150" valign="top"><B>Conta: </B></TD><TD colspan="2"><INPUT id="account_name" NAME="reg_name" onkeyup="checkAccount();" VALUE="" SIZE=30 MAXLENGTH=50><BR><font size="1" face="verdana,arial,helvetica">(Escolha sua conta)</font></TD></TR>
                      <TR><TD width="150"></TD><TD colspan="2"><b><div id="acc_name_check">Por Favor Selecione sua conta.</div></b></TD></TR>
                    <TR><TD width="150" valign="top"><B>Seu E-mail: </B></TD><TD colspan="2"><INPUT id="email" NAME="reg_email" onkeyup="checkEmail();" VALUE="" SIZE=30 MAXLENGTH=50><BR><font size="1" face="verdana,arial,helvetica">(Seu E-mail é necessário para recuperar sua conta no '.$config['server']['serverName'].')</font></TD></TR>
                      <TR><TD width="150"></TD><TD colspan="2"><b><div id="email_check">Por Favor selecione seu e-mail.</div></b></TD></TR>';
                               $main_content .= '<TR><TD width="150"><b>Selecione seu País:</b></TD><TD colspan="2"><b><select name="country">
                    <option value="">Escolha...</option><option value="af"> Afghanistan </option><option value="al"> Albania </option><option value="dz"> Algeria </option><option value="as"> American Samoa </option><option value="ad"> Andorra </option><option value="ao"> Angola </option><option value="ai"> Anguilla </option><option value="aq"> Antarctica </option><option value="ag"> Antigua and Barbuda </option><option value="ar"> Argentina </option>

                    <option value="am"> Armenia </option><option value="aw"> Aruba </option><option value="au"> Australia </option><option value="at"> Austria </option><option value="az"> Azerbaijan </option><option value="bs"> Bahamas </option><option value="bh"> Bahrain </option><option value="bd"> Bangladesh </option><option value="bb"> Barbados </option><option value="by"> Belarus </option><option value="be"> Belgium </option><option value="bz"> Belize </option><option value="bj"> Benin </option><option value="bm"> Bermuda </option><option value="bt"> Bhutan </option><option value="bo"> Bolivia </option><option value="ba"> Bosnia and Herzegowina </option><option value="bw"> Botswana </option><option value="bv"> Bouvet Island </option><option value="br"> Brazil </option><option value="io"> British Indian Ocean Territory </option><option value="bn"> Brunei Darussalam </option><option value="bg"> Bulgaria </option><option value="bf"> Burkina Faso </option><option value="bi"> Burundi </option>                                     <option value="kh"> Cambodia </option><option value="cm"> Cameroon </option><option value="ca"> Canada </option><option value="cv"> Cape Verde </option><option value="ky"> Cayman Islands </option><option value="cf"> Central African Republic </option><option value="td"> Chad </option><option value="cl"> Chile </option><option value="cn"> China </option><option value="cx"> Christmas Island </option><option value="cc"> Cocos Islands </option><option value="co"> Colombia </option><option value="km"> Comoros </option><option value="cd"> Congo </option><option value="cg"> Congo </option><option value="ck"> Cook Islands </option><option value="cr"> Costa Rica </option><option value="ci"> Cote DIvoire </option><option value="hr"> Croatia </option><option value="cu"> Cuba </option><option value="cy"> Cyprus </option><option value="cz"> Czech Republic </option><option value="dk"> Denmark </option><option value="dj"> Djibouti </option><option value="dm"> Dominica </option>

                    <option value="do"> Dominican Republic </option><option value="tp"> East Timor </option><option value="ec"> Ecuador </option><option value="eg"> Egypt </option><option value="sv"> El Salvador </option><option value="gq"> Equatorial Guinea </option><option value="er"> Eritrea </option><option value="ee"> Estonia </option><option value="et"> Ethiopia </option><option value="fk"> Falkland Islands </option><option value="fo"> Faroe Islands </option><option value="fj"> Fiji </option><option value="fi"> Finland </option><option value="fr"> France </option><option value="gf"> French Guiana </option><option value="pf"> French Polynesia </option><option value="tf"> French Southern Territories </option><option value="ga"> Gabon </option><option value="gm"> Gambia </option><option value="ge"> Georgia </option><option value="de"> Germany </option><option value="gh"> Ghana </option><option value="gi"> Gibraltar </option><option value="gr"> Greece </option>

                    <option value="gl"> Greenland </option><option value="gd"> Grenada </option><option value="gp"> Guadeloupe </option><option value="gu"> Guam </option><option value="gt"> Guatemala </option><option value="gn"> Guinea </option><option value="gw"> Guinea-Bissau </option><option value="gy"> Guyana </option><option value="ht"> Haiti </option><option value="hm"> Heard and Mc Donald Islands </option><option value="hn"> Honduras </option><option value="hk"> Hong Kong </option><option value="hu"> Hungary </option><option value="is"> Iceland </option><option value="in"> India </option><option value="id"> Indonesia </option><option value="ir"> Iran </option><option value="iq"> Iraq </option><option value="ie"> Ireland </option><option value="il"> Israel </option><option value="it"> Italy </option><option value="jm"> Jamaica </option><option value="jp"> Japan </option><option value="jo"> Jordan </option><option value="kz"> Kazakhstan </option><option value="ke"> Kenya </option>

                    <option value="ki"> Kiribati </option><option value="kr"> Korea </option><option value="kp"> Korea </option><option value="kw"> Kuwait </option><option value="kg"> Kyrgyzstan </option><option value="la"> Lao Peoples Democratic Republic </option><option value="lv"> Latvia </option><option value="lb"> Lebanon </option><option value="ls"> Lesotho </option><option value="lr"> Liberia </option><option value="ly"> Libyan Arab Jamahiriya </option><option value="li"> Liechtenstein </option><option value="lt"> Lithuania </option><option value="lu"> Luxembourg </option><option value="mo"> Macau </option><option value="mk"> Macedonia </option><option value="mg"> Madagascar </option><option value="mw"> Malawi </option><option value="my"> Malaysia </option><option value="mv"> Maldives </option><option value="ml"> Mali </option><option value="mt"> Malta </option><option value="mh"> Marshall Islands </option><option value="mq"> Martinique </option>

                    <option value="mr"> Mauritania </option><option value="mu"> Mauritius </option><option value="yt"> Mayotte </option><option value="mx"> Mexico </option><option value="fm"> Micronesia </option><option value="md"> Moldova </option><option value="mc"> Monaco </option><option value="mn"> Mongolia </option><option value="ms"> Montserrat </option><option value="ma"> Morocco </option><option value="mz"> Mozambique </option><option value="mm"> Myanmar </option><option value="na"> Namibia </option><option value="nr"> Nauru </option><option value="np"> Nepal </option><option value="nl"> Netherlands </option><option value="an"> Netherlands Antilles </option><option value="nc"> New Caledonia </option><option value="nz"> New Zealand </option><option value="ni"> Nicaragua </option><option value="ne"> Niger </option><option value="ng"> Nigeria </option><option value="nu"> Niue </option><option value="nf"> Norfolk Island </option><option value="mp"> Northern Mariana Islands </option>

                    <option value="no"> Norway </option><option value="om"> Oman </option><option value="pk"> Pakistan </option><option value="pw"> Palau </option><option value="pa"> Panama </option><option value="pg"> Papua New Guinea </option><option value="py"> Paraguay </option><option value="pe"> Peru </option><option value="ph"> Philippines </option><option value="pn"> Pitcairn </option><option value="pl"> Poland </option><option value="pt"> Portugal </option><option value="pr"> Puerto Rico </option><option value="qa"> Qatar </option><option value="re"> Reunion </option><option value="ro"> Romania </option><option value="ru"> Russian Federation </option><option value="rw"> Rwanda </option><option value="kn"> Saint Kitts and Nevis </option><option value="lc"> Saint Lucia </option><option value="ws"> Samoa </option><option value="sm"> San Marino </option><option value="st"> Sao Tome and Principe </option><option value="sa"> Saudi Arabia </option><option value="sn"> Senegal </option>

                    <option value="sc"> Seychelles </option><option value="sl"> Sierra Leone </option><option value="sg"> Singapore </option><option value="sk"> Slovakia </option><option value="si"> Slovenia </option><option value="sb"> Solomon Islands </option><option value="so"> Somalia </option><option value="za"> South Africa </option><option value="es"> Spain </option><option value="lk"> Sri Lanka </option><option value="sh"> St. Helena </option><option value="pm"> St. Pierre and Miquelon </option><option value="sd"> Sudan </option><option value="sr"> Suriname </option><option value="sj"> Svalbard and Jan Mayen Islands </option><option value="sz"> Swaziland </option><option value="se"> Sweden </option><option value="ch"> Switzerland </option><option value="sy"> Syrian Arab Republic </option><option value="tw"> Taiwan </option><option value="tj"> Tajikistan </option><option value="tz"> Tanzania </option>

                    <option value="th"> Thailand </option><option value="tg"> Togo </option><option value="tk"> Tokelau </option><option value="to"> Tonga </option>
                    <option value="tt"> Trinidad and Tobago </option><option value="tn"> Tunisia </option><option value="tr"> Turkey </option><option value="tm"> Turkmenistan </option><option value="tc"> Turks and Caicos Islands </option><option value="tv"> Tuvalu </option><option value="ug"> Uganda </option><option value="ua"> Ukraine </option><option value="ae"> United Arab Emirates </option><option value="gb"> United Kingdom </option><option value="us"> United States </option><option value="uy"> Uruguay </option><option value="uz"> Uzbekistan </option><option value="vu"> Vanuatu </option><option value="va"> Vatican </option><option value="ve"> Venezuela </option><option value="vn"> Viet Nam </option><option value="vg"> Virgin Islands (British) </option><option value="vi"> Virgin Islands (US) </option>

                    <option value="wf"> Wallis and Futuna Islands </option><option value="eh"> Western Sahara </option><option value="ye"> Yemen </option><option value="yu"> Yugoslavia </option><option value="zm"> Zambia </option><option value="zw"> Zimbabwe </option>
                  </select>';

    if(!$config['site']['create_account_verify_mail'])
    $main_content .= '<script type="text/javascript">var verifpass=1;</script>
                        <TR><TD width="150" valign="top"><B>Senha: </B></TD><TD colspan="2"><INPUT TYPE="password" id="passor" NAME="reg_password" VALUE="" SIZE=30 MAXLENGTH=50><BR><font size="1" face="verdana,arial,helvetica">(coloque aqui a senha que você quer para sua conta no '.$config['server']['serverName'].')</font></TD></TR>
                      <TR><TD width="150" valign="top"><B>Repita a senha: </B></TD><TD colspan="2"><INPUT TYPE="password" id="passor2" NAME="reg_password2" VALUE="" SIZE=30 MAXLENGTH=50><BR><font size="1" face="verdana,arial,helvetica">(Repita sua senha)</font></TD></TR>';
    else
{
}
    $main_content .= '</TABLE>
                      </TD></TR>
                      <TR><TD>
                        
                      </TD></TR>
                      <TR><TD>
                      
                      </TD></TR>
                    </TABLE></TD></TR>
                    </TABLE>
                    <BR>
                    <TABLE BORDER=0 WIDTH=100%>
                      <TR><TD ALIGN=center>
                        <IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR>
                      </TD><TD ALIGN=center VALIGN=top>
                        <INPUT TYPE=image NAME="I Agree" SRC="'.$layout_name.'/images/buttons/sbutton_iagree.gif" BORDER=0 WIDTH=120 HEIGHT=18>
                        </FORM>
                      </TD><TD ALIGN=center>
                        <FORM  ACTION="?subtopic=latestnews" METHOD=post>
                        <INPUT TYPE=image NAME="Cancel" SRC="'.$layout_name.'/images/buttons/sbutton_cancel.gif" BORDER=0 WIDTH=120 HEIGHT=18>
                        </FORM>
                      </TD><TD ALIGN=center>
                        <IMG SRC="/images/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR>
                      </TD></TR>
                    </TABLE>
                    </TD>
                    <TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD>
                    </TR>
                    </TABLE>';
}
//CREATE ACCOUNT PAGE (save account in database)
if($action == "saveaccount") {
      $reg_country = trim($_POST['country']);
    $reg_name = strtoupper(trim($_POST['reg_name']));
    $reg_email = trim($_POST['reg_email']);
    $reg_password = trim($_POST['reg_password']);
    $reg_code = trim($_POST['reg_code']);
    //FIRST check
    //check e-mail
    if(empty($reg_name))
        $reg_form_errors[] = "Por Favor Escolha sua conta.";
    elseif(!check_account_name($reg_name))
        $reg_form_errors[] = "Invalid account name format. Use only A-Z and numbers 0-9.";
    if(empty($reg_email))
        $reg_form_errors[] = "Por Favor Escolha seu E-mail.";
    else
    {
        if(!check_mail($reg_email))
            $reg_form_errors[] = "O E-mail está incorreto.";
    }
    if($config['site']['verify_code'])
    {

     }
    //check password
    if(empty($reg_password) && !$config['site']['create_account_verify_mail'])
        $reg_form_errors[] = "Por Favor escolha sua senha para criar a conta.";
    elseif(!$config['site']['create_account_verify_mail'])
    {
        if(!check_password($reg_password))
            $reg_form_errors[] = "Password contains illegal chars (a-z, A-Z and 0-9 only!) or lenght.";
    }
    //SECOND check
    //check e-mail address in database
    if(empty($reg_form_errors))
    {
        if($config['site']['one_email'])
        {
            $test_email_account = $ots->createObject('Account');
            //load account with this e-mail
            $test_email_account->findByEmail($reg_email);
            if($test_email_account->isLoaded())
                $reg_form_errors[] = "Account with this e-mail address already exist in database.";
        }
        $account_db = new OTS_Account();
        $account_db->find($reg_name);
        if($account_db->isLoaded())
            $reg_form_errors[] = 'Ja existe !';
    }
    // ----------creates account-------------(save in database)
    if(empty($reg_form_errors))
    {
        //create object 'account' and generate new acc. number
        if($config['site']['create_account_verify_mail'])
        {
            $reg_password = '';
            for ($i = 1; $i <= 6; $i++)
                $reg_password .= mt_rand(0,9);
        }
        $reg_account = $ots->createObject('Account');
        $number = $reg_account->create(0, 9999999, $reg_name);
        // saves account information in database
        $reg_account->setPassword(password_ency($reg_password));
        $reg_account->setEMail($reg_email);
        $reg_account->setCustomField("flag", $reg_country);
        $reg_account->unblock();
        $reg_account->save();
        if($config['site']['newaccount_premdays'])
        {
            $reg_account->setCustomField("premdays", $config['site']['newaccount_premdays']);
            $reg_account->setCustomField("lastday", time());
        }
        //show information about registration
        if($config['site']['send_emails'] && $config['site']['create_account_verify_mail'])
        {
            $mailBody = '<html>
            <body>
            <h3>Your account name and password!</h3>
            <p>You or someone else registred on server <a href="'.$config['server']['url'].'"><b>'.$config['server']['serverName'].'</b></a> with this e-mail.</p>
            <p>Account name: <b>'.$reg_name.'</b></p>
            <p>Password: <b>'.trim($reg_password).'</b></p>
            <br />
            <p>After login you can:</p>
            <li>Create new characters
            <li>Change your current password
            <li>Change your current e-mail
            </body>
            </html>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

check_accoun.php

<?PHP
function check_account_name($name)//sprawdza name
{
  $temp = strspn("$name", "QWERTYUIOPASDFGHJKLZXCVBNM0123456789");
  if ($temp != strlen($name))
    return false;
  if(strlen($name) > 32)
    return false;
  else
  {
    $ok = "/[A-Z0-9]/";
    return (preg_match($ok, $name))? true: false;
  }
}

echo '<?xml version="1.0" encoding="utf-8" standalone="yes"?>';
$config_ini = parse_ini_file('../config/config.ini');
$account = strtoupper(trim($_REQUEST['account']));
if(empty($account))
{
    echo '<font color="red">Please enter an account number.</font>';
    exit;
}
    if(strlen($account) > 0 && strlen($account) < 32)
    {
        if(!check_account_name($account))
        {
            echo '<font color="red">Invalid account name format. Use only A-Z and numbers 0-9.</font>';
            exit;
        }
            //connect to DB
            $server_config = parse_ini_file($config_ini['server_path'].'config.lua');
            if(isset($server_config['mysqlHost']))
            {
                //new (0.2.6+) ots config.lua file
                $mysqlhost = $server_config['mysqlHost'];
                $mysqluser = $server_config['mysqlUser'];
                $mysqlpass = $server_config['mysqlPass'];
                $mysqldatabase = $server_config['mysqlDatabase'];
                $sqlitefile = $server_config['sqliteDatabase'];
            }
            elseif(isset($server_config['sqlHost']))
            {
                //old (0.2.4) ots config.lua file
                $mysqlhost = $server_config['sqlHost'];
                $mysqluser = $server_config['sqlUser'];
                $mysqlpass = $server_config['sqlPass'];
                $mysqldatabase = $server_config['sqlDatabase'];
                $sqlitefile = $server_config['sqliteDatabase'];
            }
            // loads #####POT mainfile#####
            include('../pot/OTS.php');
            // PDO and POT connects to database
            $ots = POT::getInstance();
            if($server_config['sqlType'] == "mysql")
                $ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase) );
            elseif($server_config['sqlType'] == "sqlite")
                $ots->connect(POT::DB_SQLITE, array('database' => $config_ini['server_path'].$sqlitefile));
            $account_db = new OTS_Account();
            $account_db->find($account);
            if($account_db->isLoaded())
                echo '<font color="red">Account with this name already exist.</font>';
            else
                echo '<font color="green">Good account name ( '.$account.' ). You can create account.</font>';
        
    }
    else
        echo '<font color="red">Account name is too long (max. 32 chars).</font>';

?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

latestnews.php

<?PHP
//######################## SHOW TICKERS AND NEWS #######################
$time = time();

/////////////////////////////////////////////////////////////////////////////////////////
//The new edition of my script: Best Player, Last joined and something new Server Motd.//
/////////////////////////Everything in the new appearance.///////////////////////////////
//////////////////////////////////////by  Aleh///////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
///Queries ///
$query = $SQL->query('SELECT `players`.`name`,`players`.`id`,`players`.`level`, `players`.`experience`, `server_motd`.`id`, `server_motd`.`text` FROM `players`,`server_motd` WHERE `players`.`group_id` < '.$config['site']['players_group_id_block'].' AND `players`.`name` != "Account Manager" ORDER BY `players`.`level` DESC, `players`.`experience` DESC, `server_motd`.`id` DESC LIMIT 1;')->fetch();
$query2 = $SQL->query('SELECT `id`, `name` FROM `players` ORDER BY `id` DESC LIMIT 1;')->fetch();
$housesfree = $SQL->query('SELECT COUNT(*) FROM `houses` WHERE `owner`=0;')->fetch();
$housesrented = $SQL->query('SELECT COUNT(*) FROM `houses` WHERE `owner`=1;')->fetch();
$players = $SQL->query('SELECT COUNT(*) FROM `players` WHERE `id`>0;')->fetch();
$accounts = $SQL->query('SELECT COUNT(*) FROM `accounts` WHERE `id`>0;')->fetch();
$banned = $SQL->query('SELECT COUNT(*) FROM `bans` WHERE `id`>0;')->fetch();
$guilds = $SQL->query('SELECT COUNT(*) FROM `guilds` WHERE `id`>0;')->fetch();
///End Queries ///

    $main_content .= '<table bgcolor='.$config['site']['darkborder'].' border=0 cellpadding=4 cellspacing=1 width=100%>
    <tr bgcolor='. $config['site']['vdarkborder'] .'><td align="center" class=white colspan=1><b>Welcome to '.$config['server']['serverName'].'</b></td></tr>
    <tr><td><table border=0 cellpadding=1 cellspacing=1 width=100%>

    <tr bgcolor='. $config['site']['lightborder'] .'><td><center>Last joined us: <a href="?subtopic=characters&name='.urlencode($query2['name']).'">'.$query2['name'].'</a>, player number '.$query2['id'].'. Welcome and wish you a nice game!</center></td></tr>
    <tr bgcolor='. $config['site']['lightborder'] .'><td><center>Currently, the best player on the server is: <a href="index.php?subtopic=characters&name='.urlencode($query['name']).'"> '.$query['name'].'</a> ('.urlencode($query['level']).'). Congratulations!</center></td></tr>
    <tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Server motd:</b> '.$query['text'].'</center></td></tr> 
    <table border=0 cellpadding=0 cellspacing=1 width=100%>
      <tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Free Houses:</b> '.$housesfree[0].'</center></td>
    <td><center><b>Rented Houses:</b> '.$housesrented[0].'</center></td></tr>      
    <tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Accounts</b> in database: '.$accounts[0].'</center></td>
    <td><center><b>Players</b> in database: '.$players[0].'</center></td></tr>
    <tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Banned</b> accounts: '.$banned[0].'</center></td>
    <td><center><b>Guilds</b> in databese: '.$guilds[0].'</center></td></tr>

</table></td></tr></table>';

$main_content .= '<div class="NewsHeadline">
        <div class="NewsHeadlineBackground" style="background-image:url(' . $layout_name . '/images/news/newsheadline_background.gif)">
                <table border="0">
                        <tr>
                                
                                        <center><font color="white"><b><font size="3">.:: Most Powerfull Guilds ::.</b></font></center>

                        </tr>
                </table>
        </div>
</div>
<table border="0" cellspacing="3" cellpadding="4" width="100%">
        <tr>';

foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`,
        `g`.`logo_gfx_name` AS `logo`, COUNT(`g`.`name`) as `frags`
FROM `killers` k
        LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
        LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id`
        LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id`
        LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id`
WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1
        GROUP BY `name`
        ORDER BY `frags` DESC, `name` ASC
        LIMIT 0, 4;') as $guild)
        $main_content .= '              <td style="width: 25%; text-align: center;">
                        <a href="?subtopic=guilds&action=show&guild=' . $guild['id'] . '"><img src="guilds/' . ((!empty($guild['logo']) && file_exists('guilds/' . $guild['logo'])) ? $guild['logo'] : 'default_logo.gif') . '" width="64" height="64" border="0"/><br />' . $guild['name'] . '</a><br />' . $guild['frags'] . ' kills
                </td>';

$main_content .= '      </tr>
</table>';

///Don't delete this! Please respect my work! I
if($action == "") {

//show tickers if any in database or not blocked (tickers limit = 0)
$tickers = $SQL->query('SELECT * FROM `z_news_tickers` WHERE hide_ticker != 1 ORDER BY date DESC LIMIT 4;');
$number_of_tickers = 0;
if(is_object($tickers)) {
foreach($tickers as $ticker) {
if(is_int($number_of_tickers / 2))
        $color = "Odd";
else
        $color = "Even";
$tickers_to_add .= '<div id="TickerEntry-'.$number_of_tickers.'" class="Row" onclick=\'TickerAction("TickerEntry-'.$number_of_tickers.'")\'>
  <div class="'.$color.'">
    <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
    <div id="TickerEntry-'.$number_of_tickers.'-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
    <div class="NewsTickerText">
      <span class="NewsTickerDate">'.date("j M Y", $ticker['date']).' -</span>
      <div id="TickerEntry-'.$number_of_tickers.'-ShortText" class="NewsTickerShortText">';
//if admin show button to delete (hide) ticker
if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
$tickers_to_add .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$ticker['date'].'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
}
$tickers_to_add .= short_text($ticker['text'], 60).'</div>
      <div id="TickerEntry-'.$number_of_tickers.'-FullText" class="NewsTickerFullText">';
//if admin show button to delete (hide) ticker
if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
$tickers_to_add .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$ticker['date'].'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
}
$tickers_to_add .= $ticker['text'].'</div>
    </div>
  </div>
</div>';
$number_of_tickers++;
}
}

if(!empty($tickers_to_add)) {
//show table with tickers
$news_content .= '<div id="newsticker" class="Box">
    <div class="Corner-tl" style="background-image: url('.$layout_name.'/images/content/corner-tl.gif);"></div>
    <div class="Corner-tr" style="background-image: url('.$layout_name.'/images/content/corner-tr.gif);"></div>
    <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
    <div class="BorderTitleText" style="background-image: url('.$layout_name.'/images/content/title-background-green.gif);"></div>
    <img class="Title" src="'.$layout_name.'/images/header/headline-newsticker.gif" alt="Contentbox headline">
    <div class="Border_2">
      <div class="Border_3">
        <div class="BoxContent" style="background-image: url('.$layout_name.'/images/content/scroll.gif);">';
if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
$news_content .= '<script type="text/javascript">
var showednewticker_state = "0";
function showNewTickerForm()
{
if(showednewticker_state == "0") {
document.getElementById("newtickerform").innerHTML = \'<form action="?subtopic=latestnews&action=newticker" method="post" ><table border="0"><tr><td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="F1E0C6"><tr><td><img src="images/news/icon_0.gif" width="20"></td><td><img src="images/news/icon_1.gif" width="20"></td><td><img src="images/news/icon_2.gif" width="20"></td><td><img src="images/news/icon_3.gif" width="20"></td><td><img src="images/news/icon_4.gif" width="20"></td></tr><tr><td><input type="radio" name="icon_id" value="0" checked="checked"></td><td><input type="radio" name="icon_id" value="1"></td><td><input type="radio" name="icon_id" value="2"></td><td><input type="radio" name="icon_id" value="3"></td><td><input type="radio" name="icon_id" value="4"></td></tr></table></td></tr><tr><td align="center" bgcolor="D4C0A1"><b>New<br>ticker<br>text:</b></td><td bgcolor="F1E0C6"><textarea name="new_ticker" rows="3" cols="45"></textarea></td></tr><tr><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></form><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div></td></tr></table>\';
document.getElementById("jajo").innerHTML = \'\';
showednewticker_state = "1";
}
else {
document.getElementById("newtickerform").innerHTML = \'\';
document.getElementById("jajo").innerHTML = \'<div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/addticker.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div>\';
showednewticker_state = "0";
}
}
</script><div id="newtickerform"></div><div id="jajo"><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/addticker.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div></div><hr/>';
//add tickers list
$news_content .= $tickers_to_add;
//koniec
$news_content .= '</div>
      </div>
    </div>
    <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
    <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
    <div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
  </div>';
}
}
//##################### ADD NEW TICKER #####################
if($action == "newticker") {
if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
$ticker_text = stripslashes(trim($_POST['new_ticker']));
$ticker_icon = (int) $_POST['icon_id'];
if(empty($ticker_text)) {
$main_content .= 'You can\'t add empty ticker.';
}
else
{
if(empty($ticker_icon)) {
$ticker_icon = 0;
}
$SQL->query('INSERT INTO '.$SQL->tableName('z_news_tickers').' (date, author, image_id, text, hide_ticker) VALUES ('.$SQL->quote($time).', '.$account_logged->getId().', '.$ticker_icon.', '.$SQL->quote($ticker_text).', 0)');
$main_content .= '<center><h2><font color="red">Added new ticker:</font></h2></center><hr/><div id="newsticker" class="Box"><div id="TickerEntry-1" class="Row" onclick=\'TickerAction("TickerEntry-1")\'>
  <div class="Odd">
    <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
    <div id="TickerEntry-1-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
    <div class="NewsTickerText">
      <span class="NewsTickerDate">'.date("j M Y", $time).' -</span>
      <div id="TickerEntry-1-ShortText" class="NewsTickerShortText">';
$main_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
$main_content .= short_text($ticker_text, 60).'</div>
      <div id="TickerEntry-1-FullText" class="NewsTickerFullText">';
$main_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
$main_content .= $ticker_text.'</div>
    </div>
  </div>
</div></div><hr/>';
}
}
else
{
$main_content .= 'You don\'t have admin rights. You can\'t add new ticker.';
}
$main_content .= '<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form>';
}
//#################### DELETE (HIDE only!) TICKER ############################
if($action == "deleteticker") {
if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
header("Location: ");
$date = (int) $_REQUEST['id'];
$SQL->query('UPDATE '.$SQL->tableName('z_news_tickers').' SET hide_ticker = 1 WHERE '.$SQL->fieldName('date').' = '.$date.';');
$main_content .= '<center>News tickets with <b>date '.date("j F Y, g:i a", $date).'</b> has been deleted.<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
}
else
{
$main_content .= '<center>You don\'t have admin rights. You can\'t delete tickers.<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
}
}
if($group_id_of_acc_logged >= $config['site']['access_admin_panel']){$main_content .=  '<a href="?subtopic=forum&action=new_topic&section_id=1">Add new news</a>';}
$zapytanie = $SQL->query("SELECT `z_forum`.`post_topic`, `z_forum`.`author_guid`, `z_forum`.`post_date`, `z_forum`.`post_text`, `z_forum`.`id`, `z_forum`.`replies`, `players`.`name` FROM `z_forum`, `players` WHERE `section` = '1' AND `z_forum`.`id` = `first_post` AND `players`.`id` = `z_forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 3;")->fetchAll();
foreach ($zapytanie as $row)
{
         $BB = array(
        '/\[b\](.*?)\[\/b\]/is' => '<strong>$1</strong>',
        '/\[quote\](.*?)\[\/quote\]/is' => '<table cellpadding="0" style="background-color: #c4c4c4; width: 480px; border-style: dotted; border-color: #007900; border-width: 2px"><tr><td>$1</td></tr></table>',
        '/\[u\](.*?)\[\/u\]/is' => '<u>$1</u>',
        '/\[i\](.*?)\[\/i\]/is' => '<i>$1</i>',
        '/\[url](.*?)\[\/url\]/is' => '<a href=$1>$1</a>',
        '/\[img\](.*?)\[\/img\]/is' => '<img src=$1 alt=$1 />',
        '/\[player\](.*?)\[\/player\]/is' => '<a href='.$server['ip'].'?subtopic=characters&amp;name=$1>$1</a>',
        '/\[code\](.*?)\[\/code\]/is' => '<div dir="ltr" style="margin: 0px;padding: 2px;border: 1px inset;width: 500px;height: 290px;text-align: left;overflow: auto"><code style="white-space:nowrap">$1</code></div>'
        );
        $message = preg_replace(array_keys($BB), array_values($BB), nl2br($row['post_text']));
        $main_content .= '<div class=\'NewsHeadline\'>
        <div class=\'NewsHeadlineBackground\' style=\'background-image:url('.$layout_name.'/images/news/newsheadline_background.gif)\'>
        <table border=0><tr><td><img src="'.$layout_name.'/images/news/icon_1.gif" class=\'NewsHeadlineIcon\' alt=\'\' />
        </td><td><font color="'.$layout_ini['news_title_color'].'">'.date('d.m.y H:i:s', $row['post_date']).' - <b>'.$row['post_topic'].'</b></font></td></tr></table>
        </div>
        </div>
        <table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'><tr>
        <td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>';
        if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
        {
            $main_content .='<td width="100%">'.$message.'<br><h6><i>Posted by </i><font color="green">'.$row['name'].'</font></h6><p align="right"><a href="?subtopic=forum&action=remove_post&id='.$row['id'].'"><font color="red">[Delete this news]</font></a>  <a href="?subtopic=forum&action=edit_post&id='.$row['id'].'"><font color="green">[Edit this news]</font></a>      <a href="?subtopic=forum&action=show_thread&id='.$row['id'].'">Comments: '.$row['replies'].'</a></p>';
        }
        else        
        {
            $main_content .='<td width="100%">'.$message.'<br><h6><i>Posted by </i><font color="green">'.$row['name'].'</font></h6><p align="right"><a href="?subtopic=forum&action=show_thread&id='.$row['id'].'">Comments: '.$row['replies'].'</a></p>';        
        }
        $main_content .= '</td>
        <td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
        </tr></table>';
}

?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

downloads.php

<?PHP
$main_content .= '<br />
<center>
<table border=1>
<td>
<TABLE WIDTH=530 BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="#505050" colspan=5><B><font color="#505050">..</font><FONT COLOR="WHITE">Downloads:</font></B></TD></TR>

<TR BGCOLOR="#F1E0C6"><TD width="110" align=center><B>Nome</B></TD><TD width="235" align=center><B>Descri&ccedil;&otilde;es</B></TD><TD width="70" align=center><B>Link</b><br>


<TR BGCOLOR="#D4C0A1">
<TD align=center>Cliente Proprio</TD>
<TD align=center><font size=2>Vers&atilde;o 8.60</TD>
<TD align=center><a href="http://www.mediafire.com/file/yjlmcn9ujikssc8/BaiakCiteronWar.exe" target="Tibia">Clique aqui</a></TD>
</TR>

<TR BGCOLOR="#F1E0C6">
<TD align=center>IP-Changer</TD>
<TD align=center><font size=2>Use em conjunto com o cliente do Tibia.</TD>
<TD align=center><a href="http://files.baixe.net/ipchanger.zip" target="ipchangerr">Clique aqui</a></TD>
</TR>

<TR BGCOLOR="#D4C0A1">
<TD align=center>Hypercam</TD>
<TD align=center><font size=2>Utilizado para fazer Videos.</TD>
<TD align=center><a href="http://www.solveigmm.com/files/SolveigMM_HyperCam_3_0.zip" target="HYPERCAM">Clique aqui</a></TD>

</TR>

<TR BGCOLOR="#F1E0C6">
<TD align=center>Team Speak</TD>
<TD align=center><font size=2>Para n&atilde;o ficar mudo enquanto estiver jogando.</TD>

<TD align=center><a href="ftp://ftp.freenet.de/pub/4players/teamspeak.org/releases/ts2_client_rc2_2032.exe" target="HYPERCAM">Clique aqui</a></TD>
</TR>

</table>
</td>
</table>
';
?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

characters.php

 <?PHP
$name = stripslashes(ucwords(strtolower(trim($_REQUEST['name']))));
if(empty($name)) {
    $main_content .= '<FORM ACTION="?subtopic=characters" METHOD=post><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Procurar Personagens</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Nome:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>';
}
else
{
    if(check_name($name)) {
        $player = $ots->createObject('Player');
        $player->find($name);
        if($player->isLoaded()) {
            $account = $player->getAccount();
            $main_content .= '<TABLE border=0 cellpadding=0 width=100%><td VALIGN=top><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Informações dos Personagens</B></TD></TR>';
            if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
            $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD width=1><nobr><b>Nome:</b></TD><TD><font color="';
            $main_content .= ($player->isOnline()) ? 'green' : 'red';
            $main_content .= '"><b>'.$player->getName().'</b></font>';
            $main_content .= ($account->ispremium()) ? ' ' : '';
            if($player->isDeleted())
                $main_content .= '<font color="red"> [Deletado]</font>';
            if($player->isNameLocked())
                $main_content .= '<font color="red"> [Nome em Mudança]</font>';
            $main_content .= '</TD></TR>';
            if($player->getOldName())
            {
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                if($player->isNameLocked())
                    $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Proposition:</TD><TD>'.$player->getOldName().'</TD></TR>';
                else
                    $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><b>Nome Antigo:</b></TD><TD>'.$player->getOldName().'</TD></TR>';
            }
            
            // BEGIN Position Showing *** Fixed by jerryb1988 from otfans.net
            $group = $player->getGroup();
            if ($group == 2){$group_name = 'Tutor';}
            if ($group == 3){$group_name = 'Senior Tutor';}
            if ($group == 4){$group_name = 'GameMaster';}
            if ($group == 5){$group_name = 'Comunnity Manager';}
        if ($group == 6){$group_name = 'GOD';}
            if ($group == 7){$group_name = 'Administrador';}

            if($group != 1)
            {
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><b>Group:</b></TD><TD>'.$group_name.'</TD></TR>';
            }
            // END Position Showing
            
            if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
            $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><b>Sexo:</b></TD><TD>';
            $main_content .= ($player->getSex() == 0) ? 'Feminino' : 'Masculino';
            $main_content .= '</TD></TR>';
            if($config['site']['show_marriage_info'])
            {
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Marital status:</TD><TD>';
                $marriage = new OTS_Player();
                $marriage->load($player->getMarriage());
                if($marriage->isLoaded())
                    $main_content .= 'married to <a href="?subtopic=characters&name='.urlencode($marriage->getName()).'"><b>'.$marriage->getName().'</b></a></TD></TR>';
                else
                    $main_content .= 'single</TD></TR>';
            }
            if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
            $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><b>Vocação:</b></TD><TD>'.$vocation_name[$player->getWorld()][$player->getPromotion()][$player->getVocation()].'</TD></TR>';
            if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
            $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><b>Level:</b></TD><TD>'.$player->getLevel().'</TD></TR>';
            if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
            $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><b>Mundo:</b></TD><TD>'.$config['site']['worlds'][$player->getWorld()].'</TD></TR>';
            if(!empty($towns_list[$player->getWorld()][$player->getTownId()]))
            {
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><b>Residencia:</b></TD><TD>'.$towns_list[$player->getWorld()][$player->getTownId()].'</TD></TR>';
            }
        /*Vip Status*/ 
            if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;  
            $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Vip Status:</TD><TD>';  
            $main_content .= ($account->getPlayerVip_Time()) ? '<b><font color="green">VIP</font></b>' : '<b><font color="red">NOT VIP</font></b>';  
            

            $rank_of_player = $player->getRank();
            if(!empty($rank_of_player))
            {
            $guild_id = $rank_of_player->getGuild()->getId();
            $guild_name = $rank_of_player->getGuild()->getName();
            if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
            $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><NOBR><b>Guild</b></TD><TD>'.$rank_of_player->getName().' of the <a href="?subtopic=guilds&action=show&guild='.$guild_id.'">'.$guild_name.'</a></TD></TR>';
            }
            
            if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
            $lastlogin = $player->getLastLogin();
            if(empty($lastlogin))
                $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><NOBR><b>Ultimo Acesso</b></TD><TD><b>Nunca Logou.</b></TD></TR>';
            else
                $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><NOBR><b>Ultimo Acesso:</b></TD><TD>'.date("j F Y, g:i a", $lastlogin).'</TD></TR>';
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
            if($config['site']['show_creationdate'] && $player->getCreated())
            {
                $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><NOBR><b>Char Criado:</b></TD><TD>'.date("j F Y, g:i a", $player->getCreated()).'</TD></TR>';
            }


        //equipment shower by ballack13
        if($config['site']['show_itens_status'])
            {
            $id = $player->getCustomField("id");
            $number_of_items = 1;
            $main_content .= '<td align=center><table with=100% style="border: solid 1px #888888;" CELLSPACING="1"><TR>';        
                        $list = array('2','1','3','6','4','5','9','7','10','8'); 
                        foreach ($list as $pid => $name) {
                        $top = $SQL->query('SELECT * FROM player_items WHERE player_id = '.$id.' AND pid = '.$list[$pid].';')->fetch();
                           if($top[itemtype] == false) {
                           if($list[$pid] == '8') {
            $main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Soul:<br/>'.$player->getSoul().'</td>';
            }
                if(is_int($number_of_items / 3)){
            $main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$list[$pid].'.gif"/></TD></tr><tr>';
                } else {
            $main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$list[$pid].'.gif"/></TD>';
            }
                $number_of_items++;
            }
            else
            {
                           if($list[$pid] == '8') {
            $main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Soul:<br/>'.$player->getSoul().'</td>';
            }
                if(is_int($number_of_items / 3))
            $main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$top[itemtype].'.gif" width="45"/></TD></tr><tr>';
                else
            $main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$top[itemtype].'.gif" width="45"/></TD>';
                $number_of_items++;
            }
                           if($list[$pid] == '8') {
            $main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Cap:<br/>'.$player->getCap().'</td>';
            }
            }
            
            $main_content .= '</tr></TABLE></td>';


            //Hp/Mana/Exp Status by ballack13
            if($config['site']['show_hp_status'])
            {
                        $hp = ($player->getHealth() / $player->getHealthMax() * 100);
                        $mana = ($player->getMana() / $player->getManaMax() * 100);
                  $main_content .= '<td align=center ><table width=100%><tr><td align=center><table CELLSPACING="1" CELLPADDING="4"><tr><td BGCOLOR="#D4C0A1" align="left" width="20%"><b>Player Health:</b></td>
                                    <td BGCOLOR="#D4C0A1" align="left">'.$player->getHealth().'/'.$player->getHealthMax().'<div style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: red; width: '.$hp.'%; height: 3px;"></td></tr>
                                    <tr><td BGCOLOR="#F1E0C6" align="left"><b>Player Mana:</b></td><td BGCOLOR="#F1E0C6" align="left">'.$player->getMana().'/'.$player->getManaMax().'<div style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: blue; width: '.$mana.'%; height: 3px;"></td></tr></table><tr>';

                        $next = ($player->getLevel() + 1);
                        $exp = ((50 / 3) * ($player->getLevel() * $player->getLevel() * $player->getLevel()) - (100 * ($player->getLevel() * $player->getLevel())) + ((850/3) * $player->getLevel()) - 200);
                        $expnext = ((50 / 3) * ($next * $next * $next) - (100 * ($next * $next)) + ((850/3) * $next) - 200 - $player->getExperience());
                        $expresult = (100 - ($expnext / (($expnext  + $player->getExperience()) - $exp) * 100));
                       $main_content .= '<tr><table CELLSPACING="1" CELLPADDING="4"><tr><td BGCOLOR="#D4C0A1" align="left" width="20%"><b>Player Level:</b></td><td BGCOLOR="#D4C0A1" align="left">'.$player->getLevel().'</td></tr>
                                  <tr><td BGCOLOR="#F1E0C6" align="left"><b>Player Experience:</b></td><td BGCOLOR="#F1E0C6" align="left">'.$player->getExperience().' EXP.</td></tr>
                                  <tr><td BGCOLOR="#D4C0A1" align="left"><b>To Next Level:</b></td><td BGCOLOR="#D4C0A1" align="left">You need <b>'.$expnext.' EXP</b> to Level <b>'.$next.'</b>.<div title="99.320604545 %" style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: red; width: '.$expresult.'%; height: 3px;"></td></tr></table></td></tr></table></tr></TABLE></td>';
                    
            }
        }

        if($config['site']['show_skills_info']) {
            //Skills Pics v2. Table borders optimized by Absolute Mango
            $main_content .= '<br/><table cellspacing="0" cellpadding="0" border="0" width="200" align="center"><caption><strong>Skills</strong></caption><tbody><tr>
            <td align="center"><a href="?subtopic=highscores&list=experience"><img src="images/skills/level.png" style="border: none;"/></a></td>
            <td align="center"><a href="?subtopic=highscores&list=magic"><img src="images/skills/ml.png" style="border: none;"/></a></td>
            <td align="center"><a href="?subtopic=highscores&list=fist"><img src="images/skills/fist.png" style="border: none;"/></a></td>
            <td align="center"><a href="?subtopic=highscores&list=club"><img src="images/skills/club.png" style="border: none;"/></a></td>
            <td align="center"><a href="?subtopic=highscores&list=sword"><img src="images/skills/sword.png" style="border: none;"/></a></td>
            <td align="center"><a href="?subtopic=highscores&list=axe"><img src="images/skills/axe.png" style="border: none;"/></a></td>
            <td align="center"><a href="?subtopic=highscores&list=distance"><img src="images/skills/dist.png" style="border: none;"/></a></td>
            <td align="center"><a href="?subtopic=highscores&list=shield"><img src="images/skills/def.png" style="border: none;"/></a></td>
            <td align="center"><a href="?subtopic=highscores&list=fishing"><img src="images/skills/fish.png" style="border: none;"/></a></td>
            </tr></tbody></table>
            <table cellspacing="0" cellpadding="0" border="1" width="360" align="center"><tbody><tr><tr bgcolor="'.$config['site']['darkborder'].'">
            <td align="center" width="38"><strong>Level</strong></td>
            <td align="center" width="38"><strong>ML</strong></td>
            <td align="center" width="42"><strong>Fist</strong></td>
            <td align="center" width="40"><strong>Club</strong></td>
            <td align="center" width="38"><strong>Swrd</strong></td>
            <td align="center" width="38"><strong>Axe</strong></td>
            <td align="center" width="38"><strong>Dist</strong></td>
            <td align="center" width="38"><strong>Shield</strong></td>
            <td align="center" width="38"><strong>Fish</strong></td></font>
        </tr>
        <tr bgcolor="'.$config['site']['lightborder'].'">
            <td align="center" width="38">'.$player->getLevel().'</td>
            <td align="center" width="38">'.$player->getMagLevel().'</td>
            <td align="center" width="38">'.$player->getSkill(0).'</td>
            <td align="center" width="38">'.$player->getSkill(1).'</td>
            <td align="center" width="38">'.$player->getSkill(2).'</td>
            <td align="center" width="38">'.$player->getSkill(3).'</td>
            <td align="center" width="38">'.$player->getSkill(4).'</td>
            <td align="center" width="38">'.$player->getSkill(5).'</td>
            <td align="center" width="38">'.$player->getSkill(6).'</td>
        </tr></tbody></table><div table align="center">&nbsp;<br />&nbsp;</div>';
            //skill script end
            }
    
            if($config['site']['show_health_information']) // Modified by Jerryb1988 from otfans.net
            {    
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                $playerhp = $player->getHealth();
                $playermaxhp = $player->getHealthMax();
                $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><td>Health:</td><td>' .number_format($playerhp). '/' .number_format($playermaxhp). '<div style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: red; width: '.(($playerhp / $playermaxhp) * 100).'%; height: 3px;"></td></tr>';
            }
            if($config['site']['show_mana_information']) // Modified by Jerryb1988 from otfans.net
            {    
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                $playermana = $player->getMana();
                $playermaxmana = $player->getManaMax();
                $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><td>Mana:</td><td>' .number_format($playermana). '/' .number_format($playermaxmana). '<div style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: blue; width: '.(($playermana / $playermaxmana) * 100).'%; height: 3px;"></td></tr>';
            }
            if($config['site']['show_exp_information']) // Modified by Jerryb1988 from otfans.net
            {    
                // BEGIN *** Fixed EXP bar by Jerryb1988 from otfans.net
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;

                $currentlevel = $player->getLevel();
                $currentexp = $player->getExperience();
                $currentlevelexp = (50 * ($currentlevel - 1) * ($currentlevel - 1) * ($currentlevel - 1) - 150 * ($currentlevel - 1) * ($currentlevel - 1) + 400 * ($currentlevel - 1)) / 3;
                $nextlevel = ($currentlevel + 1);
                $nextlevelexp = (50 * ($currentlevel) * ($currentlevel) * ($currentlevel) - 150 * ($currentlevel) * ($currentlevel) + 400 * ($currentlevel)) / 3;
                $leveldifference = ($nextlevelexp - $currentlevelexp);
                $expremaining = ($nextlevelexp - $currentexp);
                $partofcurrentexp = ($currentexp-$currentlevelexp);
                $expbarpercentage = (($partofcurrentexp / $leveldifference)*100);
                $togopercentage = (100 - $expbarpercentage);
                $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>EXP:</td><td> ' .number_format($currentexp).'/' .number_format($nextlevelexp).' ('.number_format($expbarpercentage,2).'%) *** '.number_format($expremaining).' EXP (' .number_format($togopercentage,2). '%) Remaining.<div title="'.number_format($expbarpercentage,2).'%" style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: red; width: '.number_format($expbarpercentage,2).'%; height: 3px;"></td></tr>';
                
                // END *** Fixed EXP bar by Jerryb1988 from otfans.net
            }

            //Outfit shower by Pening edited by loleslav
            // ** ADDED GM/CM/GOD outfits by Jerryb1988 from otfans.net
            if($config['site']['show_outfit']) {
                $id = $player->getCustomField("id");
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                $main_content .= '<TD BGCOLOR="'.$bgcolor.'">Outfit:';
                $listaddon = array('75','128','129','130','131','132','133','134','135','136','137','138','139','140','141','142','143','144','145','146','147','148','149','150','151','152','153','154','155','158','159','251','252','266','268','269','270','273','278','279','288','289','302','324','325');
                $lookadd = array('0','1','2','3');
                foreach ($listaddon as $pid => $name)
                    foreach ($lookadd as $addo => $name) {
                        $addon1 = $SQL->query('SELECT * FROM players WHERE id = '.$id.' AND looktype = '.$listaddon[$pid].' AND lookaddons = '.$lookadd[$addo].';')->fetch();
                        if($addon1[looktype] == true ) {
                            $finaddon = $addon1[looktype] + $addon1[lookaddons] * 300;
                            $main_content .= '<TD style="background-color: '.$bgcolor.'"><img src="images/addons/'.$finaddon.'.gif"/></center></TD></TD>';
                        }
                    }
            }
            //end   Outfit shower by Pening edited by loleslav
            
            // Char Comment
            $comment = $player->getComment();
            $newlines   = array("\r\n", "\n", "\r");
            $comment_with_lines = str_replace($newlines, '<br />', $comment, $count);
            if($count < 50)
                $comment = $comment_with_lines;
            if(!empty($comment))
            {
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD VALIGN=top><b>Comentário:</b></TD><TD>'.$comment.'</TD></TR>';
            }
            $main_content .= '</td></table></td>';
            // END Char Comment

            //modified status scripts by ballack13
            
                    
                    
            
            // Signature by makr0mango.
            if($config['site']['show_signature']) {
                function randomSignature( $folder ) {
                    $files = scandir ( "./$folder/" );
                    $signature = array();

                    foreach ( $files as $file ?
                        if ( substr ( strtolower ( $file ) , -4 ) == ".png" )
                            $signature[] = $file;
                    endforeach;

                    return rand(0,count($signature)-1);
                    }
                    $random = randomSignature("signatures");
                    $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Signature</B></TD></TR>';
                    $main_content .= "<TR BGCOLOR=".$config['site']['darkborder']."><TD WIDTH=20%>Forum Link:</TD><TD><input type='text' size='75' onclick='this.select();' value='[url=\"http://" . $_SERVER['HTTP_HOST'] . "\"][IMG=http://" . $_SERVER['HTTP_HOST'] . "/signature.php?character=" .$player->getName(). "&image=" . $random . "][/url]' /></TD></TR>";
                    $main_content .= "<TR BGCOLOR=".$config['site']['lightborder']."><TD WIDTH=20%>Direct Link:</TD><TD><input type='text' size='75' onclick='this.select();' value='http://" . $_SERVER['HTTP_HOST'] . "/signature.php?character=" .$player->getName(). "&image=" . $random . "' /></TD></TR>";
                    $main_content .= "<TR BGCOLOR=".$config['site']['darkborder']."><TD COLSPAN='2' style='text-align: center;'><img src='signature.php?character=" .$player->getName(). "&image=" . $random . "' /></TD></TR>";
                    $main_content .= '</TD></TR></TABLE>';
                    
            }
            // Signature by makr0mango.
            
            //BEGIN Player advances by jerryb1988 from otfans.net
            if($config['site']['number_of_advances'] > 0) {
                $numadvances = $config['site']['number_of_advances'];
                $advances = 0;
                $player_advances = $SQL->query('SELECT * FROM `player_advances` WHERE `cid` = '.$player->getId().' ORDER BY `time` DESC LIMIT '.$numadvances.';');

                foreach($player_advances as $advance)
                {
                    $skill = $advance['skill'];
                    if ($skill == 0){$skill_name = '<font color=purple><B>Fist</B></font>';}
                    if ($skill == 1){$skill_name = '<font color=purple><B>Club</B></font>';}
                    if ($skill == 2){$skill_name = '<font color=purple><B>Sword</B></font>';}
                    if ($skill == 3){$skill_name = '<font color=purple><B>Axe</B></font>';}
                    if ($skill == 4){$skill_name = '<font color=purple><B>Distance</B></font>';}
                    if ($skill == 5){$skill_name = '<font color=purple><B>Shielding</B></font>';}
                    if ($skill == 6){$skill_name = '<font color=purple><B>Fishing</B></font>';}
                    if ($skill == 7){$skill_name = '<font color=blue><B>Magic</B></font>';}
                    if ($skill == 8){$skill_name = '<font color=red><B>Level</B></font>';}
                
                    if(is_int($advances / 2)) { $bgcolor = $config['site']['lightborder']; } else { $bgcolor = $config['site']['darkborder']; } $advances++;
                    
                    $advances_add_content .= "<tr bgcolor=\"".$bgcolor."\"><td width=\"20%\" align=\"center\"><nobr>".date("j M Y, g:i a", $advance['time'])."</td><td>".$skill_name."</td><td width=75><font color=red><B>".$advance['oldlevel']."</B></font></td><td width=75><font color=green><B>".$advance['newlevel']."</B></font></tr>";
                    
                }

                if($advances > 0)
                    $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=4 CLASS=white><B>Lastest Skill Advances</B></TD></TR><tr bgcolor='.$config['site']['darkborder'].'><td><b>Time</b></td><td><b>Skill</b></td><td><b>Old Level</b></td><td><b>New Level</b></td></tr>' . $advances_add_content . '</TABLE><br />';
            }
            //END Advances by jerryb1988 from otfans.net
            
            //deaths list

            $deads = 0;
            $player_deaths = $SQL->query('SELECT `id`, `date`, `level` FROM `player_deaths` WHERE `player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,10;');
            foreach($player_deaths as $death)
            {
                if(is_int($number_of_rows / 2))
                    $bgcolor = $config['site']['darkborder']; else $bgcolor = $config['site']['lightborder'];

                $number_of_rows++; $deads++;
                $dead_add_content .= "<tr bgcolor=\"".$bgcolor."\"><td width=\"20%\" align=\"center\"><nobr>".date("j M Y, g:i a", $death['date'])."</td><td>";
                $killers = $SQL->query("SELECT environment_killers.name AS monster_name, players.name AS player_name, players.deleted AS player_exists FROM killers LEFT JOIN environment_killers ON killers.id = environment_killers.kill_id LEFT JOIN player_killers ON killers.id = player_killers.kill_id LEFT JOIN players ON players.id = player_killers.player_id WHERE killers.death_id = ".$SQL->quote($death['id'])." ORDER BY killers.final_hit DESC, killers.id ASC")->fetchAll();

                $i = 0;
                $count = count($killers);
                foreach($killers as $killer)
                {
                    $i++;
                    if(in_array($i, array(1, $count)))
                        $killer['monster_name'] = str_replace(array("an ", "a "), array("", ""), $killer['monster_name']);

                    if($killer['player_name'] != "")
                    {
                        if($i == 1)
                            $dead_add_content .= "Killed at level <b>".$death['level']."</b> by ";
                        else if($i == $count)
                            $dead_add_content .= " and by ";
                        else
                            $dead_add_content .= ", ";

                        if($killer['monster_name'] != "")
                            $dead_add_content .= $killer['monster_name']." summoned by ";

                        if($killer['player_exists'] == 0)
                            $dead_add_content .= "<a href=\"index.php?subtopic=characters&name=".urlencode($killer['player_name'])."\">";

                        $dead_add_content .= $killer['player_name'];
                        if($killer['player_exists'] == 0)
                            $dead_add_content .= "</a>";
                    }
                    else
                    {
                        if($i == 1)
                            $dead_add_content .= "Morto no Level <b>".$death['level']."</b> por ";
                        else if($i == $count)
                            $dead_add_content .= " e por ";
                        else
                            $dead_add_content .= ", ";

                        $dead_add_content .= $killer['monster_name'];
                    }

                    if($i == $count)
                        $dead_add_content .= ".";
                }

                $dead_add_content .= "</td></tr>";
            }

            if($deads > 0)
                $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Mortes</B></TD></TR>' . $dead_add_content . '</TABLE>';

            //end
            //frags list by Xampy 
             
            $frags_limit = 5; // frags limit to show? // default: 5 
            $player_frags = $SQL->query('SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,'.$frags_limit.';'); 
            if(count($player_frags)) 
            { 
                $frags = 0; 
                $frag_add_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><br><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Vítimas</B></TD></TR>'; 
                foreach($player_frags as $frag) 
                { 
                $frags++; 
                    if(is_int($number_of_rows / 2)) $bgcolor = $config['site']['darkborder']; else $bgcolor = $config['site']['lightborder']; 
                    $number_of_rows++; 
                    $frag_add_content .= "<tr bgcolor=\"".$bgcolor."\"> 
                    <td width=\"20%\" align=\"center\">".date("j M Y, H:i", $frag['date'])."</td> 
                    <td>".(($player->getSex() == 0) ? 'Ela' : 'Ele')." matou <a href=\"index.php?subtopic=characters&name=".$frag[name]."\">".$frag[name]."</a> no Level ".$frag[level].""; 
 
                    $frag_add_content .= ". (".(($frag[unjustified] == 0) ? "<font size=\"1\" color=\"green\">Justificado</font>" : "<font size=\"1\" color=\"red\">Injustificado</font>").")</td></tr>"; 
                } 
            if($frags >= 1) 
                $main_content .= $frag_add_content . '</TABLE>'; 
            } 
            // end of frags list by Xampy  
            //end DEATHS
            
          
            if(!$player->getHideChar()) {
                $main_content .= '<TABLE BORDER=0><TR><TD></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Informações da Conta</B></TD></TR>';
                if($account->getRLName())
                {
                    if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                    $main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=20%><b>Nome Verdadeiro:</b></TD><TD>'.$account->getRLName().'</TD></TR>';
                }
                if($account->getLocation())
                {
                    if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                    $main_content .= '<TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=20%><b>Mora Em:</b></TD><TD>'.$account->getLocation().'</TD></TR>';
                }
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                if($account->getLastLogin())
                    $main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=20%><b>Ultima Visita:</b></TD><TD>'.date("j F Y, g:i a", $account->getLastLogin()).'</TD></TR>';
                else
                    $main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=20%><b>Ultima Visita:</b></TD><TD>Nun nos visitou.</TD></TR>';
                if($account->getCreated())
                {
                    if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                    $main_content .= '<TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=20%><b>Criada em:</b></TD><TD>'.date("j F Y, g:i a", $account->getCreated()).'</TD></TR>';
                }
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['lightborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                
                if($account->isBanned())
                    if($account->getBanTime() > 0)
                        $main_content .= '<font color="red"> [Banished until '.date("j F Y, G:i", $account->getBanTime()).']</font>';
                    else
                        $main_content .= '<font color="red"> [Banished FOREVER]</font>';
                $main_content .= '</TD></TR></TABLE>';
                $main_content .= '<br><TABLE BORDER=0><TR><TD></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=5 CLASS=white><B>Outros Personagens</B></TD></TR>
                <TR BGCOLOR='.$config['site']['darkborder'].'><TD><B>Nome</B></TD><TD><B>Mundo</B></TD><TD><B>Level</B></TD><TD><b>Status</b></TD><TD><B>*</B></TD></TR>';
                $account_players = $account->getPlayersList();
                $account_players->orderBy('name');
                $player_number = 0;
                foreach($account_players as $player_list)
                {
                    if(!$player_list->getHideChar())
                    {
                        $player_number++;
                        if(is_int($player_number / 2))
                            $bgcolor = $config['site']['darkborder'];
                        else
                            $bgcolor = $config['site']['lightborder'];
                        if(!$player_list->isOnline())
                            $player_list_status = '<font color="red">Deslogado</font>';
                        else
                            $player_list_status = '<font color="green">Logado</font>';
                        $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=52%><NOBR><a href="?subtopic=characters&name='.urlencode($player_list->getName()).'">'.$player_list->getName();
                        $main_content .= ($player_list->isDeleted()) ? '<font color="red"> [DELETED]</font>' : '';
                        $main_content .= '</NOBR></TD><TD WIDTH=15%>'.$config['site']['worlds'][$player_list->getWorld()].'</TD><TD WIDTH=25%>'.$player_list->getLevel().' '.$vocation_name[$player_list->getWorld()][$player_list->getPromotion()][$player_list->getVocation()].'</TD><TD WIDTH="8%"><b>'.$player_list_status.'</b></TD><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=characters" METHOD=post><TR><TD><INPUT TYPE=hidden NAME=name VALUE="'.$player_list->getName().'"><INPUT TYPE=image NAME="View '.$player_list->getName().'" ALT="View '.$player_list->getName().'" SRC="'.$layout_name.'/images/buttons/sbutton_view.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></FORM></TABLE></TD></TR>';
                    }
                }
                $main_content .= '</TABLE></TD><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD></TR></TABLE>';
            }
            $main_content .= '<BR><BR><FORM ACTION="?subtopic=characters" METHOD=post><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Procurar Mais Personagens</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Nome:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>';
            $main_content .= '</TABLE>';
        }
        else
            $search_errors[] = 'Character <b>'.$name.'</b> does not exist.';
    }
    else
        $search_errors[] = 'This name contains invalid letters. Please use only A-Z, a-z and space.';
    if(!empty($search_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($search_errors as $search_error)
            $main_content .= '<li>'.$search_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/>';
        $main_content .= '<BR><FORM ACTION="?subtopic=characters" METHOD=post><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Search Character</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>';
    }
}
?> 

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

whoisonline.php

<?php
$cache_sec = 10;
$info = array(
    0 => array('Brasil', '15/04/2012')
);

$id=0;
if(isset($_POST['world'])) {
    $f = null;
    foreach($config['site']['worlds'] as $k => $v)
        if($v == $_POST['world']) {
            $f = true;
            $id = $k;
            break;
        }
    if(!$f)
        $_POST['world'] = $config['site']['worlds'][0];
} else $_POST['world'] = $config['site']['worlds'][0];

$order = 'name_asc';
if(isset($_REQUEST['order']) && in_array($_REQUEST['order'], array('name_desc', 'level_asc','level_desc','vocation_asc','vocation_desc')))
    $order = $_REQUEST['order'];

if(count($config['site']['worlds']) > 1) {
    $main_content =
'<form action="?subtopic=whoisonline" method="post">
    <div class="TableContainer">
        <table class="Table1" cellpadding="0" cellspacing="0">
            <div class="CaptionContainer">
                <div class="CaptionInnerContainer">
                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>
                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>
                    <div class="Text">World Selection</div>
                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>
                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>
                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
                </div>
            </div>
            <tr>
                <td>
                    <div class="InnerTableContainer">
                        <table width="100%">
                            <tr>
                                <td style="vertical-align:middle" class="LabelV150">World Name:</td>
                                <td style="width:170px">
                                    <select size="1" name="world" style="width:165px">';
foreach($config['site']['worlds'] as $v)
    $main_content .= '<option value="'.$v.'"'.($v == $_POST['world'] ? ' selected="selected"' : '').'>'.$v.'</option>';
$main_content .= '
                                    </select>
                                </td>
                                <td style="text-align:left">
                                    <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)">
                                        <div onmouseover="MouseOverBigButton(this)" onmouseout="MouseOutBigButton(this)"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif)"></div>
                                            <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif"/>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</form><br/>
';
}
$main_content .=
'<div class="TableContainer">
    <table class="Table1" cellpadding="0" cellspacing="0">
        <div class="CaptionContainer">
            <div class="CaptionInnerContainer">
                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>
                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>
                <div class="Text">World Information</div>
                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>
                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>
                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
            </div>
        </div>
        <tr>
            <td>
                <div class="InnerTableContainer">
                    <table width="100%">
                        <tr>
                            <td class="LabelV150">Status:</td>
                            <td>O'.($config['status']['serverStatus_online'] == 1 ? 'n' : 'ff').'line</td>
                        </tr>
                        <tr>
                            <td class="LabelV150">Players Online:</td>
                            <td>';
$f = 'cache/whoisonline-'.$_POST['world'].'-'.$order.'.tmp';
$ff = 'cache/whoisonline-'.$_POST['world'].'-record.tmp';
if(file_exists($f) && filemtime($f) > (time() - $cache_sec)) {
    $cp = file_get_contents($f);
    $cached = null;
    if(file_exists($f) && filemtime($f) > (time() - $cache_sec)) {
        $e = explode('|', file_get_contents($ff));
        $n = $e[0];
        $c = $e[1];
        $cached = true;
    }
}
else {
    $cp = '';
    $n = 0;
    $q = 'SELECT name,level,vocation,promotion FROM players WHERE world_id='.$id.' AND online=1';
    if(in_array($order, array('name_asc','name_desc','level_asc','level_desc')))
        $q .= ' ORDER BY '.str_replace('_', ' ', $order);

    if(in_array($order, array('vocation_asc','vocation_desc'))) {
        $a = array();
        $q .= ' ORDER BY level desc';
        foreach($SQL->query($q)->fetchAll() as $p)
            $a[] = array($p['name'], $p['level'], $vocation_name[$id][$p['promotion']][$p['vocation']]);
        function cmp($a, $b) {
            return $a[2][0] == $b[2][0] ? 0 :
                $GLOBALS['order'] == 'vocation_asc'
                    ? ($a[2][0] < $b[2][0] ? -1 : 1)
                    : ($a[2][0] > $b[2][0] ? -1 : 1);
        }
        usort($a, 'cmp');
        foreach($a as $p) {
            $n++;
            $cp .= '<tr class="'.(is_int($n/2)?'Even':'Odd').'" style="text-align:right"><td style="width:70%;text-align:left"><a href="?subtopic=characters&name='.urlencode($p[0]).'">'.$p[0].'</a></td><td style="width:10%">'.$p[1].'</td><td style="width:20%">'.str_replace(' ','*',$p[2]).'</td></tr>';
        }
    }
    else {
        $l = array();
        foreach($SQL->query($q)->fetchAll() as $p) {
            $n++;
            $cp .= '<tr class="'.(is_int($n/2)?'Even':'Odd').'" style="text-align:right"><td style="width:70%;text-align:left">';
            if($order == 'name_asc') {
                $tmp = strtoupper($p['name'][0]);
                if(!in_array($tmp, $l)) {
                    $l[] = $tmp;
                    $cp .= '<a name="'.$tmp.'"></a>';
                }
            }
            $cp .= '<a href="?subtopic=characters&name='.urlencode($p['name']).'">'.$p['name'].'</a></td><td style="width:10%">'.$p['level'].'</td><td style="width:20%">'.str_replace(' ','*',$vocation_name[$id][$p['promotion']][$p['d']]).'</td></tr>';
        }
    }
    file_put_contents($f, $cp);
}
if(!$cached) {
    $r=$SQL->query('SELECT MAX(record) as r,MAX(timestamp) as t FROM server_record WHERE world_id='.$id)->fetch();
    $c = $r['r'].' players (on '.date('M/d/Y,H:i:s T', $r['t']).')';
    file_put_contents($ff, $n.'|'.$c);
}
$main_content .= $n.'</td>
                        </tr>
                        <tr>
                            <td class="LabelV150">Online Record:</td>
                            <td>'.$c.'</td>
                        </tr>
                        <tr>
                            <td class="LabelV150">Uptime:</td>
                            <td>'.$config['status']['serverStatus_uptime'].'</td>
                        </tr>
                        <tr>
                            <td class="LabelV150">Location:</td>
                            <td>'.$info[$id][0].'</td>
                        </tr>
                        <tr>
                            <td class="LabelV150">PvP Type:</td>
                            <td>';
$w=strtolower($config['server']['worldType']);
if(in_array($w, array('pvp','2','normal','open','openpvp')))
    $main_content .= 'Open PvP';
elseif(in_array($w, array('no-pvp','nopvp','non-pvp','nonpvp','1','safe','optional','optionalpvp')))
    $main_content .= 'Optional PvP';
elseif(in_array($w, array('pvp-enforced','pvpenforced','pvp-enfo','pvpenfo','pvpe','enforced','enfo','3','war','hardcore','hardcorepvp')))
    $main_content .= 'Hardcore PvP';
$main_content .= '</td>
                        </tr>
                    </table>
                </div>
            </td>
        </tr>
    </table>
</div><br/>
    <div class="TableContainer">
        <table class="Table2" cellpadding="0" cellspacing="0">    <div class="CaptionContainer">      <div class="CaptionInnerContainer">        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>        <div class="Text">Players Online';
if($order == 'name_asc')
    $main_content .= '<span class="TableHeadlineNavigation"> [ <a href="#A">A</a> <a href="#B">B</a> <a href="#C">C</a> <a href="#D">D</a> <a href="#E">E</a> <a href="#F">F</a> <a href="#G">G</a> <a href="#H">H</a> <a href="#I">I</a> <a href="#J">J</a> <a href="#K">K</a> <a href="#L">L</a> <a href="#M">M</a> <a href="#N">N</a> <a href="#O">O</a> <a href="#P">P</a> <a href="#Q">Q</a> <a href="#R">R</a> <a href="#S">S</a> <a href="#T">T</a> <a href="#U">U</a> <a href="#V">V</a> <a href="#W">W</a> <a href="#X">X</a> <a href="#Y">Y</a> <a href="#Z">Z</a> ]</span>';
$main_content .= '</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer">          <table width="100%"><tr class="LabelH"><td style="text-align:left;width:90%">Name <small style="font-weight:normal">[<a href="?subtopic=whoisonline&world='.$_POST['world'].'&order=name_'.($order == 'name_asc' ? 'desc' : 'asc').'">sort</a>]</small> <img class="sortarrow" src="'.$layout_name.'/images/'.($order == 'name_asc' ? 'content/order_desc' : ($order == 'name_desc' ? 'content/order_asc' : 'news/blank')).'.gif"/></td><td>Level <small style="font-weight:normal">[<a href="?subtopic=whoisonline&world='.$_POST['world'].'&order=level_'.($order == 'level_asc' ? 'desc' : 'asc').'">sort</a>]</small> <img class="sortarrow" src="'.$layout_name.'/images/'.($order == 'level_asc' ? 'content/order_desc' : ($order == 'level_desc' ? 'content/order_asc' : 'news/blank')).'.gif"/></td><td>Vocation <small style="font-weight:normal">[<a href="?subtopic=whoisonline&world='.$_POST['world'].'&order=vocation_'.($order == 'vocation_asc' ? 'desc' : 'asc').'">sort</a>]</small> <img class="sortarrow" src="'.$layout_name.'/images/'.($order == 'vocation_asc' ? 'content/order_desc' : ($order == 'vocation_desc' ? 'content/order_asc' : 'news/blank')).'.gif"/></td></tr>'.$cp.'          </table>        </div>  </table></div></td></tr><br/><form action="?subtopic=characters" method="post"><div class="TableContainer">  <table class="Table1" cellpadding="0" cellspacing="0">    <div class="CaptionContainer">      <div class="CaptionInnerContainer">        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>        <div class="Text">Search Character</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer">          <table width="100%"><tr><td style="vertical-align:middle" class="LabelV150">Character Name:</td><td style="width:170px"><input style="width:165px" name="name" value="" size="29" maxlength="29"/></td><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)"><div onmouseover="MouseOverBigButton(this)" onmouseout="MouseOutBigButton(this)"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif)"></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif"></div></div></td></tr>          </table>        </div>  </table></div></td></tr></form></center>';
?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

highscores.php

<?PHP
$list = $_REQUEST['list'];
$page = $_REQUEST['page'];
switch($list)
{
  case "fist":
   $id = 0;
   $list_name = 'Fist Fighting';
   break;
  case "club":
   $id = 1;
   $list_name = 'Club Fighting';
   break;
  case "sword":
   $id = 2;
   $list_name = 'Sword Fighting';
   break;
  case "axe":
   $id = 3;
   $list_name = 'Axe Fighting';
   break;
  case "distance":
   $id = 4;
   $list_name = 'Distance Fighting';
   break;
  case "shield":
   $id = 5;
   $list_name = 'Shielding';
   break;
  case "fishing":
   $id = 6;
   $list_name = 'Fishing';
   break;
}
if(!isset($id))
    if($list == "magic")
        $list_name = "Magic Level";
    else
    {
        $list_name = 'Experience';
        $list = 'experience';
    }
if(count($config['site']['worlds']) > 1)
{
    $worlds .= '<i>Select world:</i> ';
    foreach($config['site']['worlds'] as $idd => $world_n)
    {
        if($idd == (int) $_GET['world'])
        {
            $world_id = $idd;
            $world_name = $world_n;
        }
    }
}
        if($idd == (int) $_GET['world'])
        {
            $world_id = $idd;
            $world_name = $world_n;
        }
if(!isset($world_id))
{
    $world_id = 0;
    $world_name = $config['server']['serverName'];
}
$offset = $page * 100;
if(isset($id))
    $skills = $SQL->query('SELECT name,online,value,level,vocation,promotion FROM players,player_skills WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND players.id = player_skills.player_id AND player_skills.skillid = '.$id.' ORDER BY value DESC, count DESC LIMIT 101 OFFSET '.$offset);
elseif($list == "magic")
    $skills = $SQL->query('SELECT name,online,maglevel,level,vocation,promotion FROM players WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND name != "Account Manager" ORDER BY maglevel DESC, manaspent DESC LIMIT 101 OFFSET '.$offset);
elseif($list == "experience")
    $skills = $SQL->query('SELECT name,online,level,experience,vocation,promotion FROM players WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND name != "Account Manager" ORDER BY level DESC, experience DESC LIMIT 101 OFFSET '.$offset);
//wyswietlanie wszystkiego
$main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD><TD><CENTER><H2>Ranking for '.$list_name.' on '.$world_name.'</H2></CENTER><BR>';
    $main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD></TD><TD>
<FORM ACTION="?subtopic=highscores" METHOD=get><INPUT TYPE=hidden NAME=subtopic VALUE=highscores><INPUT TYPE=hidden NAME=list VALUE=experience>
<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>World Selection</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['lightborder'].'">
    <TABLE BORDER=0 CELLPADDING=1><TR><TD>World: </TD><TD><SELECT SIZE="1" NAME="world"><OPTION VALUE="" SELECTED>(choose world)</OPTION>';
    foreach($config['site']['worlds'] as $id => $world_n)
{
    $main_content .= '<OPTION VALUE="'.$id.'">'.$world_n.'</OPTION>';
}
    $main_content .= '</SELECT> </TD><TD><INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18>
        </TD></TR></TABLE></TABLE></FORM></TABLE><br><br><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%></TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD WIDTH=10% CLASS=whites><B>Country</B></TD><TD WIDTH=10% CLASS=whites><B>Rank</B></TD><TD WIDTH=75% CLASS=whites><B>Name</B></TD><TD WIDTH=15% CLASS=whites><b><center>Level</center></B></TD>';
if($list == "experience")
    $main_content .= '<TD CLASS=whites><b><center>Points</center></B></TD>';
$main_content .= '</TR><TR>';
foreach($skills as $skill)
{
$player = $ots->createObject('Player');
$player->find($skill['name']);
$account = $player->getAccount();
$account_db = new OTS_Account();
$flagg = $account->getCustomField("flag");
    if($number_of_rows < 100)
    {
        if($list == "magic")
            $skill['value'] = $skill['maglevel'];
        if($list == "experience")
            $skill['value'] = $skill['level'];
        if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
        $main_content .= '<tr bgcolor="'.$bgcolor.'"><td><image src="images/flags/'.$flagg.'.png"/></td><td>'.($offset + $number_of_rows).'.</td><td><a href="?subtopic=characters&name='.urlencode($skill['name']).'">'.($skill['online']>0 ? "<font color=\"green\">".$skill['name']."</font>" : "<font color=\"red\">".$skill['name']."</font>").'</a><br><small>'.$skill['level'].' '.$vocation_name[$world_id][$skill['promotion']][$skill['vocation']].'</small></td><td><center>'.$skill['value'].'</center></td>';
        if($list == "experience")
            $main_content .= '<td><center>'.$skill['experience'].'</center></td>';
        $main_content .= '</tr>';
    }
    else
        $show_link_to_next_page = TRUE;
}
$main_content .= '</TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>';
if($page > 0)
    $main_content .= '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="?subtopic=highscores&list='.$list.'&page='.($page - 1).'" CLASS="size_xxs">Previous Page</A></TD></TR>';
if($show_link_to_next_page)
    $main_content .= '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="?subtopic=highscores&list='.$list.'&page='.($page + 1).'" CLASS="size_xxs">Next Page</A></TD></TR>';
  $main_content .= '</TABLE></TD><TD WIDTH=5%><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=1 HEIGHT=1 BORDER=0></TD><TD WIDTH=15% VALIGN=top ALIGN=right><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=whites><B>Choose<br/>a skill</B></TD></TR><TR BGCOLOR="'.$config['site']['lightborder'].'"><TD><A HREF="?subtopic=highscores&list=experience&world='.$world_id.'" CLASS="size_xs">Experience</A><BR><A HREF="?subtopic=highscores&list=magic&world='.$world_id.'" CLASS="size_xs">Magic</A><BR><A HREF="?subtopic=highscores&list=shield&world='.$world_id.'" CLASS="size_xs">Shielding</A><BR><A HREF="?subtopic=highscores&list=distance&world='.$world_id.'" CLASS="size_xs">Distance</A><BR><A HREF="?subtopic=highscores&list=club&world='.$world_id.'" CLASS="size_xs">Club</A><BR><A HREF="?subtopic=highscores&list=sword&world='.$world_id.'" CLASS="size_xs">Sword</A><BR><A HREF="?subtopic=highscores&list=axe&world='.$world_id.'" CLASS="size_xs">Axe</A><BR><A HREF="?subtopic=highscores&list=fist&world='.$world_id.'" CLASS="size_xs">Fist</A><BR><A HREF="?subtopic=highscores&list=fishing&world='.$world_id.'" CLASS="size_xs">Fishing</A><BR></TABLE></TD><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD></TR></TABLE>';

?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

killstatistics.php

<?PHP
$players_deaths = $SQL->query('SELECT `player_deaths`.`id`, `player_deaths`.`date`, `player_deaths`.`level`, `players`.`name`, `players`.`world_id` FROM `player_deaths` LEFT JOIN `players` ON `player_deaths`.`player_id` = `players`.`id` ORDER BY `date` DESC LIMIT 0,'.$config['site']['last_deaths_limit']);
$players_deaths_count = 0;
if(!empty($players_deaths))
{
    foreach($players_deaths as $death)
    {
        $players_deaths_count++;
        if(is_int($players_deaths_count / 2))
            $bgcolor = $config['site']['darkborder'];
        else
            $bgcolor = $config['site']['lightborder'];

        $players_rows .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH="30"><center>'.$players_deaths_count.'.</center></TD><TD WIDTH="125"><small>'.date("j.m.Y, G:i:s",$death['date']).'</small></TD><TD><a href="?subtopic=characters&name='.urlencode($death['name']).'"><b>'.$death['name'].'</b></a> ';
        $killers = $SQL->query("SELECT environment_killers.name AS monster_name, players.name AS player_name, players.deleted AS player_exists
FROM killers LEFT JOIN environment_killers ON killers.id = environment_killers.kill_id
LEFT JOIN player_killers ON killers.id = player_killers.kill_id LEFT JOIN players ON players.id = player_killers.player_id
WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, killers.id ASC")->fetchAll();

        $i = 0;
        $count = count($killers);
        foreach($killers as $killer)
        {
            $i++;
            if($killer['player_name'] != "")
            {
                if($i == 1)
                    $players_rows .= "killed at level <b>".$death['level']."</b>";
                else if($i == $count)
                    $players_rows .= " and";
                else
                    $players_rows .= ",";

                $players_rows .= " by ";
                if($killer['monster_name'] != "")
                    $players_rows .= $killer['monster_name']." summoned by ";

                if($killer['player_exists'] == 0)
                    $players_rows .= "<a href=\"index.php?subtopic=characters&name=".urlencode($killer['player_name'])."\">";

                $players_rows .= $killer['player_name'];
                if($killer['player_exists'] == 0)
                    $players_rows .= "</a>";
            }
            else
            {
                if($i == 1)
                    $players_rows .= "died at level <b>".$death['level']."</b>";
                else if($i == $count)
                    $players_rows .= " and";
                else
                    $players_rows .= ",";

                $players_rows .= " by ".$killer['monster_name'];
            }
        }

        $players_rows .= '.</TD><TD>'.$config['site']['worlds'][(int)$death['world_id']].'</TD></TR>';
    }
}

if($players_deaths_count == 0)
    $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Last Deaths</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1><TR><TD>No one died on '.$config['server']['serverName'].'.</TD></TR></TABLE></TD></TR></TABLE><BR>';
else
    $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Last Deaths</B></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>'.$players_rows.'</TABLE>';
?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

wars.php

<?PHP
//Litle Config
$MaxShow = 100;
//END

if($action == '')
{
$main_content .= '
<P ALIGN=CENTER>
    <br>
    <FONT SIZE=4 COLOR=#8A0808>
        How to use...
    </FONT>
    <br>
    <br>
    <FONT SIZE=2 COLOR=#DF0101>
    * <b>/war-invite</b> :
        <FONT SIZE=1 COLOR=green>
            Send an invitation to start a war.<br>
            <u>Example</u>: /war-invite Death Hard
        </FONT><br>
    * <b>/war-accept</b> :
        <FONT SIZE=1 COLOR=green>
            Accept the invitation to start a war.
        </FONT><br>
    * <b>/war-reject</b> :
        <FONT SIZE=1 COLOR=green>
            Reject the invitation to start a war.
        </FONT><br>
    * <b>/war-cancel-invite</b> :
        <FONT SIZE=1 COLOR=green>
            Cancel the invitation already sent to start a war.
        </FONT><br>
    * <b>/war-cancel</b> :
        <FONT SIZE=1 COLOR=green>
            Finish the current war: it can only be used after 1 day of war.
        </FONT><br>
    </FONT>
    <br>
    <FONT SIZE=2 COLOR=#8A0808>
        Those commands can only be executed by guild leaders.<br><br>
        <table border="1"><tr border="1"><td border="1"><h3>Remember:</h3>
        <ul>
        <li>You won\'t get any frag if you kill someone that is VERSUS you.</li>
        <li>If you kill someone that is in your guild, you will get a frag.</li>
        </ul></td></tr></table>
    </FONT>
</P>
';
$wars = $SQL->query("
    SELECT g.name AS gname, wg.name AS wgname, g.war_time AS gtime, wg.war_time AS wgtime, g.kills AS kills, wg.kills AS ekills, g.show AS s, g.id AS gid, wg.id AS wgid, g.logo_gfx_name AS glogo, wg.logo_gfx_name AS wglogo
        FROM guilds AS g
    INNER JOIN guilds AS wg
        ON wg.id = g.in_war_with
    ORDER BY s DESC LIMIT 50;
");

foreach ($wars as $k=>$v) {
if ($v[s] == 1) 
{

$glogo = "default_logo.gif";
$wglogo = "default_logo.gif";

if(!empty($v[glogo]))
$glogo = $v[glogo];
if(!empty($v[wglogo]))
$wglogo = $v[wglogo];

if(is_int($number_of_rows / 2)) { $bgcolor = '#D4C0A1'; } else { $bgcolor = '#D5E1A2'; } $number_of_rows++;

    $stats .="
        <TR BGCOLOR=".$bgcolor.">
            <TD WIDTH=30%><center><a href='index.php?subtopic=guilds&action=show&guild=" . $v[gname] . "'><font color='#5A2800'>$v[gname]</font></a></center></TD>
            <TD WIDTH=40%><center><a href='index.php?subtopic=wars&action=show&war=" . $v[gid] . "'><font color='#5A2800'>{$v[kills]} - {$v[ekills]}</font></a></center></TD>
            <TD WIDTH=30%><center><a href='index.php?subtopic=guilds&action=show&guild=" . $v[wgname] . "'><font color='#5A2800'>$v[wgname]</font></a></center></TD>
        </TR>
        <TR BGCOLOR=".$bgcolor.">
            <TD><center><img border=1 src='guilds/".$glogo."' width='64px' height='64px'/></center></TD>
            <TD><center><b>Declared at:</b><br />" . date("d/m/y   H:i:s", $v[gtime]) . "<p><b>Started at:</b><br />" . date("d/m/y   H:i:s", $v[wgtime]) . "</center></TD>
            <TD><center><img border=1 src='guilds/".$wglogo."' width='64px' height='64px'/></center></TD>
        </TR>
    ";

}
}
$main_content .= '
<table border="0" CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tbody>            <TR BGCOLOR="'.$config['site']['vdarkborder'].'"><td><font color="white" size=4><b><blink>Active Wars</blink></b></font></td></tr></tbody></table>
';
if(!$stats) {
    $main_content .= '
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
            <TR BGCOLOR='.$config['site']['darkborder'].'>
                <TD>
                    No active wars in '.$config['server']['serverName'].' yet.
                </TD>
            </TR>
        </TABLE>
    ';
} else {
    $main_content .= "
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
            $stats
        </TABLE>
    ";    
}

?>

<?PHP
$invitations = $SQL->query("
    SELECT ig.name AS igname, i.name AS iname, i.id AS iid, ig.id AS igid, i.war_time AS itime, i.logo_gfx_name AS ilogo, ig.logo_gfx_name AS iglogo
        FROM guilds AS i
    INNER JOIN guilds AS ig
        ON ig.id = i.invited_to
    ORDER BY itime ASC LIMIT 50;    
");
foreach ($invitations as $k=>$v) {

$ilogo = "default_logo.gif";
$iglogo = "default_logo.gif";

if(!empty($v[ilogo]))
$ilogo = $v[ilogo];
if(!empty($v[iglogo]))
$iglogo = $v[iglogo];

            if(is_int($number_of_rows / 2)) { $bgcolor = '#D4C0A1'; } else { $bgcolor = '#D5E1A2'; } $number_of_rows++;

    $invi .="
        <TR BGCOLOR=".$bgcolor.">
            <TD width=30%>
                <center>
                    <b>
                        <a href='index.php?subtopic=guilds&action=show&guild=" . $v[iname] . "'><font color='#5A2800'>$v[iname]</font></a>
                    </b>
                </center>
            </TD>
            <TD width=40%><center>0-0</center></TD>
            <TD width=30%>
                <center>
                    <b>
                        <a href='index.php?subtopic=guilds&action=show&guild=" . $v[igname] . "'><font color='#5A2800'>$v[igname]</font></a>
                    </b>
                </center>
            </TD>
        </TR>
        <TR BGCOLOR=".$bgcolor.">
            <TD>
                <center>
                        <img border=1 src='guilds/".$ilogo."' width='64px' height='64px'/>
                </center>
            </TD>
            <TD><center><b>Declared on:</b><br />" . date("d/m/y   H:i:s", $v[itime]) . "</center></TD>
            <TD>
                <center>
            <img border=1 src='guilds/".$iglogo."' width='64px' height='64px'/>
                </center>
            </TD>
        </TR>
    ";
}
$main_content .= '<br><br><br>
<table border="0" CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tbody>            <TR BGCOLOR="'.$config['site']['vdarkborder'].'"><td><font color="white" size=4><b><blink>Declared Wars</blink></b></font></td></tr></tbody></table>';
if(!$invi) {
    $main_content .= '
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
            <TR BGCOLOR='.$config['site']['darkborder'].'>
                <TD>
                    No declared wars in '.$config['server']['serverName'].' yet.
                </TD>
            </TR>
        </TABLE>
    <br>
    ';
} else {
    $main_content .= "
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
            $invi
        </TABLE>
    ";
}
}

//SHOW FRAGS ~~
if($action == 'show')
{
$guild = $ots->createObject('Guild'); 
$guild->load($_REQUEST['war']);
$ranks = $SQL->query("
    SELECT 
        *
    FROM 
        guild_ranks 
    WHERE 
        guild_id = ". $guild->getId() ."
    ORDER BY
    level DESC;
    ");

foreach ($ranks as $y)
{
    $Players = $SQL->query("
    SELECT 
        *
    FROM 
        players 
    WHERE 
        rank_id = ". $y[id] ." 
    ORDER BY
    name
    ASC;");
    foreach ($Players as $v)
    {
    $totDeaths = 0;
    $deaths = $SQL->query("
    SELECT  
        COUNT(player_id) AS n
    FROM 
        deaths_in_wars
    WHERE 
        player_id = ". $v[id] ." 
    GROUP BY 
        player_id
    DESC LIMIT 1;");
        foreach ($deaths as $q)
        {
            $totDeaths = $q[n];
        }

if($totDeaths > 1 || $totDeaths == 0){
$deathL = "deaths";
}
else{
$deathL = "death";
}

    $membersDeaths1 .="<tr bgcolor=#D4C0A1>
                <td width=70%><a href=index.php?subtopic=characters&name=" . $v[name] . "><u>$v[name]</u></a></td>
        <td width=30%>$totDeaths $deathL</td>
    </tr>
    ";

    $totFrags = 0;
    $frags = $SQL->query("
    SELECT  
        COUNT(killer) AS m
    FROM 
        deaths_in_wars
    WHERE 
        killer = ". $v[id] ." 
    GROUP BY
    killer
    DESC LIMIT 1;");
        foreach ($frags as $p)
        {
            $totFrags = $p[m];
        }

if($totFrags > 1 || $totFrags == 0){
$fragL = "frags";
}
else{
$fragL = "frag";
}

    $membersFrags1 .= "<tr bgcolor=#D4C0A1>
                <td width=70%><a href=index.php?subtopic=characters&name=" . $v[name] . "><u>$v[name]</u></a></td>
        <td width=30%>$totFrags $fragL</td>
    </tr>
    ";
    }
}

$guild2 = $ots->createObject('Guild'); 
$guild2->load($guild->getCustomField(in_war_with));
$ranks2 = $SQL->query("
    SELECT 
        *
    FROM 
        guild_ranks 
    WHERE 
        guild_id = ". $guild2->getId() ."
    ORDER BY
    level DESC;
    ");

foreach ($ranks2 as $y)
{
    $Players = $SQL->query("
    SELECT 
        *
    FROM 
        players 
    WHERE 
        rank_id = ". $y[id] ." 
    ORDER BY
    name
    ASC;");
    foreach ($Players as $v)
    {
    $totDeaths2 = 0;
    $deaths = $SQL->query("
    SELECT  
        COUNT(player_id) AS n
    FROM 
        deaths_in_wars
    WHERE 
        player_id = ". $v[id] ." 
    GROUP BY
    player_id
    DESC LIMIT 1;");
        foreach ($deaths as $q)
        {
            $totDeaths2 = $q[n];
        }

if($totDeaths2 > 1 || $totDeaths2 == 0){
$deathL = "deaths";
}
else{
$deathL = "death";
}

    $membersDeaths2 .= "<tr bgcolor=#D4C0A1>
                <td width=70%><a href=index.php?subtopic=characters&name=" . $v[name] . "><u>$v[name]</u></a></td>
        <td width=30%>$totDeaths2 $deathL</td>
    </tr>
    ";

    $totFrags2 = 0;
    $frags = $SQL->query("
    SELECT  
        COUNT(killer) AS m
    FROM 
        deaths_in_wars
    WHERE 
        killer = ". $v[id] ." 
    GROUP BY
    killer
    DESC LIMIT 1;");
        foreach ($frags as $p)
        {
            $totFrags2 = $p[m];
        }

if($totFrags2 > 1 || $totFrags2 == 0){
$fragL = "frags";
}
else{
$fragL = "frag";
}

    $membersFrags2 .= "<tr bgcolor=#D4C0A1>
                <td width=70%><a href=index.php?subtopic=characters&name=" . $v[name] . "><u>$v[name]</u></a></td>
        <td width=30%>$totFrags2 $fragL</td>
    </tr>
    ";
    }
}

$deaths3 = $SQL->query("
    SELECT 
        * 
    FROM 
        deaths_in_wars 
    WHERE 
        (killer_guild = ". $guild->getId() ." OR killer_guild = ". $guild2->getId() .")
    ORDER BY 
        date 
    DESC LIMIT ". $MaxShow .";");

$deathsG1 = $SQL->query("
    SELECT 
        * 
    FROM 
        deaths_in_wars 
    WHERE 
        killer_guild = ". $guild->getId() ." 
    ORDER BY 
        date 
    DESC LIMIT ". $MaxShow .";");

$deathsG2 = $SQL->query("
    SELECT 
        * 
    FROM 
        deaths_in_wars 
    WHERE 
        killer_guild = ". $guild2->getId() ." 
    ORDER BY 
        date
    DESC LIMIT ". $MaxShow .";");

$Topfragger1 = $SQL->query("
    SELECT 
        killer, COUNT(killer) maximo
    FROM 
        deaths_in_wars
    WHERE 
        killer_guild =     ". $guild->getId() ." 
    GROUP BY 
        killer
    ORDER BY 
        maximo 
    DESC LIMIT 1;");
    
    foreach ($Topfragger1 as $y) 
        {
            $name = $ots->createObject('Player');
            $name->load($y[killer]);
            $TopFraggerName = $name->getName();
            $numTop1 = $y[maximo];
        }
        
$Topfragger2 = $SQL->query("
    SELECT 
        killer, COUNT(killer) maximo
    FROM 
        deaths_in_wars
    WHERE 
        killer_guild =     ". $guild2->getId() ." 
    GROUP BY 
        killer
    ORDER BY 
        maximo 
    DESC LIMIT 1;");
    
    foreach ($Topfragger2 as $y) 
        {
            $name = $ots->createObject('Player');
            $name->load($y[killer]);
            $TopFraggerName2 = $name->getName();
            $numTop2 = $y[maximo];
        }
        
$mostDead = $SQL->query("
    SELECT 
        player_id, COUNT(player_id) maximo
    FROM 
        deaths_in_wars
    WHERE 
        killer_guild =     ". $guild->getId() ." 
    GROUP BY 
        player_id
    ORDER BY 
        maximo 
    DESC LIMIT 1;");
    
    foreach ($mostDead as $y) 
        {
            $name = $ots->createObject('Player');
            $name->load($y[player_id]);
            $mostDeadName = $name->getName();
            $mostDeadNum = $y[maximo];
        }

$mostDead2= $SQL->query("
    SELECT 
        player_id, COUNT(player_id) maximo
    FROM 
        deaths_in_wars
    WHERE 
        killer_guild =     ". $guild2->getId() ." 
    GROUP BY 
        player_id
    ORDER BY 
        maximo 
    DESC LIMIT 1;");
    
    foreach ($mostDead2 as $y) 
        {
            $name = $ots->createObject('Player');
            $name->load($y[player_id]);
            $mostDeadName2 = $name->getName();
            $mostDeadNum2= $y[maximo];
        }

foreach ($deaths3 as $a=>$b) {
    
    $killed3 = $ots->createObject('Player');
    $killed3->load($b[player_id]);
    $killedName3 = $killed3->getName();

    $killer3 = $ots->createObject('Player');
    $killer3->load($b[killer]);
    $killerName3 = $killer3->getName();

    $guild3 = $ots->createObject('Guild');
    $guild3->load($b[killer_guild]);
    $guildName3 = $guild3->getName();

    $totKills1 = 0;
    $killss1 = $SQL->query("
    SELECT  
        COUNT(result1) AS m
    FROM 
        deaths_in_wars
    WHERE 
        (killer_guild = ". $guild->getId() ." AND date <= ". $b[date] .")
    GROUP BY
    result1
    DESC LIMIT 1;");
        foreach ($killss1 as $p)
        {
            $totKills1 = $p[m];
        }

    $totKills2 = 0;
    $killss2 = $SQL->query("
    SELECT  
        COUNT(result2) AS n
    FROM 
        deaths_in_wars
    WHERE 
        (killer_guild = ". $guild2->getId() ." AND date <= ". $b[date] .")
    GROUP BY
    result2
    DESC LIMIT 1;");
        foreach ($killss2 as $q)
        {
            $totKills2 = $q[n];
        }

    $kills3 .="
        <TR BGCOLOR=#D4C0A1>
            <TD>
                        <a href='index.php?subtopic=characters&name=" . $killerName3 . "'><u>$killerName3</u></a>
            </TD>
            <TD>
                        <a href='index.php?subtopic=characters&name=" . $killedName3 . "'><u>$killedName3</u></a>
            </TD>
            <TD>
            $guildName3
            </TD>
            <TD>
            $totKills1:$totKills2
            </TD>
            <TD>
                    " . date("d/m/y   H:i:s", $b[date]) . "
            </TD>
        </TR>
    ";
}

if(!empty($mostDeadNum)){$mostDeadNum = $mostDeadNum;}else{$mostDeadNum = 0 + $mostDeadNum;}
if(!empty($mostDeadNum2)){$mostDeadNum2 = $mostDeadNum2;}else{$mostDeadNum2 = 0 + $mostDeadNum2;}
if(!empty($numTop1)){$numTop1 = $numTop1;}else{$numTop1 = 0 + $numTop1;}
if(!empty($numTop2)){$numTop2 = $numTop2;}else{$numTop2 = 0 + $numTop2;}

foreach ($deathsG1 as $k=>$v) {
    
    $killed = $ots->createObject('Player');
    $killed->load($v[player_id]);
    $killedName = $killed->getName();

    $killer = $ots->createObject('Player');
    $killer->load($v[killer]);
    $killerName = $killer->getName();
    
    $kills .="
        <TR BGCOLOR=\"".$config['site'][($k % 2 == 1 ? 'light' : 'dark').'border']."\">
            <TD>
                <center>
                    <b>
                        <a href='index.php?subtopic=characters&name=" . $killedName . "'>$killedName</a>
                    </b>
                </center>
            </TD>
            <TD>
                <center>
                    <b>
                        <a href='index.php?subtopic=characters&name=" . $killerName . "'>$killerName</a>
                    </b>
                </center>
            </TD>
            <TD>
                <center>
                    " . date("d/m/y   H:i:s", $v[date]) . "
                </center>
            </TD>
        </TR>
    ";
}

foreach ($deathsG2 as $k=>$v) {
    
    $killed = $ots->createObject('Player');
    $killed->load($v[player_id]);
    $killedName = $killed->getName();

    $killer = $ots->createObject('Player');
    $killer->load($v[killer]);
    $killerName = $killer->getName();
    
    $kills2 .="
        <TR BGCOLOR=\"".$config['site'][($k % 2 == 1 ? 'light' : 'dark').'border']."\">
            <TD>
                <center>
                    <b>
                        <a href='index.php?subtopic=characters&name=" . $killedName . "'>$killedName</a>
                    </b>
                </center>
            </TD>
            <TD>
                <center>
                    <b>
                        <a href='index.php?subtopic=characters&name=" . $killerName . "'>$killerName</a>
                    </b>
                </center>
            </TD>
            <TD>
                <center>
                    " . date("d/m/y   H:i:s", $v[date]) . "
                </center>
            </TD>
        </TR>
    ";
}

if($numTop1 > 1 || $numTop1 == 0){$fragl1 = "frags";}else{$fragl1 = "frag";}
if($numTop2 > 1 || $numTop2 == 0){$fragl2 = "frags";}else{$fragl2= "frag";}
if($mostDeadNum > 1 || $mostDeadNum == 0){$deathl1 = "deaths";}else{$deathl1 = "death";}
if($mostDeadNum2 > 1 || $mostDeadNum2 == 0){$deathl2 = "deaths";}else{$deathl2 = "death";}

$main_content .= '
<table border="0" CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tbody>            <TR BGCOLOR="'.$config['site']['vdarkborder'].'"><td><font color="white" size=4><b>War Information</b></font></td></tr></tbody></table>
';

$logo = "default_logo.gif";
$logo2 = "default_logo.gif";
$a = $guild->getCustomField(logo_gfx_name);
$b = $guild2->getCustomField(logo_gfx_name);
if(!empty($a))
$logo = $a;
if(!empty($b))
$logo2 = $b;

$main_content .= "
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
        <TR BGCOLOR='#D4C0A1'>
            <TD WIDTH='35%'><center><a href='index.php?subtopic=guilds&action=show&guild=".$guild->getName()."'><font color='#5A2800'>".$guild->getName()."</font></a></center></TD>
            <TD WIDTH='30%'><center><font color='#5A2800'><b>".$guild->getCustomField(kills)." - ".$guild2->getCustomField(kills)."</b></font></center></TD>
            <TD WIDTH='35%'><center><a href='index.php?subtopic=guilds&action=show&guild=".$guild2->getName()."'><font color='#5A2800'>".$guild2->getName()."</font></a></center></TD>
        </TR>
        <TR BGCOLOR='#D4C0A1'>
            <TD><center><img border=1 src='guilds/".$logo."' width='64px' height='64px'/><p><b><u>Top fragger:</b></u><br /><a href='index.php?subtopic=characters&name=".$TopFraggerName."'>".$TopFraggerName."</a> (".$numTop1." ".$fragl1.")<p><b><u>Most dead:</b></u><br /><a href='index.php?subtopic=characters&name=".$mostDeadName2."'>".$mostDeadName2."</a> (".$mostDeadNum2." ".$deathl2.")</center></TD>
            <TD><center><b>Declared at:</b><br />" . date("d/m/y   H:i:s", $guild->getCustomField(war_time)) . "<p><b>Started at:</b><br />" . date("d/m/y   H:i:s", $guild2->getCustomField(war_time)) . "</center></TD>
            <TD><center><img border=1 src='guilds/".$logo2."' width='64px' height='64px'/><p><b><u>Top fragger:</u></b><br /><a href='index.php?subtopic=characters&name=".$TopFraggerName2."'>".$TopFraggerName2."</a> (".$numTop2." ".$fragl2.")<p><b><u>Most dead:</u></b><br /><a href='index.php?subtopic=characters&name=".$mostDeadName."'>".$mostDeadName."</a> (".$mostDeadNum." ".$deathl1.")</center></TD>
        </TR>
        </TABLE>    
";

$main_content .= '
<br><br><table border="0" CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tbody><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><td><font color="white" size=4><b>Kills - '.$guild->getName().' vs '.$guild2->getName().'</b></font></td></tr></tbody></table>
';

$main_content .= "
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
        <TR BGCOLOR=#D4C0A1>
            <TD><b>Killer</b></TD>
            <TD><b>Victim</b></TD>
            <TD><b>Fragging Guild</b></TD>
            <TD><b>Result</b></TD>
            <TD><b>Date</b></TD>
        </TR>
    $kills3
        </TABLE>";

$main_content .= '
<br><br><table border="0" CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tbody><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><td><font color="white" size=4><b>Most Frags</b></font></td></tr></tbody></table>';

$main_content .= "
    <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
        <TR BGCOLOR=#D4C0A1>
            <TD width=50%>
                <div align='right'>
                    <B>
                        ". $guild->getName() ."
                    </B>
                </div>
            </TD>
            <TD width=50%>
                <div align='left'>
                    <B>
                        ". $guild2->getName() ."
                    </B>
                </div>
            </TD>
        </TR>
        <TR BGCOLOR=#D4C0A1>
            <TD>
                <div align='right'>
            <img src=guilds/".$logo." width='64px' height='64px' border=1/>
        </div>
            </TD>
            <TD>
                <div align='left'>
            <img src=guilds/".$logo2." width='64px' height='64px'border=1/>
                </div>
            </TD>
        </TR>
    </TABLE>
    <TABLE ALIGN=LEFT BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=50%>
        $membersFrags1
    </TABLE>
    <TABLE ALIGN=RIGHT BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=50%>
        $membersFrags2
    </TABLE>

";
$main_content .= '
<table border="0" CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tbody><TR><td><font color="white" size=1>.</font></td></tr></tbody></table>';
$main_content .= '
<table border="0" CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tbody><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><td><font color="white" size=4><b>Most Deaths</b></font></td></tr></tbody></table>';
$main_content .= "
    <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
        <TR BGCOLOR=#D4C0A1>
            <TD width=50%>
        <div align='right'>
                    <B>
                        ". $guild->getName() ."
                    </B>
        </div>
            </TD>
            <TD width=50%>
        <div align='left'>
                    <B>
                        ". $guild2->getName() ."
                    </B>
        </div>
            </TD>
        </TR>
        <TR BGCOLOR=#D4C0A1>
            <TD>
        <div align='right'>
            <img src=guilds/".$logo." width='64px' height='64px' border=1 />
        </div>
            </TD>
            <TD>
        <div align='left'>
            <img src=guilds/".$logo2." width='64px' height='64px'border=1 />
        </div>
            </TD>
        </TR>
    </TABLE>
    <TABLE ALIGN=LEFT BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=50%>
        $membersDeaths1
    </TABLE>
    <TABLE ALIGN=RIGHT BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=50%>
        $membersDeaths2
    </TABLE>
";
}
$main_content .= "
<table border='0' CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tbody><TR><td><div style='text-align: right; margin: 20px auto; font-size: 10px;'>
      Coded by <a target='blank' href='http://otland.net/members/nahruto/'>Nahruto</a> and <a target='blank' href='http://otland.net/members/xampy/'>Xampy</a> | Fixed & Edited by <a target='blank' href='http://otland.net/members/xampy/'>Xampy</a></div></td></tr></tbody></table>";
?>

 

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

bans.php

<?PHP
$ban_types = array(1 => 'IP Banishment', 2 => 'Namelock', 3 => 'Account Banishment', 4 => 'Notation', 5 => 'Until Deletion');
$ban_reason = array("Offensive Name", "Invalid Name Format", "Unsuitable Name", "Name Inciting Rule Violation", "Offensive Statement", "Spamming", "Illegal Advertising", "Off-Topic Public Statement", "Non-English Public Statement", "Inciting Rule Violation", "Bug Abuse", "Game Weakness Abuse", "Using Unofficial Software to Play", "Hacking", "Multi-Clienting", "Account Trading or Sharing", "Threatening Gamemaster", "Pretending to Have Influence on Rule Enforcer", "False Report to Gamemaster", "Destructive Behaviour", "Excessive Unjustified Player Killing", "Invalid Payment", "Spoiling Auction");
$players_banned = $SQL->query('SELECT `bans`.`type`, `bans`.`value`, `bans`.`comment`,`bans`.`admin_id`, `bans`.`expires`, `bans`.`added`, `bans`.`reason` FROM `bans`, `players` WHERE `players`.`account_id` = `bans`.`value` AND `bans`.`active` = 1 GROUP BY `bans`.`value` ORDER BY `bans`.`added` DESC')->fetchAll();
if(!$players_banned) {
$main_content .= '<h2><center><b>Ninguem foi banido ainda...</b></center></h2>';
} else{
    $number_of_players = 0;
    foreach($players_banned as $player) {
        $nick = $SQL->query("SELECT name, id, level, account_id FROM `players` WHERE account_id =".$player['value']." ORDER BY level DESC LIMIT 1")->fetch();
        $gmnick = $SQL->query("SELECT name, id FROM `players` WHERE id =".$player['admin_id']."")->fetch();

        if($player['admin_id'] >= "1")
            $banby = "<a href=?subtopic=characters&name=".urlencode($gmnick['name'])."><font color ='green'>".$gmnick['name']."</font></a>";
        else
            $banby = "FunOT System";

        $number_of_players++;

        if(is_int($number_of_players / 2))
            $bgcolor = $config['site']['darkborder'];
        else
            $bgcolor = $config['site']['lightborder'];

        if ($player['expires'] == "-1") // If the banishment is permanent
            $expires = "Permament";
        else
            $expires = date("d/m/Y, G:i:s", $player['expires']);


        $players_rows .= '<TR BGCOLOR='.$bgcolor.'><TD WIDTH=15%><A HREF="?subtopic=characters&name='.$nick['name'].'">'.$nick['name'].'</A></TD><TD WIDTH=5%>'.$ban_reason[$player['reason']].'</TD><TD WIDTH=15%>'.$player['comment'].'</TD><TD>'.$banby.'</TD><TD>'.$expires.'</TD></TR>';
    }
    //list of players
    $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><b><center>Banned Player</center></b></TD><TD class="white"><b><center>Reason</center></b></TD><TD class="white"><b><center>Comment</center></b></TD><TD class="white"><b><center>Banned By</center></b></TD><TD class="white"><b><center>Expires</center></b></TD></TR>'.$players_rows.'</TABLE>';
}
//COPY RIGHTS!! DO NOT DELETE!
 $main_content .= '';
?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

guilds.php

<?PHP
if($action == 'login')
{
    if(check_guild_name($_REQUEST['guild']))
        $guild = $_REQUEST['guild'];
    if($_REQUEST['redirect'] == 'guild' || $_REQUEST['redirect'] == 'guilds')
        $redirect = $_REQUEST['redirect'];
    if(!$logged)
        $main_content .= 'Please enter your account number and your password.<br/><a href="?subtopic=createaccount" >Create an account</a> if you do not have one yet.<br/><br/><form action="?subtopic=guilds&action=login&guild='.$guild.'&redirect='.$redirect.'" method="post" ><div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Account Login</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td class="LabelV" ><span >Account Number:</span></td><td style="width:100%;" ><input type="password" name="account_login" SIZE="10" maxlength="20" ></td></tr><tr><td class="LabelV" ><span >Password:</span></td><td><input type="password" name="password_login" size="30" maxlength="29" ></td></tr>          </table>        </div>  </table></div></td></tr><br/><table width="100%" ><tr align="center" ><td><table border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=lostaccount" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Account lost?" alt="Account lost?" src="'.$layout_name.'/images/buttons/_sbutton_accountlost.gif" ></div></div></td></tr></form></table></td></tr></table>';
    else
    {
        $main_content .= '<center><h3>Now you are logged. Redirecting...</h3></center>';
        if($redirect == 'guilds')
            header("Location: ?subtopic=guilds");
        elseif($redirect == 'guild')
            header("Location: ?subtopic=guilds&action=show&guild=".$guild);
        else
            $main_content .= 'Wrong address to redirect!';
    }
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//show list of guilds
if($action == '')
{
    $main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD></TD><TD>
<FORM ACTION="" METHOD=get><INPUT TYPE=hidden NAME=subtopic VALUE=guilds><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>World Selection</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'">
    <TABLE BORDER=0 CELLPADDING=1><TR><TD>World: </TD><TD><INPUT TYPE=hidden NAME=subtopic VALUE=guilds><SELECT SIZE="1" NAME="world"><OPTION VALUE="" SELECTED>(choose world)</OPTION>';
    foreach($config['site']['worlds'] as $id => $world_n)
{
    $main_content .= '<OPTION VALUE="'.$id.'">'.$world_n.'</OPTION>';
}
    $main_content .= '</SELECT> </TD><TD><INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif">
        </TD></TR></TABLE></TABLE></FORM></TABLE>';
        foreach($config['site']['worlds'] as $idd => $world_n)
        {
            if($idd == (int) $_REQUEST['world'])
            {
                $world_id = $idd;
                $world_name = $world_n;
            }
        }
    if(!isset($world_id))
    {
        $world_id = 0;
        $world_name = $config['server']['serverName'];
    }
    $filter = new OTS_SQLFilter();
    $filter->compareField('world_id', (int) $world_id);
    $guilds_list = $ots->createObject('Guilds_List');
    $guilds_list->setFilter($filter);
    $guilds_list->orderBy('name');
    
    $main_content .= '<h2><center><i>World:</i> '.$world_name.'</center></h2><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
    <TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=3 CLASS=white><B>Guilds on '.$world_name.'</B></TD></TR>
    <TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=64><B>Logo</B></TD>
    <TD WIDTH=100%><B>Description</B></TD>
    <TD WIDTH=56><B>&#160;</B></TD></TR>';
    $showed_guilds = 1;
    if(count($guilds_list) > 0)
    {
        foreach($guilds_list as $guild)
        {
            if(is_int($showed_guilds / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $showed_guilds++;
            $guild_logo = $guild->getCustomField('logo_gfx_name');
            if(empty($guild_logo) || !file_exists("guilds/".$guild_logo))
                $guild_logo = "default_logo.gif";
            $description = $guild->getCustomField('description');
            $newlines   = array("\r\n", "\n", "\r");
            $description_with_lines = str_replace($newlines, '<br />', $description, $count);
            if($count < $config['site']['guild_description_lines_limit'])
                $description = $description_with_lines;
            $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><IMG SRC="guilds/'.$guild_logo.'" WIDTH=64 HEIGHT=64></TD>
            <TD valign="top"><B>'.$guild->getName().'</B><BR/>'.$description.'';
            if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
                $main_content .= '<br /><a href="?subtopic=guilds&action=deletebyadmin&guild='.$guild->getId().'">Delete this guild (for ADMIN only!)</a>';
            $main_content .= '</TD><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild->getId().'" METHOD=post><TR><TD>
            <INPUT TYPE=image NAME="View" ALT="View" SRC="'.$layout_name.'/images/buttons/sbutton_view.gif" BORDER=0 WIDTH=120 HEIGHT=18>
            </TD></TR></FORM></TABLE>
            </TD></TR>';
        }
    }
    else
        $main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD><IMG SRC="guilds/default_logo.gif" WIDTH=64 HEIGHT=64></TD>
        <TD valign="top"><B>Create guild</B><BR/>Actually there is no guild on server. Create first! Press button "Create Guild".</TD>
        <TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=createguild" METHOD=post><TR><TD>
        <INPUT TYPE=image NAME="Create Guild" ALT="Create Guild" SRC="'.$layout_name.'/images/buttons/sbutton_createguild.png" BORDER=0 WIDTH=120 HEIGHT=18>
        </TD></TR></FORM></TABLE></TD></TR>';
    $main_content .= '</TABLE><br><br>';
    if($logged)
        $main_content .= '<TABLE BORDER=0 WIDTH=100%><TR><TD ALIGN=center><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD><TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=createguild" METHOD=post><TR><TD>
        <INPUT TYPE=image NAME="Create Guild" ALT="Create Guild" SRC="'.$layout_name.'/images/buttons/sbutton_createguild.png" BORDER=0 WIDTH=120 HEIGHT=18>
        </TD></TR></FORM></TABLE></TD><TD ALIGN=center><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD></TR></TABLE>
        <BR />If you have any problem with guilds try:
        <BR /><a href="?subtopic=guilds&action=cleanup_players">Cleanup players</a> - can\'t join guild/be invited? Can\'t create guild? Try cleanup players.
        <BR /><a href="?subtopic=guilds&action=cleanup_guilds">Cleanup guilds</a> - made guild, you are a leader, but you are not on players list? Cleanup guilds!';
    else
        $main_content .= 'Before you can create guild you must login.<br><TABLE BORDER=0 WIDTH=100%><TR><TD ALIGN=center><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD><TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=login&redirect=guilds" METHOD=post><TR><TD>
        <INPUT TYPE=image NAME="Login" ALT="Login" SRC="'.$layout_name.'/images/buttons/sbutton_login.gif" BORDER=0 WIDTH=120 HEIGHT=18>
        </TD></TR></FORM></TABLE></TD><TD ALIGN=center><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD></TR></TABLE>';
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//show guild page
if($action == 'show')
{
    $guild_id = (int) $_REQUEST['guild'];
    $guild_name = $guild_id;
    $guild = $ots->createObject('Guild');
    $guild->load($guild_id);
    if(!$guild->isLoaded())
        $guild_errors[] = 'Guild with ID <b>'.$guild_id.'</b> doesn\'t exist.';
    if(!empty($guild_errors))
    {
        //show errors
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        //errors and back button
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
    }
    else
    {
        //check is it vice or/and leader account (leader has vice + leader rights)
        $guild_leader_char = $guild->getOwner();
        $rank_list = $guild->getGuildRanksList();
        $rank_list->orderBy('level', POT::ORDER_DESC);
        $guild_leader = FALSE;
        $guild_vice = FALSE;
        if($logged)
        {
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
            {
                $players_from_account_ids[] = $player->getId();
                $player_rank = $player->getRank();
                if(!empty($player_rank))
                    foreach($rank_list as $rank_in_guild)
                        if($rank_in_guild->getId() == $player_rank->getId())
                        {
                            $players_from_account_in_guild[] = $player->getName();
                            if($player_rank->getLevel() > 1)
                            {
                                $guild_vice = TRUE;
                                $level_in_guild = $player_rank->getLevel();
                            }
                            if($guild->getOwner()->getId() == $player->getId())
                            {
                                $guild_vice = TRUE;
                                $guild_leader = TRUE;
                            }
                        }
            }
        }
        //show guild page
        $guild_logo = $guild->getCustomField('logo_gfx_name');
        if(empty($guild_logo) || !file_exists("guilds/".$guild_logo))
            $guild_logo = "default_logo.gif";
        $description = $guild->getCustomField('description');
        $newlines   = array("\r\n", "\n", "\r");
        $description_with_lines = str_replace($newlines, '<br />', $description, $count);
        if($count < $config['site']['guild_description_lines_limit'])
            $description = $description_with_lines;
        $guild_owner = $guild->getOwner();
        if($guild_owner->isLoaded())
            $guild_owner = $guild_owner->getName();
        $main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR>
        <TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD><TD>
        <TABLE BORDER=0 WIDTH=100%>
        <TR><TD WIDTH=64><IMG SRC="guilds/'.$guild_logo.'" WIDTH=64 HEIGHT=64></TD>
        <TD ALIGN=center WIDTH=100%><H1>'.$guild->getName().'</H1></TD>
        <TD WIDTH=64><IMG SRC="guilds/'.$guild_logo.'" WIDTH=64 HEIGHT=64></TD></TR>
        </TABLE><BR>'.$description.'<BR><BR><a href="?subtopic=characters&name='.urlencode($guild_owner).'"><b>'.$guild_owner.'</b></a> is guild leader of <b>'.$guild->getName().'</b>.<BR>The guild was founded on '.$config['server']['serverName'].' on '.date("j F Y", $guild->getCreationData()).'.';
        if($guild_leader)
            $main_content .= '&nbsp;&nbsp;&nbsp;<a href="?subtopic=guilds&action=manager&guild='.$guild_name.'"><IMG SRC="'.$layout_name.'/images/buttons/sbutton_manageguild.png" BORDER=0 WIDTH=120 HEIGHT=18 alt="Manage Guild"></a>';
        $main_content .= '<BR><BR>
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
        <TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=3 CLASS=white><B>Guild Members</B></TD></TR>
        <TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=30%><B>Rank</B></TD>
        <TD WIDTH=70%><B>Name and Title</B></TD></TR>';
        $showed_players = 1;
        foreach($rank_list as $rank)
        {
            $players_with_rank = $rank->getPlayersList();
            $players_with_rank->orderBy('name');
            $players_with_rank_number = count($players_with_rank);
            if($players_with_rank_number > 0)
            {
                if(is_int($showed_players / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $showed_players++;
                $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD valign="top">'.$rank->getName().'</TD>
                <TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%>';
                foreach($players_with_rank as $player)
                {
$main_content .= '';
                    $main_content .= '<TR><TD><FORM ACTION="?subtopic=guilds&action=change_nick&name='.urlencode($player->getName()).'" METHOD=post><A HREF="?subtopic=characters&name='.urlencode($player->getName()).'">'.($player->isOnline() ? "<font color=\"\">".$player->getName()."</font>" : "<font color=\"\">".$player->getName()."</font>").'</A> <br><small>Level: '.$player->getLevel().' '.$vocation_name[$player->getWorld()][$player->getPromotion()][$player->getVocation()].'</small>';
                    $guild_nick = $player->getGuildNick();
                    if($logged)
                        if(in_array($player->getId(), $players_from_account_ids))
                            $main_content .= '(<input type="text" name="nick" value="'.htmlentities($player->getGuildNick()).'"><input type="submit" value="Change">)';
                        else
                        if(!empty($guild_nick))
                            $main_content .= ' ('.htmlentities($player->getGuildNick()).')';
                    else
                        if(!empty($guild_nick))
                            $main_content .= ' ('.htmlentities($player->getGuildNick()).')';
                    if($level_in_guild > $rank->getLevel() || $guild_leader)
                        if($guild_leader_char->getName() != $player->getName())
                            $main_content .= '&nbsp;<font size=1>{<a href="?subtopic=guilds&action=kickplayer&guild='.$guild->getId().'&name='.urlencode($player->getName()).'">KICK</a>}</font>';
                    $main_content .= '</FORM></TD></TR>';
                }
                $main_content .= '</TABLE></TD></TR>';
            }
        }
        $main_content .= '</TABLE><br><br>';
        $guild_id = (int)$_GET['guild'];$guildMembers = $SQL->query( 'SELECT COUNT(`gr`.`id`) AS `total` FROM `players` AS `p` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `p`.`rank_id` WHERE `gr`.`guild_id` = '.$guild_id )->fetch( );$allM = $SQL->query ('SELECT COUNT(1) as `people` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') AND online = 1')->fetch(); $allM1 = $SQL->query ('SELECT SUM(`level`) as `level` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ')->fetch(); $allM2 = $SQL->query ('SELECT AVG(`level`) as `level` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ')->fetch(); $allM3 = $SQL->query ('SELECT `name` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ORDER BY `level` ASC LIMIT 1')->fetch(); $allM4 = $SQL->query ('SELECT `name` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ORDER BY `level` DESC LIMIT 1')->fetch(); $invite = $SQL->query( 'SELECT COUNT(*) FROM `guild_invites` WHERE `guild_id` = '.$guild_id.'')->fetch( );                        $main_content .= '<table width="100%" cellspacing="1" cellpadding="4" border="0">        <tbody><tr bgcolor="#505050"><td class="white" colspan="3"><b>Guild Statistic</b></td></tr>        <tr bgcolor="#d4c0a1"><td width="30%"><b>Type</b></td>        <td width="50%"><b>Value</b></td></tr><tr bgcolor="#f1e0c6">                <td valign="top">Number of Members in Guild</td>        <td><table width="100%" cellspacing="0" cellpadding="0" border="0">        <tbody><tr><td>'.$guildMembers['total'].'</td></tr></tbody></table>        </td></tr>                <tr bgcolor="#d4c0a1"><td valign="top">Number of Members Online in Guild</td>                <td><table width="100%" cellspacing="0" cellpadding="0" border="0">        <tbody><tr><td>'.$allM[0].'</td></tr></tbody></table>        </td></tr>                <td valign="top">Total Level in guild</td>        <td><table width="100%" cellspacing="0" cellpadding="0" border="0">        <tbody><tr><td>'.$allM1[0].'</td></tr></tbody></table>        </td></tr>                <tr bgcolor="#d4c0a1"><td valign="top">Avg Level in guild</td>                <td><table width="100%" cellspacing="0" cellpadding="0" border="0">        <tbody><tr><td>'.round($allM2[0]).'</td></tr></tbody></table>        </td></tr>                <td valign="top">Lowest Level in guild</td>        <td><table width="100%" cellspacing="0" cellpadding="0" border="0">        <tbody><tr><td>'.$allM3[0].'</td></tr></tbody></table>        </td></tr>                <tr bgcolor="#d4c0a1"><td valign="top">Highest Level in guild</td>                <td><table width="100%" cellspacing="0" cellpadding="0" border="0">        <tbody><tr><td>'.$allM4[0].'</td></tr></tbody></table>        </td></tr>                <tr bgcolor="#f1e0c6"><td valign="top">Number of Invited Members</td>                <td><table width="100%" cellspacing="0" cellpadding="0" border="0">        <tbody><tr><td>'.$invite[0].'</td></tr></tbody></table>        </td></tr>        </table>';  
        include('pot/InvitesDriver.php');
        new InvitesDriver($guild);
        $invited_list = $guild->listInvites();
        if(count($invited_list) == 0)
            $main_content .= '<BR><BR><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Invited Characters</B></TD></TR><TR BGCOLOR='.$config['site']['lightborder'].'><TD>No invited characters found.</TD></TR></TABLE>';
        else
        {
            $main_content .= '<BR><BR><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Invited Characters</B></TD></TR>';
            $show_accept_invite = 0;
            $showed_invited = 1;
            foreach($invited_list as $invited_player)
            {
                if(count($account_players) > 0)
                    foreach($account_players as $player_from_acc)
                        if($player_from_acc->getName() == $invited_player->getName())
                            $show_accept_invite++;
                if(is_int($showed_invited / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $showed_invited++;
                $main_content .= '<TR bgcolor="'.$bgcolor.'"><TD><a href="?subtopic=characters&name='.urlencode($invited_player->getName()).'">'.$invited_player->getName().'</a>';
                if($guild_vice)
                    $main_content .= '  (<a href="?subtopic=guilds&action=deleteinvite&guild='.$guild_name.'&name='.$invited_player->getName().'">Cancel Invitation</a>)';
                $main_content .= '</TD></TR>'; 
            }
            $main_content .= '</TABLE>';
        }
        $main_content .= '<BR><BR>
        <TABLE BORDER=0 WIDTH=100%><TR><TD ALIGN=center><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD>';
        if(!$logged)
            $main_content .= '<TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=login&guild='.$guild_name.'&redirect=guild" METHOD=post><TR><TD>
            <INPUT TYPE=image NAME="Login" ALT="Login" SRC="'.$layout_name.'/images/buttons/sbutton_login.gif" BORDER=0 WIDTH=120 HEIGHT=18>
            </TD></TR></FORM></TABLE></TD>';
        else
        {
            if($show_accept_invite > 0)
                $main_content .= '<TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=acceptinvite&guild='.$guild_name.'" METHOD=post><TR><TD>
                <INPUT TYPE=image NAME="Accept Invite" ALT="Accept Invite" SRC="'.$layout_name.'/images/buttons/sbutton_acceptinvite.png" BORDER=0 WIDTH=120 HEIGHT=18>
                </TD></TR></FORM></TABLE></TD>';
            if($guild_vice)
            {
                $main_content .= '<TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=invite&guild='.$guild_name.'" METHOD=post><TR><TD>
                <INPUT TYPE=image NAME="Invite Player" ALT="Invite Player" SRC="'.$layout_name.'/images/buttons/sbutton_inviteplayer.png" BORDER=0 WIDTH=120 HEIGHT=18>
                </TD></TR></FORM></TABLE></TD>';
                $main_content .= '<TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=changerank&guild='.$guild_name.'" METHOD=post><TR><TD>
                <INPUT TYPE=image NAME="Change Rank" ALT="Change Rank" SRC="'.$layout_name.'/images/buttons/sbutton_changerank.png" BORDER=0 WIDTH=120 HEIGHT=18>
                </TD></TR></FORM></TABLE></TD>';
            }
            if($players_from_account_in_guild > 0)
                $main_content .= '<TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=leaveguild&guild='.$guild_name.'" METHOD=post><TR><TD>
                <INPUT TYPE=image NAME="Leave Guild" ALT="Leave Guild" SRC="'.$layout_name.'/images/buttons/sbutton_leaveguild.png" BORDER=0 WIDTH=120 HEIGHT=18>
                </TD></TR></FORM></TABLE></TD>';
        }
        $main_content .= '<TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&world='.$guild->getWorld().'" METHOD=post><TR><TD>
        <INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18>
        </TD></TR></FORM></TABLE>
        </TD><TD ALIGN=center><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD></TR></TABLE>
        </TD><TD><IMG src="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD>
        </TR></TABLE></TABLE>';
    }
}

//--------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------
//change rank of player in guild
if($action == 'changerank')
{
    $guild_name = (int) $_REQUEST['guild'];
    if(!$logged)
        $guild_errors[] = 'You are not logged in. You can\'t change rank.';
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with ID <b>'.$guild_name.'</b> doesn\'t exist.';
    }
    if(!empty($guild_errors))
    {
        //show errors
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        //errors and back button
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
    }
    else
    {
    //check is it vice or/and leader account (leader has vice + leader rights)
    $rank_list = $guild->getGuildRanksList();
    $rank_list->orderBy('level', POT::ORDER_DESC);
    $guild_leader = FALSE;
    $guild_vice = FALSE;
    $account_players = $account_logged->getPlayers();
    foreach($account_players as $player)
    {
        $player_rank = $player->getRank();
        if(!empty($player_rank))
            foreach($rank_list as $rank_in_guild)
                if($rank_in_guild->getId() == $player_rank->getId())
                {
                    $players_from_account_in_guild[] = $player->getName();
                    if($player_rank->getLevel() > 1) {
                        $guild_vice = TRUE;
                        $level_in_guild = $player_rank->getLevel();
                    }
                    if($guild->getOwner()->getId() == $player->getId()) {
                        $guild_vice = TRUE;
                        $guild_leader = TRUE;
                    }
                }
    }
    //tworzenie listy osob z nizszymi uprawnieniami i rank z nizszym levelem
    if($guild_vice)
    {
        foreach($rank_list as $rank)
        {
            if($guild_leader || $rank->getLevel() < $level_in_guild)
            {
                $ranks[$rid]['0'] = $rank->getId();
                $ranks[$rid]['1'] = $rank->getName();
                $rid++;
                $players_with_rank = $rank->getPlayersList();
                $players_with_rank->orderBy('name');
                if(count($players_with_rank) > 0)
                {
                    foreach($players_with_rank as $player)
                    {
                        if($guild->getOwner()->getId() != $player->getId() || $guild_leader)
                        {
                            $players_with_lower_rank[$sid]['0'] = $player->getName();
                            $players_with_lower_rank[$sid]['1'] = $player->getName().' ('.$rank->getName().')';
                            $sid++;
                        }
                    }
                }
            }
        }
        if($_REQUEST['todo'] == 'save')
        {
            $player_name = stripslashes($_REQUEST['name']);
            $new_rank = (int) $_REQUEST['rankid'];
            if(!check_name($player_name))
                $change_errors[] = 'Invalid player name format.';
            $rank = $ots->createObject('GuildRank');
            $rank->load($new_rank);
            if(!$rank->isLoaded())
                $change_errors[] = 'Rank with this ID doesn\'t exist.';
            if($level_in_guild <= $rank->getLevel() && !$guild_leader)
                $change_errors[] = 'You can\'t set ranks with equal or higher level than your.';
            if(empty($change_errors))
            {
                $player_to_change = $ots->createObject('Player');
                $player_to_change->find($player_name);
                if(!$player_to_change->isLoaded())
                    $change_errors[] = 'Player with name '.$player_name.'</b> doesn\'t exist.';
                else
                {
                    $player_in_guild = FALSE;
                    if($guild->getName() == $player_to_change->getRank()->getGuild()->getName() || $guild_leader)
                    {
                        $player_in_guild = TRUE;
                        $player_has_lower_rank = FALSE;
                        if($player_to_change->getRank()->getLevel() < $level_in_guild || $guild_leader)
                            $player_has_lower_rank = TRUE;
                    }
                }
                $rank_in_guild = FALSE;
                foreach($rank_list as $rank_from_guild)
                    if($rank_from_guild->getId() == $rank->getId())
                        $rank_in_guild = TRUE;
                if(!$player_in_guild)
                $change_errors[] = 'This player isn\'t in your guild.';
                if(!$rank_in_guild)
                    $change_errors[] = 'This rank isn\'t in your guild.';
                if(!$player_has_lower_rank)
                    $change_errors[] = 'This player has higher rank in guild than you. You can\'t change his/her rank.';
            }
            if(empty($change_errors))
            {
                $player_to_change->setRank($rank);
                $player_to_change->save();
                $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Guild Deleted</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Rank of player <b>'.$player_to_change->getName().'</b> has been changed to <b>'.$rank->getName().'</b>.</td></tr>          </table>        </div>  </table></div></td></tr><br>';
                unset($players_with_lower_rank);
                unset($ranks);
                $rid = 0;
                $sid= 0;
                foreach($rank_list as $rank)
                {
                    if($guild_leader || $rank->getLevel() < $level_in_guild)
                    {
                        $ranks[$rid]['0'] = $rank->getId();
                        $ranks[$rid]['1'] = $rank->getName();
                        $rid++;
                        $players_with_rank = $rank->getPlayersList();
                        $players_with_rank->orderBy('name');
                        if(count($players_with_rank) > 0)
                        {
                            foreach($players_with_rank as $player)
                            {
                                if($guild->getOwner()->getId() != $player->getId() || $guild_leader)
                                {
                                    $players_with_lower_rank[$sid]['0'] = $player->getName();
                                    $players_with_lower_rank[$sid]['1'] = $player->getName().' ('.$rank->getName().')';
                                    $sid++;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
                foreach($change_errors as $change_error)
                    $main_content .= '<li>'.$change_error;
                $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/>';
            }
        }
        $main_content .= '<FORM ACTION="?subtopic=guilds&action=changerank&guild='.$guild_name.'&todo=save" METHOD=post>
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
        <TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Change Rank</B></TD></TR>
        <TR BGCOLOR='.$config['site']['darkborder'].'><TD>Name: <SELECT NAME="name">';
        foreach($players_with_lower_rank as $player_to_list)
            $main_content .= '<OPTION value="'.$player_to_list['0'].'">'.$player_to_list['1'];
        $main_content .= '</SELECT>&nbsp;Rank:&nbsp;<SELECT NAME="rankid">';
        foreach($ranks as $rank)
            $main_content .= '<OPTION value="'.$rank['0'].'">'.$rank['1'];
        $main_content .= '</SELECT>&nbsp;&nbsp;&nbsp;<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD><TR>
        </TABLE></FORM><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
    }
    else
        $main_content .= 'Error. You are not a leader or vice leader in guild '.$guild->getName().'.<FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></FORM>';
    }
}

//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//show guild page
if($action == 'deleteinvite')
{
    //set rights in guild
    $guild_name = (int) $_REQUEST['guild'];
    $name = stripslashes($_REQUEST['name']);
    if(!$logged)
        $guild_errors[] = 'You are not logged in. You can\'t delete invitations.';
    if(!check_name($name))
        $guild_errors[] = 'Invalid name format.';
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with ID <b>'.$guild_name.'</b> doesn\'t exist.';
    }
    if(empty($guild_errors))
    {
        $rank_list = $guild->getGuildRanksList();
        $rank_list->orderBy('level', POT::ORDER_DESC);
        $guild_leader = FALSE;
        $guild_vice = FALSE;
        $account_players = $account_logged->getPlayers();
        foreach($account_players as $player)
        {
            $player_rank = $player->getRank();
            if(!empty($player_rank))
            {
                foreach($rank_list as $rank_in_guild)
                {
                    if($rank_in_guild->getId() == $player_rank->getId())
                    {
                        $players_from_account_in_guild[] = $player->getName();
                        if($player_rank->getLevel() > 1)
                        {
                            $guild_vice = TRUE;
                            $level_in_guild = $player_rank->getLevel();
                        }
                        if($guild->getOwner()->getId() == $player->getId())
                        {
                            $guild_vice = TRUE;
                            $guild_leader = TRUE;
                        }
                    }
                }
            }
        }
    }
    if(empty($guild_errors))
    {
        $player = new OTS_Player();
        $player->find($name);
        if(!$player->isLoaded())
            $guild_errors[] = 'Player with name <b>'.$name.'</b> doesn\'t exist.';
    }
    if(!$guild_vice)
        $guild_errors[] = 'You are not a leader or vice leader of guild <b>'.$guild_name.'</b>.';
    if(empty($guild_errors))
    {
        include('pot/InvitesDriver.php');
        new InvitesDriver($guild);
        $invited_list = $guild->listInvites();
        if(count($invited_list) > 0)
        {
            $is_invited = FALSE;
            foreach($invited_list as $invited)
                if($invited->getName() == $player->getName())
                    $is_invited = TRUE;
            if(!$is_invited)
                $guild_errors[] = '<b>'.$player->getName().'</b> isn\'t invited to your guild.';
        }
        else
            $guild_errors[] = 'No one is invited to your guild.';
    }
    if(!empty($guild_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
    }
    else
    {
        if($_REQUEST['todo'] == 'save')
        {
            $guild->deleteInvite($player);
            $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Delete player invitation</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=100%>Player with name <b>'.$player->getName().'</b> has been deleted from "invites list".</TD></TR></TABLE><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
        }
        else
            $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Delete player invitation</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=100%>Are you sure you want to delete player with name <b>'.$player->getName().'</b> from "invites list"?</TD></TR></TABLE><br/><center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><TR><FORM ACTION="?subtopic=guilds&action=deleteinvite&guild='.$guild_name.'&name='.$player->getName().'&todo=save" METHOD=post><TD align="right" width="50%"><INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18>&nbsp;&nbsp;</TD></FORM><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TD>&nbsp;&nbsp;<INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></FORM></TABLE></center>';
    }
}

//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//show guild page
if($action == 'invite')
{
    //set rights in guild
    $guild_name = (int) $_REQUEST['guild'];
    $name = stripslashes($_REQUEST['name']);
    if(!$logged)
        $guild_errors[] = 'You are not logged in. You can\'t invite players.';
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with ID <b>'.$guild_name.'</b> doesn\'t exist.';
    }
    if(empty($guild_errors))
    {
        $rank_list = $guild->getGuildRanksList();
        $rank_list->orderBy('level', POT::ORDER_DESC);
        $guild_leader = FALSE;
        $guild_vice = FALSE;
        $account_players = $account_logged->getPlayers();
        foreach($account_players as $player)
        {
            $player_rank = $player->getRank();
            if(!empty($player_rank))
                foreach($rank_list as $rank_in_guild)
                    if($rank_in_guild->getId() == $player_rank->getId())
                    {
                        $players_from_account_in_guild[] = $player->getName();
                        if($player_rank->getLevel() > 1)
                        {
                            $guild_vice = TRUE;
                            $level_in_guild = $player_rank->getLevel();
                        }
                        if($guild->getOwner()->getId() == $player->getId())
                        {
                            $guild_vice = TRUE;
                            $guild_leader = TRUE;
                        }
                    }
        }
    }
    if(!$guild_vice)
        $guild_errors[] = 'You are not a leader or vice leader of guild <b>'.$guild_name.'</b>.'.$level_in_guild;
    if($_REQUEST['todo'] == 'save')
    {
        if(!check_name($name))
            $guild_errors[] = 'Invalid name format.';
        if(empty($guild_errors))
        {
            $player = new OTS_Player();
            $player->find($name);
            if(!$player->isLoaded())
                $guild_errors[] = 'Player with name <b>'.$name.'</b> doesn\'t exist.';
            else
            {
                $rank_of_player = $player->getRank();
                if(!empty($rank_of_player))
                    $guild_errors[] = 'Player with name <b>'.$name.'</b> is already in guild. He must leave guild before you can invite him.';
            }
        }
        if(empty($guild_errors) && $guild->getWorld() != $player->getWorld())
            $guild_errors[] = '<b>'.$player->getName().'</b> is from other world then your guild.';
        if(empty($guild_errors))
        {
            include('pot/InvitesDriver.php');
            new InvitesDriver($guild);
            $invited_list = $guild->listInvites();
            if(count($invited_list) > 0)
                foreach($invited_list as $invited)
                    if($invited->getName() == $player->getName())
                        $guild_errors[] = '<b>'.$player->getName().'</b> is already invited to your guild.';
        }
    }
    if(!empty($guild_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
    }
    else
        if($_REQUEST['todo'] == 'save')
        {
            $guild->invite($player);
            $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Invite player</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=100%>Player with name <b>'.$player->getName().'</b> has been invited to your guild.</TD></TR></TABLE><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
        }
        else
            $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Invite player</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=100%><FORM ACTION="?subtopic=guilds&action=invite&guild='.$guild_name.'&todo=save" METHOD=post>Invite player with name:&nbsp;&nbsp;<INPUT TYPE="text" NAME="name">&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></FORM></TD></TD></TR></TR></TABLE><br/><center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><TR><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TD><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></FORM></TABLE></center>';
}


//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//show guild page
if($action == 'acceptinvite') {
//set rights in guild
$guild_name = (int) $_REQUEST['guild'];
$name = stripslashes($_REQUEST['name']);
if(!$logged)
    $guild_errors[] = 'You are not logged in. You can\'t accept invitations.';
if(empty($guild_errors))
{
    $guild = $ots->createObject('Guild');
    $guild->load($guild_name);
    if(!$guild->isLoaded())
        $guild_errors[] = 'Guild with ID <b>'.$guild_name.'</b> doesn\'t exist.';
}

if($_REQUEST['todo'] == 'save') {
if(!check_name($name))
    $guild_errors[] = 'Invalid name format.';
if(empty($guild_errors)) {
$player = new OTS_Player();
$player->find($name);
if(!$player->isLoaded()) {
$guild_errors[] = 'Player with name <b>'.$name.'</b> doesn\'t exist.';
}
else
{
$rank_of_player = $player->getRank();
if(!empty($rank_of_player)) {
$guild_errors[] = 'Character with name <b>'.$name.'</b> is already in guild. You must leave guild before you join other guild.';
}
}
}
}
if($_REQUEST['todo'] == 'save') {
if(empty($guild_errors)) {
$is_invited = FALSE;
include('pot/InvitesDriver.php');
new InvitesDriver($guild);
$invited_list = $guild->listInvites();
if(count($invited_list) > 0) {
foreach($invited_list as $invited) {
if($invited->getName() == $player->getName()) {
$is_invited = TRUE;
}
}
}
if(!$is_invited) {
$guild_errors[] = 'Character '.$player->getName.' isn\'t invited to guild <b>'.$guild->getName().'</b>.';
}
}
}
else
{
//co jesli nei save
if(empty($guild_errors)) {
$acc_invited = FALSE;
$account_players = $account_logged->getPlayers();
include('pot/InvitesDriver.php');
new InvitesDriver($guild);
$invited_list = $guild->listInvites();
if(count($invited_list) > 0) {
foreach($invited_list as $invited) {
foreach($account_players as $player_from_acc){
if($invited->getName() == $player_from_acc->getName()) {
$acc_invited = TRUE;
$list_of_invited_players[] = $player_from_acc->getName();
}
}
}
}
}
if(!$acc_invited) {
$guild_errors[] = 'Any character from your account isn\'t invited to <b>'.$guild->getName().'</b>.';
}
}
if(!empty($guild_errors)) {
$main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
foreach($guild_errors as $guild_error) {
    $main_content .= '<li>'.$guild_error;
}
$main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
}
else
{
if($_REQUEST['todo'] == 'save') {
$guild->acceptInvite($player);
$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Accept invitation</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=100%>Player with name <b>'.$player->getName().'</b> has been added to guild <b>'.$guild->getName().'</b>.</TD></TR></TABLE><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
}
else
{
$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Accept invitation</B></TD></TR>';
$main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=100%>Select character to join guild:</TD></TR>';
$main_content .= '<TR BGCOLOR='.$config['site']['darkborder'].'><TD>
<form action="?subtopic=guilds&action=acceptinvite&guild='.$guild_name.'&todo=save" METHOD="post">';
sort($list_of_invited_players);
foreach($list_of_invited_players as $invited_player_from_list) {
$main_content .= '<input type="radio" name="name" value="'.$invited_player_from_list.'" />'.$invited_player_from_list.'<br>';
}
$main_content .= '<br><INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></form></TD></TR></TABLE><br/><center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><TR><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TD><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></FORM></TABLE></center>';
}
}
}


//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//show guild page
if($action == 'kickplayer') {
//set rights in guild
$guild_name = (int) $_REQUEST['guild'];
$name = stripslashes($_REQUEST['name']);
if(!$logged)
    $guild_errors[] = 'You are not logged in. You can\'t kick characters.';
if(!check_name($name))
    $guild_errors[] = 'Invalid name format.';
if(empty($guild_errors))
{
    $guild = $ots->createObject('Guild');
    $guild->load($guild_name);
    if(!$guild->isLoaded())
        $guild_errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
}
if(empty($guild_errors)) {
$rank_list = $guild->getGuildRanksList();
$rank_list->orderBy('level', POT::ORDER_DESC);
$guild_leader = FALSE;
$guild_vice = FALSE;
$account_players = $account_logged->getPlayers();
foreach($account_players as $player) {
$player_rank = $player->getRank();
if(!empty($player_rank)) {
foreach($rank_list as $rank_in_guild) {
if($rank_in_guild->getId() == $player_rank->getId()) {
$players_from_account_in_guild[] = $player->getName();
if($player_rank->getLevel() > 1) {
$guild_vice = TRUE;
$level_in_guild = $player_rank->getLevel();
}
if($guild->getOwner()->getId() == $player->getId()) {
$guild_vice = TRUE;
$guild_leader = TRUE;
}
}
}
}
}
}
if(empty($guild_errors)) {
if(!$guild_leader && $level_in_guild < 3) {
$guild_errors[] = 'You are not a leader of guild <b>'.$guild_name.'</b>. You can\'t kick players.';
}
}
if(empty($guild_errors)) {
$player = new OTS_Player();
$player->find($name);
if(!$player->isLoaded()) {
$guild_errors[] = 'Character <b>'.$name.'</b> doesn\'t exist.';
}
else
{
if($player->getRank()->getGuild()->getName() != $guild->getName()) {
$guild_errors[] = 'Character <b>'.$name.'</b> isn\'t from your guild.';
}
}
}
if(empty($guild_errors)) {
if($player->getRank()->getLevel() >= $level_in_guild && !$guild_leader) {
$guild_errors[] = 'You can\'t kick character <b>'.$name.'</b>. Too high access level.';
}
}
if(empty($guild_errors)) {
if($guild->getOwner()->getName() == $player->getName()) {
$guild_errors[] = 'It\'s not possible to kick guild owner!';
}
}
if(!empty($guild_errors)) {
$main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
foreach($guild_errors as $guild_error) {
    $main_content .= '<li>'.$guild_error;
}
$main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
}
else
    if($_REQUEST['todo'] == 'save')
    {
        $player->setRank();
        $player->save();
        $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Kick player</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=100%>Player with name <b>'.$player->getName().'</b> has been kicked from your guild.</TD></TR></TABLE><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
    }
    else
        $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Kick player</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=100%>Are you sure you want to kick player with name <b>'.$player->getName().'</b> from your guild?</TD></TR></TABLE><br/><center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><TR><FORM ACTION="?subtopic=guilds&action=kickplayer&guild='.$guild_name.'&name='.$player->getName().'&todo=save" METHOD=post><TD align="right" width="50%"><INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18>&nbsp;&nbsp;</TD></FORM><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TD>&nbsp;&nbsp;<INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></FORM></TABLE></center>';
}

//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//show guild page
if($action == 'leaveguild')
{
    //set rights in guild
    $guild_name = (int) $_REQUEST['guild'];
    $name = stripslashes($_REQUEST['name']);
    if(!$logged)
        $guild_errors[] = 'You are not logged in. You can\'t leave guild.';
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with ID <b>'.$guild_name.'</b> doesn\'t exist.';
    }

    if(empty($guild_errors))
    {
        $guild_owner_id = $guild->getOwner()->getId();
        if($_REQUEST['todo'] == 'save')
        {
            if(!check_name($name))
                $guild_errors[] = 'Invalid name format.';
            if(empty($guild_errors))
            {
                $player = new OTS_Player();
                $player->find($name);
                if(!$player->isLoaded())
                    $guild_errors[] = 'Character <b>'.$name.'</b> doesn\'t exist.';
                else
                    if($player->getAccount()->getId() != $account_logged->getId())
                        $guild_errors[] = 'Character <b>'.$name.'</b> isn\'t from your account!';
            }
            if(empty($guild_errors))
            {
                $player_loaded_rank = $player->getRank();
                if(!empty($player_loaded_rank) && $player_loaded_rank->isLoaded())
                {
                    if($player_loaded_rank->getGuild()->getId() != $guild->getId())
                        $guild_errors[] = 'Character <b>'.$name.'</b> isn\'t from guild <b>'.$guild->getName().'</b>.';
                }
                else
                    $guild_errors[] = 'Character <b>'.$name.'</b> isn\'t in any guild.';
            }
            if(empty($guild_errors))
                if($guild_owner_id == $player->getId())
                    $guild_errors[] = 'You can\'t leave guild. You are an owner of guild.';
        }
        else
        {
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player_fac)
            {
                $player_rank = $player_fac->getRank();
                if(!empty($player_rank))
                    if($player_rank->getGuild()->getId() == $guild->getId())
                        if($guild_owner_id != $player_fac->getId())
                            $array_of_player_ig[] = $player_fac->getName();
            }
        }
    }
    if(!empty($guild_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
    }
    else
    {
        if($_REQUEST['todo'] == 'save')
        {
            $player->setRank();
            $player->save();
            $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Leave guild</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=100%>Player with name <b>'.$player->getName().'</b> leaved guild <b>'.$guild->getName().'</b>.</TD></TR></TABLE><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
        }
        else
        {
            $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Leave guild</B></TD></TR>';
            if(count($array_of_player_ig) > 0)
            {
                $main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=100%>Select character to leave guild:</TD></TR>';
                $main_content .= '<TR BGCOLOR='.$config['site']['darkborder'].'><TD>
                <form action="?subtopic=guilds&action=leaveguild&guild='.$guild_name.'&todo=save" METHOD="post">';
                sort($array_of_player_ig);
                foreach($array_of_player_ig as $player_to_leave)
                    $main_content .= '<input type="radio" name="name" value="'.$player_to_leave.'" />'.$player_to_leave.'<br>';
                $main_content .= '</TD></TR><br></TABLE>';
            }
            else
                $main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=100%>Any of your characters can\'t leave guild.</TD></TR>';
            $main_content .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><tr>';
            if(count($array_of_player_ig) > 0)
                $main_content .= '<td width="130" valign="top"><INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></form></td>';
            $main_content .= '<td><FORM ACTION="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></FORM></td></tr></table>';
        }
    }
}

//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//create guild
if($action == 'createguild')
{
    $guild_name = $_REQUEST['guild'];
    $name = stripslashes($_REQUEST['name']);
    $todo = $_REQUEST['todo'];
    if(!$logged)
        $guild_errors[] = 'You are not logged in. You can\'t create guild.';
    if(empty($guild_errors)) 
    {
        $account_players = $account_logged->getPlayers();
        foreach($account_players as $player)
        {
            $player_rank = $player->getRank();
            if(empty($player_rank))
                if($player->getLevel() >= $config['site']['guild_need_level'])
                    if(!$config['site']['guild_need_pacc'] || $account_logged->isPremium())
                        $array_of_player_nig[] = $player->getName();
        }
    }

    if(empty($todo))
    if(count($array_of_player_nig) == 0)
        $guild_errors[] = 'On your account all characters are in guilds or have too low level to create new guild.';
    if($todo == 'save')
    {
        if(!check_guild_name($guild_name))
        {
            $guild_errors[] = 'Invalid guild name format.';
            $guild_name = '';
        }
        if(!check_name($name))
        {
            $guild_errors[] = 'Invalid character name format.';
            $name = '';
        }
        if(empty($guild_errors))
        {
            $player = $ots->createObject('Player');
            $player->find($name);
            if(!$player->isLoaded())
                $guild_errors[] = 'Character <b>'.$name.'</b> doesn\'t exist.';
        }
        if(empty($guild_errors))
        {
            $guild = $ots->createObject('Guild');
            $guild->find($guild_name);
            if($guild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_name.'</b> already exist. Select other name.';
        }
        if(empty($guild_errors))
        {
            $bad_char = TRUE;
            foreach($array_of_player_nig as $nick_from_list)
                if($nick_from_list == $player->getName())
                    $bad_char = FALSE;
            if($bad_char)
                $guild_errors[] = 'Character <b>'.$name.'</b> isn\'t on your account or is already in guild.';
        }
        if(empty($guild_errors))
        {
            if($player->getLevel() < $config['site']['guild_need_level'])
                $guild_errors[] = 'Character <b>'.$name.'</b> has too low level. To create guild you need character with level <b>'.$config['site']['guild_need_level'].'</b>.';
            if($config['site']['guild_need_pacc'] && !$account_logged->isPremium())
                $guild_errors[] = 'Character <b>'.$name.'</b> is on FREE account. To create guild you need PREMIUM account.';
        }
    }
    if(!empty($guild_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
        unset($todo);
    }

    if($todo == 'save')
    {
        $new_guild = new OTS_Guild();
        $new_guild->setCreationData($time);
        $new_guild->setName($guild_name);
        $new_guild->setOwner($player);
        $new_guild->save();
        $new_guild->setCustomField('description', 'New guild. Leader must edit this text :)');
        $new_guild->setCustomField('creationdata', time());
        $new_guild->setCustomField('world_id', $player->getWorld());
        $ranks = $new_guild->getGuildRanksList();
        $ranks->orderBy('level', POT::ORDER_DESC);
        foreach($ranks as $rank)
            if($rank->getLevel() == 3)
            {
                $player->setRank($rank);
                $player->save();
            }
        $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Create guild</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=100%><b>Congratulations!</b><br/>You have created guild <b>'.$guild_name.'</b>. <b>'.$player->getName().'</b> is leader of this guild. Now you can invite players, change picture, description and motd of guild. Press submit to open guild manager.</TD></TR></TABLE><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild='.$new_guild->getId().'" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_Submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
    }
    else
    {
        $main_content .= 'To play on '.$config['server']['serverName'].' you need an account. 
        All you have to do to create your new account is to enter your email address, password to new account, verification code from picture and to agree to the terms presented below. 
        If you have done so, your account number, password and e-mail address will be shown on the following page and your account and password will be sent 
        to your email address along with further instructions.<BR><BR>
        <FORM ACTION="?subtopic=guilds&action=createguild&todo=save" METHOD=post>
        <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
        <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Create a '.$config['server']['serverName'].' Account</B></TD></TR>
        <TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLSPACING=8 CELLPADDING=0>
          <TR><TD>
            <TABLE BORDER=0 CELLSPACING=5 CELLPADDING=0>';
        $main_content .= '<TR><TD width="150" valign="top"><B>Leader: </B></TD><TD><SELECT name=\'name\'>';
        if(count($array_of_player_nig) > 0)
        {
            sort($array_of_player_nig);
            foreach($array_of_player_nig as $nick)
                $main_content .= '<OPTION>'.$nick.'</OPTION>';
        }
        $main_content .= '</SELECT><BR><font size="1" face="verdana,arial,helvetica">(Name of leader of new guild.)</font></TD></TR>
            <TR><TD width="150" valign="top"><B>Guild name: </B></TD><TD><INPUT NAME="guild" VALUE="" SIZE=30 MAXLENGTH=50><BR><font size="1" face="verdana,arial,helvetica">(Here write name of your new guild.)</font></TD></TR>
            </TABLE>
          </TD></TR>
        </TABLE></TD></TR>
        </TABLE>
        <BR>
        <TABLE BORDER=0 WIDTH=100%>
          <TR><TD ALIGN=center>
            <IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR>
          </TD><TD ALIGN=center VALIGN=top>
            <INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18>
            </FORM>
          </TD><TD ALIGN=center>
            <FORM  ACTION="?subtopic=guilds" METHOD=post>
            <INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18>
            </FORM>
          </TD><TD ALIGN=center>
            <IMG SRC="/images/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR>
          </TD></TR>
        </TABLE>
        </TD>
        <TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD>
        </TR>
        </TABLE>';
    }
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'manager')
{
    $guild_name = (int) $_REQUEST['guild'];
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with ID <b>'.$guild_name.'</b> doesn\'t exist.';
    }
    if(empty($guild_errors))
    {
        if($logged)
        {
            $guild_leader_char = $guild->getOwner();
            $rank_list = $guild->getGuildRanksList();
            $rank_list->orderBy('level', POT::ORDER_DESC);
            $guild_leader = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
                if($guild_leader_char->getId() == $player->getId())
                {
                    $guild_vice = TRUE;
                    $guild_leader = TRUE;
                    $level_in_guild = 3;
                }
            if($guild_leader)
            {
                $main_content .= '<center><h2>Welcome to guild manager!</h2></center>Here you can change names of ranks, delete and add ranks, pass leadership to other guild member and delete guild.';
                $main_content .= '<br/><br/><table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'>
                <tr bgcolor='.$config['site']['darkborder'].'><td width="170"><font color="red"><b>Option</b></font></td><td><font color="red"><b>Description</b></font></td></tr>
                <tr bgcolor='.$config['site']['lightborder'].'><td width="170"><b><a href="?subtopic=guilds&guild='.$guild_name.'&action=passleadership">Pass Leadership</a></b></td><td><b>Pass leadership of guild to other guild member.</b></td></tr>
                <tr bgcolor='.$config['site']['darkborder'].'><td width="170"><b><a href="?subtopic=guilds&guild='.$guild_name.'&action=deleteguild">Delete Guild</a></b></td><td><b>Delete guild, kick all members.</b></td></tr>
                <tr bgcolor='.$config['site']['lightborder'].'><td width="170"><b><a href="?subtopic=guilds&guild='.$guild_name.'&action=changedescription">Change Description</a></b></td><td><b>Change description of guild.</b></td></tr>
                <tr bgcolor='.$config['site']['darkborder'].'><td width="170"><b><a href="?subtopic=guilds&guild='.$guild_name.'&action=changemotd">Change MOTD</a></b></td><td><b>Change MOTD of guild.</b></td></tr>
                <tr bgcolor='.$config['site']['lightborder'].'><td width="170"><b><a href="?subtopic=guilds&guild='.$guild_name.'&action=changelogo">Change guild logo</a></b></td><td><b>Upload new guild logo.</b></td></tr>
                </table>';
                $main_content .= '<br><div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Add new rank</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td width="120" valign="top">New rank name:</td><td> <form action="?subtopic=guilds&guild='.$guild_name.'&action=addrank" method="POST"><input type="text" name="rank_name" size="20"><input type="submit" value="Add"></form></td></tr>          </table>        </div>  </table></div></td></tr>';
                $main_content .= '<center><h3>Change rank names and levels</h3></center><form action="?subtopic=guilds&action=saveranks&guild='.$guild_name.'" method=POST><table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'><tr bgcolor='.$config['site']['vdarkborder'].'><td rowspan="2" width="120" align="center"><font color="white"><b>Delete Rank</b></font></td><td rowspan="2" width="300"><font color="white"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name</b></font></td><td colspan="3" align="center"><font color="white"><b>Level of RANK in guild</b></font></td></tr><tr bgcolor='.$config['site']['vdarkborder'].'><td align="center" bgcolor="red"><font color="white"><b>Leader (3)</b></font></td><td align="center" bgcolor="yellow"><font color="black"><b>Vice (2)</b></font></td><td align="center" bgcolor="green"><font color="white"><b>Member (1)</b></font></td></tr>';
                foreach($rank_list as $rank)
                {
                    if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                    $main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><a href="?subtopic=guilds&guild='.$guild_name.'&action=deleterank&rankid='.$rank->getId().'" border="0"><img src="'.$layout_name.'/images/news/delete.png" border="0" alt="Delete Rank"></a></td><td><input type="text" name="'.$rank->getId().'_name" value="'.$rank->getName().'" size="35"></td><td align="center"><input type="radio" name="'.$rank->getId().'_level" value="3"';
                    if($rank->getLevel() == 3)
                        $main_content .= ' checked="checked"';
                    $main_content .= ' /></td><td align="center"><input type="radio" name="'.$rank->getId().'_level" value="2"';
                    if($rank->getLevel() == 2)
                        $main_content .= ' checked="checked"';
                    $main_content .= ' /></td><td align="center"><input type="radio" name="'.$rank->getId().'_level" value="1"';
                    if($rank->getLevel() == 1)
                        $main_content .= ' checked="checked"';
                    $main_content .= ' /></td></tr>';
                }
                $main_content .= '<tr bgcolor='.$config['site']['vdarkborder'].'><td>&nbsp;</td><td>&nbsp;</td><td colspan="3" align="center"><input type="submit" value="Save All"></td></tr></table></form>';
                $main_content .= '<h3>Ranks info:</h3><b>0. Owner of guild</b> - it\'s highest rank, only one player in guild may has this rank. Player with this rank can:
                <li>Invite/Cancel Invitation/Kick Player from guild
                <li>Change ranks of all players in guild
                <li>Delete guild or pass leadership to other guild member
                <li>Change names, levels(leader,vice,member), add and delete ranks
                <li>Change MOTD, logo and description of guild<hr>
                <b>3. Leader</b> - it\'s second rank in guild. Player with this rank can:
                <li>Invite/Cancel Invitation/Kick Player from guild (only with lower rank than his)
                <li>Change ranks of players with lower rank level ("vice leader", "member") in guild<hr>
                <b>2. Vice Leader</b> - it\'s third rank in guild. Player with this rank can:
                <li>Invite/Cancel Invitation
                <li>Change ranks of players with lower rank level ("member") in guild<hr>
                <b>1. Member</b> - it\'s lowest rank in guild. Player with this rank can:
                <li>Be a member of guild';
                $main_content .= '<br/><center><form action="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
            }
            else
                $guild_errors[] = 'You are not a leader of guild!';
        }
        else
            $guild_errors[] = 'You are not logged. You can\'t manage guild.';
    }
    if(!empty($guild_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
    }
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'changelogo')
{
    $guild_name = (int) $_REQUEST['guild'];
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
    }
    if(empty($guild_errors))
    {
        if($logged)
        {
            $guild_leader_char = $guild->getOwner();
            $guild_leader = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
                if($guild_leader_char->getId() == $player->getId())
                {
                    $guild_vice = TRUE;
                    $guild_leader = TRUE;
                    $level_in_guild = 3;
                }
            if($guild_leader)
            {
                $max_image_size_b = $config['site']['guild_image_size_kb'] * 1024;
                $allowed_ext = array('image/gif', 'image/jpg', 'image/pjpeg', 'image/jpeg', 'image/bmp', 'image/png', 'image/x-png');
                $ext_name = array('image/gif' => 'gif', 'image/jpg' => 'jpg', 'image/jpeg' => 'jpg', 'image/pjpeg' => 'jpg', 'image/bmp' => 'bmp', 'image/png' => 'png', 'image/x-png' => 'png');
                $save_file_name = str_replace(' ', '_', strtolower($guild->getName()));
                $save_path = 'guilds/'.$save_file_name;
                if($_REQUEST['todo'] == 'save')
                {
                    $file = $_FILES['newlogo'];
                    if(is_uploaded_file($file['tmp_name']))
                    {
                        if($file['size'] > $max_image_size_b)
                            $upload_errors[] = 'Uploaded image is too big. Size: <b>'.$file['size'].' bytes</b>, Max. size: <b>'.$max_image_size_b.' bytes</b>.';
                        $type = strtolower($file['type']);
                        if(!in_array($type, $allowed_ext))
                            $upload_errors[] = 'Your file type isn\' allowed. Allowed: <b>gif, jpg, bmp, png</b>. Your file type: <b>'.$type.'</b> If it\'s image contact with admin.';
                    }
                    else
                        $upload_errors[] = 'You didn\'t send file or file is too big. Limit: <b>'.$config['site']['guild_image_size_kb'].' KB</b>.';
                    if(empty($upload_errors))
                    {
                        $extension = $ext_name[$type];
                        if(!move_uploaded_file($file['tmp_name'], $save_path.'.'.$extension))
                            $upload_errors[] = 'Sorry! Can\'t save your image.';
                    }
                    if(empty($upload_errors)) 
                    {
                        $guild_logo = $guild->getCustomField('logo_gfx_name');
                        if(empty($guild_logo) || !file_exists("guilds/".$guild_logo))
                            $guild_logo = "default_logo.gif";
                        if($guild_logo != "default_logo.gif" && $guild_logo != $save_file_name.'.'.$extension)
                            unlink('guilds/'.$guild_logo);
                    }
                    //show errors or save file
                    if(!empty($upload_errors))
                    {
                        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
                        foreach($upload_errors as $guild_error)
                            $main_content .= '<li>'.$guild_error;
                        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
                    }
                    else
                        $guild->setCustomField('logo_gfx_name', $save_file_name.'.'.$extension);
                }
                $guild_logo = $guild->getCustomField('logo_gfx_name');
                if(empty($guild_logo) || !file_exists("guilds/".$guild_logo))
                    $guild_logo = "default_logo.gif";
                $main_content .= '<center><h2>Change guild logo</h2></center>Here you can change logo of your guild.<BR>Actuall logo: <img src="guilds/'.$guild_logo.'" HEIGHT="64" WIDTH="64"><BR><BR>';
                $main_content .= '<form enctype="multipart/form-data" action="?subtopic=guilds&guild='.$guild_name.'&action=changelogo" method="POST">
                <input type="hidden" name="todo" value="save" />
                <input type="hidden" name="MAX_FILE_SIZE" value="'.$max_image_size_b.'" />
                    Select new logo: <input name="newlogo" type="file" />
                    <input type="submit" value="Send new logo" /></form>Only <b>jpg, gif, png, bmp</b> pictures. Max. size: <b>'.$config['site']['guild_image_size_kb'].' KB</b><br>';
                $main_content .= '<br/><center><form action="?subtopic=guilds&guild='.$guild_name.'&action=manager" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
            }
            else
                $guild_errors[] = 'You are not a leader of guild!';
        }
        else
            $guild_errors[] = 'You are not logged. You can\'t manage guild.';
    }
    if(!empty($guild_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
        $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
    }
}


//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'deleterank')
{
    $guild_name = (int) $_REQUEST['guild'];
    $rank_to_delete = (int) $_REQUEST['rankid'];
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
    }
    if(empty($guild_errors))
    {
        if($logged)
        {
            $guild_leader_char = $guild->getOwner();
            $rank_list = $guild->getGuildRanksList();
            $rank_list->orderBy('level', POT::ORDER_DESC);
            $guild_leader = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
                if($guild->getOwner()->getId() == $player->getId())
                {
                    $guild_leader = TRUE;
                    $level_in_guild = 3;
                }
            if($guild_leader)
            {
                $rank = new OTS_GuildRank();
                $rank->load($rank_to_delete);
                if(!$rank->isLoaded())
                    $guild_errors2[] = 'Rank with ID '.$rank_to_delete.' doesn\'t exist.';
                else
                {
                    if($rank->getGuild()->getId() != $guild->getId())
                        $guild_errors2[] = 'Rank with ID '.$rank_to_delete.' isn\'t from your guild.';
                    else
                    {
                        if(count($rank_list) < 2)
                            $guild_errors2[] = 'You have only 1 rank in your guild. You can\'t delete this rank.';
                        else
                        {
                            $players_with_rank = $rank->getPlayersList();
                            $players_with_rank_number = count($players_with_rank);
                            if($players_with_rank_number > 0)
                            {
                                foreach($rank_list as $checkrank)
                                    if($checkrank->getId() != $rank->getId())
                                        if($checkrank->getLevel() <= $rank->getLevel())
                                            $new_rank = $checkrank;
                                if(empty($new_rank))
                                {
                                    $new_rank = new OTS_GuildRank();
                                    $new_rank->setGuild($guild);
                                    $new_rank->setLevel($rank->getLevel());
                                    $new_rank->setName('New Rank level '.$rank->getLevel());
                                    $new_rank->save();
                                }
                                foreach($players_with_rank as $player_in_guild)
                                {
                                    $player_in_guild->setRank($new_rank);
                                    $player_in_guild->save();
                                }
                            }
                            $rank->delete();
                            $saved = TRUE;
                        }
                    }
                }
                if($saved)
                    $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Rank Deleted</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Rank <b>'.$rank->getName().'</b> has been deleted. Players with this rank has now other rank.</td></tr>          </table>        </div>  </table></div></td></tr>';
                else
                {
                    $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
                    foreach($guild_errors2 as $guild_error) 
                        $main_content .= '<li>'.$guild_error;
                    $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
                }
                //back button
                $main_content .= '<br/><center><form action="?subtopic=guilds&guild='.$guild_name.'&action=manager" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
            }
            else
                $guild_errors[] = 'You are not a leader of guild!';
        }
        else
            $guild_errors[] = 'You are not logged. You can\'t manage guild.';
    }
    if(!empty($guild_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
        $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
    }
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'addrank')
{
    $guild_name = (int) $_REQUEST['guild'];
    $ranknew = $_REQUEST['rank_name'];
    if(empty($guild_errors))
    {
        if(!check_rank_name($ranknew))
            $guild_errors[] = 'Invalid rank name format.';
        if(!$logged)
            $guild_errors[] = 'You are not logged.';
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
        if(empty($guild_errors))
        {
            $guild_leader_char = $guild->getOwner();
            $rank_list = $guild->getGuildRanksList();
            $rank_list->orderBy('level', POT::ORDER_DESC);
            $guild_leader = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
                if($guild_leader_char->getId() == $player->getId())
                {
                    $guild_vice = TRUE;
                    $guild_leader = TRUE;
                    $level_in_guild = 3;
                }
            if($guild_leader)
            {
                $new_rank = new OTS_GuildRank();
                $new_rank->setGuild($guild);
                $new_rank->setLevel(1);
                $new_rank->setName($ranknew);
                $new_rank->save();
                header("Location: ?subtopic=guilds&guild=".$guild_name."&action=manager");
                $main_content .= 'New rank added. Redirecting...';
            }
            else
                $guild_errors[] = 'You are not a leader of guild!';
        }
        if(!empty($guild_errors))
        {
            $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
            foreach($guild_errors as $guild_error)
                $main_content .= '<li>'.$guild_error;
            $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
            $main_content .= '<br/><center><form action="?subtopic=guilds&guild='.$guild_name.'&action=show" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
        }
    }
    else
        if(!empty($guild_errors))
        {
            $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
            foreach($guild_errors as $guild_error)
                $main_content .= '<li>'.$guild_error;
            $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
            $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
        }
}

//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'changedescription')
{
    $guild_name = (int) $_REQUEST['guild'];
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
    }
    if(empty($guild_errors))
    {
        if($logged)
        {
            $guild_leader_char = $guild->getOwner();
            $rank_list = $guild->getGuildRanksList();
            $rank_list->orderBy('level', POT::ORDER_DESC);
            $guild_leader = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
                if($guild->getOwner()->getId() == $player->getId())
                {
                    $guild_vice = TRUE;
                    $guild_leader = TRUE;
                    $level_in_guild = 3;
                }
            if($guild_leader)
            {
                if($_REQUEST['todo'] == 'save')
                {
                    $description = htmlspecialchars(stripslashes(substr(trim($_REQUEST['description']),0,$config['site']['guild_description_chars_limit'])));
                    $guild->setCustomField('description', $description);
                    $saved = TRUE;
                }
                $main_content .= '<center><h2>Change guild description</h2></center>';
                if($saved)
                    $main_content .= '<center><font color="red" size="3"><b>CHANGES HAS BEEN SAVED!</b></font></center><br>';
                $main_content .= 'Here you can change description of your guild.<BR>';
                $main_content .= '<form enctype="multipart/form-data" action="?subtopic=guilds&guild='.$guild_name.'&action=changedescription" method="POST">
                <input type="hidden" name="todo" value="save" />
                    <textarea name="description" cols="60" rows="'.bcsub($config['site']['guild_description_lines_limit'],1).'">'.$guild->getCustomField('description').'</textarea><br>
                    (max. '.$config['site']['guild_description_lines_limit'].' lines, max. '.$config['site']['guild_description_chars_limit'].' chars) <input type="submit" value="Save description" /></form><br>';
                $main_content .= '<br/><center><form action="?subtopic=guilds&guild='.$guild_name.'&action=manager" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
            }
            else
                $guild_errors[] = 'You are not a leader of guild!';
        }
        else
        $guild_errors[] = 'You are not logged. You can\'t manage guild.';
    }
    if(!empty($guild_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
        $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
    }
}

//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'passleadership')
{
    $guild_name = (int) $_REQUEST['guild'];
    $pass_to = stripslashes(trim($_REQUEST['player']));
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with ID <b>'.$guild_name.'</b> doesn\'t exist.';
    }
    if(empty($guild_errors))
    {
        if($_POST['todo'] == 'save')
        {
            if(!check_name($pass_to))
                $guild_errors2[] = 'Invalid player name format.';
            if(empty($guild_errors2))
            {
                $to_player = new OTS_Player();
                $to_player->find($pass_to);
                if(!$to_player->isLoaded())
                    $guild_errors2[] = 'Player with name <b>'.$pass_to.'</b> doesn\'t exist.';
                if(empty($guild_errors2))
                {
                    $to_player_rank = $to_player->getRank();
                    if(!empty($to_player_rank))
                    {
                        $to_player_guild = $to_player_rank->getGuild();
                        if($to_player_guild->getId() != $guild->getId())
                            $guild_errors2[] = 'Player with name <b>'.$to_player->getName().'</b> isn\'t from your guild.';
                    }
                    else
                        $guild_errors2[] = 'Player with name <b>'.$to_player->getName().'</b> isn\'t from your guild.';
                }
            }
        }
    }
    if(empty($guild_errors) && empty($guild_errors2))
    {
        if($logged)
        {
            $guild_leader_char = $guild->getOwner();
            $guild_leader = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
                if($guild_leader_char->getId() == $player->getId())
                {
                    $guild_vice = TRUE;
                    $guild_leader = TRUE;
                    $level_in_guild = 3;
                }
            if($guild_leader)
            {
                if($_POST['todo'] == 'save')
                {
                    $guild->setOwner($to_player);
                    $guild->save();
                    $saved = TRUE;
                    $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Guild Deleted</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td><b>'.$to_player->getName().'</b> is now a Leader of <b>'.$guild->getName().'</b>.</td></tr>          </table>        </div>  </table></div></td></tr><br/><center><form action="?subtopic=guilds&guild='.$guild_name.'&action=show" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
                }
                else
                    $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Guild Deleted</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Pass leadership to: </b><br>
                    <form action="?subtopic=guilds&guild='.$guild_name.'&action=passleadership" METHOD=post><input type="hidden" name="todo" value="save"><input type="text" size="40" name="player"><input type="submit" value="Save"></form>
                    </td></tr>          </table>        </div>  </table></div></td></tr><br/><center><form action="?subtopic=guilds&guild='.$guild_name.'&action=manager" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
            }
            else
                $guild_errors[] = 'You are not a leader of guild!';
        }
        else
            $guild_errors[] = 'You are not logged. You can\'t manage guild.';
    }
    if(empty($guild_errors) && !empty($guild_errors2))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors2 as $guild_error2)
            $main_content .= '<li>'.$guild_error2;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
        $main_content .= '<br/><center><form action="?subtopic=guilds&guild='.$guild_name.'&action=passleadership" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
    }
    if(!empty($guild_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        if(!empty($guild_errors2))
            foreach($guild_errors2 as $guild_error2)
                $main_content .= '<li>'.$guild_error2;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br><br/><center><form action="?subtopic=guilds&action=show&guild='.$guild_name.'" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
    }
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'deleteguild')
{
    $guild_name = (int) $_REQUEST['guild'];
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with ID <b>'.$guild_name.'</b> doesn\'t exist.';
    }
    if(empty($guild_errors))
    {
        if($logged)
        {
            $guild_leader_char = $guild->getOwner();
            $rank_list = $guild->getGuildRanksList();
            $rank_list->orderBy('level', POT::ORDER_DESC);
            $guild_leader = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
                if($guild->getOwner()->getId() == $player->getId())
                {
                    $guild_vice = TRUE;
                    $guild_leader = TRUE;
                    $level_in_guild = 3;
                }
            if($guild_leader)
            {
                if($_POST['todo'] == 'save')
                {
                    delete_guild($guild->getId());
                    $saved = TRUE;
                }
                if($saved)
                {
                    $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Guild Deleted</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Guild with name <b>'.$guild_name.'</b> has been deleted.</td></tr>          </table>        </div>  </table></div></td></tr>';
                    $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
                }
                else
                {
                    $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Guild Deleted</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Are you sure you want delete guild <b>'.$guild_name.'</b>?<br>
                    <form action="?subtopic=guilds&guild='.$guild_name.'&action=deleteguild" METHOD=post><input type="hidden" name="todo" value="save"><input type="submit" value="Yes, delete"></form>
                    </td></tr>          </table>        </div>  </table></div></td></tr>';
                    $main_content .= '<br/><center><form action="?subtopic=guilds&guild='.$guild_name.'&action=manager" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
                }
            }
            else
                $guild_errors[] = 'You are not a leader of guild!';
        }
        else
            $guild_errors[] = 'You are not logged. You can\'t manage guild.';
    }
    if(!empty($guild_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
        $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
    }
}


//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'deletebyadmin')
{
    $guild_name = (int) $_REQUEST['guild'];
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
    }
    if(empty($guild_errors))
    {
        if($logged)
        {
            if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
            {
                if($_POST['todo'] == 'save')
                {
                    delete_guild($guild->getId());
                    $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Guild Deleted</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Guild with ID <b>'.$guild_name.'</b> has been deleted.</td></tr>          </table>        </div>  </table></div></td></tr><br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
                }
                else
                    $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Guild Deleted</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Are you sure you want delete guild <b>'.$guild->getName().'</b>?<br>
                    <form action="?subtopic=guilds&guild='.$guild_name.'&action=deletebyadmin" METHOD=post><input type="hidden" name="todo" value="save"><input type="submit" value="Yes, delete"></form>
                    </td></tr>          </table>        </div>  </table></div></td></tr><br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
            }
            else
                $guild_errors[] = 'You are not an admin!';
        }
        else
            $guild_errors[] = 'You are not logged. You can\'t delete guild.';
    }
    if(!empty($guild_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
        $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
    }
}

//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'changemotd')
{
    $guild_name = (int) $_REQUEST['guild'];
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with ID <b>'.$guild_name.'</b> doesn\'t exist.';
    }
    if(empty($guild_errors))
    {
        if($logged)
        {
            $guild_leader_char = $guild->getOwner();
            $rank_list = $guild->getGuildRanksList();
            $rank_list->orderBy('level', POT::ORDER_DESC);
            $guild_leader = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
                if($guild->getOwner()->getId() == $player->getId())
                {
                    $guild_vice = TRUE;
                    $guild_leader = TRUE;
                    $level_in_guild = 3;
                }
            if($guild_leader)
            {
                if($_REQUEST['todo'] == 'save')
                {
                    $motd = htmlspecialchars(stripslashes(substr(trim($_REQUEST['motd']),0,$config['site']['guild_motd_chars_limit'])));
                    $guild->setCustomField('motd', $motd);
                    $saved = TRUE;
                }
                $main_content .= '<center><h2>Change guild MOTD</h2></center>';
                if($saved)
                    $main_content .= '<center><font color="red" size="3"><b>CHANGES HAS BEEN SAVED!</b></font></center><br>';
                $main_content .= 'Here you can change MOTD (Message of the Day, showed in game!) of your guild.<BR>';
                $main_content .= '<form enctype="multipart/form-data" action="?subtopic=guilds&guild='.$guild_name.'&action=changemotd" method="POST">
                <input type="hidden" name="todo" value="save" />
                    <textarea name="motd" cols="60" rows="3">'.$guild->getCustomField('motd').'</textarea><br>
                    (max. '.$config['site']['guild_motd_chars_limit'].' chars) <input type="submit" value="Save MOTD" /></form><br>';
                $main_content .= '<br/><center><form action="?subtopic=guilds&guild='.$guild_name.'&action=manager" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
            }
            else
                $guild_errors[] = 'You are not a leader of guild!';
        }
        else
            $guild_errors[] = 'You are not logged. You can\'t manage guild.';
    }
    if(!empty($guild_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($guild_errors as $guild_error)
            $main_content .= '<li>'.$guild_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
        $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
    }
}

//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'saveranks')
{
    $guild_name = (int) $_REQUEST['guild'];
    if(empty($guild_errors))
    {
        $guild = $ots->createObject('Guild');
        $guild->load($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
    }
    if(empty($guild_errors))
    {
        if($logged)
        {
            $guild_leader_char = $guild->getOwner();
            $rank_list = $guild->getGuildRanksList();
            $rank_list->orderBy('level', POT::ORDER_DESC);
            $guild_leader = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
                if($guild_leader_char->getId() == $player->getId())
                {
                    $guild_vice = TRUE;
                    $guild_leader = TRUE;
                    $level_in_guild = 3;
                }
            if($guild_leader)
            {
                foreach($rank_list as $rank)
                {
                    $rank_id = $rank->getId();
                    $name = $_REQUEST[$rank_id.'_name'];
                    $level = (int) $_REQUEST[$rank_id.'_level'];
                    if(check_rank_name($name))
                        $rank->setName($name);
                    else
                        $ranks_errors[] = 'Invalid rank name. Please use only a-Z, 0-9 and spaces. Rank ID <b>'.$rank_id.'</b>.';
                    if($level > 0 && $level < 4)
                        $rank->setLevel($level);
                    else
                        $ranks_errors[] = 'Invalid rank level. Contact with admin. Rank ID <b>'.$rank_id.'</b>.';
                    $rank->save();
                }
                if(!empty($ranks_errors))
                {
                    $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
                    foreach($ranks_errors as $guild_error)
                        $main_content .= '<li>'.$guild_error;
                    $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
                }
                else
                    header("Location: ?subtopic=guilds&action=manager&guild=".$guild_name);
            }
            else
                $guild_errors[] = 'You are not a leader of guild!';
        }
        else
            $guild_errors[] = 'You are not logged. You can\'t manage guild.';
    }
    if(!empty($guild_errors)) {
    $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
    foreach($guild_errors as $guild_error) {
        $main_content .= '<li>'.$guild_error;
    }
    $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
    }
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'cleanup_players')
{
    if($logged)
    {
        if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
        {
            $players_list = new OTS_Players_List();
            $players_list->init();
        }
        else
            $players_list = $account_logged->getPlayersList();
        if(count($players_list) > 0)
        {
            foreach($players_list as $player)
            {
                $player_rank = $player->getRank();
                if(!empty($player_rank))
                {
                    if($player_rank->isLoaded())
                    {
                        $rank_guild = $player_rank->getGuild();
                        if(!$rank_guild->isLoaded())
                        {
                            $player->setRank();
                            $player->setGuildNick();
                            $player->save();
                            $changed_ranks_of[] = $player->getName();
                            $deleted_ranks[] = 'ID: '.$player_rank->getId().' - '.$player_rank->getName();
                            $player_rank->delete();
                        }
                    }
                    else
                    {
                        $player->setRank();
                        $player->setGuildNick('');
                        $player->save();
                        $changed_ranks_of[] = $player->getName();
                    }
                    
                }
            }
            $main_content .= "<b>Deleted ranks (this ranks guilds doesn't exist [bug fix]):</b>";
            if(!empty($deleted_ranks))
                foreach($deleted_ranks as $rank)
                    $main_content .= "<li>".$rank;
            $main_content .= "<BR /><BR /><b>Changed ranks of players (rank or guild of rank doesn't exist [bug fix]):</b>";
            if(!empty($changed_ranks_of))
                foreach($changed_ranks_of as $name)
                    $main_content .= "<li>".$name;
        }
        else
            $main_content .= "0 players found.";
    }
    else
        $main_content .= "You are not logged in.";
    $main_content .= "<center><h3><a href=\"?subtopic=guilds\">BACK</a></h3></center>";
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'cleanup_guilds')
{
    if($logged)
    {
        $guilds_list = new OTS_Guilds_List();
        $guilds_list->init();
        if(count($guilds_list) > 0)
        {
            foreach($guilds_list as $guild)
            {
                $error = 0;
                $leader = $guild->getOwner();
                if($leader->isLoaded())
                {
                    $leader_rank = $leader->getRank();
                    if(!empty($leader_rank))
                    {
                        if($leader_rank->isLoaded())
                        {
                            $leader_guild = $leader_rank->getGuild();
                            if($leader_guild->isLoaded())
                            {
                                if($leader_guild->getId() != $guild->getId())
                                    $error = 1;
                            }
                            else
                                $error = 1;
                        }
                        else
                            $error = 1;
                    }
                    else
                        $error = 1;
                }
                else
                    $error = 1;
                if($error == 1)
                {
                    $deleted_guilds[] = $guild->getName();
                    $status = delete_guild($guild->getId());
                }
            }
            $main_content .= "<b>Deleted guilds (leaders of this guilds are not members of this guild [fix bugged guilds]):</b>";
            if(!empty($deleted_guilds))
                foreach($deleted_guilds as $guild)
                    $main_content .= "<li>".$guild;
        }
        else
            $main_content .= "0 guilds found.";
    }
    else
        $main_content .= "You are not logged in.";
    $main_content .= "<center><h3><a href=\"?subtopic=guilds\">BACK</a></h3></center>";
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
    if($action == 'change_nick')
    {
        if($logged)
        {
            $player_n = stripslashes($_REQUEST['name']);
            $new_nick = stripslashes($_REQUEST['nick']);
            $player = new OTS_Player();
            $player->find($player_n);
            $player_from_account = FALSE;
            if(strlen($new_nick) <= 40)
            {
                if($player->isLoaded())
                {
                    $account_players = $account_logged->getPlayersList();
                    if(count($account_players))
                    {
                        foreach($account_players as $acc_player)
                        {
                            if($acc_player->getId() == $player->getId())
                                $player_from_account = TRUE;
                        }
                        if($player_from_account)
                        {
                            $player->setGuildNick($new_nick);
                            $player->save();
                            $main_content .= 'Guild nick of player <b>'.$player->getName().'</b> changed to <b>'.htmlentities($new_nick).'</b>.';
                            $addtolink = '&action=show&guild='.$player->getRank()->getGuild()->getId();
                        }
                        else
                            $main_content .= 'This player is not from your account.';
                    }
                    else
                        $main_content .= 'This player is not from your account.';
                }
                else
                    $main_content .= 'Unknow error occured.';
            }
            else
                $main_content .= 'Too long guild nick. Max. 30 chars, your: '.strlen($new_nick);
        }
            else
                $main_content .= 'You are not logged.';
        $main_content .= '<center><h3><a href="?subtopic=guilds'.$addtolink.'">BACK</a></h3></center>';
    }
?>

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

topguilds.php

<?PHP 
    $main_content .= '<div style="text-align: center; font-weight: bold;"><h2>Top 15 guilds on ' . $config['server']['serverName'] . '</h2></div> 
<center><table border="0" cellspacing="1" cellpadding="4" width="80%"> 
    <tr bgcolor="'.$config['site']['vdarkborder'].'"> 
        <td width="10%"><b><font color=white><center>Pos</font></center></b></td> 
        <td width="20%"><b><font color=white><center>Logo</center></b></font></td> 
        <td width="30%"><b><font color=white><center>Guild Name</center></b></font></td> 
        <td width="20%"><b><font color=white><center>Kills</center></b></font></td> 
    </tr>'; 
$i = 0; 
foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`, 
    `g`.`logo_gfx_name` AS `logo`, COUNT(`g`.`name`) as `frags` 
    FROM `killers` k 
    LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id` 
    LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id` 
    LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id` 
    LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id` 
   WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1 
    GROUP BY `name` 
    ORDER BY `frags` DESC, `name` ASC 
    LIMIT 0, 15;') as $guild) 

    $i++; 
    $main_content .= '<tr bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']). '"> 
        <td>             
            <center>'.$i.'</center> 
        </td> 
        <td>             
            <center><img src="guilds/' . ((!empty($guild['logo']) && file_exists('guilds/' . $guild['logo'])) ? $guild['logo'] : 'default_logo.gif') . '" width="64" height="64" border="0"/></center> 
        </td> 
        <td> 
            <center><a href="?subtopic=guilds&action=show&guild=' . $guild['id'] . '">' . $guild['name'] . '</a></center> 
        </td> 
        <td> 
            <center>' . $guild['frags'] . ' kills</center> 
        </td> 
    </tr>'; 

$main_content .= '</table><br />'; 
?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

calendario.php

<?PHP
    //Script 100% By Fabinho
    $main_content .= '
    <center><h1>Calend&aacute;rio de Eventos</center></h1>
    ';
    
    $main_content .= '
    <table border="0" cellspacing=1 cellpadding=4 width="100%">
    <tr bgcolor="'.$config['site']['vdarkborder'].'">
    <th width="100%"><font class=black><b>Calend&aacute;rio</b></font></th>
    </tr>
    </table>
    <table border="0" cellspacing=1 cellpadding=4 width="100%">
    <tr>
    <td bgcolor="'.$config['site']['darkborder'].'" witdh="2%"><center><b>Segunda-Feira</center></b></td>
    <td bgcolor="'.$config['site']['darkborder'].'" witdh="2%"><center><b>Ter&ccedil;a-Feira</center></b></td>
    <td bgcolor="'.$config['site']['darkborder'].'" witdh="2%"><center><b>Quarta-Feira</center></b></td>
    <td bgcolor="'.$config['site']['darkborder'].'" witdh="2%"><center><b>Quinta-Feira</center></b></td>
    <td bgcolor="'.$config['site']['darkborder'].'" witdh="2%"><center><b>Sexta-Feira</center></b></td>
    <td bgcolor="'.$config['site']['darkborder'].'" witdh="2%"><center><b>S&aacute;bado</center></b></td>
    <td bgcolor="'.$config['site']['darkborder'].'" witdh="2%"><center><b>Domingo</center></b></td>
    </tr>
    <tr>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>Dota</center></b></td>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>Coliseum</center></b></td>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>Castle</center></b></td>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>Coliseum ou Dota</center></b></td>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>Castle</center></b></td>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>Coliseum ou Dota</center></b></td>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>Castle</center></b></td>
    </tr>
    <tr>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>14:00 ou 20:00 Hrs</center></b></td>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>14:00 ou 20:00 Hrs</center></b></td>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>19:00 Hrs</center></b></td>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>14:00 ou 20:00 Hrs</center></b></td>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>19:00 Hrs</center></b></td>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>14:00 ou 20:00 Hrs</center></b></td>
    <td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>19:00 Hrs</center></b></td>
    </tr>
    </table>
    <table border="0" cellspacing=1 cellpadding=4 width="100%">
    <tr bgcolor="'.$config['site']['vdarkborder'].'">
    <td width="100%"></td>
    </tr>
    </table>
    <br>
    ';
    
    $main_content.='
    <table border="0" cellspacing=1 cellpadding=4 width="100%">
    <tr bgcolor="'.$config['site']['vdarkborder'].'">
    <th width="100%"><font class=black>Observa&ccedil;&otilde;es</b></th>
    </tr>
    </table>
    <table border="0" cellspacing=1 cellpadding=4 width="100%">
    <tr bgcolor="'.$config['site']['darkborder'].'">
    <td width="100%"><ul><li>O hor&aacute;rio dos eventos n&atilde;o s&atilde;o 100% precisos, se caso n&atilde;o ocorra o evento no dia e por que n&atilde;o tinha nenhum <b>Administrador</b> online naquele momento para administrar o evento.</li></ul></td>
    </tr>
    <tr bgcolor="'.$config['site']['darkborder'].'">
    <td width="100%"><ul><li>O evento <b>Castle</b> &eacute; automatico, se caso ele n&atilde;o se iniciar na hora marcada no calend&aacute;rio, poste no forum pois poder&aacute; ser um bug !</li></ul></td>
    </tr>
    </table>
    ';

?>


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

tasks.php

<?php
    $main_content .= '
    <center><h1><b>Task Quest</center></h1></b>
    ';
    
    $main_content .= '
    <ul>
    <li>
    Task: Sistema de miss&otilde;es, fale com o NPC "Task Man" logo acima no templo para que ele lhe diga uma miss&atilde;o, ap&oacute;s voc&ecirc; conclui-la ele lhe dar&aacute; um pr&ecirc;mio.
    </li>
    </ul>
    ';
    
    $main_content .= '
    <table border="0" cellspacing=1 cellpadding=4 width="100%">
    <tr bgcolor="'.$config['site']['vdarkborder'].'">
    <th width=\"50%\"><font class=black><b><center>Video</center></b></font></th>
    </tr>
    </table>
    
    <table border="0" cellspacing=1 cellpadding=4 width="100%">
    <tr bgcolor="'.$config['site']['darkborder'].'">
    <iframe allowfullscreen width="640" height="480" src="https://youtu.be/kcwZkgl3nl0" frameborder="0" allowfullscreen></iframe>

    </tr>
    </table>
    <br>
    ';

?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

boss.php

<?php
    $main_content .= '
    <h1><center><b>Boss</h1></center></b>
<table width="100%" cellspacing=1 cellpadding=4 border="0">
  <tr bgcolor="'.$config['site']['vdarkborder'].'">
    <th align="left">Legenda</th>
  </tr>
  <tr bgcolor="'.$config['site']['darkborder'].'">
    <td align="left" valign="top">
    <ul>
    <li>
    <strong>
    Bosses s&atilde;o criaturas que comandam a sua ra&ccedil;a. E geralmente dropam itens muito valiosos. Aqui nessa p&aacute;gina est&aacute; citado apenas os bosses que dropam itens de addon, esses itens s&atilde;o necess&aacute;rios para os addons: Mage, Druid, Assassin, Warrior, Shaman e Pirate.
    </strong>
    </li>
      <li>
    <strong>
      Exemplo: Orshabaal &eacute; um &quot;boss&quot; do Demon.</td>
    </strong>
    </li>
    </ul>
  </tr>
</table>
<br>
<table width="100%" cellspacing=1 cellpadding=4 border="0">
  <tr bgcolor="'.$config['site']['vdarkborder'].'">
    <th width="100%">Modos de encontra-los</th>
  </tr>
</table>
<table cellspacing=1 cellpadding=4 width="100%" border="0">
  <tr bgcolor="'.$config['site']['darkborder'].'" align="center">
    <td width="100%" align="center"><strong>Cada boss diferente &eacute; sumonado no map 1 vez por semana, no local da sua respectiva "ra&ccedil;a". Toda vez que 1 &eacute; sumonado, aparece uma mensagem para todos os players online.</strong></td>
  </tr>
  <tr bgcolor="'.$config['site']['lightborder'].'" align="center">
    <td width="100%" align="center"><strong>Por meio das tasks tamb&eacute;m voc&ecirc; poder&aacute; conseguir um acesso para a &aacute;rea dos bosses, la voc&ecirc; esolher&aacute; qual quer matar, voc&ecirc; s&oacute; poder&aacute; matar apenas 1 boss.</strong></td>
  </tr>
  <tr bgcolor="'.$config['site']['darkborder'].'" align="center">
    <td width="100%" align="center"><strong>Outro meio tamb&eacute;m &eacute; comprando um addon doll no SHOP do site, com ele voc&ecirc; poder&aacute; fazer os 2 addons completos.Ou ainda pode comprar apenas o item necess&aacute;rio para o respectivo addon !</strong></td>
  </tr>
</table>
<br>
<table width="100%" cellspacing=1 cellpadding=4 border="0">
  <tr bgcolor="'.$config['site']['vdarkborder'].'">
    <th width="33%">Boss</th>
    <th width="33%">Loot</th>
    <th width="33%">Chance de droop</th>
  </tr>
</table>
<table cellspacing=1 cellpadding=4 width="100%" border="0">
  <tr bgcolor="'.$config['site']['darkborder'].'" align="center">
    <td width="33%" align="center"><strong>The Horned Fox</strong></td>
    <td width="33%"><strong>Nose Ring</strong></td>
    <td width="33%"><strong>25%</strong></td>
  </tr>
  <tr bgcolor="'.$config['site']['lightborder'].'" align="center">
    <td width="33%"><strong>Necropharus</strong></td>
    <td width="33%"><strong>Soul Stone</strong></td>
    <td width="33%"><strong>25%</strong></td>
  </tr>
  <tr bgcolor="'.$config['site']['darkborder'].'" align="center">
    <td width="33%"><strong>Demodras</strong></td>
    <td width="33%"><strong>Dragon Claw</strong></td>
    <td width="33%"><strong>25%</strong></td>
  </tr>
  <tr bgcolor="'.$config['site']['lightborder'].'" align="center">
    <td width="33%"><strong>Tiquandas Revenge</strong></td>
    <td width="33%"><strong>Mandrake</strong></td>
    <td width="33%"><strong>25%</strong></td>
  </tr>
  <tr bgcolor="'.$config['site']['darkborder'].'" align="center">
    <td width="33%"><strong>Ron the Ripper</strong></td>
    <td width="33%"><strong>Ron the Rippers Sabre</strong></td>
    <td width="33%"><strong>100%</strong></td>
  </tr>
  <tr bgcolor="'.$config['site']['lightborder'].'" align="center">
    <td width="33%"><strong>Deadeye Devious</strong></td>
    <td width="33%"><strong>Deadeye Devious Eye Patch</strong></td>
    <td width="33%"><strong>100%</strong></td>
  </tr>
  <tr bgcolor="'.$config['site']['darkborder'].'" align="center">
    <td width="33%"><strong>Lethal Lissy</strong></td>
    <td width="33%"><strong>The Lethal Lissys Shirt</strong></td>
    <td width="33%"><strong>100%</strong></td>
  </tr>
  <tr bgcolor="'.$config['site']['lightborder'].'" align="center">
    <td width="33%"><strong>Brutus Bloodbeard</strong></td>
    <td width="33%"><strong>Brutus Bloodbeards Hat</strong></td>
    <td width="33%"><strong>100%</strong></td>
  </tr>
  <tr bgcolor="'.$config['site']['lightborder'].'" align="center">
    <td width="33%"><strong><font color="red">*</font> Evento no Jogo !</strong></td>
    <td width="33%"><strong>Botanists Container</strong></td>
    <td width="33%"><strong>100%</strong></td>
  </tr>
</table>
<br>
<p align="right">
<b>Page Boss By: <a href="mailto:[email protected]">Fabinho</a></b>
    
    ';
?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

team.php

<style type="text/css"> 
        tr.over:hover { 
        background-color: lightgrey; 
        } 
</style> 

<?php 
    if($groups = simplexml_load_file($config['site']['server_path'].'/data/XML/groups.xml') or die('<b>Could not load groups!</b>')) 
        foreach($groups->group as $g)   
            $groupList[(int)$g['id']] = $g['name']; 

    $list = $SQL->query("SELECT `name`, `online`, `group_id`, `world_id` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` DESC");
    $showed_players = 0;

    $main_content .= '<center><h2>Support in game</h2></center><br>';

    $headline = '<table border="0" cellspacing="1" cellpadding="1" width="100%">
        <tr bgcolor="'.$config['site']['vdarkborder'].'">
        <td width="20%"><font class=white><b>Group</b></font></td>
        <td width="45%"><font class=white><b>Name</b></font></td>
        <td width="15%"><font class=white><b>Status</b></font></td>
        <td width="20%"><font class=white><b>World</b></font></td>'; 
      
    $group_id = 0;
    foreach($list as $gm)
    {
        if($group_id != (int)$gm['group_id']) 
        { 
            if($group_id != 0) 
                $main_content .= '</table><br />'; 

            $main_content .= $headline; 
            $group_id = (int)$gm['group_id']; 
        } 

        $main_content .= '<tr bgcolor="'.(is_int($showed_players++ / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']).'" class="over"><td>'.$groupList[(int)$gm['group_id']].'</td><td><a href="?subtopic=characters&name='.urlencode($gm['name']).'">'.$gm['name'].'</a></td><td><font color="'.($gm['online'] == 0 ? 'red">Offline' : 'green">Online').'</font></td><td>'.$config['site']['worlds'][$gm['world_id']].'</td></tr>'; 
    } 

    $main_content .= '</table><table border="0" cellspacing="1" cellpadding="4" width="100%"><tbody><tr><td><div style="text-align: right; margin: 20px auto; font-size: 10px;"</div></td></tr></tbody></table>';
?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

buypoints.php

<?php
if(!$logged)
if($action == "logout")
$main_content .= '<div class="TableContainer" > <table class="Table1" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url(tibiacom/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Logout Successful</div> <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td>You have logged out of your '.$config['server']['serverName'].' account. In order to view your account you need to <a href="?subtopic=accountmanagement" >log in</a> again.</td></tr> </table> </div> </table></div></td></tr>';
else
$main_content .= 'Digite sua conta e sua senha para logar.<br/><a href="?subtopic=createaccount" >Cria Sua Conta</a> Caso Você não tenha criado ainda.<br/><br/><form action="?subtopic=accountmanagement" method="post" ><div class="TableContainer" > <table class="Table1" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Account Login</div> <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td class="LabelV" ><span >Account Name:</span></td><td style="width:100%;" ><input type="password" name="account_login" SIZE="10" maxlength="10" ></td></tr><tr><td class="LabelV" ><span >Password:</span></td><td><input type="password" name="password_login" size="30" maxlength="29" ></td></tr> </table> </div> </table></div></td></tr><br/><table width="100%" ><tr align="center" ><td><table border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=lostaccount" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Account lost?" alt="Account lost?" src="'.$layout_name.'/images/buttons/_sbutton_accountlost.gif" ></div></div></td></tr></form></table></td></tr></table>';
else
{
$main_content .= '  
<br><table width="100%" border="2" cellpadding="4" cellspacing="1">
<tbody><tr>
  <td class="white" colspan="3" bgcolor="#505050"><span class="style4">Detalhes dos Points.</span></td>
 
</tr>
<tr bgcolor="#f1e0c6"><td width="35%"><b>Quantidade de Points</b></td><td width="35%"><b>Valor da Doação</b></td></tr>
<tr bgcolor="#d4c0a1"><td><img src="./layouts/tibiacom/images/content/bullet.gif"> 5 Points</td><td>R$5,00</td></tr>
 
<tr bgcolor="#f1e0c6"><td><img src="./layouts/tibiacom/images/content/bullet.gif"> 10 Points</td><td>R$10,00</td></tr>
<tr bgcolor="#d4c0a1"><td><img src="./layouts/tibiacom/images/content/bullet.gif"> 20 Points</td><td>R$20,00</td></tr>
<tr bgcolor="#f1e0c6"><td><img src="./layouts/tibiacom/images/content/bullet.gif"> 40 Points</td><td>R$40,00</td></tr>
<tr bgcolor="#d4c0a1"><td><img src="./layouts/tibiacom/images/content/bullet.gif"> 60 Points</td><td>R$60,00</td></tr>
<tr bgcolor="#f1e0c6"><td><center><img src="./layouts/tibiacom/images/content/bullet.gif"> E assim por diante!!! <img src="./layouts/tibiacom/images/content/bullet.gif"></center></td><td><center><img src="./layouts/tibiacom/images/content/bullet.gif"> E assim por diante!!! <img src="./layouts/tibiacom/images/content/bullet.gif"></center></td></tr>
</tbody></table> 
<br></br>
<table border="2"><tbody><tr border="2"><td bgcolor="#505050">
<center><font size="2"><b></b></font></center>
<div style="width: 0%">
<form method="post" target="_new" action="https://pagseguro.uol.com.br/security/webpagamentos/webpagto.aspx" name="LOGIN" class="formulario" style="width: 450px; margin: 0 0 10px 0; float: left;">
<p>
<input type="hidden" name="email_cobranca" value="SEU-EMAIL PAG SEGURO AQUI">
<input type="hidden" name="tipo" value="CP">
<input type="hidden" name="moeda" value="BRL">
<input type="hidden" name="item_id_1" value="2000050">
<br><table border="2"><tbody><tr border="2"><td bgcolor="#505050" class="white"><strong>Nome do Seu Character (Sem erro):</strong></td></tr></tbody></table>
<table border="2"><tbody><tr border="2"><td bgcolor="grey"><input type="text" name="item_descr_1"></td></tr></tbody></table><br>
<input type="hidden" name="item_quant_1" value="1">
<br><table border="2"><tbody><tr border="2"><td width="153" bgcolor="#505050" class="white"><span class="style11 style4"><strong>Valor do pagamento:</strong></span></td>
</tr></tbody></table>
<table border="0"><tbody><tr border="2">
  <td width="96" bgcolor="grey"><label>
    <select name="item_valor_1" id="item_valor_1" tabindex="2">
      <option selected>Selecione</option>
      <option value="5,00">5 Points</option>
      <option value="10,00">10 Points</option>
      <option value="20,00">20 Points</option>
      <option value="30,00">30 Points</option>
      <option value="40,00">40 Points</option>
      <option value="50,00">50 Points</option>
      <option value="60,00">60 Points</option>
      <option value="70,00">70 Points</option>
      <option value="80,00">80 Points</option>
      <option value="90,00">90 Points</option>
      <option value="100,00">100 Points</option>
      <option value="110,00">110 Points</option>
      <option value="120,00">120 Points</option>
      <option value="130,00">130 Points</option>
      <option value="140,00">140 Points</option>
      <option value="150,00">150 Points</option>
                                </select>
  </label></td>
</tr></tbody></table>
</td>
</tr>
<br>
<br>
<input type="hidden" name="item_frete_1" value="000">
<br>
<table border="2"><tbody><tr border="2"><td bgcolor="#505050"><input type="submit" value="Finalizar Compra"></td></tr></tbody></table>
</p>

<div></div>
<tr>
</tr>
</tbody></table></form>
<br></br><br></br><b><font size="1">Pelo PagSeguro é possível realizar doações por Boletos Bancários, Cartões de credito e Transferências entre contas PagSeguro. Após efetuar a doação aguarde o prazo de 24/48hrs para a conclusão da sua doação.Os Coins serão entregues dentro do prazo definido ou após a aprovação do pagamento no PagSeguro.</b></font>'; } ?> 

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

shopsystem.php

<?PHP
//  ALTER TABLE `z_shop_history_item` CHANGE `offer_id` `offer_id` VARCHAR( 255 ) NOT NULL;
// UPDATE `z_shop_history_item`, `z_shop_offer` SET `z_shop_history_item`.`offer_id` = `z_shop_offer`.`offer_name` WHERE `z_shop_history_item`.`offer_id` = `z_shop_offer`.`id`;
if($config['site']['shop_system'] == 1) {
    if($logged)
        $user_premium_points = $account_logged->getCustomField('premium_points');
    else
        $user_premium_points = 'Login first';

function getItemByID($id)
{
  $id = (int) $id;
  $SQL = $GLOBALS['SQL'];
  $data = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_offer').' WHERE '.$SQL->fieldName('id').' = '.$SQL->quote($id).';')->fetch();
  if ($data['offer_type'] == 'pacc')
  {
    $offer['id'] = $data['id'];
    $offer['type'] = $data['offer_type'];
    $offer['days'] = $data['count1'];
    $offer['points'] = $data['points'];
    $offer['description'] = $data['offer_description'];
    $offer['name'] = $data['offer_name'];
  }
  elseif ($data['offer_type'] == 'item')
  {
    $offer['id'] = $data['id'];
    $offer['type'] = $data['offer_type'];
    $offer['item_id'] = $data['itemid1'];
    $offer['item_count'] = $data['count1'];
    $offer['points'] = $data['points'];
    $offer['description'] = $data['offer_description'];
    $offer['name'] = $data['offer_name'];
  }
  elseif ($data['offer_type'] == 'vipdays')
  {
    $offer['id'] = $data['id'];
    $offer['type'] = $data['offer_type'];
    $offer['days'] = $data['count1'];
    $offer['points'] = $data['points'];
    $offer['description'] = $data['offer_description'];
    $offer['name'] = $data['offer_name'];
  }
  elseif ($data['offer_type'] == 'itemvip')
  {
    $offer['id'] = $data['id'];
    $offer['type'] = $data['offer_type'];
    $offer['item_id'] = $data['itemid1'];
    $offer['item_count'] = $data['count1'];
    $offer['points'] = $data['points'];
    $offer['description'] = $data['offer_description'];
    $offer['name'] = $data['offer_name'];
  }
  elseif ($data['offer_type'] == 'container')
  {
    $offer['id'] = $data['id'];
    $offer['type'] = $data['offer_type'];
    $offer['container_id'] = $data['itemid2'];
    $offer['container_count'] = $data['count2'];
    $offer['item_id'] = $data['itemid1'];
    $offer['item_count'] = $data['count1'];
    $offer['points'] = $data['points'];
    $offer['description'] = $data['offer_description'];
    $offer['name'] = $data['offer_name'];
  }
  elseif ($data['offer_type'] == 'unban')
  {
    $offer['id'] = $data['id'];
    $offer['type'] = $data['offer_type'];
    $offer['points'] = $data['points'];
    $offer['description'] = $data['offer_description'];
    $offer['name'] = $data['offer_name'];
  }
  elseif ($data['offer_type'] == 'redskull')
  {
    $offer['id'] = $data['id'];
    $offer['type'] = $data['offer_type'];
    $offer['points'] = $data['points'];
    $offer['description'] = $data['offer_description'];
    $offer['name'] = $data['offer_name'];
  }
  elseif ($data['offer_type'] == 'itemlogout')
  {
    $offer['id'] = $data['id'];
    $offer['type'] = $data['offer_type'];
    $offer['points'] = $data['points'];
    $offer['description'] = $data['offer_description'];
    $offer['pid'] = $data['pid'];
    $offer['count1'] = $data['count1'];
    $offer['item_id'] = $data['itemid1'];
    $offer['free_cap'] = $data['free_cap'];
  }
  elseif ($data['offer_type'] == 'changename')
  {
    $offer['id'] = $data['id'];
    $offer['type'] = $data['offer_type'];
    $offer['points'] = $data['points'];
    $offer['description'] = $data['offer_description'];
    $offer['name'] = $data['offer_name'];
  }
  return $offer;
}

function getOfferArray()
{
  $offer_list = $GLOBALS['SQL']->query('SELECT * FROM '.$GLOBALS['SQL']->tableName('z_shop_offer').';');
  $i_pacc = 0;
  $i_item = 0;
  $i_vipdays = 0;
  $i_itemvip = 0;
  $i_container = 0;
  $i_unban = 0;
  $i_redskull = 0;
  $i_itemlogout = 0;
  $i_changename = 0;
  while($data = $offer_list->fetch()) {
    if ($data['offer_type'] == 'pacc')
    {
      $offer_array['pacc'][$i_pacc]['id'] = $data['id'];
      $offer_array['pacc'][$i_pacc]['days'] = $data['count1'];
      $offer_array['pacc'][$i_pacc]['points'] = $data['points'];
      $offer_array['pacc'][$i_pacc]['description'] = $data['offer_description'];
      $offer_array['pacc'][$i_pacc]['name'] = $data['offer_name'];
      $i_pacc++;
    }
    elseif ($data['offer_type'] == 'item')
    {
      $offer_array['item'][$i_item]['id'] = $data['id'];
      $offer_array['item'][$i_item]['item_id'] = $data['itemid1'];
      $offer_array['item'][$i_item]['item_count'] = $data['count1'];
      $offer_array['item'][$i_item]['points'] = $data['points'];
      $offer_array['item'][$i_item]['description'] = $data['offer_description'];
      $offer_array['item'][$i_item]['name'] = $data['offer_name'];
      $i_item++;
    }
    elseif ($data['offer_type'] == 'vipdays')
    {
      $offer_array['vipdays'][$i_vipdays]['id'] = $data['id'];
      $offer_array['vipdays'][$i_vipdays]['days'] = $data['count1'];
      $offer_array['vipdays'][$i_vipdays]['points'] = $data['points'];
      $offer_array['vipdays'][$i_vipdays]['description'] = $data['offer_description'];
      $offer_array['vipdays'][$i_vipdays]['name'] = $data['offer_name'];
      $i_vipdays++;
    }
    elseif ($data['offer_type'] == 'itemvip')
    {
      $offer_array['itemvip'][$i_itemvip]['id'] = $data['id'];
      $offer_array['itemvip'][$i_itemvip]['item_id'] = $data['itemid1'];
      $offer_array['itemvip'][$i_itemvip]['item_count'] = $data['count1'];
      $offer_array['itemvip'][$i_itemvip]['points'] = $data['points'];
      $offer_array['itemvip'][$i_itemvip]['description'] = $data['offer_description'];
      $offer_array['itemvip'][$i_itemvip]['name'] = $data['offer_name'];
      $i_itemvip++;
    }
    elseif ($data['offer_type'] == 'container')
    {
      $offer_array['container'][$i_container]['id'] = $data['id'];
      $offer_array['container'][$i_container]['container_id'] = $data['itemid2'];
      $offer_array['container'][$i_container]['container_count'] = $data['count2'];
      $offer_array['container'][$i_container]['item_id'] = $data['itemid1'];
      $offer_array['container'][$i_container]['item_count'] = $data['count1'];
      $offer_array['container'][$i_container]['points'] = $data['points'];
      $offer_array['container'][$i_container]['description'] = $data['offer_description'];
      $offer_array['container'][$i_container]['name'] = $data['offer_name'];
      $i_container++;
    }
    elseif ($data['offer_type'] == 'unban')
    {
      $offer_array['unban'][$i_unban]['id'] = $data['id'];
      $offer_array['unban'][$i_unban]['points'] = $data['points'];
      $offer_array['unban'][$i_unban]['description'] = $data['offer_description'];
      $offer_array['unban'][$i_unban]['name'] = $data['offer_name'];
      $i_unban++;
    }
    elseif ($data['offer_type'] == 'redskull')
    {
      $offer_array['redskull'][$i_redskull]['id'] = $data['id'];
      $offer_array['redskull'][$i_redskull]['points'] = $data['points'];
      $offer_array['redskull'][$i_redskull]['description'] = $data['offer_description'];
      $offer_array['redskull'][$i_redskull]['name'] = $data['offer_name'];
      $i_redskull++;
    }
    elseif ($data['offer_type'] == 'itemlogout')
    {
      $offer_array['itemlogout'][$i_itemlogout]['id'] = $data['id'];
      $offer_array['itemlogout'][$i_itemlogout]['points'] = $data['points'];
      $offer_array['itemlogout'][$i_itemlogout]['description'] = $data['offer_description'];
      $offer_array['itemlogout'][$i_itemlogout]['name'] = $data['offer_name'];
      $offer_array['itemlogout'][$i_itemlogout]['count1'] = $data['count1'];
      $offer_array['itemlogout'][$i_itemlogout]['pid'] = $data['pid'];
      $offer_array['itemlogout'][$i_itemlogout]['item_id'] = $data['itemid1'];
      $offer_array['itemlogout'][$i_itemlogout]['free_cap'] = $data['free_cap'];
      $i_itemlogout++;
    }
    elseif ($data['offer_type'] == 'changename')
    {
      $offer_array['changename'][$i_changename]['id'] = $data['id'];
      $offer_array['changename'][$i_changename]['points'] = $data['points'];
      $offer_array['changename'][$i_changename]['description'] = $data['offer_description'];
      $offer_array['changename'][$i_changename]['name'] = $data['offer_name'];
      $i_changename++;
    }
  }
  return $offer_array;
}

    if($action == '') {
        unset($_SESSION['viewed_confirmation_page']);
        $main_content .= '<h2><center>Welcome to '.$config['server']['serverName'].' Shop.</center></h2>';
        $offer_list = getOfferArray();
            //show list of vipdays offers
                if(count($offer_list['vipdays']) > 0) {
                $main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;VIP Days</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
                    foreach($offer_list['vipdays'] as $vipdays) {
                        $main_content .= '<tr bgcolor="#F1E0C6"><td align="center">'.$vipdays['days'].'</td><td><b>'.$vipdays['name'].'</b> ('.$vipdays['points'].' points)<br />'.$vipdays['description'].'</td><td align="center">';
                        if(!$logged) $main_content .= '<b>Login to buy</b>'; else 
                        $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$vipdays['id'].'"><input type="submit" value="Buy '.$vipdays['name'].'"><br><b>for '.$vipdays['points'].' points</b></form>';
                        $main_content .= '</td></tr>';
                    }
                    $main_content .= '</table><br />';
                }
            //show list of itemsvip offers
            if(count($offer_list['itemvip']) > 0) {
                $main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;Items VIP</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
                    foreach($offer_list['itemvip'] as $itemvip) {
                        $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemvip['id'].'.gif"></td><td><b>'.$itemvip['name'].'</b> ('.$itemvip['points'].' points)<br />'.$itemvip['description'].'</td><td align="center">';
                        if(!$logged) $main_content .= '<b>Login to buy</b>'; else 
                        $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$itemvip['id'].'"><input type="submit" value="Buy '.$itemvip['name'].'"><br><b>for '.$item['points'].' points</b></form>';
                        $main_content .= '</td></tr>';
                    }
                    $main_content .= '</table><br />';
                }
            //show list of items offers
            if(count($offer_list['item']) > 0 or count($offer_list['container']) > 0 or count($offer_list['itemlogout']) > 0)
                $main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;ITEMS</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
                if(count($offer_list['item']) > 0) {
                    foreach($offer_list['item'] as $item) {
                        $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$item['id'].'.gif"></td><td><b>'.$item['name'].'</b> ('.$item['points'].' points)<br />'.$item['description'].'</td><td align="center">';
                        if(!$logged) $main_content .= '<b>Login to buy</b>'; else 
                        $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$item['id'].'"><input type="submit" value="Buy '.$item['name'].'"><br><b>for '.$item['points'].' points</b></form>';
                        $main_content .= '</td></tr>';
                    }
                    $main_content .= '</table><br />';
                }
                //show list of containers offers
                if(count($offer_list['container']) > 0) {
                    $main_content .= '<table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;CONTAINERS WITH ITEMS</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
                    foreach($offer_list['container'] as $container) {
                        $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$container['id'].'.gif"></td><td><b>'.$container['name'].'</b> ('.$container['points'].' points)<br />'.$container['description'].'</td><td align="center">';
                        if(!$logged) $main_content .= '<b>Login to buy</b>'; else 
                        $main_content .= '<form action="?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$container['id'].'"><input type="submit" value="Buy '.$container['name'].'"><br><b>for '.$container['points'].' points</b></form>';
                        $main_content .= '</td></tr>';
                    }
                    $main_content .= '</table><br />';
                }
                if(count($offer_list['itemlogout']) > 0) {
                    $main_content .= '<table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;Receive Item on Logout</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></font></td><td width="350" align="left"><b>Description</b></font></td><td width="250" align="center"><b>Select product</b></font></td></tr>';
                    foreach($offer_list['itemlogout'] as $itemlogout) {
                        $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemlogout['id'].'.gif"></td><td><b>'.$itemlogout['name'].'</b> ('.$itemlogout['points'].' points)<br />'.$itemlogout['description'].'</td><td align="center">';
                        if(!$logged) $main_content .= '<b>Login to buy</b>'; else 
                        $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$itemlogout['id'].'"><input type="submit" value="Buy '.$itemlogout['name'].'"><br><b>for '.$itemlogout['points'].' points</b></form>';
                        $main_content .= '</td></tr>';
                    }
                    $main_content .= '</table><br />';
                }
            if(count($offer_list['changename']) > 0 or count($offer_list['pacc']) > 0 or count($offer_list['redskull']) > 0 or count($offer_list['unban']) > 0 )
                $main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;Others</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>#</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
                //Pacc
                if(count($offer_list['pacc']) > 0)
                    foreach($offer_list['pacc'] as $pacc) {
                        $main_content .= '<tr bgcolor="#F1E0C6"><td align="center">'.$pacc['days'].'</td><td><b>'.$pacc['name'].'</b> ('.$pacc['points'].' points)<br />'.$pacc['description'].'</td><td align="center">';
                        if(!$logged) $main_content .= '<b>Login to buy</b>'; else 
                        $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$pacc['id'].'"><input type="submit" value="Buy '.$pacc['name'].'"><br><b>for '.$pacc['points'].' points</b></form>';
                    }
                //Change Name
                if(count($offer_list['changename']) > 0)
                    foreach($offer_list['changename'] as $changename) {
                        $main_content .= '<tr bgcolor="#F1E0C6"><td align="center">Change Name</td><td><b>'.$changename['name'].'</b> ('.$changename['points'].' points)<br />'.$changename['description'].'</td><td align="center">';
                        if(!$logged) $main_content .= '<b>Login to buy</b>'; else 
                        $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$changename['id'].'"><input type="submit" value="Buy '.$changename['name'].'"><br><b>for '.$changename['points'].' points</b></form>';
                    }
                //Remove Red Skull
                if(count($offer_list['redskull']) > 0)
                    foreach($offer_list['redskull'] as $redskull) {
                        $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$redskull['id'].'.gif"></td><td><b>'.$redskull['name'].'</b> ('.$redskull['points'].' points)<br />'.$redskull['description'].'</td><td align="center">';
                        if(!$logged) $main_content .= '<b>Login to buy</b>'; else 
                        $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$redskull['id'].'"><input type="submit" value="Buy '.$redskull['name'].'"><br><b>for '.$redskull['points'].' points</b></form>';
                        $main_content .= '</td></tr>';
                    }
                //Unban
                if(count($offer_list['unban']) > 0)
                    foreach($offer_list['unban'] as $unban){
                        $main_content .= '<tr bgcolor="#F1E0C6"><td align="center">Unban</td><td><b>'.$unban['name'].'</b> ('.$unban['points'].' points)<br />'.$unban['description'].'</td><td align="center">';
                        if(!$logged) $main_content .= '<b>Login to buy</b>'; else 
                        $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$unban['id'].'"><input type="submit" value="Buy '.$unban['name'].'"><br><b>for '.$unban['points'].' points</b></form>';
                        $main_content .= '</td></tr>';
                    }
                    $main_content .= '</table>';
    }
    elseif($action == 'select_player') {
        unset($_SESSION['viewed_confirmation_page']);
        if(!$logged) {
            $main_content .= 'Please login first.';
        } else {
            $buy_id = (int) $_REQUEST['buy_id'];
            if(empty($buy_id)) {
                $main_content .= 'Please <a href="index.php?subtopic=shopsystem">select item</a> first.';
            } else {
                $buy_offer = getItemByID($buy_id);
                if(isset($buy_offer['id'])) {  //item exist in database
                    if($buy_offer['type'] != 'changename') {
                        if($user_premium_points >= $buy_offer['points']) {
                            $main_content .= '<center><h2>Select player</h2><table border="0" cellpadding="1" cellspacing="1" width="650">
                                <tr bgcolor="#505050"><td colspan="2"><font color="white" size="4"><b>Selected offer</b></font></td></tr>
                                <tr bgcolor="#F1E0C6"><td width="100"><b>Name:</b></td><td width="550">'.$buy_offer['name'].'</td></tr>
                                <tr bgcolor="#D4C0A1"><td width="100"><b>Description:</b></td><td width="550">'.$buy_offer['description'].'</td></tr>
                                </table><br /><form action="index.php?subtopic=shopsystem&action=confirm_transaction" method=POST><input type="hidden" name="buy_id" value="'.$buy_id.'">
                                <table border="0" cellpadding="1" cellspacing="1" width="650">
                                <tr bgcolor="#505050"><td colspan="2"><font color="white" size="4"><b>Give item to a player from your account</b></font></td></tr>
                                <tr bgcolor="#F1E0C6"><td width="110"><b>Name:</b></td><td width="550"><select name="buy_name">';
                                $players_from_logged_acc = $account_logged->getPlayersList();
                            if(count($players_from_logged_acc) > 0) {
                                $players_from_logged_acc->orderBy('name');
                                foreach($players_from_logged_acc as $player)
                                    $main_content .= '<option>'.$player->getName().'</option>';
                            } else {
                                $main_content .= 'You don\'t have any character on your account.';
                            }
                            $main_content .= '</select>&nbsp;<input type="submit" value="Give"></td></tr></table>
                                </form><br /><form action="index.php?subtopic=shopsystem&action=confirm_transaction" method=POST><input type="hidden" name="buy_id" value="'.$buy_id.'">
                                <table border="0" cellpadding="1" cellspacing="1" width="650">
                                <tr bgcolor="#505050"><td colspan="2"><font color="white" size="4"><b>Give item to other player</b></font></td></tr>
                                <tr bgcolor="#D4C0A1"><td width="110"><b>To player:</b></td><td width="550"><input type="text" name="buy_name"> - name of the player who should get item</td></tr>
                                <tr bgcolor="#F1E0C6"><td width="110"><b>From:</b></td><td width="550"><input type="text" name="buy_from">&nbsp;<input type="submit" value="Give"> - your nick, \'empty\' = Anonymous</td></tr>
                                </table><br /></form>';
                        } else {
                            $main_content .= 'For this item you need <b>'.$buy_offer['points'].'</b> points.<br>You have only <b>'.$user_premium_points.'</b> premium points. Please <a href="index.php?subtopic=shopsystem">select other item</a> or buy premium points.';
                        }
                    } else {
                    $main_content .= '<center><h2>Change Name</h2><form action="index.php?subtopic=shopsystem&action=confirm_transaction" method=POST><input type="hidden" name="buy_id" value="'.$buy_id.'">
                        <table border="0" cellpadding="1" cellspacing="1" width="650"><tr bgcolor="#505050"><td colspan="2"><font color="white" size="4"><b>Change Name:</b></font></td></tr>
                        <tr bgcolor="#D4C0A1"><td width="110"><b>Name:</b></td><td width="550"><select name="buy_name">';
                    $players_from_logged_acc = $account_logged->getPlayersList();
                        if(count($players_from_logged_acc) > 0) {
                            $players_from_logged_acc->orderBy('name');
                            foreach($players_from_logged_acc as $player) {
                                $main_content .= '<option>'.$player->getName().'</option>';
                            }
                        } else {
                            $main_content .= 'You don\'t have any character on your account.';
                        }
                        $main_content .= '</select></td></tr><tr bgcolor="#F1E0C6"><td width="110"><b>New name:</b></td><td width="550"><input type="text" name="buy_from">&nbsp;<input type="submit" value="Change Name"></td></tr></table><br /></form>';
                    }
                } else {
                          $main_content .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="index.php?subtopic=shopsystem">select item</a> again.';
                }
            }
        }
    }
    elseif($action == 'confirm_transaction') {
        if(!$logged) {
            $main_content .= 'Please login first.';
        } else {
            $buy_id = (int) $_POST['buy_id'];
            $buy_name = stripslashes(urldecode($_POST['buy_name']));
            $buy_from = stripslashes(urldecode($_POST['buy_from']));
            if(empty($buy_id)) {
                $main_content .= 'Please <a href="index.php?subtopic=shopsystem">select item</a> first.';
            } else {
                if($buy_offer['type'] == 'changename'){
                    if(!check_name_new_char($buy_from)) {
                        $main_content .= 'Invalid name format of new name.';
                    }
                } else {
                    $buy_offer = getItemByID($buy_id);
                    $check_name_in_database = $ots->createObject('Player');
                    $check_name_in_database->find($buy_from);
                    if($buy_offer['type'] == 'changename'){
                        if(!$check_name_in_database->isLoaded()) {
                        }
                    }
                    if(isset($buy_offer['id'])) {  //item exist in database
                        if($user_premium_points >= $buy_offer['points']) {
                            if(check_name($buy_name)) {
                                $buy_player = new OTS_Player();
                                $buy_player->find($buy_name);
                                if($buy_player->isLoaded()) {
                                    $buy_player_account = $buy_player->getAccount();
                                    if($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes') {
                                        if($buy_offer['type'] == 'pacc') {
                                            $player_vip_time = $buy_player_account->getCustomField('vip_time');
                                            $player_lastlogin = $buy_player_account->getCustomField('lastday');
                                            $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_pacc').' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['days']).', \'realized\', '.$SQL->quote(time()).', '.$SQL->quote(time()).');';
                                            $SQL->query($save_transaction);
                                            if($player_vip_time > 0)
                                                $buy_player_account->setCustomField('vip_time', $player_vip_time + $buy_offer['days'] * 86400);
                                            else
                                                $buy_player_account->setCustomField('vip_time', time() + $buy_offer['days'] * 86400);
                                            $buy_player_account->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                            $user_premium_points = $user_premium_points - $buy_offer['points'];
                                            if ($player_vip_days >= 1) {
                                            }
                                            $main_content .= '<center><h2>VIP Days added!</h2><b>'.$buy_offer['days'].' days</b> of VIP days added to the account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
                                            }
                                        elseif($buy_offer['type'] == 'unban') {
                                            $my_acc_id = $account_logged->getCustomField('id');
                                            $datadata = $SQL->query('SELECT * FROM '.$SQL->tableName('bans').' WHERE value = '.$my_acc_id.';')->fetch();
                                                if($datadata['value'] == $my_acc_id) {
                                                    if($SQL->query('DELETE FROM bans WHERE value= '.$my_acc_id.' LIMIT 1;')) {
                                                    } else {
                                                        $SQL->query('DELETE FROM bans WHERE account= '.$my_acc_id.' LIMIT 1;');
                                                    }
                                                    $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                                    $user_premium_points = $user_premium_points - $buy_offer['points'];
                                                    $main_content .= '<center><h2>Ban Deleted!</h2><b>Your account has been unbanned for '.$buy_offer['points'].' premium points</b> from your account.
                                                        <br>Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
                                                } else {
                                                    $main_content .= '<center><b>You don\'t have any bans in your account!</b><br><br><a href="index.php?subtopic=shopsystem">Go back</a><br>';
                                                }
                                            }
                                        ////////////////////////////////
                                        elseif($buy_offer['type'] == 'itemlogout') {
                                            $my_acc_id = $buy_player->getCustomField('id');
                                            $playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE id = '.$my_acc_id.';')->fetch();
                                            $playerslot = $SQL->query('SELECT * FROM '.$SQL->tableName('player_items').' WHERE player_id = '.$my_acc_id.';')->fetch();
                                            if($playerinfo['online'] == '0') {
                                                if ($playerslot['pid'] != '10') {
                                                    if ($datadata['cap'] >= $SQL->quote($buy_offer['free_cap'])) {
                                                        $SQL->query('INSERT INTO player_items (player_id, pid, itemtype, count) VALUES ('.$my_acc_id.', '.$SQL->quote($buy_offer['pid']).', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['count1']).');');
                                                        $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                                        $user_premium_points = $user_premium_points - $buy_offer['points'];
                                                        $main_content .= '<h2>Item received to player: '.$buy_player->getName().'!</h2><br>Now you have <b>'.$user_premium_points.' premium points</b>.
                                                            <br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a>';
                                                    } else {
                                                        $main_content .= '<b>You need '.$SQL->quote($buy_offer['free_cap']).' or more of cap!</b><br><a href="index.php?subtopic=shopsystem">Go back</a>';
                                                    }
                                                } else {
                                                    $main_content .= '<b>Please leave the arrow slot in blank to receive item!</b><br><a href="index.php?subtopic=shopsystem">Go back</a>';
                                                }
                                            } else {
                                                $main_content .= '<b>You need to be offline!</b><br><a href="index.php?subtopic=shopsystem">Go back</a>';
                                            }
                                        }
                                        ////////////////////////////////
                                        elseif($buy_offer['type'] == 'changename') {
                                            $my_acc_id = $buy_player->getCustomField('id');
                                            $playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$my_acc_id.';')->fetch();
                                            $checkname = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('name').' = '. $SQL->quote($buy_from) .';')->fetch();
                                             if($playerinfo['online'] == '0') {
                                                if($checkname == false) { 
                                                    $SQL->query('UPDATE `players` SET `name` = '. $SQL->quote($buy_from) .' WHERE `id` = '. $my_acc_id.' ;');
                                                    $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                                    $user_premium_points = $user_premium_points - $buy_offer['points'];
                                                    $main_content .= '<center><h2>Your name has been changed to '.$buy_from.'.</h2><br><b>You have '.$user_premium_points.' premium points left</b>.
                                                        <br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
                                                } else {
                                                    $main_content .= '<center><h2>Sorry, the name "<i>'.$buy_from.'</i>" does already exist.<br>Please select another name.</h2><br>';
                                                }
                                            } else {
                                                $main_content .= '<center><h2>'.$buy_name.' has to be offline to complete transaction.</h2><br><br><a href="index.php?subtopic=shopsystem">Go back</a><br>';
                                            }
                                        }
                                        ////////////////////////////////
                                        elseif($buy_offer['type'] == 'redskull') {
                                            $my_acc_id = $buy_player->getCustomField('id');
                                            $playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$my_acc_id.';')->fetch();
                                            if($playerinfo['skull'] == '4' AND $playerinfo['online'] >= '0' AND $playerinfo['skulltime'] > '0') {
                                                $SQL->query('UPDATE killers SET unjustified=0 WHERE id IN (SELECT kill_id FROM player_killers WHERE player_id='. $my_acc_id .');');
                                                $SQL->query('UPDATE players SET skulltime=0, skull=0 WHERE id='. $my_acc_id .';');
                                                $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                                $user_premium_points = $user_premium_points - $buy_offer['points'];
                                                $main_content .= '<center><h2>RedSkull Removed!</h2><br><b>Your redskull has been removed from the player '.$buy_player->getName().'.</b>
                                                    <br>Now you have<b> '.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
                                            } else {
                                                $main_content .= '<center><b>'.$buy_player->getName().' has to be offline or have redskull to complete transaction!.</b><br><br><a href="index.php?subtopic=shopsystem">Go back</a><br>';
                                            }
                                        }
                                        //////////////////////////
                                        elseif($buy_offer['type'] == 'item') {
                                            $sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' (id, name, type, action, param1, param2, param3, param4, param5, param6, param7, delete_it) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', \'login\', \'give_item\', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', \'\', \'\', \'item\', '.$SQL->quote($buy_offer['name']).', \'\', \'1\');';
                                            $SQL->query($sql);
                                            $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' (id, to_name, to_account, from_nick, from_account, price, offer_id, trans_state, trans_start, trans_real) VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', \'wait\', '.$SQL->quote(time()).', \'0\');';
                                            $SQL->query($save_transaction);
                                            $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                            $user_premium_points = $user_premium_points - $buy_offer['points'];
                                            $main_content .= '<center><h2>Item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br>Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
                                        }
                                                                                if($buy_offer['type'] == 'vipdays') {
                                                                                        $player_vip_time = $buy_player_account->getCustomField('vip_time');
                                                                                        $player_lastlogin = $buy_player_account->getCustomField('lastday');
                                                                                        $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_pacc').' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['days']).', \'realized\', '.$SQL->quote(time()).', '.$SQL->quote(time()).');';
                                                                                        $SQL->query($save_transaction);
                                                                                        if($player_vip_time > 0)
                                                                                                 $buy_player_account->setCustomField('vip_time', $player_vip_time + $buy_offer['days'] * 86400);
                                                                                        else
                                                                                                 $buy_player_account->setCustomField('vip_time', time() + $buy_offer['days'] * 86400);
                                                                                        $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                                                                        $user_premium_points = $user_premium_points - $buy_offer['points'];
                                                                                        if ($player_vip_days >= 1) {
                                                                                        }
                                                                                        $main_content .= '<center><h2>VIP Days added!</h2><b>'.$buy_offer['days'].' days</b> of VIP days added to the account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
                                                                                        }  
                                        elseif($buy_offer['type'] == 'itemvip') {
                                            $sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' (id, name, type, action, param1, param2, param3, param4, param5, param6, param7, delete_it) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', \'login\', \'give_item\', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['megaitems_count']).', \'\', \'\', \'megaitems\', '.$SQL->quote($buy_offer['name']).', \'\', \'1\');';
                                            $SQL->query($sql);
                                            $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' (id, to_name, to_account, from_nick, from_account, price, offer_id, trans_state, trans_start, trans_real) VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', \'wait\', '.$SQL->quote(time()).', \'0\');';
                                            $SQL->query($save_transaction);
                                            $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                            $user_premium_points = $user_premium_points - $buy_offer['points'];
                                            $main_content .= '<center><h2>Mega Item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br>Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
                                        }
                                        elseif($buy_offer['type'] == 'container') {
                                            $sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' (id, name, type, action, param1, param2, param3, param4, param5, param6, param7, delete_it) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', \'login\', \'give_item\', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote($buy_offer['container_id']).', '.$SQL->quote($buy_offer['container_count']).', \'container\', '.$SQL->quote($buy_offer['name']).', \'\', \'1\');';
                                            $SQL->query($sql);
                                            $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' (id, to_name, to_account, from_nick, from_account, price, offer_id, trans_state, trans_start, trans_real) VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', \'wait\', '.$SQL->quote(time()).', \'0\');';
                                            $SQL->query($save_transaction);
                                            $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                            $user_premium_points = $user_premium_points - $buy_offer['points'];
                                            $main_content .= '<center><h2>Container of items added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
                                        }
                                    } else {
                                        if($buy_offer['type'] != 'changename') {
                                            $set_session = TRUE;
                                            $_SESSION['viewed_confirmation_page'] = 'yes';
                                            $main_content .= '<center><h2>Confirm transaction</h2>
                                                <table border="0" cellpadding="1" cellspacing="1" width="700">
                                                <tr bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>Confirm transaction</b></font></td></tr>
                                                <tr bgcolor="#D4C0A1"><td width="100"><b>Name:</b></td><td width="550" colspan="2">'.$buy_offer['name'].'</td></tr>
                                                <tr bgcolor="#F1E0C6"><td width="100"><b>Description:</b></td><td width="550" colspan="2">'.$buy_offer['description'].'</td></tr>
                                                <tr bgcolor="#D4C0A1"><td width="100"><b>Cost:</b></td><td width="550" colspan="2"><b>'.$buy_offer['points'].' premium points</b> from your account</td></tr>
                                                <tr bgcolor="#F1E0C6"><td width="100"><b>For Player:</b></td><td width="550" colspan="2"><font color="red">'.$buy_player->getName().'</font></td></tr>
                                                <tr bgcolor="#D4C0A1"><td width="100"><b>From:</b></td><td width="550" colspan="2"><font color="red">'.$buy_from.'</font></td></tr>
                                                <tr bgcolor="#F1E0C6"><td width="100"><b>Transaction?</b></td><td width="275" align="left">
                                                <form action="index.php?subtopic=shopsystem&action=confirm_transaction" method="POST"><input type="hidden" name="buy_confirmed" value="yes"><input type="hidden" name="buy_id" value="'.$buy_id.'"><input type="hidden" name="buy_from" value="'.urlencode($new_name).'"><input type="hidden" name="buy_name" value="'.urlencode($buy_name).'"><input type="submit" value="Accept"></form></td>
                                                <td align="right"><form action="index.php?subtopic=shopsystem" method="POST"><input type="submit" value="Cancel"></form></td></tr>
                                                </table>';
                                        } else {
                                            $set_session = TRUE;
                                            $_SESSION['viewed_confirmation_page'] = 'yes';
                                            $main_content .= '<center><h2>Confirm Name Changing</h2>
                                                <table border="0" cellpadding="1" cellspacing="1" width="700">
                                                <tr bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>Confirm transaction</b></font></td></tr>
                                                <tr bgcolor="#D4C0A1"><td width="130"><b>Name:</b></td><td width="550" colspan="2">'.$buy_offer['name'].'</td></tr>
                                                <tr bgcolor="#F1E0C6"><td width="130"><b>Description:</b></td><td width="550" colspan="2">'.$buy_offer['description'].'</td></tr>
                                                <tr bgcolor="#D4C0A1"><td width="130"><b>Cost:</b></td><td width="550" colspan="2"><b>'.$buy_offer['points'].' premium points</b> from your account</td></tr>
                                                <tr bgcolor="#F1E0C6"><td width="130"><b>Current Name:</b></td><td width="550" colspan="2"><font color="red">'.$buy_player->getName().'</font></td></tr>
                                                <tr bgcolor="#D4C0A1"><td width="130"><b>New Name:</b></td><td width="550" colspan="2"><font color="red">'.$buy_from.'</font></td></tr>
                                                <tr bgcolor="#F1E0C6"><td width="130"><b>Change Name?</b></td><td width="275" align="left">
                                                <form action="index.php?subtopic=shopsystem&action=confirm_transaction" method="POST"><input type="hidden" name="buy_confirmed" value="yes"><input type="hidden" name="buy_id" value="'.$buy_id.'"><input type="hidden" name="buy_from" value="'.urlencode($buy_from).'"><input type="hidden" name="buy_name" value="'.urlencode($buy_name).'"><input type="submit" value="Accept"></form></td>
                                                <td align="right"><form action="index.php?subtopic=shopsystem" method="POST"><input type="submit" value="Cancel"></form></td></tr>
                                                </table>';
                                        }
                                    }
                                } else {
                                    $main_content .= 'Player with name <b>'.$buy_name.'</b> doesn\'t exist. Please <a href="index.php?subtopic=shopsystem&action=select_player&buy_id='.$buy_id.'">select other name</a>.';
                                }
                            } else {
                                $main_content .= 'Invalid name format. Please <a href="index.php?subtopic=shopsystem&action=select_player&buy_id='.$buy_id.'">select other name</a> or contact with administrator.';
                            }
                        } else {
                            $main_content .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. You have only <b>'.$user_premium_points.'</b> premium points. Please <a href="index.php?subtopic=shopsystem">select other item</a> or buy premium points.';
                        }
                          } else {
                        $main_content .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="index.php?subtopic=shopsystem">select item</a> again.';
                    }
                }
            }
        }
        if(!$set_session) {
            unset($_SESSION['viewed_confirmation_page']);
        }
    }

    elseif($action == 'show_history') {
        if(!$logged) {
            $main_content .= 'Please login first.';
        } else{
            $items_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
            if(is_object($items_history_received)) {
                foreach($items_history_received as $item_received) {
                    if($account_logged->getId() == $item_received['to_account'])
                        $char_color = 'green';
                    else
                        $char_color = 'red';
                        $items_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$item_received['to_name'].'</font></td><td>';
                    if($account_logged->getId() == $item_received['from_account'])
                        $items_received_text .= '<i>Your account</i>';
                    else
                        $items_received_text .= $item_received['from_nick'];
                        $items_received_text .= '</td><td>'.$item_received['offer_id'].'</td><td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>';
                    if($item_received['trans_real'] > 0)
                        $items_received_text .= '<td>'.date("j F Y, H:i:s", $item_received['trans_real']).'</td>';
                    else
                        $items_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>';
                        $items_received_text .= '</tr>';
                }
            }
            $paccs_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_pacc').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
            if(is_object($paccs_history_received)) {
                foreach($paccs_history_received as $pacc_received) {
                    if($account_logged->getId() == $pacc_received['to_account'])
                        $char_color = 'green';
                    else
                        $char_color = 'red';
                        $paccs_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$pacc_received['to_name'].'</font></td><td>';
                    if($account_logged->getId() == $pacc_received['from_account'])
                        $paccs_received_text .= '<i>Your account</i>';
                    else
                        $paccs_received_text .= $pacc_received['from_nick'];
                        $paccs_received_text .= '</td><td>'.$pacc_received['pacc_days'].' days</td><td>'.$pacc_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $pacc_received['trans_real']).'</td></tr>';
                }
            }
            $main_content .= '<center><h1>Transactions History</h1></center>';
            if(!empty($items_received_text)) 
                $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b>&nbsp;Item Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Offer name</b></td><td><b>Bought on page</b></td><td><b>Received on '.$config['server']['serverName'].'</b></td></tr>'.$items_received_text.'</table><br />';
            if(!empty($paccs_received_text))
                $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b>&nbsp;Pacc Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Duration</b></td><td><b>Cost</b></td><td><b>Added:</b></td></tr>'.$paccs_received_text.'</table><br />';
            if(empty($paccs_received_text) && empty($items_received_text))
                $main_content .= 'You did not buy/receive any items or PACC.';
        }
    }
    if(!$logged)
        $main_content .= 'Please login to see how much points you have.';
    else
        $main_content .= '<br><b><font color="green">You have premium points: </font></b>'.$user_premium_points;
    }
else
    $main_content .= '<br><center><b>Shop System is currently disabled for this server.Please ask the admin for more information.</b></center>';
?>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

confirmacao.php

<?PHP 
$main_content .= '  <form name="form1" method="post" action="donate/gravar.php"> 
</SCRIPT> 
<FIELDSET id=fieldcontato><LEGEND><STRONG>Formulario</STRONG> </LEGEND> 
<FORM id=form1 method=post name=form1> 
<TABLE border=0 cellSpacing=3 cellPadding=3 width=500> 
<TBODY> 
<TR> 
<TD width="29%"><STRONG>Pago via</STRONG></TD> 
<TD width="71%"><LABEL><SELECT id=assunto name=assunto> <OPTION selected>Pagseguro (Boleto, Cartao de Credito e etc)</OPTION> <OPTION>Santander</OPTION></SELECT> </LABEL></TD></TR> 
<TR></TD> 
<TD height=20 vAlign=center colSpan=2> 
<HR color=#c0c0c0 noShade> 
</TD></TR> 
<TR> 
<TD><STRONG>Nome</STRONG></TD> 
<TD><SPAN id=nome><LABEL><INPUT id=nome maxLength=40 size=25 name=nome> </LABEL><SPAN class=textfieldRequiredMsg><FONT size=1>Digite seu nome completo.</FONT></SPAN></SPAN></TD></TR> 
<TR></TD> 
<TD height=20 vAlign=center colSpan=2> 
<HR color=#c0c0c0 noShade> 
</TD></TR> 
<TR> 
<TD><STRONG>Email da sua Account</STRONG></TD> 
<TD><SPAN id=email><LABEL><INPUT id=email size=25 name=email> </LABEL><SPAN class=textfieldRequiredMsg><FONT size=1>Digite o email da sua conta.</FONT></SPAN><SPAN class=textfieldInvalidFormatMsg></SPAN></SPAN></TD></TR> 
<TR></TD> 
<TD height=20 vAlign=center colSpan=2> 
<HR color=#c0c0c0 noShade> 
</TD></TR> 
<TR> 
<TD><STRONG>Sua Account</STRONG></TD> 
<TD><SPAN id=conta><LABEL><INPUT id=account maxLength=25 size=25 name=account> </LABEL><SPAN class=textfieldRequiredMsg><FONT size=1>Digite sua conta.</FONT></SPAN><SPAN class=textfieldInvalidFormatMsg></SPAN></SPAN></TD></TR> 
<TR></TD> 
<TD height=20 vAlign=center colSpan=2> 
<HR color=#c0c0c0 noShade> 
</TD></TR> 
<TR> 
<TD><STRONG>Personagem</STRONG></TD> 
<TD><SPAN id=personagem><LABEL><INPUT id=personagem size=25 name=personagem> </LABEL><SPAN class=textfieldRequiredMsg><FONT size=1>Digite seu personagem.</FONT></SPAN></SPAN></TD></TR> 
<TR></TD> 
<TD height=20 vAlign=center colSpan=2> 
<HR color=#c0c0c0 noShade> 
</TD></TR> 
<TR></TR> 
<TR> 
<TD><STRONG>Valor da doacao</STRONG></TD> 
<TD><SPAN id=valor><LABEL><INPUT id=valor maxLength=5 size=25 name=valor> <SPAN class=textfieldRequiredMsg><FONT size=1>Exemplo: 12,50</FONT></SPAN></SPAN></LABEL></TD></TR> 
<TR></TD> 
<TD height=20 vAlign=center colSpan=2> 
<HR color=#c0c0c0 noShade> 
</TD></LABEL></TR> 
<TR> 
<TD><STRONG>Data do deposito</STRONG></TD> 
<TD><SPAN id=data><LABEL><INPUT id=data maxLength=10 size=25 name=data> </LABEL><SPAN class=textfieldRequiredMsg><FONT size=1>Exemplo: 15/07/2009</FONT></SPAN><SPAN class=textfieldInvalidFormatMsg></SPAN></SPAN></TD></TR> 
<TR></TD> 
<TD height=20 vAlign=center colSpan=2> 
<HR color=#c0c0c0 noShade> 
</TD></TR> 
<TR> 
<TD><STRONG>Hora do deposito</STRONG></TD> 
<TD><SPAN id=hora><LABEL><INPUT id=hora maxLength=5 size=25 name=hora> </LABEL><SPAN class=textfieldRequiredMsg><FONT size=1>Exemplo: 14:20</FONT></SPAN><SPAN class=textfieldInvalidFormatMsg></SPAN></SPAN></TD></TR> 
<TR></TD> 
<TD height=20 vAlign=center colSpan=2> 
<HR color=#c0c0c0 noShade> 
</TD></TR> 
<TR> 
<TR> 
<TD><STRONG>Codigo PagSeguro</STRONG></TD> 
<TD><SPAN id=Codigo><LABEL><INPUT id=hora maxLength=44 size=25 name=hora> </LABEL><SPAN class=textfieldRequiredMsg><FONT size=1>Exemplo: 8FE9B3BC-6BB3-495E-9EE5-2835FF8729FF</FONT></SPAN><SPAN class=textfieldInvalidFormatMsg></SPAN></SPAN></TD></TR> 
<TR></TD> 
<TD height=20 vAlign=center colSpan=2> 
<HR color=#c0c0c0 noShade> 
</TD></TR> 
<TR> 
<TD><STRONG>Imagem do comprovante</STRONG><BR><FONT color=red>(Apenas por Deposito)</FONT></TD> 
<TD><LABEL><INPUT id=imagem size=25 name=imagem> <BR> 
<H5>Hospede a foto do seu comprovante no <A href="http://www.imageshack.us" target=_blank>ImageShack</A></H5></LABEL></TD></TR> 
<TR></TD> 
<TD height=20 vAlign=center colSpan=2> 
<HR color=#c0c0c0 noShade> 
</TD></TR> 
<TR> 
<TD>&nbsp;</TD></TR></TBODY></TABLE> 
<P><INPUT value=Enviar type=submit name=enviar> <INPUT value=Limpar type=reset name=limpar></P></FORM></FIELDSET><BR> 
<H3>Duvidas.</H3><FONT color=red>Apos efetuar o pagamento entre no site e clica Confirmar pagamento e coloca os dado do comprovante i espere ate seus points ser liberados<br>Prazo maximo de liberacao e de 4 Horas apos a confirmacao do pagamento ou mande um email para [email protected] (mande o nome do char o comprovante etc tudo que tem que mandar)<br>Por email a liberacao e mais rapida.<BR></FONT> 

<script type=text/javascript> 
<!-- 
var sprytextfield1 = new Spry.Widget.ValidationTextField("nome", "none", {validateOn:["blur", "change"]}); 
var sprytextfield2 = new Spry.Widget.ValidationTextField("email", "email", {validateOn:["blur", "change"]}); 
var sprytextarea1 = new Spry.Widget.ValidationTextarea("dados", {validateOn:["blur", "change"]}); 
var sprytextfield3 = new Spry.Widget.ValidationTextField("conta", "integer", {validateOn:["blur", "change"]}); 
var sprytextfield4 = new Spry.Widget.ValidationTextField("personagem", "none", {validateOn:["blur", "change"]}); 
var sprytextfield5 = new Spry.Widget.ValidationTextField("data", "date", {format:"dd/mm/yyyy", validateOn:["blur"]}); 
var sprytextfield6 = new Spry.Widget.ValidationTextField("valor", "integer", {validateOn:["blur", "change"]}); 
var sprytextfield7 = new Spry.Widget.ValidationTextField("hora", "time", {validateOn:["blur", "change"]}); 
//--> 
  </SCRIPT> 
<BR><BR></TD></TABLE> 
<CENTER></CENTER></TD></TABLE></DIV> '; 
?>

Link para o post
Compartilhar em outros sites

@Emanueldk

 

clica em editar sua resposta e poem esse codigo ai dentro do "OLHINHO" "SPOILER" pra não ficar tão grande a aba, deixa te perguntar esse erro ai aparece no site junto com todas imagens mesmo ou fica uma tela branca com o erro sem aparecer nada do site?

       112674.gif

 

 

 

Link para o post
Compartilhar em outros sites
1 minuto atrás, Emanueldk disse:

@Zzyzx aparece o site normal eu posso mexer nele normal mais esses erro ficam do lado, e em cima

 

vai no seu gesior index.php

ctrl + f

error_reporting

 

Vai estar assim eu acho

error_reporting(-1);

 

deixa ele assim

error_reporting(0);

       112674.gif

 

 

 

Link para o post
Compartilhar em outros sites
Spoiler

<?PHP
date_default_timezone_set('Europe/Berlin');
session_start();
ob_start("ob_gzhandler");
//require('./exaBD.php');
function microtime_float() {
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();

//##### CONFIG #####
include('config-and-functions.php');
$action = $_REQUEST['action'];

//##### LOGOUT #####
if($action == "logout") {
    unset($_SESSION['account']);
    unset($_SESSION['password']);
}

//##### LOGIN #####
$logged = FALSE;
if(isset($_SESSION['account'])) {
    $account_logged = $ots->createObject('Account');
    $account_logged->load($_SESSION['account']);
    if($account_logged->isLoaded() && $account_logged->getPassword() == $_SESSION['password']) {
        $logged = TRUE;
        $group_id_of_acc_logged = $account_logged->getPageAccess();
    } else {
        $logged = FALSE;
        unset($_SESSION['account']);
        unset($account_logged);
    }
}
$login_account = strtoupper(trim($_POST['account_login']));
$login_password = trim($_POST['password_login']);
if(!$logged && !empty($login_account) && !empty($login_password)) {
    $login_password = password_ency($login_password);
    $account_logged = $ots->createObject('Account');
    $account_logged->find($login_account);
    if($account_logged->isLoaded()) {
        if($login_password == $account_logged->getPassword()) {
            $_SESSION['account'] = $account_logged->getId();
            $_SESSION['password'] = $login_password;
            $logged = TRUE;
            $account_logged->setCustomField("page_lastday", time());
            $group_id_of_acc_logged = $account_logged->getPageAccess();
        } else
            $logged = FALSE;
    }
}

//#### LOAD PAGE ##########
if(empty($_REQUEST['subtopic'])) {
    $_REQUEST['subtopic'] = "latestnews";
    $subtopic = "latestnews";
}
switch($_REQUEST['subtopic']) {

        case "latestnews":
                $topic = "Ultimas Noticias";
                $subtopic = "latestnews";
                include("latestnews.php");
        break;
        
        case "live";
            $subtopic = "live";
            $topic = "Cast ON";
            include("live.php");
        break;
        
    case "foot";
            $topic = "Football Tops";
           $subtopic = "foot";
           include("foot.php");
        break;

    case "promotions":
                $topic = "Promo&ccedil;&otilde;es";
                $subtopic = "promotions";
                include("promotions.php");
        break;
        
        case "calendario":
                $topic = "Calend&aacute;rio";
                $subtopic = "calendario";
                include("calendario.php");
        break;
        
        case "dota":
                $topic = "Dota";
                $subtopic = "dota";
                include("dota.php");
        break;
        
        case "coliseum":
                $topic = "Coliseum";
                $subtopic = "coliseum";
                include("coliseum.php");
        break;
        
                case "mount":
                $topic = "Mount";
                $subtopic = "mount";
                include("mount.php");
        break;
        
                        case "cassino":
                $topic = "Cassino";
                $subtopic = "cassino";
                include("cassino.php");
        break;
        
                                case "forj":
                $topic = "Forjamento";
                $subtopic = "forj";
                include("forj.php");
        break;

    

    case "suport":
                $topic = "Suport Online";
                $subtopic = "suportonline";
                include("suport.php");
        break;

    case "boss":
                $topic = "Bosses";
                $subtopic = "boss";
                include("boss.php");
        break;

    case "present":
                $topic = "Present Diary";
                $subtopic = "present";
                include("present.php");
        break;
        
        case "tunneltuto":
                $topic = "Tibia Tunnel Tutorial";
                $subtopic = "tunneltuto";
                include("tunneltuto.php");
        break;
        
        case "tunnel":
                $topic = "Falconia Tibia Tunnel";
                $subtopic = "tunnel";
                include("tunnel.php");
        break;
        
        case "task":
                $topic = "Task Quest";
                $subtopic = "task";
                include("task.php");
        break;

    

    case "powergamers";
                $topic = "Powergamers";
                $subtopic = "powergamers";
                include("powergamers.php");
        break;

    case "onlinetime";
            $topic = "Onlinetime";
            $subtopic = "onlinetime";
            include("onlinetime.php");
        break;

    case "domain":
                $topic = "domain";
                $subtopic = "domain";
                include("domain.php");
        break;

        case "vip":
                $topic = "VIP";
                $subtopic = "vip";
                include("vip.php");
        break; 

    case "chat";
            $topic = "chat";
            $subtopic = "chat";
            include("chat.php");
        break; 

    case "exphist";
            $subtopic = "exphist";
            $topic = "Powergamers";
            include("exphist.php");
        break;  

    case "featured":
                $topic = "Featured Article";
                $subtopic = "article";
                include("featured.php");
        break;

    case "viplist";
                $subtopic = "viplist";
                $topic = "Jogadores Vip";
                include("viplist.php");
        break;

    case "home";
                $subtopic = "home";
                $topic = "home";
                include("home.php");
        break;

        case "addons":
                $topic = "Addons";
                $subtopic = "addons";
                include("addons.php");
        break;

    
    case "detalhe";
                $topic = "Detalhes";
                $subtopic = "detalhe";
                include("detalhe.php");
        break;
        

        case "buypoints":
                $topic = "Comprar Pontos";
                $subtopic = "buypoints";
                include("buypoints.php");
        break;

        case "tradeoff";
                $topic = "Trade Off";
                $subtopic = "tradeoff";
                include("tradeoff.php");
        break;

        case "lottery";
            $subtopic = "lottery";
            $topic = "Lottery";
            include("lottery.php");
        break;

        case "wars":
                $topic = "Guild Wars";
                $subtopic = "wars";
                include("wars.php");
        break;
       
        case "creatures";
                $topic = "Monstros";
                $subtopic = "creatures";
                include("creatures.php");
        break;

        case "about";
                $topic = "Sobre o Server";
                $subtopic = "about";
                include("about.php");
        break;
       
        case "spells";
                $topic = "Magias";
                $subtopic = "spells";
                include("spells.php");
        break;
       
     case "bugtracker";
              $topic = "Bug Tracker";
             $subtopic = "bugtracker";
             include("bug.php");
    break;  

        case "experiencetable";
                $topic = "Tabela de Experiência";
                $subtopic = "experiencetable";
                include("experiencetable.php");
        break;
       
        case "characters";
                $topic = "Players";
                $subtopic = "characters";
                include("characters.php");
        break;
       
        case "whoisonline";
                $topic = "Players Online";
                $subtopic = "whoisonline";
                include("whoisonline.php");
        break;
       
        case "highscores";
                $topic = "Ranking";
                $subtopic = "highscores";
                include("highscores.php");
        break;
       
        case "killstatistics";
                $topic = "Últimas Mortes";
                $subtopic = "killstatistics";
                include("killstatistics.php");
        break;
       
        case "guilds";
                $topic = "Guilds";
                $subtopic = "guilds";
                include("guilds.php");
        break;
       
        case "accountmanagement";
                $topic = "Editar Conta";
                $subtopic = "accountmanagement";
                include("accountmanagement.php");
        break;
       
        case "createaccount";
                $topic = "Criar Conta";
                $subtopic = "createaccount";
                include("createaccount.php");
        break;
       
        case "lostaccount";
                $topic = "Perdeu sua conta?";
                $subtopic = "lostaccount";
                include("lostaccount.php");
        break;

        case "tibiarules";
                $topic = "Regras do Server";
                $subtopic = "tibiarules";
                include("tibiarules.php");
        break;

        case "adminpanel":
                $topic = "Painel do Admin";
                $subtopic = "adminpanel";
                include("adminpanel.php");
        break;

    case "admin";
           $subtopic = "admin";
           $topic = "Advanced Admin Panel";
           include("adminpro.php");
      break;  

        case "confirmacao":
                $topic = "Confirmação";
                $subtopic = "confirmacao";
                include("confirmacao.php");
        break;

        case "vantagens":
                $topic = "Vantagens";
                $subtopic = "vantagens";
                include("vantagens.php");
        break;
       
        case "forum":
                $topic = "Forum";
                $subtopic = "forum";
                include("forum.php");
        break;
       
        case "team";
                $subtopic = "Membros da Staff";
                $topic = "Support List";
                include("team.php");
        break;

        case "downloads";
                $subtopic = "Downloads";
                $topic = "Downloads";
                include("downloads.php");
        break;

        case "serverinfo";
                $subtopic = "Info do Server";
                $topic = "Server Info";
                include("serverinfo.php");
        break;

        case "shopsystem";
                $subtopic = "Loja do Server";
                $topic = "Shop Offerts";
                include("shopsystem.php");
        break;
       
        case "doacao";
                $subtopic = "doação";
                $topic = "Doacao";
                include("doacao.php");
        break;

        case "gallery";
                $subtopic = "gallery";
                $topic = "Gallery";
                include("gallery.php");
        break;
       
        case "namelock";
                $subtopic = "namelock";
                $topic = "Namelock Manager";
                include("namelocks.php");
        break;
       
        case "archive";
                $subtopic = "archive";
                $topic = "News Archives";
                include("archive.php");
        break;
       
        case "mail";
                $subtopic = "mail";
                $topic = "Mass emails sender";
                include("mail.php");
        break;

    case "shopadmin";
        $subtopic = "Loja do Admin";
        $topic = "Shop Admin";
        include("shopadmin.php");
    break;

    case "records";
        $subtopic = "Record de Players ON";
        $topic = "Players Online Records";
        include("records.php");
    break;

    case "restarter";
        $subtopic = "restarter";
        $topic = "Restarter";
        include("restarter.php");
    break;
     
    case "bans";
        $subtopic = "Banidos";
        $topic = "Ban List";
        include("bans.php");
    break;

      case "polls";
        $topic = "Enquetes";
        $subtopic = "polls";
        include("polls.php");
    break;     

    case "changelog";
            $topic = "Changelog";
           $subtopic = "changelog";
           include("changelog.php");
    break; 
    
    case "fragers";
            $topic = "Top Fragers";
           $subtopic = "fragers";
           include("fragers.php");
    break;

        case "topguild";
                 $topic = "Top Guild";
                 $subtopic = "Top Guilds";
                 include("topguilds.php");
        break;
        
        case "cast";
                 $topic = "Cast ON";
                 $subtopic = "Cast ON";
                 include("live.php");
        break;

}

if(empty($topic)) {
    $title = $GLOBALS['config']['server']["serverName"]." - OTS";
    $main_content .= 'Invalid subtopic. Can\'t load page.';
} else {
    $title = $GLOBALS['config']['server']["serverName"]." - ".$topic;
}

//#####LAYOUT#####
$layout_header = '<script type=\'text/javascript\'>
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function MouseOverBigButton(source)
{
  source.firstChild.style.visibility = "visible";
}
function MouseOutBigButton(source)
{
  source.firstChild.style.visibility = "hidden";
}
function BigButtonAction(path)
{
  window.location = path;
}
var';
if($logged) { $layout_header .= "loginStatus=1; loginStatus='true';"; } else { $layout_header .= "loginStatus=0; loginStatus='false';"; };
$layout_header .= " var activeSubmenuItem='".$subtopic."';</script>";
include($layout_name."/layout.php");
ob_end_flush();
?>

 



 

Editado por Emanueldk (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

@Zzyzx ae man, vlw mermo salvo muito, mais voce sabe como compilar uma distro para rodar em mysql? tipo quando eu abro meu servidor sqlite em mysql a distro fecha sem mostrar nenhum erro nela eae quando eu pego uma distro de um servidor mysql que roda com site a distro pega mais vem bastente erro por causa dos scripts da distro que sao diferentes

Link para o post
Compartilhar em outros sites
9 horas atrás, Emanueldk disse:

@Zzyzx ae man, vlw mermo salvo muito, mais voce sabe como compilar uma distro para rodar em mysql? tipo quando eu abro meu servidor sqlite em mysql a distro fecha sem mostrar nenhum erro nela eae quando eu pego uma distro de um servidor mysql que roda com site a distro pega mais vem bastente erro por causa dos scripts da distro que sao diferentes

se te ajudei deixa aquele REP+

olha nesse topico aqui, o cara ta ensinando a compilar de sql pra mysql

https://tibiaking.com/forums/topic/90056-ajuda-colocando-servidor-em-mysql/?tab=comments#comment-494189

       112674.gif

 

 

 

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Andersontatuador
      .Qual servidor ou website você utiliza como base? 
      Global Full 8.60 + Zao
      Qual o motivo deste tópico? 
      O site não esta adicionando os pontos na conta dos plays.
       
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       



    • Por A.Mokk
      .Qual servidor ou website você utiliza como base? 
      TFS 0.4
      Qual o motivo deste tópico? 
      Estou tendo um probleminha indelicado no meu site, gostaria de obter respostas aqui com voces que sao sempre muito eficientes e praticos.
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
       
    • Por thunmin
      .Qual servidor ou website você utiliza como base? 
      Canary
      Qual o motivo deste tópico? 
      Não consigo deixar ele automatico os players tem que confirmar o pagamento depois eu tenho que verificar se caiu pra depois eu confirmar e colocar as coins
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
    • Por Jordan422
      Faala Deuses do Tibia! Estou com um projeto sólido de um global old, mas to preso nessa parte do website viu.. Eu dou meu jeitinho mas ta chegando nas coisas avançadas que precisa daquele freelancer bacana para ajeitar umas páginas para mim! Já tenho as ideias, basta somente botar a mão na massa.. Quem estiver interessado por favor entrar em contato por mensagem aqui no Tibiaking mesmo ou preferencialmente pelo discord mythh9257 
       
    • Por moleza
      Para quem quer abrir um servidor antigo que roda em php5 e está com dificuldade com a configuração do linux, pode contratar um cpanel que contenha o php5 que facilita a configuração do site!!
       
      essa foi a minha solução!
       
      Resolvido !!
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo