I wrote a login code in PHP:
<form NAME="form1" METHOD="POST" ACTION="operation/validateLogin.php">
Username <br/><input name="username" type=text autocomplete="off"><br/><br/>
Password <br/><input name="password" type=text autocomplete="off"><br/><br/>
<button class="btn btn-primary submit" type="submit">Sign In</button>
</form>
When I submit the form the credentials are sent to a validation file. If an error occurs the file sends the error message back to the login page:
header("Location: http://localhost/demoapp/login.php/?em=28");
I handle the 'GET' parameter and print the error message:
if (isset($_GET['em'])){
if($_GET['em'] == 28){$errorMessage = "Your username or password was incorrect.";}
}
Now the user needs to try to login again by resubmitting the form, but the action of the form is:
operation/validateLogin.php
and the URL is now:
http://localhost/demoapp/login.php/?em=28
Therefore, when the form is submitted the url becomes:
http://localhost/demoapp/login.php/operation/validateLogin.php
When it should be...
http://localhost/demoapp/operation/validateLogin.php
How do you prevent this from happening to the URL?