Exemplo n.º 1
0
    <article>

        <header>
            <h1>Criar Post:</h1>
        </header>

        <?php 
$post = filter_input_array(INPUT_POST, FILTER_DEFAULT);
if (isset($post) && $post['SendPostForm']) {
    $post['post_status'] = $post['SendPostForm'] == 'Cadastrar' ? '0' : '1';
    $post['post_cover'] = $_FILES['post_cover']['tmp_name'] ? $_FILES['post_cover'] : null;
    unset($post['SendPostForm']);
    require '_models/AdminPost.class.php';
    $cadastra = new AdminPost();
    $cadastra->ExeCreate($post);
    if ($cadastra->getResult()) {
        if (!empty($_FILES['gallery_covers']['tmp_name'])) {
            $sendGallery = new AdminPost();
            $sendGallery->gbSend($_FILES['gallery_covers'], $cadastra->getResult());
        }
        header('Location: painel.php?exe=posts/update&create=true&postId=' . $cadastra->getResult());
    } else {
        WSErro($cadastra->getError()[0], $cadastra->getError()[1]);
    }
}
?>

        <form name="PostForm" action="" method="post" enctype="multipart/form-data">

            <label class="label">
                <span class="field">Enviar Capa:</span>
Exemplo n.º 2
0
    <article>

        <header>
            <h1>Criar Post:</h1>
        </header>

        <?php 
$post = filter_input_array(INPUT_POST, FILTER_DEFAULT);
if (isset($post) && $post['SendPostForm']) {
    $post['post_status'] = $post['SendPostForm'] == 'Cadastrar' ? '0' : '1';
    $post['post_cover'] = $_FILES['post_cover']['tmp_name'] ? $_FILES['post_cover'] : null;
    unset($post['SendPostForm']);
    require '_models/AdminPost.class.php';
    $cadastra = new AdminPost();
    $cadastra->ExeCreate($post);
    if ($cadastra->getResult()) {
        header('Location: painel.php?exe=posts/update&create=true&postId=' . $cadastra->getResult());
    } else {
        WSErro($cadastra->getError()[0], $cadastra->getError()[1]);
    }
}
?>

        <form name="PostForm" action="" method="post" enctype="multipart/form-data">

            <div class="label_line">
                <label class="label_medium">
                    <span class="field">Enviar Capa:</span>
                    <input type="file" name="post_cover" class="max"/>
                </label>