-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake_admin.php
More file actions
72 lines (59 loc) · 2.16 KB
/
Copy pathmake_admin.php
File metadata and controls
72 lines (59 loc) · 2.16 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
<?php include("header.php");?>
<?php include('db_con.php');?>
<div class="container-fluid">
<div class="row" id="wrapper">
<?php require_once'menubar.php';?>
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-body">
<?php
if (isset($_POST['submit'])){
$user_name = $_POST['user_name'];
$password = $_POST['password'];
if($user_name != NULL && $password != NULL){
$sql = "UPDATE `admin` SET `user_name`='$user_name',`password`='$password' WHERE id='1'";
$result = mysqli_query($conn,$sql);
if($result){
session_start();
if(session_destroy()) {
echo "<div class='alert alert-success'>";
echo "<strong>Successfully Logged out. Redirecting Login page. Wait 2 secs..</strong>";
echo "</div>";
header("Refresh: 2;URL = admin_login.php");
}
}else{
echo "<div class='alert alert-danger'>";
echo "<strong>Error!</strong> in update.Please try again.";
echo "</div>";
}
}
}
?>
<div class="col-md-8 col-md-offset-2">
<center><h3>Make a new Admin</h3></center>
<br>
<form action="make_admin.php" method="post" class="form-horizontal" role="form">
<div class="form-group">
<label for="user_name" class="col-sm-2 control-label">User Name</label>
<div class="col-sm-7">
<input type="text" class="form-control" name="user_name">
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">Password</label>
<div class="col-sm-7">
<input type="text" class="form-control" name="password">
</div>
</div>
<center><input type="submit" name="submit" value="Submit" class="btn btn-primary" style="padding: 10px; width: 100px;"></center>
<input type="hidden" name="id">
</form>
</div>
</div>
<a href="welcome_admin.php" class="btn btn-warning" style="padding: 10px; width: 100px; left: 20px;"> Go Back </a>
<br>
<br>
</div>
</div>
</div>
</div>