Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
- {
- $ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
- }
- else
- {
- $ip_address = $_SERVER['REMOTE_ADDR'];
- }
- // PCT postbacks always come from one of these IP addresses
- if (!($ip_address == "173.192.21.242" || $ip_address == "173.192.21.250" || $ip_address == "50.19.101.91" || $ip_address == "50.19.125.94"))
- {
- exit;
- }
- $mysql_host = "localhost"; //hostname - usually localhost
- $mysql_username = "*********"; //database username
- $mysql_password = "*********"; //database password
- $mysql_database = "*********"; //database name
- // Make a MySQL connection
- $conn = mysql_connect($mysql_host, $mysql_username, $mysql_password); //Make a mysql connection
- if (!$conn)
- {
- die(mysql_error());
- }
- mysql_select_db($mysql_database, $conn); //Select the correct database
- $subid = $_GET["sid1"]; //sid1 is the subid that is passed to you by PointClickTrack
- $sid2 = $_GET["sid2"]; //sid1 is the subid that is passed to you by PointClickTrack
- $sid3 = $_GET["sid3"]; //sid1 is the subid that is passed to you by PointClickTrack
- $campaign_id = $_GET["campaign_id"]; //Campaign_id is the campaign ID passed to you by PointClickTrack
- $campaign_name = $_GET["campaign_name"]; //Campaign_id is the campaign ID passed to you by PointClickTrack
- $pdtshow = $_GET["commission"];
- $status = $_GET["status"];
- // Convert $commission dollars to points
- $points = $commission * 100;
- // Calculate what the user earns
- $earn = round($points / 2);
- $userid = mysql_real_escape_string($subid);
- $refer_points = 10;
- if ($status == "credited")
- {
- $query = sprintf("UPDATE members SET points = points + $pdtshow,
- completed_surveys = completed_surveys + 1 WHERE username = '$subid'", $earn, $userid);
- mysql_query($query, $conn);
- $query = sprintf("SELECT referral_ID FROM members WHERE username = '$subid'", $userid);
- $res = mysql_query($query, $conn);
- list($refid) = mysql_fetch_row($res);
- mysql_free_result($res);
- if ($refid)
- {
- $query = sprintf("UPDATE members SET points = points + $pdtshow
- WHERE username = '$subid'", $refer_points, $refid);
- mysql_query($query, $conn);
- }
- }
- elseif ($status == "reversed")
- {
- $query = sprintf("UPDATE members SET points = points - $pdtshow,
- completed_surveys = completed_surveys - 1 WHERE username = '$subid'", $earn, $userid);
- mysql_query($query, $conn);
- $query = sprintf("SELECT referral_ID FROM members WHERE username = '$subid'", $userid);
- $res = mysql_query($query, $conn);
- list($refid) = mysql_fetch_row($res);
- mysql_free_result($res);
- if ($refid)
- {
- $query = sprintf("UPDATE members SET points = points - $pdtshow
- WHERE username = '$subid'", $refer_points, $refid);
- mysql_query($query, $conn);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement