Code: Selecteer alles
<?php
// Enable referer validation? 1 = YES, 0 = NO
$check_referer = 0;
// Domains that are allowed to access this script
$referers = array ("127.0.0.1","newcybertron.nl");
// Get page and log file names
$page = htmlentities($_GET['page']);
$logfile = "logs/" . $page . ".log";
// If $check_referer is set to 1 and if HTTP_REFERER is set to
// a value let's check refering site
if ($check_referer == 1 && !(empty($_SERVER['HTTP_REFERER'])))
{
check_referer($_SERVER['HTTP_REFERER']);
}
// If the log file doesn't exist we start count from 1 ...
if (! @$file = fopen($logfile,"r+"))
{
$count="1";
}
// If the log file exist lets read count from it
else {
$count = @fread($file, filesize($logfile)) or $count=0;
fclose($file);
// Raise the value of $count by 1
$count++;
}
// Write the new $count in the log file
$file = fopen($logfile,"w+") or die("Can't open/write the log file, please CHMOD logs folder to 777 (rwx-rwx-rwx)!");
fputs($file, $count);
fclose($file);
// Print out Javascript code and exit
echo "The spacebridge is $count keer bezocht.";
// function that will check refering URL
function check_referer($thisurl) {
global $referers;
for ($i=0;$i<count($referers);$i++)
{
if (preg_match("/$referers[$i]/i",$thisurl)) {return true;}
}
die("Invalid referer!");
}
// eindtijd
list($msec, $sec) = explode(' ',microtime());
$end_time = ((float)$msec + (float)$sec);
// bereken parse-tijd
$parse_time = round(($end_time - $start_time),5);
// html voor bijvoorbeeld weergave in statusbalk
echo " Deze pagina is geladen in $parse_time seconden.";
?>
Code: Selecteer alles
// Enable referer validation? 1 = YES, 0 = NO
$check_referer = 0;
// Domains that are allowed to access this script
$referers = array ("127.0.0.1","newcybertron.nl");
// Get page and log file names
$page = htmlentities($_GET['page']);
$logfile = "logs/" . $page . ".log";
// If $check_referer is set to 1 and if HTTP_REFERER is set to
// a value let's check refering site
if ($check_referer == 1 && !(empty($_SERVER['HTTP_REFERER'])))
{
check_referer($_SERVER['HTTP_REFERER']);
}
// If the log file doesn't exist we start count from 1 ...
if (! @$file = fopen($logfile,"r+"))
{
$count="1";
}
// If the log file exist lets read count from it
else {
$count = @fread($file, filesize($logfile)) or $count=0;
fclose($file);
// Raise the value of $count by 1
$count++;
}
// Write the new $count in the log file
$file = fopen($logfile,"w+") or die("Can't open/write the log file, please CHMOD logs folder to 777 (rwx-rwx-rwx)!");
fputs($file, $count);
fclose($file);
// Print out Javascript code and exit
// function that will check refering URL
function check_referer($thisurl) {
global $referers;
for ($i=0;$i<count($referers);$i++)
{
if (preg_match("/$referers[$i]/i",$thisurl)) {return true;}
}
die("Invalid referer!");
}
// eindtijd
list($msec, $sec) = explode(' ',microtime());
$end_time = ((float)$msec + (float)$sec);
// bereken parse-tijd
$parse_time = round(($end_time - $start_time),5);
// html voor bijvoorbeeld weergave in statusbalk
$template->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'COUNT' => $count,
'PARSE_TIME' => $parse_time)
) ;
$template->pparse('overall_footer');
Can't open/write the log file, please CHMOD logs folder to 777 (rwx-rwx-rwx)!
doe iets vout maar weet niet wat wie kan me helpen?

