Advertisement
JWhy

Simple Shell Launcher by JWhy

Feb 19th, 2012
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.54 KB | None | 0 0
  1. <?php
  2.     $script_name = 'Simple Shell Launcher';
  3.  
  4.     $username = 'admin';
  5.     $password = 'bcp-pass';
  6.    
  7.     $scripts[0]['file'] = '/opt/bukkit.sh';
  8.     $scripts[0]['name'] = 'Start bukkit';
  9.    
  10.     $scripts[1]['file'] = '/opt/nyan.sh';
  11.     $scripts[1]['name'] = 'Kill the whole server';
  12.    
  13. ?>
  14.  
  15. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  16.        "http://www.w3.org/TR/html4/loose.dtd">
  17. <html>
  18. <head>
  19. <title><?php echo $script_name; ?></title>
  20. </head>
  21. <body>
  22. <?php
  23.     if(isset($_POST['username']) AND isset($_POST['password']) AND isset($_POST['scriptno'])){
  24.         $exec_res = shell_exec($scripts[$_POST['scriptno']]['file']);
  25. ?>
  26.     <h3>Scripts launched</h3>
  27.     <p>Execution result:</p>
  28.     <p>
  29.         <?php if(empty($exec_res)){
  30.             echo '(empty)';
  31.         } else {
  32.             echo $exec_res;
  33.         }
  34.         ?>
  35.     </p>
  36. <?php
  37.     } else {
  38. ?>
  39.     <form action="<?php $PHP_SELF; ?>" method="POST">
  40.         <table>
  41.             <tr>
  42.                 <td>
  43.                     <p>Username:</p>
  44.                 </td>
  45.                 <td>
  46.                     <input name="username" type="text">
  47.                 </td>
  48.             </tr>
  49.             <tr>
  50.                 <td>
  51.                     <p>Password:</p>
  52.                 </td>
  53.                 <td>
  54.                     <input name="password" type="password" size="20">
  55.                 </td>
  56.             </tr>
  57.             <tr>
  58.                 <td>
  59.                     <p>Script:</p>
  60.                 </td>
  61.                 <td>
  62.                     <select name="scriptno" size="3">
  63.                         <?php foreach($scripts as $key=>$value) echo "<option value=\"$key\">" . $value['name'] . '</option>' . "\n";?>
  64.                     </select>
  65.                 </td>
  66.             </tr>
  67.             <tr>
  68.                 <td colspan="2">
  69.                     <input type="reset">
  70.                     <input type="submit">
  71.                 </td>
  72.             </tr>
  73.         </table>
  74.     </form>
  75. <?php
  76.     }
  77. ?>
  78. </body>
  79. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement