chubbychubus
-
Posts
6 -
Joined
-
Last visited
Posts posted by chubbychubus
-
-
so is this possible? could someone just please modify that script to overwrite on the file? instead of appending or prepending? i tried "w" and "w+" ..and didnt seem to work.
-
no, its not an actual server, its just a server script, to receive a from a client script (via sockets)... but that is not relevant to this part of the script, i dont think. when the server script runs, it will post this message to let me know that its started the last time, (as you said).. i dont really need to see logs, just need to know the last time it started. so instead of appending or prepending to the file, i dont need to see all those logs, just the single one line.
-
its just a server script (in ahk) that starts a server and it will just post to that message, but i am not sure how its all going to work out, and just going step by step (so i dont have the full details of how i want the things to be yet) i could also login via temviewer and see if the program started, but this way i can just see it on the logs, instead of loginto my home computer( sometimes my wife uses it and dont need to interrupt her while in the middle of work)
-
yeah, i am just to get my home computers post 1 line, so it can read 1 message. when an program starts, that way i know its running and what time it started.
also, i read on that link prior to posting, but those modes are either prepend, or append to the file, not sure how to overwrite it though
-
i got the below code from google, need to adapt it to use, it works, but i just need it to over write on the file instead of appending to the file , please help, i am not a coder nor understand much of this, if someone could change it for me please:
function logText($text) { $ts = date("D d-m-y h:i A",time()); $toLog = "[" . $ts . "] " . $text; $fh = fopen("logFile.txt", 'a'); fwrite($fh, $toLog."\n"); fclose($fh); }
chubbychub (no, this thread isn't spam)
in PHP Coding Help
Posted
thank you requinix!, that helped, i ended up using the below code:
function logText($text)
{
$ts = date("D d-m-y h:i A",time());
$toLog = "[" . $ts . "] " . $text;
file_put_contents( "logFile.txt",$toLog);
//fwrite($fh, $toLog."\n");
//fclose($fh);
}
this has time stamp in a formatt that i want to easily read.