Gruzin Posted August 13, 2006 Share Posted August 13, 2006 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 bannedipif (!$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 useripif (!$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] Quote Link to comment Share on other sites More sharing options...
whare Posted August 13, 2006 Share Posted August 13, 2006 maybe try changing the code around abit like[code]//checkif($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 Quote Link to comment Share on other sites More sharing options...
king arthur Posted August 13, 2006 Share Posted August 13, 2006 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.