Advertisement
Guest User

Untitled

a guest
May 6th, 2018
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. <?php
  2. session_start();
  3. require('includes/config.php');
  4.  
  5. $servername = "localhost";
  6. $username = "username";
  7. $password = "password";
  8. $dbname = "database";
  9.  
  10. $selectQuery = "SELECT username, email, tokens, tokenstatus, tokensinc, tokenstatus1, tokenswith, tokenstatus2 FROM members WHERE username = '".($_SESSION['username']) ."'";
  11.  
  12. $updateQuery = "UPDATE members SET tokens=tokens - 10, tokenstatus='(Pending Tokens)' ,tokenswith=tokenswith + 10, tokenstatus1='(Pending Tokens)' WHERE username = '".($_SESSION['username']) ."'";
  13.  
  14. // Create connection
  15. $db = mysqli_connect($servername, $username, $password, $dbname);
  16. // Check connection
  17. if (!$db) {
  18. die("Connection failed: " . mysqli_connect_error());
  19. }
  20.  
  21. //if not logged in redirect to login page
  22. if(!$user->is_logged_in()) { header('Location: login.php'); exit(); }
  23.  
  24. //define page title
  25. $title = 'Withdraw ~ Pixel Jag';
  26.  
  27. //include header template
  28. require('layout/header.php');
  29. ?>
  30. <div class="container">
  31. <div class="panel panel-default">
  32. <?php
  33.  
  34.  
  35. $result = mysqli_query($db, $selectQuery);
  36.  
  37. if (mysqli_num_rows($result) > 0) {
  38. // output data of each row
  39. echo "<ul class='list-group'>";
  40. while($row = mysqli_fetch_assoc($result)) {
  41. if ($row['tokens'] < 10) {
  42. echo "<li class='list-group-item list-group-item-danger'>You do not have enough tokens!</li>";
  43. }
  44. }
  45. echo "</ul>";
  46. }
  47.  
  48. if (mysqli_query($db, $updateQuery)) {
  49. echo "<ul class='list-group'><li class='list-group-item list-group-item-success'><h4>Record updated successfully!</h4></li><li class='list-group-item list-group-item-success'><h4>Dont forget to let us know by contacting admin: boss@pixeljag.com to speed things up a bit.. Please alow us up to 72hours to complete the process of moving your active tokens into withdrawn tokens with a (completed) status.<br> Any problems contact: <em>boss@pixeljag.com</em></h4></li></ul>";
  50. } else {
  51. echo "Error updating record: " . mysqli_error($db);
  52. }
  53.  
  54. mysqli_close($db);
  55. ?>
  56.  
  57. <div class="panel-footer">
  58. <a href="index.php"><h4>Back To Dashboard..</h4></a>
  59. </div>
  60. </div>
  61. </div>
  62. <?php
  63. //include header template
  64. require('layout/footer.php');
  65. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement