-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.php
More file actions
159 lines (149 loc) · 5.72 KB
/
signup.php
File metadata and controls
159 lines (149 loc) · 5.72 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
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
<?php
session_start();
require_once "pdo.php";
if (isset($_POST["cancel"])) {
header('Location: index.php');
return;
}
if (isset($_POST['email']) && isset($_POST['pass']) && isset($_POST['name']) && isset($_POST['phone']) && isset($_POST['address']) && isset($_POST['postal']) && isset($_POST['country']) && isset($_POST['gender'])) {
$refuser = 'F';
$reftype = 'first';
$coin = 0;
if (strlen($_POST['email']) < 1) {
$_SESSION['error'] = "Email missing";
header("Location: signup.php");
return;
} else if (strlen($_POST['pass']) < 1) {
$_SESSION['error'] = "Password missing";
header("Location: signup.php");
return;
} else if (strlen($_POST['name']) < 1) {
$_SESSION['error'] = "Name missing";
header("Location: signup.php");
return;
} else if (strlen($_POST['phone']) < 1) {
$_SESSION['error'] = "Phone number missing";
header("Location: signup.php");
return;
} else if (strlen($_POST['address']) < 1) {
$_SESSION['error'] = "Address missing";
header("Location: signup.php");
return;
} else if (strlen($_POST['postal']) < 1) {
$_SESSION['error'] = "Postal code missing";
header("Location: signup.php");
return;
} else if (strlen($_POST['country']) < 1) {
$_SESSION['error'] = "Country missing";
header("Location: signup.php");
return;
} else if (strlen($_POST['gender']) < 1) {
$_SESSION['error'] = "Gender missing";
header("Location: signup.php");
return;
} else if (!is_numeric($_POST['phone'])) {
$_SESSION['error'] = "Phone must be numbers";
header("Location: signup.php");
return;
} else {
$stmt = $pdo->prepare('INSERT INTO users (email, pass, name, phone, address, postal, country, gender, stats, referalcode, refertype, coinamount) VALUES (:emai, :pas, :nam, :phon, :addres, :posta, :countr, :gende, :stats, :referalcode, :refertype, :coinamount)');
$stmt->execute(array(
':emai' => htmlentities($_POST['email']),
':pas' => htmlentities(md5($_POST['pass'])),
':nam' => htmlentities($_POST['name']),
':phon' => htmlentities($_POST['phone']),
':addres' => htmlentities($_POST['address']),
':posta' => htmlentities($_POST['postal']),
':countr' => htmlentities($_POST['country']),
':gende' => htmlentities($_POST['gender']),
':stats' => 'active',
':referalcode' => $refuser.rand(1000,9999)*rand(1,10)*rand(1,10),
':refertype' => $reftype,
':coinamount' => $coin,
));
$_SESSION['success'] = "Record added";
header("Location: index.php");
return;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Muhammad Qayim bin Norizan</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js">
</script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js">
</script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js">
</script>
<style>
.container{
text-align: center;
}
.logo{
font-family: "Trebuchet MS", sans-serif;
padding-top: 70px;
padding-bottom: 30px;
}
#email, #pass, #name, #phone, #address, #postal, #country, #gender{
padding:10px;
height:53px;
width:355px;
font-size:14pt;
}
.btn{
height:53px;
width:355px;
}
</style>
</head>
<body>
<div class="container fluid">
<div class="logo">
<h1>Ringgit%</h1>
</div>
<?php
if ( isset($_SESSION['error']) ) {
echo('<p style="color: red;">'.htmlentities($_SESSION['error'])."</p>\n");
unset($_SESSION['error']);
}
?>
<div class="container">
<form method="POST">
<input type="email" placeholder="email" name="email" id="email">
<p> </p>
<input type="password" placeholder="password" name="pass" id="pass">
<p> </p>
<input type="text" placeholder="name" name="name" id="name"></br>
<p> </p>
<input type="text" placeholder="phone number" name="phone" id="phone">
<p> </p>
<input type="text" placeholder="address" name="address" id="address">
<p> </p>
<input type="text" placeholder="postal" name="postal" id="postal"></br>
<p> </p>
<input type="text" placeholder="country" name="country" id="country">
<p> </p>
</div>
<p>Gender: </p>
<input type="radio" id="male" name="gender" value="male">
<label for="male">Male</label>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label>
<input type="radio" id="other" name="gender" value="other">
<label for="other">Other</label>
<p> </p>
<input type="submit" class="btn btn-info btn-lg" value="Sign Up">
<p> </p>
</form>
</div>
</body>
</html>