Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include 'db.php'; ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Login page</title>
- <link rel="stylesheet" href="main.css">
- </head>
- <body>
- <form action="login_process.php" method="post" onsubmit="return validate_form(this)">
- <div class="container">
- <?php
- if(isset($_GET['error']) && $_GET['error']=='yes') {
- echo 'Incorrect Password ! try again !!';
- }
- if(isset($_GET['error']) && $_GET['error']=='username'){
- echo 'Wrong username';
- }
- ?>
- <h2>Log in</h2>
- <label><b>Username</b></label>
- <input type="text" placeholder="Enter Username" name="username" >
- <label><b>Password</b></label>
- <input type="password" placeholder="Enter Password" name="password" >
- <button type="submit">Login</button>
- <input type="checkbox" checked="checked"> Remember me
- </div>
- <div class="container" style="background-color:#f1f1f1">
- <a href="logout.php">Logout</a>
- </div>
- </form>
- <script>
- function validate_required(field, alerttxt){
- with(field){
- if(value==null||value==""){
- alert(alerttxt); return false;
- }else{
- return true;
- }
- }
- }
- function validate_form(thisform){
- with(thisform){
- if(validate_required(username,"username must be filled out")==false){
- username.focus();return false;
- }else if(validate_required(password,"password must be filled out")==false){
- password.focus(); return false;
- }
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement