Live log/console for public viewing
Discussion in 'Rust Discussion' started by [X] Meep, Aug 16, 2015.
-
Sure, it's possible. In PHP you only can get the log file. This file is updated every... x minutes.
So not live
Code:<?PHP $timestamp = time(); $date = date("d-m-Y", $timestamp); $fileName = basename($_SERVER['PHP_SELF']); $ftp_server = "IP / HOSTNAME"; $ftp_user_name = "USER"; $ftp_user_pass = "PASSWORD"; $ftp_server_file = 'oxide_'.$date.'.txt'; $string = file_get_contents("ftp://$ftp_user_name:$ftp_user_pass@$ftp_server/PATH/server/my_server_identity/oxide/logs/$ftp_server_file"); $string = explode("\n", $string); $string = array_slice($string, -30); $string = implode("\n", $string); echo '<pre>',print_r($string,1),'</pre>';?> <script type="text/javascript"> setTimeout(function(){ window.location.href = "<?PHP echo $fileName; ?>"; }, 3000);</script>
-
why would you want to show all your errors to the world? :3
-
We dont have errors. -
Never stated you did just concerned that some plugins print out to the console for owners eyes only and workout knowing how you ate planning on implementing it I was just curious
-
-
Easily fixable with some regular expression preg_replace
-
If you are well with PHP would you mind helping out? Im on my own here with web work. No one to assist.
-
Not at all PHP is pretty much a 2nd language to me :3
[DOUBLEPOST=1439762013][/DOUBLEPOST]$logstring = "My IP is 123.53.13.1";
$logstring = preg_replace("/(?:[0-9]{1,3}\.){3}[0-9]{1,3}/i","xxx.xxx.xxx.xxx",$logstring);
echo $logstring; -
If its possible to look a little fancy. Console output like RUST:IO Map, but hide all players IP address. Dont want anyone getting hurt.
-
http://prntscr.com/85ex4x i s the result