Jump to content

[SOLVED] redirect


fullyloaded

Recommended Posts

hi

any one know how to add a redirect to this little bit of script? its for banning ip's as of now it will only show this (You have been banned from viewing this website.)

thanks

<?php
//place the users IP in the ip variable
$ip = $_SERVER['REMOTE_ADDR'];
$connection = mysql_connect("localhost", "****", "*****") or die(mysql_error());
mysql_select_db("****");
$query = mysql_query("SELECT * FROM banned_users WHERE userip='$ip'");

//check to see if the users IP matches a banned IP
$select_banned = mysql_num_rows($query);

if($select_banned == 1) {
//print a message to the user if they are banned
print "You have been banned from viewing this website.";
//stop the page from being loaded
exit;
}
?>

Link to comment
https://forums.phpfreaks.com/topic/42942-solved-redirect/
Share on other sites

<?php
//place the users IP in the ip variable
$ip = $_SERVER['REMOTE_ADDR'];
$connection = mysql_connect("localhost", "****", "*****") or die(mysql_error());
mysql_select_db("****");
$query = mysql_query("SELECT * FROM banned_users WHERE userip='$ip'");

//check to see if the users IP matches a banned IP
$select_banned = mysql_num_rows($query);

if($select_banned == 1) {
header('Location: http://www.sitetoredirecto.com');
//print a message to the user if they are banned
//print "You have been banned from viewing this website.";

//stop the page from being loaded
exit;
}
?>

 

Is that what you are looking for?

Link to comment
https://forums.phpfreaks.com/topic/42942-solved-redirect/#findComment-208590
Share on other sites

Archived

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

×
×
  • 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.