Jump to content

Security on a download page that has a session further down already


deleet

Recommended Posts

Hi all,

 

I have a shopping cart that people can download from, but I didn't want anyone getting to it unless they had a "1" in the database under the "level" column.  So I put this in:

 

<?php

session_start();

if ($_SESSION['level']!=1)
{header over to register page instead}

?>

 

But the thing is that someone who's patient can sniff out the store's actual URL and just get right to it and start downloading.  Without needing anyone to code any of it, I'm just wondering what coding elements I should use to screen out people who aren't in the database with a "1" designation (paid), most likely on the same page.

 

Thanks much.

Serve the file dynamically. This post should give you an idea of how to do it. If you are serving large files you shouldn't use readfile() though; it loads up the entire file in memory. You might want to use a combination of fopen, fread, feof and fclose to serve smaller chunks of the file sequentially instead.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.