Jump to content

Question: How to continue the script to run?


Gruzin

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]
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.