getvalues.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. $currentusr = $_SESSION["username"];
  3. $isadminqry = mysqli_query($link, "select * from users where username='".$currentusr."'");
  4. while($row = mysqli_fetch_array($isadminqry)){
  5. $admin = $row['admin'];
  6. $userid = $row['id'];
  7. }
  8. if(isset($_GET['a'])){
  9. $place = $_GET['a'];
  10. }
  11. if(isset($_GET['asset'])){
  12. $asset = $_GET['asset'];
  13. }
  14. if(isset($_GET['do'])){
  15. $do = $_GET['do'];
  16. }
  17. if(isset($_GET['sched'])){
  18. $sched = $_GET['sched'];
  19. }
  20. if(isset($_GET['newscriptid'])){
  21. $newscriptid = $_GET['newscriptid'];
  22. }
  23. if(isset($_GET['script'])){
  24. $script = $_GET['script'];
  25. }
  26. if(isset($_GET['req'])){
  27. $req = trim($_GET['req']);
  28. }
  29. if(isset($_GET['acc'])){
  30. $acc = trim($_GET['acc']);
  31. }
  32. if(isset($_GET['clt'])){
  33. $cltid = trim($_GET['clt']);
  34. }
  35. if(isset($_GET['rep'])){
  36. $rep = trim($_GET['rep']);
  37. }
  38. if(isset($_GET['usr'])){
  39. $usr = trim($_GET['usr']);
  40. }
  41. if(isset($_GET['chk'])){
  42. $chk = trim($_GET['chk']);
  43. }
  44. if(isset($_GET['repid'])){
  45. $repportid = trim($_GET['repid']);
  46. }
  47. if(isset($_GET['searchstring'])){
  48. $searchstring = trim($_GET['searchstring']);
  49. }
  50. if(isset($_GET['dvctp'])){
  51. $dvctp = trim($_GET['dvctp']);
  52. }
  53. if(isset($_GET['stpdn'])){
  54. $stpdn = trim($_GET['stpdn']);
  55. }
  56. if(isset($_GET['repdn'])){
  57. $repdn = trim($_GET['repdn']);
  58. }
  59. if($place == "logout"){
  60. session_destroy();
  61. header("Refresh:0");
  62. exit;
  63. }
  64. if($_SERVER["REQUEST_METHOD"] == "POST"){
  65. require "place/postactions.php";
  66. }
  67. if(isset($acc)){
  68. if($acc == "yes"){
  69. $sql = "UPDATE request SET treated_by = ?, approved = 1 WHERE id = ?";
  70. if($stmt = mysqli_prepare($link, $sql)){
  71. mysqli_stmt_bind_param($stmt, "si", $currentusr, $req);
  72. if(mysqli_stmt_execute($stmt)){
  73. header("location: ?a=launch&req=$req");
  74. exit();
  75. } else{
  76. echo "Oops! Something went wrong. Please try again later.";
  77. }
  78. }
  79. }elseif($acc == "cltclass"){
  80. $sql = "UPDATE request SET clientid = ? WHERE id = ?";
  81. if($stmt = mysqli_prepare($link, $sql)){
  82. mysqli_stmt_bind_param($stmt, "ii", $cltid, $req);
  83. if(mysqli_stmt_execute($stmt)){
  84. header("location: ?a=launch&req=$req");
  85. exit();
  86. } else{
  87. echo "Oops! Something went wrong. Please try again later.";
  88. }
  89. }
  90. }elseif($acc == "reqend"){
  91. $sql = "UPDATE request SET approved = 3 WHERE id = ?";
  92. if($stmt = mysqli_prepare($link, $sql)){
  93. mysqli_stmt_bind_param($stmt, "i", $req);
  94. if(mysqli_stmt_execute($stmt)){
  95. header("location: ?a=launch");
  96. exit();
  97. } else{
  98. echo "Oops! Something went wrong. Please try again later.";
  99. }
  100. }
  101. }
  102. }
  103. if(isset($stpdn)){
  104. $stepqry = mysqli_query($link, "select * from repports where id='$rep'");
  105. while($row = mysqli_fetch_array($stepqry)){
  106. $stepsdone = $row['stepsdone'];
  107. }
  108. if(strpos("$stepsdone", "<$stpdn>")){
  109. $stepsdone = str_replace("<$stpdn>","",$stepsdone);
  110. $delstepqry = "UPDATE repports SET stepsdone = ? WHERE id = $rep";
  111. if($stmt = mysqli_prepare($link, $delstepqry)){
  112. mysqli_stmt_bind_param($stmt, "s", $stepsdone);
  113. if(mysqli_stmt_execute($stmt)){
  114. header("location: ?a=launch&acc=rapp&req=$req&rep=$rep");
  115. exit();
  116. }
  117. }
  118. }else{
  119. $stepsdone = $stepsdone."<$stpdn>";
  120. $addstepqry = "UPDATE repports SET stepsdone=? WHERE id=$rep";
  121. if($stmt = mysqli_prepare($link, $addstepqry)){
  122. mysqli_stmt_bind_param($stmt, "s", $stepsdone);
  123. if(mysqli_stmt_execute($stmt)){
  124. header("location: ?a=launch&acc=rapp&req=$req&rep=$rep");
  125. exit();
  126. }
  127. }
  128. }
  129. }
  130. if(isset($repdn)){
  131. $delrepqry = "UPDATE repports SET repstat = 1 WHERE id = ?";
  132. if($stmt = mysqli_prepare($link, $delrepqry)){
  133. mysqli_stmt_bind_param($stmt, "i", $rep);
  134. if(mysqli_stmt_execute($stmt)){
  135. header("location: ?a=launch&acc=rapp&req=$req");
  136. exit();
  137. }
  138. }
  139. }
  140. require "place/theme.php";
  141. ?>