forked from AswinPG/FossLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.php
More file actions
64 lines (62 loc) · 2.08 KB
/
signup.php
File metadata and controls
64 lines (62 loc) · 2.08 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
<?php
require 'dbconfig/config.php';
?>
<!DOCTYPE html>
<html>
<head>
<title> Sign Up </title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="login-box">
<img src="https://raw.githubusercontent.com/AswinPG/FossLab/master/avatar.png" class="avatar">
<h1>Register Here</h1>
<form class="myform"action="tablemanipulation.php" method="post">
<p>Username :</p>
<input name="username" type="text" class="inputvalue" placeholder=" Your Username" required/>
<p>Password :</p>
<input name="password" type="password" class="inputvalue" placeholder=" Your Password" required/>
<p>Confirm Password : </p>
<input name="cpassword" type="password" class="inputvalue" placeholder="Confirm Password" required/>
<input name="submit_btn" type="submit" id="signup_btn" value="Sign Up" />
<a href="loginhome1.html">>>>LOG IN NOW</a><br>
</form>
<?php
if(isset($_POST['submit_btn']))
{
//echo '<script type="text/javascript"> alert("Sign Up button clicked") </script>';
$username = $_POST['username'];
$password = $_POST['password'];
$cpassword = $_POST['cpassword'];
if($password==$cpassword)
{
$query = "select * from userinfo where username='$username'";
$query_run = mysqli_query($con,$query);
if(mysqli_num_rows($query_run)>0)
{
// there is already a user with same username
echo '<script type="text/javascript"> alert("Username already exist") </script>';
}
else
{
$query = "insert into userinfo values('$username','$password')";
$query_run = mysqli_query($con,$query);
if($query_run)
{
echo '<script type="text/javascript"> alert("User Registered ... Go To Login Page To Login") </script>';
}
else
{
echo '<script type="text/javascript"> alert("ERROR!!") </script>';
}
}
}
else
{
echo '<script type="text/javascript"> alert("Password and confirm password does not match!") </script>';
}
}
?>
</div>
</body>
</html