rossmcl
Programmer
- Apr 18, 2000
- 128
Hi
I am brand new to PHP, trying to do something very quickly so I can store some basic information on visitors hitting my site. I have no idea about PHP, and have strung the below very quickly (and amateurishly) together.
But I am getting errors (surprisingly enough!)
I would REALLY appreciate if someone could take a quick perusal and debug for me. It will take me several hours of reading php.net to work out what is wrong, but I am sure one of you can do it in minutes!! Not trying to be lazy, honest guvnor...but my 'talents' lie elsewhere...!
=====
<?php
$filename = "PHPStoreVisitorInfo.txt";
$handle = fopen ($filename, "a+"
;
$todaydate = strval((date("m.d.y"
);
$todaytime = strval(time())
$visitorInfo = $HTTP_SERVER_VARS['REMOTE_ADDR'] \r\n ;
fwrite( $handle, $todaydate + $todaytime + $visitorInfo );
fclose( $handle );
?>
====
All I want to do is concatentate strings for todays date AND todays time AND the IP address from visitors remote machine, and put it into a row in a text file. Then I want to create a new line (I believe the \r\n does that, so that next time I come back to the txt file, I will be appending a new line to the txt file (I believe the a+ in file open function will take me to this new line (?)
As I say, any help in debugging this for me would be very much appreciated. Dont want to spend ages learning PHP, when its only a very simple thing I need to be able to do with PHP for my website (at the moment). In the meantime, would prefer to leave it to the experts...YOU!
Thanks
RM
I am brand new to PHP, trying to do something very quickly so I can store some basic information on visitors hitting my site. I have no idea about PHP, and have strung the below very quickly (and amateurishly) together.
But I am getting errors (surprisingly enough!)
I would REALLY appreciate if someone could take a quick perusal and debug for me. It will take me several hours of reading php.net to work out what is wrong, but I am sure one of you can do it in minutes!! Not trying to be lazy, honest guvnor...but my 'talents' lie elsewhere...!
=====
<?php
$filename = "PHPStoreVisitorInfo.txt";
$handle = fopen ($filename, "a+"
$todaydate = strval((date("m.d.y"
$todaytime = strval(time())
$visitorInfo = $HTTP_SERVER_VARS['REMOTE_ADDR'] \r\n ;
fwrite( $handle, $todaydate + $todaytime + $visitorInfo );
fclose( $handle );
?>
====
All I want to do is concatentate strings for todays date AND todays time AND the IP address from visitors remote machine, and put it into a row in a text file. Then I want to create a new line (I believe the \r\n does that, so that next time I come back to the txt file, I will be appending a new line to the txt file (I believe the a+ in file open function will take me to this new line (?)
As I say, any help in debugging this for me would be very much appreciated. Dont want to spend ages learning PHP, when its only a very simple thing I need to be able to do with PHP for my website (at the moment). In the meantime, would prefer to leave it to the experts...YOU!
Thanks
RM