note 88916 added to function.fputs
| From: | camilord at kagayan dot com | Date: | Fri, 13 Feb 2009 02:47:32 +0000 |
| Subject: | note 88916 added to function.fputs | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-150608@lists.php.net to get a copy of this message | ||
Here's a sample using fputs() function... it may be useful like making logs visiting your
website by recording the IP address.
<?php
// file container where all texts are to be written
$fileContainer = date("MjY").'.log';
// open the said file
$filePointer = fopen($fileContainer,"w+");
// text to be written in the file
$logMsg = "You are located at ".$_SERVER["REMOTE_ADDR"]."\n";
// below is where the log message has been written to a file.
fputs($filePointer,$logMsg);
// close the open said file after writing the text
fclose($filePointer);
?>
that's it... :)
-- camilord
----
Server IP: 69.147.83.197
Probable Submitter: 202.84.119.223
----
Manual Page -- http://www.php.net/manual/en/function.fputs.php
Edit -- https://master.php.net/note/edit/88916
Del: integrated -- https://master.php.net/note/delete/88916/integrated
Del: useless -- https://master.php.net/note/delete/88916/useless
Del: bad code -- https://master.php.net/note/delete/88916/bad+code
Del: spam -- https://master.php.net/note/delete/88916/spam
Del: non-english -- https://master.php.net/note/delete/88916/non-english
Del: in docs -- https://master.php.net/note/delete/88916/in+docs
Del: other reasons-- https://master.php.net/note/delete/88916
Reject -- https://master.php.net/note/reject/88916
Search -- https://master.php.net/manage/user-notes.php