Login script help
alright, I'm copying this tutorial to create a login page
and it starting to piss me off, and I dont know why its not redirecting to the page I want to redirect
and this is my script for the login page
if($_SERVER["REQUEST_METHOD"] == "POST")
// username and password sent from Form
$sql="SELECT id FROM Account_Info WHERE UserName='$myusername' and Password='$mypassword'";
// If result matched $myusername and $mypassword, table row must be 1 row
$error="Your Login Name or Password is invalid";
thank you for all of your help in advance
- The "redirection" is clearly in the header function. Have you verified that page exists: copy the entire URL into the browser address and click...you should not get a "page not found/404" error
- If the flow of code does not get to the header function, that means PHP found an error in execution at an earlier point. It usually sends the error to standard output (to your browser in the HTTP response. What does that output say?
There are many points in your code where PHP execution errors are possible. You must not only resolve all PHP errors, but also warnings and notices...they are usually problems that should be errors.
- is your HTTP request what it should be?? Did you set up a form (HTML form markup) with textbox elements that are named 'username' and 'password' that are transmitted with the click? Did you use the POST instead of GET method? The script wants POST.
- is your MySQL database set up properly?
- you have an include file: was it found?? using the require() function instead of include would given an error rather than perhaps a notice or warning.