View file sdark.mobi/pay/class.config.php

File size: 6.21Kb
<?php

require_once("class.response.php");
require_once("class.billing.php");
require_once("class.project.php");
require_once("class.protocol.php");
require_once("class.standart.php");

$db_host = "localhost";
$db_user = "darks";
$db_table = "darkw";
$db_pass = "eXG9ce4V7KCTELs";
$connect = @ mysql_pconnect($db_host, $db_user,  $db_pass);
@ mysql_select_db($db_table);
@ mysql_query("SET NAMES 'utf8'", $connect);




class XsollaConfig
{


    public static $mysqlHost = "localhost";
    public static $mysqlUser = "darks";
    public static $mysqlPass = "eXG9ce4V7KCTELs";
    public static $mysqlDb = "darkw";
 
	 public static $allowedIPs = array(
	 "195.191.24.180",
	 "94.103.26.176",
"94.103.26.177",
"94.103.26.178",
"94.103.26.179",
"185.30.21.73",
"159.255.220.240/28",
"159.255.220.241",
"159.255.220.254",
"185.30.20.16/29",
"185.30.20.17",
"185.30.20.22",
"185.30.21.16/29",
"185.30.21.17",
"185.30.21.22",
"185.30.21.0/24",
"185.30.21.1",
"185.30.21.254",
"94.103.26.180",
"94.103.26.181",
"94.103.26.182",
"94.103.26.178",
"159.255.220.240",
"159.255.220.241",
"159.255.220.242",
"159.255.220.243",
"159.255.220.244",
"159.255.220.245",
"159.255.220.246",
"159.255.220.247",
"159.255.220.248",
"159.255.220.249",
"159.255.220.250",
"159.255.220.251",
"159.255.220.252",
"159.255.220.253",
"159.255.220.254",

"185.30.20.16",
"185.30.20.17",
"185.30.20.18",
"185.30.20.19",
"185.30.20.20",
"185.30.20.21",
"185.30.20.22",

"185.30.21.16",
"185.30.21.17",
"185.30.21.18",
"185.30.21.19",
"185.30.21.20",
"185.30.21.21",
"185.30.21.22");
    public static $secretKey = "#:>6m4HM}PE/UL:Fs>nd>|g&9+*u<>6@";
}


class XsollaStandartSampleProject extends XsollaStandartProject
{
    public function check()
    {

$id = iconv('windows-1251','utf-8',$_GET[v1]); 
$req = mysql_query("SELECT * FROM `user` WHERE `id`='$id'");
$avto=mysql_num_rows($req);
if($avto>=1){
return array("code" => XsollaStandartProtocolResponse::$codeSuccess, "description" => "Success"); }
else{
return array("code" => XsollaStandartProtocolResponse::$codeIncorrectUser, "description" => "User is not found"); }
      
    }

