-
Notifications
You must be signed in to change notification settings - Fork 2
/
student_login.php
84 lines (79 loc) · 2.61 KB
/
student_login.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
<?php
require_once "config.php";
// mysql_select_db();
session_start();
// Check if the user is already logged in, if yes then redirect him to welcome page
if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true){
header("location: extraCo_curricular.php");
exit;
}
if (isset($_POST['submit'])){
$uname=$_POST['uname'];
$password=$_POST['password'];
$regdno=$_POST['regdno'];
$query="select * from student where regdno='$regdno' and name='$uname' and password='$password' ";
$result=mysqli_query($conn,$query);
if(mysqli_num_rows($result)==1){
echo "You have sucessfully logged in";
session_start();
$_SESSION["loggedin"] = true;
$_SESSION["username"] = $uname;
if ($result->num_rows > 0)
{
// fetch all data from db into array
$row1 = $result->fetch_assoc();
}
//while($rows1=$result->fetch_assoc())
//{
$num=$row1['regdno'];
$_SESSION["num"] = $num;
//}
header("location: extraCo_curricular.php");
exit();
}
else{
echo "You entered wrong credentials ";
echo $uname;
exit();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>student login</title>
<link type="text/css" rel="stylesheet" href="stylesheet.css">
<style>
</style>
</head>
<body>
<div style="text-align:center">
<form action="#" method="post">
<table align='center' style="font-weight:bold;">
<tr>
<td><h1 style='text-align:center'> student login</h1></td>
</tr>
<tr>
<td align='right'>
<label for="student_regd">Regdno:</label>
<input type='text' name="regdno" id="student_regd" required></td>
</tr>
<tr>
<td align='right'>
<label for="student_name">Name:</label>
<input type='text' name="uname" id="student_name" required></td>
</tr>
<tr>
<td>
<label for="student_password">Password:</label>
<input type='password' id="student_password" name="password" required></td>
</tr>
<tr>
<td align='center'><br>
<input type="submit" name="submit" class="button" value="Login"/>
</td>
</tr>
</table>
</form>
</body>
</html