Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
header('Content-type: text/xml');
switch ($_GET['command']){
case 'check':
check();
break;
case 'pay':
pay();
break;
case 'cancel':
cancel();
break;
}
function check(){
if($_GET['md5'] == md5("check".$_GET["v1"]."#yYGUoEdDgH7fNA)8e*]Apych3{PUqWc")){
$check = mysql_fetch_array(mysql_query("SELECT `id` FROM `user` WHERE `login`='".addslashes($_GET["v1"])."'"));
if(isset($check['id'])){
$response='<result>0</result>';
}else{
$response='<result>7</result><comment>Not found.</comment>';
}
echo'<?xml version="1.0" encoding="windows-1251"?><response>'.$response.'</response>';
}
}
function pay(){
if($_GET['md5'] == md5("pay".$_GET["v1"].$_GET['id']."#yYGUoEdDgH7fNA)8e*]Apych3{PUqWc")){
$pay = mysql_fetch_array(mysql_query("SELECT `id` FROM `user` WHERE `login`='".addslashes($_GET["v1"])."'"));
$payb = mysql_fetch_array(mysql_query("SELECT * FROM `payments` WHERE `code`='".htmlspecialchars($_GET['id'])."'"));
if(isset($pay['id'])){
if(empty($payb['id'])){
mysql_query("UPDATE `user` SET `dd`=dd+'".intval($_GET['sum'])."' WHERE `id`='".$pay['id']."'");
mysql_query("INSERT INTO `payments` (`uid`, `time_unix`, `time_norm`, `tpay`, `count`, `code`) VALUES ('".$pay['id']."', '".time()."', '".date("Y-m-d")."', '2pay','".floatval($_GET['sum'])."','".htmlspecialchars($_GET['id'])."');");
$LastID = mysql_insert_id();
$response='<id>'.$_GET['id'].'</id><id_shop>'.$LastID.'</id_shop><sum>'.$_GET['sum'].'</sum><result>0</result>';
//начисление бабла тому кто пригласил
$referal=mysql_fetch_assoc(mysql_query("SELECT * FROM `ref_system` WHERE `ref_id`='".$pay['id']."' LIMIT 1;"));
if($referal['who_id']){
$usrb = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id`='".$referal['who_id']."' LIMIT 1;"));
if($usrb['id']){
$refparams = mysql_fetch_assoc(mysql_query("SELECT * FROM `ref_adm` WHERE `id`='1' LIMIT 1;"));
if($refparams['money_dlr_bonus']>0){
$givebonus = round(intval($_GET['sum'])*($refparams['money_dlr_bonus']/100),2);
if(mysql_query("UPDATE `user` SET `dd`=`dd`+'".$givebonus."' WHERE `id`='".$usrb['id']."' LIMIT 1;")){
$ms="top.frames['chmain'].add_msg('<font class=chattime> ".date("H:i:s")." </font> <font color=000000><font color=#000000><b>Системная информация.</b></font> Вы получили бонус за пополнение счета рефералом: <b>".$givebonus."</b> DLR.</font><BR>'+'');";
mysql_query("INSERT INTO `chat` (`time`,`login`,`dlya`,`msg`) VALUES ('".time()."','sys','<".$usrb['login'].">','".addslashes($ms)."');");
}
mysql_query("UPDATE `ref_system` SET `bonus_dlr`=`bonus_dlr`+'".$givebonus."' WHERE `ref_id`='".$pay['id']."' AND `who_id`='".$usrb['id']."' LIMIT 1;");
}
}
}
//end
}else{
$response='<id>'.$payb['code'].'</id><id_shop>'.$payb['id'].'</id_shop><sum>'.$payb['count'].'</sum><result>0</result>';
}
}else{
$response='<id>'.$_GET['id'].'</id><sum>'.$_GET['sum'].'</sum><result>1</result><comment>Error in payment.<br>Please try later</comment>';
}echo'<?xml version="1.0" encoding="windows-1251"?><response>'.$response.'</response>';
}
}
function cancel(){
if($_GET['md5'] == md5("cancel".$_GET['id']."#yYGUoEdDgH7fNA)8e*]Apych3{PUqWc")){
$CheckCancel = mysql_fetch_array(mysql_query("SELECT * FROM `payments` WHERE `code`='".htmlspecialchars($_GET['id'])."'"));
if(!empty($CheckCancel['id'])){
if($CheckCancel['PayOk'] == 'yes'){
if(mysql_query("UPDATE `payments` SET `PayOk` = 'no' WHERE `code`='".htmlspecialchars($_GET['id'])."'")){
// mysql_query("UPDATE `user` SET `dnv`=dnv-'".floatval($CheckCancel['count'])."' WHERE `id`='".$CheckCancel['uid']."'");
$response = '<result>0</result>';
}else{
$response = '<result>7</result><comment>Payment specified in the request can not be canceled</comment>';
}
}elseif($CheckCancel['PayOk'] == 'no'){
$response = '<result>7</result><comment>Payment specified in the request can not be canceled</comment>';
}
}else{
$response = '<result>2</result><comment>Payment with given ID does not exists</comment>';
}
echo'<?xml version="1.0" encoding="windows-1251"?><response>'.$response.'</response>';
}
}
У кого есть пример реализации функции платежа и настройка Xsolla, необходимо подключение проекта.