scripts.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. }else{
  32. $powershell = "powershell";
  33. $cmd = "cmd";
  34. $bash = "bash";
  35. }
  36. }else{
  37. $do = "newscript";
  38. }
  39. echo "<div class='editcollumn'>
  40. <a>Name</a><br>
  41. <form action='?a=scripts&script=$script&do=$do' method='POST'>
  42. <input type='text' name='scriptname' class='input' placeholder='Script Name' value='$scriptname'><br>
  43. <select id='shell' name='shell'>
  44. <option value='$cmd'>CMD</option>
  45. <option value='$powershell'>PowerShell</option>
  46. <option value='$bash'>BASH</option>
  47. </select><br>
  48. <textarea type='longtext' name='script' class='input-script' placeholder='Enter Script Here'>$scriptdata</textarea><br>
  49. <input type='submit' class='button' value='Save'>
  50. <a href='?a=delscript&script=$script' class='button' style='background-color:red; color:black;'>Delete</a>
  51. </form>
  52. ";
  53. }