-
Notifications
You must be signed in to change notification settings - Fork 11
/
power.php
executable file
·47 lines (45 loc) · 1.61 KB
/
power.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
<?php
include ("header.php");
include ("pass.php");
?>
<div style="padding: 5px 30px 0px;">
<div class="row">
<div class="col-lg-2">
<form action="power" method="POST"><input type="hidden">
<div class="input-group">
<button class='btn btn-default' type="submit" name="status" value="reboot">Restart StakeBox</button>
</div><!-- /input-group -->
</form>
</div><!-- /.col-lg-2 -->
<div class="col-lg-2">
<form action="power" method="POST"><input type="hidden">
<div class="input-group">
<button class='btn btn-default' type="submit" name="status" value="shutdown">Shut Down StakeBox</button>
</div><!-- /input-group -->
</form>
</div><!-- /.col-lg-2 -->
</div><!-- /.row -->
<?php
$status = $_POST["status"];
if ($status == "reboot"){
if ($lockState != "Not Encrypted") {
$currentWallet = NavCoin;
$_SESSION['currentWallet'] = $currentWallet;
$coinu = $wallets[$currentWallet];
$coin = new jsonRPCClient("{$coinu['protocol']}://{$coinu['user']}:{$coinu['pass']}@{$coinu['host']}:{$coinu['port']}", true);
$coin->walletlock();
$newLockState = "Locked";
changeLockState();
}
//exec("python /home/stakebox/UI/libs/reboot.py");
exec("sudo reboot");
print '<h2>Your StakeBox is restarting ...</h2>';
} else if ($status == "shutdown"){
//exec("python /home/stakebox/UI/libs/shutdown.py");
exec("sudo shutdown now");
print '<h2>Your StakeBox is shutting down ...</h2>';
}
?>
</div>
</div>
<?php include ("footer.php"); ?>