-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreaterAccount.php
184 lines (173 loc) · 7.36 KB
/
CreaterAccount.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>PHP Login System</title>
<style>
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
#h1{
background-color: rgba(14,135,130,255);
}
body{
background-color: rgba(254,230,170,255);
}
.row{
background-color:rgba(255,167,129,255);
border-top-left-radius: 30px;
border-top-right-radius: 30px;
border-bottom-left-radius: 30px;
border-bottom-right-radius: 30px;
box-shadow: 12px 12px 22px rgba(255,167,129,255) ;
}
img{
border-top-left-radius: 30px;
border-top-right-radius: 30px;
border-bottom-left-radius: 30px;
border-bottom-right-radius: 30px;
}
.btn1{
border: none;
outline: node;
height: 50px;
width: 100%;
background-color:black;
color: white;
border-radius: 4px;
font-weight: bold;
}
.btn1:hover{
background: rgba(19,135,132,255);
border:5px solid;
color:black;
}
.navbar-custom{
background-color: black;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light
">
<a class="navbar-brand" href="">ID MAKER</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
</div>
</nav>
<section class="Form my-4 mx-5">
<div class="container">
<div class="row no-gutters">
<div class="col-lg-5">
<img src="https://www.fonewalls.com/wp-content/uploads/1440x2560-Background-HD-Wallpaper-465-768x1365.jpg" class="img-fluid" alt="">
</div>
<div class="col-lg-7 px-5 pt-5">
<h1 class="font-weight-bold py-3">Create Account</h1>
<form method='post' action=''>
<div class="form-row">
<div class="col-lg-7">
<h6>Full name</h6>
<input type="text" id="fullname" name="fullname" class="form-control my-3 p-4" placeholder="Enter Your name here" required="required">
</div>
</div>
<div class="form-row">
<div class="col-lg-7">
<h6>Username</h6>
<input type="text" id="username" name="username" class="form-control my-3 p-4" placeholder="Enter Your Username here" required="required">
</div>
</div>
<div class="form-row">
<div class="col-lg-7">
<h6>User Type</h6>
<input type="text" id="collegename" name="collegename" class="form-control my-3 p-4" placeholder="Enter Your User type here" required="required">
</div>
</div>
<div class="form-row">
<div class="col-lg-7">
<h6>Number</h6>
<input type="number" id="number" name="number" class="form-control my-3 p-4" required="required" placeholder="Enter your number">
</div>
</div>
<div class="form-row">
<div class="col-lg-7">
<h6>Password</h6>
<input type="password" id="password" name="password" class="form-control my-3 p-4" required="required" placeholder="*******">
</div>
</div>
<div class="form-row">
<div class="col-lg-7">
<button type="submit" id="btn" class="btn1 mt-3 mb-5" value="Login">Create Account</button> </div>
</div>
<p>If already have an account??</p><a href="practice.html">Login here</a> <!--Have to chage while creating web-->
</div>
</form>
</div>
</div>
</div>
</div>
</section>
<?php
$server = "localhost";
$user = "id19260662_root";
$pas = 'l](|t}_9ZLQ~V8P+';
$db_name = "id19260662_login_page";
$con = mysqli_connect($server, $user, $pas, $db_name);
if(mysqli_connect_errno()) {
die("Failed to connect with MySQL: ". mysqli_connect_error());
}
$conn = mysqli_connect($server,$user,$pas,$db_name);
$sql = 'SELECT * FROM `login_page_`';
// $result = mysqli_query($conn,$sql);
if(!$con){
die("connection to this database");
}
$fistname = ($_POST['fullname']);
$collegename = ($_POST['collegename']);
$email = ($_POST['username']);
$passw = ($_POST['password']);
$number = ($_POST['number']);
$query = mysqli_query($conn,"SELECT * FROM `login_page_` WHERE username='$email'");
// $pfpsql = "INSERT INTO `login_page`.`signuppage` (`name`,`college`,`email`,`number`) VALUES ($firstname,$collegename,'$email','$number')";
if(mysqli_num_rows($query)>0){
echo '</style><div class="alert alert-warning alert-dismissible fade show" role="alert">
<strong>Please use different email</strong> Because either the field is empty or this email is already used
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>';
}else{
$sql = "INSERT INTO `id19260662_login_page`.`login_page_` (`username`,`password`,`usertype`) VALUES ('$email','$passw','$collegename')";
if($con->query($sql)>0){
echo "<div class='alert alert-success' role='alert'>
Your account has been created
</div>
";
}
else{
echo "Something went wrong";
}
}
$con->close();
?>