assets.php 4.0 KB

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