-
Notifications
You must be signed in to change notification settings - Fork 0
/
safe_create_profile.php
executable file
·114 lines (98 loc) · 3.18 KB
/
safe_create_profile.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
<?php
session_start();
if(isset($_SESSION['EMAIL']))
{
$NAME = $_POST['NAME'];
$PHONENUMBER = $_POST['PHONENUMBER'];
$BIRTHDATE = $_POST['BIRTHDATE'];
$BIVAG = $_POST['BIVAG'];
$ZILLA = $_POST['ZILLA'];
$UPAZILLA = $_POST['UPAZILLA'];
$BLOODGROUP = $_POST['BLOODGROUP'];
$EMAIL = $_SESSION['EMAIL'];
$server_name = "127.0.0.1";
$username = "root";
$password = "";
$database = "test";
$check_email = 'SELECT * FROM members_login_data WHERE EMAIL="'.$EMAIL.'";';
$create_profile = 'INSERT INTO members_login_data(NAME, EMAIL) VALUES("'.$NAME.'", "'.$EMAIL.'");';
$get_id = 'SELECT * FROM members_login_data WHERE EMAIL="'.$EMAIL.'";';
$connection = mysqli_connect($server_name, $username, $password, $database);
$create_doner_profile = 'INSERT INTO members(NAME, BIRTHDATE, PHONENUMBER, BLOODGROUP, BIVAG, ZILLA, UPAZILLA) VALUES("'.$NAME.'", "'.$BIRTHDATE.'", "'.$PHONENUMBER.'", "'.$BLOODGROUP.'", "'.$BIVAG.'", "'.$ZILLA.'", "'.$UPAZILLA.'");';
$check_profile = 'SELECT * FROM members WHERE EMAIL="'.$EMAIL.'";';
if($connection == false)
{
die("ERROR: " . mysqli_connect_error());
}
mysqli_query($connection, "SET NAMES utf8mb4");
if($result = mysqli_query($connection, $check_email))
{
if(mysqli_num_rows($result)>0) die("EMAIL EXIST, BUG FOUND, PLEASE REPORT TO THE ADMINSTERTOR");
}
mysqli_query($connection, $create_profile);
if($result = mysqli_query($connection, $get_id))
{
if(mysqli_num_rows($result)>0)
{
while($row = mysqli_fetch_array($result))
//CREATE PROFILE DONE
$reg_id = $row['ID'];
}
}else{
die("CREATE PROFILE FAILED");
}
}else{
die("NO EMAIL OBJECT FOUND ON POST REQUEST");
}
mysqli_close($connection);
unset($result);
$connection = mysqli_connect($server_name, $username, $password, $database);
if($connection == false)
{
die("ERROR 01: " . mysqli_connect_error());
}s
mysqli_query($connection, "SET NAMES utf8mb4");
$check_id = 'SELECT * FROM members_login_data WHERE ID='.$reg_id;
$check_doner_id = 'SELECT * FROM members WHERE ID='.$reg_id;
if($result = mysqli_query($connection, $check_id))
{
echo '1';
if(mysqli_num_rows($result)>0)
{
echo '2';
while($row = mysqli_fetch_array($result))
{
echo '3';
if($row['ID'] == $reg_id && $row['EMAIL'] == $_SESSION['EMAIL'])
{
echo '4';
mysqli_query($connection, $create_doner_profile);
echo 'HA';
if($doner_profile = mysqli_query($connection, $check_doner_id))
{
echo '5';
if(mysqli_num_rows($doner_profile)>0)
{
echo '6';
while($doner_data = mysqli_fetch_array($doner_profile))
{
echo '7';
if($doner_data['ID'] == $reg_id && $doner_data['NAME'] == $NAME)
{
echo 'AT';
echo $_SESSION['IMAGE_NAME'];
// echo '<script> window.location.href="/doner.php?doner='.$doner_data['ID'].'"; </script>';
}else{
die("SOMETHING WENT WRONG [ERROR CODE: 01101]");
}
}
}
}
}else{
die("SOMETHING WENT WRONG");
}
}
}
}
echo 'SCRIPT END';
?>