This is a discussion on Strange 403 error - no problem with localhost within the Apache Web Server forums, part of the Web Server and Related Forums category; I've searched the forums on this and can't seem to find out what's going on. I'm ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I've searched the forums on this and can't seem to find out what's
going on. I'm running Apache 2.2 with PHP 5 on Windows. I have a file, index.php (below) that does load: the form with the name, password, and submit all load on the screen. However, when I click submit, I'm getting "You are not authorized to access this resource" regardless of correct name/password. Interestingly enough, when I access this page from /localhost, the submit button works and the private data is displayed. However, when I try to access this page from the public IP address, I'm getting a 403 error after I click submit. I've checked my httpd.conf file, but nothing seems to be amiss. This same program works just fine on my other computer. Here is the file: <?php //create short names for variables $name= $_POST['name']; $password = $_POST['password']; if(empty($name)||empty($password)) { ?> <h1>Please Log In</h1> <form method ="post" action="<?php $_SERVER['PHP_SELF'] ?>"> <table border = "1" <tr> <th>Username</th> <td><input type="text" name="name"> </td> </tr> <tr> <th>Password</th> <td><input type="password" name="password"> </td> </tr> <tr> <td colspan="2" align="center"> <input type = "submit" value = "Log In"> </td> </tr> </table> </form> <?php } else if($name=='foo' && $password=='bar') { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> //some other junk <?php } ?> |
|
|||
|
Cut wrote:
> I've searched the forums on this and can't seem to find out what's > going on. > I'm running Apache 2.2 with PHP 5 on Windows. I have a file, > index.php (below) that does load: the form with the name, password, > and submit all load on the screen. However, when I click submit, I'm > getting "You are not authorized to access this resource" regardless of > correct name/password. > Interestingly enough, when I access this page from /localhost, the > submit button works and the private data is displayed. However, when > I try to access this page from the public IP address, I'm getting a > 403 error after I click submit. I've checked my httpd.conf file, but > nothing seems to be amiss. This same program works just fine on my > other computer. > $name= $_POST['name']; This can be a number of issues. My suggestion is you address one issue at a time, then test each issue; be patient. There are many tutorials available on the web which instruct how to address each of these issues. Your Windows firewall configuration could be an issue if running an NT5 type; xp home pro media. Apache needs to be added to your "exceptions" in your firewall to allow services for your local network and the internet. Apache must be running as a background service. Check your directory permissions for the directory where you are writing a file. You need to turn on "file sharing" for this directory and enable "allow changing files" to write. Usually turning on file sharing and changing files for a parent directory containing your child directory will do. However, this grants permission to write for all child directories; you might not want to open up all directories. For some very rare circumstances, you need to enable your executable file for "run as" then select an administrator account and enter a password. Doubtful this is a problem but keep this in mind. A restricted local user cannot grant permission for internet file sharing. My presumption is your Apache is under an Administrator or All Users. Again, doubtful this is an issue. Check your Apache httpd.conf file to be sure a POST method is allowed for your directory. Your directory will need to be in Apache root, this is, under htdocs OR aliased in your httpd.conf file with appropriate directives enabled. Google searching will help you with each issue. Purl Gurl |