getvalues.php 4.2 KB

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