Learn how to a build a cloud-first strategyRegister Now


PHP Security

Posted on 2006-03-30
Medium Priority
Last Modified: 2008-03-10
How would one go about protecting a folder on a webserver using PHP? I'm not able to use .htaccess for some reason on the servers I use for hosting my website. I'm using GoDaddy.com's package and that seems to not let me use .htaccess. Maybe I'm using it wrongly or something. But is this a fact, that GoDaddy doesn't accept .htaccess?

Anyway, I'd like to be able to have a simple login screen where poeple login with a username/password and it gives them access to the folder+links in the folder that has pages in it (and all it's subfolders). Also, it shouldn't let people surf directly to a link in the folder (eg. http://www.site.com/admin/loggedin.php)

Can anyone help me with this problem?
Question by:Gamzarme
  • 2
  • 2
LVL 15

Expert Comment

ID: 16338086
GoDaddy.com supports htaccess files as far as I know... Their help section even talks about them:

Author Comment

ID: 16338216
Thanks, got it working..kinda.
It works on any other file besides regular .php files. Not sure why though.
Any workaround for this?

Also, can you integrate the login box into a webpage php file?
LVL 15

Accepted Solution

Tomeeboy earned 450 total points
ID: 16338359
As far as I know, the only way to accomplish that kind of integration would be to have PHP read and interact with the .htaccess file.  By the time you were done with it, you might as well have just made a simple login script (or used an existing one).

As for the .php file problem, I'll have to look into that a bit.  I never really use htaccess for anything, so I'm unfamiliar with that problem.  It could have something to do with PHP being parsed server side.

If you want the integration into a custom login page / form, you may just want to go with a simple authentication script that uses PHP / Sessions.

Author Comment

ID: 16388030
What do you mean "have PHP read and interact with the .htaccess file"? How would one go about doing that?

About a script, what does one look like?
Also, sessions, new to me also.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month20 days, 21 hours left to enroll

810 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