unban script

i thought i would come here and see if you could help me.

i have a forum that i coded myself and i can ban users, but the script will not unban them, the code supplied below is the code that should update the mysql db row to allow the user access to the board. any help appreciated!

$datetime=date("y-m-d H:i:s");
$tblbanned=$prefix."banned";

if($datetime >= $rows['banend']){
	mysql_query("UPDATE $tblbanned SET `banned` = '0' WHERE username='$user'");
}

it is meant to be $rows[‘banend’] and not $rows[‘banned’]!

i guess banend is datetime field of ur “banned” MySQL table.

i personly don’t like to compare strings with ‘>=’, but your code looks ok, what does print_r($rows) return?

maybe a SQL based version instead of the if() solves the prob, try:
[php]$datetime=date(“y-m-d H:i:s”);
$tblbanned=$prefix.“banned”;

mysql_query(“UPDATE $tblbanned SET banned = ‘0’ WHERE username=’$user’ AND banend<=’$datetime’”);
[/php]

i fixed it, instead of >= it had to be >

thanks anyway

no prob

good 2 know that it’s working now.

Sponsor our Newsletter | Privacy Policy | Terms of Service