Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Logging Dowload Files From Your Server Onto A Html File
NeOniX
post Jun 17 2006, 07:45 PM
Post #1


Newbie [Level 1]
*

Group: Members
Posts: 22
Joined: 17-June 06
From: Nebuchadnezzar, dock 6, Zion
Member No.: 25,271



Well, i had the idea of logging the downloads from my web in a html file few weeks ago, and i solved it with a lil php page included in my homepage. You could name the links with a name like "download.php?file=filename.ext" and then, in the download.php put the next code:

(well you put the html and head and body tags if u want, i only write the php here)
CODE
<?
if (isset($_GET['file'])) $file=$_GET['file']; //so it gets the GET data from url (file=filename.ext);

$ip=$_SERVER['REMOTE_ADDRESS'];
$file=fopen('download_log.html','a');
$date=date('d-m-y H:i:s');
$text="<br><hr><p>".$file.", ".$ip." on date ".$date;
fputs($file,$text); /* At that point, the download try is logged, so if he doesn't proceed the download, will be logged anyway */
/* if you want to be secure and avoid the ppl downloading what they dont have to do, you could add every file name to a MySQL DB and add an ID, so you were only to need to put in your links the id like "download.php?id=257", but thats a bit long to explain, so i continue with the simple explanation */

echo "You're going to download the file <b>".$file."</b>. If you want to proceed, click <a href='".$file"' target='_blank'><b>here</b></a>";
?>


Obviously you can improve that code much more, but that simple thing should work only by being at the same folder of the files to download.
Go to the top of the page
 
+Quote Post
ghostrider
post Jun 20 2006, 09:30 PM
Post #2


Super Member
*********

Group: Members
Posts: 398
Joined: 9-June 06
From: Wisconsin
Member No.: 24,924



That looks really useful I will have to write something like that for my site.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Getting List Of Directories And Files Using Php(6)
  2. Change Permission With Php Code(3)
  3. Script: Php Jukebox(6)
  4. Include File.php?id=something(13)
  5. Adapting Html Code Embed To Work On Phpnuke(7)
  6. Php And Disabling Html Tags(11)
  7. <?php ?> Unique Visitors Script(2)
  8. Security Issue Writing Files(1)
  9. Grabt Access To My Protected Files(2)
  10. Php Pages Permission On Apache Server(1)
  11. File Upload(1)
  12. No File Extension(3)
  13. Php And Flash Image Gallery(5)
  14. Script To Translate Into Bbcode From Html Tags(1)
  15. Html Site With Login(2)
  1. Html Code Tester. Online Script(15)
  2. File Checker-how To Check File Whith Html Through Html?(2)
  3. Php Without Server(6)
  4. Download Script For Mp3 Files(0)
  5. Updating Php File Through A Web Form(5)
  6. How Do I Get The Result To "stick" And Add Html Tags?(14)
  7. Need Some Help In File Browser(8)
  8. Php Configuration File(16)
  9. Html Form!(4)
  10. Dohwow(2)
  11. Linux/ Apache /mod_rewrite Issue(4)
  12. Weird Formatting: Embedding Php Into Html(9)
  13. Php - Fetching Random Line From A Text File(0)


 



- Lo-Fi Version Time is now: 23rd November 2008 - 12:51 AM