-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalid_join.php
More file actions
83 lines (69 loc) · 2.5 KB
/
valid_join.php
File metadata and controls
83 lines (69 loc) · 2.5 KB
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
<?php
session_start();
if (!isset($_POST['username'])){
exit("this page is not displayable");
}
require_once("sql_connect.php");
$fname = mysqli_real_escape_string($conn, $_POST['username']);
$femail = mysqli_real_escape_string($conn, $_POST['email']);
$pwd = mysqli_real_escape_string($conn, $_POST['password']);
$fdob = mysqli_real_escape_string($conn, $_POST['dob']);
$fgender = mysqli_real_escape_string($conn, $_POST['gender']);
$pnumber = mysqli_real_escape_string($conn, $_POST['phonenumber']);
$uID = mysqli_real_escape_string($conn, $_POST['userid']);
$grant = mysqli_real_escape_string($conn, "allow");
if (!filter_var($femail, FILTER_VALIDATE_EMAIL)) {
exit("Invalid email!");
}
$sql1= mysqli_query($conn, "SELECT userID FROM users where userID='{$uID}'");
if (mysqli_num_rows($sql1) > 0){
exit("ID already taken try another one!");
}
$sql1= mysqli_query($conn, "SELECT userID FROM users where email='{$femail}'");
if (mysqli_num_rows($sql1) > 0){
exit("email already taken try another one!");
}
//upload the FORM to mysql db
$data = $conn->prepare("INSERT INTO users(userID, username, email,password, date_of_birth, gender, phonenumber,all_map_access)VALUES(?, ?, ?, ?, ?, ?,?,?)");
$data->bind_param("ssssssss", $uID, $fname, $femail, $pwd, $fdob, $fgender, $pnumber, $grant);
$data->execute() or die("Problem saving profiles reload & tryagain!");
#save user id data in the browser session
$sql = "SELECT userID FROM users WHERE userID='{$uID}'";
$result = $conn->query($sql);
session_regenerate_id();
if ($result->num_rows > 0) {
while($uid = $result->fetch_assoc()) {
$_SESSION["user_id"] = $uid["userID"];
$uniq = uniqid("@user");
$_SESSION["unique"] = $uniq;
};
echo "
<div style='
width: 100%;
height: 700px;
position: fixed;
text-align: center;
background-color: white;
color: black;
font-size: 30px;
top: 0;
left: 0;
z-index: 7;
'>
Click the button to continue or reload this page to continue
<br>
<button style='
width: 50%;
height: 49px;
position: fixed;
background-color: #0000ff;
color: white;
font-size: 20px;
background-image: linear-gradient(45deg, black, transparent);
border-radius: 12px;
left: 27%;
' onclick='letsgo()'>Click here</button>
</div>
";
}
$conn->close();