1<?php
2//Something to write to txt log
3$log = "User: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL.
4 "Attempt: ".($result[0]['success']=='1'?'Success':'Failed').PHP_EOL.
5 "User: ".$username.PHP_EOL.
6 "-------------------------".PHP_EOL;
7
8//Save string to log, use FILE_APPEND to append.
9file_put_contents('./log_'.date("j.n.Y").'.log', $log, FILE_APPEND);
1session_destroy();
2session_unset();
3unset($_SESSION["loggedin"]);
4$_SESSION = array();
1
2For those interested. Works with older than 4.3 versions.
3
4<?php
5 function byteConvert($bytes)
6 {
7 $s = array('B', 'Kb', 'MB', 'GB', 'TB', 'PB');
8 $e = floor(log($bytes)/log(1024));
9
10 return sprintf('%.2f '.$s[$e], ($bytes/pow(1024, floor($e))));
11 }
12?>
13
14