Created
February 22, 2016 22:24
-
-
Save xkrsz/102d2c15da6714a42cba to your computer and use it in GitHub Desktop.
Licznik odwiedzin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
$plik = "licznik.txt"; | |
if (!file_exists($plik)) { | |
$f = fopen($plik, "w"); | |
fwrite($f,"0"); | |
fclose($f); | |
} | |
$f = fopen($plik,"r"); | |
$licznik = fread($f, filesize($plik)); | |
fclose($f); | |
if(!isset($_SESSION['odwiedzil'])){ | |
$_SESSION['odwiedzil']="tak"; | |
$licznik++; | |
$f = fopen($plik, "w"); | |
fwrite($f, $licznik); | |
fclose($f); | |
} | |
echo "Jestes ".$licznik."odwiedzajacym na tej stronie, elo."; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment