How to know who entry in web site by login
Author: Francisco R.
Visited 1203,
Followers 1,
Shared 0
I have the web site setup for Loging user .
I would like to receive an e-mail when somebody Login or to have detail in SQL that who is login and time.
I install stadistic but in this Table SQL no give me User details.
Thank you for you help
Posted on the
Author
i put code, it created a userlogs.txt for me is enough. But did not give me user:
<?php
$date=date("l, d F, Y, H:I");
$updatefile = "userlogs.txt";
$fh = fopen($updatefile, 'a') or die("can't open file");
$stringData = "User: $username ";
fwrite($fh, $stringData);
$stringData = "Logged in: $date<br><hr>";
fwrite($fh, $stringData);
$stringData = "name:$pa";
fwrite($fh, $stringData);
fclose($fh);
?>
Quote:
User: Logged in: Monday, 24 October, 2016, 10:1<br><hr>
User: Logged in: Monday, 24 October, 2016, 10:1<br><hr>
Unquote:
How this code can show User:.........???
Thank you
Author
Resuelto put this code/pone este codigo / in main web index.php / en la pagina principal index.php
after close body/ antes de cerrar body.
<?php
$date=date("l, d F, Y, H:i:s");
$updatefile = "userlogs.txt";
$fh = fopen($updatefile, 'a') or die("can't open file");
$stringData = "User: $user[username]\n";
fwrite($fh, $stringData);
$stringData = "Logged in: $date\r\n";
fwrite($fh, $stringData);
fclose($fh);
?>
Te creara un archivo userlogs.txt en tu FTP con todos los usuarios que se han Loggeado
Logged in: Monday, 24 October, 2016, 13:55:40
User: admin
Logged in: Monday, 24 October, 2016, 13:55:41
User: admin
Logged in: Monday, 24 October, 2016, 13:55:42
User: admin
Logged in: Monday, 24 October, 2016, 13:57:17
User: admin
Logged in: Monday, 24 October, 2016, 13:57:18
User: admin
Logged in: Monday, 24 October, 2016, 13:57:19
User: admin
Logged in: Monday, 24 October, 2016, 13:57:20
User: admin
Logged in: Monday, 24 October, 2016, 13:57:21
User: admin
Logged in: Monday, 24 October, 2016, 13:57:22
User: admin
Logged in: Monday, 24 October, 2016, 13:57:23