PHP counter problem

If you have anything to say - or advice to give - on the creation or publishing of ManiaLinks, here is the place to do it!

Moderator: TM-Patrol

Post Reply
cuba.12
pedestrian
pedestrian
Posts: 8
Joined: 26 Apr 2008 13:44
Owned TM-games: TMN, TMNF, TMUF
Manialink(s): cuba.12

PHP counter problem

Post by cuba.12 » 02 Jan 2009 18:07

:ftw: Hi all, i have a problem with PHP counter. I added this code to my manialink with <?include?> tag.

Code: Select all

<?php
$soubor = "http://****************.txt";
$otevren = fopen($soubor, "r+");
$obsah = fgets($otevren,10) + 1;
rewind($otevren);
fputs($otevren,$obsah);
fclose($otevren);
?>
Chmod set to 646.
This I added to main page, where i want to display the counter:

Code: Select all

echo '<label textsize="5" posn="19 0 32" sizen="36 2" halign="center" valign="top" text="$s$i'.$obsah.'$z"/>';
It shows always "1". And, whatever, it doesn´t edit the file. Links are right. Please, help me. The best will be if you will send a working code.

Thx, Cuba.CZ

cuba.12
pedestrian
pedestrian
Posts: 8
Joined: 26 Apr 2008 13:44
Owned TM-games: TMN, TMNF, TMUF
Manialink(s): cuba.12

Re: PHP counter problem

Post by cuba.12 » 03 Jan 2009 17:56

:grmblz: Doh, i repaired it. But now i have another problem. Always, when the counter should reach "10", it puts to the "data.txt" 0 instead of "10". Then it continues - 1,2,3,4,5,6,7,8,9,0,1... I only discovered there is option to write "0001" to the "data.txt" - Then it looks like this: 0008, 0009, 0010... But it looks bad - especially when i want to use it for awarding. Just imagine - "Awards: 0005". Please help me if you can, tell me how can i solve this problem. :?: :?: :?:

Post Reply