<?php
#initialize variables
$today date("Y-m-d H:i:s");
$ip getenv ("REMOTE_ADDR");
$addVarsgetenv("QUERY_STRING");

#make sure one page is loaded
if (!(isset($page))){
    
$page="news.php";
}
#Security Log
###ADJUST HERE:
$phplogfopen("MYLOGFILEPATH""a+");
fwrite($phplog"Date:<b> $today </b>IP:<b> $ip </b> Function:<b>$addVars</b><br>");
fwrite($phplogchr(13));
fclose($phplog);

#check if file is loaded
if ( !file_exists($page) or strstr($page"../") ){
     print
"I cannot find the file requested ( $page ).<br><i>Sending email to admin.</i>";
     
$wholeURL getenv ("REQUEST_URI");
     
###ADJUST HERE
     
$ok = @mail("MYEMAIL""Broken link? Page: $page""User ($ip) got an error message at $today when accessing $wholeURL",
   
"From: MYEMAIL\r\n"
   
."X-Mailer: sukhanov.net PHP/" phpversion());
     if(
$ok){
     print
"<br>Email sent sucessfully, please check back later for updates";
     }else{
     Print
"<br>I had an error sending email, please contact admin from contact page.";
     }
     
    
} else {
    
$absolutepath split("/"$_SERVER["SCRIPT_FILENAME"]);
    
$currdir="";
    for (
$i=0$i<(count($absolutepath)-1); $i++){
        
$currdir="$currdir$absolutepath[$i]/";
    }
    include 
"$currdir$page";
}
?>