Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2007
    Posts
    79
    Tokens
    0

    Default Alert System Help

    Ok i have done up a alert system ok its llike dis:

    PHP Code:
    This is what is in partof 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>"

    I NEED TO GIVE REP TO
    Heinous

    i found a cool Web site ts Stuff
    Click it


  2. #2
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    PHP Code:
    $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");

    Last edited by Drompo; 21-05-2007 at 03:35 PM.


  3. #3
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    PHP Code:
    $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

  4. #4
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    PHP Code:
    $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


  5. #5
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Ah it did, good spotting :p

    +Rep for no reason. :p

  6. #6
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    Quote Originally Posted by Invent View Post
    Ah it did, good spotting :p

    +Rep for no reason. :p
    Why thank you simon


  7. #7
    Join Date
    Jan 2007
    Location
    Canada eh?
    Posts
    766
    Tokens
    75

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •