Menu
I created a code in which each time a user login successfully, php will write to a text file the activity of the user (login). But I can’t figure it out on how it will create a new text file to write once the size of the text file exceeded 100 kb.
Here is the piece of code.
[code=php]
// insert to log file
$datasize= filesize(“logs.txt”);
if ($datasize <= 100)
{
$user= $_POST[‘username’];
$timendate= gmdate(“l dS of F Y h:i:s A”);
$data= ” User $user login at $timendate rn”;
$file = fopen(“logs.txt”,”a”);
fwrite($file,”$data “);
fclose($file);
}
Any Ideas?