-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.php
127 lines (113 loc) · 3.46 KB
/
admin.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
<?php
session_start();
error_reporting(0);
include('config.php');
if(strlen($_SESSION['alogin'])==0)
{
header('location:main.html');
}
if(isset($_POST['submit']))
{ $sql="select * from admina where user_id='".$_SESSION['alogin']."' AND passworde='".$_POST['cpass']."' LIMIT 1";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result)==1)
{
$con=mysqli_query($conn,"update admina set passworde='".$_POST['newpass']."'where user_id='".$_SESSION['alogin']."'");
$_SESSION['msg']="Password Changed Successfully !!";
}
else
{
$_SESSION['msg']="Old Password not match !!";
}
}
?>
<!Doctype html>
<html>
<head>
<link rel="stylesheet" href="css/cus.css">
<link href="css/bootstrap.css" rel="stylesheet" />
<link href="css/font-awesome.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet" />
<title>
ADMIN PANEL
</title>
</head>
<script type="text/javascript">
function valid()
{
if(document.chngpwd.cpass.value=="")
{
alert("Current Password Filed is Empty !!");
document.chngpwd.cpass.focus();
return false;
}
else if(document.chngpwd.newpass.value=="")
{
alert("New Password Filed is Empty !!");
document.chngpwd.newpass.focus();
return false;
}
else if(document.chngpwd.cnfpass.value=="")
{
alert("Confirm Password Filed is Empty !!");
document.chngpwd.cnfpass.focus();
return false;
}
else if(document.chngpwd.newpass.value!= document.chngpwd.cnfpass.value)
{
alert("Password and Confirm Password Field do not match !!");
document.chngpwd.cnfpass.focus();
return false;
}
return true;
}
</script>
<body>
<body>
<?php include('header.php');?>
<!-- LOGO HEADER END-->
<?php if($_SESSION['alogin']!="")
{
include('menu.php');
}?>
<!-- MENU SECTION END-->
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line">Admin Change Password </h1>
</div>
</div>
<div class="row" >
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
Change Password
</div>
<font color="green" align="center"><?php echo htmlentities($_SESSION['msg']);?><?php echo htmlentities($_SESSION['msg']="");?></font>
<div class="panel-body">
<form name="chngpwd" method="post" onSubmit="return valid();">
<div class="form-group">
<label for="exampleInputPassword1">Current Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" name="cpass" placeholder="Password" />
</div>
<div class="form-group">
<label for="exampleInputPassword1">New Password</label>
<input type="password" class="form-control" id="exampleInputPassword2" name="newpass" placeholder="Password" />
</div>
<div class="form-group">
<label for="exampleInputPassword1">Confirm Password</label>
<input type="password" class="form-control" id="exampleInputPassword3" name="cnfpass" placeholder="Password" />
</div>
<button type="submit" name="submit" class="btn btn-default">Submit</button>
<hr />
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<?php include('footer.php');?>
</html>