Hello,
Whats frong with my Paymentwall Script ?
i became this error messeage -> Missing parameters
<?php
include('inc/config.php');
if(!is_resource($sql))
{
exit("Problemi di connessione, si prega di contattare lo staff.");
}
define('SECRET', 'SECRET_CODE');
define('IP_WHITELIST_CHECK_ACTIVE', true);
define('CREDIT_TYPE_CHARGEBACK', 2);
$ipsWhitelist = array('174.36.92.186', '174.36.96.66', '174.36.92.187', '174.36.92.192', '174.37.14.28');
$userId = isset($_GET['uid']) ? $_GET['uid'] : null;
$credits = isset($_GET['currency']) ? $_GET['currency'] : null;
$type = isset($_GET['type']) ? $_GET['type'] : null;
$refId = isset($_GET['ref']) ? $_GET['ref'] : null;
$signature = isset($_GET['sig']) ? $_GET['sig'] : null;
$sign_version = isset($_GET['sign_version']) ? $_GET['sign_version'] : null;
$result = false;
$errors = array ();
if (!empty($userId) && !empty($credits) && isset($type) && !empty($refId) && !empty($signature))
{
$signatureParams = array();
if (empty($sign_version) || $sign_version <= 1)
{
$signatureParams = array('uid' => $userId, 'currency' => $credits, 'type' => $type, 'ref' => $refId);
}
else
{
$signatureParams = array();
foreach ($_GET as $param => $value) {$signatureParams[$param] = $value;}
unset($signatureParams['sig']);
}
$signatureCalculated = calculatePingbackSignature($signatureParams, SECRET, $sign_version);
if (!IP_WHITELIST_CHECK_ACTIVE || in_array($_SERVER['REMOTE_ADDR'], $ipsWhitelist))
{
if ($signature == $signatureCalculated)
{
$result = true;
if ($type == CREDIT_TYPE_CHARGEBACK)
{
if ($credits >= '1')
{
$update_cash = mysql_query("UPDATE ".$db_account_name.".account SET coins = coins - '".$credits."' WHERE id = ('".$userId."')");
}
else
{
$update_cash = mysql_query("UPDATE ".$db_account_name.".account SET coins = coins - '1' WHERE id = ('".$userId."')");
}
}
else
{
if ($credits >= '1')
{
$update_cash = mysql_query("UPDATE ".$db_account_name.".account SET coins = coins + '".$credits."' WHERE id = ('".$userId."')");
}
else
{
$update_cash = mysql_query("UPDATE ".$db_account_name.".account SET coins = coins + '1' WHERE id = ('".$userId."')");
}
}
if (!$update_cash)
{
$result = false;
}
}
else
{
$errors['signature'] = 'Signature is not valid!';
}
}
else
{
$errors['whitelist'] = 'IP not in whitelist!';
}
}
else
{
$errors['params'] = 'Missing parameters!';
}
if ($result)
{
echo 'OK';
}
else
{
echo implode(' ', $errors);
}
function calculatePingbackSignature($params, $secret, $version)
{
$str = '';
if ($version == 2)
{
ksort($params);
}
foreach ($params as $k=>$v) {$str .= "$k=$v";}
$str .= $secret;
return md5($str);
}
?>