assets.php 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <div class="launchcollumn">
  2. <a>Assets</a><br>
  3. <?php
  4. $getaassetqry = mysqli_query($link, "select * from assets where active=1 ORDER BY name ASC");
  5. while($row = mysqli_fetch_array($getaassetqry)){
  6. echo "<a href='?a=assets&asset=".$row['id']."' class='collumnbutton'>".$row['name']."</a>";
  7. }
  8. ?>
  9. </div>
  10. <?php
  11. if(isset($asset)){
  12. $getinfqry = mysqli_query($link, "SELECT * from assets where id = $asset");
  13. while($row = mysqli_fetch_array($getinfqry)){
  14. $assetdesc = $row['description'];
  15. $assetname = $row['name'];
  16. }
  17. echo "<div class='launchcollumn'>";
  18. echo "<a>$assetname</a>";
  19. echo "<a class='collumnbutton'>$assetdesc</a>";
  20. echo "<a href='?a=assets&asset=$asset&do=scripts' class='collumnbutton'>Exécution Scripts</a>";
  21. echo "</div>";
  22. if(isset($do) && $do == 'scripts'){
  23. echo "<div class='launchcollumn'>";
  24. echo "<a>Scripts</a>";
  25. echo "<a href='?a=assets&asset=$asset&do=$do&sched=new' class='collumnbutton'>New</a>";
  26. $getschedqry = mysqli_query($link, "SELECT * from schedules where assetid = $asset ORDER BY runtime DESC");
  27. while($row = mysqli_fetch_array($getschedqry)){
  28. $scriptid = $row['scriptid'];
  29. $schedtime = $row['runtime'];
  30. $schedid = $row['id'];
  31. $getscriptqry = mysqli_query($link, "SELECT * from scripts where id = $scriptid");
  32. while($row = mysqli_fetch_array($getscriptqry)){
  33. $scriptname = $row['name'];
  34. }
  35. echo "<a href='?a=assets&asset=$asset&do=$do&sched=$schedid' class='collumnbutton'>$scriptname $schedtime</a>";
  36. }
  37. echo "</div>";
  38. if(isset($sched) && $sched != 'new' && $sched != 'set'){
  39. $getschedqry = mysqli_query($link, "SELECT * from schedules where id = $sched");
  40. while($row = mysqli_fetch_array($getschedqry)){
  41. $scriptid = $row['scriptid'];
  42. $schedtime = $row['runtime'];
  43. $rantime = $row['rantime'];
  44. $status = $row['status'];
  45. $output = $row['output'];
  46. $userid = $row['userid'];
  47. }
  48. $getscriptqry = mysqli_query($link, "SELECT * from scripts where id = $scriptid");
  49. while($row = mysqli_fetch_array($getscriptqry)){
  50. $scriptname = $row['name'];
  51. $scriptdesc = $row['description'];
  52. }
  53. $getuserqry = mysqli_query($link, "SELECT * from users where id = $userid");
  54. while($row = mysqli_fetch_array($getuserqry)){
  55. $username = $row['username'];
  56. }
  57. echo "<div class='launchcollumn'>";
  58. echo "<a>$scriptname</a>";
  59. echo "<a class='collumnbutton'>$scriptdesc</a>";
  60. echo "<a class='collumnbutton'>Time: $schedtime</a>";
  61. echo "<a class='collumnbutton'>CMD retreived: $rantime</a>";
  62. echo "<a class='collumnbutton'>Status: $status</a>";
  63. echo "<a class='collumnbutton'>Output: $output</a>";
  64. echo "<a class='collumnbutton'>Ran by: $username</a>";
  65. }elseif(isset($sched) && $sched == 'new'){
  66. echo "<div class='launchcollumn'>";
  67. echo "<a>New</a>";
  68. $getscriptsqry = mysqli_query($link, "SELECT * from scripts");
  69. while($row = mysqli_fetch_array($getscriptsqry)){
  70. echo "<a href='?a=assets&asset=$asset&do=$do&sched=set&newscriptid=".$row['id']."' class='collumnbutton'>".$row['name']."</a>";
  71. }
  72. }elseif(isset($sched) && $sched == 'set'){
  73. echo "<div class='launchcollumn'>";
  74. echo "<a>Set time</a>
  75. <form action='?a=assets&asset=$asset&do=$do&sched=save&newscriptid=$newscriptid' method='POST'>
  76. <input type='text' name='datetime' class='input' placeholder='yyyy-MM-dd HH:mm:ss'>
  77. <input type='submit' class='button' value='Save'>
  78. </form>";
  79. echo "</div>";
  80. }
  81. }
  82. }
  83. ?>