-
Notifications
You must be signed in to change notification settings - Fork 0
/
doctorlogin.php
128 lines (116 loc) · 4.36 KB
/
doctorlogin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
session_start();
error_reporting(0);
include("dbconnection.php");
$dt = date("Y-m-d");
$tim = date("H:i:s");
include("dbconnection.php");
if(isset($_SESSION['doctorid']))
{
echo "<script>window.location='doctoraccount.php';</script>";
}
$err='';
if(isset($_POST['submit']))
{
$sql = "SELECT * FROM doctor WHERE loginid='$_POST[loginid]' AND password='$_POST[password]' AND status='Active'";
$qsql = mysqli_query($con,$sql);
if(mysqli_num_rows($qsql) == 1)
{
$rslogin = mysqli_fetch_array($qsql);
$_SESSION['doctorid']= $rslogin['doctorid'] ;
echo "<script>window.location='doctoraccount.php';</script>";
}
else
{
$err = "<div class='alert alert-danger'>
<strong>Oh !</strong> Change a few things up and try submitting again.
</div>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<title>HMS - Admin</title>
<link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<!-- Custom Css -->
<link href="assets/css/main.css" rel="stylesheet">
<link href="assets/css/login.css" rel="stylesheet">
<!-- Swift Themes. You can choose a theme from css/themes instead of get all themes -->
<link href="assets/css/themes/all-themes.css" rel="stylesheet" />
</head>
<body class="theme-cyan login-page authentication" style="background-image:url('images/login.jpeg');background-repeat: no-repeat;background-size: 100%">
<!-- header section -->
<div class="container">
<div id = "err"><?php echo $err;
?></div>
<div class="card-top"></div>
<div class="card">
<h1 class="title"><span>Hospital Management System</span>Login <span class="msg">Hello, Doctor!</span></h1>
<div class="col-md-12">
<form method="post" action="" name="frmadminlogin" id="sign_in" onSubmit="return validateform()">
<div class="input-group"> <span class="input-group-addon"> <i class="zmdi zmdi-account"></i> </span>
<div class="form-line">
<input type="text" name="loginid" id="loginid" class="form-control" placeholder="Username" /></div>
</div>
<div class="input-group"> <span class="input-group-addon"> <i class="zmdi zmdi-lock"></i> </span>
<div class="form-line">
<input type="password" name="password" id="password" class="form-control" placeholder="Password" /> </div>
</div>
<div>
<div class="text-center">
<input type="submit" name="submit" id="submit" value="Login" class="btn btn-raised waves-effect g-bg-cyan" /></div>
</div>
</form>
</div>
</div>
</div>
<div class="clear"></div>
<div class="theme-bg"></div>
</div>
</div>
<!-- Jquery Core Js -->
<script src="assets/bundles/libscripts.bundle.js"></script> <!-- Lib Scripts Plugin Js -->
<script src="assets/bundles/vendorscripts.bundle.js"></script> <!-- Lib Scripts Plugin Js -->
<script src="assets/bundles/mainscripts.bundle.js"></script><!-- Custom Js -->
</body>
</html>
<script type="application/javascript">
var alphaExp = /^[a-zA-Z]+$/; //Variable to validate only alphabets
var alphaspaceExp = /^[a-zA-Z\s]+$/; //Variable to validate only alphabets and space
var numericExpression = /^[0-9]+$/; //Variable to validate only numbers
var alphanumericExp = /^[0-9a-zA-Z]+$/; //Variable to validate numbers and alphabets
var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; //Variable to validate Email ID
function validateform()
{
if(document.frmdoctlogin.loginid.value == "")
{
alert("Login ID should not be empty..");
document.frmdoctlogin.loginid.focus();
return false;
}
else if(!document.frmdoctlogin.loginid.value.match(alphanumericExp))
{
alert("Login ID not valid..");
document.frmdoctlogin.loginid.focus();
return false;
}
else if(document.frmdoctlogin.password.value == "")
{
alert("Password should not be empty..");
document.frmdoctlogin.password.focus();
return false;
}
else if(document.frmdoctlogin.password.value.length < 8)
{
alert("Password length should be more than 8 characters...");
document.frmdoctlogin.password.focus();
return false;
}
}
</script>