-
Notifications
You must be signed in to change notification settings - Fork 0
/
request.php
41 lines (34 loc) · 1.45 KB
/
request.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
<?php
$fullname = $_GET['ifullname'];
$university = $_GET['iuniversity'];
$college = $_GET['icollege'];
$db = "registr_database";
$tb = "registered_people";
$connection = mysqli_connect("localhost", "root", "", "$db");
$fullname = mysqli_real_escape_string($connection, $fullname);
$university = mysqli_real_escape_string($connection, $university);
$college = mysqli_real_escape_string($connection, $college);
$requestOne = "SELECT * FROM $tb WHERE full_name='$fullname'";
$modelOne = mysqli_query($connection, $requestOne);
$scan = mysqli_num_rows($modelOne);
if($fullname != "" && $university != "" && $college != "") {
if(!$scan) {
$fullname = mysqli_real_escape_string($connection, $fullname);
$university = mysqli_real_escape_string($connection, $university);
$college = mysqli_real_escape_string($connection, $college);
$requestTwo = "INSERT INTO $tb(full_name, university, college) VALUES ('$fullname', '$university', '$college')";
$modelTwo = mysqli_query($connection, $requestTwo);
if($modelTwo) {
echo "Registration Successful!";
unset($fullname);
unset($university);
unset($college);
}
} else {
echo "You are already registered.";
}
} else {
echo "Please fill up all fields.";
}
mysqli_close($connection);
?>