Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 29th Dec 2009, 12:06 AM   #1
A rat after money...
War Room Member
 
HomeBizNizz's Avatar
 
Join Date: 2009
Location: Inside a cheese...
Posts: 770
Thanks: 365
Thanked 80 Times in 68 Posts
Default
A simple PHP download script
Share on: 
fb share twitter share gplus share more share

In this PHP script you have to write in a 3 letter code (can easily be changed).
And click the submit button.
The PHP script will send the requst to the right file by a PHP redirection to download the right file.

To use it have a subfolder names "files".
Plase your files there.
And edit the filepaths in the PHP script.

You can also place a .htaccess file in the files folder to deny all acess to the files from outside.
And you can also place the filefolder (I think) outside the www-root.
Just copy and paste the code below to a empty php file (*.php).
Or place it between the <body> and </body> tags.

<?php

$code = $_POST['code'];

if ( $code == "rtf" ) {
header( 'Location: files/code.rtf' ) ;
}

if ( $code == "odt" ) {
header( 'Location: files/code.odt' ) ;
}

if ( $code == "pdf" ) {
header( 'Location: files/code.pdf' ) ;
}

?>

<p>You can choose to download a file.<br />
Choose between 3 file extentions.<br />
Type in the following 3 letter word in <strong>bold</strong> that is either <strong>rtf</strong>, <strong>odt</strong> or <strong>pdf<br />
</strong>This will send a request to the right filetype . </p>
<form name="dl-form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="code">
<input type="submit" name="Submit" value="Submit">
</form>
HomeBizNizz is offline  
Unread 29th Dec 2009, 07:56 AM   #2
HyperActive Warrior
 
milo_pl's Avatar
 
Join Date: 2009
Location: EU
Posts: 120
Thanks: 8
Thanked 7 Times in 5 Posts
Default
Re: A simple PHP download script
Share on: 
fb share twitter share gplus share more share

Sth wrong with your connection - you've posted 3 threads with the same title...


milo_pl is offline  
Closed Thread


Bookmarks

Tags
download, php, script, simple


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 07:34 PM.