<?php
define('_IN_JOHNCMS', 1);
$textl='Homiylarni 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_spons` SET `name`='$name', `pic`='$pic', `plus`='$plus', `pay`='$pay'");
			echo'Yangi homiy '.$name.' qo`shildi!';
		}
		
		echo'</b><hr/>';
	}
		echo
		'
			<form action="addspons.php" method="post">
				<b>Homiy nomi:</b><br/><input type="text" name="name" /><br/>
				<b>Surati:</b><br/><input type="text" name="pic" value="nopic.jpg" /><br/>
				<b>Kontrakt summasi:</b><br/><input type="text" name="pay" /><br/>
				<b>O`yin uchun foyda:</b><br/><input type="text" name="plus" /><br/>
				<input type="submit" name="submit" value="Yaratish" />
			</form>
		';
		echo"<div class='phdr'><a href='adminka.php'>Adminka</a></div>";
}

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