Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form id="login" action="process_login.php" type="POST" >
- Username: <input type="text" id="username" />
- Password: <input type="password" id="password" />
- <input type="Submit" value="Login" />
- </form>
- In process_login.ph file...
- $uname = $_POST['username']; // ID of username field in form will be username
- $pswd = $_POST['password']; // ID of password field in form will be password
- $sql = "SELECT username from users where username='$uname' AND password ='$pswd'"; // make sure the column names match the fields in your database
- $result = mysql_query($sql);
- $row = mysql_fetch_row($result); // will return number of match rows
- if ($row) {
- header("Location: /successful.html"); // redirect the user to whichever page
- } else {
- header("Location: /failed.html");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement