Jump to content

Archived

This topic is now archived and is closed to further replies.

Gruzin

Question: How to continue the script to run?

Recommended Posts

hi guys, I've got a problem:
I want to check if the user is banned or not (ip addresses are stored in db). here is the script, but I want the script to continue if the banned ip and user ip do not match, but in my case the scripts stops... hope someone can help, thanks in advance.


[color=red]<?php

$conban = mysql_connect("localhost","3d","pass"); // check for bannedip
if (!$conban)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("3d", $conban);

$resultban = mysql_query("SELECT * FROM ip");

while($rowban = mysql_fetch_array($resultban))
  {
  $rowban['bannedip'];
  }
mysql_close($conban);



$con = mysql_connect("localhost","3d","pass"); // check for userip
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("3d", $con);

$result = mysql_query("SELECT * FROM ip");

while($row = mysql_fetch_array($result))
  {
  $row['userip'];
  }
mysql_close($con);



//Set banned IP
$banned  = $rowban;

//Set user IP address
$userip = $row;

//check
if($userip == $banned){ 
    echo "<BR>This IP address has been banned";
}
else{
  continue;
  }
exit();
?>[/color]

Share this post


Link to post
Share on other sites
maybe try changing the code around abit like

[code]//check
if($userip != $banned){
        [Your other code here so that the "echo "<BR>This IP address has been banned";" goes to the end of the file]
}
else{
      echo "<BR>This IP address has been banned";
  }
exit();
?>[/code]

some times if the change code around like that it seems to work give it a try at least you never no :)

sorry I carnt give you any more

Share this post


Link to post
Share on other sites
Ummm.....what are these statements supposed to do?
[code]
$rowban['bannedip'];

and

$row['userip'];
[/code]

and why do you close the connection to the database and immediately re-open it?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.