Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function Log($msg){
$fp = fopen("log.txt","a+");
fwrite($fp, $msg."\r\n");
fclose($fp);
}
Log("Page Loaded");
include "LibOfFuncs.php";
Log("someotherpage loaded");
Page Loaded
someotherpage loaded
<?
$_custom_log = "";
function AddToLog($msg){
global $_custom_log;
$_custom_log .= $msg."\r\n";
}
function SaveLog(){
global $_custom_log;
$contents = "==============================";
$contents .= date("Y-m-d h:i:s a")."\r\n";
$contents .= $_custom_log;
// update file
for ($r=0;$r<=60;$w++){ // Try 60 times to get write access to the file
if ($r > 0) sleep(1); // if NOT the first attempt, sleep 1 second
$fp = @fopen("log.php","a+");
if ($fp) break; // Got access, break loop
}
if ($fp){ // If access to the file was gained
fputs($fp,$content); // Inject contents
fclose($fp); // Close file
}
}
?>
AddToLog("whatever you want");
AddToLog("however many times you want");
saveLog();
file_put_contents($filename, $data, FILE_APPEND|LOCK_EX)
while (!file_put_contents($filename, $data, FILE_APPEND|LOCK_EX)){
continue;
}
function SaveLog(){
global $_custom_log;
// update file
for ($r=0;$r<=60;$w++){ // Try 60 times to get write access to the file
if ($r > 0) sleep(1); // if NOT the first attempt, sleep 1 second
$fp = @fopen("log.php","a+");
if ($fp) break; // Got access, break loop
}
if ($fp){ // If access to the file was gained
fputs($fp,"==============================\r\n".date("Y-m-d h:i:s a")."\r\n".$_custom_log); // Inject contents
fclose($fp); // Close file
}
}