Advertisement
Guest User

Untitled

a guest
Nov 11th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.89 KB | None | 0 0
  1. <?php
  2.  
  3. if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
  4.     {
  5.     $ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
  6.     }
  7.   else
  8.     {
  9.     $ip_address = $_SERVER['REMOTE_ADDR'];
  10.     }
  11.  
  12. // PCT postbacks always come from one of these IP addresses
  13.  
  14. 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"))
  15.     {
  16.     exit;
  17.     }
  18.  
  19. $mysql_host = "localhost"; //hostname - usually localhost
  20. $mysql_username = "*********"; //database username
  21. $mysql_password = "*********"; //database password
  22. $mysql_database = "*********"; //database name
  23.  
  24. // Make a MySQL connection
  25.  
  26. $conn = mysql_connect($mysql_host, $mysql_username, $mysql_password); //Make a mysql connection
  27.  
  28. if (!$conn)
  29.     {
  30.     die(mysql_error());
  31.     }
  32.  
  33. mysql_select_db($mysql_database, $conn); //Select the correct database
  34. $subid = $_GET["sid1"]; //sid1 is the subid that is passed to you by PointClickTrack
  35. $sid2 = $_GET["sid2"]; //sid1 is the subid that is passed to you by PointClickTrack
  36. $sid3 = $_GET["sid3"]; //sid1 is the subid that is passed to you by PointClickTrack
  37. $campaign_id = $_GET["campaign_id"]; //Campaign_id is the campaign ID passed to you by PointClickTrack
  38. $campaign_name = $_GET["campaign_name"]; //Campaign_id is the campaign ID passed to you by PointClickTrack
  39. $pdtshow = $_GET["commission"];
  40. $status = $_GET["status"];
  41.  
  42. // Convert $commission dollars to points
  43.  
  44. $points = $commission * 100;
  45.  
  46. // Calculate what the user earns
  47.  
  48. $earn = round($points / 2);
  49. $userid = mysql_real_escape_string($subid);
  50. $refer_points = 10;
  51.  
  52. if ($status == "credited")
  53.     {
  54.     $query = sprintf("UPDATE members SET points = points + $pdtshow,
  55.        completed_surveys = completed_surveys + 1 WHERE username = '$subid'", $earn, $userid);
  56.     mysql_query($query, $conn);
  57.     $query = sprintf("SELECT referral_ID FROM members WHERE username = '$subid'", $userid);
  58.     $res = mysql_query($query, $conn);
  59.     list($refid) = mysql_fetch_row($res);
  60.     mysql_free_result($res);
  61.     if ($refid)
  62.         {
  63.         $query = sprintf("UPDATE members SET points = points + $pdtshow
  64.            WHERE username = '$subid'", $refer_points, $refid);
  65.         mysql_query($query, $conn);
  66.         }
  67.     }
  68. elseif ($status == "reversed")
  69.     {
  70.     $query = sprintf("UPDATE members SET points = points - $pdtshow,
  71.        completed_surveys = completed_surveys - 1 WHERE username = '$subid'", $earn, $userid);
  72.     mysql_query($query, $conn);
  73.     $query = sprintf("SELECT referral_ID FROM members WHERE username = '$subid'", $userid);
  74.     $res = mysql_query($query, $conn);
  75.     list($refid) = mysql_fetch_row($res);
  76.     mysql_free_result($res);
  77.     if ($refid)
  78.         {
  79.         $query = sprintf("UPDATE members SET points = points - $pdtshow
  80.            WHERE username = '$subid'", $refer_points, $refid);
  81.         mysql_query($query, $conn);
  82.         }
  83.     }
  84.  
  85. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement