-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
102 lines (78 loc) · 1.94 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
<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
<style>
.button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
}
.button2 {
background-color: white;
color: black;
border: 2px solid #008CBA;
}
.button2:hover {
background-color: #008CBA;
color: white;
}
</style>
</head>
<body>
<?php
$email=$_POST['emailval'];
$name=$_POST['nameval'];
$servername = "localhost";
$username = "root";
$password = "time.org";
$dbname = "seproject";
// Create $connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
$sql2 = "SELECT Username,Name FROM Department where Username='$email'";
$result2 = $conn->query($sql2);
if ($result2->num_rows > 0)
{
$_SESSION['name'] = $row["Name"];
header('Location: departmenthomepage.php');
}
$sql1 = "SELECT username,rollno FROM Student where username='$email'";
$result1 = $conn->query($sql1);
if ($result1->num_rows > 0)
{
$row = $result1->fetch_assoc();
$_SESSION['rollno'] = $row["rollno"];
header('Location: studenthomepage.php');
}
?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<button type="submit" name="dept" value="dept" class="button button2"> SIGN UP AS DEPARTMENT </button>
<button type="submit" name="stu" value="stu" class="button button2"> SIGN UP AS STUDENT </button>
</form>
<?php
if (isset($_POST['dept'])) {
$_SESSION['dname'] = $name;
$_SESSION['demail'] = $email;
header('Location: departmentsignup.php');
}
if (isset($_POST['stu'])) {
$_SESSION['sname'] = $name;
$_SESSION['semail'] = $email;
header('Location: studentsignup.php');
}
?>
</body>
</html>