PHP Security

Posted on 2006-03-30
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'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.

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

    Expert Comment

    by:Tomeeboy supports htaccess files as far as I know... Their help section even talks about them:

    Author Comment

    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

    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

    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

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    As this topic comes over and over again in different forms, I've finally decided to write a short (yea, right...) article / tutorial about pagination with PHP with MySQL database. There are dozens of these kind of tutorials, I know - I wanted to mak…
    The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    733 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now