Jump to content

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


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.