12 февраля 2020 Нет комментариев
$curl=curl_init();
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl,CURLOPT_HEADER,0);
curl_setopt($curl,CURLOPT_POST,1);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl,CURLOPT_POSTFIELDS,$data);
curl_setopt($curl,CURLOPT_PROXY,$proxy_ip);
curl_setopt($curl,CURLOPT_PROXYPORT,$proxy_port);
curl_setopt($curl,CURLOPT_PROXYAUTH,CURLAUTH_DIGEST);
curl_setopt($curl,CURLOPT_PROXYUSERPWD,$proxy_user.':'.$proxy_password);
$result=curl_exec($curl);
Categories: PHP Tags:
7 февраля 2020 Нет комментариев
header("Content-Type: application/javascript");
Categories: PHP Tags:
7 февраля 2020 Нет комментариев

.htacess:

Header set Access-Control-Allow-Origin *

или php:

header('Access-Control-Allow-Origin: *');
Categories: PHP, Web Tags: ,
4 февраля 2020 Нет комментариев

в .htaccess

Header always append X-Frame-Options DENY
Categories: Web Tags:
24 января 2020 Нет комментариев
<input type="text" name="test" placeholder="Test" onkeyup="this.value=this.value.replace(/\s+/gi,'')"/>
Categories: Javascript Tags:
24 января 2020 Нет комментариев
ini_set('session.gc_maxlifetime',120960);
ini_set('session.cookie_lifetime',120960);
ini_set('session.save_path',$_SERVER['DOCUMENT_ROOT'].'../sessions/');

https://habr.com/ru/post/28418/

Categories: PHP Tags:
24 декабря 2019 Нет комментариев

Javascript:

$(document).ready(function(){
	var select_brand=$('select[name=brand]');
	var select_collection=$('select[name=collection]');
	select_brand.on('change',function(){
		$.ajax({
			url:"/?ajax_action=get_collections&brand="+select_brand.val(),
			dataType:"json",
			success:function(data){
				select_collection.find('option').not(':first').remove();
				$.each(data,function(index,item){
					select_collection.append('<option value="'+item.id+'">'+item.name+'</option>');
				});
				select_collection.trigger("chosen:updated");
			}
		});
	});
});

HTML:

<select name="brand" class="chosen">
	<option value="0">Выбрать</option>
	<?if(count($brands)>0){?>
		<?foreach($brands as $item){?>
			<option value="<?=$item['id']?>"<?if($item['id']==$change_catalog["brand"]){?> selected="selected"<?}?>><?=$item['name']?></option>
		<?}?>
	<?}?>
</select>
<select name="collection" class="chosen">
	<option value="0">Выбрать</option>
	<?if(count($collections)>0){?>
		<?foreach($collections as $item){?>
			<option value="<?=$item['id']?>"<?if($item['id']==$change_catalog["collection"]){?> selected="selected"<?}?>><?=$item['name']?></option>
		<?}?>
	<?}?>
</select>

PHP:

if($_GET['ajax_action']=='get_collections'&&$_GET['brand']>0){
	header("Content-Type: application/json");
	$result=get_from_base('`id`,`name`','collections',"`parent`='".$_GET['brand']."'",'pos');
	echo json_encode($result);
	exit();
}
$brands=get_from_base('`id`,`name`','brands',"1",'`parent`,`pos`');
if($_GET["change_id"]){
	$change_catalog=get_by_id($_GET["change_id"],'catalog');
	if($change_catalog['brand']){
		$collections=get_from_base('`id`,`name`','collections',"`parent`='".$change_catalog['brand']."'",'pos');
	}
}
Categories: Javascript, PHP Tags: ,