Файл: vkolhoze.com/xsolla/lib.php
Строк: 49
<?php
function checkIP ($ip)
{
if ($ip == "94.103.26.178" || $ip = "94.103.26.181")
{
return 1;
}
return 0;
}
function check_nickname($nick)
{
if ($nick == '')
{
return 0;
}
$myrow = mysql_query ("SELECT * FROM kolhoz_user WHERE id = '".$nick."'");
$num_rows = mysql_num_rows($myrow);
if ($num_rows > 0 )
{
return 1;
}
return 0;
}
function pay($v1, $sum, $id)
{
$date = date("Y-m-d H:i:s");
mysql_query("UPDATE kolhoz_user SET euro = euro + ".+$sum." WHERE id = '".$v1."'");
mysql_query ("INSERT INTO xsolla_billing (invoice,v1,currency,date,canceled) VALUES ('".$id."','".$v1."','".$sum."','".$date."','0')");
mysql_query ("INSERT INTO xsolla_shop (id,v1,sum) VALUES ('".$id."','".$v1."','".$sum."')");
$result3 = mysql_query("SELECT id_shop FROM xsolla_shop WHERE id='".$id."'");
$paymentId = mysql_fetch_array ($result3);
return $paymentId['id_shop'];
}
function cancel ($id)
{
$date = date("Y-m-d H:i:s");
$result = mysql_query("SELECT currency, v1, canceled FROM xsolla_billing WHERE invoice='$id'");
$amount = mysql_fetch_array ($result);
$num_rows = mysql_num_rows($result);
if ($num_rows > 0 && $amount['canceled'] == '0')
{
mysql_query("UPDATE kolhoz_user SET euro = euro - ".$amount['currency']." WHERE id = '".$amount['v1']."'");
mysql_query("UPDATE xsolla_billing SET canceled='1', date_cancel='".$date."' WHERE invoice ='".$id."'");
return 1;
}
return 0;
}
?>