Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2005
    Location
    Teh NORTH Pole! ;O
    Posts
    99
    Tokens
    0

    Default Heh. Slight problem!

    Well! I'm trying to make that php alert thing. I TRIED to set it up. BUT FAILED. So can anyone point out where I have gone wrong?

    http://grid.dailydns.com/~bwctc/alert2/alert.php

    http://grid.dailydns.com/~bwctc/alert2/alert2.php

    alert.php

    <?
    $dbName = "-";
    $dbUser = "-";
    $dbPass = "-";
    // Connect
    mysql_connect ("localhost", "$dbUser", "$dbPass");
    mysql_select_db ("$dbName");
    // Get Alert
    $alertQuery = mysql_query("SELECT * FROM alert WHERE active='Y'");
    if(mysql_num_rows($alertQuery) =="1"){
    $alertData = mysql_fetch_array($alertQuery);

    if($_COOKIE[$alertData[ID]] !="Y"){
    $y = "Y";
    setcookie($alertData[ID], $y);
    Echo"
    <script language='javascript'>alert('$alertData[message]');</script>";
    }
    }

    Echo"<META HTTP-EQUIV='refresh' content='60;URL=alert.php'>";
    Echo"$_COOKIE[$alertDataID]"
    ?>
    alert2.php

    <?
    $dbName = "-";
    $dbUser = "-";
    $dbPass = "-";
    // Connect
    mysql_connect ("localhost", "$dbUser", "$dbPass");
    mysql_select_db ("$dbName");
    switch($_GET['act']){
    default:
    $alertQuery = mysql_query("SELECT * FROM alert WHERE active='Y'");
    if($alertData[message] !=""){
    $Var ="<u>Current Active Alert</u>: $alertData[message] [<a href='alert.php?act=deactivate'>Deactivate</a>]";
    }
    Echo"<center><b>Alert Script Control Panel</b></center>
    <u>NOTE:</u> You can only have one alert at one time. Once you want people to
    stop being alerted, you will have to deactive it below. Creating a new alert
    will delete the old one.<br>

    $Var

    <hr width='100%' height='1' color='#000000' shade='no'>

    <form method='post' action='alert.php?act=create'>
    Message:<br>
    <textarea name='message' cols='30' rows='6'>Keep the message short</textarea><br>
    <input type='submit' value='Create'>
    </form>";
    break;
    case"create":
    $message = "From your sites name DJ: ". $_POST['message'];

    if(empty($message)){
    Echo"<b>Error:</b> Please fill out the message.";
    exit;
    }
    mysql_query("UPDATE alert SET active ='N'");
    mysql_query("INSERT INTO alert (message,active) VALUES ('$message','Y')");

    Echo"<b>Alert Added Sucessfully</b><br>
    All other alerts have been deactivated. All users will recieve this alert
    once, until you deactivate it.";
    break;
    case"deactivate":
    mysql_query("UPDATE alert SET active ='N'");
    Echo"<b>Alerts Deactivated</b><br>
    All previous alerts have been deactivated.";
    break;
    }
    ?>
    Reputation will be awarded!
    Last edited by Newsie; 08-01-2006 at 11:01 AM.

  2. #2
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Check your database info

  3. #3
    Join Date
    Oct 2005
    Location
    Teh NORTH Pole! ;O
    Posts
    99
    Tokens
    0

    Default

    Hmm... Tom. You said to turn of something. How do you do that?
    Last edited by Newsie; 08-01-2006 at 11:12 AM.

  4. #4
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    You cant turn it off you need you server admin to turn it off.

  5. #5
    Join Date
    Oct 2005
    Location
    Teh NORTH Pole! ;O
    Posts
    99
    Tokens
    0

    Default

    Could you take a look because its exactly the php that you put on the other thread.
    Last edited by Newsie; 08-01-2006 at 11:14 AM.

  6. #6
    Join Date
    Dec 2004
    Location
    Manchester, UK
    Posts
    334
    Tokens
    0

    Default

    Make this line:
    if(mysql_num_rows($alertQuery) =="1"){
    Say
    if(@mysql_num_rows($alertQuery) =="1"){

  7. #7
    Join Date
    Oct 2005
    Location
    Teh NORTH Pole! ;O
    Posts
    99
    Tokens
    0

    Default

    Well it kind of works, but the alert send thing isn't working. Anyway reputation added.

Posting Permissions

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