View file stat/_modules/admin/platforms/edit/index.php

File size: 4.09Kb
<?php

	# mark core  v1.0
    # author Drk in
	# date 24.10.19 	

	# core

	require_once ( $_SERVER['DOCUMENT_ROOT']."/_core/system.php" );

	$id =  isset( $_GET['id'] ) ? system::abs($_GET['id']): 0;

	if (cache_pf::ch($id) === false)system::header('/admin/platforms','Ошибка, ID не найден');

	$act = cache_pf::check($id);

	# meta

	$title = 'Изменение cайта - '.system::check($act['url']).' » Мобильные WAP сайты';
	$description = system::check($config['description']);
	$keywords = system::check($config['keywords']);
	$tl = 'Изменение cайта - '.system::check($act['url']).'';
	
	# adm

	system::adm();

	# post

	if (isset($_POST['CFMS'])): 

	$url  		= system::check($_POST['url']);
	$message  	= system::check($_POST['message']);
	$cat  		= system::abs($_POST['cat']);
	$big  		= system::abs($_POST['big']);
	$small  	= system::abs($_POST['small']);
	$hide 		= (empty($_POST['hide'])) ? 0 : 1;
	$CK  		= system::check($_POST['CK']);	

	if (system::utf_strlen($url) > 5 && system::utf_strlen($url)	< 36):	
	if (system::utf_strlen($message) > 5 && system::utf_strlen($message)	< 81):	
	if (cache_cat::ch($cat) == true):
	if ($big > 0 && $big < 12):
	if ($small > 0 && $small < 12):
	if ($user['CK'] == $CK):
	
	DB :: $dbh -> query("UPDATE platforms SET url = ?, message = ?, cat = ?, big = ?, small = ?, hide = ? WHERE id = ? LIMIT 1;", array($url,$message,$cat,$big,$small,$hide,$act['id']));	
	
	cache_pf::save($act['id']);	

	system::header('/admin/platforms','Успешно',1);		
		
	# error
	
	else: system::header('?','Ошибка, возможно вам подкинули эту ссылку'); endif;
	else: system::header('?','Не верно выбран счетчик для остальных страниц'); endif;
	else: system::header('?','Не верно выбран счетчик для главной страницы'); endif;
	else: system::header('?','Не верно выбрана категория'); endif;
	else: system::header('?','Описание от 5 до 80 символов'); endif;
	else: system::header('?','URL от 5 до 35 символов'); endif;

	endif;	


	# head

	require_once ( head );

	echo'
	<div class="touch">
	<form method="post">
	<input type="hidden" name="CK" value = "'.$user['CK'].'">
	URL сайта (без http:// и т.п) [max. 35]:<br>
	<input type="text" name="url" value ="'.system::check($act['url']).'"><br>
	Описание сайта [max. 80]:<br>
	<textarea name="message" cols="38" rows="8">'.system::check($act['message']).'</textarea><br>
	Категория:<br>
	<select name="cat">
	';

	# cat

	$query = DB :: $dbh -> query("SELECT id FROM cat ORDER BY id");	

	while ($cat = $query -> fetch()):

	$cat = cache_cat::check($cat['id']);	

	echo '<option value="'.$cat['id'].'" '.($act['cat'] == $cat['id'] ? 'selected="selected"':'').'>'.system::check($cat['name']).'</option>';		

	endwhile;	

	# coutn code

	$cn = [1,2,3,4,5,6,7,8,9,10,11];
	
	echo'
	</select>
	<hr>
	<small><strong>Для главной страницы сайта: <font size="2">*</font></strong></small>
	<br>';

	foreach ($cn as $big): # big

	echo '
	<input type="radio" name="big" value="'.$big.'" '.($big == $act['big'] ? 'checked="checked"':'').'>
	<img src="'.ico.'cn/big/'.$big.'.gif" alt="*">
	<br>';	

	endforeach;		

	echo '
	<hr>
	<small><strong>Для остальных страниц сайта: <font size="2">*</font></strong></small>
	<br>';
	

	foreach ($cn as $small): # small

	echo '
	<input type="radio" name="small" value="'.$small.'" '.($small == $act['small'] ? 'checked="checked"':'').'>
	<img src="'.ico.'cn/small/'.$small.'.gif" alt="*">
	<br>	
	';	

	endforeach;	
	
	echo '
	<br>
	<input name="hide" type="checkbox" value="1" '.($act['hide'] == 1 ? 'checked="checked"':'').'> Скрыть статистику<br>
	<input name="CFMS" type="submit" value="Изменить">
	</form></div>
	<a href="'.site.'admin/platforms" class="touch">« Назад</a>
	';


	# foot

	require_once ( foot ) ;
?>