$username?=?$_GET["username"];?
創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),臺(tái)前企業(yè)網(wǎng)站建設(shè),臺(tái)前品牌網(wǎng)站建設(shè),網(wǎng)站定制,臺(tái)前網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,臺(tái)前網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。
$password?=?$_GET["password"];
date_default_timezone_set('Asia/Shanghai');
$con?=?mysql_connect('localhost',?'xauth',?'xauthpassword')?or?die(mysql_error());
mysql_query('set?names?utf8',?$con);
mysql_select_db('xauth',$con);
$sql?=?'select?*?from?accounts?where?肢薯playername="伏纖'?.?$username?.?'"';
$res?=?mysql_query($sql,?$con);
$row?=?mysql_fetch_assoc($res);
if?(empty($row))?{
echo?"not?exist";
exit();
}
if?($row['realpw']?!=?$password)?{
echo?"password?wrong";
exit();
}
$id?=?$row['id'];
$sql2?=?'select?*?from?sessions?where?accountid='?.?$id;
$res2?=?mysql_query($sql2,?$con);
$row2?=?mysql_fetch_assoc($res2);
if?(empty($row2))?{
//=====要放在這,不管有沒(méi)有都嘗試刪除accountid為$id的一行======
mysql_query('delete?from?sessions?where?accountid='.$id,$con);
mysql_query('insert?into?sessions?values?("'?.?$id?.?'","'?.?$_SERVER['REMOTE_ADDR']?.?'","'?.?date('Y-m-d?H:i:s')?.?'")',$con);
}?else?{
mysql_query('update?sessions?set?ipaddress="'?.?$_SERVER['REMOTE_ADDR']?.?'",?logintime='?.?date('Y-m-d?H:i:s')?.?'"?where?accountid='?.?歷廳者$id,$con);
}
echo?"success!";
這個(gè)并返 $sql="delete from news where id={'$id'}";
多了對(duì)單引號(hào)吧,應(yīng)該是$sql="delete from news where id={$id}";
建議調(diào)試的螞蔽喚悶凱時(shí)候,把sql打印出來(lái)檢查
//刪除是記錄是用sql語(yǔ)句,比如 delete from xxx(table) where id=1 刪除 id=1的雀腔記錄
//數(shù)碧賀據(jù)庫(kù)操作后,手動(dòng)關(guān)閉是頃慧衫好得習(xí)慣,不手動(dòng)關(guān)閉,php程序也會(huì)最后自動(dòng)關(guān)閉