Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php //open php
- include "../includes/head3.php";
- ?>
- <a href=<?=$_SERVER['PHP_SELF']?>?adds=1>[Add Log Entry]</a>
- <?php
- //------------------------------------------
- // DELETE FUNCTIONS
- //------------------------------------------
- if (isset($_GET['del'])) {
- if ($change == add){
- $OldAmount -= $Amount;
- }
- else {
- $OldAmount += $Amount;
- }
- mysql_query("DELETE from APSLOG where ID='" . $_GET['del'] . "'");
- echo "<br>Record deleted!<br>";
- }
- //------------------------------------------
- // ADD FUNCTIONS
- //------------------------------------------
- if (isset($_GET['adds'])) {
- echo '<form action=' . $_SERVER['PHP_SELF'] . ' method="post">';
- echo 'Username: <input type="text" name="Name"/>';
- echo 'User ID: <input type="text" name="UserID"/>';
- echo 'Old Amount: <input type="text" name="OldAmount"/>';
- echo 'Point Change: <select name="change"/>';
- echo '<option value="add">Add</option>';
- echo '<option value="sub">Subtract</option>';
- echo '<input type="text" name="Amount"/>';
- echo 'Description: <input type="text" name="Description"/>';
- echo '<input type="hidden" value="ID" name="ID"/>';
- echo '<input type="submit" value="Add" name="addit"/>';
- echo '</form>';
- }
- if (isset($_POST['addit'])) {
- $Name=$_POST['Name'];
- $Name=strip_tags($Name);
- $UserID=$_POST['UserID'];
- $OldAmount=$_POST['OldAmount'];
- $change=$_POST['change'];
- $Amount=$_POST['Amount'];
- $Description=$_POST['Description'];
- if ($change == add){
- $OldAmount += $Amount;
- }
- If ($change == sub){
- $OldAmount -= $Amount;
- }
- mysql_query("INSERT INTO APSLOG (Amount = Amount + '$change' where UserID = '$UserId')");
- }
- //------------------------------------------
- // DISPLAY FUNCTIONS
- //------------------------------------------
- $result = mysql_query("SELECT * FROM APSLOG ORDER BY ID DESC");
- if (mysql_num_rows($result) > 0) {
- echo '<table border=1><tr><td><center>Name</center></td><td><center>Change</center></td><td><center>Description</center></td></tr>';
- while($row = mysql_fetch_array($result));
- {
- 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>";
- }
- mysql_free_result($result);
- }
- mysql_close($con);
- include "../includes/foot.php";
- ?>
Add Comment
Please, Sign In to add comment