<?
$moth=date('m');
$date=date('d.m.Y - H:i');
$comments="0";
$prosmotrov="0";
if(mysql_select_db($db_name))
{
$s="CREATE TABLE news(id INT(10), tittle VARCHAR(100) NOT NULL, soderjanie VARCHAR(1000) NOT NULL, fullsoderjanie VARCHAR(1000) NOT NULL, cathegory VARCHAR(100) NOT NULL, author VARCHAR(255) NOT NULL, comments INT(10) NOT NULL, prosmotrov INT(20) NOT NULL, moth VARCHAR(20) NOT NULL, date VARCHAR(100) NOT NULL)";
}
if(mysql_query($s));
{
if($_GET[news]=="add")
{
if(isset($_POST['tittle']) && isset($_POST['soderjanie']) && isset($_POST['fullsoderjanie']) && isset($_POST['cathegory']) && isset($_POST['author']))
{
$tittle=$_POST['tittle'];
$soderjanie=$_POST['soderjanie'];
$fullsoderjanie=$_POST['fullsoderjanie'];
$cathegory=$_POST['cathegory'];
$author=$_POST['author'];
$imgg=$_POST['img'];
$zuss=mysql_query("SELECT * FROM news");
if(mysql_num_rows($zuss)==0)
$ida=1;
else
$ida=mysql_num_rows($zuss)+1;
$zall=mysql_fetch_array($zuss);
$d="INSERT INTO news(id, tittle, soderjanie, fullsoderjanie, cathegory, author, comments, prosmotrov, moth, date) values ('$ida', '$tittle', '$soderjanie', '$fullsoderjanie', '$cathegory', '$author', '$comments', '$prosmotrov', '$moth', '$date')" ;
}
{
if(mysql_query($d) or die(mysql_error()));
echo "Новость добавлена";
echo "<script language='Javascript'>function reload() {location = 'add_news.php'}; setTimeout('reload()', 1500);</script>";
}
}
}
?>