Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm new to PHP. So far I'm trying to create a login & registration system.

My goal is to have visible PHP pages and then only runnable PHP pages which sort of route traffic. I have a page login.php which is in the document root (/var/www/html).

There is a form which posts to scripts/checklogin.php. I set up scripts as a location in apache and to deny from all, in hopes that the PHP files in scripts would receive inputs via POSTs, process data, and then redirect accordingly via header(...).

I'm getting denied access issues when the request POSTs to scripts/checklogin.php, which I'm guessing is due to the deny from all.

Any ideas?

share|improve this question
    
If you deny access to your scripts you won't be able to access them. That's what deny is for. Don't do it, and you should be fine. And now seriously, why do you need the scripts to be non-accessible? –  Karol Piczak Apr 9 '11 at 20:05

1 Answer 1

You can put an .htaccess file in the scripts directory like that:

Deny from all

An just include the files you are going to use from your main scripts, so you cannot executem them from the browser (for example: http://localhost/scripts/test.php, will give you a 403 forbidden error); but include them, for example:

include("./scripts/test.php");

Is not denied the access; that's because they run in different layers.

I guess that was your doubt.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.