Skip to content

Commit

Permalink
Update counter.php
Browse files Browse the repository at this point in the history
  • Loading branch information
glorialaw committed Oct 15, 2018
1 parent be6a3b7 commit 1a474b8
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions umpleonline/counter.php
Expand Up @@ -9,25 +9,22 @@
//opens countlog.txt to read the number of hits
$dir = dirname(__FILE__);
$logpath = $dir."/countlog.txt";
if(!file_exists($logpath)){
if(file_exists($logpath)){
if(!is_writable($logpath)||!is_readable($logpath)) {
chmod($logpath, 0755);
}
$log = fopen($logpath, "r");
$count = fgets($log,1000);
fclose($log);
$count=$count + 1 ;
echo "$count" ;
echo " visits since October 2018" ;

// opens countlog.txt to change new hit number
$log = fopen($logpath,"w");
fwrite($log, 0);
fwrite($log, $count);
fclose($log);
}
if(!is_writable($logpath)||!is_readable($logpath)) {
chmod($logpath, 0755);
}
$log = fopen($logpath, "r");
$count = fgets($log,1000);
fclose($log);
$count=$count + 1 ;
echo "$count" ;
echo " visits since October 2018" ;

// opens countlog.txt to change new hit number
$log = fopen($logpath,"w");
fwrite($log, $count);
fclose($log);


?>

0 comments on commit 1a474b8

Please sign in to comment.