Архив

Архив раздела ‘PHP’
20 сентября 2015 Нет комментариев
$text=preg_replace('/style=\\"[^\\"]*\\"/','',$text);

http://community.sitepoint.com/t/remove-inline-style-with-preg-replace/21743/2

Categories: PHP Tags:
$arrs=array('_GET','_POST','_COOKIE');
foreach($arrs as $arr_key=>$arr_value){
	if(is_array($$arr_value)){
		foreach($$arr_value as $key=>$value){
			$nbz1=substr_count($value,'--');
			$nbz2=substr_count($value,'/*');
			$nbz3=substr_count($value,"'");
			$nbz4=substr_count($value,'"');
			if($nbz1>0||$nbz2>0||$nbz3>0||$nbz4>0){
				Print404();
				exit(); 
			}
		}
	}
}

http://www.softtime.ru/forum/read.php?id_forum=3&id_theme=83821

Categories: PHP, Web Tags: ,
23 марта 2015 Нет комментариев
$step1=explode('v=',$youtube_link);
$step2=explode('&',$step1[1]);
$video_id=$step2[0];
echo '<iframe width="560" height="315" src="http://www.youtube.com/embed/'.$video_id.'?autoplay=0" frameborder="0"></iframe>';
Categories: PHP Tags:
26 января 2015 Нет комментариев
strtotime(date('Y-m-01')." -2 month")
Categories: PHP Tags:
26 января 2015 Нет комментариев

timestamp:

strtotime(date('Y-m',$month_start).' next month - 1 hour')

где $month_start — timestamp даты в указанном месяце, например, дата начала позапрошлого месяца

strtotime(date('Y-m-01')." -2 month")
Categories: PHP Tags:
13 января 2015 2 комментария
$qpos=mysql_query('SELECT COUNT(*) FROM table WHERE pos<'.$data['pos']);
$rpos=mysql_fetch_array($qpos);
$pos=$rpos[0]+1;
Categories: MySQL, PHP Tags: ,
12 января 2015 Нет комментариев
$arr=array_diff($arr,array(''));
Categories: PHP Tags: