Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Restart script by Rockerfooi!
- session_start();
- //Variables
- $Username = "Username";
- $Password = "Password";
- //Script Start
- if(isset($_SESSION["LoggedIN"])){
- if(isset($_GET["logout"])){
- session_destroy();
- Header("Location: index.php");
- }else{
- If(isset($_POST["cancel"])){
- $exec = shell_exec("shutdown -a");
- echo($exec);
- echo("Aborted.<br><br>");
- }
- If(isset($_POST["mode"])){
- Switch($_POST["mode"]){
- Case "Shutdown":
- $out = shell_exec("shutdown -s -f -t 20");
- echo($out);
- echo("Computer will be shutdown in 20 seconds! <br>");
- echo("
- <form action=\"index.php\" method=\"post\">
- <input type=\"submit\" name=\"cancel\" value=\"Cancel\">
- </form>
- ");
- Break;
- Case "Reboot":
- $out = shell_exec("shutdown -r -f -t 20");
- echo($out);
- echo("Computer will be rebooted in 20 seconds! <br>");
- echo("
- <form action=\"index.php\" method=\"post\">
- <input type=\"submit\" name=\"cancel\" value=\"Cancel\">
- </form>
- ");
- Break;
- }
- }else{
- echo("
- <form action=\"index.php\" method=\"post\">
- <input type=\"radio\" name=\"mode\" value=\"Shutdown\"> Shutdown<br>
- <input type=\"radio\" name=\"mode\" value=\"Reboot\"> Reboot<br>
- <input type=\"submit\" value=\"Execute!\">
- </form><br><br>
- Click <a href=\"index.php?logout=true\">here</a> to logout!
- ");
- }
- }
- }else{
- if(isset($_POST["username"])){
- if($_POST["username"] == $Username && $_POST["password"] == $Password){
- $_SESSION["LoggedIN"] = 1;
- Header("Location: index.php");
- }else{
- echo("Incorrect login!");
- }
- }else{
- echo ("
- <form action=\"index.php\" method=\"post\">
- Username: <input type=\"text\" name=\"username\"><br>
- Password: <input type=\"password\" name=\"password\"><br>
- <input type=\"submit\" value=\"Login\">
- </form><br><br>
- ");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement