Advertisement
Guest User

Untitled

a guest
May 3rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.92 KB | None | 0 0
  1. <?php
  2. //Restart script by Rockerfooi!
  3. session_start();
  4.  
  5. //Variables
  6. $Username = "Username";
  7. $Password = "Password";
  8.  
  9. //Script Start
  10. if(isset($_SESSION["LoggedIN"])){
  11.     if(isset($_GET["logout"])){
  12.         session_destroy();
  13.         Header("Location: index.php");
  14.     }else{
  15.         If(isset($_POST["cancel"])){
  16.             $exec = shell_exec("shutdown -a");
  17.             echo($exec);
  18.             echo("Aborted.<br><br>");
  19.         }
  20.         If(isset($_POST["mode"])){
  21.             Switch($_POST["mode"]){
  22.                 Case "Shutdown":
  23.                     $out = shell_exec("shutdown -s -f -t 20");
  24.                     echo($out);
  25.                     echo("Computer will be shutdown in 20 seconds! <br>");
  26.                     echo("
  27.                         <form action=\"index.php\" method=\"post\">
  28.                         <input type=\"submit\" name=\"cancel\" value=\"Cancel\">
  29.                         </form>
  30.                     ");
  31.                     Break;
  32.                 Case "Reboot":
  33.                     $out = shell_exec("shutdown -r -f -t 20");
  34.                     echo($out);
  35.                     echo("Computer will be rebooted in 20 seconds! <br>");
  36.                     echo("
  37.                         <form action=\"index.php\" method=\"post\">
  38.                         <input type=\"submit\" name=\"cancel\" value=\"Cancel\">
  39.                         </form>
  40.                     ");
  41.                     Break;
  42.             }
  43.         }else{
  44.             echo("
  45.        
  46.                 <form action=\"index.php\" method=\"post\">
  47.                 <input type=\"radio\" name=\"mode\" value=\"Shutdown\"> Shutdown<br>
  48.                 <input type=\"radio\" name=\"mode\" value=\"Reboot\"> Reboot<br>
  49.                 <input type=\"submit\" value=\"Execute!\">
  50.                 </form><br><br>
  51.                 Click <a href=\"index.php?logout=true\">here</a> to logout!
  52.            
  53.             ");
  54.         }
  55.     }
  56. }else{
  57.     if(isset($_POST["username"])){
  58.         if($_POST["username"] == $Username && $_POST["password"] == $Password){
  59.             $_SESSION["LoggedIN"] = 1;
  60.             Header("Location: index.php");
  61.         }else{
  62.             echo("Incorrect login!");
  63.         }
  64.     }else{
  65.  
  66.         echo ("
  67.  
  68.             <form action=\"index.php\" method=\"post\">
  69.             Username: <input type=\"text\" name=\"username\"><br>
  70.             Password: <input type=\"password\" name=\"password\"><br>
  71.             <input type=\"submit\" value=\"Login\">
  72.             </form><br><br>
  73.  
  74.         ");
  75.     }
  76. }
  77. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement