Guest User

Untitled

a guest
Feb 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. <?php //open php
  2. include "../includes/head3.php";
  3. ?>
  4.  
  5. <a href=<?=$_SERVER['PHP_SELF']?>?adds=1>[Add Log Entry]</a>
  6.  
  7. <?php
  8. include "../includes/vars.php";
  9. //------------------------------------------
  10. // DELETE FUNCTIONS
  11. //------------------------------------------
  12. if (isset($_GET['del'])) {
  13. if ($change == add){
  14. $OldAmount -= $Amount;
  15. }
  16. if ($change == sub){
  17. $OldAmount += $Amount;
  18. }
  19. mysql_query("DELETE from APSLOG where ID='" . $_GET['del'] . "'");
  20. echo "<br>Record deleted!<br>";
  21. }
  22.  
  23. //------------------------------------------
  24. // ADD FUNCTIONS
  25. //------------------------------------------
  26. if (isset($_GET['adds'])) {
  27.  
  28. echo '<form action=' . $_SERVER['PHP_SELF'] . ' method="post">';
  29. echo 'Username: <input type="text" name="Name"/>';
  30. echo 'User ID: <input type="text" name="UserID"/>';
  31. echo 'Old Amount: <input type="text" name="OldAmount"/>';
  32. echo 'Point Change: <select name="change"/>';
  33. echo '<option value="add">Add</option>';
  34. echo '<option value="sub">Subtract</option>';
  35. echo '<input type="text" name="Amount"/>';
  36. echo 'Description: <input type="text" name="Description"/>';
  37. echo '<input type="hidden" value="ID" name="ID"/>';
  38. echo '<input type="submit" value="Add" name="addit"/>';
  39. echo '</form>';
  40.  
  41. }
  42.  
  43. if (isset($_POST['addit'])) {
  44. $Name=$_POST['Name'];
  45. $Name=strip_tags($Name);
  46. $UserID=$_POST['UserID'];
  47. $OldAmount=$_POST['OldAmount'];
  48. $change=$_POST['change'];
  49. $Amount=$_POST['Amount'];
  50. $Description=$_POST['Description'];
  51.  
  52. If ($change == add){
  53. $OldAmount =+ $Amount;
  54. }
  55.  
  56. If ($change == sub){
  57. $OldAmount -= $Amount;
  58. }
  59.  
  60. mysql_query("INSERT INTO APSLOG (Name, UserID, OldAmount, change, Amount, Description) VALUES ('$Name', '$UserID', '$OldAmount', '$change',, '$Amount' '$Description')");
  61. }
  62.  
  63.  
  64.  
  65. //------------------------------------------
  66. // DISPLAY FUNCTIONS
  67. //------------------------------------------
  68.  
  69. $result = mysql_query("SELECT * FROM APSLOG ORDER BY ID DESC");
  70.  
  71. if (mysql_num_rows($result) > 0) {
  72. echo '<table border=1><tr><td><center>Name</center></td><td><center>Change</center></td><td><center>Description</center></td></tr>';
  73. while($row = mysql_fetch_array($result));
  74. {
  75. echo "<tr><td width=150>" . $row['Name'] . "</td><td width=100>" . $row['change'] . "" . $row['Amount'] . "</td><td width=600>" . $row['Description'] . "</td><td width=150><a href=" . $_SERVER['PHP_SELF'] . "?del=" . $row['ID'] . ">Delete</a></td></tr>";
  76. }
  77. mysql_free_result($result);
  78. }
  79. mysql_close($con);
  80. include "../includes/foot.php";
  81. ?>
Add Comment
Please, Sign In to add comment