JesterJoker
Regular Member
- Jan 13, 2008
- 238
- 28
Script 1:
This script checks my database if the IP address matches one for a previous visitor to my page, and redirects them to another page so they cannot see the original content the went to, to begin with.
I need to combine that with this script.
This script checks the referer to see if its from a specific page and displays my whitehat or blackhat page depending on that, but before this point I want it to check the IP address with the script above this one and redirect them completely as a safeguard. As visitors come to my site they are logged by ip and hostname so that record that is stored on visit 1 is what is being referenced. This is part of a chameleon script to hide the originating page. So as example the script below would be called index.php And the chameleon script that references it would be the 12345.php page.
This script checks my database if the IP address matches one for a previous visitor to my page, and redirects them to another page so they cannot see the original content the went to, to begin with.
PHP:
<?php
$vis_ip = $_SERVER["REMOTE_ADDR"]; // the user's IP address
$vis_url = $_GET["url"]; // the URL they have visited
$vis_agent=$_SERVER["HTTP_USER_AGENT"]; //user agent
$vis_lang=$_SERVER["HTTP_ACCEPT_LANGUAGE"]; //accept language
$vis_ref=$_SERVER["HTTP_REFERER"]; //referer
$vis_hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$sql=mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("databaseName")or die(mysql_error());
$sql_query = mysql_query("SELECT `id_stat` FROM `stats` WHERE `vis_ip` like '$vis_ip' ");//check IP in database
$rows = mysql_num_rows($sql_query);
if($rows>0)
{
header('Location: redirected.php');
}
else {$found=false;}
?>
I need to combine that with this script.
This script checks the referer to see if its from a specific page and displays my whitehat or blackhat page depending on that, but before this point I want it to check the IP address with the script above this one and redirect them completely as a safeguard. As visitors come to my site they are logged by ip and hostname so that record that is stored on visit 1 is what is being referenced. This is part of a chameleon script to hide the originating page. So as example the script below would be called index.php And the chameleon script that references it would be the 12345.php page.
PHP:
<?php
$referer = $_SERVER['HTTP_REFERER'];
if($referer == "http://www.site.com/12345.php")
{
echo "
<html>
<title>Blackhat Page</title>
</head>
<body>
<center>
<h2>BlackhatPage</h2>
</center>
</body>
</html>
";
}
else
{
echo "
<html>
<title>whitehat page</title>
</head>
<body>
<center>
<h2>Whitehat Page</h2>
</center>
</body>
</html>
";
}
?>
Last edited: