game/interrpaykassa.php
2022-06-07 00:30:34 +03:00

120 lines
5.3 KiB
PHP

<?php
// åñëè â íàñòðîéêàõ êàññû èíòåðôåéñ â ïîëÿõ URL âçàèìîäåéñòâèÿ âûñòàâëåí POST åñëè æå èñïîëüçóåòñÿ GET -
// òîãäà â äàëüøå ìåñòî ïåðåìåííîé $_POST èñïîëüçóåì $_GET
$dataSet = $_POST;
//Äëÿ ïðîñìîòðà ðàñøèðåííîãî îòâåòà
//$answer = 'Our answer from Interkassa :'.PHP_EOL;
//foreach ($dataSet as $key => $val) {
// $answer .= $key.' => '.$val.PHP_EOL;
//}
$c = array(
/* MySQL Áàçà äàííûõ */
'db_name' => 'pay_operations', //Òàáëèöà â êîòîðóþ çàíîñÿòñÿ äàííûå
'db_host' => 'localhost',
'db_user' => 'newcom1_abk',
'db_pass' => '4nWYsIM[c?}P',
'db_base' => 'newcom1_abk',
/* Íàñòðîéêè ïëàòåæåé
'ip_list' => array('127,0,0,1,188.166.34.68,136.243.38.147,136.243.38.149,136.243.38.150,136.243.38.151,136.243.38.189,88.198.88.98'), //Óêàçûâàòü ÷åðåç çàïÿòóþ (Ðàçðåøåííûå IP)
'key' => 'qtzl0igb', //gamedealer key
'id' => '65643' //ID ïðîåêòà*/
);
function connect_db($c) {
$db = mysql_connect($c['db_host'],$c['db_user'],$c['db_pass']) or die('Îøèáêà ïîäêëþ÷åíèÿ ê MySQL ñåðâåðó!');
mysql_select_db($c['db_base'],$db) or die('Îøèáêà ïîäêëþ÷åíèÿ ê áàçå äàííûõ!');
mysql_query('SET NAMES cp1251');
}
$needle = $dataSet['ik_sign'];
unset($dataSet['ik_sign']);// óäàëÿåì èç äàííûõ ñòðîêó ïîäïèñè
ksort($dataSet, SORT_STRING); // ñîðòèðóåì ïî êëþ÷àì â àëôàâèòíîì ïîðÿäêå ýëåìåíòû ìàññèâà
$test_key = '8RRwZKMHllBKtux6'; //  äàííîì ñëó÷àå èñïîëüçóåòñÿ òåñòîâûé êëþ÷
array_push($dataSet, $test_key); // äîáàâëÿåì â êîíåö ìàññèâà êëþ÷
$signString = implode(':', $dataSet); // êîíêàòåíèðóåì çíà÷åíèÿ ÷åðåç ñèìâîë ":"
$sign = base64_encode(md5($signString, true)); // áåðåì MD5 õýø â áèíàðíîì âèäå ïî ñôîðìèðîâàííîé ñòðîêå è êîäèðóåì â BASE64
if ($needle == $sign) {
$answer .= 'Sign successfully'.PHP_EOL;
echo 'OK';
connect_db($c);
$nick = mysql_fetch_array(mysql_query('SELECT * FROM `pay_operation` WHERE `id` = "'.$dataSet['ik_pm_no'].'" LIMIT 1'));
$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$nick['uid'].'" LIMIT 1'));
if (isset ($dataSet['ik_pm_no']))
{
if ($nick['good']!=0)
{
echo "Óæå íà÷èñëåííî";
}
else
{
mysql_query('UPDATE `users` SET `money2` = `money2` + '.$nick['ekr'].' WHERE `id` = "'.$nick['uid'].'" LIMIT 1');
mysql_query('UPDATE `pay_operation` SET `good` = "'.time().'" WHERE `id` = "'.$dataSet['ik_pm_no'].'" LIMIT 1');
mysql_query('UPDATE `users` SET `catch` = `catch` + '.$nick['ekr'].' WHERE `id` = "'.$nick['uid'].'" LIMIT 1');
//mysql_query('INSERT INTO `'.$c['db_name'].'` (`time`,`type`,`ip`,`value`,`money`,`project`) VALUES ("'.time().'","'.mysql_real_escape_string($type).'","'.$_SERVER['HTTP_X_REAL_IP'].'","'.mysql_real_escape_string($value).'","'.mysql_real_escape_string($money).'","'.mysql_real_escape_string($this->id).'")');
$r = '<span class=date>'.date('d.m.Y H:i').'</span> Àëõèìèê <img src=https://img.new-combats.com/i/align/align50.gif width=12 height=15 /><u><b>Àäìèíèñòðàòîð</b> / Àâòîìàòè÷åñêàÿ îïëàòà</u> ñîîáùàåò: ';
if($user['sex'] == 1)
{
$r .= 'Óâàæàåìàÿ';
}
else
{
$r .= 'Óâàæàåìûé';
}
$r .= ' <b>'.$user['login'].'</b>, íà Âàø èãðîâîé ñ÷åò çà÷èñëåíî '.$nick['ekr'].' Åâðîêðåäèòîâ. Áëàãîäàðèì Âàñ çà ïîêóïêó!';
//$str1 = iconv("cp1251","UTF-8",$r);
mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$user['city']."','".$user['room']."','','".$user['login']."','".$r."','-1','5','0')");
//echo $r."r<br>";
if ($nick['ref'] !=0)
{
$refecr=round(($nick['ekr']/10));
mysql_query('UPDATE `users` SET `money2` = `money2` + '.$refecr.' WHERE `id` = "'.$nick['ref'].'" LIMIT 1');
$referal = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$nick['ref'].'" LIMIT 1'));
$r = '<span class=date>'.date('d.m.Y H:i').'</span> Àëõèìèê <img src=https://img.new-combats.com/i/align/align50.gif width=12 height=15 /><u><b>Àäìèíèñòðàòîð</b> / Ðåôåðàëüíûé çàðàáîòîê</u> ñîîáùàåò: ';
if($referal['sex'] == 1)
{
$r .= 'Óâàæàåìàÿ';
}
else
{
$r .= 'Óâàæàåìûé';
}
$r .= ' <b>'.$referal['login'].'</b>, íà Âàø èãðîâîé ñ÷åò çà÷èñëåíî '.$refecr.' Åâðîêðåäèòîâ. Áëàãîäîðÿ âàøåìó ðåôåðàëó!'.$user['login'].'';
//$str1 = iconv("cp1251","UTF-8",$r);
mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$referal['city']."','".$referal['room']."','','".$referal['login']."','".$r."','-1','5','0')");
}
echo "Ïîêóïàòåë: ".$user['login']." | ID: ".$nick['uid']." | Ñóììà: ".$nick['ekr']." | ID îïåðàöèè: ".$dataSet['ik_pm_no']."<br>";
if (isset ($referal['id']))
{
echo "Ðåôåðàë(òîò êòî ïðèâåë): ".$referal['login']." | ID: ".$referal['id']." | Ñóììà: ".$refecr."<br>";
}
else
{
echo "Ïîëüçîâàòåëü ðåôåðàë íå íàéäåí!!";
}
}
}
else
{
echo "Ïîêóïàòåëü íå óêàçàí!";
}
} else {
$answer .= 'Sign do not match'.PHP_EOL;
echo 'Something bad';
}
$answer .= 'IK sing :'.$needle.PHP_EOL;
$answer .= 'locally formed :'.$sign.PHP_EOL;
file_put_contents('answer.txt', $answer);
//35.233.69.55, 34.77.232.58, 35.240.117.224
?>