Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "alphaearn";
- $password = "alphaearn";
- $db = "alpha";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $db);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- //echo "Connected successfully";
- /********* UNCOMMENT ALL OF THIS WHEN DONE WITH TESTING ******************
- $IP = User::get_Request_IP();
- $validIPs = array(
- '204.232.224.18',
- '204.232.224.19',
- '104.130.46.116',
- '104.130.60.109',
- '104.239.224.178',
- '104.130.60.108'
- );
- if (!in_array($IP, $validIPs))
- {
- // Request is not coming from a valid source. Abort! Abort!
- exit;
- }
- ***************************************************************************/
- class Lead
- {
- protected $db;
- protected $oid;
- protected $odyn;
- protected $onm;
- protected $cur;
- protected $sb1;
- protected $sts;
- protected $ip;
- protected $tid;
- protected $uts;
- public function __construct()
- {
- $this->db = Database::get_Database();
- $this->oid = $_GET['oid'];
- $this->odyn = $_GET['odyn'];
- $this->onm = $_GET['onm'];
- $this->cur = $_GET['cur'];
- $this->sb1 = $_GET['sb1'];
- $this->sts = $_GET['sts'];
- $this->ip = $_GET['ip'];
- $this->tid = $_GET['tid'];
- $this->uts = $_GET['uts'];
- $this->run();
- }
- protected function run()
- {
- $already_Rewarded = $this->db->one_Row(
- "SELECT count(*) AS cnt FROM offer_log WHERE offerid = :offerid AND status = :status AND dynamic = 'false'",
- array('offerid' => $this->oid, 'status' => $this->sts)
- );
- if ($already_Rewarded['cnt'] != 0)
- {
- // Already rewarded
- return;
- }
- try
- {
- $this->db->begin_Transaction();
- $this->db->do_Query(
- "INSERT INTO offer_log SET txn_id = :txnid, "
- . "user_id = :userid, "
- . "offer_id = :offerid, "
- . "dynamic = :dynamic, "
- . "offer_name = :offername, "
- . "currency = :currency, "
- . "status = :status, "
- . "ip = :ip, "
- . "timestamp = :timestamp",
- array(
- 'txnid' => $this->tid,
- 'userid' => $this->sb1,
- 'offerid' => $this->oid,
- 'dynamic' => $this->odyn,
- 'offername' => $this->onm,
- 'currency' => $this->cur,
- 'status' => $this->sts,
- 'ip' => $this->ip,
- 'timestamp' => $this->uts
- )
- );
- $this->db->do_Query(
- "UPDATE adscend SET balance = balance + :balance WHERE user_id = :userid",
- array('balance' => $this->cur, 'userid' => $this->sb1)
- );
- $this->db->do_Commit();
- }
- catch (Exception $e)
- {
- $this->db->roll_Back();
- }
- catch (dbException $e)
- {
- $this->db->roll_Back();
- }
- }
- }
- $p = new Lead();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement