FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


counter





AlexandruDan
Hello.
I have a question: how can I make this script to work?
The problem is that when I create the contor.txt file, it is emplty and I receve an error. If I manually add a value in it, it works just fine...

Here's the script:

<?php
$deschide = fopen("contor.txt",r);
$valoare = fread($deschide,filesize("contor.txt"));
$valoare++;
fclose($deschide);
if ($_COOKIE["vizitat"]!="da"){
$deschide = fopen("contor.txt",w);
fwrite($deschide, $valoare);
setcookie("vizitat","da",time()+2);
fclose($deschide);
}
else {
echo "<br /> deja ai accesat pagina o data in ultimele 5 secunde <br />";
}
echo "fisierul a fost deschis de $valoare ori";
?>
Diablosblizz
In contor.txt you can't have a blank value. For your script, it NEEDS to be a number (like 0). I believe if you do this then it will set the blank value to 0.

Code:
<?php
$deschide=fopen("contor.txt",r);
$check=fread($deschide);
if($check == "") {
$number=0;
$valoare=fwrite($deschide,$number);
}
?>
manav
please make sure tht counter.txt is chmod to 777 that is read write and executable permissions are set correctly for it....
Related topics
Counter strike
Favourite game? (OFFICIAL THREAD)
Counter Strike website!
Counter
My Counter-Strike: Source Clan
php counter
PHP Counter?
Counter Strike Condition Zero
PHP Counter
The "Best Game" Counter-Strike
Counter Graphic, anyone for 35 Frihs!
Counter Strike
100 Fps en Counter Strike
Hit counter
My website has gotten 100 hits without...
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.