<?php
/*
Yousite Walls Postback Script
Section: Walls
Developed by Yousite.com
Note: This is an example postback script, it can be edited according to user site requirements.
Example Postback URL:
http://yourdomain.com/script.php?sid=%SID%&sid2=%SID2%&status=%STATUS%&vc=%VC% (This script is coded according to this example url format, we will use sid variable as its set in url)
Dont forget to include your functions / db configuration and other necessary files required by your site like database configuration to perform sql queries.
*/
$allowed_IP = '72.9.148.195'; //Valid Yousite Postback Server IP Address
$ip = $_SERVER['REMOTE_ADDR']; //your postback hosting server ip
$sid = $_GET['sid']; // SubId
$sid2 = $_GET['sid2']; //Subid 2
$status = $_GET['status']; //1 - success, 2 - revoked
$vc = $_GET['vc']; //Virtual Currency Value
//These variables are not set in url, these are optional, if you didn't set these vars in postback url, you can remove these variables
$sid3 = $_GET['sid3']; //Subid 3
$sid4 = $_GET['sid4']; //Subid 4
$sid5 = $_GET['sid5']; //Subid 5
//-------------------------------------//
// validate postback source, if its not from Yousite, then stop script
if($ip != $allowed_IP)
die("Unauthorized Access!!!");
//Postback Authorized, Now you can code below according to your site needs ..
if($status == 1){ //Lead Confirmed
//Example of crediting user
$sql = "UPDATE users SET balance = balance+$vc WHERE uid = '$sid' AND code = '$sid2'";
if(mysql_query($sql))
{
echo "User Credited.";
}else
{
echo "Error...";
}
}elseif($status == 2) //Lead Reversed
{
//Example Of Credits Deduction
$sql = "UPDATE users SET balance = balance-$vc WHERE uid = '$sid' AND code = '$sid2'";
if(mysql_query($sql))
{
echo "User Credits Deducted.";
}else
{
echo "Error...";
}
}
?>