Guest User

Untitled

a guest
Jan 13th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <?php
  2. function postToDiscord($message)
  3. {
  4. $data = array("content" => $message, "username" => "Postback Bot");
  5. $curl = curl_init("https://discordapp.com/api/webhooks/#################/###################################################");
  6. curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
  7. curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
  8. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  9. return curl_exec($curl);
  10. }
  11.  
  12. $servername = "localhost";
  13. $username = "#######";
  14. $password = "#######";
  15. $dbname = "########";
  16. $conn = new mysqli($servername, $username, $password, $dbname);
  17.  
  18. if (!isset($_GET['id'])) {
  19. exit();
  20. }
  21.  
  22. if (!isset($_GET['robux'])) {
  23. exit();
  24. }
  25.  
  26. $userid = $_GET['id'];
  27. $payout = $_GET['robux'];
  28.  
  29. $sql = "SELECT id, username, balance FROM logs";
  30. $result = $conn->query($sql);
  31.  
  32. while($row = $result->fetch_assoc()) {
  33. if ($userid == $row['id']) {
  34. $currentbal = $row['balance'];
  35. $user = $row['username'];
  36. }
  37. }
  38.  
  39. $newbal = $currentbal + $payout;
  40.  
  41. $sql = "UPDATE logs SET balance='$newbal' WHERE id=".$userid;
  42. $conn->query($sql);
  43.  
  44. $money = round($payout/40, 2);
  45.  
  46. $msg = '
  47. **NEW PAYOUT**
  48. Username: '.$user.'
  49. Payout: '.$payout.' R$
  50. New balance: '.$newbal.' R$
  51.  
  52. Our earnings: '.$money.'$
  53. --------------------';
  54. postToDiscord($msg);
  55. ?>
Add Comment
Please, Sign In to add comment