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] Link to comment https://forums.phpfreaks.com/topic/17411-question-how-to-continue-the-script-to-run/ 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 Link to comment https://forums.phpfreaks.com/topic/17411-question-how-to-continue-the-script-to-run/#findComment-74098 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? Link to comment https://forums.phpfreaks.com/topic/17411-question-how-to-continue-the-script-to-run/#findComment-74102 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.