Bom pessoal to aqui algumas horas desesperado querendo aplicar esse codigo aqui: Agora o codigo php: <?php
session_start();
include_once( "Addons/TemplatePower.php" );
$tpl = new TemplatePower( "Template/index.tpl" );
$tpl->assignInclude( "menu", "Template/menu.tpl" );
$tpl->assignInclude( "header", "Template/header.tpl" );
$tpl->assignInclude( "blocks", "Template/blocks.tpl" );
$tpl->assignInclude( "news", "Template/news.tpl" );
$tpl->assignInclude( "footer", "Template/footer.tpl" );
$tpl->prepare();
include 'Site_Settings/Configuration.php';
include 'Addons/Classes.php';
include 'Addons/Globals.php';
include 'Addons/addons.php';
//-----------------------------------------------------------------------//
//--------------------------[ START reset send error ]-------------------//
//-----------------------------------------------------------------------//
//---------------------------[ END reset send error ]-------------------//
if( $User->LoggedIn == true )
{
// fetch chars info
mysql_select_db( $SiteSQL["config-database_db"] , $Site_sqlcon) or die( mysql_error() );
$chars_info = mysql_query("SELECT a_index, a_user_index, a_nick, a_level, a_max_hp, a_str, a_dex, a_int, a_con, a_teach_complete, a_job, a_job2 FROM t_characters WHERE a_user_index = ". $User->ID ." AND a_deletedelay=0 ");
// Update Cash table
mysql_select_db( $SiteSQL["config-database_site"] , $Site_sqlcon) or die( mysql_error() );
$result_cash = mysql_query("SELECT * FROM t_user_cash WHERE a_account_index = ". $User->ID ."");
if(mysql_num_rows($result_cash) == 0) {
// No Entry found, Adding 'cash 0' to login index
mysql_query("INSERT INTO t_user_cash (a_account_index, a_cash) VALUES (". $User->ID .", '0')");
}
// COMEÇA AQUI O QUE EU QUERO FAZER
if( isset( $_GET['Do'] ) && $_GET['Do'] == 'resetar' )
{
$tpl->newBlock('a_nick');
mysql_select_db( $SiteSQL["config-database_db"] , $Site_sqlcon) or die( mysql_error() );
$update_admin = mysql_query("UPDATE t_characters SET a_wearing = 0 WHERE a_nick = '". Sanitize( $_POST['a_nick'] ) . "' AND a_account_index = ". $User->ID ." ");
}
// TERMINA AQUI
else {
// Do Nothing
}
//-----------------------------------------------------------------------//
//--------------------------[ START HOME ]-------------------------------//
if( isset( $_GET['Do'] ) && $_GET['Do'] == 'account' )
{
$tpl->newBlock('userinfo');
// Account Settings
$tpl->Assign('UserID' , $account['user_code']);
$tpl->Assign('Username' , htmlspecialchars( $account['user_id'] ));
$tpl->newBlock('charinfo');
if( mysql_num_rows( $chars_info ) == 0 )
{
$tpl->newBlock('nochars');
}
else
{
while( $row = mysql_fetch_array( $chars_info ) )
{
$Info = new Info();
$Info->ClassJob( $row['a_job'] , $row['a_job2'] );
$ClassImage = 'Template/Img/' . $Info->Class . ".gif";
$tpl->newBlock('chars');
$tpl->Assign('Icon' , $ClassImage);
$tpl->Assign('Job' , $Info->Job );
$tpl->Assign('charid' , $row['a_index'] );
$tpl->Assign('Name' , htmlspecialchars( $row['a_nick'] ) );
$tpl->Assign('Level' , $row['a_level'] );
$tpl->Assign('maxhp' , htmlspecialchars( $row['a_max_hp'] ) );
$tpl->Assign('str' , htmlspecialchars( $row['a_str'] ) );
$tpl->Assign('dex' , htmlspecialchars( $row['a_dex'] ) );
$tpl->Assign('int' , htmlspecialchars( $row['a_int'] ) );
$tpl->Assign('con' , htmlspecialchars( $row['a_con'] ) );
}
}
}
//---------------------------[ END HOME ]--------------------------------//
//-----------------------------------------------------------------------//
//-----------------------------------------------------------------------//
//--------------------------[ START Commands ]---------------------------//
if( isset( $_GET['Do'] ) && $_GET['Do'] == 'commands' )
{
// List GM Commands
$tpl->newBlock('GameCommands');
}
//---------------------------[ END Commands ]----------------------------//
//-----------------------------------------------------------------------//
//-----------------------------------------------------------------------//
//--------------------------[ START NPC ID List ]------------------------//
if( isset( $_GET['Do'] ) && $_GET['Do'] == 'npc_ids' )
{
// List NPC IDs
$tpl->newBlock('npc_ids');
}
//---------------------------[ END NPC ID List ]-------------------------//
//-----------------------------------------------------------------------//
//-----------------------------------------------------------------------//
//--------------------------[ START Item ID List ]-----------------------//
if( isset( $_GET['Do'] ) && $_GET['Do'] == 'item_ids' )
{
// List NPC IDs
$tpl->newBlock('item_ids');
mysql_select_db( $SiteSQL["config-database_data"] , $Site_sqlcon) or die( mysql_error() );
$item_ids = mysql_query("SELECT a_index, a_name, a_descr, a_level FROM t_item ORDER BY a_index DESC");
while($item_ids1 = mysql_fetch_array( $item_ids ))
{
$tpl->newBlock('item_ids_loop');
$tpl->Assign('item_id' , $item_ids1['a_index'] );
$tpl->Assign('item_name' , $item_ids1['a_name'] );
$tpl->Assign('item_descr' , $item_ids1['a_descr'] );
$tpl->Assign('item_level' , $item_ids1['a_level'] );
}}
//---------------------------[ END Item ID List ]------------------------//
//-----------------------------------------------------------------------//
//-----------------------------------------------------------------------//
//--------------------------[ START News ]-------------------------------//
if( isset( $_GET['Do'] ) && $_GET['Do'] == 'home' )
{
mysql_select_db( $SiteSQL["config-database_site"] , $Site_sqlcon) or die( mysql_error() );
$news = mysql_query("SELECT * FROM t_latest_news ORDER BY a_index DESC LIMIT 5");
if(mysql_num_rows($news) == 0) {
// no news
} else {
while($news1 = mysql_fetch_array( $news ))
{
$tpl->newBlock('news_loop');
$tpl->Assign('news_title' , $news1['a_title'] );
$tpl->Assign('news_poster' , $news1['a_user'] );
$tpl->Assign('news_date' , $news1['a_date'] );
$tpl->Assign('news' , $news1['a_news'] );
$tpl->newBlock('news_buttons');
mysql_select_db( $SiteSQL["config-database_site"] , $Site_sqlcon) or die( mysql_error() );
$admin_checker = mysql_query("SELECT a_admin FROM t_user_admin WHERE a_account_index = ". $User->ID ."");
while($admin_checker1 = mysql_fetch_array( $admin_checker ))
{
if($admin_checker1['a_admin'] == "10")
{
$tpl->newBlock('newsedit_buttons');
$tpl->Assign('newsid' , $news1['a_index'] );
}
} //end admin
}}}
//---------------------------[ END News ]--------------------------------//
//-----------------------------------------------------------------------//
} else {
$tpl->newBlock('NotLoggedIn');
$tpl->Assign('ServerName' , $config["ServerName"]);
mysql_select_db( $SiteSQL["config-database_site"] , $Site_sqlcon) or die( mysql_error() );
$news = mysql_query("SELECT * FROM t_latest_news ORDER BY a_index DESC LIMIT 5");
if(mysql_num_rows($news) == 0) {
} else {
while($news1 = mysql_fetch_array( $news ))
{
$tpl->newBlock('news_loop');
$tpl->Assign('news_id' , $news1['a_index'] );
$tpl->Assign('news_title' , $news1['a_title'] );
$tpl->Assign('news_poster' , $news1['a_user'] );
$tpl->Assign('news_date' , $news1['a_date'] );
$tpl->Assign('news' , $news1['a_news'] );
$tpl->newBlock('news_buttons');
}
}
}
$tpl->printToScreen();
?>
então eu quero zerar a coluna a_wearing da tabela t_characters que o WHERE do query vai depender do ID do usuario (a_user_index) e do personagem (a_nick)
e quando apertar no botao de resetar ele faiz o comando para resetar como citei acima mais não consiguo....
tambem queria fazer com que quando fosse zerado essa coluna a pagina se recarrega com a mensagem "RESETADO COM SUCESSO" e caso o nome do personagem não fosse da conta da pessoa aparece "ESSE PERSONAGEM não E SEU"
<tr>
<td class="tu1">Problema ao logar a conta</td>
<td class="tu2"><font color=red>* Se você está tentando logar e aparece Send Error - Click em Resetar
<form method="post" action="index.php?Do=account">Nome do personagem: <input class="usuario" type="text" name="a_nick"> <input class="button3" type="submit" name="resetar" value="Resetar" /></form></font>
</td>
</tr> bom vlw ai pessoal espero que me ajudem não sei se expliquei certo