?
Solved

Securing folder using Apache and PHP

Posted on 2005-04-15
7
Medium Priority
?
224 Views
Last Modified: 2010-03-04
I have login system writen on PHP and uses MySQL database.  On the server I have folder which contains html files and pictures, like:

1.html
1.jpg

2.html
2.jpg

3.html
3.jpg

Every user have a number that is stored in his MySQL, and I want to prohibit folder from being browsed by every body exept that user only can see files which are starts from his number.  For example user "yo" have a number "3" stored in his database. I want hi m to be able only see files 3.html & 3.jpg and denied access from his to view any other files!

Is is possible to do something like this using apache and php security. By the way I was using session auth.  If needed .html files can be changed to .php and some security can be added to protect them from being viwed, but how can I protect the pictures???


Thank you...
0
Comment
Question by:g00r00
  • 2
  • 2
5 Comments
 

Author Comment

by:g00r00
ID: 13800150
Anybody? Any clues?
0
 
LVL 14

Expert Comment

by:trigger-happy
ID: 13800361
no apparent idea...the best i can think of is either complicated scripting, or seperated folders...i'm not really sure...i've never tried something like this before...

--trigger-happy
0
 
LVL 14

Expert Comment

by:cracky
ID: 13813335
May I suggest that instead of doing this by filename, you allocate each user their own directory and restrict access like that?

Note that you will need to set up per directory .htaccess restrictions for this at the least, so you will need to add users both to the database and to .htaccess.
0
 

Author Comment

by:g00r00
ID: 13825273
Does any one know any free php scripts that work with MRPG graphs? This is why I am trying to do.!
0
 
LVL 14

Accepted Solution

by:
cracky earned 1000 total points
ID: 13825378
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Loops Section Overview
Suggested Courses
Course of the Month15 days, 12 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question