ok, i have a script i wrote to log visitors, however i want the script to only be processed if the following is true$input = $_GET['send'];
if ($input == NULL || $input == "NoReffer") {i want the script in here}
if tried loads of times, but the 2nd part of the script requires the first part to be processed, otherwise errors appear. basically i need the two scrips joined together
<?php
$day = date("d M Y");
$countfile = ("todays---s/" .$day. ".txt");
if (!file_exists("$countfile")) {
$fp = fopen("$countfile", "a");
fputs($fp, "0");
fclose($fp);
}
$count = join('', file($countfile));
trim($count);
$count++;
$ip = ($_SERVER['REMOTE_ADDR']);
if ($ip == "192.168.1.2" || $ip == "192.168.1.3") {}
else {
$fp = fopen($countfile, "w");
fputs($fp, $count);
fclose($fp);
}
?>
<?php
error_reporting(0);
$countfile = "log/counter.txt";
$logfile = "log/data.htm";
if (!file_exists("$countfile")) {
$fp = fopen("$countfile", "a");
fputs($fp, "0");
fclose($fp);
}
$count = join('', file($countfile));
trim($count);
$count++;
if (!isset($_SERVER['HTTP_REFERER'])) { // Checks to see if some other website redirrected them here...
$refferer = "No Referer";
}
else { // If it Is set...
$refferer = $_SERVER['HTTP_REFERER'];
}
$hisip = ($_SERVER['REMOTE_ADDR']);
$useragent = ($_SERVER['HTTP_USER_AGENT']);
if ($hisip == "195.188.50.199") {
$hisip = "Litherland High";
}
else if ($hisip == "212.219.14.3") {
$hisip = "Southport College";
}
if ($hisip == "192.168.1.2" || $hisip == "192.168.1.3" || $hisip == "192.168.1.4")
{}
else {
$fp = fopen($countfile, "w");
fputs($fp, $count);
fclose($fp);
$fp = fopen($logfile, "a");
$date = date("d M Y");
$time = date("g:i a");
fputs($fp, "<tr><td>".$hisip."<td>".$date."<td>".$time."<td>".$count."<td>".$refferer);
fputs($fp, "\n");
fclose($fp);
}
?>
Jaymc.co.nr