Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder Troy297's Avatar
    Join Date
    Oct 2006
    Location
    Earth
    Posts
    314
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Exclamation Code Not Working Properly

    Hey All,

    I am making a script that allows a DJ on a radio site, per say, to send a user a message by their ip. What it does is it when the dj uses the alert ip form it enters 3 details into a db; the dj who sent it(fromdj), the message for the user (message), and the ip address for it to be sent to (toip).

    So I use a script that says if the users ip is the same as the one in the db then display the message that corresponds. Except, the message is always displayed even if the users ip doesn't match and I can't figure out why! The code I use is below - any help would be great!

    PHP Code:
    <?php
    require('connect.php');
    $ipaddr $_SERVER['REMOTE_ADDR'];
    $result mysql_query("SELECT id, toip, message, fromdj FROM rp_alerts ORDER BY id ASC") or die(mysql_error());
    $row mysql_fetch_array($result);
    if(
    $ipaddr $row['toip']) {
    echo 
    '<script language="JavaScript" type="text/javascript">
    alert("DJ '
    .$row['fromdj'].' Says: '.$row['message'].'")</script>';
    }
    ?>
    <?php
    $result 
    mysql_query("DELETE FROM rp_alerts WHERE id = '$row[id]'") or die(mysql_error());
    ?>
    And fyi - the second part deletes the message once it has been displayed to the user.

    Any help is great! Thanks!
    Everyone hears what you say, friends listen to what you say, best friends listen to what you don't say.
    Radio DJ Panel v3 - It's Here!

  • #2
    Senior Coder koyama's Avatar
    Join Date
    Dec 2006
    Location
    Copenhagen, Denmark
    Posts
    1,246
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Maybe you are going to hate yourself

    Code:
    if($ipaddr == $row['toip'])

  • #3
    Regular Coder Troy297's Avatar
    Join Date
    Oct 2006
    Location
    Earth
    Posts
    314
    Thanks
    10
    Thanked 0 Times in 0 Posts
    .........hate is byfar an understatement..... thxs
    Everyone hears what you say, friends listen to what you say, best friends listen to what you don't say.
    Radio DJ Panel v3 - It's Here!


  •  

    Posting Permissions

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