JezK
Edit File: index.php
<html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <link rel="shortcut icon" type="image/png" href="../img/favicon.png"> <title>Video Conference</title> <!-- <link rel="shortcut icon" type="image/png" href="assets/img/favico.png" /> --> <link rel="stylesheet" href="css/bootstrap.min.css"> <!-- Our Custom CSS --> <!-- <link href="assets/Bootstrap-4-Date-Time-Picker/build/css/tempusdominus-bootstrap-4.css" rel="stylesheet"> --> <link rel="stylesheet" href="css/style.css"> <script type="text/javascript" src="js/bootstrap.bundle.min.js"></script> <script type="text/javascript" src="js/jquery.slim.min.js"></script> <script src="js/bootstrap.min.js" type="text/javascript"></script> </head> <body> <nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top"> <div class="container-fluid mx-4"> <a class="navbar-brand" href="index.php"><img src="img/logo1.png" alt="logo" width= "207px" height="41px"></a> </div> </nav> <?php // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // error_reporting(E_ALL); include('classes/class_admin_videoconsultation.php'); $videocon = new admin_videoconsultation(); if (isset($_SESSION['aid'])) { echo "<script>window.location='dashboard.php';</script>"; } if (isset($_POST['action']) && $_POST['action'] == 'login') { $login = $videocon->login($_POST); if ($login) { echo "<script>window.location='dashboard.php';</script>"; exit; } else { echo "<script>alert('Invalid Credentials');</script>"; } } ?> <section class="mt-5 pt-4 mx-5"> <div class="container-fluid bg-light text-dark"> <div class="row justify-content-center align-items-center login-border"> <div class="col col-sm-8 col-md-8 col-lg-6 col-xl-5"> <form action="" method="POST"> <h6 class="mt-4 mb-5 style-login fancy-underline">Login</h6> <div class="form-group"> <label for="username" class="fieldName">Username</label> <input type="text" class="form-control formField-control" name="username" id="username" value="<?php if (isset($_POST['username']) && $_POST['username'] != '') { echo $_POST['username']; } ?>"> </div> <div class="form-group"> <label for="password" class="fieldName">Password</label> <input type="password" class="form-control formField-control" name="password" id="password" value="<?php if (isset($_POST['password']) && $_POST['password'] != '') { echo $_POST['password']; } ?>"> </div> <div class="form-group "> <!--<input type="checkbox" id="test3"> <label for="test3" class="fieldName pt-1">Remember Me</label>--> <a href="" data-toggle="modal" data-target="#myModal" class="float-right fieldName-forgot pt-1">Forgot Password?</a> </div> <input type="hidden" name="action" value="login"> <div class="form-group mb-5"> <button class="btn basic-btn-color w-100" onclick="return loginvalidation();">Login</button> </div> <div class="form-group"> <p style="text-align: center; font-size: small;">version: 2.2</p> </div> </form> </div> </div> </div> </section> <div class="container"> <!-- The Modal --> <div class="modal" id="myModal"> <div class="modal-dialog"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header border-0"> <button type="button" class="close px-2 pt-2 pb-0" data-dismiss="modal">×</button> </div> <!-- Modal body --> <div class="modal-body mx-4"> <h5 class="modal-title style-login mb-3">Forgot Password</h5> <p class="modal-font"> Enter your registerd email. We will send you mail to recover your password</p> <!--start password Form --> <div class="form-group"> <label for="forget_email" class="fieldName">Email ID</label> <input type="text" class="form-control formField-control" name="forget_email" id="forget_email"> </div> <div class="form-group"> <button class="btn basic-btn-color w-100" onclick="return forgetEmail();">Submit</button> </div> <!--end password Form --> </div> </div> </div> </div> <!-- </div> --> </body> </html> <script> function forgetEmail() { var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; if ($('#forget_email').val() == '') { alert('Please enter email'); return false; } else if ($('#forget_email').val() != '') { var email = $('#forget_email').val(); if (!email.match(mailformat)) { alert("Please enter valid email address"); return false; } else { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if(this.responseText == 1) { alert("Password sent successfully") ;window.location="index.php"; }else if(this.responseText == 0){ alert("Given email not exist"); return false; }else{ alert("Sorry some error occured"); window.location="index.php"; } //document.getElementById("txtHint").innerHTML = this.responseText; } }; xmlhttp.open("POST", "ajax.php?action=forgetpwd&email=" + email, true); xmlhttp.send(); } } } function loginvalidation() { if ($('#username').val() == '') { alert('Please enter username'); return false; } else if ($('#password').val() == '') { alert('Please enter password'); return false; } } </script>