<html>
<head>
<title>Coins</title>
</head>
<body>
<?
require '../inc/settings.php';

db_connect();

mysql_select_db ( 'player' );

if ( isset ( $_POST['nome'] ) ) {

$pass_tool = $_POST['pass'];

if ( $pass_tool != $passw_to ) {

echo "<div class='warning_box'>Password Errata</div>";

} else {

$nome = $_POST['nome'];
$monete = $_POST['monete'];

$query = mysql_query ( "SELECT * FROM player WHERE name='$nome'" );

if ( $check = mysql_fetch_array ( $query ) ) {
$account_id = $check ['account_id'];

mysql_select_db ( 'account' );

$trova = mysql_query ( "SELECT * FROM account WHERE id='$account_id'" );
$monete_chek = mysql_fetch_array($trova);
$monete_attuali = $monete_chek ['monete'];
$monete_totali = ($monete_attuali + $monete);
$querys = mysql_query ( "UPDATE account SET monete='$monete_totali' WHERE id='$account_id'" );

if ( $querys == true ) {
echo "<center>Hai Mandato <i>$monete</i> Monete All'Account di : <i>$nome</i>, In totale possiede : <i>$monete_totali</i> Monete</center>";

} else {

echo "<center>Errore Nell'Inserimento Delle Monete</center>";

}

} else {

echo "<center>$nome Non Trovato</center>";

}

}

} else {
?>
<form action='' method='POST'>
<table align='center'>
<tr>
<td>Nome Pg</td>
<td><input name='nome'></td>
</tr>
<tr>
<td>Monete</td>
<td><input name='monete'></td>
</tr>
<tr>
<td>Password Tool</td>
<td><input type='password' name='pass'></td>
</tr>
</table>
<center><input type="submit" value="Login"></center>
</form>
<? } ?>
</body>
</html>