Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include ('../steamauth/userInfo.php');
- //Your postback url should look like this http://yourdomain.com/path/postbackfilename.php?userid={s1}&points={points}&token=89jadsfknlk12klaslk
- $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
- $userid = $_GET['userid'];
- $points = $_GET['points'];
- $token = $_GET['token'];
- $servername = 'localhost';
- $username = 'earnskin_ADMIN';
- $password = 'wordpass11!';
- $dbname = 'earnskin_MAIN';
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- if($token !== $secret_token) //see if token matches
- {
- echo 'Invalid token';
- exit;
- }
- if(!$userid || !$points)
- {
- echo 'Missing parameters';
- exit;
- }
- //Add code here to insert $userid and $points into database
- $sql = "SELECT balance FROM users WHERE steamid = '".$steamprofile['steamid']."'";
- $result = $conn->query($sql);
- $row = $result->fetch_assoc();
- $userBalance = $row['balance'];
- $userBalance + $points = $newBalance;
- $sql = "UPDATE users SET balance='".$newBalance."', WHERE steamid='".$steamprofile['steamid']."'";
- $result = $conn->query($sql);
- $sql2 = "INSERT INTO transactions (userid, amount, user) VALUES ('".$userid."', '".$points."', '".$steamprofile['steamid']."')";
- $result = $conn->query($sql2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement