forked from agarwalbharat/CTF-Zone-v1
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsignup.php
134 lines (121 loc) · 4.53 KB
/
signup.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
session_start();
include("db.php");
$error="";
if(isset($_SESSION['id']) && isset($_SESSION['email'])){
header("Location: profile/");
}else{
if(isset($_POST['submit'])){
if(!empty($_POST['email'])){
if(!empty($_POST['pass']) && !empty($_POST['cpass'])){
if(!empty($_POST['fname']) && !empty($_POST['lname'])){
if(!empty($_POST['phone'])){
if($_POST['pass']!==$_POST['cpass']){
$error = "password and confirm password not matching";
}else{
$email = $_POST['email'];
$pass = md5($_POST['pass']);
$twitter = $_POST['twitter'];
$facebook = $_POST['facebook'];
$linkedin = $_POST['linkedin'];
$website = $_POST['website'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$phone = $_POST['phone'];
$about = $_POST['about'];
$level = 1;
$db_usrquery="SELECT * FROM users WHERE email='$email' ";
$result=mysqli_query($conn,$db_usrquery);
$checkusr=mysqli_num_rows($result);
if($checkusr >= 1){
$error = "email already exist";
}else{
$sql_insert = "INSERT INTO users (email,password,fname,lname,phone,about,twitter,facebook,linkedin,website,level) VALUES ('$email','$pass','$fname','$lname','$phone','$about','$twitter','$facebook','$linkedin','$website','$level')";
$sql_insert_exe = mysqli_query($conn, $sql_insert);
if($sql_insert_exe){
$db_usrquery="SELECT * FROM users WHERE email='$email' ";
$result=mysqli_query($conn,$db_usrquery);
$checkusr=mysqli_num_rows($result);
if($checkusr >= 1){
if($row = mysqli_fetch_assoc($result)){
$_SESSION['id']= $row['id'];
$_SESSION['email'] = $row['email'];
header("Location: profile/");
}
}
}
}
}
}else{
$error="Phone is empty";
}
}else{
$error="First Name or Last name is empty";
}
}else{
$error="password or confirm password is empty";
}
}else{
$error = "email can't be empty";
}
}
?>
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Haxonic</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php include("menu.html") ?>
<div class="glitch" data-text="Haxonic"><a href="#">Haxonic<a></div>
<!-- multistep form -->
<form id="msform" method="post" action="">
<!-- progressbar -->
<ul id="progressbar">
<li class="active">Account Setup</li>
<li>Social Profiles</li>
<li>Personal Details</li>
</ul>
<!-- fieldsets -->
<p style="color:red"><?php echo $error; ?></p>
<fieldset>
<h2 class="fs-title">Create your account</h2>
<h3 class="fs-subtitle">This is step 1</h3>
<input type="email" name="email" placeholder="Email"/>
<input type="password" name="pass" placeholder="Password" />
<input type="password" name="cpass" placeholder="Confirm Password" />
<input type="button" name="next" class="next action-button" value="Next" />
</fieldset>
<fieldset>
<h2 class="fs-title">Social Profiles</h2>
<h3 class="fs-subtitle">Your presence on the social network</h3>
<input type="text" name="twitter" placeholder="Twitter username" />
<input type="text" name="facebook" placeholder="Facebook username" />
<input type="text" name="linkedin" placeholder="linkedin username" />
<input type="text" name="website" placeholder="Website Without http or https" />
<input type="button" name="previous" class="previous action-button" value="Previous" />
<input type="button" name="next" class="next action-button" value="Next" />
</fieldset>
<fieldset>
<h2 class="fs-title">Personal Details</h2>
<h3 class="fs-subtitle">We will never sell it</h3>
<input type="text" name="fname" placeholder="First Name" />
<input type="text" name="lname" placeholder="Last Name" />
<input type="text" name="phone" placeholder="Phone" />
<textarea name="about" placeholder="about"></textarea>
<input type="button" name="previous" class="previous action-button" value="Previous" />
<input type="submit" name="submit" class="action-button" value="Submit" />
</fieldset>
</form>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js'></script>
<script src="js/index.js"></script>
</body>
</html>
<?php
}
?>