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

File size: 6.13Kb
<?php require_once ( $_SERVER['DOCUMENT_ROOT']."/_core/system.php" );
	system::access(true);
	$id =  isset( $_GET['id'] ) ? system::abs($_GET['id']): 0;
	if (cache_pf::ch($id) === false)system::header('/office/platforms','Ошибка, ID не найден');
	$act = cache_pf::check($id);
	if ($act['user'] != $user['id'])system::header('/office/platforms','Ошибка, ID не найден');
	$title = 'Мой кабинет » Мобильные WAP сайты';
	$description = system::check($config['description']);
	$keywords = system::check($config['keywords']);
	$tl = 'Изменение cайта - '.system::check($act['url']);
	if (isset($_POST['CFMS'])): 
		$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($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 message = ?, cat = ?, big = ?, small = ?, hide = ? WHERE id = ? LIMIT 1;", array($message,$cat,$big,$small,$hide,$act['id']));	
							cache_pf::save($act['id']);	
							system::header('/office/platforms','Успешно',1);		
						else: system::header('?','Ошибка, возможно вам подкинули эту ссылку'); endif;
					else: system::header('?','Не верно выбран счетчик для остальных страниц'); endif;
				else: system::header('?','Не верно выбран счетчик для главной страницы'); endif;
			else: system::header('?','Не верно выбрана категория'); endif;
		else: system::header('?','Описание от 5 до 80 символов'); endif;
	endif;	
	require(head); ?>
	<div class="_forma1">
		<h3>Редактировать сайт</h3>
		<form method="post">
			<input type="hidden" name="CK" value = "<?php echo $user['CK'];?>">
			<label>Описание сайта [max. 80]</label>
			<textarea class="_textreasds" name="message" cols="38" rows="8"><?php echo system::check($act['message']);?></textarea>
			<label>Категория </label>
			<select class="_selefasda" name="cat">
				<?php $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;	?>
			</select>
			<?php $cn = [1,2,3,4,5,6,7,8,9,10,11];?>
			<label>Для главной страницы сайта</label>
			<?php $i = 0;
			foreach ($cn as $big):
				$i++; ?>
				<label style="margin: 0;"><div><input style="vertical-align: 4px;margin-right: 2px;" type="radio" name="big" value="<?php echo $big;?>" <?php echo ($big == $act['big'] ? 'checked="checked"':'');?>> <img src="<?php echo ico;?>cn/big/<?php echo $big;?>.gif" alt="*"></div></label>
			<?php endforeach;	?>
			<label style="margin-top: 15px;">Для остальных страниц сайта</label>
			<?php $i = 0;
			foreach ($cn as $small):
				$i++; ?>
				<label style="margin: 0;"><div><input style="vertical-align: -1px;margin-right: 2px;" type="radio" name="small" value="<?php echo $small;?>" <?php echo ($small == $act['small'] ? 'checked="checked"':'');?>> <img src="<?php echo ico;?>cn/small/<?php echo $small;?>.gif" alt="*"></div></label>
			<?php endforeach;	?>
			<div><input style="margin-top: 15px;margin-bottom: 15px;" name="hide" type="checkbox" value="1" <?php echo ($act['hide'] == 1 ? 'checked="checked"':'');?>> Скрыть статистику</div>
			<input class="_forma3" name="CFMS" type="submit" value="Сохранить">
		</form>
		<a href="<?php echo site;?>office/platforms" class="_forma4 _dop3"><i class="fas fa-paste"></i> Мои сайты</a>
	</div>

	<?php







	/*

	echo '
	<div class="touch">
	<form method="post">
	<input type="hidden" name="CK" value = "'.$user['CK'].'">
	Описание сайта [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>
	<br><font size="2">*</font> - Все поля обязательные к заполнению.<br>
	<font size="2">**</font> - Описание сайта должно быть адекватное!
	</div>

	<a href="'.site.'office/platforms" class="touch">« Мои сайты</a>
	<a href="'.site.'" class="touch">« На главную</a>
	';

	# foot
	*/
	require_once ( foot ) ;

?>