forked from SaiyamTuteja/Faculty_Evaluation_System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
237 lines (216 loc) · 7.82 KB
/
signup.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!DOCTYPE html>
<html lang="en">
<?php
session_start();
include ('./db_connect.php');
ob_start();
$system = $conn->query("SELECT * FROM system_settings")->fetch_array();
foreach ($system as $k => $v) {
$_SESSION['system'][$k] = $v;
}
ob_end_flush();
?>
<?php
if (isset($_SESSION['login_id']))
header("location:index.php?page=home");
?>
<?php include 'header.php' ?>
<style>
.signup-logo {
text-align: center;
margin-bottom: 20px;
/* Adjust as needed */
}
.signup-logo img {
width: 200px;
/* Set the width as per your requirements */
height: auto;
/* This maintains the image's aspect ratio */
}
.signup-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
/* height: 100vh; 100% of viewport height */
max-height: fit-content;
}
.signup-box {
max-width: 400px;
/* Adjust the width as needed */
text-align: center;
/* Center align text inside the box */
}
/* Add styles for the success pop-up */
.popup-message {
padding: 10px;
margin: 10px 0;
border-radius: 5px;
}
.popup-message.success {
background-color: #d4edda;
color: #155724;
}
.popup-message.error {
background-color: #f8d7da;
color: #721c24;
}
</style>
<body class="hold-transition login-page bg-white">
<div class="signup-container">
<div class="signup-box">
<h2><b>AQMS - Sign Up</b></h2>
<div class="card">
<div class="card-body signup-card-body">
<form action="process_signup.php" method="POST" id="signup-form">
<div class="signup-logo">
<img src="profpraisal.png" alt="Your Image Alt Text">
</div>
<div class="input-group mb-3">
<input type="text" class="form-control" name="CUID" required placeholder="CUID">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa fa-id-card"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="name" class="form-control" name="firstname" required placeholder="First Name">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-user"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="name" class="form-control" name="lastname" required placeholder="Last Name">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-user"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="email" class="form-control" name="email" required placeholder="Email">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-envelope"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="password" class="form-control" id="password" name="password" required placeholder="Password">
<div class="input-group-append">
<div class="input-group-text" onclick="togglePasswordVisibility('password')">
<span id="passwordIcon" class="fas fa-lock"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="password" class="form-control" id="Conform_password" name="Conform_password" required
placeholder="Confirm_Password">
<div class="input-group-append">
<div class="input-group-text" onclick="togglePasswordVisibility('Conform_password')">
<span id="Conform_passwordIcon" class="fas fa-lock"></span>
</div>
</div>
</div>
<div class="form-group mb-3">
<label for="user_type">Select User Type</label>
<select name="user_type" id="user_type" class="custom-select custom-select-sm">
<option value="student">Student</option>
<option value="faculty">Faculty</option>
</select>
</div>
<div class="row">
<div class="col-12">
<button type="submit" class="btn btn-primary btn-block">Sign Up</button>
</div>
</div>
</form>
</div>
<!-- /.signup-card-body -->
</div>
</div>
</div>
<!-- /.signup-container -->
<!-- Success pop-up message -->
<div id="successPopup" class="popup-message">
</div>
<script>
$(document).ready(function () {
$('#signup-form').submit(function (e) {
e.preventDefault();
var formData = $(this).serializeArray();
var email = formData.find(input => input.name === 'email').value;
// Verify the email address with Disify
$.ajax({
type: 'POST',
url: 'verify_email.php', // This should be the path to your PHP script that calls the Disify API
data: { email: email },
success: function (verificationResult) {
try {
const verificationData = JSON.parse(verificationResult);
// Check if the 'disposable' property is true
if (verificationData.format && !verificationData.disposable) {
// If the email is not disposable, proceed with the signup process
$.ajax({
type: 'POST',
url: 'process_signup.php',
data: formData,
success: function (response) {
var responseData = JSON.parse(response);
if (responseData.status === 'success') {
showMessage('Signup successful! You can now <a href="login.php">log in</a>.', 'success');
} else {
showMessage('Error: ' + responseData.message, 'error');
}
},
error: function (xhr, status, error) {
showMessage('Error during signup: ' + xhr.responseText, 'error');
}
});
} else {
// If the email is disposable, show a not deliverable message
showMessage('Email is disposable and cannot be used for signup.', 'error');
}
} catch (error) {
console.error("Error parsing verification result:", error);
showMessage('Email verification failed: Invalid response format.', 'error');
}
},
error: function (xhr, status, error) {
// Show Disify email verification failed message
showMessage('Email verification failed: ' + xhr.responseText, 'error');
}
});
});
function showMessage(message, type) {
var $popup = $('#successPopup');
$popup.html(message);
$popup.removeClass('error success').addClass(type);
$popup.show();
setTimeout(function () {
$popup.hide();
}, 5000);
}
});
</script>
<script>
function togglePasswordVisibility(passwordId) {
var passwordInput = document.getElementById(passwordId);
var passwordIcon = document.getElementById(passwordId + 'Icon');
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
passwordIcon.classList.remove('fa-lock');
passwordIcon.classList.add('fa-eye');
} else {
passwordInput.type = 'password';
passwordIcon.classList.remove('fa-eye');
passwordIcon.classList.add('fa-lock');
}
}
</script>
<?php include 'footer.php' ?>
</body>
</html>