Advertisement
Guest User

posty

a guest
Nov 16th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "alphaearn";
  4. $password = "alphaearn";
  5. $db = "alpha";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $db);
  9.  
  10. // Check connection
  11. if ($conn->connect_error) {
  12. die("Connection failed: " . $conn->connect_error);
  13. }
  14. //echo "Connected successfully";
  15. /********* UNCOMMENT ALL OF THIS WHEN DONE WITH TESTING ******************
  16. $IP = User::get_Request_IP();
  17.  
  18. $validIPs = array(
  19. '204.232.224.18',
  20. '204.232.224.19',
  21. '104.130.46.116',
  22. '104.130.60.109',
  23. '104.239.224.178',
  24. '104.130.60.108'
  25. );
  26.  
  27. if (!in_array($IP, $validIPs))
  28. {
  29. // Request is not coming from a valid source. Abort! Abort!
  30. exit;
  31. }
  32. ***************************************************************************/
  33.  
  34. class Lead
  35. {
  36. protected $db;
  37.  
  38. protected $oid;
  39. protected $odyn;
  40. protected $onm;
  41. protected $cur;
  42. protected $sb1;
  43. protected $sts;
  44. protected $ip;
  45. protected $tid;
  46. protected $uts;
  47.  
  48. public function __construct()
  49. {
  50. $this->db = Database::get_Database();
  51.  
  52. $this->oid = $_GET['oid'];
  53. $this->odyn = $_GET['odyn'];
  54. $this->onm = $_GET['onm'];
  55. $this->cur = $_GET['cur'];
  56. $this->sb1 = $_GET['sb1'];
  57. $this->sts = $_GET['sts'];
  58. $this->ip = $_GET['ip'];
  59. $this->tid = $_GET['tid'];
  60. $this->uts = $_GET['uts'];
  61.  
  62. $this->run();
  63. }
  64.  
  65. protected function run()
  66. {
  67. $already_Rewarded = $this->db->one_Row(
  68. "SELECT count(*) AS cnt FROM offer_log WHERE offerid = :offerid AND status = :status AND dynamic = 'false'",
  69. array('offerid' => $this->oid, 'status' => $this->sts)
  70. );
  71.  
  72. if ($already_Rewarded['cnt'] != 0)
  73. {
  74. // Already rewarded
  75. return;
  76. }
  77.  
  78. try
  79. {
  80. $this->db->begin_Transaction();
  81.  
  82. $this->db->do_Query(
  83. "INSERT INTO offer_log SET txn_id = :txnid, "
  84. . "user_id = :userid, "
  85. . "offer_id = :offerid, "
  86. . "dynamic = :dynamic, "
  87. . "offer_name = :offername, "
  88. . "currency = :currency, "
  89. . "status = :status, "
  90. . "ip = :ip, "
  91. . "timestamp = :timestamp",
  92. array(
  93. 'txnid' => $this->tid,
  94. 'userid' => $this->sb1,
  95. 'offerid' => $this->oid,
  96. 'dynamic' => $this->odyn,
  97. 'offername' => $this->onm,
  98. 'currency' => $this->cur,
  99. 'status' => $this->sts,
  100. 'ip' => $this->ip,
  101. 'timestamp' => $this->uts
  102. )
  103. );
  104.  
  105. $this->db->do_Query(
  106. "UPDATE adscend SET balance = balance + :balance WHERE user_id = :userid",
  107. array('balance' => $this->cur, 'userid' => $this->sb1)
  108. );
  109.  
  110. $this->db->do_Commit();
  111. }
  112.  
  113. catch (Exception $e)
  114. {
  115. $this->db->roll_Back();
  116. }
  117.  
  118. catch (dbException $e)
  119. {
  120. $this->db->roll_Back();
  121. }
  122. }
  123. }
  124.  
  125. $p = new Lead();
  126. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement