Использовать javascript: window.top.location.href
Например вместо:
header("Location: ".$result_data->response->body->url_login);
указать:
header("Location: /?goto=".$result_data->response->body->url_login);
и на самой странице:
<?php
if(isset($_GET['goto'])){?>
<script>
window.top.location.href="<?=$_GET['goto']?>";
window.location.href="<?=$_GET['goto']?>";
</script>
<?}?>
1. Установка epel (если не установлен) и remi
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
2. Установка yum-utils (если не установлен)
3. Обновление или установка php
yum-config-manager --enable remi-php56
yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo
4. Проверка версии
https://www.tecmint.com/install-php-5-6-on-centos-7/
Например, для замены в $text
{lists_4}
на название списка и список элементов:
preg_match_all("/{lists\s*(.*?)}/si",$text,$matches,PREG_SET_ORDER);
if(count($matches)>0){
foreach($matches as $m){
$me=explode('_',trim(trim($m[0],'}'),"{"));
if($me[0]=='lists'&&$me[1]>0){
$replace='';
$list=get_by_id($me[1],'lists');
if($list['id']){
$items=get_from_base('*','list_items',"`parent`='".$list['id']."' and `shown`=1",'pos');
if(count($items)>0){
$replace.='<div class="list">';
$replace.='<div class="name">'.$list['name'].'</div>';
$replace.='<ul>';
foreach($items as $count=>$item){
$replace.='<li class="item">'.$item['name'].'</li>';
}
$replace.='</ul>';
$replace.='</div>';
}
}
$text=str_replace($m,$replace,$text);
}
}
}
JS:
$(".input_place").autocomplete({
source:"/?ajax_action=get_places",
minLength:4,
position:{my:"left top",at:"left bottom"},
select:function(event,ui){
var loc=$(this).closest('form').attr('action');
if(ui.item.country_id){
loc+='?country[]='+ui.item.country_id;
$('#hidden_country').val(ui.item.country_id);
}
if(ui.item.district_id){
loc+='&district[]='+ui.item.district_id;
$('#hidden_district').val(ui.item.district_id);
}
if(ui.item.city_id){
loc+='&city[]='+ui.item.city_id;
$('#hidden_city').val(ui.item.city_id);
}
var selected=ui.item.country_name;
if(ui.item.district_name!=''){
selected=ui.item.district_name;
}
if(ui.item.city_name!=''){
selected=ui.item.city_name;
}
$(this).val(selected);
if($('#hidden_country').val()==undefined){
window.location.href=loc;
}
return false;
}
}).autocomplete("instance")._renderItem=function(ul,item){
var li=item.country_name;
if(item.district_name!=''){
li+=' '+item.district_name;
}
if(item.city_name!=''){
li+=' '+item.city_name;
}
return $("<li>").append(li).appendTo(ul);
};
if($_GET['ajax_action']=='get_places'){
$places=array();
$ajax_countries=get_from_base('*','countries',"shown=1 and (`name` LIKE '%".$_GET['term']."%' OR `id` IN (SELECT `parent` FROM `districts` WHERE`shown`=1 and (`name` LIKE '%".$_GET['term']."%' OR `id` IN (SELECT `parent` FROM `cities` WHERE`shown`=1 and `name` LIKE '%".$_GET['term']."%'))))",'pos');
if(count($ajax_countries)>0){
foreach($ajax_countries as $country){
$places[]=array('country_id'=>$country['id'],'country_name'=>$country['name'],'district_id'=>0,'district_name'=>'','city_id'=>0,'city_name'=>'');
$ajax_districts=get_from_base('*','districts',"`parent`=".$country['id']." and `shown`=1 and (`name` LIKE '%".$_GET['term']."%' OR `id` IN (SELECT `parent` FROM `cities` WHERE`shown`=1 and `name` LIKE '%".$_GET['term']."%'))",'pos');
if(count($ajax_districts)>0){
foreach($ajax_districts as $district){
$places[]=array('country_id'=>$country['id'],'country_name'=>$country['name'],'district_id'=>$district['id'],'district_name'=>$district['name'],'city_id'=>0,'city_name'=>'');
$ajax_cities=get_from_base('*','cities',"`parent`=".$district['id']." and `shown`=1 and `name` LIKE '%".$_GET['term']."%'",'pos');
if(count($ajax_cities)>0){
foreach($ajax_cities as $city){
$places[]=array('country_id'=>$country['id'],'country_name'=>$country['name'],'district_id'=>$district['id'],'district_name'=>$district['name'],'city_id'=>$city['id'],'city_name'=>$city['name']);
}
}
}
}
}
}
header('Content-Type: application/json');
echo json_encode($places);
exit();
}
https://jqueryui.com/autocomplete/#custom-data