-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjoin_student.php
More file actions
37 lines (29 loc) · 878 Bytes
/
Copy pathjoin_student.php
File metadata and controls
37 lines (29 loc) · 878 Bytes
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
<?php
include "util.php";
$email = $_POST["email"];
$password = $_POST["password"];
$name = $_POST["name"];
$date = date('Y-m-d');
$conn = mysqli_connect(servername, username, password, db_name);
$sql = "INSERT INTO student (email, password, name, register_date) VALUES ('$email', '$password', '$name', '$date')";
if (student_check($email, $password) == false) {
mysqli_close($conn);
error();
} else {
$query = mysqli_query($conn, $sql);
$id = mysqli_insert_id($conn);
$form = "
<h3 class='display-6'>You are registered as a student with id=$id.</h3>
<div align=center><button type='button' class='btn btn-outline-primary'><a href='index.php'>go to main page</a></button></div>
";
mysqli_close($conn);
echo basis($form, "");
}
function student_check($email, $password){
if ($email == "" or $password == "") {
return false;
} else {
return true;
}
}
?>