-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
150 lines (111 loc) · 3.95 KB
/
index.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
require('dbconn.php');
?>
<!DOCTYPE html>
<html>
<!-- Head -->
<head>
<title>Library Member Login Form </title>
<!-- Meta-Tags -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="Library Member Login Form Widget Responsive, Login Form Web Template, Flat Pricing Tables, Flat Drop-Downs, Sign-Up Web Templates, Flat Web Templates, Login Sign-up Responsive Web Template, Smartphone Compatible Web Template, Free Web Designs for Nokia, Samsung, LG, Sony Ericsson, Motorola Web Design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- //Meta-Tags -->
<!-- Style --> <link rel="stylesheet" href="css/style.css" type="text/css" media="all">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<!-- Fonts -->
<link href="//fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<!-- //Fonts -->
</head>
<!-- //Head -->
<!-- Body -->
<body>
<div class="container-fluid" style = "width:80% ; margin: auto ;">
<?php
include('clg-nav.php') ;
?>
<hr>
<div class="container mt-5">
<div class="login" >
<h2>Sign In</h2>
<form action="index.php" method="post">
<input type="text" Name="RollNo" placeholder="RollNo" required="">
<input type="password" Name="Password" placeholder="Password" required="">
<div class="send-button">
<!--<form>-->
<input type="submit" name="signin"; value="Sign In">
</form>
</div>
<div class="clear"></div>
</div>
<div class="register">
<h2>Sign Up</h2>
<form action="index.php" method="post">
<input type="text" Name="Name" placeholder="Name" required>
<input type="text" Name="Email" placeholder="Email" required>
<input type="password" Name="Password" placeholder="Password" required>
<input type="text" Name="PhoneNumber" placeholder="Phone Number" required>
<input type="text" Name="RollNo" placeholder="Roll Number" required="">
<!--
<select name="Category" id="Category">
<option value="GEN">General</option>
<option value="OBC">OBC</option>
<option value="SC">SC</option>
<option value="ST">ST</option>
</select> -->
<br>
<br>
<div class="send-button">
<input type="submit" name="signup" value="Sign Up">
</form>
</div>
<div class="clear">
</div>
</div>
<div class="clear"></div>
</div>
</div>
<?php include('clg-footer.php') ; ?>
<?php
if(isset($_POST['signin']))
{$u=$_POST['RollNo'];
$p=$_POST['Password'];
//$c=$_POST['Category'];
$sql="select * from LMS.user where RollNo='$u'";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$x=$row['Password'];
$y=$row['Type'];
if(strcasecmp($x,$p)==0 && !empty($u) && !empty($p))
{
echo "Login Successful";
$_SESSION['RollNo']=$u;
if($y=='admin')
header('location:admin/index.php');
else
header('location:student/index.php');
}
else
{ echo "<script type='text/javascript'>alert('Failed to Login! Incorrect RollNo or Password')</script>";
}
}
if(isset($_POST['signup']))
{
$name=$_POST['Name'];
$email=$_POST['Email'];
$password=$_POST['Password'];
$mobno=$_POST['PhoneNumber'];
$rollno=$_POST['RollNo'];
$type='Student';
$sql="insert into LMS.user (Name,Type,RollNo,EmailId,MobNo,Password) values ('$name','$type','$rollno','$email','$mobno','$password')";
if ($conn->query($sql) === TRUE) {
echo "<script type='text/javascript'>alert('Registration Successful')</script>";
} else {
echo "<script type='text/javascript'>alert('User Exists')</script>";
}
}
?>
</body>
<!-- //Body -->
</html>