<?

include '../../config.php';
include '../../func.php';
head();

if ( isset($_POST['submit']) ) {
    
    $msg = html( $_POST['msg'] );
    $name = html( $_POST['name'] );
    
    if ( empty($name) and empty($msg) ) {
        
        header('Location: index.php?mod=empty_add&result=error');
        
    } else {
        
    $result = mysql_query("INSERT INTO `news` SET `name` = '".$name."', `msg` = '".nl2br($msg)."', `date` = '".$date."', `razmestil` = '".$login_session."', `razmestil_id` = '".$id_session."'");
    
    if ( $result != NULL ) {
        header('Location: index.php?mod=razdel_add&result=good');
    } else {
        header('Location: index.php?mod=razdel_add&result=error');
    }        
        
    }
    
}
echo link2 . '<form action="new_add.php" method="post" name="form">';
echo 'Название:<br/ ><textarea id="tarea" name="name" cols="30" rows="5" style="width: 99%;"></textarea><br/ >';
echo 'Новость:<br/ ><textarea id="tarea" name="msg" cols="30" rows="5" style="width: 99%;"></textarea><br/ >';
echo '<input name="submit" class="submit" type="submit" value="Создать" /></form>' . div;