|
#1
|
||||||||||||
|
||||||||||||
|
Do you want to log the details of visitors to your site? Here is a basic tutorial on making a php logger which will log details of users visiting your site.
1.) Open the file you want to put the logger in(best to be the pages the visitors are visiting) Add if a .html or htm Code:
If the file is a .php file and already is in php just remove the <?php and ?> in the code above 2.)Now make a log.html file that is blank Explantation of the code Code:
$file is given the command to open log.html Code:
To acquire the exclusive lock (writer) Code:
$time is given the value of the server time with the time format fwrite now uses $file which was seen before to write Time in bold with the time using $time. Code:
Now the code checks if $REMOTE_ADDR is true(existent) if $remote_addr is true it goes to fwrite where it uses $file again then with ip address in bold and then the users $REMOTE_ADDR Code:
If $HTTP_REFERER is true then fwrite using $file with Referer in bold with the $HTTP_REFERER which is where the person came from(website or page) If the person typed in the address into their address bar then REFERER will appear Code:
The final piece of fwrite, it uses the $file line again this time with Browser in bold and then $HTTP_USER_AGENT which gets the person's browser type. example:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461; .NET CLR 1.0.3705) Opera/6.0 (Windows XP; U) [en] Code:
To release the lock (shared or exclusive) Code:
Its time to fclose the $file which closes log.html Hopefully you read the expantation instead of just copy and pasting I hope you enjoyed my tutorial. CheetahShrk |
| Pictual Design Forums's Sponsored Links: |
|
| Display your advertising here - learn about Pictual Revenue Sharing |
|
#2
|
||||||||||||
|
||||||||||||
|
great
|
|
#3
|
||||||||||||
|
||||||||||||
|
wow its nice tutrial
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| php links | xplicit | Programming | 4 | 08-30-2006 04:09 PM |
| PHP Arrays | ownsyou | Tutorials | 4 | 03-05-2006 11:03 AM |
| Introduction to Php | dbfootballa3 | Tutorials | 11 | 12-01-2005 11:33 AM |
| Php Simple Email Script | FireNova | Tutorials | 4 | 07-01-2005 07:56 PM |
| Php Randomizing images | FireNova | Tutorials | 3 | 06-19-2005 04:00 PM |