Help me debug a PHP script
First of all - here's the script.
$time = time();
$ip = $_SERVER['REMOTE_ADDR'];
$refer = $_SERVER['HTTP_REFERER'];
if ($refer == "") { $refer = "No Referrer available."; }
$write = "||$refer^$ip^$time";
$filename = "stats.txt";
if($flag == false) { // if the file doesn't exist
$handle = fopen($filename, 'w') or die("can't open file");
fwrite($handle, $write);
fclose($handle);
} else { //if the file already exists
//write to file
$handle = fopen($filename, 'a') or die("can't open file");
fwrite($handle, $write);
fclose($handle);
} Gather information -> Does the file already exist? -> (No) Create empty file (Yes) Append gathered information to the end of the file
Can anyone see where this is going wonky? I'm not seeing it here and have a feeling the script is being called twice somehow.
Click Here To Download 14 (Odd)
Copywriting Hacks...