I am trying to create a php code - that open a .txt file in my root directory and write whoever visits my site - ip address, may be location (from where.. ) and time of enter..
I do not want to use database.. I am wondering with the txt file.. and also wondering what will happen if two users trying enter my site at the same time.. about the .txt file..
Here is what I have - on top of my index.php page:
$_SESSION["currip"] = $_SERVER['REMOTE_ADDR'];
$_SESSION["timeofentry"] = date("Y-m-d h:i:s",time());
$file = 'dump.txt';
$fh = fopen($file, 'w') or die('Could not open file');
fwrite($fh, '$_SESSION["currip"]') or die('Could not write to file');
Also that my die() message - ~~ I do not want to disturb the users with my error messages. I thought that my host will have those info, but they do not.
any suggestions? Again, I am learning PHP and want to practice...