Файл: wenr.online/app/game/pay.php
Строк: 44
<?php
if (!$user->isAuth()) {
redirect('/');
exit;
}
function gold_name($gold){
$array = [200=>'Горсть золота',
400=>'Кучка золота',
1000=>'Чан золота',
2000=>'Сундук золота',
6000=>'Мешок золота',
25000=>'Сокровище'
];
return $array[$gold];
}
if(isset($_GET['potion'])){
$potion = Clean :: int($_GET['potion']);
$array = [1];
if(!in_array($potion,$array)){
redirect('/pay');
exit;
}
$amount = 120;
$sql = $db->prepare('insert into balance (user,amount,time,type) values (?,?,?,?)');
$sql -> execute([$user->get()->user_id,$potion,time(),'potion']);
$id = $db->lastInsertId();
$payID = trim(file_get_contents('https://pay.uspay.ru/merchant/api2?id_shop=61&summa='.$amount.'&hash=PXvZt5VhQRjWgIB&desc='.$id));
if(is_numeric($payID)){
header('Location: https://pay.uspay.ru/merchant/'.$payID);
exit;
}else{
Notif :: message($payID,'/pay');
exit;
}
}
$arrayPrice = [200=>15,400=>30,1000=>80,2000=>160,6000=>480,25000=>2000];
if(isset($_GET['kol'])){
$kol = Clean :: int($_GET['kol']);
$array = [200,400,1000,2000,6000,250000];
if(!in_array($kol,$array)){
redirect('/pay');
exit;
}
$amount = $arrayPrice[$kol];
$sql = $db->prepare('insert into balance (user,amount,time) values (?,?,?)');
$sql -> execute([$user->get()->user_id,$kol,time()]);
$id = $db->lastInsertId();
$payID = trim(file_get_contents('https://pay.uspay.ru/merchant/api2?id_shop=61&summa='.$amount.'&hash=PXvZt5VhQRjWgIB&desc='.$id));
if(is_numeric($payID)){
header('Location: https://pay.uspay.ru/merchant/'.$payID);
exit;
}else{
Notif :: message($payID,'/pay');
exit;
}
}
echo $template->render('game.pay', ['arrayPrice'=>$arrayPrice, 'k'=>0]);