Not your usual GET problem
Posted: Wed Mar 26, 2008 8:28 am
I received a piece of code that I had to debug but unfortunately I don' t have an idea on how to fixed it
Here is the problem the code is stop a user getting the same Javascript file more than once.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
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