RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting

Show secured file

Join Date: Jul 2006
Posts: 6
Reputation: dcarrillo18 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
dcarrillo18 dcarrillo18 is offline Offline
Newbie Poster

Help Show secured file

  #1  
Mar 20th, 2007
I have a folder called _secure in which I have a .htaccess file that denies all access to the _secure folder. Within the _secure folder I also have a swf file. I'm using PHP to retrieve the secured swf file and show it if the user is logged in. For some reason my code bellow doen't seem to work. I would appreciate any help.

$filename = $_GET['filename'];
$dir = '_secure/';

if ( user_logged_in() ) {
download_file( $filename, $dir );
} else {
header("HTTP/1.1 404 Not Found"); // dead end
}

function download_file( $fname, $path) {
$fpath = $path.$fname; // absolute path to file
$fsize = filesize( $fpath ); // size of file

header('Content-Type: application/x-shockwave-flash');
$content = file_get_contents($fpath);
echo $content;
}
AddThis Social Bookmark Button
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:19 pm.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC