Welcome Guest, Not a member yet? Register   Sign In
Download and general security question
#1

[eluser]BobbyB[/eluser]
Hi boys and girls,
I have a question on how to secure user downloads and keep unauthorized users from downloading other users' stuff.

Right now I have follwowing code which is supposed to stop users that are logged in to guess other users' directories and download files from there.

This is my download function:

Code:
function download(){

check_login(); //////Here I check if a user is logged in at all(Helper). If not he will be redirected.

/////Now I get the users root directory and the file name/id.
$download = $this->input->get_post('download', TRUE);
$root = $this->input->get_post('root', TRUE);

///Now I check if the root directory is the same as the one saved in the session if not the user will be redirected
if ($root!=$this->session->userdata('root')){redirect('');}

.........

Is this a good way to do this?
Any comments welcome.
I am quite new to php/codeigniter so please dont hit me with a stick Smile

Thanks in advance!


Messages In This Thread
Download and general security question - by El Forum - 04-09-2009, 10:13 AM
Download and general security question - by El Forum - 04-09-2009, 10:30 AM
Download and general security question - by El Forum - 04-09-2009, 10:56 AM
Download and general security question - by El Forum - 04-09-2009, 11:32 AM
Download and general security question - by El Forum - 04-09-2009, 01:07 PM
Download and general security question - by El Forum - 04-09-2009, 01:13 PM
Download and general security question - by El Forum - 04-09-2009, 02:05 PM
Download and general security question - by El Forum - 04-09-2009, 02:17 PM
Download and general security question - by El Forum - 04-09-2009, 04:58 PM
Download and general security question - by El Forum - 04-10-2009, 06:44 AM
Download and general security question - by El Forum - 04-10-2009, 06:58 AM
Download and general security question - by El Forum - 04-10-2009, 07:51 AM
Download and general security question - by El Forum - 04-10-2009, 09:36 AM
Download and general security question - by El Forum - 04-10-2009, 10:02 AM
Download and general security question - by El Forum - 04-10-2009, 01:06 PM
Download and general security question - by El Forum - 04-10-2009, 04:23 PM
Download and general security question - by El Forum - 04-10-2009, 09:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB