142 lines
3.9 KiB
PHP
142 lines
3.9 KiB
PHP
|
<?php
|
|||
|
/*
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
*/
|
|||
|
|
|||
|
function getIP() {
|
|||
|
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
|
|||
|
return $_SERVER['REMOTE_ADDR'];
|
|||
|
}
|
|||
|
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP
|
|||
|
function getIPblock() {
|
|||
|
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
|
|||
|
return $_SERVER['REMOTE_ADDR'];
|
|||
|
}
|
|||
|
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
|
|||
|
if(!isset($_GET['robot'])) {
|
|||
|
//if( $_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1' ) { die('Hello pussy!'); }
|
|||
|
if(getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock() != '91.228.152.24') {
|
|||
|
die(getIPblock().'<br>'.$_SERVER['SERVER_ADDR']);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//$curency = 5.21; //<2F><><EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD>. <20> 1 <20><><EFBFBD>. <20><>.
|
|||
|
$true = array(
|
|||
|
'AUD' => true,
|
|||
|
'AZN' => true,
|
|||
|
'AMD' => true,
|
|||
|
'BYR' => true,
|
|||
|
'BGN' => true,
|
|||
|
'BRL' => true,
|
|||
|
'HUF' => true,
|
|||
|
'KRW' => true,
|
|||
|
'DKK' => true,
|
|||
|
'USD' => true,
|
|||
|
'EUR' => true,
|
|||
|
'INR' => true,
|
|||
|
'KZT' => true,
|
|||
|
'CAD' => true,
|
|||
|
'KGS' => true,
|
|||
|
'CNY' => true,
|
|||
|
'LVL' => true,
|
|||
|
'LTL' => true,
|
|||
|
'MDL' => true,
|
|||
|
'RON' => true,
|
|||
|
'TMT' => true,
|
|||
|
'NOK' => true,
|
|||
|
'PLN' => true,
|
|||
|
'XDR' => true,
|
|||
|
'SGD' => true,
|
|||
|
'TJS' => true,
|
|||
|
'TRY' => true,
|
|||
|
'UZS' => true,
|
|||
|
'UAH' => true,
|
|||
|
'GBP' => true,
|
|||
|
'CZK' => true,
|
|||
|
'SEK' => true,
|
|||
|
'CHF' => true,
|
|||
|
'ZAR' => true,
|
|||
|
'JPY' => true
|
|||
|
);
|
|||
|
|
|||
|
define('GAME',true);
|
|||
|
|
|||
|
setlocale(LC_CTYPE ,"ru_RU.CP1251");
|
|||
|
|
|||
|
include('_incl_data/__config.php');
|
|||
|
include('_incl_data/class/__db_connect.php');
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
mysql_query('UPDATE `stats` SET `transfers` = 100 WHERE `transfers` < 200');
|
|||
|
|
|||
|
function str_count($str,$col) {
|
|||
|
if (strlen($str) > $col)
|
|||
|
{
|
|||
|
$str = substr($str,0,$col);
|
|||
|
}
|
|||
|
return ($str);
|
|||
|
}
|
|||
|
|
|||
|
function getCurs(){
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> XML
|
|||
|
$xml = new DOMDocument();
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$url = 'https://www.cbr.ru/scripts/XML_daily.asp?date_req=' . date('d.m.Y');
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> xml <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if ($xml->load($url)){
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$result = array();
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> xml
|
|||
|
$root = $xml->documentElement;
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> 'Valute' <20> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$items = $root->getElementsByTagName('Valute');
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> 'Valute' <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
foreach ($items as $item){
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$code = $item->getElementsByTagName('CharCode')->item(0)->nodeValue;
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$value = $item->getElementsByTagName('Value')->item(0)->nodeValue;
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$nominal = $item->getElementsByTagName('Nominal')->item(0)->nodeValue;
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$result[$code] = round(str_replace(',', '.', $value),5)/$nominal;
|
|||
|
}
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
return $result;
|
|||
|
}else{
|
|||
|
// <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> xml <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> false
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
$get = getCurs();
|
|||
|
//
|
|||
|
if( $c['curency_name'] == 'RUB' ) {
|
|||
|
$curency = $c['curency_value'];
|
|||
|
}else{
|
|||
|
$curency = round($get[$c['curency_name']]*$c['curency_value'],4);
|
|||
|
}
|
|||
|
//
|
|||
|
if( $get['USD'] > 0 ) {
|
|||
|
$price = array(
|
|||
|
'AUD','AZN','AMD','BYR','BGN','BRL','HUF','KRW','DKK','USD','EUR','INR','KZT','CAD','KGS','CNY','LVL','LTL','MDL','RON','TMT','NOK','PLN','XDR','SGD','TJS','TRY','UZS','UAH','GBP','CZK','SEK','CHF','ZAR','JPY'
|
|||
|
);
|
|||
|
$i = 0;
|
|||
|
while( $i < count($price) ) {
|
|||
|
if( isset($price[$i]) && $get[$price[$i]] > 0 ) {
|
|||
|
if( $price[$i] == 'UAH' || $price[$i] == 'BYR' ) {
|
|||
|
//$get[$price[$i]] -= round($get[$price[$i]]/6,4);
|
|||
|
}
|
|||
|
$r .= ',`'.$price[$i].'`="'.$get[$price[$i]].'"';
|
|||
|
}
|
|||
|
$i++;
|
|||
|
}
|
|||
|
//echo 'INSERT INTO `bank_table` SET `time` = "'.time().'",`cur` = "'.$curency.'",`data` = "'.date('d.m.Y').'"'.$r.'<br>';
|
|||
|
mysql_query('INSERT INTO `bank_table` SET `time` = "'.time().'",`cur` = "'.$curency.'",`data` = "'.date('d.m.Y').'"'.$r.'');
|
|||
|
}
|
|||
|
?>
|