View file element_forum/element_subforum_other_create_razdel.php

File size: 2.07Kb
<?php
	if ($user['lost_privilege'] != 3) { header('Location: /forum'); exit; }

	$title = 'Создать раздел';
	require_once './element_include/element_head.php';
	require_once './element_include/element_header_user_true.php';
	
	if ($go == 'add') {
		$title1 = (isset($_POST['title']) AND !empty($_POST['title'])) ? htmlspecialchars(addslashes(trim($_POST['title']))) : false;
		$opis = (isset($_POST['opis']) AND !empty($_POST['opis'])) ? htmlspecialchars(addslashes(trim($_POST['opis']))) : false;
		$close = $_POST['close'];
	
		if (!$title1) $error = 'Поле \'заголовок\' обязательно для ввода<br/>';
		if (!$opis) $error .= 'Поле \'описание\' обязательно для ввода<br/>';
	
		if (!isset($error)) {
			require_once './element_function/element_function_forum.php';
			if ($close) $close = 1; else $close = 0;
			
			
			mysql_query("INSERT INTO `element_forum_list_2` SET `lost_name` = '$title1',
															     `lost_sub_name` = '$opis',
															     `lost_dostype` = '$close'");
																 
			$insert = mysql_insert_id();
			header('Location: /forum/subforum?id='.$insert);
			exit;
		} else echo '<div class="nfl p5 mb5 cntr small red mlra">'.$error.'</div>';
	
	}
	
	echo '<div class="nfl p5 mb5 mt5 small mlra">';
	echo '<div class="p5 white cntr">
			<form method="post" action="/forum/subforum/create?go=add">
				<span class="small white">Название раздела</span><br/>
				<input class="fdark w96 mb5" type="text" size="20" maxlength="20" value="'.(($title1) ? $title1 : '').'" name="title"/><br/>
				<span class="small white">Краткое описание раздела</span><br/>
				<input class="fdark w96 mb5" type="text" size="20" maxlength="60" value="'.(($opis) ? $opis : '').'" name="opis"/><br/>
				<input type="checkbox" name="close" value="close"/>Закрытый раздел<br/>
				<span class="button w50 mt5"><input type="submit" class="ttl" name="submit" value="Создать"/></span>
			</form>
		</div>';
	
	echo '</div>';
?>