-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSignUp.php
More file actions
141 lines (128 loc) · 3.07 KB
/
Copy pathSignUp.php
File metadata and controls
141 lines (128 loc) · 3.07 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
<?php
include 'init2.php';
if(isset($_POST['signup'])){
$screenName = $_POST['screenName'];
$email = $_POST['email'];
$password = $_POST['password'];
$error = '';
if(empty($screenName) or empty($password) or empty($email)){
$error = 'All fields are required';
}else {
$email = $getFromU->checkInput($email);
$screenName = $getFromU->checkInput($screenName);
$password = $getFromU->checkInput($password);
if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
$error = "Invalid email format";
}
else if(strlen($screenName) > 20){
$error = 'Name must be between in 6-20 characters';
}else if(strlen($password) < 5){
$error = 'Password is too short';
}else {
if($getFromU->checkEmail($email) === true){
$error = 'Email is already in use';
}else {
$password = md5($password);
$user_id = $getFromU->create('users', array('email' => $email, 'password' => $password , 'screenName' => $screenName, 'profileImage' => 'dp.jpg', 'profileCover' => 'pic4.jpg'));
$_SESSION['user_id'] = $user_id;
header('Location:main.php?step=1');
}
}
}
}
?>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Log in</title>
<style>
body{
margin: 0;
padding: 0;
font-family: sans-serif;
background-image: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8) ), url("p5.jpg");
background-size: cover;
}
.login-box{
width: 280px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
color: white;
}
.login-box h1{
float: left;
font-size: 40px;
border-bottom: 6px solid #4caf50;
margin-bottom: 50px;
padding: 13px 0;
}
.textbox{
width: 100%;
overflow: hidden;
font-size: 20px;
padding: 8px 0;
margin: 8px 0;
border-bottom: 1px solid #4caf50;
}
.textbox i{
width: 26px;
float: left;
text-align: center;
}
.textbox input{
border: none;
outline: none;
background: none;
color: white;
font-size: 18px;
width: 80%;
float: left;
margin: 0 10px;
}
.btn{
width: 100%;
background: none;
border: 2px solid #4caf50;
color: white;
padding: 5px;
font-size: 18px;
cursor: pointer;
margin: 12px 0;
}
.span-fp-error
{
margin-top: 10px;
font-size: 150%;
}
</style>
</head>
<body>
<div class="login-box">
<form method="post">
<h1>Sign Up</h1>
<div class="textbox">
<i class="fas fa-user"></i>
<input type="text" name="screenName" placeholder="Full Name"/>
</div>
<div class="textbox">
<i class="fas fa-user"></i>
<input type="text" name="email" placeholder="Email">
</div>
<div class="textbox">
<i class="fas fa-lock"></i>
<input type="password" name="password" placeholder="Password">
</div>
<input type="submit" class="btn" name="signup" Value="Signup">
<?php
if(isset($error)){
echo '
<div class="span-fp-error">'.$error.'</div>
';
}
?>
</form>
</div>
</body>
</html>