访问www目录外的php脚本
问题描述:
I have a my login details and connect file defined in a folder which is outside www/public. And it works ok. However, I have a got a form and when the user clicks on submit I would the request to be handled by a file in this folder again due to security reasons (which is outside the www folder). However, it tells me access forbidden as if there's an htaccess file (but there isn't such).
<form action="/C:/xampp/login_mysql/process_login.php" method="post"
name="login_form">
User: <input type="text" name="username" id="username"/>
Password: <input type="password"
name="password"
id="password"/>
<input type="submit"
value="Login" />
</form>
答
The action
attribute is what the browser gets. You'd need to either
- move
process_login.php
to a location under the site root, or - create a file under the site root to
include
process_login.php
.
Example for #2:
<form action="/somewhere/under/the/www/root/process_login.php"
...
and
somewhere/under/the/www/root/process_login.php
:
<?php include 'C:/xampp/login_mysql/process_login.php'; ?>