Jump to content
MakeWebGames

Recommended Posts

Posted

I found a pretty old post on here with an example for a Super Points postback. The problem I had, is that it was for V2, which calls a file I don't have with 1.1 (config.php).

So, since I know nothing about the way the DB connections work, I kind of just started cut and pasting. I think it's working right now, except for one weird thing. When using the Admin Test, it does credit the points.

The problem is, it credits the points about 8-10 separate times, and I cannot figure it out. Any pointers?

I'm also trying to send an event to the user confirming the offer went through. I've tried dozens of ways, but no luck. Would appreciate any help on this.

srpback.php: (I know it's probably completely wrong, so have mercy, please)

<?php
session_start();
require "mysql.php";
global $c;


$earn = ($_GET['new']);
$userid = ($_GET['uid']);
$totaluser = ($_GET['total']);
$offerid = ($_GET['oid']);
store_lead($_GET['oid'], $_GET['uid'], $_GET['total'], $_GET['new']); 

echo 1;


//store_lead function in classes.php//
function store_lead($offerid, $userid, $totaluser, $earn){
mysql_query("SELECT * FROM `offers` WHERE `oid`='{$offerid}', `uid`='{$userid}', `total`='{$totaluser}', `new`='{$earn}'");

mysql_query("INSERT INTO `offers` (`oid`, `uid`, `total`, `new`) VALUES ('$offerid', '$userid', '$totaluser', '$earn')");


 mysql_query("UPDATE `users` SET crystals = crystals+$earn WHERE userid=$userid"); //give user crystals//

} 



//ASSIGN VARIABLES TO USER INFO
$time = date("M j G:i:s Y"); 
$ip = getenv('REMOTE_ADDR');
$userAgent = getenv('HTTP_USER_AGENT');
$referrer = getenv('HTTP_REFERER');
$query = getenv('QUERY_STRING');

//COMBINE VARS INTO OUR LOG ENTRY
$msg = "IP: " . $ip . " TIME: " . $time . " REFERRER: " . $referrer . " SEARCHSTRING: " . $query . " USERAGENT: " . $userAgent;

//CALL OUR LOG FUNCTION
writeToLogFile($msg);

function writeToLogFile($msg)
{
    $today = date("Y_m_d"); 
    $logfile = $today."_log.txt"; 
    $dir = 'postbacklogs';
    $saveLocation=$dir . '/' . $logfile;
    if (!$handle = @fopen($saveLocation, "a"))
    {
         exit;
    }
    else
    {
         if(@fwrite($handle,"$msg\r\n")===FALSE) 
         {
              exit;
         }

         @fclose($handle);
    }
}

?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...