我有一些错误:md100sms.php没有在硬币列中向数据库添加硬币
<?PHP
if(isset($_GET['do']) && $_GET['do']=="aktivieren" && isset($_GET['hash']) && !empty($_GET['hash'])) {
echo '<div class="main main_top">
Information
</div>
<div class="main main_content">';
if(strlen($_GET['hash'])==32 && $_GET['hash']!=1 && checkAnum($_GET['hash'])) {
$cmdHash = "SELECT id,web_aktiviert FROM account.account WHERE web_aktiviert='".$_GET['hash']."' AND web_aktiviert!='1' LIMIT 1;";
$qryHash = mysql_query($cmdHash,$sqlServ);
if(mysql_num_rows($qryHash)) {
$getData = mysql_fetch_object($qryHash);
$userUpdate = "UPDATE account.account SET web_aktiviert='1',status='OK' WHERE id='".$getData->id."' LIMIT 1;";
$updateQry = mysql_query($userUpdate,$sqlServ);
if($updateQry) {
echo'Ihr Account wurde erfolgreich aktiviert. Sie können sich nun einloggen.';
echo'<meta http-equiv="refresh" content="1; URL=index.php?s=login"> ';
}
else {
echo'Query fehlgeschlagen. Bitte einen Admin kontaktieren!';
}
}
else {
echo'Es wurde kein passender Eintrag gefunden. Aktivierung fehlgeschlagen.';
}
}
else {
echo'Kein valider Hash!';
}
echo '</div>
<div class="main main_bottom">
</div>';
}
if(!empty($_SESSION['user_id']))
{
echo '<div id="con-top" class="post-top1">Login</div>
<div id="con-mid">
';
echo'<ul style="margin-top:0;">';
if($_SESSION['user_admin']>0) {
echo'<li><a href="index.php?s=admin">Administrar</a></li>';
}
if($_SESSION['user_admin']>=0) {
echo'<a href="index.php?s=itemshop"><input type="submit" class="btn" value="ItemShop" name="submit"></a> ';
echo'<a href="index.php?s=spenden"><input type="submit" class="btn" value="Comprar Moedas" name="submit"></a> ';
echo'<a href="index.php?s=charaktere"><input type="submit" class="btn" value="Personagens" name="submit"></a> ';
echo'<a href="index.php?s=passwort"><input type="submit" class="btn" value="Alterar Dados" name="submit"></a> ';
echo'<a href="index.php?s=Vote"><input type="submit" class="btn" value="Votar no Servidor" name="submit"></a> ';
}
$cmdStats = "SELECT SUM( player.playtime ) AS ges_spielzeit, COUNT( * ) AS ges_chars, player_index.empire
FROM player.player
INNER JOIN player.player_index ON player_index.id = player.account_id
WHERE player.account_id = '".$_SESSION['user_id']."'
LIMIT 1";
$qryStats = mysql_query($cmdStats,$sqlServ);
$getStats = mysql_fetch_object($qryStats);
if(!empty($getStats->empire)) {
$reich = '<img src="img/reiche/'.$getStats->empire.'.png" title="Reino" alt="Reino"/>';
}
else {
$reich='Conta sem reino.';
}
echo'<table>
<tr>
<th class="topLine">ID:</th>
<td class="tdunkel">'.$_SESSION['user_name'].'</td>
</tr>
<tr>
<th class="topLine">Reino:</th>
<td class="thell">'.$reich.'</td>
</tr>
<tr>
<th class="topLine">Personagens:</th>
<td class="tdunkel">'.$getStats->ges_chars.'</td>
</tr>
<tr>
<th class="topLine">Tempo de Jogo:</th>
<td class="thell">'.$getStats->ges_spielzeit.' Minutos</td>
</tr>';
$sqlAcc = "SELECT account.social_id AS loeschcode, safebox.password AS lagerpw
FROM account.account
LEFT JOIN player.safebox
ON account.id=safebox.account_id
WHERE account.id='".$_SESSION['user_id']."'";
$qryAcc = mysql_query($sqlAcc) or die(mysql_error());
$getAcc = mysql_fetch_object($qryAcc);
if(empty($getAcc->lagerpw)) $getAcc->lagerpw = '000000';
echo'<tr style="margin-bottom:0;">
<th class="topLine">Codigo Personagem:</th>
<td class="tdunkel">'.$getAcc->loeschcode.'</td>
</tr>
</table>
</div>
<div id="con-bot"></div> </div>';
}
else
{
?>
<div id="con-top" class="post-top1">Entrar</div>
<div id="con-mid">
<form action="index.php?s=login" method="POST" class="login">
<input type="text" class="bar" name="userid" onFocus="if(this.value=='Oseuid') this.value=''" onBlur="if(this.value=='')this.value='Oseuid'" value="Oseuid">
<input type="password" class="bar" name="userpass" onFocus="if(this.value=='Passwortpasswort') this.value=''" onBlur="if(this.value=='')this.value='Passwortpasswort'" value="Passwortpasswort">
<input type="submit" class="btn" value="LOGIN" name="submit">
<span><br>
<a href="index.php?s=register">Criar um nova conta!</a><br />
<a href="index.php?s=lostpw">Esqueceste a senha?</a>
</span>
</form>
</div>
<div id="con-bot"></div> </div>
<?PHP
}
?>
md100sms.php
<div id="con-top" class="post-top1">Moedas Automaticas - 100 Moedas</div>
<div id="con-mid">
<font color="green">Moedas compradas com sucesso.<br>
Foram adicionadas <font color="white">100</font> Moedas à tua conta.</font>
<?PHP
$sqlCmd = sprintf("UPDATE account.account SET coins = coins +100 WHERE id = '.$_SESSION['user_id'].'")
?>
</div>
<div id="con-bot"></div></div>
当我转到md100sms.php时,页面显示:Successful added coins, 100 coins.
但是当我在数据库中查看我的帐户时,没有添加任何硬币。
答案 0 :(得分:0)
尝试将session_start();
添加到页面顶部。
另外,检查查询的引号。尝试:
$sqlCmd = sprintf("UPDATE account.account SET coins = coins + 100 WHERE id = '".$_SESSION['user_id']."'");