-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSignup.php
144 lines (126 loc) · 3.08 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
135
136
137
138
139
140
141
142
143
144
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: Arial, Helvetica, sans-serif;
width: 50%;
margin: auto;
margin-top: 5%;
}
* {
box-sizing: border-box;
}
html {
background: url("./assets/img1.webp");
}
input[type=text],
select,
textarea {
width: 80%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical;
}
input[type=password],
select,
textarea {
width: 80%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical;
}
input[type=tel],
select,
textarea {
width: 80%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical;
}
input[type=submit] {
background-color: #ff3256;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #45a049;
}
#form-img {
max-width: 20%;
margin: 2%;
}
#form-head {
display: flex;
justify-content: flex-start;
align-items: center;
}
.container {
width: 50%;
margin-left: 30%;
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
clear: both;
}
.container input {
width: 100%;
clear: both;
}
</style>
</head>
<?php
session_start();
if (isset($_POST['submit'])) {
require_once('./config.php');
$name = $_POST['f_name'];
$u_name = $_POST['u_name'];
$pass = $_POST['pass'];
$uid = uniqid($u_name);
$securepass = crypt($pass, $u_name);
$sql = "INSERT INTO `sashakti`.`users` (`userid`, `username`, `password`, `name`) VALUES ('$uid', '$u_name', '$securepass', '$name');";
if ($con->query($sql) == true) {
echo "<h3 style='margin-left:400px;margin-top:20px;color:green' >You have successfully registered<a href='Login.php'>Go back to Login Page</a></h3>";
} else {
echo "ERROR: $con->error";
}
$con->close();
}
?>
<body>
<div id="form-head">
<img src="assets/icon1.png" id="form-img"></img>
<h2 style="text-align: center; font-size:40px; color:#ff3256; margin:2%;">Signup</h2>
</div>
<div class="container">
<form method="post">
<label for="f_name">Full Name</label>
<input type="text" id="u_name" name="f_name" placeholder="Your full name">
<br>
<label for="u_name">User Name</label>
<input type="text" id="u_name" name="u_name" placeholder="Username">
<br>
<label for="password">Password</label>
<input type="password" id="password" name="pass" placeholder="Your password">
<br>
<br>
<input type="submit" name="submit" action="submit">
</form>
</div>
</body>
</html>