-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.html.php
85 lines (68 loc) · 1.9 KB
/
login.html.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
<?php
session_start();
if($_SESSION)
{
$email=$_SESSION["email"];
{
include("dbcon.php");
$result = mysql_query("SELECT * FROM admin WHERE email LIKE '$email'");
$info = mysql_fetch_array($result);
if($info[email]==$email)
header( "refresh:0;url=teacher.php" );
mysql_query($sql,$con);
mysql_close($con);
}
{
include("dbcon.php");
$result = mysql_query("SELECT * FROM login WHERE email LIKE '$email'");
$info = mysql_fetch_array($result);
if($info[email]==$email)
header( "refresh:0;url=student.php" );
mysql_query($sql,$con);
mysql_close($con);
}
}
?>
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Login</title>
<link rel="stylesheet" href="css/login.css">
<style>
body{
background-image: url(image/login_back.jpg);
background-repeat: no-repeat;
background-size:cover;
}
</style>
</head>
<body>
<?php include('/homenav.html'); ?>
<div id="boxForm">
<h2 id="title">Login Form</h2>
<form action="login.php" name="myForm" onsubmit="return validateForm();" method="post" >
<input class='text' type='email' name='email' placeholder='Email' required>
<br>
<input class='text' id='pass' name="pass" type='password' placeholder='Password' required>
<br><p></p>
<input id='rememberMe' name='check' value="yes" type='checkbox' checked> <label>Remember me</label>
<br>
<input class='button' type='submit' value='Login'>
</form>
</div>
<script src="js/index.js"></script>
<script src="js/index.js"></script>
<script>
function validateForm() {
var x = document.forms["myForm"]["email"].value;
var atpos = x.indexOf("@");
var dotpos = x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) {
alert("Not a valid e-mail address");
return false;
}
}
</script>
</body>
</html>