<?php
define('_IN_JOHNCMS', 1);
$headmod = 'manager';
$textl='Sozlashlar qo`shish'; 
require_once("../incfiles/core.php");
require_once("../incfiles/head.php");
require_once("manfunc.php"); 

echo"<h2 align='center'>$textl</h2>";

if($rights>=7)
{
	if($_POST['submit'])
	{
		$name = $_POST['name'] ? trim(functions::check($_POST['name'])) : false;
		$pic = $_POST['pic'] ? trim(functions::check($_POST['pic'])) : false;
		$pay = $_POST['pay'] ? intval($_POST['pay']) : false;
		$plus = $_POST['plus'] ? intval($_POST['plus']) : false;
		echo'<b>';
		
		if(!$name || !$pay || !$plus)
		{
			echo'Barcha maydonlarni to`ldirish kerak!<br/>';
		}
		else
		{
			if(!$pic)
			{
				$pic = 'nopic.jpg';
			}
			mysql_query("INSERT INTO `fman_build` SET `name`='$name', `pic`='$pic', `plus`='$plus', `pay`='$pay'");
			echo'Yangi qurilish '.$name.' qo`shildi!';
		}
		
		echo'</b><hr/>';
	}
		echo
		'
			<form action="addbuild.php" method="post" enctype="multipart/form-data">
				<b>Qurilish nomi:</b><br/><input type="text" name="name" /><br/>
				<b>Surati:</b><br/><input type="text" name="pic" value="nopic.jpg" /><br/>
				<b>Qurulish bahosi:</b><br/><input type="text" name="pay" /><br/>
				<b>Daromad:</b><br/><input type="text" name="plus" /><br/>
				<input type="submit" name="submit" value="Yaratish" />
			</form>
		';
}

require_once("../incfiles/end.php"); 
?>