Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. <?php
  2.  
  3. include ('../steamauth/userInfo.php');
  4.  
  5. //Your postback url should look like this http://yourdomain.com/path/postbackfilename.php?userid={s1}&points={points}&token=89jadsfknlk12klaslk
  6.  
  7. $secret_token = '89jadsfknlk12klaslk'; //This token is to verify that the postback has come from AdGate and not some user who has gained access to your postback url
  8.  
  9. $userid = $_GET['userid'];
  10. $points = $_GET['points'];
  11. $token = $_GET['token'];
  12.  
  13. $servername = 'localhost';
  14. $username = 'earnskin_ADMIN';
  15. $password = 'wordpass11!';
  16. $dbname = 'earnskin_MAIN';
  17.  
  18. $conn = new mysqli($servername, $username, $password, $dbname);
  19.  
  20. if ($conn->connect_error) {
  21. die("Connection failed: " . $conn->connect_error);
  22. }
  23.  
  24. if($token !== $secret_token) //see if token matches
  25. {
  26. echo 'Invalid token';
  27. exit;
  28. }
  29.  
  30. if(!$userid || !$points)
  31. {
  32. echo 'Missing parameters';
  33. exit;
  34. }
  35.  
  36. //Add code here to insert $userid and $points into database
  37.  
  38. $sql = "SELECT balance FROM users WHERE steamid = '".$steamprofile['steamid']."'";
  39. $result = $conn->query($sql);
  40. $row = $result->fetch_assoc();
  41. $userBalance = $row['balance'];
  42.  
  43. $userBalance + $points = $newBalance;
  44.  
  45. $sql = "UPDATE users SET balance='".$newBalance."', WHERE steamid='".$steamprofile['steamid']."'";
  46. $result = $conn->query($sql);
  47.  
  48.  
  49. $sql2 = "INSERT INTO transactions (userid, amount, user) VALUES ('".$userid."', '".$points."', '".$steamprofile['steamid']."')";
  50. $result = $conn->query($sql2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement