<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';


only_reg();
$set['title']='Добавление альбома';
include_once '../sys/inc/thead.php';
title();
if (isset($_POST['add']))
{

$name=mysql_real_escape_string($_POST['name']);
$opis=mysql_real_escape_string($_POST['opis']);
if(isset($_POST['pass']))$pass=mysql_real_escape_string($_POST['pass']); else $pass=NULL;
if(strlen($name)<2)$err='Название не менее 2 символов';
if(!isset($err)){
mysql_query("INSERT INTO `video_album` (`name`, `opis`, `time`, `id_user`, `pass`) VALUES ('$name', '$opis', '".time()."', '$user[id]', '$pass')");
if(isset($_POST['pass']))$_SESSION['pass']=mysql_real_escape_string($_POST['pass']);
$id=mysql_insert_id();
header("Location: album.php?id=".$id);
}
}

err();

echo "<form class='p_m' method='post' action=''>\n";
echo "Название:<br />\n<input type=\"text\" name=\"name\" value=\"\" /><br />\n";
echo "Описание:<br />\n<textarea name=\"opis\"></textarea><br />\n";
echo "Пароль:<br />\n<input type=\"text\" name=\"pass\" value=\"\" /><br />\n";
echo "<input value=\"Добавить\" name=\"add\" type=\"submit\" />\n";
echo "</form>\n";


echo "<div class='foot'>\n";
echo "<a href='index.php'>Видеоальбомы</a><br />\n";
echo "</div>\n";


include_once '../sys/inc/tfoot.php';
?>