I need some help with this...
Well, I'm currently just testing some things with writing and reading files on my website, so far it's been good.
But I'm kinda stuck right now.
Here's my code:
<?php
$ipi = getenv("REMOTE_ADDR");
$counter = "test.txt";
$fd = fopen($counter, "rw");
$oldipi = fread($fd, filesize( $counter ));
$useripi = $ipi;
fwrite($fd, $oldipi . "\n" . $useripi);
fclose($fd);
?>
This started as a counter, first it used fopen($counter, "r") and "w" to first read the file then to add new values using $num = $num + 1;
but I'm stuck right now.
It wont read the file then write the new info on a new line with the old info still in it.
How would I go by to accomplish this?
Well, I'm currently just testing some things with writing and reading files on my website, so far it's been good.
But I'm kinda stuck right now.
Here's my code:
<?php
$ipi = getenv("REMOTE_ADDR");
$counter = "test.txt";
$fd = fopen($counter, "rw");
$oldipi = fread($fd, filesize( $counter ));
$useripi = $ipi;
fwrite($fd, $oldipi . "\n" . $useripi);
fclose($fd);
?>
This started as a counter, first it used fopen($counter, "r") and "w" to first read the file then to add new values using $num = $num + 1;
but I'm stuck right now.
It wont read the file then write the new info on a new line with the old info still in it.
How would I go by to accomplish this?