Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum

Get help for TinyWebGallery, the best image gallery. The forum is also home for the Joomla JFUploader, TWG Flash Uploader and the Wordpress flash uploader.
It is currently 16. Apr 2024, 12:51

This forum is readonly now. Please use the new forum if you don't find the answer to your question here. The new forum is at https://www.tinywebgallery.com/blog/forum/


All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 9. Jan 2014, 19:46 
Offline

Joined: 3. Jan 2014, 09:28
Posts: 15
Hi Michael,

since a few weeks baidu hits my gallerie even its forbidden by robots.txt
so I start looking at your code to get an idea how to disable counting robots.

while doing this I adjust counter.txt by hand (I now: don't do this :-) and the total counter stops counting.

I traced this down to an additional \n inserted from vi after editing the value in counter.txt.

The problem was the implicit string to integer cast from "$zaehler++;" in counter.inc.php.
If the string contains only regular characters the implict cast is working and the counter is increased.
But if the string contains i.e. a \n the implicit cast was not woking, the string stays unchanged and is written back as is to the file.

I solved the problem with an explict cast to integer while reading the value from counter.txt.
afterwards the counter counts again, even if there is a \n.

Code:
 from counter.inc.php
[...]
        $dateir = fopen($dateiname, "r");
        $zaehler = (integer) fgets($dateir, 20); // <- explicit cast string to integer
        $closed = fclose($dateir);
    }
    $zaehler++;
    $dateiw = fopen($dateiname, "w+");
    fwrite($dateiw, $zaehler);
    fclose($dateiw);
[...]


Top
 Profile  
 
PostPosted: 9. Jan 2014, 23:24 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
I'll add this improvement to the next version.

Thanks,
Michael


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
powered by phpbb | Datenschutz/ Privacy policy