|
-
Oct 13th, 2008, 10:41 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] help plase
Can anyone help me please.
im trying to show my site to people that are not banned from my website the html part at the top should only show when they are not banned and if they are banned then it show display the php you are banned code. When they are banned it still shows the html coade part aswell.
PHP Code:
<B>Website Coming Soon</b>
<?php
include("config.php");
mysql_connect("$host", "$username", "$password");
mysql_select_db($db) or die(mysql_error());
$sql = "SELECT * FROM ip";
$result = mysql_query($sql);
$row = mysql_fetch_array($result) or die(mysql_error());
if ($_SERVER["REMOTE_ADDR"] == $row["ip"] )
{
echo "You are banned from viewing this website";
}
?>
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
-
Oct 13th, 2008, 10:46 AM
#2
-
Oct 13th, 2008, 10:53 AM
#3
Thread Starter
Frenzied Member
Re: help plase
I need to show my website to the people that are not banned and show the You are banned from viewing this website message to people that are on my banned list?
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
-
Oct 13th, 2008, 10:58 AM
#4
-
Oct 13th, 2008, 11:02 AM
#5
Thread Starter
Frenzied Member
Re: help plase
I have tryed
PHP Code:
<?php
include("config.php");
mysql_connect("$host", "$username", "$password");
mysql_select_db($db) or die(mysql_error());
$sql = "SELECT * FROM ip";
$result = mysql_query($sql);
$row = mysql_fetch_array($result) or die(mysql_error());
if ($_SERVER["REMOTE_ADDR"] == $row["ip"] )
{
die("You are banned from viewing this website");
}
?>
load website normally here.
if the ip isnt banned then it shows a blank page.
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
-
Oct 13th, 2008, 11:02 AM
#6
-
Oct 13th, 2008, 11:05 AM
#7
Thread Starter
Frenzied Member
Re: help plase
yeah works now but will this work when i add more ip address's?
Also how do i make a page for me to add ip's to the database.? I have been struggling on it?
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
-
Oct 13th, 2008, 11:56 AM
#8
Thread Starter
Frenzied Member
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
-
Oct 13th, 2008, 09:01 PM
#9
Re: help plase
please DO NOT bump threads.
also, using die() is not good practice. I forget why, but i think it has to do with running process, and your stopping them in the middle. so dont do it.
My usual boring signature: Something
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|