PDA

View Full Version : Alert System Help



Epanel
21-05-2007, 08:58 AM
Ok i have done up a alert system ok its llike dis:


This is what is in part! of the panel Were u recive the alert ok now i want it when u send a alert it shows up only ONCE on dis one it shows up all da time help?


$showit = mysql_query("SELECT * FROM `ipalert`");
while($row = mysql_fetch_array($showit)){
$ip = $row["ip"];
$message = $row["message"];
$djname = $row["djname"];
}
if ($_SERVER["REMOTE_ADDR"] == $ip){
echo "<script>
alert ('Moderator $djname Says: $message\')
</script>";

Drompo
21-05-2007, 03:33 PM
$showit = mysql_query("SELECT * FROM `ipalert`");
while($row = mysql_fetch_array($showit)){
$ip = $row["ip"];
$message = $row["message"];
$djname = $row["djname"];
}
if ($_SERVER["REMOTE_ADDR"] == $ip){
echo "<script>
alert ('Moderator $djname Says: $message\')
</script>";
mysql_query("DELETE FROM `ipalert` WHERE `ip` = '$ip'2) or die ("Error");
}

Invent
21-05-2007, 03:38 PM
$showit = mysql_query("SELECT * FROM `ipalert`");
while($row = mysql_fetch_array($showit)){
$ip = $row["ip"];
$message = $row["message"];
$djname = $row["djname"];
}
if ($_SERVER["REMOTE_ADDR"] == $ip){
echo "<script>
alert ('Moderator ". $djname ." Says: ". $message ."')
</script>";
mysql_query("DELETE FROM `ipalert` WHERE `ip` = '$ip'2") or die ("Error");
}


Reina's code had an error, so this is the fixed version :)

Drompo
21-05-2007, 03:41 PM
$showit = mysql_query("SELECT * FROM `ipalert`");
while($row = mysql_fetch_array($showit)){
$ip = $row["ip"];
$message = $row["message"];
$djname = $row["djname"];
}
if ($_SERVER["REMOTE_ADDR"] == $ip){
echo "<script>
alert ('Moderator ". $djname ." Says: ". $message ."')
</script>";
mysql_query("DELETE FROM `ipalert` WHERE `ip` = '$ip'") or die ("Error");
}
Invents Code had an error, Here is the fixed Version
Enjoy

Invent
21-05-2007, 03:45 PM
Ah it did, good spotting :p

+Rep for no reason. :p

Drompo
21-05-2007, 03:54 PM
Ah it did, good spotting :p

+Rep for no reason. :p

Why thank you simon

QuickScriptz
21-05-2007, 05:16 PM
Just a thought but shouldn't you delete the alerts by an ID (Primary Key) instead of by IP? Because if say you send 2 alerts to the same user then they both get deleted but only one is shown... wouldn't a mysql look work better?

EDIT: Wait nvm - you did that ;) my bad

Want to hide these adverts? Register an account for free!