[hack] stop robots and download tools causing zero-ratings [hack] stop robots and download tools causing zero-ratings
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

[hack] stop robots and download tools causing zero-ratings

Started by lamama, November 21, 2004, 01:51:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lamama

PROBLEM:   Robots, spiders and download tools crawling the gallery and causing lots of "zero"-rated pics.

SOLUTION: a little robot-trap

I'm not a big PHP freak, but I built a little robot-trap to stop robots etc. from voting for a pic.
Just because I'm no PHP freak someone might throw an eye on this hack and tell me if it's correct, useful or not.  ???


THE IDEA:

The rating a robot does is normally the 0-rating, because it's the first rating link he gets.
So why not set an extra vote before that first vote and keep it invisible so only a robot or download tool will be able to use it. If the robot/tool follows that invisible link it will not be counted, but remarked inside the "votes" table, so every next rating attempt on that pic won't be successful.


The changes I've made:


FILE: ratepic.php   ###########################################################################

SEARCH FOR:

$pic = (int)$HTTP_GET_VARS['pic'];
$rate = (int)$HTTP_GET_VARS['rate'];


ADD AFTER:

$bottrap = 0;                         // reset bottrap value
if ($rate > 5)                        // everything higher than 5 is illegal -- 9 is the bot's vote
    {
      $bottrap = 1;                  // activate bot-trap
    }



SEARCH FOR:

if (!empty($user) && $user==$owner && !USER_IS_ADMIN) cpg_die(ERROR, $lang_rate_pic_php['forbidden'], __FILE__, __LINE__);
// Update picture rating


ADD BEFORE:

if ($bottrap == 0)                     // update the picture rating only if bot-trap is not active
{


SEARCH FOR:

// Update the votes table


ADD BEFORE:

}                                     // end to the if above: The votes table has to be updated so the bot can't vote this pic again.




FILE: displayimage.php   ###########################################################################

SEARCH FOR:                            (inside function html_rating_box() )

       '{VOTES}' => $votes,

ADD AFTER:

       '{RATE9}' => "ratepic.php?pic=$pid&rate=9",              // bot trap rating is "9"
       




FILE: theme.php  (template: classic) #################################################################


SEARCH FOR:                            (after something like "// HTML template for the image rating box" )


       <td class="tableb_compact" width="17%" align="center"><a href="{RATE0}" title="{RUBBISH}"><img src="images/rating0.gif" alt="{RUBBISH}" border="0" /><br /></a></td>              


CHANGE IT TO:

       <td class="tableb_compact" width="17%" align="center"><a href="{RATE9}" title="{RUBBISH}"></a>
                                                             <a href="{RATE0}" title="{RUBBISH}"><img src="images/rating0.gif" alt="{RUBBISH}" border="0" /><br /></a></td>              



The last one just adds the additional, invisible rating link. I took the "classic" theme for example, It's maybe quite similar in other templates (I use only one template and didn't check others).


That's all. ;D


I tested it and it works fine under test conditions (making the invisible link visible and click on it manually), but it hasn't been tested with "real" bots or download tools yet.


Maybe a similar trap could be used to keep robots and download-tools locked out from the entire gallery, but as I have no idea where and how to modify the code.....   ::)

Tranz

Thank you for the contribution. This issue is one of the things on the to-do list to address. We're looking into a form solution. While your idea is creative, it would expect robots to behave a certain way and they may change their behavior. I'll defer to the wisdom of the other dev team members, though.

It's still something you can try to use and test until we can implement the intended solution.

However, it's great that you're trying to hack the code because it makes you get acquainted with it and who knows what else you can come up with. ;)

lamama

I just let WinHTTrack (www.httrack.com, website copier) run over my gallery for a while - to test it unter more "realistic" conditions - and it worked ok: no zero-ratings (although httrack hit ratepics.php quite a lot of times).

Quoteit would expect robots to behave a certain way and they may change their behavior.

It maybe won't have a great effect on search engine robots that step by every now and then and maybe they can be defended more effective with robots.txt or .htaccess. I had tools and bots in mind that crawl/download the complete page in one session and in a very linear way: link found first, link followed first.
But I'm looking forward to the 'official' solution.  :)

Mish-A-Man

I use these codes and some bots still vote with zero! I don't know why doesn't work. It'll be very very good if this hack work, its very usefull.. those bots are going to my nervs