Ajuda com type SELECT e banco de dados

0 respostas
K

Nao sei se estou postando certo pois sou novo aqui .....

bom tenho essse codigo em php e tpl

site_settings.php
<?php

	session_start();

	include_once( "Addons/TemplatePower.php" );

	$tpl = new TemplatePower( "Template/site_settings.tpl" );
	
	$tpl->assignInclude( "menu", "Template/menu.tpl" );
	$tpl->assignInclude( "header", "Template/header.tpl" );
	$tpl->assignInclude( "blocks", "Template/blocks.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';
		
	if( $User->LoggedIn == true )
	{
	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( isset( $_GET['Do'] ) && $_GET['Do'] == 'news_submit' )
		{
		mysql_query("INSERT INTO t_latest_news (a_user, a_date, a_news, a_title)
		VALUES ('". Sanitize( $_POST['yourname'] ) . "', '". Sanitize( $_POST['date'] ) . "', '". Sanitize( $_POST['news'] ) . "', '". Sanitize( $_POST['title'] ) . "')
		");
		
		$tpl->newBlock('success_news');
		}

		if( isset( $_GET['Do'] ) && $_GET['Do'] == 'site_submit' )
		{
		mysql_query("UPDATE t_settings SET 
		a_server_name='". Sanitize( $_POST['ServerName'] ) . "',
		a_page_title='". Sanitize( $_POST['WebsiteTitle'] ) . "',
		a_forum_link='". Sanitize( $_POST['ForumLink'] ) . "',
		a_contact_name='". Sanitize( $_POST['ContactName'] ) . "',
		a_contact_email='". Sanitize( $_POST['ContactEmail'] ) . "',
		a_contact_skype='". Sanitize( $_POST['ContactSkype'] ) . "',
		a_contact_messenger='". Sanitize( $_POST['ContactMsn'] ) . "',
		a_contact_icq='". Sanitize( $_POST['ContactIcq'] ) . "',
		a_guest_notice_1='". Sanitize( $_POST['GuestNotice1'] ) . "',
		a_guest_notice_2='". Sanitize( $_POST['GuestNotice2'] ) . "',
		a_member_notice_1='". Sanitize( $_POST['MemberNotice1'] ) . "',
		a_member_notice_2='". Sanitize( $_POST['MemberNotice2'] ) . "',
		a_login_server_ip='". Sanitize( $_POST['LoginServerIp'] ) . "',
		a_login_server_port='". Sanitize( $_POST['LoginServerPort'] ) . "',
		a_messenger_server_ip='". Sanitize( $_POST['MessengerServerIp'] ) . "',
		a_messenger_server_port='". Sanitize( $_POST['MessengerServerPort'] ) . "',
		a_helper_server_ip='". Sanitize( $_POST['HelperServerIp'] ) . "',
		a_helper_server_port='". Sanitize( $_POST['HelperServerPort'] ) . "',
		a_connector_server_ip='". Sanitize( $_POST['ConnectorServerIp'] ) . "',
		a_connector_server_port='". Sanitize( $_POST['ConnectorServerPort'] ) . "',		
		a_game_server_ip='". Sanitize( $_POST['GameServerIp'] ) . "',
		a_game_server_port='". Sanitize( $_POST['GameServerPort'] ) . "',
		a_style='". Sanitize( $_POST['style'] ) . "',
		a_paypal_email='". Sanitize( $_POST['paypalemail'] ) . "',
		a_currency='". Sanitize( $_POST['currency'] ) . "',
		a_donation_amount1='". Sanitize( $_POST['donation1'] ) . "',
		a_donation_amount2='". Sanitize( $_POST['donation2'] ) . "',
		a_donation_amount3='". Sanitize( $_POST['donation3'] ) . "',
		a_donation_amount4='". Sanitize( $_POST['donation4'] ) . "'
		WHERE a_index = 1");
		
		$tpl->newBlock('success');
		} 
		
		if( isset( $_GET['Do'] ) && $_GET['Do'] == 'addnews' )
		{
		// Add News page
		$tpl->newBlock('addnews');

		}
		
		// Get News row from db
		if( isset( $_GET['Do'] ) && $_GET['Do'] == 'edit_news' )
		{
		$tpl->newBlock('edit_news');
		mysql_select_db( $SiteSQL["config-database_site"] , $Site_sqlcon) or die( mysql_error() );	
		$news_edit = mysql_query("SELECT * FROM t_latest_news WHERE a_index = '". Sanitize( $_POST['newsid'] ) . "' ");
		while($news_edit1 = mysql_fetch_array( $news_edit )) 
		{
		$tpl->Assign('a_index' ,  htmlspecialchars( $news_edit1['a_index'] ) );
		$tpl->Assign('a_user' ,  htmlspecialchars( $news_edit1['a_user'] ) );
		$tpl->Assign('a_date' ,  htmlspecialchars( $news_edit1['a_date'] ) );
		$tpl->Assign('a_news' ,  htmlspecialchars( $news_edit1['a_news'] ) );
		$tpl->Assign('a_title' ,  htmlspecialchars( $news_edit1['a_title'] ) );
		}}
		
		
		if( isset( $_GET['Do'] ) && $_GET['Do'] == 'site_settings' )
		{
		if($admin_checker1['a_admin'] == "10")
		{
		$tpl->newBlock('admin');


		$site_settings = mysql_query("SELECT * FROM t_settings");
		while($site_settings1 = mysql_fetch_array( $site_settings )) 
		{
		$tpl->Assign('ServerName' ,  htmlspecialchars( $site_settings1['a_server_name'] ) );
		$tpl->Assign('WebsiteTitle' ,  htmlspecialchars( $site_settings1['a_page_title'] ) );
		$tpl->Assign('ForumLink' ,  htmlspecialchars( $site_settings1['a_forum_link'] ) );
		$tpl->Assign('ContactName' ,  htmlspecialchars( $site_settings1['a_contact_name'] ) );
		$tpl->Assign('ContactEmail' ,  htmlspecialchars( $site_settings1['a_contact_email'] ) );
		$tpl->Assign('ContactSkype' ,  htmlspecialchars( $site_settings1['a_contact_skype'] ) );
		$tpl->Assign('ContactMsn' ,  htmlspecialchars( $site_settings1['a_contact_messenger'] ) );
		$tpl->Assign('ContactIcq' ,  htmlspecialchars( $site_settings1['a_contact_icq'] ) );
		$tpl->Assign('GuestNotice1' ,  htmlspecialchars( $site_settings1['a_guest_notice_1'] ) );
		$tpl->Assign('GuestNotice2' ,  htmlspecialchars( $site_settings1['a_guest_notice_2'] ) );
		$tpl->Assign('MemberNotice1' ,  htmlspecialchars( $site_settings1['a_member_notice_1'] ) );
		$tpl->Assign('MemberNotice2' ,  htmlspecialchars( $site_settings1['a_member_notice_2'] ) );
		$tpl->Assign('LoginServerIp' ,  htmlspecialchars( $site_settings1['a_login_server_ip'] ) );
		$tpl->Assign('LoginServerPort' ,  htmlspecialchars( $site_settings1['a_login_server_port'] ) );
		$tpl->Assign('MessengerServerIp' ,  htmlspecialchars( $site_settings1['a_messenger_server_ip'] ) );
		$tpl->Assign('MessengerServerPort' ,  htmlspecialchars( $site_settings1['a_messenger_server_port'] ) );		
		$tpl->Assign('HelperServerIp' ,  htmlspecialchars( $site_settings1['a_helper_server_ip'] ) );
		$tpl->Assign('HelperServerPort' ,  htmlspecialchars( $site_settings1['a_helper_server_port'] ) );		
		$tpl->Assign('HelperServerIp' ,  htmlspecialchars( $site_settings1['a_helper_server_ip'] ) );
		$tpl->Assign('HelperServerPort' ,  htmlspecialchars( $site_settings1['a_helper_server_port'] ) );			
		$tpl->Assign('ConnectorServerIp' ,  htmlspecialchars( $site_settings1['a_connector_server_ip'] ) );
		$tpl->Assign('ConnectorServerPort' ,  htmlspecialchars( $site_settings1['a_connector_server_port'] ) );		
		$tpl->Assign('GameServerIp' ,  htmlspecialchars( $site_settings1['a_game_server_ip'] ) );
		$tpl->Assign('GameServerPort' ,  htmlspecialchars( $site_settings1['a_game_server_port'] ) );
		$tpl->Assign('paypalemail' ,  htmlspecialchars( $site_settings1['a_paypal_email'] ) );
		$tpl->Assign('currency' ,  htmlspecialchars( $site_settings1['a_currency'] ) );
		$tpl->Assign('donation1' ,  htmlspecialchars( $site_settings1['a_donation_amount1'] ) );
		$tpl->Assign('donation2' ,  htmlspecialchars( $site_settings1['a_donation_amount2'] ) );
		$tpl->Assign('donation3' ,  htmlspecialchars( $site_settings1['a_donation_amount3'] ) );
		$tpl->Assign('donation4' ,  htmlspecialchars( $site_settings1['a_donation_amount4'] ) );
		}}
		}


		if( isset( $_GET['Do'] ) && $_GET['Do'] == 'admin_settings' )
		{
		if($admin_checker1['a_admin'] == "10")
		{
		$tpl->newBlock('admin_settings');
		mysql_select_db( $SiteSQL["config-database_db"] , $Site_sqlcon) or die( mysql_error() );	
		$get_all_chars = mysql_query("SELECT a_user_index, a_nick, a_admin FROM t_characters WHERE a_admin <> '0' ");
		while($get_all_chars1 = mysql_fetch_array( $get_all_chars )) 
		{
		$tpl->newBlock('all_chars_loop');
		$tpl->Assign('a_index1' ,  htmlspecialchars( $get_all_chars1['a_user_index'] ) );
		$tpl->Assign('a_name1' ,  htmlspecialchars( $get_all_chars1['a_nick'] ) );
		$tpl->Assign('a_admin1' ,  htmlspecialchars( $get_all_chars1['a_admin'] ) );	
		}

_______________________ aqui onde modifiquei __________________

		mysql_select_db( $SiteSQL["config-database_auth"] , $Site_sqlcon) or die( mysql_error() );	
		$get_all_chars = mysql_query("SELECT user_id, cash, email FROM bg_user WHERE cash <> '0' ");
		while($get_all_chars1 = mysql_fetch_array( $get_all_chars )) 
		{
		$tpl->newBlock('all_chars_cash');
		$tpl->Assign('user_id' ,  htmlspecialchars( $get_all_chars1['user_id'] ) );
		$tpl->Assign('cash' ,  htmlspecialchars( $get_all_chars1['cash'] ) );	
		$tpl->Assign('email' ,  htmlspecialchars( $get_all_chars1['email'] ) );
		}

_______________________ ate aqui __________________


		mysql_select_db( $SiteSQL["config-database_site"] , $Site_sqlcon) or die( mysql_error() );	
		$get_all_charsa = mysql_query("SELECT a_account_index, a_admin FROM t_user_admin WHERE a_admin = '10' ");
		while($get_all_charsa1 = mysql_fetch_array( $get_all_charsa )) 
		{
		
		$a_account_index = $get_all_charsa1['a_account_index'];
		mysql_select_db( $SiteSQL["config-database_auth"] , $Site_sqlcon) or die( mysql_error() );	
		$get_all_charsb = mysql_query("SELECT user_id FROM bg_user WHERE user_code = $a_account_index ");
		while($get_all_charsb1 = mysql_fetch_array( $get_all_charsb )) 
		{
		$tpl->newBlock('all_chars1_loop');
		$tpl->Assign('a_index2' ,  htmlspecialchars( $get_all_charsa1['a_account_index'] ) );
		$tpl->Assign('a_name2' ,  htmlspecialchars( $get_all_charsb1['user_id'] ) );
		$tpl->Assign('a_admin2' ,  htmlspecialchars( $get_all_charsa1['a_admin'] ) );	
		}
		}}}

		if( isset( $_GET['Do'] ) && $_GET['Do'] == 'game_admin_add' )
		{
		if($admin_checker1['a_admin'] == "10")
		{
		$tpl->newBlock('game_admin_add');	
		mysql_select_db( $SiteSQL["config-database_db"] , $Site_sqlcon) or die( mysql_error() );	
		$update_admin = mysql_query("UPDATE t_characters SET a_admin = 10 WHERE a_name = '". Sanitize( $_POST['game_admin_add'] ) . "' ");

		}}

_______________________ aqui onde modifiquei __________________
		
		if( isset( $_GET['Do'] ) && $_GET['Do'] == 'game_add_cash' )
		{
		if($admin_checker1['a_admin'] == "10")
		{
		$tpl->newBlock('game_add_cash');	
		mysql_select_db( $SiteSQL["config-database_auth"] , $Site_sqlcon) or die( mysql_error() );	
		$update_admin = mysql_query("UPDATE bg_user SET cash = (10000+cash) WHERE user_id = '". Sanitize( $_POST['game_add_cash'] ) . "' ");
	
	
		}}

_______________________ ate aqui __________________
		
		if( isset( $_GET['Do'] ) && $_GET['Do'] == 'site_admin_add' )
		{
		if($admin_checker1['a_admin'] == "10")
		{
		$tpl->newBlock('site_admin_add');	
		mysql_select_db( $SiteSQL["config-database_auth"] , $Site_sqlcon) or die( mysql_error() );
		$get_ac_id = mysql_query("SELECT user_code FROM bg_user WHERE user_id = '". Sanitize( $_POST['site_admin_add'] ) . "' ");
		while($ac_id1 = mysql_fetch_array( $get_ac_id )) 
		{
		$ACC1_ID = $ac_id1['user_code'];
		mysql_select_db( $SiteSQL["config-database_site"] , $Site_sqlcon) or die( mysql_error() );	
		$update_admin1 = mysql_query("INSERT INTO t_user_admin (a_account_index, a_admin) VALUES ($ACC1_ID, '10')");
		}}}

	}
	if(mysql_num_rows($admin_checker) == 0) {
	$tpl->newBlock('nothaha');
	}} else {
	$tpl->newBlock('error');
			}
	
	$tpl->printToScreen();
	
?>
agora em tpl a parte que interessa site_settings.tpl
<span class="color">Adicionar 10k de cash para algum usuario:</span><br />
				<table width="60%" border="0" cellspacing="0"><tr><td>
				<form method="post" action="site_settings.php?Do=game_add_cash">
				ID da conta: <input class="input" type="text" name="game_add_cash" /> 
				
				
							<td width="90%">
							<select name="quantidade">
							<option>5000</option>
							<option>10000</option>
							<option>15000</option>
							<option>20000</option>
							</select> - Quantidade de cash !
				<input type="submit" class="button" value="Adicionar" />
							</td>
				
				</form></td></tr></table><br /><br />

____________________________________________

Queria saber como criar uma variavel nos valores do option na parte do