-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaccount.php
123 lines (110 loc) · 4.74 KB
/
account.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
<?php
require("core.php");
head();
?>
<div class="content-wrapper">
<!--CONTENT CONTAINER-->
<!--===================================================-->
<div id="content-container">
<section class="content-header">
<h1><i class="fa fa-user"></i> Admin Account</h1>
<ol class="breadcrumb">
<li><a href="dashboard.php"><i class="fa fa-home"></i> Admin Panel</a></li>
<li class="active">Admin Account</li>
</ol>
</section>
<!--Page content-->
<!--===================================================-->
<section class="content">
<?php
if (isset($_POST['edit'])) {
$username = addslashes($_POST['username']);
$password = $_POST['password'];
$config['username'] = $username;
file_put_contents('config.php', '<?php return ' . var_export($config, true) . '; ?>');
if ($password != null) {
$password = hash('sha256', $_POST['password']);
$config['password'] = $password;
file_put_contents('config.php', '<?php return ' . var_export($config, true) . '; ?>');
}
echo '<meta http-equiv="refresh" content="0;url=account.php">';
}
?>
<div class="row">
<div class="col-md-9">
<div class="box">
<div class="box-header">
<h3 class="box-title">Admin Account</h3>
</div>
<div class="box-body">
<table id="dt-basic" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
<thead>
<tr>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<td><img src="assets/img/avatar.png" width="25px" height="25px"> <?php
echo $config['username'];
?></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-3">
<form class="form-horizontal" action="" method="post">
<div class="box">
<div class="box-header">
<h3 class="box-title">Edit Account</h3>
</div>
<div class="box-body">
<div class="form-group">
<label class="col-sm-4 control-label">Username: </label>
<div class="col-sm-8">
<input type="text" name="username" class="form-control" value="<?php
echo $config['username'];
?>" required>
</div>
</div>
<hr>
<div class="form-group">
<label class="col-sm-4 control-label">New Password: </label>
<div class="col-sm-8">
<input type="text" name="password" class="form-control">
</div>
</div>
<br /><i>Fill this field only if you want to change the password.</i>
</div>
<div class="panel-footer">
<button class="btn btn-flat btn-success" name="edit" type="submit">Save</button>
<button type="reset" class="btn btn-flat btn-default">Reset</button>
</div>
</div>
</form>
</div>
</div>
</div>
<!--===================================================-->
<!--End page content-->
</div>
<!--===================================================-->
<!--END CONTENT CONTAINER-->
<script>
$(document).ready(function() {
$('#dt-basic').dataTable( {
"responsive": true,
"language": {
"paginate": {
"previous": '<i class="fa fa-angle-left"></i>',
"next": '<i class="fa fa-angle-right"></i>'
}
}
} );
} );
</script>
<?php
footer();
?>