-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.php
More file actions
58 lines (46 loc) · 1.69 KB
/
signup.php
File metadata and controls
58 lines (46 loc) · 1.69 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
<?php
session_start();
include("connection.php");
include("functions.php");
if($_SERVER['REQUEST_METHOD'] == "POST"){
$username= $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$confirm_pw = $_POST['conf_password'];
if(!$password == $confirm_pw){
echo "Password do not match";
}
elseif(!empty($username) && !empty($password) && !is_numeric($username)){
$user_id = random_number(9);
$query = "insert into userdata (user_id,username,email,password) values ('$user_id','$username','$email','$password')";
mysqli_query($con,$query);
echo "Signup Successfull!";
}else{
echo "Please enter valid information";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Signup</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<div class="container">
<h1>Signup</h1>
<form action="" method="post">
<div class="login">
<input type="text" name="username" placeholder="Username">
<input type="text" name="email" placeholder="Emali">
<input type="password" name="password" placeholder="Password">
<input type="password" name="conf_password" placeholder="Confirm Password">
<input id="loginbtn" type="submit" value="Signup">
<a href="login.php">To login</a>
</div>
</form>
</div>
</body>
</html>