grafx77
BANNED
- Mar 6, 2007
- 444
- 219
If anyone ever wants to check and make sure the script is working and your referrer URL is not showing, just do this:
1. Make a blank text file from Notepad. Label it: visitorlog.txt.
2. Upload the .txt file and Chmod it to 777
3. Copy and paste this code into any .php page you want to track. For example test.php.
4. Upload the .php file.
5. Now test the code that XIMSCREAMINGX posted by putting the test.php page within the refresh page (page 2)
Example:
Conclusion: Now go to your visitorlog.txt page (http://www.test.php/visitorlog.txt) and look for your IP. If XIMSCREAMINGX's script works (and it does), then the log should state "Direct Access" and nothing else.
This is a surefire way for all you non-believers to ensure the script does work.
:cool2:
1. Make a blank text file from Notepad. Label it: visitorlog.txt.
2. Upload the .txt file and Chmod it to 777
3. Copy and paste this code into any .php page you want to track. For example test.php.
PHP:
<?php
function writeFile($a,$b="",$c="")
{
clearstatcache();
$fh = (file_exists($a)? fopen($a, 'r+') : fopen($a, 'w+'));
$read = chop(@fread($fh, filesize($a)));
$c = ($b=="counter"? (file_exists($a)? $read+1 : "1") : ($b=="after"?
$read.$c : $c));
if(file_exists($a)) while(1)
if(flock($fh, LOCK_EX))
{
rewind($fh);
fwrite($fh, $c);
fflush($fh);
ftruncate($fh, ftell($fh));
flock($fh, LOCK_UN);
break;
}
else fwrite($fh, $c);
fclose($fh);
}
writeFile("./visitorlog.txt","after","\r\n".date("Y-m-d H:i")." - ".$_SERVER["REMOTE_ADDR"]." - ".($_SERVER["HTTP_REFERER"] ? "Referer: ".$_SERVER["HTTP_REFERER"] : "Direct access"));
?>
4. Upload the .php file.
5. Now test the code that XIMSCREAMINGX posted by putting the test.php page within the refresh page (page 2)
Example:
PHP:
<?php
$referer = $_SERVER['HTTP_REFERER'];
if($referer == "")
{
echo "<meta http-equiv=\"refresh\" content=\"0;url=http://www.test.php\">";
}
?>
Conclusion: Now go to your visitorlog.txt page (http://www.test.php/visitorlog.txt) and look for your IP. If XIMSCREAMINGX's script works (and it does), then the log should state "Direct Access" and nothing else.
This is a surefire way for all you non-believers to ensure the script does work.
:cool2: