Re: Download system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, March 21, 2005 3:45 pm, JoShQuNe \(TR\) said:
> Hi, i want to add my site a more specific download system. The redirecting
> is now done by directly
> giving the path of the file to variable. I want to do it over an id
> number.
> (now: dl.php?rel=/files/somefile.zip, i want: dl.php?id=64b3j283) The file
> path and id is read
> from mysql table. System is now; it matches from table and lets visitor to
> download but putting
> this kind of path is something useless. Download script is just used for
> counting the hit but for
> example i want to rename the file while giving to visitor instead of
> letting user to learn where
> it is stored and its real name, The_Justice_by_Someone_MyDomain_com.zip
> looks like what i want to
> have. I tried this system with header("Location: ......"); but it just
> opened a new page and
> nothing happened else. For example if visitor uses FlashGet i want him to
> see just an address
> which doesnt involve the real path and name. If any body can help me,
> please.. Thanx a lot..

Some snippets of ideas that should be useful to you:

Build a table that relates secret tokens to filenames:

create table downloads (
  token char(32) unique not null primary key,
  filename varchar(255),
  whattime time_stamp
);



Generate a secret token:
$token = md5(uniqid(rand(), true));

Put the file they asked for and the token in the table:
$query = "insert into downloads (token, filename) values ('$token',
'$download')";

You're on your own for the rest.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux