954,591 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

simple url variable

Hello,


i am creating a simple website for a friend. There is a download page that waits 3 seconds bafore redirecting the user directly to the file. I dont want to make a redirect page for each file. so i figured i could put this in the url:

[HTML]download.php?dlurl=URL OF FILE[/HTML]

i can do that but how would i then put it into my page as a redirect? with the variable and all?

could someone please help me a bit here?

thanks

melefire
Newbie Poster
6 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

[php]<?php

if ($_GET['dlurl'])
{
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="downloaded.pdf"');
readfile('original.pdf');
}

?>[/php] as an example.

Gary King
PHP/vBulletin Guru
Team Colleague
417 posts since Nov 2003
Reputation Points: 53
Solved Threads: 5
 

thank you but that does not make sense. i want it to be automated, it shhould not matter about the file type, i just want to be able to print the text after the ?dlurl= on the page.

somebody please help

melefire
Newbie Poster
6 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

You can access the text as how Gary used it in his example. Its basically like accessing a variable you have declared only you got from the previous page.

print $_GET['dlurl'];


Is this what u were looking for? or if you want it to appear as a link on your new page

<a href="<?=$_GET['dlurl']?>" >DOWNLOAD FILE</a>
jblacdao
Light Poster
37 posts since Jan 2007
Reputation Points: 12
Solved Threads: 3
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You