OwlCyberSecurity - MANAGER
Edit File: form-editar.php
<?php include("../../includes/config.php"); include("../../modulos/game-tags/actions.php"); verificarLogado(); $id = filter_input(INPUT_GET, 'id'); $query = $db->prepare("SELECT * FROM game WHERE idg=:id"); $query->execute(array('id' => $id)); $result = $query->fetch(PDO::FETCH_ASSOC); $pastaImagem = "../../../icones-games/icones/" . $result['imagem']; if ($result['tipo'] == 'embed') $pastaSwf = $result['swf']; else $pastaSwf = "../../../icones-games/jogos/" . $result['swf']; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Games - Editar</title> <?php include("../../includes/head.php"); ?> </head> <body> <div class="container"> <div class="row"> <div class="col-xs-12"> <h1 class="page-header"> <a href="./" class="pull-right btn btn-default"><i class="glyphicon glyphicon-chevron-left"></i></a> Editar </h1> <form action="update.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="id" value="<?= $id ?>"> <div class="row"> <div class="col-xs-3"> <label for="">Tipo de jogo:</label> <select name="tipo" id="tipo"> <option value="flash">Flash</option> <option value="html5" <?= $result['tipo'] == "html5" ? "selected" : "" ?>>HTML 5</option> <option value="embed" <?= $result['tipo'] == "embed" ? "selected" : "" ?>>Embed</option> </select> </div> <div class="col-xs-4"> <?php $dt = strtotime($result['data_publicar']); ?> <label class="label-control">Data de Publicação</label> <br /> <input type="date" name="data_publicar_data" value="<?= date("Y-m-d", $dt) ?>" /> <input type="time" name="data_publicar_hora" value="<?= date("H:i", $dt)?>" /> </div> </div> <br> <label>Descrição do tipo</label> <br> <input type="text" name="tipo_descricao" size="70" placeholder="Mobile ..." value="<?= $result['tipo_descricao'] ?>"> <br><br> <label>Nome</label> <br> <input type="text" name="game" size="70" placeholder="Título do Game" value="<?= $result['game'] ?>" required> <br><br> <label>Título do Link - Letras minúsculas e hifen no lugar de espaço(Ex.:titulo-do-link)</label> <br> <input type="text" name="url" size="70" required placeholder="Título do Link" value="<?= $result['url'] ?>" required> <br> <br> <div class="row"> <div class="col-xs-6"> <div class="form-group"> <label>Tags (Separe as tags novas por vírgula ou precione a tecla TAB)</label> <input type="text" id="game_tags" name="tags" value="<?= $result['tags'] ?>" /> </div> </div> </div> <label>Descrição</label> <br> <textarea name="descricao" rows="10" cols="70" placeholder="Descrição" required><?= $result['descricao'] ?></textarea> <br><br> <label>Exclusivo? (0 -> Não | 1 -> Exclusivo)</label> <input type="number" name="exclusive" id="categoria" min="0" max="1" value="<?= $result['exclusive'] ?>"> <br> <br> <label>Categorias:</label> <br> 1 - Monter High <br> 2 - Ever After High <br> 3 - My Little Pony <br> 4 - Winx <br> 5 - Anime <br> 6 - Bratz <br> 7 - Barbie <br> 8 - Celebrities <br> 9 - Disney <br> 10 - Cartoon <br> <input type="number" name="categoria" id="categoria" min="1" max="10" value="<?= $result['categoria'] ?>"> <br> <br> <label>Imagem</label> <input type="file" name="imagem"> <br> <img src="<?= $pastaImagem ?>" height="100" /> <br /><br /> <div id="swf_html5"> <label>Jogo(swf ou html5)</label> <input type="file" name="swf"> </div> <div id="jogoembed" style="display: none"> <label>Link do Jogo Embed </label> <input type="text" name="embedurl" style="width: 50%" value="<?= $pastaSwf ?>"> </div> <br> <?php if ($result['tipo'] == "html5" || $result['tipo'] == "embed") { echo "<iframe src='{$pastaSwf}' width='100%' height='400' frameborder='0' style='padding: 0; margin:0'></iframe>"; } else { echo "<embed width='600' height='400' src='{$pastaSwf}'>"; } ?> <br /><br /> <button type="submit">Salvar</button> </form> </div><!-- /.col-xs-12 --> </div> <!-- /.row --> </div> <!-- /.container --> <script> /** * FRIENDLY URL FIELD ---------------------------------------------- */ $('input[name=url]').slugify('input[name=game]'); function exibirTipoJogo() { var t = $('#tipo').val(); if (t == 'embed') { $('#jogoembed').show(); $('#swf_html5').hide(); } else { $('#jogoembed').hide(); $('#swf_html5').show(); } } exibirTipoJogo(); $('#tipo').change(function () { exibirTipoJogo(); }); /** * FIELD TAGS ------------------------------------------------------ */ $('#game_tags').tokenfield({ autocomplete: { source: <?php echo GameTagsListJson($db)?>, delay: 100 }, showAutocompleteOnFocus: true }); </script> </body> </html>