<?php
mysql_select_db('databasename', mysql_connect('localhost', 'database_user', 'database_password')); //change this
$file = 'paygol.log';
$accountid = $_GET['custom'];
$transactionDate= $_SESSION['time'];
$currency = $_GET['currency'];
$sender = $_GET['sender'];
$price = $_GET['price'];
// check that the request comes from PayGol server
if(!in_array($_SERVER['REMOTE_ADDR'],
array('109.70.3.48', '109.70.3.146', '109.70.3.58'))) {
header("HTTP/1.0 403 Forbidden");
die("Error: Unknown IP");
}
else
{
if ($currency == "EUR"){
if ($price == 3) $amount = 6; //change this
if ($price == 7) $amount = 15; //change this
if ($price == 14) $amount = 32; //change this
if ($price == 28) $amount = 65; //change this
$log = "Received ".$price." ".$currency." from ".$sender." For ".$amount." points to account ".$accountid."";
$add = mysql_query("UPDATE `accounts` SET `premium_points` = `premium_points` + '".$amount."' WHERE `id` = '".$accountid."' ");
}
$open = fopen($file, "a");
fwrite($open, $log);
fwrite($open, "\r\n");
fclose($open);
}
?>