scripts.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <div class="launchcollumn">
  2. <a>Scripts</a><br>
  3. <?php
  4. echo "<a href='?a=scripts&script=newscript' class='collumnbutton'>--> New <--</a>";
  5. $getscriptsqry = mysqli_query($link, "select * from scripts ORDER BY name ASC");
  6. while($row = mysqli_fetch_array($getscriptsqry)){
  7. echo "<a href='?a=scripts&script=".$row['id']."' class='collumnbutton'>".$row['name']."</a>";
  8. }
  9. echo "</div>";
  10. if(isset($script)){
  11. if($script != 'newscript'){
  12. $do = "scriptedit";
  13. $getscriptsqry = mysqli_query($link, "select * from scripts where id = $script");
  14. while($row = mysqli_fetch_array($getscriptsqry)){
  15. $scriptname = $row['name'];
  16. $scriptdata = $row['data'];
  17. $shell = $row['shell'];
  18. }
  19. if($shell == 'powershell'){
  20. $powershell = "powershell' selected='selected";
  21. $cmd = "cmd";
  22. $bash = "bash";
  23. }elseif($shell == 'cmd'){
  24. $powershell = "powershell";
  25. $cmd = "cmd' selected='selected";
  26. $bash = "bash";
  27. }elseif($shell == 'bash'){
  28. $powershell = "powershell";
  29. $cmd = "cmd";
  30. $bash = "bash' selected='selected";
  31. }
  32. }else{
  33. $do = "newscript";
  34. }
  35. echo "<div class='editcollumn'>
  36. <a>Name</a><br>
  37. <form action='?a=scripts&script=$script&do=$do' method='POST'>
  38. <input type='text' name='scriptname' class='input' placeholder='Script Name' value='$scriptname'><br>
  39. <select id='shell' name='shell'>
  40. <option value='$cmd'>CMD</option>
  41. <option value='$powershell'>PowerShell</option>
  42. <option value='$bash'>BASH</option>
  43. </select><br>
  44. <textarea type='longtext' name='script' class='input-script' placeholder='Enter Script Here'>$scriptdata</textarea>
  45. <input type='submit' class='button' value='Save'>
  46. </form>
  47. ";
  48. }