first commit
This commit is contained in:
174
admin/backups/evento_insere.php
Executable file
174
admin/backups/evento_insere.php
Executable file
@@ -0,0 +1,174 @@
|
||||
<?php require_once('../Connections/conn_sustentabilidade.php'); ?>
|
||||
<?php
|
||||
if (!function_exists("GetSQLValueString")) {
|
||||
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
|
||||
{
|
||||
if (PHP_VERSION < 6) {
|
||||
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
|
||||
}
|
||||
|
||||
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
|
||||
|
||||
switch ($theType) {
|
||||
case "text":
|
||||
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
|
||||
break;
|
||||
case "long":
|
||||
case "int":
|
||||
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
|
||||
break;
|
||||
case "double":
|
||||
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
|
||||
break;
|
||||
case "date":
|
||||
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
|
||||
break;
|
||||
case "defined":
|
||||
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
|
||||
break;
|
||||
}
|
||||
return $theValue;
|
||||
}
|
||||
}
|
||||
|
||||
$editFormAction = $_SERVER['PHP_SELF'];
|
||||
if (isset($_SERVER['QUERY_STRING'])) {
|
||||
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
|
||||
}
|
||||
|
||||
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form_evento_insere")) {
|
||||
$insertSQL = sprintf("INSERT INTO tbeventos (id_evento, nome_evento, local_evento, publico_evento, imagem_evento, descr_evento, destaque_evento, tipo_evento) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
|
||||
GetSQLValueString($_POST['id_evento'], "int"),
|
||||
GetSQLValueString($_POST['nome_evento'], "text"),
|
||||
GetSQLValueString($_POST['local_evento'], "text"),
|
||||
GetSQLValueString($_POST['publico_evento'], "text"),
|
||||
GetSQLValueString($_FILES['imagem_evento']['name'], "text"),
|
||||
GetSQLValueString($_POST['descr_evento'], "text"),
|
||||
GetSQLValueString($_POST['destaque_evento'], "text"),
|
||||
GetSQLValueString($_POST['tipo_evento'], "int"));
|
||||
|
||||
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
|
||||
$Result1 = mysql_query($insertSQL, $conn_sustentabilidade) or die(mysql_error());
|
||||
|
||||
$insertGoTo = "evento_lista.php";
|
||||
if (isset($_SERVER['QUERY_STRING'])) {
|
||||
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
|
||||
$insertGoTo .= $_SERVER['QUERY_STRING'];
|
||||
}
|
||||
header(sprintf("Location: %s", $insertGoTo));
|
||||
}
|
||||
|
||||
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
|
||||
$query_select_tipo = "SELECT * FROM tbtipos ORDER BY rotulo_tipo ASC";
|
||||
$select_tipo = mysql_query($query_select_tipo, $conn_sustentabilidade) or die(mysql_error());
|
||||
$row_select_tipo = mysql_fetch_assoc($select_tipo);
|
||||
$totalRows_select_tipo = mysql_num_rows($select_tipo);
|
||||
|
||||
if(isset($_POST['enviar'])){
|
||||
$nome_img=$_FILES['imagem_evento']['name'];
|
||||
$tmp_img=$_FILES['imagem_evento']['tmp_name'];
|
||||
$dir_img="../imagens/".$nome_img;
|
||||
move_uploaded_file($tmp_img,$dir_img);
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Evento - Insere</title>
|
||||
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<section id="topo" class="container-fluid">
|
||||
<a href="evento_lista.php"><h4><span class="glyphicon glyphicon-menu-left "></span> Voltar</h4></a>
|
||||
<section id="titulo" class="container">
|
||||
<h1>Evento - Insere</h1>
|
||||
<hr>
|
||||
</section>
|
||||
</section>
|
||||
<section id="insere_centro" class="container-fluid">
|
||||
<section id="form" class="container">
|
||||
<form name="form_evento_insere" action="<?php echo $editFormAction; ?>" method="POST" id="form_evento_insere" enctype="multipart/form-data">
|
||||
<label for="nome_evento">Evento:</label>
|
||||
<p class="input-group">
|
||||
<span class="input-group-addon"></span>
|
||||
<input name="nome_evento" class="form-control input" type="text" id="nome_evento" maxlength="50" required placeholder="Nome do Evento">
|
||||
</p>
|
||||
|
||||
<label for="publico_evento">Publico:</label>
|
||||
<p class="input-group">
|
||||
<span class="input-group-addon"></span>
|
||||
<input name="publico_evento" class="form-control input" type="text" id="publico_evento" maxlength="30" required placeholder="Ex.: Todos" >
|
||||
</p>
|
||||
|
||||
<label for="tipo_evento">Tipo:</label>
|
||||
<p class="input-group">
|
||||
<span class="input-group-addon"></span>
|
||||
<select name="tipo_evento" id="tipo_evento" required>
|
||||
<?php do { ?>
|
||||
<option value="<?php echo $row_select_tipo['id_tipo']?>">
|
||||
<?php echo $row_select_tipo['rotulo_tipo']?>
|
||||
</option>
|
||||
<?php } while ($row_select_tipo = mysql_fetch_assoc($select_tipo));
|
||||
$rows = mysql_num_rows($select_tipo);
|
||||
if($rows > 0) {
|
||||
mysql_data_seek($select_tipo, 0);
|
||||
$row_select_tipo = mysql_fetch_assoc($select_tipo);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<label for="local_evento">Local:</label>
|
||||
<p class="input-group">
|
||||
<span class="input-group-addon"></span>
|
||||
<input name="local_evento" class="form-control input" type="text" id="local_evento" maxlength="30" required placeholder="Ex.: Itapetininga" >
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Escolha a imagem:</b><br>
|
||||
<input type="file" name="imagem_evento" id="imagem_evento">
|
||||
</p>
|
||||
|
||||
<label for="descr_evento">Descrição:</label>
|
||||
<p>
|
||||
<textarea name="descr_evento" id="descr_evento" cols="35" rows="5" maxlength="300"></textarea>
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<label for="destaque_evento"><b>É destaque?:</b></label>
|
||||
<div class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||
<label class="btn btn-warning">
|
||||
<input name="destaque_evento" type="radio" id="destaque_evento_s" value="Sim" required> Sim
|
||||
</label>
|
||||
<label class="btn btn-warning">
|
||||
<input name="destaque_evento" type="radio" id="destaque_evento_n" value="Nao" required checked> Não
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="btn-group btn-group-justified" role="group" aria-label="...">
|
||||
<div class="btn-group" role="group">
|
||||
<input class="btn btn-success btn-block" type="submit" value="Adicionar" name="enviar" id="enviar">
|
||||
</div>
|
||||
<div class="btn-group" role="group">
|
||||
<input class="btn btn-danger btn-block" type="reset" value="Limpar">
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="MM_insert" value="form_evento_insere">
|
||||
</form>
|
||||
</section>
|
||||
</section>
|
||||
<!-- Jquery (obrigatório para plugin JS do Bootstrap) -->
|
||||
<script src="../bootstrap/jquery.min.js"></script>
|
||||
|
||||
<!-- Plugin JS-->
|
||||
<script src="../bootstrap/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
mysql_free_result($select_tipo);
|
||||
?>
|
Reference in New Issue
Block a user