2

I need for changeable/hidden download link . For example mt download link is :

example.com/file.rar

and my changable link is :

example.com/download.php?dbj35hdjs5dgsgdjh7djh6sdjsj.rar

or

example.com/dh45hdfv5dhgfbhdf54vg8hd/download.php?file.rar

or ....

how can create link like this ?

what can i do for creat this link ?what do i do ?

I'm need for example because I'm Beginner in php and i can't use symlink() in php please help me for use symlink() / please give me a sample code .

Thanks

Mehrdad
  • 33
  • 3

2 Answers2

1

What you need to do is to store your actual file(s) (e.g. file.rar) outside the web root. Then you need to write your download.php script to read the requested file from disk and serve it. There's loads of information about how to do the latter. You could start somewhere like here generate download file link in php

Community
  • 1
  • 1
liquorvicar
  • 6,081
  • 1
  • 16
  • 21
0

first create a random string. now save it in a database table with attributes (tempString, realfile) so you insert the randomString as tempString and the realfile file.rar

your url should be sth. like this: example.com/download.php?file=dbj35hdjs5dgsgdjh7djh6sdjsj
(with dbj35hdjs5dgsgdjh7djh6sdjsj is the generated random string)

your dowmload.php has to check if the string $_GET['file'] is in tempString of your table (don't forget escaping the inputs), an then the script just returns the realfile, using appropriate headers. Also delete the entry in the DB, so the link is only available ONE time. Other approaches are a counter in the table, to make the link available e.g. 5 times, or datetime for making the link available only a period of time.

Inna
  • 367
  • 3
  • 12