· 7 years ago · Sep 09, 2018, 05:52 AM
1<?php
2include 'config.php'; //Get api key in config file
3
4$secret_key = '0c51dce22dc8061b07dfc8ef76e6fa5b'; // Set this one, it is provided to you.
5$transaction_id = urldecode($_REQUEST['transaction_id']); // The unique transaction id.
6$user_id = urldecode($_REQUEST['user_id']); // The member who did the work
7$ms = urldecode($_REQUEST['ms']); // The verification code.
8$amount = urldecode($_REQUEST['amount']); // The amount your member will receive.
9$offer_type = urldecode($_REQUEST['offer_type']); // 1 = Paid to Click, 2 = job, 3 = offer ( I only use ptc offer right now, so I don't set up offertype for others)
10$hash = md5($transaction_id.":".$secret_key);
11
12if($multiplicator == "true"){
13 $amount = $amount *$multiplicator_amount;
14}
15
16
17$calc = $amount / 100;
18$calc = $calc * $refshare;
19$calc = floor($calc);
20
21if($offers4all_status == "false"){
22 die("Disabled");
23}
24
25if($hash == $ms){
26
27 $sql = "SELECT * FROM wallets WHERE id = '$user_id' ";
28 $result = $conn->query($sql);
29 $checko = "0";
30 if ($result->num_rows > 0) {
31 while($row = $result->fetch_assoc()) {
32 $wallet = $row['wallet'];
33 $ref = $row['ref'];
34 $checko = '1';
35 }
36 }
37
38 if($checko == "1"){
39 $sql = "UPDATE wallets SET balance = balance + '$amount' WHERE wallet = '$wallet'";
40 $res = $conn->query($sql);
41 $sql = "INSERT INTO transactions(id, wallet, type, amount)VALUES('', '$wallet', 'Offerwall', '$amount')";
42 $runner = $conn->query($sql);
43 }
44
45 if($ref == "none"){
46 die("ok");
47 } else {
48 $sql = "UPDATE wallets SET balance = balance + '$calc' WHERE wallet = '$ref'";
49 $res = $conn->query($sql);
50 $sql = "UPDATE wallets SET refbal = refbal + '$calc' WHERE wallet = '$ref'";
51 $res = $conn->query($sql);
52 $sql = "INSERT INTO transactions(id, wallet, type, amount)VALUES('', '$ref', 'Referral', '$calc')";
53 $runner = $conn->query($sql);
54 }
55
56 die("200");
57} else {
58 die("0");
59}
60?>