1-Download and update corresponding txtfile
//Insert your call to the php3 script in the body tag
//first parameter : url = location of the zipfile
//second parameter : ref= filezip (short filename, no extension)
2-Read the last score in the corresponding txtfile
//One parameter : graal = name of the corresponding txtfile
//(short filename, no extension)
--------------------------------
download test1.zip
(
downloads)
--------------------------------
Free Php3/JavaScript provided by ©2003-VB'Breizh
WebSite
==============================================
@@@@@@@ php3 file (download.php3) @@@@@@
==============================================
// extract parameter
$zipfile="$url";
$datafile=$zipfile.".txt";
//create corresponding data file if it does'nt exist
if(!file_exists("$datafile")) {
$fp=fopen($datafile,"w");
fputs($fp,"0"); // initialize score
fclose($fp);
}
$fp = fopen($datafile,"r+"); // open data
$downld=fgets($fp,10); // read score
$downld++; // incrementation
fseek($fp,0); // insert position
fputs($fp, $downld); // save
fclose($fp); //close
?>
==============================================
@@@@@@@ php3 file (update.php3) @@@@@@
==============================================
//headers
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
//-----extract (graal) parameter from url
// txtfilename corresponding to the zipfilename
$graal = $HTTP_GET_VARS["graal"];
$txtfile =$graal.".txt";
$score=0;
if(file_exists("$txtfile")) {
$fp=fopen($txtfile,"r");
$score=fgets($fp,10);
fclose($fp);
}
echo "document.write($score);";
?>