htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Using PHP to check user permissions and outputting a file?
PostPosted: 24 Mar 2008 09:41 
Offline

Joined: 24 Mar 2008 09:38
Posts: 1
Hello everyone!

I am setting up a system where I have a directory of renders (pre-cut images for graphics) and I do not want them accessible to anyone who is not a member of the premium usergroup on my vBulletin forum. I used a htaccess script of "Order Allow, Deny" to make the directory completely unaccessible. I'm sure my error lies in here, but I'm not sure.

I used the following code on the page that will allow the user to download the files from:

Code:
<?php
if ($vbulletin->userinfo['usergroupid'] == '6' )
   {
   echo "Welcome to the premium section!<br /><a href='depu/Avatars.rar'>A</a>";
             } else {
             echo "You do not have permission for this page"; }
   ?>


When I go to right click and save as for the file, it just brings up a 404 error page. When I click on the file with a left click, it brings up the Internal Server Error page. My .htaccess file for the directory the Avatars.rar file is in says:


Order allow, deny

I set the htaccess up to make it so if someone outside of the usergroup finds out the file name in the directory (ie Avatars.rar), they can't just go to mysite.com/depu/Avatars.rar and download it. Should I have a different command in the htaccess file? Or does the php code have to include something else?

And when I load that page in my main page using a php include, it doesn't let me download the rar file. Do I have to include some type of php code inside of the htacces? Or did I mess up my coding?


Top
 Profile  
 
 Post subject:
PostPosted: 26 Mar 2008 19:41 
Offline

Joined: 28 Feb 2007 17:16
Posts: 40
Good detailed questions, could you post more of your .htaccess files, and how you are doing the various things you mention..


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB