Logging Dowload Files From Your Server Onto A Html File

free web hosting
Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Logging Dowload Files From Your Server Onto A Html File

NeOniX
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.

 

 

 


Reply

ghostrider
That looks really useful I will have to write something like that for my site.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : logging, dowload, files, server, html, file

  1. Html Form!
    Using MySQL?! (4)
  2. Php Configuration File
    "config.php" (16)
    I did create this topic mainly because I want to know everything about that configuration file. I
    will post other replies if I want to know more depending on your experience. Is this code correct
    for that file: CODE <? $host="localhost"; $dbname="XXX";
    $dbuser="XXX"; $dbpass="XXX";
    $connection=mysql_connect($host, $dbuser, $dbpass) or
    die(mysql_error()); mysql_select_db($dbname) or
    die(mysql_error()); ?> Add your suggestions or i....
  3. Need Some Help In File Browser
    listing all sub folders and files in them. (8)
    Hey I want to create a very simple file browser, so that, it reads all the sub-folders which are
    places in a directory, and the files inside the sub-folders (It reads only files inside sub-folders
    and list them in simply. ) Also, it creates a directory (any name) inside each sub folder. My
    Following code reads on the files inside the main directory, it does not read the files inside the
    sub-folders.. I appreciate any help. CODE <? $path = "./"; $dir_handle =
    @opendir($path) or die("Unable to open $path"); whil....
  4. How Do I Get The Result To "stick" And Add Html Tags?
    Help please? (14)
    $changepage = $_REQUEST ; echo " $changepage "; ?> Okay, I need a
    way for any information typed in my textarea to "stick" on the page in which it "posts". Since I am
    creating a way for my registered users to decorate their "homepages". So any help, tutorials, etc.
    would be greatly appreciated. ^^ Thanks.....
  5. Updating Php File Through A Web Form
    (5)
    Hello, i'm not sure if this can be done with php or not but what i need is a way to make an php
    file that have an html form on it and it will take the info you put in to that form and write it to
    an existing php file, for example: if i have the file news.php and the file news_update.php. if you
    went to news_update.php you would get an form with a text area for you to write a new addition for
    the news.php file and when you hit submit it will add what you typed in the form to the file
    news.php. If this is going to be a big code or a hard one to make but some one think....
  6. Download Script For Mp3 Files
    (0)
    Hello, I'm looking for a download script for sound files (e.g. mp3, avi, wma, and other ones).
    i have found a few download scripts but they would not work for sound files for some reason. also
    this will not be used for allowing downloading of illegal or riped music, what i will be using this
    script for is i'm making a site for my church and the pastor wants to be able to recored the
    services and then have me upload them to the site so that the church members can download them for
    what ever reason. If some one could tell me how to make one or could show me a plac....
  7. Php Without Server
    (6)
    I have just recently bought a laptop and would like to use PHP for local reasons on it, but I am not
    allowed to setu p a local webserver because it would slow down our already crappy internet. Is there
    a way for me to run local PHP without using Apache or any other webserver for purely local uses.....
  8. File Checker-how To Check File Whith Html Through Html?
    (2)
    edit:sorry for the mistake it is php not html and its with not whith my code checking script= CODE
    <?php $file = '$CHECK'; if (file_exists($file)) {
        echo "The file $filename exists"; } else {     echo "The file $filename
    does not exist"; } ?> my question is how to check the file whith html example:on a page
    a text box is provided and a button the user writes a file name (or website) the user clicks on the
    submit button then it checks and show it (with the code above) i got the code C....
  9. Html Code Tester. Online Script
    (15)
    Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if
    this works. I have not tested it yet, but I will later and post back with a demo and fix it up.
    Current script: CODE <?php //Save this as something like htmltest.php function
    CheckForm() { $html_unsafe=$_POST['code']; //Gives us our user
    input $html_safe=str_replace("<?php"," ",$html_unsafe);
    //Starts security measures $html_safe=str_replace("?>","
    ",$html_sa....
  10. Html Site With Login
    Is it possible? (2)
    Hello. I´m building my own site and I need some help... Is it possible to use a login sistem in php
    and mysql database in a html site? ....
  11. Script To Translate Into Bbcode From Html Tags
    (1)
    I was wanting to know how to make a form like they use here for the website form. I want to be able
    to turn stuff in to bbcode. If you know how or would be willing to write the script for me could
    you email me. will@darkzone3.com . I am william to give all credit to who ever makes it. and i can
    put a link back to a site if you want. Please be specific with the topic title. "Help" is never a
    good topic title. This is explained in our forum rules. Title modified. ....
  12. Php And Flash Image Gallery
    Need some help in creating or editing an xml file while viewing some o (5)
    Hello there and thanks for the helping hand you are offering. PHP newbie here! /ph34r.gif"
    style="vertical-align:middle" emoid=":ph34r:" border="0" alt="ph34r.gif" /> So here is my problem:
    On my website I have a flash image gallery.The way the gallery works is by uploading pictures in a
    folder and editing? an xml file.(pics.xml) where it adds the following code when you upload a
    picture: CODE <pictures>     <image location="nameofpicture1.jpg"
    desc="" />     <image location="nameofpicture2.jpg" desc="" /&#....
  13. No File Extension
    (3)
    On MediaWiki, the URL of the content is http://YOURWIKI.com/index.php/Blah Is it possible to
    create a page or two that doesn't have a file extension? If so, how is it done?....
  14. File Upload
    File upload (1)
    I need to add a facility on my customer's website so his clients can send him jobs, typically
    5mb - 50mb. I've looked around the web and researched this, and tried a few tests (failed), but
    my brain's beginning to hurt. Could someone please tell me the best way to go about this,
    please. The site is done in Flash, but I'm sure a link to an html page would be ok if necessary.....
  15. Php Pages Permission On Apache Server
    PHP pages permission on Apache Server (1)
    Hello, I want to know what permissions for PHP pages should be given on Apache web server so that
    PHP pages can be executed. If PHP pages are in a folder, what permissions should be given for that
    folder? ....
  16. Grabt Access To My Protected Files
    grabt access to my protected files (2)
    Hi all, I am sure all of you are great programers but First i am no code programmer i am just
    trying to learn to run my sites, will the problem is i got a code from the web to protect my files
    ,1st i want to know how to work it out then i will try other things but can't let it go without
    a fight thanx all php: CODE <?php if ( ! defined( 'myname' )
    ) {         print "You cannot access this file directly.";         exit(); }
    customer data here ?> now i can't access my files what is the meth....
  17. Security Issue Writing Files
    Security issue writing files (1)
    Hi, first, sorry about my english. i am a beginner with php and i have some question about writing
    files using php in a shared hosting. is a risk?, use database to store data is a better way? i just
    want make an interface (in php) that write the data in a .html extension file to show to everybody
    the html page and just the php interface is to the content manager. thanks in advance ....
  18. <?php ?> Unique Visitors Script
    Flat file unique visitors script (no sessions) (2)
    This is really simple script. Well at least this part is, but it could be extendable. Only problem
    is that it's not really for massive websites with hundread of visitors a day, but rather for
    small ones. But it is a good script to figure out how to make a visitor counter script. Anyway
    here's the snippet. CODE <?php function getVisits($variable) {
        $visits = array();     if ($handle =
    opendir('stats/')) {     while (false !== ($file =
    readdir($handle))) {  ....
  19. <?php ?> Marking Up With Php
    How to simply add HTML tags with PHP (0)
    Just a simple function to mark your queries /smile.gif" style="vertical-align:middle" emoid=":)"
    border="0" alt="smile.gif" /> CODE <?php $uzorak = 'Hosting credit'; //use
    post to get $uzorak variable $tapeti = "Hosting credits are collected by posting at
    the forums. The hosting credits are given after your posts are filtered and depending on its size,
    you get proportional hosting credits. Once you get the required credits you can post an application
    for hosting. One of our admins will then approve your application after which you c....
  20. [php]simple Flat File Text Manipulator
    Example on how to use forms to write to files in PHP (3)
    I made a simple flat file text editor, that can show you probably how simple it is to use forms with
    php and write that data to file. This example has 2 files, submit.php, and postit.html. Submit.php
    is used to write title, and some text, and add html tags, and paragraph tags where new paragraphs
    are. Here's the file with comments. I think that HTML really doesn't need some more
    explaining. CODE Title: <br /> <input type="text"
    name="title" size="53"> <br /> Text: <br />
    <textarea nam....
  21. Edit .txt File In Ftp Via Webpage
    file on external ftp (2)
    Right Im new here and stuggling with a problem im having. I've currently got a Login Script to
    login to a external ftp and it displays the folders contents, however i need it so it echos a
    specific file (coursedata.cfg) into a formarea which you can then edit the file and when u click
    save it overwrites the file with the new one. Im really quiet getting annoyed with it xD as
    everything i do ends up trying to include the file from the webserver the script is hosted on and
    not the external ftp source. thanks Full Code Bellow Simple FTP Manager body { fon....
  22. Reading Files From Directory To Array, And Using $_get To Get Them
    Simple way to manage lot's of files (2)
    Some user posted a similar problem i had when i tried to figure out how to update content on my
    website in less work as possible. This is just part of the "big" plan i have for my site but it can
    be helpfull to you guys if you like FlatFile. I hope that mod's don't mind me posting the
    same code here and on their forums, couse if they do i'll delete it from their forums
    /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> So
    here's the situation. Let's say you have a folder called 'myfilesdirectory' on your
    s....
  23. Forms, Text Files, And Php For A Signature Generator.
    Help a little. (1)
    Hello everyone! I am in need of some code a for a signature generator I am making. I am using
    BuffaloHELP's code for the php file, now I am trying to improve that code by making a form in a
    html file that will have the user say what is on the sig! But now, I need help getting the form
    data that is posted by the user to get into that sig! There is a file, sig.txt, where that tells
    the php file what text will go on the sig. But how can I make the form data in the html file go into
    the text file so it will go onto the sig? You might want to read BuffaloHELP&....
  24. Help With Moving Html Form Results To Shopping Cart?
    (3)
    Hello All- So I think I'm tackling a pretty big project here and was looking for some help... I
    am fairly new to extensive coding (beyond HTML and a little bit of JavaScript) and wanted to know
    how I can recall HTML form results on the next page (in a shopping cart) with a price based on the
    choices picked in the form. It sounds complicated...look at this example: Check out this page:
    http://www.plugcomputers.com/intelprobuild.php See how when the user goes through and picks all
    their computer parts a price at the bottom shows the system price based on their sel....
  25. Php Help Needed Including File In A Page.
    (2)
    i'm a noob in php programming, i can understand and modify php programs, but i dont know to
    write on my own. So please somebody who is well versed in php help me. My need is, I'm
    currently builiding a knowledge base website , i've my own design for the website, check here,
    http://laschatz.info/kzone/ Each page in the left hand site has a tree navigation of all the
    topics available. Since this information must be same in all the pages, presently I need to change
    all the pages after adding a new category. Could you please help me in such a way that I can ad....
  26. Adapting Html Code Embed To Work On Phpnuke
    Help With This Html Code Pls (7)
    QUOTE how can get this html code to work on my phpnuke site? what tags would i
    have to enable in the $Allowable HTML part of my config.php file?? Edited topic title. Moved
    to Programming. ....
  27. Include File.php?id=something
    using the include() function (13)
    Well, I am making a full CMS system for my site, and want to make the index.php file to include the
    view.php?id=1 file. I tried with this code, but it didn't work: CODE <?php include
    'view.php?id=1' ?> This is the error I get: CODE Warning:
    main(view.php?id=1) [function.main]: failed to open stream: Invalid argument
    in C:\server\xampp\htdocs\test\index.php on line 1 Warning:
    main() [function.include]: Failed opening 'view.php?id=1' for inclusion
    (i....
  28. Script: Php Jukebox
    A one file script! (4)
    This scripts is so simple, you dont need to edit ANY of it! All you have to do is make a folder
    called 'songs' and put some audio files in it. Here is the whole page, I named it index.php
    and put it in a folder called 'music': CODE <!DOCTYPE HTML PUBLIC
    "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
    <title>PHP jukebox</title> </head> <body> <!-- ©2005 Craig
    lloyd. All rights reserved. Visit cragllo.com for more sc....
  29. Change Permission With Php Code
    code to change files' and folders' permissions? (3)
    As everyone know, there two ways (that I can think of) to change files' and directories'
    permissions. One is to change it in your cPanel's Disk Manager and the other is with an FTP
    client that supports chmod. Well, I'm doing something for my site that requires files to have
    full permissions (Execute, Write, and Read on all three groups). At first, I thought that if I made
    the directory 777, then every file created in that directory will be 777 as well. I'm wrong. An
    alternative to doing this is to change each file permission myself, but that would be....
  30. Getting List Of Directories And Files Using Php
    PHP Function for Directory and File List (6)
    is there a php function that lists the content of some folder.... example: /New folder new.txt
    left.gif download.zip dc.exe ....so is there..? /rolleyes.gif' border='0'
    style='vertical-align:middle' alt='rolleyes.gif' /> ....

    1. Looking for logging, dowload, files, server, html, file

Searching Video's for logging, dowload, files, server, html, file
Similar
Html
Form! -
Using
MySQL?!
Php
Configuratio
n File -
"config.
php"
Need Some
Help In File
Browser -
listing all
sub folders
and files in
them.
How Do I Get
The Result
To
"stick&
quot; And
Add Html
Tags? - Help
please?
Updating Php
File Through
A Web Form
Download
Script For
Mp3 Files
Php Without
Server
File
Checker-how
To Check
File Whith
Html Through
Html?
Html Code
Tester.
Online
Script
Html Site
With Login -
Is it
possible?
Script To
Translate
Into Bbcode
From Html
Tags
Php And
Flash Image
Gallery -
Need some
help in
creating or
editing an
xml file
while
viewing some
o
No File
Extension
File Upload
- File
upload
Php Pages
Permission
On Apache
Server - PHP
pages
permission
on Apache
Server
Grabt Access
To My
Protected
Files -
grabt access
to my
protected
files
Security
Issue
Writing
Files -
Security
issue
writing
files
<?php
?> Unique
Visitors
Script -
Flat file
unique
visitors
script (no
sessions)
<?php
?>
Marking Up
With Php -
How to
simply add
HTML tags
with PHP
[php]simple
Flat File
Text
Manipulator
- Example on
how to use
forms to
write to
files in PHP
Edit .txt
File In Ftp
Via Webpage
- file on
external ftp
Reading
Files From
Directory To
Array, And
Using
$_get
To Get Them
- Simple way
to manage
lot's of
files
Forms, Text
Files, And
Php For A
Signature
Generator. -
Help a
little.
Help With
Moving Html
Form Results
To Shopping
Cart?
Php Help
Needed
Including
File In A
Page.
Adapting
Html Code
Embed To
Work On
Phpnuke -
Help With
This Html
Code Pls
Include
File.php?id=
something -
using the
include()
function
Script: Php
Jukebox - A
one file
script!
Change
Permission
With Php
Code - code
to change
files'
and
folders'
permissions?
Getting List
Of
Directories
And Files
Using Php -
PHP Function
for
Directory
and File
List
advertisement



Logging Dowload Files From Your Server Onto A Html File



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE