8. (C) Design a PHP page for authenticating a user.
| <html> | |
| <head> | |
| <title>User authentication</title> | |
| </head> | |
| <body> | |
| <form method="post" action="validate.php"> | |
| Username: <input type="text" name="t1"><br> | |
| Password: <input type="password" name="p1"><br> | |
| <input type="submit" value="Submit"> | |
| <input type="reset" value="Clear"> | |
| </form> | |
| </body> | |
| </html> | |
| validate.php: | |
| <?php | |
| $user=$_POST['t1']; | |
| $pass=$_POST['p1']; | |
| if($user=="abc" && $pass=="1234") | |
| echo "Welcome ".$user; | |
| else | |
| echo "Invalid username and password"; | |
| ?> |
8. (C) Design a PHP page for authenticating a user.
Reviewed by admin
on
December 24, 2019
Rating:
No comments: