Page 1 of 1

Not your usual GET problem

Posted: Wed Mar 26, 2008 8:28 am
by Rovas
I received a piece of code that I had to debug but unfortunately I don' t have an idea on how to fixed it :(
http://www.example.com/engine%20%messag ... mon/js_get?
file=common/js_get?file=msie/js_get?file=msie/js_get?file=msie/js_get?fi
le=msie/js_get?file=common/js_get?file=common/js_get?file=msie/js_get?fi
Here is the problem the code is stop a user getting the same Javascript file more than once.

Code: Select all

 
 
//in the make_head.php $head contains all the tags with metadata from html tag head
$head="<head>";
//some lines not important
$head.='<script language="javascript" type="text/javascript" src="js_get?file=common"></script>';
$head.='<script language="javascript" type="text/javascript" src="js_get?file='.$GLOBALS["BROWSER"].'_common"></script>';
//in the anti_spam.php this function appends the Javascript to a file that will be cached
    function anti_boot($delay,$calls) {
        if  ($GLOBALS['CALLER_NETWORK']=='localhost') return; 
                //create the temporary file 
        $completfilename=$GLOBALS['BOOTER_ROOT'].'/'.$GLOBALS['CALLER_NETWORK'].'_'.$_SERVER['REMOTE_ADDR'].'.tmp';
                if (file_exists($completfilename)) {
            //check to see if the creation time is the same or smaller than the request
                        if (@filemtime($completfilename) < (time() - $delay)) {@file_put_contents($completfilename,'.'); return;}
                        // more than $cals request delete the temporary file 
            if (@filesize($completfilename) > $calls) {myErrorHandler (-53,'site boot', __FILE__, __LINE__); sleep($delay); @unlink($completfilename); return;} 
        }
        @file_put_contents($completfilename,'.',FILE_APPEND);
    }
//create.php creates the webpage
   anti_boot(2,400);
   //create and display the temporary file 
 

Re: Not your usual GET problem

Posted: Wed Mar 26, 2008 9:58 am
by pickle
I'm not totally sure what your problem is or what you've tried to fix it.

Re: Not your usual GET problem

Posted: Wed Mar 26, 2008 2:23 pm
by Rovas
The dude who made the code made a function that doesn' t permit a computer to request more than 400 times.The request is made using GET a file that is in the cache of the webserver. This file is made by putting some javascript files togheter. It' s crazy I know but that' s the way he wants it.