Now there are many Web download files provide statistical features, this article discusses how to use PHP to implement this function, for the need to hide the download file path, avoid users directly using URL download programmer, this article also has some reference value. Implementation environment: LINUX+APACHE+PHP+MYSQLWINDOWS98+PWS4+PHP+MYSQL a database structure database to create a table to store file information, including file encoding, name, download path, statistics, The corresponding SQL file contents are as follows: CREATE DATABASE dl_db; CREATE TABLE dl_file (ID varchar (6), name varchar (), URL varchar ($), count bigint (+)); INSERT into Dl_file VALUES (00 0001, test, Test.zip, 0), INSERT into Dl_file VALUES (000002, TIF, download/123.tif, 0), PHP programming 1, function file function file including database connection initialization function and cue letter Display functions. DL_FUNC.PHP3: 2. Download Connection page The download Connection page reads the download file information from the database and displays it. FILELIST.PHP3: <title>File download</title> "; echo "$arr _dlfile[name]"; echo ""; echo "(Download count: $arr _dlfile[count])"; echo "
";} Mysql_close ($dl _in);? >3. Download page when the file is present, the download page goes to the file to be downloaded, and if an error occurs, a prompt is displayed. FILEDOWN.PHP3: The principle of implementation is to show the connection of all files, and then to get the name and path of the file according to the Filelist.php3 ID, and to download the file by repositioning. The above procedure the author tested, run normally. The file URL can be local, or it can be on a different server. If the contents of the file are stored in the database, or if the file is not in the HTTP and FTP path, the solution can be used to echo the contents of the file to replace the header ("Location: $arrfile [url]"), because the method of reading the file is relatively simple, not to repeat here.
http://www.bkjia.com/PHPjc/532037.html www.bkjia.com true http://www.bkjia.com/PHPjc/532037.html techarticle now there are many Web download files provide statistical features, this article discusses how to use PHP to implement this feature, for want to hide the download file path, to avoid the user directly using the URL to download ...