    public function sell()
    {

$id = iconv('windows-1251','utf-8',$_GET['v1']); 
$su=intval($_GET['sum']);
if($su<200){$kol=$su;}
if($su>=200 and $su<1000){$kol=$su+35;}
if($su>=1000 and $su<4000){$kol=$su+250;}
if($su>=4000 and $su<10000){$kol=$su+1200;}
if($su>=10000){$kol=$su+3500;}
$sumx=$kol*100;
$apgx = round($sumx*0.07);
$aprel = floor($su*0.20);
$apr = floor($sumx*0.20);

$klolo = mysql_result(mysql_query("SELECT COUNT(id) FROM `xsolla_billing` WHERE `v1`='".$uks."'"),0);
if($klolo == 0){$kol = $kol*2;}
/* if($kol>=200){
$pumpkin=floor($kol/200);
mysql_query("UPDATE `user` set `pumpkin`=`pumpkin`+'$pumpkin' where `id` = '".$id."'");
} */
if($su > 999) {
mysql_query("INSERT INTO `chests_user` set `user_id`='".$id."', `chest_id`='3', `time`='".time()."'");
mysql_query("UPDATE `user` set `topaz`=`topaz`+10,`rubyn`=`rubyn`+10,`almaz`=`almaz`+10,`sapfyr`=`sapfyr`+10,`izumrud`=`izumrud`+10 where `id` = '$id'");
}
/* if($su >= 3999) {
mysql_query("INSERT INTO `chests_user` set `user_id`='".$id."', `chest_id`='4', `time`='".time()."'");
} */
mysql_query("UPDATE `user` set `gold`=`gold`+'".$sumx."'+'".$apr."' where `id` = '".$id."'");
//mysql_query("UPDATE `user` set `gold`=`gold`+'$sumx' where `id` = '$id'");
//, `snow`=`snow`+'".floor($kol/100)."'
$sum=intval($_GET['sum']);
$av = mysql_num_rows(mysql_query("SELECT * FROM `task` WHERE `usr`='".$id."' and `status`='2' and `task`='12'"));
if($av>0){mysql_query("UPDATE `task` SET `min` = `min`+'".$sum."'  WHERE `usr`='".$id."' and `status`='2' and `task`='12'");}

$apg = round($sum*0.07);
$time = time();
$timer = time()+2592000;
$texst = "Поздравляем, ваш друг купил золото! Вы получаете <img src=/images/icon/gold.png>$apg ";

//$text = "Поздравляем, Вы успешно приобрели <img src=/images/icon/gold.png>$sum золота!";
$text = "Поздравляем, Вы успешно приобрели <img src=/images/icon/gold.png> ".$sum." золота! </br> По акции Вам начислено дополнительно ".$aprel." золота!";

$reqj = mysql_query("SELECT * FROM `user` WHERE `id` = '$id' LIMIT 1");
$user = mysql_fetch_array($reqj);

$requ = mysql_query("SELECT * FROM `user` WHERE `id` = '$user[inv]' LIMIT 1");
$ank = mysql_fetch_array($requ);

$t=time();
mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Куплено золото', `time` = '".$t."', `kol`='$sumx', `kto`='+'");
//.....mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Куплено золото', `time` = '".$t."', `kol`='$apr', `kto`='+'");

mysql_query("UPDATE `user` set `gold`=`gold`+'$apgx' where `id` = '$ank[id]'");
if($ank[id]>0){mysql_query("INSERT INTO `mail` SET `id_user` = '2', `id_kont` = '$ank[id]', `time` = '$time', `timer` = '$timer', `read` = '1', `msg` = '$texst'");
}mysql_query("INSERT INTO `mail` SET `id_user` = '2', `id_kont` = '$user[id]', `time` = '$time', `timer` = '$timer',`read` = '1', `msg` = '$text'");
$req = mysql_query("SELECT * FROM `users_konts` WHERE `id_user`='$user[id]' and `id_kont` = '2'");
$avto=mysql_num_rows($req);
if($avto==0){
mysql_query("INSERT INTO `users_konts` SET `id_user` = '$user[id]', `id_kont` = '2', `time` = '$time', `timer` = '$timer', `new_msg` = '1'");
}else{mysql_query("UPDATE `users_konts` SET  `time` = '$time', `timer` = '$timer', `new_msg` = '1'  WHERE`id_user` = '$user[id]' and `id_kont` = '2'");
}
$req = mysql_query("SELECT * FROM `users_konts` WHERE `id_user`='$ank[id]' and `id_kont` = '2'");
$avto=mysql_num_rows($req);
if($avto==0){
mysql_query("INSERT INTO `users_konts` SET `id_user` = '$ank[id]', `id_kont` = '2', `time` = '$time', `new_msg` = '1'");
}else{mysql_query("UPDATE  `users_konts`  SET  `time` = '$time', `new_msg` = '1' WHERE `id_user` = '$ank[id]' and `id_kont` = '2'");
}

        return array("code" => XsollaStandartProtocolResponse::$codeSuccess, "description" => "Success");
  
   }
   
   
   

    public function cancel()
    {
        // put your code here
        return array("code" => XsollaStandartProtocolResponse::$codeCancelSuccess, "description" => "Success");
   
	}

}

class XsollaStandartSampleBilling extends XsollaBilling
{

}