View Single Post
Old 11-22-2008, 06:01 AM   #9 (permalink)
codefreek
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Box

Thank you kalle for bringing us closer to making a good script :D
and the point of session_start() i know that yes not suppose to be inside there i just put it there so we have everything in same place :P sorry if that has confused some of you :)

//let's keep this ball up in the air people you never know what we might do :)


PHP Code:
/* so i thought we might make a ip log as well for the spamblocker */
function iplog() 

$useragent $_SERVER['HTTP_USER_AGENT'];
$httpreferrer $_SERVER['HTTP_REFERER'];
$HttpClientIP $_SERVER['HTTP_CLIENT_IP'];
$RemAddr $_SERVER['REMOTE_ADDR'];
$CacheControl $_SERVER['HTTP_CACHE_CONTROL'];
$XForward $_SERVER['HTTP_X_FORWARDED_FOR'];
$querystring $_SERVER['QUERY_STRING'];

$filename 'log.txt';
$somecontent "User Agent: $useragent\n HTTP Referrer: $httpreferrer\n HTTP Client IP: $HttpClientIP\n Remote Address: $RemAddr\n Cache Control: $CacheControl\n X Forward: $XForward\n Query String: $querystring\n";

if (
is_writable($filename)) {

if (!
$handle fopen($filename'a')) {
echo 
"Cannot open file ($filename)";
exit;
}

if (
fwrite($handle$somecontent) === FALSE) {
echo 
"Cannot write to file ($filename)";
exit;
}

fclose($handle);

} else {
echo 
"The file $filename is not writable";
}
return 
$somecontent;

keep it up guys
:D

Last edited by codefreek : 11-22-2008 at 06:22 AM.
codefreek is offline  
Reply With Quote