-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathadminreg.php
More file actions
151 lines (137 loc) · 5.17 KB
/
adminreg.php
File metadata and controls
151 lines (137 loc) · 5.17 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
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
<?php
define('DB_HOST', 'localhost');
define('DB_NAME', 'test');
define('DB_USER','root');
define('DB_PASSWORD','');
$con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error());
$db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error());
function NewUser()
{
$email = $_POST['email'];
$password = $_POST['pass'];
$epassword=md5($password);
$query = "INSERT INTO admin (email,pass) VALUES ('$email','$epassword')";
$data = mysql_query ($query)or die(mysql_error());
if($data)
{
echo "YOUR REGISTRATION IS COMPLETED...";
}
session_start();
$_SESSION["Email"] = $email;
$_SESSION["login"] = 1;
$query2 = mysql_query("SELECT * FROM admin where email = '$_POST[email]' AND pass = '$epassword'") or die(mysql_error());
$row = mysql_fetch_array($query2);
$_SESSION["ID"]=$row['userID'];
header("Location: https://localhost/adminpage.php");
}
function SignUp()
{
if(!empty($_POST['email']))
{
$query = mysql_query("SELECT * FROM admin WHERE email = '$_POST[email]'") or die(mysql_error());
if(!$row = mysql_fetch_array($query) or die(mysql_error()))
{
newuser();
}
else
{
echo "SORRY...YOU ARE ALREADY REGISTERED USER...";
}
}
}
if(isset($_POST['submit']))
{
SignUp();
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width= device-width, initial-scale=1">
<title>Log-in/Sign-up</title>
<link rel="stylesheet" type="text/css" href="./css/signup.css">
<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="./css/bootstrap-material-design.css">
<link rel="stylesheet" type="text/css" href="./css/ripples.min.css">
</head>
<body>
<!-- NavBar -->
<div class="navbar navbar-default navbar-fixed-top navtrans" style="background-color: grey;">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://localhost/home.html">WD</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="https://localhost/home.html">Home </a></li>
<li><a href="javascript:void(0)">Buy </a></li>
<li><a href="https://localhost/register.php">Sell </a></li>
</ul>
</div>
</div>
</div>
<!-- End NavBar -->
<!-- container -->
<div class="container">
<div class="backbox">
<div class="loginMsg">
<div class="textcontent">
<p class="title">Don't have an account?</p>
<p>Sign up to sell your car.</p>
<a id="switch1" class="btn btn-raised buttonn btn-success">Sign Up</a>
</div>
</div>
<div class="signupMsg visibility">
<div class="textcontent">
<p class="title">Have an account?</p>
<p>Log in to see all the information.</p>
<a id="switch2" class="btn btn-raised buttonn btn-success">LOG IN</a>
</div>
</div>
</div>
<!-- backbox -->
<!-- frontbox -->
<form action="https://localhost/adminreg.php" method="post">
<div class="frontbox">
<div class="login">
<h2>LOG IN</h2>
<div class="inputbox">
<input class="form-control" type="email" name="user" placeholder=" E-MAIL" id="login_email">
<input class="form-control" type="password" name="pass" placeholder=" PASSWORD" id="login_password">
</div>
<p style="color: blue; font-size:15px;">FORGET PASSWORD?</p>
<input type="submit" name="submit" id="login" class="btn btn-raised buttonn btn-primary" value="Login">
</div>
</form>
<form action="http://localhost/adminreg.php" method="post">
<div class="signup hide">
<h2>SIGN UP</h2>
<div class="inputbox">
<input type="email" name="email" placeholder=" E-MAIL" class="form-control" id="signup_email">
<input type="password" name="pass" placeholder=" PASSWORD" class="form-control" id="signup_password">
<input type="password" name="cpass" placeholder=" CONFIRM PASSWORD" class="form-control" id="signup_confirm_password">
<p id="validate-status"></p>
</div>
<input type="submit" name="submit" id="signup" class="btn btn-raised buttonn btn-primary" value="SignUp">
</div>
</form>
</div>
<!-- frontbox -->
</div>
<!-- container -->
<!-- scripts -->
<script src="./js/jquery.min.js"></script>
<script src="./js/material.min.js"></script>
<script src="./js/ripples.min.js"></script>
<script src="./js/ripplesinit.js"></script>
<SCRIPT src="./js//validatelog.js"></SCRIPT>
<script src="./js/signup.js"></script>
</body>
</html>