The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Simple IP Logger?

Hi again.. I've tried the PHP Freaks code snippet and it doesnt log anything... Could someone tell me how to log an IP to a .txt file with the respective date and time they viewed the site without using mysql, if it can't be done without mysql could you tell me the sql code to enter into my database on myPHPAdmin.

<?php $addr=$REMOTE_ADDR; // Assigns Remote address to $addr$server=$SERVER_NAME; // Assigns Server Name to $server$today=date("d/M/Y:H:i:s"); // Assigns the date details to $today$timecorr="+0530"; // Provides Offset for time zone + or - from GMT :: +0530 for India$method=$REQUEST_METHOD; // Assigns the Method to $method$serprot=$SERVER_PROTOCOL; // Assigns the Protocol to $serprot$browser=$HTTP_USER_AGENT; // Assigns Browser details to $browser$space=" "; // Assigns space to $space$apos='"'; // Assigns " to $apos$fil=$SCRIPT_NAME; // Assigns the called file along with path to $fil$name=basename($fil); // Uses basename() to get the file name from path with file name$fsiz=filesize($name); // Uses filesize() to get size of file $name$ref=$HTTP_REFERER; // Assigns the referring file to $ref // All the special characters like - , [ ] ," and spaces to meet format needs are achieved below. // when the string $webdet is created.$webdet=$addr.$space.$server." - "."[".$today.$space.$timecorr."]".$space.$apos.$method.$space.$fil.$space.$serprot. $apos.$space."200".$space.$fsiz.$space.$apos.$ref.$apos.$space.$apos.$browser.$apos."\n";// The string $webdet with all the parts is created using the string operator . to join the // different individual elements, with a end of line "\n" at the end of the string$filelog="ip.txt"; // Assigns file ip.txt to $filelog$fweb=fopen($filelog,"a"); // Opens a file pointer $fwebfputs($fweb,$webdet,250); // Appends the entire string up to 250 bytes length to the filefclose($fweb); // Closes the file after writing?>

Add ip.txt to the folder where this will be located and chmod it to 777, i would include() this in my index.php =)