forked from ameibrahim/CollegeDux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth.php
163 lines (127 loc) · 7.1 KB
/
auth.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
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
session_start();
session_unset();
session_destroy();
session_start();
$username = isset($_SESSION['id']);
$role = isset($_SESSION['role']);
if($username && $role == "student"){ header('location: /student'); }
elseif($username && $role == "teacher"){ header('location: /teacher'); }
elseif($username && $role == "admin"){ header('location: /admin'); }
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
<link rel="stylesheet" href="css/auth.css">
<script src="/js/auth.js?4" defer></script>
<script src="/js/functions.js?4" defer></script>
<script src="/js/weather.js" defer></script>
</head>
<body>
<div class="wrapper">
<div class="logo-container">
<img src="assets/images/air-logo.png" alt="">
<div class="top-text">College Dux</div>
</div>
<div class="outer-container">
<div class="bubble-message-container">Wrong Credentials</div>
<form class="form-container login-container">
<p class="title-tag">dux login</p>
<span class="text-box">
<!-- <p class="hint-text">You can log in with your email or </p> -->
<input type="text" id="username-field" required class="bordered bordered-dark" placeholder="Email / Student Number">
</span>
<span class="text-box">
<input type="password" id="password-field" required class="bordered bordered-dark" placeholder="password">
</span>
<div class="button background-dark" onclick="login()">login</div>
<p class="link" onclick="showSignup()">Don't have an account? Signup</p>
</form>
<form class="form-container signup-container">
<p class="title-tag">dux signup</p>
<div class="tab-buttons">
<div class="tab-button student-tab-button" data-active="true" onclick="showStudentForm()">student</div>
<div class="tab-button teacher-tab-button" data-active="false" onclick="showTeacherForm()">teacher</div>
</div>
<label for="signupImageInput" class="profile-picture-container">
<img id="chosenPhoto" src="" alt="User Photo">
<input type="file" id="signupImageInput" accept="image/*" onchange="loadImage(event, '#chosenPhoto')">
<span>Click to select a profile image</span>
</label>
<div class="two-column-grid student-form">
<span class="text-box">
<input type="text" id="name"required class="bordered bordered-dark" placeholder="Name">
</span>
<span class="text-box">
<input type="text" id="stdnumber" required class="bordered bordered-dark" placeholder="Student Number">
</span>
<span class="text-box">
<input type="text" id="department" required class="bordered bordered-dark" placeholder="Department">
</span>
<span class="text-box">
<input type="text" id="email" required class="bordered bordered-dark" placeholder="Email">
</span>
<span class="text-box stretch-x">
<input type="text" id="address" required class="bordered bordered-dark" placeholder="Address">
</span>
<span class="text-box">
<input type="text" id="phone" required class="bordered bordered-dark" placeholder="Phone Number">
</span>
<span class="text-box">
<input type="password" id="password" required class="bordered bordered-dark" placeholder="Password">
</span>
</div>
<div class="two-column-grid teacher-form">
<span class="text-box">
<input type="text" id="t-name" required class="bordered bordered-dark" placeholder="Name">
</span>
<span class="text-box">
<input type="text" id="t-department" required class="bordered bordered-dark" placeholder="Department">
</span>
<span class="text-box stretch-x">
<input type="text" id="t-email" required class="bordered bordered-dark" placeholder="Email">
</span>
<span class="text-box stretch-x">
<input type="text" id="t-address" required class="bordered bordered-dark" placeholder="Address">
</span>
<span class="text-box">
<input type="text" id="t-phone" required class="bordered bordered-dark" placeholder="Phone Number">
</span>
<span class="text-box">
<input type="password" id="t-password" required class="bordered bordered-dark" placeholder="Password">
</span>
</div>
<div class="button background-dark" onclick="signup()">Signup</div>
<p class="link" onclick="showLogin()">Have an account? Login</p>
</form>
</div>
</div>
<div class="weather-container">
<div class="weather"></div>
</div>
<script>
let studentName = document.querySelector("#name");
let studentNumber = document.querySelector("#stdnumber");
let studentDepartment = document.querySelector("#department");
let studentEmail = document.querySelector("#email");
let studentAddress = document.querySelector("#address");
let studentPhone = document.querySelector("#phone");
let studentPassword = document.querySelector("#password");
const randomstring = Math.random().toString(36).slice(-8);
studentNumber.addEventListener("input", () => {
studentEmail.value = `${studentNumber.value}@profdux.aiiot.website`;
studentAddress.value = "Unset";
studentPhone.value = "Unset";
studentPassword.setAttribute("type", "text");
studentPassword.value = randomstring;
});
</script>
<div style="position:absolute;" class="gtranslate_wrapper"></div>
<script>window.gtranslateSettings = {"default_language": "en", "languages": ["en", "tr", "fr", "de", "it", "es"], "wrapper_selector": ".gtranslate_wrapper", "switcher_horizontal_position": "left", "switcher_vertical_position": "bottom", "float_switcher_open_direction": "bottom", "flag_style": "3d" }</script>
<script src="https://cdn.gtranslate.net/widgets/latest/float.js" defer></script>
</body>
</html>