Ir para conteúdo

MyTrill

Campones
  • Total de itens

    33
  • Registro em

  • Última visita

Posts postados por MyTrill

  1. Executa isso aqui no mysql:

     

    SELECT * , SUBSTRING( CONVERT( attributes
    USING latin1 )
    FROM 18 ) AS 'serial'
    FROM player_items
    WHERE CONVERT( attributes
    

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 30' at line 6

     

    Venho aqui avisar que já solucionei, pedir obrigado a todos que tentaram me ajudar.

     

    O problema todo era no sistema de anti-clone/libs e Globaladvents.

    Removi estes sistemas e estou testando outro..

  2. O ot já conseguir por online havia sobrecarregado o banco de dados e como eu usava VPS não dava pra fazer muita coisa, passei para um dedicado e conseguir por online normalmente, mais ainda dá este erro no ServerLog

     

     

     

    mysql_real_query(): SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM player_items WHERE SUBSTRING(CONVERT(attributes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin1) FR OM 18) FROM player_items WHERE CONVERT(attributes USING latin1) LIKE '%serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING COUNT(*) > 1 ) - MYSQL ERROR: Lost connection to MySQL server during query (2013)

    [!] -> Cannot get info, table is empty, there are not items with duplicated seri al or you have a problem on the query syntax: player_items.

    [22:46:17.709] > WARNING: MYSQL Lost connection, attempting to reconnect...

    [22:46:27.709] mysql_real_query(): SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM player_depotitems WHERE SUBSTRING(CONVERT(attri butes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin 1) FROM 18) FROM player_depotitems WHERE CONVERT(attributes USING latin1) LIKE ' %serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING CO UNT(*) > 1) - MYSQL ERROR: Lost connection to MySQL server during query (2013)

    [!] -> Cannot get info, table is empty, there are not items with duplicated seri al or you have a problem on the query syntax: player_depotitems.

    [22:46:27.709] > WARNING: MYSQL Lost connection, attempting to reconnect...

     

     

  3. Está ae

     

     

     

    tablesToCheck = {"player_items", "player_depotitems"}

     

    function onStartup()

    local text, final = "", ""

    local filex = "data/logs/duplicated.txt"

    local f = io.open(filex, "a+")

    for i = 1, table.maxn(tablesToCheck) do

    local query = db.getResult("SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM " .. tablesToCheck .. " WHERE SUBSTRING(CONVERT(attributes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin1) FROM 18) FROM " .. tablesToCheck .. " WHERE CONVERT(attributes USING latin1) LIKE '%serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING COUNT(*) > 1)")

    local duplicated = {}

    if query:getID() ~= -1 then

    while(true) do

    text = "[!] -> Deleting item with duplicated serial: [Player: " .. getPlayerNameByGUID(query:getDataInt("player_id")) .. ", Item: " .. query:getDataInt("itemtype") .. ", Count: " .. query:getDataInt("count") .. ", Serial: " .. query:getDataString("track") .."]... "

    local delete = db.executeQuery("delete from " .. tablesToCheck .. " where SUBSTRING(CONVERT(attributes USING latin1) FROM 18) = " .. db.escapeString(query:getDataString("track")) .. ";")

    if delete then

    text = text .. "Success!"

    else

    text = text .. "Failed!"

    end

    final = final .. (final ~= "" and "\n" or "") .. text

    print(text)

    if not query:next() then break end

    end

    if f ~= nil then

    f:write(os.date() .. "\n" .. final .. "\n\n")

    f:close()

    else

    print("[!] -> Cannot save info to file!")

    end

    else

    print("[!] -> Cannot get info, table is empty, there are not items with duplicated serial or you have a problem on the query syntax: " .. tablesToCheck .. ".")

    end

    end

    return true

    end

     

     

  4. Não é bem isso, o site do meu ot não abre, o PHPMYADMIN não abre, webadmin não abre..

     

    Executei o Mysqlthunder.pl e deu isso, mais não sei como resolver.

     

     

     

    -------- Storage Engine Statistics -------------------------------------------

    [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster

    [--] Data in MyISAM tables: 34K (Tables: 14)

    [--] Data in InnoDB tables: 9M (Tables: 36)

    [!!] Total fragmented tables: 36

     

     

  5. Não sei se estar na area correta, se não tiver movam plx.

     

    Meu servidor já tem 1 mês online e nunca deu nenhum problema. Hoje estava funcionando em perfeito estado depois ficou off de uma hora pra outra e o site tabém, quando fui olhar no SSH tava dando este erro.

     

    Me ajudem por favor.

     

    Imagem

     

     

    [23:32:28.999] > Loading time: 63.572 seconds.

    [23:32:36.811] [Error - LuaInterface::loadFile] cannot open data/npc/scripts/Seymour.lua: No such file or directory

    [23:32:36.811] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/Seymour.lua

    [23:32:36.811] cannot open data/npc/scripts/Seymour.lua: No such file or directory

    [23:32:36.827] [Error - LuaInterface::loadFile] cannot open data/npc/scripts/Tom.lua: No such file or directory

    [23:32:36.827] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/Tom.lua

    [23:32:36.827] cannot open data/npc/scripts/Tom.lua: No such file or directory

    [23:32:39.090] [Warning - Houses::loadFromXml] House entry not set for: Thais # Custom House # (2385)

    [23:32:39.091] > Parsing time: 10.092 seconds.

    [23:33:03.322] > Synchronization time: 24.23 seconds.

    [23:33:03.830] > Unserialization time: 0.508 seconds.

    [23:33:04.032] >> Checking world type... Open PvP

    [23:33:04.032] >> Starting to dominate the world... done.

    [23:33:04.032] >> Initializing game state and binding services...

    [23:33:35.056] mysql_real_query(): SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM player_items WHERE SUBSTRING(CONVERT(attributes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin1) FROM 18) FROM player_items WHERE CONVERT(attributes USING latin1) LIKE '%serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING COUNT(*) > 1) - MYSQL ERROR: Lost connection to MySQL server during query (2013)

    [23:33:35.056] > WARNING: MYSQL Lost connection, attempting to reconnect...

    [23:34:06.507] mysql_real_query(): SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM player_depotitems WHERE SUBSTRING(CONVERT(attributes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin1) FROM 18) FROM player_depotitems WHERE CONVERT(attributes USING latin1) LIKE '%serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING COUNT(*) > 1) - MYSQL ERROR: Lost connection to MySQL server during query (2013)

    [23:34:06.579] > WARNING: MYSQL Lost connection, attempting to reconnect...

    [23:34:36.637] mysql_real_query(): SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM player_items WHERE SUBSTRING(CONVERT(attributes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin1) FROM 18) FROM player_depotitems WHERE CONVERT(attributes USING latin1) LIKE '%serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING COUNT(*) > 0) - MYSQL ERROR: Lost connection to MySQL server during query (2013)

    [23:34:36.649] > WARNING: MYSQL Lost connection, attempting to reconnect...

    [23:35:06.866] mysql_real_query(): SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM player_items WHERE SUBSTRING(CONVERT(attributes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin1) FROM 18) FROM tile_items WHERE CONVERT(attributes USING latin1) LIKE '%serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING COUNT(*) > 0) - MYSQL ERROR: Lost connection to MySQL server during query (2013)

    [23:35:06.866] > WARNING: MYSQL Lost connection, attempting to reconnect...

    [23:35:37.326] mysql_real_query(): SELECT *, SUBSTRING(CONVERT(attributes USING latin1) FROM 18) AS 'track' FROM player_depotitems WHERE SUBSTRING(CONVERT(attributes USING latin1) FROM 18) IN (SELECT SUBSTRING(CONVERT(attributes USING latin1) FROM 18) FROM tile_items WHERE CONVERT(attributes USING latin1) LIKE '%serial%' GROUP BY SUBSTRING(CONVERT(attributes USING latin1) FROM 18) HAVING COUNT(*) > 0) - MYSQL ERROR: Lost connection to MySQL server during query (2013)

    [23:35:37.TMI] >> Item Tracker: 0 duplicated items have been deleted...

    [23:35:37.510] > WARNING: MYSQL Lost connection, attempting to reconnect...

     

     

     

  6. VictorWebMaster

     

    Tem como configurar o Featured Article em meu latestnews?

     

     

    <?PHP
    date_default_timezone_set('America/Sao_Paulo');
    //######################## SHOW TICKERS AND NEWS #######################
    if ($logged){
    $players_from_account = $SQL->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
    foreach($players_from_account as $player)
    {
    	$str .= '<option value="'.$player['id'].'"';
    		if($player['id'] == $char_id)
    		$strt .= ' selected="selected"';
    		$str .= '>'.$player['name'].'</option>';
    }
    }
    $time = time();
    $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="headline.php?text=News ticker" alt="Contentbox headline">
    <div class="Border_2">
    <div class="Border_3">
    <div class="BoxContent" style="background-image: url('.$layout_name.'/images/content/scroll.gif);">';
    //##################### 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)) {
    $news_content .= 'You can\'t add empty ticker.';
    }
    else
    {
    if(empty($ticker_icon)) {
    $news_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)');
    $news_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">';
    $news_content .= '<a href="index.php?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
    $news_content .= short_text($ticker_text, 60).'
    </div>
    <div id="TickerEntry-1-FullText" class="NewsTickerFullText">';
    $news_content .= '<a href="index.php?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
    $news_content .= $ticker_text.'
    </div>
    </div>
    </div>
    </div>
    </div><hr/>';
    }
    }
    else
    {
    $news_content .= 'You don\'t have admin rights. You can\'t add new ticker.';
    }
    $news_content .= '<form action="index.php?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.';');
    $news_content .= '<center>News tickets with <b>date '.date("j M Y", $date).'</b> has been deleted.<form action="index.php?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
    {
    $news_content .= '<center>You don\'t have admin rights. You can\'t delete tickers.<form action="index.php?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>';
    }
    }
    //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="index.php?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="index.php?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
    if($group_id_of_acc_logged >= $config['site']['access_admin_panel'] && $action!=newticker)
    $news_content .= '<script type="text/javascript">
    var showednewticker_state = "0";
    function showNewTickerForm()
    {
    if(showednewticker_state == "0") {
    document.getElementById("newtickerform").innerHTML = \'<form action="index.php?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="'.$layout_name.'/images/news/icon_0.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_1.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_2.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_3.gif" width="20"></td><td><img src="'.$layout_name.'/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>';
    //end of tickers, news part
    //adding news
    if($action == "newnews") {
    if($group_id_of_acc_logged >= $config['site']['access_news']) {
    $text = ($_REQUEST['text']);
    $char_id = (int) $_REQUEST['char_id'];
    $post_topic = stripslashes(trim($_REQUEST['topic']));
    $smile = (int) $_REQUEST['smile'];
    $news_icon = (int) $_REQUEST['icon_id'];
    if(empty($news_icon)) {
    $news_icon = 0;
    }
    if(empty($post_topic)) {
    $an_errors[] .= 'You can\'t add news without topic.';
    }
    if(empty($text)) {
    $an_errors[] .= 'You can\'t add empty news.';
    }
    if(empty($char_id)) {
    $an_errors[] .= 'Select character.';
    }
    //execute query
    if(empty($an_errors)) {
    $SQL->query("INSERT INTO `z_forum` (`id` ,`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`, `icon_id`) VALUES ('NULL', '0', '".time()."', '1', '0', '0', '".$account_logged->getId()."', '".(int) $char_id."', ".$SQL->quote($text).", ".$SQL->quote($post_topic).", '".(int) $smile."', '".time()."', '0', '0', '".$_SERVER['REMOTE_ADDR']."', '".$news_icon."')");
    $thread_id = $SQL->lastInsertId();
    $SQL->query("UPDATE `z_forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);//show added data
    $main_content .= '<form action="index.php?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>';
    }
    else
    {
    //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($an_errors as $an_error) {
    $main_content .= '<li>'.$an_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/>';
    //okno edycji newsa z wpisanymi danymi przeslanymi wczesniej
    $main_content .= '<form action="index.php?subtopic=latestnews&action=newnews" 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="'.$layout_name.'/images/news/icon_0.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_1.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_2.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_3.gif" width="20"></td><td><img src="'.$layout_name.'/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="F1E0C6"><b>Topic:</b></td><td><input type="text" name="topic" maxlenght="50" style="width: 300px" value="'.$post_topic.'"></td></tr><tr><td align="center" bgcolor="D4C0A1"><b>News<br>text:</b></td><td bgcolor="F1E0C6"><textarea name="text" rows="6" cols="60">'.$text.'</textarea></td></tr><tr><td width="180"><b>Character:</b></td><td><select name="char_id"><option value="0">(Choose character)</option>'.$str.'</select></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="CancelAddNews" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="location.href=\'index.php?subtopic=latestnews\';" alt="CancelAddNews" /></div></div></td></tr></table>';
    }
    }
    else
    {
    $main_content .= 'You don\'t have site-admin rights. You can\'t add news.';}
    }
    //####################Show script with new news panel############################								
    if($group_id_of_acc_logged >= $config['site']['access_news'] && $action != 'newnews')
    {
    
    $main_content .= '
    <font style="font-size: 16px; font-weight: bold; margin-left: 20px;">New News</font>
    <form action="index.php?subtopic=latestnews&action=newnews" method="post" >
    <table border="0">
    <tr>
    <td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td>
    <td>
    <table border="0">
    <tr bgcolor="F1E0C6">
    <td><img src="'.$layout_name.'/images/news/icon_0.gif" width="20"></td>
    <td><img src="'.$layout_name.'/images/news/icon_1.gif" width="20"></td>
    <td><img src="'.$layout_name.'/images/news/icon_2.gif" width="20"></td>
    <td><img src="'.$layout_name.'/images/news/icon_3.gif" width="20"></td>
    <td><img src="'.$layout_name.'/images/news/icon_4.gif" width="20"></td>
    </tr>
    <tr bgcolor="D4C0A1">
    <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="F1E0C6"><b>Topic:</b></td>
    <td><input type="text" name="topic" maxlenght="50" style="width: 300px" ></td>
    </tr>
    <tr>
    <td align="center" bgcolor="D4C0A1"><b>News<br>text:</b></td>
    <td bgcolor="F1E0C6"><textarea name="text" rows="6" cols="60"></textarea></td>
    </tr>
    <tr>
    <td width="180"><b>Character:</b></td>
    <td><select name="char_id"><option value="0">(Choose character)</option>'.$str.'</select></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></td></tr>
    </table>
    <hr/>';
    $zapytanie = $SQL->query("SELECT `z_forum`.`icon_id`,`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();
    }
    ///show news
    $announcements = $SQL->query("SELECT * FROM `announcements` WHERE id ORDER BY `date` DESC LIMIT 1");
    foreach ($announcements as $announcementsRow){
    $news_content .= '<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="headline.php?text=Announcement" 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="images/news/announcement.jpg" width="150" height="100" border="0" alt="" /></div>
    <div id="TeaserText">
    <div style="position: relative; margin-bottom: 2px;" >
    <div style="font-size:18px; font-weight:bold;">'.$announcementsRow['title'].'</div>
    </div>
    '.$announcementsRow['text'].'
    <br />
    <br />
    <small style="float: right;">Posted by <font color="red">'.$announcementsRow['author'].'</font> - '.date("d M Y", $announcementsRow['date']).'</small>';
    if ($logged)if ($account_logged->getCustomField("page_access") > 6 ){ $news_content .='<input type="button" value="Deletar" OnClick="location.href=\'index.php?subtopic=cpanel&action=deletar_ann&id='.$announcementsRow['id'].'\'" />';}
    $news_content .='
    </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>';
    }
    //
    $zapytanie = $SQL->query("SELECT `z_forum`.`icon_id`, `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(
    	'/\[youtube\](.*?)\[\/youtube\]/is' => '<center><object width="500" height="405"><param name="movie" value="http://www.youtube.com/v/$1&hl=pt-br&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$1&hl=pt-br&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="405"></embed></object></center>',
    	'/\[b\](.*?)\[\/b\]/is' => '<strong>$1</strong>',
    	'/\[center\](.*?)\[\/center\]/is' => '<center>$1</center>',
    	'/\[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>',
    	'/\[letter\](.*?)\[\/letter\]/is' => '<img src=images/letters/$1.gif alt=$1 />',
    	'/\[url](.*?)\[\/url\]/is' => '<a href=$1>$1</a>',
    	'/\[color\=(.*?)\](.*?)\[\/color\]/is' => '<span style="color: $1;">$2</span>',
    	'/\[img\](.*?)\[\/img\]/is' => '<img src=$1 alt=$1 />',
    	'/\[player\](.*?)\[\/player\]/is' => '<a href='.$server['ip'].'index.php?subtopic=characters&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)">
    	<img src="'.$layout_name.'/images/news/icon_'.$row['icon_id'].'_big.gif" class="NewsHeadlineIcon" />
    	<div class="NewsHeadlineDate">'.date('j M Y', $row['post_date']).' - </div>
    	<div class="NewsHeadlineText">'.$row['post_topic'].'</div>
    	</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><p align="right"><a href="index.php?subtopic=forum&action=remove_post&id='.$row['id'].'"><font color="red">[Delete this news]</font></a>  <a href="index.php?subtopic=forum&action=edit_post&id='.$row['id'].'"><font color="green">[Edit this news]</font></a>';
    	}
    	else		
    	{
    		$main_content .='<td width="100%">'.$message.'<br /><br />';		
    	}
    	$main_content .= '</td>
    	<td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
    	</tr></table>';
    }
    ?>

     

  7. Onde eu mudo o facebook do site?

     

    config/config.php

     

    $link_down = "http://www.tibia.com"; ## Link de download do cliente proprio ##
    $config['site']['SocialFacebook'] = "seu_link";
    $config['site']['SocialTweet'] = "seu_link";

     

    Gostaria de um Featured Article e Top Guilds

  8. PiabetaMan01

     

    hey cara, assim que puder posta pra mim a pagina pra pacc, pois uso vip por p.a e nao por vp_system, fui tentar mudar aqui e deu varios bugs nas datas e etc.. assim qe der posta ai pra gente.. vlw

     

     

    VictorWebMaster

     

    poderia colocar pra mudar de vip_system pra pacc, pra ficar legal pra todos.. e cara, otimo trabalho.. poucos fazem oque vc faz, ta de parabens msm e obrigado

     

    Já configurei a minha cara.

    characters.php = Pra vc ver o player com Premium Account ao envés de VIP

    <?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>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>';
    }
    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 CELLSPACING=0 WIDTH=100%><TR><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=0 HEIGHT=01 BORDER=0></TD><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Character Information</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=20%>Name:</TD><TD>';
    $main_content .= $player->getName();
    if($player->isDeleted())
    $main_content .= ' <font color="red"><b>[DELETED]</b></font>';
    if($player->isNameLocked())
    $main_content .= ' <font color="red">[NAMELOCK]</font>';
    $main_content .= '<div style="float:right;"><a href="index.php?subtopic=report_name&name='.$player->getName().'"><img src="'.$layout_name.'/images/buttons/sbutton_reportname.gif" /></div>
    </TD></TR>';
    $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 = 'Community Manager';}
    if ($group == 6){$group_name = 'Administrator';}
    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>Position:</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>Sex:</TD><TD>';
    $main_content .= ($player->getSex() == 0) ? 'female' : 'male';
    $main_content .= '</TD></TR>';
    if($player->getMarriage()){
    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>Profession:</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>Level:</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>World:</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>Residence:</TD><TD>'.$towns_list[$player->getWorld()][$player->getTownId()].'</TD></TR>';
    }
    $house = $SQL->query('SELECT `houses`.`name`, `houses`.`town`, `houses`.`paid` FROM `houses` WHERE `houses`.`world_id` = '.$player->getWorld().' AND `houses`.`owner` = '.$player->getId().';')->fetchAll();
    if(count($house) != 0)
    {
    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>House:</TD><TD colspan="2">'.$house[0]['name'].' ('.$towns_list[$player->getWorld()][$house[0]['town']].')';
    if ($house[0]['paid']){$main_content .=' is paid until '.date("M j Y", $house[0]['paid']);}
    $main_content .='.</TD></TR>';
    }
    $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>Guild Membership:</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++;
    if($player->getLastLogin())
    $main_content .= '<TR BGCOLOR='.$bgcolor.'><TD WIDTH="20%">Last login:</TD><TD>'.date("M j Y, H:i:s T", $player->getLastLogin()).'</TD></TR>';
    else
    $main_content .= '<TR BGCOLOR='.$bgcolor.'><TD WIDTH="20%">Last login:</TD><TD>Never logged in.</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>Account Status:</TD><TD>'; 
    $main_content .= ($account->isPremium()) ? '<font color="green"><b>Premium Account</b></font>' : 'font color="green"><b>Free Account</b></font>';
    //Comment System
    $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">Comment:</TD><TD>'.$comment.'</TD></TR>';
    }
    //Outfit
    if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
    $main_content .= '
    <TR><TD WIDTH="10%">';
    if ($player->getCustomField("show_outfit") == 1){
    $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">Outfit:</td>
    <td style="width:100%;">
    <div style="position: relative; width: 32px; height: 32px;">
    <div style="background-image: url(\'outfitter.php?id='.$player->getLookType().'&addons='.$player->getLookAddons().'&head='.$player->getLookHead().'&body='.$player->getLookBody().'&legs='.$player->getLookLegs().'&feet='.$player->getLookFeet().'\'); position: absolute; width: 64px; height: 80px; background-position: bottom right; background-repeat: no-repeat; right: 0px; bottom: 0px;"></div>
    </div>
    </td>
    </tr>
    <tr>
    <td> </td>
    </tr>';
    if ($player->getCustomField("lookmount") > 900){
    $main_content .='
    <tr>
    <td class="LabelV">Mount:</td>
    <td style="width:100%;">
    <div style="position: relative; width: 32px; height: 32px;">
    <div style="background-image: url(\'images/mounts/'.$player->getCustomField("lookmount").'.gif\'); position: absolute; width: 64px; height: 80px; background-position: bottom right; background-repeat: no-repeat; right: 0px; bottom: 0px;"></div>
    </div>
    </td>
    </tr>';}
    $main_content .='
    </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>
    </TD>';
    }
    if ($player->getCustomField("show_eq") == 1){
    $main_content .='
    </td>
    <td>
    <div class="SmallBox" style="width: 260px;" >
    <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>';
    $main_content .='
    <td align="center">';
    $number_of_items = 1;
    $main_content .= '<table with=100% style="background-image:url(\'images/equipment/bg.gif\'); border: solid 1px #000;" 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 = '.$player->getId().' AND pid = '.$list[$pid].';')->fetch();
    if($top[itemtype] == false)
    {
    if($list[$pid] == '8')
    {
    $main_content .= '<td></td>';
    }
    if(is_int($number_of_items / 3))
    {
    $main_content .= '<TD style="text-align: center;"><img src="images/equipment/'.$list[$pid].'.gif" width="32" higth="32" ></TD></tr><tr>';
    } else {
    $main_content .= '<TD style="text-align: center;"><img src="images/equipment/'.$list[$pid].'.gif" width="32" higth="32"></TD>';
    }
    $number_of_items++;
    }
    else
    {
    if($list[$pid] == '8')
    {
    $main_content .= '<td></td>';
    }
    if(is_int($number_of_items / 3))
    $main_content .= '<TD style="background-image:url(\'images/equipment/0.gif\'); text-align: center;"><img src="images/items/'.$top[itemtype].'.gif" width="32" higth="32"/></TD></tr><tr>';
    else
    $main_content .= '<TD style="background-image:url(\'images/equipment/0.gif\'); text-align: center;"><img src="images/items/'.$top[itemtype].'.gif" width="32" higth="32" /></TD>';
    $number_of_items++;
    }
    if($list[$pid] == '8')
    {
    $main_content .= '</table>';
    }
    }
    $main_content .='
    </td>';
    $main_content .='
    <td valign="top">
    <b>HP:</b> '.$player->getHealth().'
    <div style="-moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;width: 100px; height: 5px; border: 1px solid #000;">
    <div style="background: red; width: 100%; height: 5px;"></div>
    </div>
    <b>Mana:</b> '.$player->getMana().'
    <div style="-moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;width: 100px; height: 5px; border: 1px solid #000;">
    <div style="background: blue; width: 100%; height: 5px;"></div>
    </div>
    ';
    }
    $main_content .='
    </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>
    </td>
    </tr>
    </table>
    ';
    $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=\"30%\" align=\"center\">".date("M j Y, H:i:s T", $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 .= "Died at level <b>".$death['level']."</b> by ";
    else if($i == $count)
    $dead_add_content .= " and by ";
    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>Character Deaths</B></TD></TR>' . $dead_add_content . '</TABLE><br />';
    //end
    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>Account Information</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='.$bgcolor.'><TD WIDTH=20%>Real name:</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='.$bgcolor.'><TD WIDTH=20%>Location:</TD><TD>'.$account->getLocation().'</TD></TR>';
    }
    $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 = 'Community Manager';}
    if ($group == 6){$group_name = 'Administrator';}
    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>Position:</TD><TD>'.$group_name.'</TD></TR>';
    }
    if($player->getCreated())
    {
    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>Created:</TD><TD>'.date("M j Y, H:i:s T", $player->getCreated()).'</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='.$bgcolor.'><TD WIDTH="20%">Last login:</TD><TD>'.date("M j Y, H:i:s T", $account->getLastLogin()).'</TD></TR>';
    if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
    $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 * FROM `bans` WHERE `value` = '.$account->getCustomField('id').'')->fetchAll();
    foreach($players_banned as $player) {
    if($account->isBanned())
    if($account->getBanTime() > 0)
    $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Banished:</td><td><font color="red"><b>Account Banishment</b> <br /><b>Expires:</b> '.date("j F Y, G:i A", $account->getBanTime()).' - '.$ban_reason[$player['reason']].'</font></td></tr>';
    else
    $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Banished:</td><td><font color="red"><b>Banished Forever</font></td></tr>';
    }
    $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>Characters</B></TD></TR>
    <TR BGCOLOR='.$config['site']['darkborder'].'><TD><B>Name</B></TD><TD><B>World</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 = '';
    else
    $player_list_status = '<b style="color:green;">online</b>';
    $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=52%><NOBR>'.$player_number.'. '.$player_list->getName();
    $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%">'.$player_list_status.'</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>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>';
    $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>';
    }
    }
    ?>
    

     

    accountmanagement.php = Quando o Player fazer login ver que ta premium e o crystal fica verde.

     

    <?php
    if(!$logged)
    if($action == "logout"){
    //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="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="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">login</a> again.
     </td>
     </tr></table></div></table></div></td></tr>';
    }else{
     $link = "?subtopic=accountmanagement";
     $link_lost = "?subtopic=lostaccount";
     include("login.php");
    }else
     {
     if($account_logged->getCustomField("group_id") == 4)
     $main_content .='<meta http-equiv="refresh" content="0;url=index.php?subtopic=accountmanagement&action=logout">';
    else
    if(!$account_logged->getCustomField("premdays"))
     $account_status = '<b>Free Account</b><br /><small>You do not have VIP <i>!</i></small>';
    else
     $account_status = '<b>VIP Account</b><br /><small>(You have '.$account_logged->getCustomField("premdays").' CEST days left)</small>';
    
    $account_premium = $account_logged->isPremium() ? 'Premium Account' : 'Free Account';
    if ($account_premium == "Premium Account")
    $account_premium_status = "green";
    else
    $account_premium_status = "red";
    if($action == ""){
    $main_content .= '
    <div>
    <center>
    <table><tbody><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;">';
    $account_reckey = $account_logged->getRecoveryKey();
    if(empty($account_reckey)){
    $main_content .= 'Welcome to your account!';}
    else {
    $main_content .='Welcome to your account, ' . $account_logged->getCustomField("rlname") . '!';}
    $main_content .='
    <br />
    </td><td>
    <img src="'.$layout_name.'/images/content/headline-bracer-right.gif">
    </td></tr></tbody></table>
    </center>
    <br />';
    if($account_logged->getCustomField("page_access") > $config['site']['access_admin_panel']){
    $main_content .='
    <div class="InnerTableContainer">
    <table>
    <tbody>
    <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" style="border: 1px solid #faf0d7;">
    <tbody>
    <tr style="background-color: #505050;">
    </tr>
    <tr class="Table" style="background-color: #d4c0a1;">
    <td style="width: 800; border: 1px; border-style: solid; border-color: #FAF0D7; padding: 4px;">
    <font style="font-size:16px; font-weight:bold;">
    Primeira vez utilizando nosso website?</font><br />Visite o <a href="index.php?subtopic=cpanel">painel de administração</a> para adicionar tabelas não existentes.<small><br />Assim tais como o <b>sistema automatico pagseguro</b> não possui as tabelas instaladas.</small>
    </font>
    </td>
    </tr>
    </tbody>
    </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>
    </tbody>
    </table>
    </div><br />';
    }
    $main_content .='
    <div class="TableContainer">
    <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 Status</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>
    <table class="Table5" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td>
    <div class="InnerTableContainer">
    <table style="width:100%;">
    <tbody>
    <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" style="border:1px solid #faf0d7;" width="100%">
    <tbody>
    <tr>
    <td><img class="AccountStatusImage" src="images/account/account-status_'.$account_premium_status.'.gif" /></td>
    <td valign="middle" width="100%">
    <span class="BigBoldText">'.$account_premium.'</span>
    <br />';
    if ($account_premium == "Premium Account")
    $main_content .='<small>Your premium time expired at '.date("M j Y, H:i:s", $account_logged->getCustomField("premdays")).' CEST.</small>';
    $main_content .='</td>
    <td><form action="?subtopic=accountmanagement&action=logout" method="post" style="padding:0px;margin: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" name="Logout" alt="Logout" src="'.$layout_name.'/images/buttons/_sbutton_logout.gif" type="image"></div></div></form><div style="font-size:1px;height:4px;"></div><form action="?subtopic=accountmanagement&action=manage" method="post" style="padding:0px;margin: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" name="Manage Account" alt="Manage Account" src="'.$layout_name.'/images/buttons/_sbutton_manageaccount.gif" type="image"></div></div></form></td></tr>    </tbody></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>  </tbody></table>
    </div>
    </td>
    </tr>
    </tbody>
    </table>
    </div>';
    $main_content .='
    <div class="SmallBox"></div>
    <br />
    <div class="RowsWithOverEffect">
    <div class="TableContainer">
    <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>
    <table class="Table3" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td>
    <div class="InnerTableContainer">
    <table style="width:100%;">
    <tbody>
    <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:5%" > </td>
    <td style="width:65%" >Name</td>
    <td style="width:15%" >World</td>
    <td style="width:7%">Status </td>
    <td style="width:5%"> </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 style="width:5%" >'.$player_number_counter.'.</td>
    <td><NOBR>'.$account_player->getName();
    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>';
    }
    $main_content .= '<br />
    <small>'.$vocation_name[$account_player->getWorld()][$account_player->getPromotion()][$account_player->getVocation()].' - level '.$account_player->getLevel().'</small></td>
    <td><NOBR>'.$config['site']['worlds'][$account_player->getWorld()].'</td>
    <td>';
    if($account_player->isDeleted()){
    $main_content .= 'deleted';
    }elseif($account_player->getHideChar() == 1){
    $main_content .= 'hidden';
    }else{
    $main_content .= '';
    }$main_content .= '</td>
    <td style="text-align:center;vertical-align:middle;horizontal-align:center;" align="center"><p>[<a href="?subtopic=accountmanagement&action=changecomment&name='.urlencode($account_player->getName()).'" >Edit</a>]</p>
    <p>';
    if($account_player->isDeleted()){
    $main_content .= '[<a href="?subtopic=accountmanagement&action=undelete&name='.urlencode($account_player->getName()).'">Undelete</a><a href="index.php?subtopic=accountmanagement&action=undelete&name='.urlencode($account_player->getName()).'" ></a>]</p></td>';
    }else{
    $main_content .= '[<a href="?subtopic=accountmanagement&action=deletecharacter&name='.urlencode($account_player->getName()).'">Delete</a><a href="?subtopic=accountmanagement&action=changecomment&name='.urlencode($account_player->getName()).'" ></a>]</p></td>';
    }
    $main_content .= '</tr>';
    }
    $players_from_logged_acc = $account_logged->getPlayersList();
    if(count($players_from_logged_acc) == 0) {
    $main_content .='<tr bgcolor="'.$config['site']['lightborder'].'"><td colspan="5" align="center">You don\'t have any character on your account.</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"><tbody><tr><td></td><td style="padding-right:7px;width:100%;" align="right"><form action="?subtopic=accountmanagement&action=createcharacter" method="post" style="padding:0px;margin:0px;"><input name="selectedcharacter" value="" type="hidden"><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" name="Create Character" alt="Create Character" src="'.$layout_name.'/images/buttons/_sbutton_createcharacter.gif" type="image"></div></div></form></td></tr></tbody></table></td></tr>  </tbody></table></div>  </td></tr></tbody></table></div></div><br /><br />
    </div>';
    }
    elseif($action== "manage"){
    $account_reckey = $account_logged->getRecoveryKey();
    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 = 'Yes <b>(<a href="index.php?subtopic=accountmanagement&action=newreckey">Buy new Rec key</a>)</b>';
    else
    $account_registred = 'Yes';
    $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_vip = $account_logged->isPremium() ? '<b>VIP</b> - '.date("d/m/Y, H:i", $account_logged->isPremium()).'' : '<b>Free Account</b>'; 
    $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>';
    $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="90%"> </td>
    <td width="10%">
    <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="Overview" alt="Overview" src="'.$layout_name.'/images/buttons/_sbutton_overview.gif" id="Overview" >
    </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 />
    <br />';
    //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 /><small>You can accept <b>new e-mail after '.date("j F Y", $account_email_new_time).".</b></small>";
    $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">Account Name:</td><td>'.$account_logged->getCustomField("name").'</td></tr>
    <tr style="background-color:'.$config['site']['lightborder'].';" ><td class="LabelV">Email Address:</td><td style="width:90%;" >'.$account_email.''.$account_email_change.'</td></tr>
    <tr style="background-color:'.$config['site']['darkborder'].';" ><td class="LabelV">Created:</td><td>'.date("j F Y, G:i:s", $account_created).'</td></tr>
    <tr style="background-color:'.$config['site']['lightborder'].';" ><td class="LabelV">Last Login:</td><td>'.date("j F Y, G:i:s", time()).'</td></tr>
    <tr style="background-color:'.$config['site']['darkborder'].';" ><td class="LabelV">Account Status:</td><td>'.$account_status.'</td></tr>
    <tr style="background-color:'.$config['site']['lightborder'].';" ><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="index.php?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 />';
    $pagseguro_query = $SQL->query("SELECT COUNT(*) FROM `pagsegurotransacoes` WHERE ".$SQL->fieldName('referencia')." = ".$SQL->quote($account_logged->getCustomField("name"))."")->fetch();
    $pagseguro_history_received = $SQL->query('SELECT * FROM `pagsegurotransacoes` WHERE '.$SQL->fieldName('referencia').' = '.$SQL->quote($account_logged->getCustomField("name")).' ORDER BY `Data` DESC LIMIT 5;');
    if(is_object($pagseguro_history_received)) {
    foreach($pagseguro_history_received as $pagseguro_received) {
     if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
     $pagseguro_received_text .= '<tr  bgcolor="'.$bgcolor.'"><td style="padding: 5px;">'.$pagseguro_received['TransacaoID'].'</td><td>';
     $pagseguro_received_text .= $pagseguro_received['TipoPagamento'];
     $pagseguro_received_text .= '</td><td><b>R$</b>'.$pagseguro_received['NumItens'].',00</td><td><b style="color:red;">'.$pagseguro_received['StatusTransacao'].'</b></td></tr>';
    }
    }
    if ($pagseguro_query[0] > 0){
    $main_content .='
    <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" >Payments History</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 bgcolor="#D4C0A1">
    <td><b>Trans. ID:</b></td>
    <td><b>Type:</b></td>
    <td><b>Cost:</b></td>
    <td><b>Status</b></td>
    </tr>
    '.$pagseguro_received_text.'
    </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>
    </tr>
    <tr>
    <td>
    <form action="index.php?subtopic=history" 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="View History" alt="View History" src="'.$layout_name.'/images/buttons/_sbutton_viewhistory.gif" >
    </div>
    </div>
    </form>
    </td>
    </td>
    </tr>
    </table>
    </div>
    </table>
    </div>
    </td>
    </tr>
    ';
    }
    }
    //########### 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="index.php?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&action=manage" 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="index.php?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&action=manage" 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>';
    require("phpmailer/class.phpmailer.php");
    $mail = new PHPMailer();
    if ($config['site']['smtp_enabled'] == "yes")
    {
    $mail->IsSMTP();
    $mail->Host = $config['site']['smtp_host'];
    $mail->Port = (int)$config['site']['smtp_port'];
    $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
    $mail->Username = $config['site']['smtp_user'];
    $mail->Password = $config['site']['smtp_pass'];
    }
    else
    $mail->IsMail();
    $mail->IsHTML(true);
    $mail->From = $config['site']['mail_address'];
    $mail->AddAddress($account_logged->getEMail());
    $mail->Subject = $config['server']['serverName']." - Changed password";
    $mail->Body = $mailBody;
    if($mail->Send())
    $main_content .= '<br /><small>Your new password were send on email address <b>'.$account_logged->getEMail().'</b>.</small>';
    else
    $main_content .= '<br /><small>An error occorred while sending email with password!</small>';
    }
    $main_content .= '</td></tr>  </table></div>  </table></div></td></tr><br /><center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=manage" 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></center>';
    $_SESSION['password'] = $new_password;
    }
    }
    }
    //############# CHANGE E-MAIL ###################
    if($action == "changeemail") {
    $account_email_new_time = $account_logged->getCustomField("email_new_time");
    if($account_email_new_time > 10) {$account_email_new = $account_logged->getCustomField("email_new"); }
    if($account_email_new_time < 10){
    if($_POST['changeemailsave'] == 1) {
    $account_email_new = trim($_POST['new_email']);
    $post_password = trim($_POST['password']);
    if(empty($account_email_new)) {
    $change_email_errors[] = "Please enter your new email address.";
    }
    else
    {
    if(!check_mail($account_email_new)) {
    $change_email_errors[] = "E-mail address is not correct.";
    }
    }
    if(empty($post_password)) {
    $change_email_errors[] = "Please enter password to your account.";
    }
    else
    {
    $post_password = password_ency($post_password);
    if($post_password != $account_logged->getPassword()) {
    $change_email_errors[] = "Wrong password to account.";
    }
    }
    if(empty($change_email_errors)) {
    $account_email_new_time = time() + $config['site']['email_days_to_change'] * 24 * 3600;
    $account_logged->setCustomField("email_new", $account_email_new);
    $account_logged->setCustomField("email_new_time", $account_email_new_time);
    $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" >New Email Address Requested</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 requested to change your email address to <b>'.$account_email_new.'</b>. The actual change will take place after <b>'.date("j F Y, H:i:s", $account_email_new_time).'</b>, during which you can cancel the request at any time.</td></tr>  </table></div>  </table></div></td></tr><br /><center><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></center>';
    }
    else
    {
    //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($change_email_errors as $change_email_error) {
    $main_content .= '<li>'.$change_email_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 />';
    //show form
    $main_content .= 'Please enter your password and the new email address. Make sure that you enter a valid email address which you have access to. <b>For security reasons, the actual change will be finalised after a waiting period of '.$config['site']['email_days_to_change'].' days.</b><br /><br /><form action="index.php?subtopic=accountmanagement&action=changeemail" 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 Email Address</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 Email Address:</span></td>  <td style="width:90%;" ><input name="new_email" value="'.$_POST['new_email'].'" size="30" maxlength="50" ></td><tr></tr><td class="LabelV" ><span >Password:</span></td>  <td><input type="password" name="password" 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;" ><input type="hidden" name=changeemailsave value=1 ><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&action=manage" 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
    {
    $main_content .= 'Please enter your password and the new email address. Make sure that you enter a valid email address which you have access to. <b>For security reasons, the actual change will be finalised after a waiting period of '.$config['site']['email_days_to_change'].' days.</b><br /><br /><form action="index.php?subtopic=accountmanagement&action=changeemail" 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 Email Address</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 Email Address:</span></td>  <td style="width:90%;" ><input name="new_email" value="'.$_POST['new_email'].'" size="30" maxlength="50" ></td><tr></tr><td class="LabelV" ><span >Password:</span></td>  <td><input type="password" name="password" 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;" ><input type="hidden" name=changeemailsave value=1 ><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&action=manage" 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($account_email_new_time < time()) {
    if($_POST['changeemailsave'] == 1) {
    $account_logged->setCustomField("email_new", "");
    $account_logged->setCustomField("email_new_time", 0);
    $account_logged->setEmail($account_email_new);
    $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" >Email Address Change Accepted</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 accepted <b>'.$account_logged->getEmail().'</b> as your new email adress.</td></tr>  </table></div>  </table></div></td></tr><br /><center><table border="0" cellspacing="0" cellpadding="0" ><form action="index.php?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></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" >Email Address Change Accepted</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>Do you accept <b>'.$account_email_new.'</b> as your new email adress?</td></tr>  </table></div>  </table></div></td></tr><br /><table width="100%"><tr><td width="30"> </td><td align=left><form action="index.php?subtopic=accountmanagement&action=changeemail" method="post"><input type="hidden" name="changeemailsave" value=1 ><INPUT TYPE=image NAME="I Agree" SRC="'.$layout_name.'/images/buttons/sbutton_iagree.gif" BORDER=0 WIDTH=120 HEIGHT=17></FORM></td><td align=left><form action="index.php?subtopic=accountmanagement&action=changeemail" method="post"><input type="hidden" name="emailchangecancel" value=1 ><input type=image name="Cancel" src="'.$layout_name.'/images/buttons/sbutton_cancel.gif" BORDER=0 WIDTH=120 HEIGHT=17></form></td><td align=right><form action="?subtopic=accountmanagement&action=manage" 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></td><td width="30"> </td></tr></table>';
    }
    }
    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" >Change of Email Address</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>A request has been submitted to change the email address of this account to <b>'.$account_email_new.'</b>.<br />The actual change will take place on <b>'.date("j F Y, G:i:s", $account_email_new_time).'</b>.<br />If you do not want to change your email address, please click on "Cancel".</td></tr>  </table></div>  </table></div></td></tr><br /><table style="width:100%;" ><tr align="center"><td><table border="0" cellspacing="0" cellpadding="0" ><form action="index.php?subtopic=accountmanagement&action=changeemail" method="post" ><tr><td style="border:0px;" ><input type="hidden" name="emailchangecancel" value=1 ><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="Cancel" alt="Cancel" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" ></div></div></td></tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=manage" 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>';
    }
    }
    if($_POST['emailchangecancel'] == 1) {
    $account_logged->setCustomField("email_new", "");
    $account_logged->setCustomField("email_new_time", 0);
    $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" >Email Address Change Cancelled</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 request to change the email address of your account has been cancelled. The email address will not be changed.</td></tr>  </table></div>  </table></div></td></tr><br /><center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=manage" 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></center>';
    }
    }
    
    //########### CHANGE PUBLIC INFORMATION (about account owner) ######################
    if($action == "changeinfo") {
    $new_rlname = htmlspecialchars(stripslashes(trim($_POST['info_rlname'])));
    $new_location = htmlspecialchars(stripslashes(trim($_POST['info_location'])));
    if($_POST['changeinfosave'] == 1) {
    //save data from form
    $account_logged->setRLName($new_rlname);
    $account_logged->setLocation($new_location);
    $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" >Public Information 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 public information has been changed.</td></tr>  </table></div>  </table></div></td></tr><br /><center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=manage" 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></center>';
    }
    else
    {
    //show form
    $account_rlname = $account_logged->getRLName();
    $account_location = $account_logged->getLocation();
    $main_content .= 'Here you can tell other players about yourself. This information will be displayed alongside the data of your characters. If you do not want to fill in a certain field, just leave it blank.<br /><br /><form action="index.php?subtopic=accountmanagement&action=changeinfo" 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 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 class="LabelV" >Real Name:</td><td style="width:90%;" ><input name="info_rlname" value="'.$account_rlname.'" size="30" maxlength="50" ></td></tr><tr><td class="LabelV" >Location:</td><td><input name="info_location" value="'.$account_location.'" size="30" maxlength="50" ></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;" ><input type="hidden" name="changeinfosave" value="1" ><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&action=manage" 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>';
    }
    }
    //############## GENERATE RECOVERY KEY ###########
    if($action == "registeraccount")
    {
    $reg_password = password_ency(trim($_POST['reg_password']));
    $old_key = $account_logged->getRecoveryKey("key");
    if($_POST['registeraccountsave'] == "1")
    {
    if($reg_password == $account_logged->getPassword())
    {
    if(empty($old_key))
    {
    $dontshowtableagain = 1;
    $acceptedChars = 'ABCDEFGHIJKLMNPQRSTUVWXYZ1234567890';
    $max = strlen($acceptedChars)-1;
    $new_rec_key = NULL;
    // 10 = number of chars in generated key
    for($i=0; $i < 22; $i++) {
    $cnum[$i] = $acceptedChars{mt_rand(0, $max)};
    $new_rec_key .= $cnum[$i];
    }
    $account_logged->setRecoveryKey($new_rec_key);
    $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" >Account Registered</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%;" >Thank you for registering your account! You can now recover your account if you have lost access to the assigned email address by using the following<br /><br /><font size="5">   <b>Recovery Key: '.$new_rec_key.'</b></font><br /><br /><br /><b>Important:</b><ul><li>Write down this recovery key carefully.</li><li>Store it at a safe place!</li>';
    if($config['site']['send_emails'] && $config['site']['send_mail_when_generate_reckey'])
    {
    $mailBody = '<html>
    <body>
    <h3>New recovery key!</h3>
    <p>You or someone else generated recovery key to your account on server <a href="'.$config['server']['url'].'"><b>'.$config['server']['serverName'].'</b></a>.</p>
    <p>Recovery key: <b>'.$new_rec_key.'</b></p>
    </body>
    </html>';
    require("phpmailer/class.phpmailer.php");
    $mail = new PHPMailer();
    if ($config['site']['smtp_enabled'] == "yes")
    {
    $mail->IsSMTP();
    $mail->Host = $config['site']['smtp_host'];
    $mail->Port = (int)$config['site']['smtp_port'];
    $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
    $mail->Username = $config['site']['smtp_user'];
    $mail->Password = $config['site']['smtp_pass'];
    }
    else
    $mail->IsMail();
    $mail->IsHTML(true);
    $mail->From = $config['site']['mail_address'];
    $mail->AddAddress($account_logged->getEMail());
    $mail->Subject = $config['server']['serverName']." - recovery key";
    $mail->Body = $mailBody;
    if($mail->Send())
    $main_content .= '<br /><small>Your recovery key were send on email address <b>'.$account_logged->getEMail().'</b>.</small>';
    else
    $main_content .= '<br /><small>An error occorred while sending email with recovery key! You will not receive e-mail with this key.</small>';
    }
    $main_content .= '</ul>  </table></div>  </table></div></td></tr><br /><center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=manage" 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></center>';
    }
    else
    $reg_errors[] = 'Your account is already registred.';
    }
    else
    $reg_errors[] = 'Wrong password to account.';
    }
    if($dontshowtableagain != 1)
    {
    //show errors if not empty
    if(!empty($reg_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($reg_errors as $reg_error)
    $main_content .= '<li>'.$reg_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 />';
    }
    //show form
    $main_content .= 'To generate recovery key for your account please enter your password.<br /><br />
    <form action="index.php?subtopic=accountmanagement&action=registeraccount" method="post" >
    <input type="hidden" name="registeraccountsave" value="1">
    <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" >Generate recovery key</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 >Password:</td>
    <td><input type="password" name="reg_password" 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&action=manage" 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>';
    }
    }
    //############## GENERATE NEW RECOVERY KEY ###########
    if($action == "newreckey"){
    $reg_password = password_ency(trim($_POST['reg_password']));
    $reckey = $account_logged->getRecoveryKey();
    if((!$config['site']['generate_new_reckey'] || !$config['site']['send_emails']) || empty($reckey))
    $main_content .= '
    <table border="0" cellspacing="1" cellpadding="4" width="100%">
    <tr bgcolor="'.$config['site']['vdarkborder'].'">
    <td class="white"><b>Error</b></td>
    </tr>
    <tr bgcolor='.$config['site']['darkborder'].'>
    <td>
    <table border="0" cellspacing="1" cellpadding="1">
    <tr>
    <td>You are not allowed to generate a new recovery key.</td>
    </tr>
    </table>
    </td>
    </tr>
    </table> ';
    else
    {
    $points = $account_logged->getPremiumPoints();
    if($_POST['registeraccountsave'] == "1")
    {
    if($reg_password == $account_logged->getPassword())
    {
    if($points >= $config['site']['generate_new_reckey_price'])
    {
    $dontshowtableagain = 1;
    $acceptedChars = 'ABCDEFGHIJKLMNPQRSTUVWXYZ1234567890';
    $max = strlen($acceptedChars)-1;
    $new_rec_key = NULL;
    // 10 = number of chars in generated key
    for($i=0; $i < 22; $i++) {
    $cnum[$i] = $acceptedChars{mt_rand(0, $max)};
    $new_rec_key .= $cnum[$i];
    }
    $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" >Account Registered</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%;" ><ul>';
    $mailBody = '
    <html>
    <body>
    <h3>New recovery key!</h3>
    <p>You or someone else generated recovery key to your account on server <b>'.$config['server']['serverName'].'</b>.</p>
    <p>Recovery key: <b>'.$new_rec_key.'</b></p>
    </body>
    </html>';
    require("phpmailer/class.phpmailer.php");
    $mail = new PHPMailer();
    if ($config['site']['smtp_enabled'] == "yes")
    {
    $mail->IsSMTP();
    $mail->Host = $config['site']['smtp_host'];
    $mail->Port = (int)$config['site']['smtp_port'];
    $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
    $mail->Username = $config['site']['smtp_user'];
    $mail->Password = $config['site']['smtp_pass'];
    }
    else
    $mail->IsMail();
    $mail->IsHTML(true);
    $mail->From = $config['site']['mail_address'];
    $mail->AddAddress($account_logged->getEMail());
    $mail->Subject = $config['server']['serverName']." - new recovery key";
    $mail->Body = $mailBody;
    if($mail->Send())
    {
    $account_logged->setRecoveryKey(new_rec_key);
    $account_logged->setPremiumPoints($account_logged->getPremiumPoints()-$config['site']['generate_new_reckey_price']);
    $account_logged->save();
    $main_content .= '<br />Your recovery key were send on email address <b>'.$account_logged->getEMail().'</b> for '.$config['site']['generate_new_reckey_price'].' premium points.';
    }
    else
    $main_content .= 'An error occorred while sending email (<b>'.$account_logged->getEMail().'</b>) with recovery key! Recovery key not changed. Try again later.';
    $main_content .= '</ul></table></div>  </table></div></td></tr><br /><center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement&action=manage" 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></center>';
    }
    else
    $reg_errors[] = 'You need '.$config['site']['generate_new_reckey_price'].' premium points to generate new recovery key. You have <b>'.$points.'<b> premium points.';
    }
    else
    $reg_errors[] = 'Wrong password to account.';
    }
    if($dontshowtableagain != 1)
    {
    //show errors if not empty
    if(!empty($reg_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($reg_errors as $reg_error)
    $main_content .= '<li>'.$reg_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 />';
    }
    //show form
    $main_content .= 'To generate NEW recovery key for your account please enter your password.<br /><font color="red"><b>New recovery key cost '.$config['site']['generate_new_reckey_price'].' Premium Points.</font><br />You have '.$points.' premium points. You will receive e-mail with this recovery key.</b><br /><br /><form action="index.php?subtopic=accountmanagement&action=newreckey" method="post" ><input type="hidden" name="registeraccountsave" value="1"><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" >Generate recovery key</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 >Password:</td><td>';
    if ($account_logged->getCustomField("premium_points") < $config['site']['generate_new_reckey_price']){
    $main_content .='<input type="text" name="" size="35" value="You no have premium points to buy" disabled="disabled" >';
    }
    else
    {
    $main_content .='<input type="password" name="reg_password" size="30" maxlength="29" >';
    }
    $main_content .='</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&action=manage" 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>';
    }
    }
    }
    //###### CHANGE CHARACTER COMMENT ######
    if($action == "changecomment") {
    $player_name = stripslashes($_REQUEST['name']);
    $new_comment = htmlspecialchars(stripslashes(substr(trim($_POST['comment']),0,2000)));
    $new_hideacc = (int) $_POST['accountvisible'];
    $new_showskills = (int) $_POST['showskills'];
    $show_outfit = (int) $_POST['show_outfit'];
    $show_eq = (int) $_POST['show_eq'];
    if(check_name($player_name)) {
    $player = $ots->createObject('Player');
    $player->find($player_name);
    if($player->isLoaded()) {
    $player_account = $player->getAccount();
    if($account_logged->getId() == $player_account->getId()) {
    if($_POST['changecommentsave'] == 1) {
    $player->setCustomField("hide_char", $new_hideacc);
    $player->setCustomField("show_eq", $show_eq);
    $player->setCustomField("comment", $new_comment);
    $player->setCustomField("show_outfit", $show_outfit);
    $main_content .= '
    <form action="index.php?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" >Character Information 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>The character information has been changed.</td>
    </tr>
    </table>
    </div>
    </table>
    </div>
    </td>
    </tr>
    <br />
    <center>
    <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="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></center>';
    }
    else
    {
    $main_content .= 'Here you can see and edit the information about your character.<br />If you do not want to specify a certain field, just leave it blank.<br /><br />
    <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" >Character Data</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 class="LabelV" style="vertical-align:middle;">Name:</td>
    <td style="width:80%;" >'.$player_name.'</td>
    </tr>
    <tr>
    <td class="LabelV" style="vertical-align:middle;" >World:</td>
    <td style="width:80%;" >'.$config['server']['serverName'].'</td>
    </tr>';
    if ($player->getCustomField("sex") > 0){
    $main_content .='
    <tr>
    <td class="LabelV" style="vertical-align:middle;">Sex:</td>
    ';
    $sex_types = array (1 => 'male', 0 => 'female');
    $main_content .='
    <td>'.$sex_types[$player->getCustomField("sex")].'</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>
    </td>
    </tr>
    </table>
    </div>
    </table>
    </div>
    </td>
    </tr>
    <br />
    <form action="index.php?subtopic=accountmanagement&action=changecomment" method="post" >
    <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" >Edit Character 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 class="LabelV" >Equipment Shower:</td><td>
    ';
    if ($player->getCustomField("show_eq") == 1){
    $main_content .='<input type="checkbox" name="show_eq"  value="1" checked="checked"> <small>Visível</small>';
    }else{
    $main_content .='<input type="checkbox" name="show_eq"  value="1" > <small>Invisível</small>';
    }
    $main_content .= '</td>
    </tr>
    <tr>
    <td class="LabelV" >Outfit Shower:</td><td>
    ';
    if ($player->getCustomField("show_outfit") == 1){
    $main_content .='<input type="checkbox" name="show_outfit"  value="1" checked="checked"> <small>Visível</small>';
    }else{
    $main_content .='<input type="checkbox" name="show_outfit"  value="1" > <small>Invisível</small>';
    }
    $main_content .= '</td>
    </tr>
    <tr>
    <td class="LabelV" >Hide Account:</td><td>';
    if($player->getCustomField("hide_char") == 1)
    {
    $main_content .= '<input type="checkbox" name="accountvisible"  value="1" checked="checked">';
    }
    else
    {
    $main_content .= '<input type="checkbox" name="accountvisible"  value="1" >';
    }
    $main_content .= ' check to hide your account information</td>
    </tr>
    <tr><td><b>Comment:</b></td>
    <td style="width:80%;" ><textarea name="comment" rows="10" cols="50" wrap="virtual">'.$player->getCustomField("comment").'</textarea><br />[max. length: 2000 chars, 50 lines (ENTERs)]<br />
    <Small><b>BBCode:</b> OFF</small></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>
    </div>
    </div>
    </td>
    </tr>
    <tr>
    <td>
    </td>
    </tr>
    </td>
    </tr>
    </table>
    </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;" ><input type="hidden" name="name" value="'.$player->getName().'"><input type="hidden" name="changecommentsave" value="1"><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="index.php?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
    {
    $main_content .= '<div class="notice">Player <b>'.$player_name.'</b> is not on your account !</div><br />
    <table border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td style="border: 0px none;">
    <a href="javascript:void();" onclick=location.href="index.php?subtopic=accountmanagement">
    <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); visibility: hidden;"></div>
    <input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/vips/_sbutton_back.gif" type="image">
    </table>';
       }
      }
      else
      {
       $main_content .= '<TABLE BORDER="0" CELLSPACING="1" CELLPADDING="5" WIDTH="100%">
    <tr BGCOLOR="'.$config['site']['vdarkborder'].'">
    <td CLASS="white"><b>Error</b></td>
    </tr>
    <tr BGCOLOR='.$config['site']['darkborder'].'>
    <td>Error. Character with this name doesn\'t exist.</td>
    </tr>
    </TABLE>
    <br />
    <center>
    <table border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td style="border: 0px none;">
    <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>
    <form action="?subtopic=accountmanagement" method="post">
    <input class="ButtonText" name="Back" alt="Back" src="'.$layout_name.'/images/vips/_sbutton_back.gif" type="image">
    </form>
    </div>
    </div>
    </td>
    </tr>
    </tbody>
    </table>
    </center>';
      }
     }
     else
     {
      $main_content .= "Error. Name contain illegal characters.";
     }
    }
    //### NEW NICK - set new nick proposition ###
    if($action == "newnick")
    {
    $name = $_GET['name'];
    $name_new = stripslashes(ucwords(strtolower(trim($_GET['name_new']))));
    if(!empty($name) && !empty($name_new))
    {
    if(check_name_new_char($name_new))
    {
    $player = $ots->createObject('Player');
    $player->find($name);
    if($player->isLoaded() && $player->isNameLocked())
    {
    $player_account = $player->getAccount();
    if($account_logged->getId() == $player_account->getId())
    {
    if(!$player->getOldName())
    if(!$player->isOnline())
    {
    $player->setCustomField('old_name', $name_new);
    $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" >New nick proposition</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>The character <b>'.$name.'</b> new nick proposition <b>'.$name_new.'</b> has been set. Now you must wait for acceptation from GM.</td></tr>  </table></div>  </table></div></td></tr>';
    }
    else
    $main_content .= 'This character is online.';
    else
    $main_content .= 'You already set new name for this character ( <b>'.$player->getOldName().'</b> ). You must wait until GM accept/reject your proposition.';
    }
    else
    $main_content .= 'Character <b>'.$player_name.'</b> is not on your account.';
    }
    else
    $main_content .= 'Character with this name doesn\'t exist or isn\'t name locked.';
    }
    else
    $main_content .= 'Name contain illegal characters. Invalid format or lenght.';
    }
    else
    $main_content .= 'Please enter new char name.';
    $main_content .= '<br /><center><table border="0" cellspacing="0" cellpadding="0" ><form action="index.php?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></center>';
    }
    //### DELETE character from account ###
    if($action == "deletecharacter") {
    $player_name = stripslashes(trim($_GET['name']));
    $password_verify = trim($_POST['delete_password']);
    $password_verify = password_ency($password_verify);
    if($_POST['deletecharactersave'] == 1) {
    if(!empty($player_name) && !empty($password_verify)) {
    if(check_name($player_name)) {
    $player = $ots->createObject('Player');
    $player->find($player_name);
    if($player->isLoaded()) {
    $player_account = $player->getAccount();
    if($account_logged->getId() == $player_account->getId()) {
    if($password_verify == $account_logged->getPassword()) {
    if(!$player->isOnline())
    {
    // show table "delete character" again
    $dontshowtableagain = 1;
    //delete player
    $player->setCustomField('deleted', 1);
    $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" >Character 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>The character <b>'.$player_name.'</b> has been deleted.</td>
    </tr>
    </table>
    </div>
    </table>
    </div>
    </td>
    </tr>
    <br />
    <center>
    <table border="0" cellspacing="0" cellpadding="0" >
    <form action="index.php?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>
    </center>';
    }
    else
    $delete_errors[] = 'This character is online.';
    }
    else
    {
    $delete_errors[] = 'Wrong password to account.';
    }
    }
    else
    {
    $delete_errors[] = 'Character <b>'.$player_name.'</b> is not on your account.';
    }
    }
    else
    {
    $delete_errors[] = 'Character with this name doesn\'t exist.';
    }
    }
    else
    {
    $delete_errors[] = 'Name contain illegal characters.';
    }
    }
    else
    {
    $delete_errors[] = 'Character name or/and password is empty. Please fill in form.';
    }
    }
    if($dontshowtableagain != 1) {
    if(!empty($delete_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($delete_errors as $delete_error) {
    $main_content .= '<li>'.$delete_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 .= 'To delete this character enter your password and click on "Submit".
    You can undelete the character within the first 2 months (60 days) after the deletion.
    After this time the character is deleted for good and cannot be restored anymore!<br /><br />
    <form action="index.php?subtopic=accountmanagement&action=deletecharacter&name='.$player_name.'" method="post" >
    <input type="hidden" name="deletecharactersave" value="1">
    <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" >Delete 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 style="width:100%;" >
    <tr>
    <td class="LabelV" ><span >Character Name:</td>
    <td style="width:90%;" >'.$player_name.'</td>
    </tr>
    <tr>
    <td class="LabelV" ><span >Password:</td>
    <td><input type="password" name="delete_password" 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="index.php?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>';
    }
    }
    
    //### UNDELETE character from account ###
    if($action == "undelete")
    {
    $player_name = stripslashes(trim($_GET['name']));
    if(!empty($player_name))
    {
    if(check_name($player_name))
    {
    $player = $ots->createObject('Player');
    $player->find($player_name);
    if($player->isLoaded())
    {
    $player_account = $player->getAccount();
    if($account_logged->getId() == $player_account->getId())
    {
    if(!$player->isOnline())
    {
    $player->setCustomField('deleted', 0);
    $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" >Character Undeleted</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>The character <b>'.$player_name.'</b> has been undeleted.</td>
    </tr>
    </table>
    </div>
    </table>
    </div>
    </td>
    </tr>
    <br />
    <center>
    <table border="0" cellspacing="0" cellpadding="0" >
    <form action="index.php?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></center>';
    }
    else
    $delete_errors[] = 'This character is online.';
    }
    else
    $delete_errors[] = 'Character <b>'.$player_name.'</b> is not on your account.';
    }
    else
    $delete_errors[] = 'Character with this name doesn\'t exist.';
    }
    else
    $delete_errors[] = 'Name contain illegal characters.';
    }
    }
    //## CREATE CHARACTER on account ###
    if($action == "createcharacter"){
    if(count($config['site']['worlds']) > 1){
    if(isset($_REQUEST['world']))
    $world_id = (int) $_REQUEST['world'];
    }
    else
    $world_id = 0;
    if(!isset($world_id)){
    $main_content .= 'Before you can create character you must select world: ';
    foreach($config['site']['worlds'] as $id => $world_n)
    $main_content .= '<br /><a href="index.php?subtopic=accountmanagement&action=createcharacter&world='.$id.'">- '.$world_n.'</a>';
    $main_content .= '<br /><h3><a href="index.php?subtopic=accountmanagement">BACK</a></h3>';
    }else{
    $main_content .= '
    <script type="text/javascript">
    var nameHttp;
    function checkName()
    {
    if(document.getElementById("newcharname").value=="")
    {
    document.getElementById("name_check").innerHTML = \'<font color="red">Please enter new character name.</font>\';
    return;
    }
    nameHttp=GetXmlHttpObject();
    if (nameHttp==null)
    {
    return;
    }
    var newcharname = document.getElementById("newcharname").value;
    var url="ajax/check_name.php?name=" + newcharname + "&uid="+Math.random();
    nameHttp.onreadystatechange=NameStateChanged;
    nameHttp.open("GET",url,true);
    nameHttp.send(null);
    }
    function NameStateChanged()
    {
    if (nameHttp.readyState==4)
    {
    document.getElementById("name_check").innerHTML=nameHttp.responseText;
    }
    }
    </script>';
    $newchar_name = stripslashes(ucwords(strtolower(trim($_POST['newcharname']))));
    $newchar_sex = $_POST['newcharsex'];
    $newchar_vocation = $_POST['newcharvocation'];
    $newchar_town = $_POST['newchartown'];
    if($_POST['savecharacter'] != 1)
    {
    $main_content .= 'Please choose a name';
    if(count($config['site']['newchar_vocations'][$world_id]) > 1)
    $main_content .= ', vocation';
    $main_content .= ' and sex for your character. <br />In any case the name must not violate the naming conventions stated in the <a href="index.php?subtopic=tibiarules" target="_blank" >'.$config['server']['serverName'].' Rules</a>, or your character might get deleted or name locked.<br />';
    if($account_logged->getPlayersList()->count() >= $config['site']['max_players_per_account'])
    $main_content .= '<br /><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="4" WIDTH="100%">
    <TR BGCOLOR="'.$config['site']['vdarkborder'].'">
    <TD CLASS=white><b>Erro</b></td>
    </TR>
    <TR BGCOLOR='.$config['site']['darkborder'].'><TD><b><font color="red">You have maximum number of characters per account on your account. Delete one before you make new.</font></b></TD>
    </TR></TABLE>';
    $main_content .= '<br /><form action="index.php?subtopic=accountmanagement&action=createcharacter" method="post" >
    <input type="hidden" name="world" value="'.$world_id.'" >
    <input type="hidden" name=savecharacter value="1" >
    <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" >Create 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 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:50%;" ><span >Name</td>
    <td><span >Sex</td>
    </tr>
    <tr class="Odd" >
    <td><input id="newcharname" name="newcharname" onkeyup="checkName();" value="'.$newchar_name.'" size="30" maxlength="29" ><br />
    <font size="1" face="verdana,arial,helvetica">
    <div id="name_check">Please enter your character name.</div>
    </font>
    </td>
    <td>';
    $main_content .= '<input type="radio" name="newcharsex" value="1" ';
    if($newchar_sex == 1)
    $main_content .= 'checked="checked" ';
    $main_content .= '>male<br />';
    $main_content .= '<input type="radio" name="newcharsex" value="0" ';
    if($newchar_sex == "0")
    $main_content .= 'checked="checked" ';
    $main_content .= '>female<br /></td></tr></table></div></div></table></div>';
    if(count($config['site']['newchar_towns'][$world_id]) > 1 || count($config['site']['newchar_vocations'][$world_id]) > 1)
    $main_content .= '<div class="InnerTableContainer" >  <table style="width:100%;" ><tr>';
    if(count($config['site']['newchar_vocations'][$world_id]) > 1)
    {
    $main_content .= '<td>
    <table class="TableContent" width="100%" >
    <tr class="Odd" valign="top">
    <td width="160">
    <br /><b>Select your vocation:</b></td>
    <td><table class="TableContent" width="100%" >';
    foreach($config['site']['newchar_vocations'][$world_id] as $char_vocation_key => $sample_char)
    {
    $main_content .= '<tr><td><input type="radio" name="newcharvocation" value="'.$char_vocation_key.'" ';
    if($newchar_vocation == $char_vocation_key)
    $main_content .= 'checked="checked" ';
    $main_content .= '>'.$vocation_name[$world_id][0][$char_vocation_key].'</td></tr>';
    }
    $main_content .= '</table></table></td>';
    }
    if(count($config['site']['newchar_towns'][$world_id]) > 1)
    {
    $main_content .= '<td><table class="TableContent" width="100%" ><tr class="Odd" valign="top"><td width="160"><br /><b>Select your city:</b></td><td><table class="TableContent" width="100%" >';
    foreach($config['site']['newchar_towns'][$world_id] as $town_id)
    {
    $main_content .= '<tr><td><input type="radio" name="newchartown" value="'.$town_id.'" ';
    if($newchar_town == $town_id)
    $main_content .= 'checked="checked" ';
    $main_content .= '>'.$towns_list[$world_id][$town_id].'</td></tr>';
    }
    $main_content .= '</table></table></td>';
    }
    if(count($config['site']['newchar_towns'][$world_id]) > 1 || count($config['site']['newchar_vocations'][$world_id]) > 1)
    $main_content .= '</tr></table></div>';
    $main_content .= '</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="index.php?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($newchar_name))
    $newchar_errors[] = 'Please enter a name for your character!';
    if(empty($newchar_sex) && $newchar_sex != "0")
    $newchar_errors[] = 'Please select the sex for your character!';
    if(count($config['site']['newchar_vocations'][$world_id]) > 1)
    {
    if(empty($newchar_vocation))
    $newchar_errors[] = 'Please select a vocation for your character.';
    }
    else
    $newchar_vocation = $config['site']['newchar_vocations'][$world_id][0];
    if(count($config['site']['newchar_towns'][$world_id]) > 1)
    {
    if(empty($newchar_town))
    $newchar_errors[] = 'Please select a town for your character.';
    }
    else
    $newchar_town = $config['site']['newchar_towns'][$world_id][0];
    if(empty($newchar_errors))
    {
    if(!check_name_new_char($newchar_name))
    $newchar_errors[] = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.';
    if($newchar_sex != 1 && $newchar_sex != "0")
    $newchar_errors[] = 'Sex must be equal <b>0 (female)</b> or <b>1 (male)</b>.';
    if(!in_array($newchar_town, $config['site']['newchar_towns'][$world_id]))
    $newchar_errors[] = 'Please select valid town.';
    if(count($config['site']['newchar_vocations'][$world_id]) > 1)
    {
    $newchar_vocation_check = FALSE;
    foreach($config['site']['newchar_vocations'][$world_id] as $char_vocation_key => $sample_char)
    if($newchar_vocation == $char_vocation_key)
    $newchar_vocation_check = TRUE;
    if(!$newchar_vocation_check)
    $newchar_errors[] = 'Unknown vocation. Please fill in form again.';
    }
    else
    $newchar_vocation = 0;
    }
    if(empty($newchar_errors))
    {
    $check_name_in_database = $ots->createObject('Player');
    $check_name_in_database->find($newchar_name);
    if($check_name_in_database->isLoaded())
    $newchar_errors[] .= 'This name is already used. Please choose another name!';
    $number_of_players_on_account = $account_logged->getPlayersList()->count();
    if($number_of_players_on_account >= $config['site']['max_players_per_account'])
    $newchar_errors[] .= 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.$config['site']['max_players_per_account'].')</b>!';
    }
    if(empty($newchar_errors))
    {
    $char_to_copy_name = $config['site']['newchar_vocations'][$world_id][$newchar_vocation];
    $char_to_copy = new OTS_Player();
    $char_to_copy->find($char_to_copy_name);
    if(!$char_to_copy->isLoaded())
    $newchar_errors[] .= 'Wrong characters configuration. Try again or contact with admin. ADMIN: Edit file config/config.php and set valid characters to copy names. Character to copy'.$char_to_copy_name.'</b> doesn\'t exist.';
    }
    if(empty($newchar_errors))
    {
    if($newchar_sex == "0")
    $char_to_copy->setLookType(136);
    $player = $ots->createObject('Player');
    $player->setName($newchar_name);
    $player->setAccount($account_logged);
    $player->setGroup($char_to_copy->getGroup());
    $player->setSex($newchar_sex);
    $player->setVocation($char_to_copy->getVocation());
    $player->setConditions($char_to_copy->getConditions());
    $player->setRank($char_to_copy->getRank());
    $player->setLookAddons($char_to_copy->getLookAddons());
    $player->setTownId($newchar_town);
    $player->setExperience($char_to_copy->getExperience());
    $player->setLevel($char_to_copy->getLevel());
    $player->setMagLevel($char_to_copy->getMagLevel());
    $player->setHealth($char_to_copy->getHealth());
    $player->setHealthMax($char_to_copy->getHealthMax());
    $player->setMana($char_to_copy->getMana());
    $player->setManaMax($char_to_copy->getManaMax());
    $player->setManaSpent($char_to_copy->getManaSpent());
    $player->setSoul($char_to_copy->getSoul());
    $player->setDirection($char_to_copy->getDirection());
    $player->setLookBody($char_to_copy->getLookBody());
    $player->setLookFeet($char_to_copy->getLookFeet());
    $player->setLookHead($char_to_copy->getLookHead());
    $player->setLookLegs($char_to_copy->getLookLegs());
    $player->setLookType($char_to_copy->getLookType());
    $player->setCap($char_to_copy->getCap());
    $player->setPosX(0);
    $player->setPosY(0);
    $player->setPosZ(0);
    $player->setLossExperience($char_to_copy->getLossExperience());
    $player->setLossMana($char_to_copy->getLossMana());
    $player->setLossSkills($char_to_copy->getLossSkills());
    $player->setLossItems($char_to_copy->getLossItems());
    $player->save();
    unset($player);
    $player = $ots->createObject('Player');
    $player->find($newchar_name);
    if($player->isLoaded())
    {
    $player->setCustomField('world_id', (int) $world_id);
    $player->setSkill(0,$char_to_copy->getSkill(0));
    $player->setSkill(1,$char_to_copy->getSkill(1));
    $player->setSkill(2,$char_to_copy->getSkill(2));
    $player->setSkill(3,$char_to_copy->getSkill(3));
    $player->setSkill(4,$char_to_copy->getSkill(4));
    $player->setSkill(5,$char_to_copy->getSkill(5));
    $player->setSkill(6,$char_to_copy->getSkill(6));
    $player->save();
    $loaded_items_to_copy = $SQL->query("SELECT * FROM player_items WHERE player_id = ".$char_to_copy->getId()."");
    foreach($loaded_items_to_copy as $save_item)
    $SQL->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', '".$save_item['attributes']."');");
    $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" >Character Created</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>The character <b>'.$newchar_name.'</b> has been created.<br />Please select the outfit when you log in for the first time.<br /><br /><b>See you on '.$config['server']['serverName'].'!</b></td>
    </tr>
    </table>
    </div>
    </table>
    </div>
    </td>
    </tr>
    <br />
    <center>
    <table border="0" cellspacing="0" cellpadding="0" >
    <form action="index.php?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></center>';
    }
    else
    {
    echo "Error. Can\'t create character. Probably problem with database. Try again or contact with admin.";
    exit;
    }
    }
    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($newchar_errors as $newchar_error)
    $main_content .= '<li>'.$newchar_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 .= 'Please choose a name';
    if(count($config['site']['newchar_vocations'][$world_id]) > 1)
    $main_content .= ', vocation';
    $main_content .= ' and sex for your character. <br />In any case the name must not violate the naming conventions stated in the <a href="index.php?subtopic=tibiarules" target="_blank" >'.$config['server']['serverName'].' Rules</a>, or your character might get deleted or name locked.<br /><br /><form action="index.php?subtopic=accountmanagement&action=createcharacter" method="post" ><input type="hidden" name="world" value="'.$world_id.'" ><input type="hidden" name=savecharacter value="1" ><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" >Create 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 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:50%;" ><span >Name</td><td><span >Sex</td></tr><tr class="Odd" ><td><input id="newcharname" name="newcharname" onkeyup="checkName();" value="'.$newchar_name.'" size="30" maxlength="29" ><br /><font size="1" face="verdana,arial,helvetica"><div id="name_check">Please enter your character name.</div></font></td><td>';
    $main_content .= '<input type="radio" name="newcharsex" value="1" ';
    if($newchar_sex == 1)
    $main_content .= 'checked="checked" ';
    $main_content .= '>male<br />';
    $main_content .= '<input type="radio" name="newcharsex" value="0" ';
    if($newchar_sex == "0")
    $main_content .= 'checked="checked" ';
    $main_content .= '>female<br /></td></tr></table></div></div></table></div>';
    if(count($config['site']['newchar_towns'][$world_id]) > 1 || count($config['site']['newchar_vocations'][$world_id]) > 1)
    $main_content .= '<div class="InnerTableContainer" >  <table style="width:100%;" ><tr>';
    if(count($config['site']['newchar_vocations'][$world_id]) > 1)
    {
    $main_content .= '<td><table class="TableContent" width="100%" ><tr class="Odd" valign="top"><td width="160"><br /><b>Select your vocation:</b></td><td><table class="TableContent" width="100%" >';
    foreach($config['site']['newchar_vocations'][$world_id] as $char_vocation_key => $sample_char)
    {
    $main_content .= '<tr><td><input type="radio" name="newcharvocation" value="'.$char_vocation_key.'" ';
    if($newchar_vocation == $char_vocation_key)
    $main_content .= 'checked="checked" ';
    $main_content .= '>'.$vocation_name[$world_id][0][$char_vocation_key].'</td></tr>';
    }
    $main_content .= '</table></table></td>';
    }
    if(count($config['site']['newchar_towns'][$world_id]) > 1)
    {
    $main_content .= '<td><table class="TableContent" width="100%" ><tr class="Odd" valign="top"><td width="160"><br /><b>Select your city:</b></td><td><table class="TableContent" width="100%" >';
    foreach($config['site']['newchar_towns'][$world_id] as $town_id)
    {
    $main_content .= '<tr><td><input type="radio" name="newchartown" value="'.$town_id.'" ';
    if($newchar_town == $town_id)
    $main_content .= 'checked="checked" ';
    $main_content .= '>'.$towns_list[$world_id][$town_id].'</td></tr>';
    }
    $main_content .= '</table></table></td>';
    }
    if(count($config['site']['newchar_towns'][$world_id]) > 1 || count($config['site']['newchar_vocations'][$world_id]) > 1)
    $main_content .= '</tr></table></div>';
    $main_content .= '</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="index.php?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>';
    }
    }
    }
    }
    }
    ?>
    

  9. Systema de SHOP feito por mim

     

     

     

    -- ### CONFIG ###

    -- message send to player by script "type" (types you can check in "global.lua")

    SHOP_MSG_TYPE = 19

    -- time (in seconds) between connections to SQL database by shop script

    SQL_interval = 30

    -- ### END OF CONFIG ###

    function onThink(interval, lastExecution)

    local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")

    if(result_plr:getID() ~= -1) then

    while(true) do

    id = tonumber(result_plr:getDataInt("id"))

    action = tostring(result_plr:getDataString("action"))

    delete = tonumber(result_plr:getDataInt("delete_it"))

    cid = getCreatureByName(tostring(result_plr:getDataString("name")))

    if isPlayer(cid) == TRUE then

    local itemtogive_id = tonumber(result_plr:getDataInt("param1"))

    local itemtogive_count = tonumber(result_plr:getDataInt("param2"))

    local container_id = tonumber(result_plr:getDataInt("param3"))

    local container_count = tonumber(result_plr:getDataInt("param4"))

    local add_item_type = tostring(result_plr:getDataString("param5"))

    local add_item_name = tostring(result_plr:getDataString("param6"))

    local received_item = 0

    local full_weight = 0

    if add_item_type == 'container' then

    full_weight = getItemWeightById(itemtogive_id, 1)

    end

    local free_cap = getPlayerFreeCap(cid)

    if full_weight <= free_cap then

    if add_item_type == 'container' then

    local new_container = doCreateItemEx(container_id, 1)

    local iter = 0

    while iter ~= container_count do

    doAddContainerItem(new_container, itemtogive_id, itemtogive_count)

    iter = iter + 1

    end

    received_item = doPlayerAddItemEx(cid, new_container)

    else

    local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)

    received_item = doPlayerAddItemEx(cid, new_item)

    end

    if received_item == RETURNVALUE_NOERROR then

    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')

    db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")

    db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")

    doPlayerSave(cid)

    end

    end

    end

    if not(result_plr:next()) then

    break

    end

    end

    result_plr:free()

    end

    return TRUE

    end

     

     

    Mais algum erro para ser reparado para a prox versão?

     

    Deu este erro e ainda não ta chegando os itens

     

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SHOP_MSG_TYPE = 19 -- time (in seconds) between connections to SQL database by ' at line 3

  10. Vai na pasta do seu ot

     

    data/globaladvents/scripts

    copia um arquivo qualquer renomeia pra shop

     

    adiciona o codigo la de cima que vitor postou, fexa e salva

     

    depois va em globaladvents.xml e add isso

     

    <globalevent name="shop" interval="10" event="script" value="shop.lua"/>

  11. Quero mudar isso para aparecer os dias de premium ao envés de VIP

     

    if(!$account_logged->getCustomField("vip_time"))

    $account_status = '<b>Free Account</b><br /><small>You do not have VIP <i>!</i></small>';

    else

    $account_status = '<b>VIP Account</b><br /><small>(Your premium time expired at '.date("M j Y, H:i:s", $account_logged->getCustomField("vip_time")).' CEST)</small>';

  12. Perfeitamente funcionando...

    Vlw Victor, vc é o cara!

     

    470vS.jpg

     

     

     

    Não querendo abusar muito mais já abusando...tem como vc fazer uma lista de pontos pra selecionar?

     

    Funciona em 9.83 e em 8.5?

     

     

    O meu é 9.81 rodando perfeitamente!

  13. Qual website utilizado ( versão )?

     

    O que vc acabou de postar, eu tinha baixado o anterior e estava com 2 problemas, então vc postou o novo e eu baixei pra ver se estava corrigido, mais corrigiu apenas 1.

     

    outra coisa, ná parte de selecionar os pontos tbm tá sem a caixa de selecionar a quantidade de pontos, tem que colocar manualmente..

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...