Location: PHPKode > scripts > WH Board > wh_board/admin/blog_posts_new.php
<?php require('management/admin_functions/session.php'); ?>
<?php require('management/admin_layout/header.php'); ?>

    <ul id="breadcrumbs">
        <li><a href="index.php"><?php echo $lang['main_navigation']; ?></a></li>
        <li><a href="blog.php">Blog</a></li>
        <li><a href="blog_posts_new.php" class="actual"><?php echo $lang['create_article']; ?></a></li>
    </ul>

    <div class="clear_blog"></div>

    <?php

    if(isset($_POST['submit'])) {
    $errors = array();

    if(empty($_POST['blog_title'])) {
    echo $lang['enter_a_title'];

        }else{
        $blog_title = mysql_real_escape_string($_POST['blog_title']);
        }

    if(empty($_POST['blog_author'])) {
    echo $lang['reg_fill_name'];

        }else{
        $blog_author = htmlentities($_POST['blog_author']);
        }

    if(empty($_POST['blog_post'])) {
    echo $lang['enter_a_text'];

        }else{
        $blog_post = mysql_real_escape_string($_POST['blog_post']);
        }

    if($blog_title && $blog_author && $blog_post) {

    $query = "INSERT INTO articles (blog_title, blog_author, blog_post, blog_date) VALUES('" . $blog_title . "', '" . $blog_author . "', '" . $blog_post . "', NOW())";
    $result = mysql_query($query) OR die(mysql_error());

    if($result) {

    echo '<p class="success">' . $lang['success_article_published'] . '!</p>
    <p><a href="blog.php">' . $lang['go_on'] . '</a></p>';

        }else{

        echo '<p class="false">' . $lang['falied_article_published'] . '</p>
        <p><a href="blog_posts_new.php">' . $lang['back'] . '</a></p>';
        }

    }else{

    echo '<p class="false">' . $lang['not_filled_all'] . '</p>
    <p><a href="blog_posts_new.php">' . $lang['back'] . '</a></p>';
    echo '<ul>';

    foreach($errors as $value) {
    echo '<li>&#8226; ' . $value . '</li>';
    }
    }
    echo '</ul>';
    }

    echo '<form action="" method="post">
    <p><input type="input" name="blog_title" class="textfields" size="30" maxlength="60"> ' . $lang['title'] . '</p>
    <p><input type="input" name="blog_author" class="textfields" size="30" maxlength="35"> ' . $lang['author'] . '</p>
    <p>' . $lang['article_content'] . '</p>
    <textarea cols="45" rows="8" name="blog_post" id="blog_post" class="textareas"></textarea>
    <p><input type="submit" name="submit" id="submit" alt="' . $lang['to_publish'] . '" value="' . $lang['to_publish'] . '" class="buttons"></p>
    <input type="hidden" name="submitted" value="TRUE">
    </form>';

    ?>

<?php require('management/admin_layout/footer.php'); ?>
Return current item: WH Board