-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
100 lines (95 loc) · 2.8 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
<?php
session_start();
if(isset($_POST['submit']))
{
$uname = $_POST['uname'];
$pass = $_POST['password'];
$con = mysqli_connect("localhost","root","","rba");
$role = $_POST['role'];
if($role=='admin')
{
$sql = mysqli_query($con, "INSERT INTO `user` (`user`, `pass`, `role`) VALUES ('".$uname."', '".$pass."', 'admin')")or die(mysqli_error($con));
if ($sql)
{
header("location:index.php");
}
else
{
echo "<script>alert('invalid username or password for selected role')</script>";
}
}
else if($role=='bideveloper')
{
$sql = mysqli_query($con, "INSERT INTO `user` (`user`, `pass`, `role`) VALUES ('".$uname."', '".$pass."', 'bideveloper')")or die(mysqli_error($con));
if ($sql)
{
header("location:index.php");
}
else
{
echo "<script>alert('invalid username or password for selected role')</script>";
}
}
else if($role=='blockchaindeveloper')
{
$sql = mysqli_query($con, "INSERT INTO `user` (`user`, `pass`, `role`) VALUES ('".$uname."', '".$pass."', 'blockchaindeveloper')")or die(mysqli_error($con));
if ($sql)
{
header("location:index.php");
}
else
{
echo "<script>alert('invalid username or password for selected role')</script>";
}
}
else if($role=='dataanalyst')
{
$sql = mysqli_query($con, "INSERT INTO `user` (`user`, `pass`, `role`) VALUES ('".$uname."', '".$pass."', 'dataanalyst')")or die(mysqli_error($con));
if ($sql)
{
header("location:index.php");
}
else
{
echo "<script>alert('invalid username or password for selected role')</script>";
}
}
else
{
$sql = mysqli_query($con, "INSERT INTO `user` (`user`, `pass`, `role`) VALUES ('".$uname."', '".$pass."', 'datascientist')")or die(mysqli_error($con));
if ($sql)
{
header("location:index.php");
}
else
{
echo "<script>alert('invalid username or password for selected role')</script>";
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>login</title>
<link rel="stylesheet" type="text/css" href="admin.css">
</head>
<body>
<form class="box" action="" method="post">
<h1>Signup</h1><br><br>
<input type="text" name="uname" placeholder="Enter Username" autocomplete="off"><br><br>
<input type="password" name="password" placeholder="Enter password" autocomplete="off"><br><br>
<select name="role" id="role" style="width: 170px;">
<option>Select your role</option>
<option value="admin">Admin</option>
<option value="bideveloper">BI Developer</option>
<option value="blockchaindeveloper">BlockChain Developer</option>
<option value="datascientist">Data Scientist</option>
<option value="dataanalyst">Data Analyst</option>
</select><br>
<br>
<input type="submit" name="submit" value="Signup"><br>
<a href="index.php" style="color:white;">LOGIN</a>
</form>
</body>
</html>