Okay, To start off, my script is running without any errors displaying, but a big problem is It isn’t displaying the alert to people who havn’t been notified, on the row where my ip is, It is “0” for notified, but… it still only displays the else…
Here is the code. Can anyone explain why it isn’t displaying the alert to people with the value 0 in the asked row.
[code=php]<?php
// notify new forum hits that arcade highscores is a member only feature.
include ‘../index/start.php’;
//$db is in start, it is the database connection.
//$IP is also there. it is “$IP = $_SERVER[‘REMOTE_ADDR’];”.
$rowcheck=$db->query(“SELECT * FROM visitors WHERE ip='{$IP}’ LIMIT 1″);
while ($notified=$db->fetch_row($rowcheck)) {
// got the row, now check if it has been notified.
if ($notified[‘asked’] = 0) {
echo ‘<script type=”text/javascript”>
<!–
var answer = confirm (“Highscores in the arcade will only be recorded for members! Do you want to register?”)
if (answer)
alert (“Thats Great, Taking you to register page now..”)
window.location=”http://weconncet.co.cc/forum/index.php?action=register”
else
alert (“Okay. This will not pop up again. If you decided to register, just press register.”)
// –>
</script>’;
$db->query(“UPDATE visitors SET asked=1 WHERE visid={$notified[‘visid’]}”);
}
else if (($notified[‘asked’] > 1) || ($notified[‘asked’] < 0)) {
// Something is wrong, fix it and refresh.
$db->query(“UPDATE visitors SET asked=0 WHERE visid={$notified[‘visid’]}”);
$where = $_SERVER[‘REQUEST_URI’];
echo ‘ERROR! – A unexplainable error has occured with the database, The error has been repaired. Reloading…’;
header( “refresh:1;url=$where” );
}
else {
//if this displays they must already be notified.
echo ‘Already notifed.(Content is displayed purely for debugging.)’;
}
}
?>
I can’t figure it out.. Help would be appriciated, Also, I’m 17 and still learning, so if you have any improvements for other parts, please share them. Thank you.