45 lines
1.1 KiB
PHP
Executable File
45 lines
1.1 KiB
PHP
Executable File
<?php
|
|
//Потрошитель дизнета
|
|
|
|
|
|
function ekr($text)
|
|
{ // ФУНКЦИЯ очистки кода
|
|
|
|
$old1 = array("</script><script>setViewedProduct(", ');</script>', "'");#Ищем вредное ">",, "<"
|
|
|
|
$new1 = array("", "", '"');#Меняем на полезное">", , "<"
|
|
|
|
$text = str_replace($old1, $new1, $text);#Собсно сама замена =)
|
|
|
|
return $text;
|
|
}
|
|
|
|
|
|
function parcestringdeznet($str)
|
|
{
|
|
$str = ekr($str);
|
|
|
|
//$len=mb_strlen($str); // 59
|
|
$json = trim(mb_substr($str, 7, strlen($str)));
|
|
//echo $json;
|
|
$array = \core::j($json);
|
|
//print_r($array);
|
|
|
|
$code = $array['PRODUCT_ID'];
|
|
$cena = $array['MIN_PRICE']['PRICE'];
|
|
$cena = round($cena * 1.5, 2);
|
|
|
|
if ($cena && $code)
|
|
\DBmysql::set("UPDATE `tovar` SET `cena`=?, `code`=? WHERE `id`=?", [$cena, $code, $_GET['id']]);
|
|
|
|
}
|
|
|
|
$html = \core::get_page($res['massiv']['donor']);
|
|
if ($html['code'] == 200) {
|
|
$lines = explode("\n", $html['html']);
|
|
$c = count($lines);
|
|
for ($i = 0; $i < $c; $i++)
|
|
if (strpos($lines[$i], 'setViewedProduct'))
|
|
parcestringdeznet($lines[$i]);
|
|
}
|
|
?>
|