first commit

This commit is contained in:
2021-11-19 22:12:23 -03:00
commit 923636c670
128 changed files with 16515 additions and 0 deletions

174
admin/backups/evento_insere.php Executable file
View 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);
?>

104
admin/backups/evento_lista.php Executable file
View File

@ -0,0 +1,104 @@
<?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;
}
}
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_eventos_lista = "SELECT * FROM vw_tbeventos";
$eventos_lista = mysql_query($query_eventos_lista, $conn_sustentabilidade) or die(mysql_error());
$row_eventos_lista = mysql_fetch_assoc($eventos_lista);
$totalRows_eventos_lista = mysql_num_rows($eventos_lista);
?>
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Eventos</title>
<!-- CSS do Bootstrap -->
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<?php include_once ("menu_adm.php");?>
<section class="container" id=tabela>
<h1>Tabela de Eventos</h1>
<hr>
<table class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Nome</th>
<th>Local</th>
<th>Público</th>
<th>Tipo</th>
<th>Imagem</th>
<th>Descrição</th>
<th>Destaque</th>
<th colspan="2">
<a href="evento_insere.php"><button class="btn btn-success btn-xs btn-block"><span class="glyphicon glyphicon-plus"></span>&nbsp;Inserir</button></a>
</th>
</tr>
</thead>
<tbody>
<?php do { ?>
<tr>
<td><?php echo $row_eventos_lista['nome_evento']?></td>
<td><?php echo $row_eventos_lista['local_evento']?></td>
<td><?php echo $row_eventos_lista['publico_evento']?></td>
<td><?php echo $row_eventos_lista['rotulo_tipo']?></td>
<td><img src="../imagens/<?php echo $row_eventos_lista['imagem_evento']?>" class="img-thumbnail" width="100px">
<a href="evento_imagem.php?id_evento=<?php echo $row_eventos_lista['id_evento']?>"><button class="btn btn-primary btn-xs btn-block"><span class="glyphicon glyphicon-pencil"></span>&nbsp;Alterar Img</button></a>
</td>
<td><?php echo $row_eventos_lista['descr_evento']?></td>
<td><?php echo $row_eventos_lista['destaque_evento']?></td>
<td>
<a href="evento_altera.php?id_evento=<?php echo $row_eventos_lista['id_evento']?>"><button class="btn btn-primary btn-xs btn-block"><span class="glyphicon glyphicon-pencil"></span>&nbsp;Alterar</button></a>
</td>
<td>
<a href="evento_deleta.php?id_evento=<?php echo $row_eventos_lista['id_evento']?>"><button class="btn btn-danger btn-xs btn-block"><span class="glyphicon glyphicon-trash"></span> &nbsp;Deletar</button></a>
</td>
</tr>
<?php } while ($row_eventos_lista = mysql_fetch_assoc($eventos_lista)); ?>
</tbody>
</table>
</table>
</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($eventos_lista);
?>

788
admin/backups/index-backup.php Executable file
View File

@ -0,0 +1,788 @@
<?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;
}
}
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_usuarios_lista = "SELECT * FROM tbusuarios";
$usuarios_lista = mysql_query($query_usuarios_lista, $conn_sustentabilidade) or die(mysql_error());
$row_usuarios_lista = mysql_fetch_assoc($usuarios_lista);
$totalRows_usuarios_lista = mysql_num_rows($usuarios_lista);
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form-usuarios-insere")) {
$insertSQL = sprintf("INSERT INTO tbusuarios (id_usuario, login_usuario, senha_usuario, nivel_usuario) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['id_usuario'], "int"),
GetSQLValueString($_POST['login_usuario'], "text"),
GetSQLValueString($_POST['senha_usuario'], "text"),
GetSQLValueString($_POST['nivel_usuario'], "text"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($insertSQL, $conn_sustentabilidade) or die(mysql_error());
$insertGoTo = "usuarios_lista.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
#Update INICIO
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form-usuarios-atualiza")) {
$updateSQL = sprintf("UPDATE tbusuarios SET login_usuario=%s, senha_usuario=%s, nivel_usuario=%s WHERE id_usuario=%s",
GetSQLValueString($_POST['login_usuario'], "text"),
GetSQLValueString($_POST['senha_usuario'], "text"),
GetSQLValueString($_POST['nivel_usuario'], "text"),
GetSQLValueString($_POST['id_usuario'], "int"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($updateSQL, $conn_sustentabilidade) or die(mysql_error());
$updateGoTo = "usuarios_lista.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_usuarios_atualiza = "-1";
if (isset($_GET['id_usuario'])) {
$colname_usuarios_atualiza = $_GET['id_usuario'];
}
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_usuarios_atualiza = sprintf("SELECT * FROM tbusuarios WHERE id_usuario = %s", GetSQLValueString($colname_usuarios_atualiza, "int"));
$usuarios_atualiza = mysql_query($query_usuarios_atualiza, $conn_sustentabilidade) or die(mysql_error());
$row_usuarios_atualiza = mysql_fetch_assoc($usuarios_atualiza);
$totalRows_usuarios_atualiza = mysql_num_rows($usuarios_atualiza);
#Fim
#TiposLista
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_tipos_lista = "SELECT * FROM tbtipos";
$tipos_lista = mysql_query($query_tipos_lista, $conn_sustentabilidade) or die(mysql_error());
$row_tipos_lista = mysql_fetch_assoc($tipos_lista);
$totalRows_tipos_lista = mysql_num_rows($tipos_lista);
#fim
#InsereEventos
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form_tipo_insere")) {
$insertSQL = sprintf("INSERT INTO tbtipos (id_tipo, sigla_tipo, rotulo_tipo) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['id_tipo'], "int"),
GetSQLValueString($_POST['sigla_tipo'], "text"),
GetSQLValueString($_POST['rotulo_tipo'], "text"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($insertSQL, $conn_sustentabilidade) or die(mysql_error());
$insertGoTo = "tipo_lista.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
#Fim
#ListarEventos
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_eventos_lista = "SELECT * FROM vw_tbeventos";
$eventos_lista = mysql_query($query_eventos_lista, $conn_sustentabilidade) or die(mysql_error());
$row_eventos_lista = mysql_fetch_assoc($eventos_lista);
$totalRows_eventos_lista = mysql_num_rows($eventos_lista);
#Fim
#InserirEventos
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);
}
#Fim
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="../css/estilo.css" rel="stylesheet">
</head>
<body>
<!-- Modal Listar Usuarios -->
<div class="modal fade" id="modalusuarios" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"><b>Listar Usuários</b></h4>
<a href="usuarios_lista.php"></a>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="table-responsive">
<table id="mytable" class="table table-bordered table-striped">
<thead>
<th>Id</th>
<th>Login Usuário</th>
<th class="esconde">Senha Usuário</th>
<th class="esconde">Nivel Usúario</th>
<th colspan="2"><p data-placement="top" data-toggle="tooltip" title="Delete">
</p></th>
</thead>
<tbody>
<?php do { ?>
<tr>
<td><?php echo $row_usuarios_lista['id_usuario']; ?></td>
<td><?php echo $row_usuarios_lista['login_usuario']; ?></td>
<td class="esconde"><?php echo $row_usuarios_lista['senha_usuario']; ?></td>
<td class="esconde"><?php echo $row_usuarios_lista['nivel_usuario']; ?></td>
<td>
<p data-placement="top" data-toggle="tooltip" title="Edit">
<button class="btn btn-primary btn-xs" data-toggle="modal" data-target="#modalalterausuarios" value="<?php echo $row_usuarios_lista['id_usuario']; ?>"><span class="glyphicon glyphicon-pencil"></span></button>
</td>
<td>
<p data-placement="top" data-toggle="tooltip" title="Delete"><a href="usuarios_exclui.php?id_usuario=<?php echo $row_usuarios_lista['id_usuario']?>"><button class="btn btn-danger btn-xs" ><span class="glyphicon glyphicon-trash"></span></button></a>
</p>
</td>
</tr>
<?php } while ($row_usuarios_lista = mysql_fetch_assoc($usuarios_lista)); ?>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<center><button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button></center>
</div>
</div>
</div>
</div>
</div>
<!-- Fim do Listar usuarios -->
<!-- Modal Inserir Usuarios -->
<div class="modal fade" id="modalinsereusuarios" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"><b>Usuários Insere</b></h4>
<a href="usuarios_lista.php"></a>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="container">
<div class="col-lg-5">
<hr>
<form name="form-usuarios-insere" action="<?php echo $editFormAction; ?>" method="POST" id="form_usuarios_insere" enctype="multipart/form-data">
<input type="hidden" name="id_usuario">
<label for="nome_usuario">Nome:</label>
<p class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
<input name="login_usuario" class="form-control input" type="text" id="login_usuario" maxlength="30" required placeholder="Digite o seu login">
</p>
<label for="senha_usuario">Senha:</label>
<p class="input-group">
<span class="input-group-addon">
<i class="fas fa-lock"></i></span>
<input name="senha_usuario" class="form-control input" type="password" id="senha_usuario" maxlength="16" required placeholder="Digite sua senha">
</p>
<br>
<h5>Nivel de Usúario:<h5>
<p class="hidden"><b>Nível de Permissão:</b><br>
<p>
<input name="nivel_usuario" type="radio" id="nivel_usuario" value="sup" required>
<label for="nivel_usuario_sup">Super Usuário</label>
<br>
<input name="nivel_usuario" type="radio" id="nivel_usuario" value="com" required >
<label for="nivel_usuario_com"> <b>Usuário Comum</b></label>
</p>
<p><input class="btn btn-success " type="submit" value="Registrar">
<input type="hidden" name="MM_insert" value="form-usuarios-insere">
</div>
</div>
</div>
</form>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Final Inserir Usuarios -->
<!-- Modal Alterar Usuarios -->
<div class="modal fade" id="modalalterausuarios" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"><b>Usuários Altera</b></h4>
<a href="usuarios_altera.php"></a>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<section class="container-fluid">
<section class="container">
<section class="col-lg-5">
<hr>
<form action="<?php echo $editFormAction; ?>" name="form-usuarios-atualiza" method="POST" id="form_usuarios_atualiza" enctype="multipart/form-data">
<input type="hidden" name="id_usuario" id="id_usuario" value="<?php echo $row_usuarios_atualiza['id_usuario']; ?>">
<label for="nome_usuario">Nome:</label>
<p class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
<input name="login_usuario" class="form-control input" type="text" id="login_usuario" value="<?php echo $row_usuarios_atualiza['login_usuario']; ?>" maxlength="30" required>
</p>
<label for="senha_usuario">Senha:</label>
<p class="input-group">
<span class="input-group-addon">
<i class="fas fa-lock"></i></span>
<input name="senha_usuario" class="form-control input" type="password" id="senha_usuario" value="<?php echo $row_usuarios_atualiza['senha_usuario']; ?>" maxlength="16" required >
</p>
<br>
<h5>Nivel de Usúario:<h5>
<p class="hidden"><b>Nível de Permissão:</b><br>
<p>
<input name="nivel_usuario" type="radio" id="nivel_usuario" value="sup" title="<?php echo $row_usuarios_atualiza['nivel_usuario']; ?>" required>
<label for="nivel_usuario_sup">Super Usuário</label>
<br>
<input name="nivel_usuario" type="radio" id="nivel_usuario" value="com" required checked>
<label for="nivel_usuario_com"> <b>Usuário Comum</b></label>
</p>
<p><input class="btn btn-success " type="submit" value="Atualizar">
&nbsp;&nbsp;&nbsp;&nbsp;
<input class="btn btn-danger " type="submit" value="Limpar"></p>
<input type="hidden" name="MM_update" value="form-usuarios-atualiza">
</section>
</section>
</section>
</form>
</div>
</div>
</div>
</div>
<!-- Final Alterar Usuarios -->
<!-- Modal Listar Categoria -->
<div class="modal fade" id="modalcategoria" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"><b>Categoria de Eventos</b></h4>
<a href="usuarios_altera.php"></a>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<section class="container-fluid">
<section class="col-lg-12">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Rotulo</th>
<th>Sigla</th>
</tr>
</thead>
<tbody>
<?php do { ?>
<tr>
<td><?php echo $row_tipos_lista['rotulo_tipo']?></td>
<td><?php echo $row_tipos_lista['sigla_tipo']?></td>
<td>
<a href="tipo_altera.php?id_tipo=<?php echo $row_tipos_lista['id_tipo']?>"><button class="btn btn-primary btn-xs btn-block"><span class="glyphicon glyphicon-pencil"></span></button>
</td>
<td>
<a href="tipo_deleta.php?id_tipo=<?php echo $row_tipos_lista['id_tipo']?>"><button class="btn btn-danger btn-xs btn-block"><span class="glyphicon glyphicon-trash"></span></button></a>
</td>
</tr>
<?php } while ($row_tipos_lista = mysql_fetch_assoc($tipos_lista)); ?>
</tbody>
</table>
</div>
</section>
</section>
</div>
</div>
</div>
</div>
<!-- Final Modal Categoria -->
<!-- Modal Inserir cat Eventos -->
<div class="modal fade" id="modalinserircateventos" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"><b>Inserir Eventos</b></h4>
<a href="usuarios_altera.php"></a>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<section id="insere_centro" class="container-fluid">
<section id="form" class="container">
<section class="col-sm-5">
<form name="form_tipo_insere" action="<?php echo $editFormAction; ?>" method="POST" id="form_rotulo_insere" enctype="multipart/form-data">
<label for="rotulo_tipo">Rótulo:</label>
<p class="input-group">
<span class="input-group-addon"></span>
<input name="rotulo_tipo" class="form-control input" type="text" id="rotulo_tipo" maxlength="15" required placeholder="Digite o rótulo">
</p>
<label for="sigla_tipo">Sigla:</label>
<p class="input-group">
<span class="input-group-addon"></span>
<input name="sigla_tipo" class="form-control input" type="text" id="sigla_tipo" maxlength="3" required placeholder="Digite uma sigla" >
</p>
<p><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="Atualizar">
</div>
<div class="btn-group" role="group">
<input class="btn btn-danger btn-block" type="reset" value="Limpar">
</div>
</div></p>
<input type="hidden" name="MM_insert" value="form_tipo_insere">
</form>
</section>
</section>
</section>
</div>
</div>
</div>
</div>
<!-- Final inserir cat eventos -->
<!-- Listar Eventos -->
<div class="modal fade bs-example-modal-lg" id="modallistareventos" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<section class="container">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Nome</th>
<th class="esconde">Local</th>
<th class="esconde">Público</th>
<th>Tipo</th>
<th class="img-tbl">Imagem</th>
<th>Descrição</th>
<th class="esconde"></th>
</tr>
</thead>
<tbody>
<?php do { ?>
<tr>
<td><?php echo $row_eventos_lista['nome_evento']?></td>
<td class="esconde"><?php echo $row_eventos_lista['local_evento']?></td>
<td class="esconde"><?php echo $row_eventos_lista['publico_evento']?></td>
<td><?php echo $row_eventos_lista['rotulo_tipo']?></td>
<td class="img-tbl"><img src="../imagens/<?php echo $row_eventos_lista['imagem_evento']?>" class="img-thumbnail" width="100px">
<a href="evento_imagem.php?id_evento=<?php echo $row_eventos_lista['id_evento']?>"><button class="btn btn-primary btn-xs btn-block"><span class="glyphicon glyphicon-pencil"></span>&nbsp;Alterar Img</button></a>
</td>
<td><?php echo $row_eventos_lista['descr_evento']?></td>
<td>
<?php if ($row_eventos_lista['destaque_evento'] == 'Sim'){
echo("<span class='glyphicon glyphicon-star'></span>");
}else if ($row_eventos_lista['destaque_evento']== 'Nao'){
echo("<span class='glyphicon glyphicon-star-empty'></span>");
}?>
</td>
<td class="esconde">
<a href="evento_altera.php?id_evento=<?php echo $row_eventos_lista['id_evento']?>"><button class="btn btn-primary btn-xs btn-block"><span class="glyphicon glyphicon-pencil"></span></button></a>
</td>
<td class="esconde">
<a href="evento_deleta.php?id_evento=<?php echo $row_eventos_lista['id_evento']?>"><button class="btn btn-danger btn-xs btn-block"><span class="glyphicon glyphicon-trash"></span></button></a>
</td>
</tr>
<?php } while ($row_eventos_lista = mysql_fetch_assoc($eventos_lista)); ?>
</tbody>
</table>
</section>
<div class="modal-footer">
<center><button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button></center>
</div>
</div>
</div>
</div>
</div>
<!-- fim Listar Eventos -->
<!-- Modal Eventos Insere -->
<div class="modal fade" id="modaleventosinsere" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"><b>Listar Eventos</b></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<section id="insere_centro" class="container-fluid">
<section id="form" class="container">
<section class="col-sm-5">
<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>
</section>
</div>
</div>
</div>
</div>
<!-- Final eventos insere -->
<nav>
<?php include("menu_adm.php"); ?>
</nav>
<main class="container">
<section>
<hr>
<h1 id="h1areaadm">Área administrativa</h1>
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="thumbnail thumbnailadm">
<img src="../imagens/user.png" width="250px" height="250px" alt="...">
</center>
<br>
<center><font id="admimagens" size="5px" ><b>Usuários</b></font></center>
<br>
<div class="alert alert-success" role="alert">
<div class="btn-group btn-group-justified" role="group">
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modalusuarios" type="button" class="btn btn-default">Listar</button>
</div>
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modalinsereusuarios" type="button" class="btn btn-default">Inserir</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="thumbnail thumbnailadm">
<img src="../imagens/tipos evento.png" width="250px" height="250px" alt="">
<br>
<center><font id="admimagens2" size="5px"><b>Categorias de Eventos</b></font></center>
<br>
<div class="alert alert-success" role="alert">
<div class="btn-group btn-group-justified" role="group">
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modalcategoria" type="button" class="btn btn-default">Listar</button>
</div>
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modalinserircateventos" type="button" class="btn btn-default">Inserir</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="thumbnail thumbnailadm">
<img src="../imagens/eventos.png" width="250px" height="250px" alt="">
<br>
<center><font id="admimagens3" size="5px" ><b>Eventos</b></font></center>
<br>
<div class="alert alert-success" role="alert">
<div class="btn-group btn-group-justified" role="group">
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modallistareventos" type="button" class="btn btn-default">Listar</button>
</div>
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modaleventosinsere" type="button" class="btn btn-default">Inserir</button
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
<script src="../bootstrap/jquery.min.js"></script>
<script src="../bootstrap/js/bootstrap.min.js"></script>
</body>
<center><font size="2px" color="white">© 2019 SustentaItape - Sustentabilidade. Todos os direitos reservados.</font></center>
</html>

564
admin/backups/index-bkp.php Executable file
View File

@ -0,0 +1,564 @@
<?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;
}
}
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_usuarios_lista = "SELECT * FROM tbusuarios";
$usuarios_lista = mysql_query($query_usuarios_lista, $conn_sustentabilidade) or die(mysql_error());
$row_usuarios_lista = mysql_fetch_assoc($usuarios_lista);
$totalRows_usuarios_lista = mysql_num_rows($usuarios_lista);
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form-usuarios-insere")) {
$insertSQL = sprintf("INSERT INTO tbusuarios (login_usuario, senha_usuario, nivel_usuario) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['login_usuario'], "text"),
GetSQLValueString($_POST['senha_usuario'], "text"),
GetSQLValueString($_POST['nivel_usuario'], "text"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($insertSQL, $conn_sustentabilidade) or die(mysql_error());
$insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
#TiposLista
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_tipos_lista = "SELECT * FROM tbtipos";
$tipos_lista = mysql_query($query_tipos_lista, $conn_sustentabilidade) or die(mysql_error());
$row_tipos_lista = mysql_fetch_assoc($tipos_lista);
$totalRows_tipos_lista = mysql_num_rows($tipos_lista);
#fim
#InsereEventos
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form_tipo_insere")) {
$insertSQL = sprintf("INSERT INTO tbtipos (sigla_tipo, rotulo_tipo) VALUES (%s, %s)",
GetSQLValueString($_POST['sigla_tipo'], "text"),
GetSQLValueString($_POST['rotulo_tipo'], "text"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($insertSQL, $conn_sustentabilidade) or die(mysql_error());
$insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
#Fim
#ListarEventos
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_eventos_lista = "SELECT * FROM vw_tbeventos";
$eventos_lista = mysql_query($query_eventos_lista, $conn_sustentabilidade) or die(mysql_error());
$row_eventos_lista = mysql_fetch_assoc($eventos_lista);
$totalRows_eventos_lista = mysql_num_rows($eventos_lista);
#Fim
#InserirEventos
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 = "index.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);
}
#Fim
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="../css/estilo.css" rel="stylesheet">
<link rel="stylesheet" href="../css/font-face/stylesheet.css">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<nav>
<?php include_once("menu_adm.php"); ?>
</nav>
<!-- Modal Listar Usuarios -->
<div class="modal fade" id="modalusuarios" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"><b>Listar Usuários</b></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="table-responsive">
<table id="mytable" class="table table-bordered table-striped">
<thead>
<th>Id</th>
<th>Login Usuário</th>
<th class="esconde600">Senha Usuário</th>
<th class="esconde600">Nivel Usúario</th>
<th colspan="2">
<p data-placement="top" data-toggle="tooltip" title="Delete">
</p>
</th>
</thead>
<tbody>
<?php do { ?>
<tr>
<td><?php echo $row_usuarios_lista['id_usuario']; ?></td>
<td><?php echo $row_usuarios_lista['login_usuario']; ?></td>
<td class="esconde600"><?php echo $row_usuarios_lista['senha_usuario']; ?></td>
<td class="esconde600"><?php echo $row_usuarios_lista['nivel_usuario']; ?></td>
<td>
<p data-placement="top" data-toggle="tooltip" title="Edit">
<a href="usuarios_altera.php?id_usuario=<?php echo $row_usuarios_lista['id_usuario']; ?>">
<button class="btn btn-primary btn-xs btn-block"><span class="glyphicon glyphicon-pencil"></span></button></a>
</td>
<td>
<p data-placement="top" data-toggle="tooltip" title="Delete"><a href="usuarios_exclui.php?id_usuario=<?php echo $row_usuarios_lista['id_usuario']?>"><button class="btn btn-danger btn-xs" ><span class="glyphicon glyphicon-trash"></span></button></a>
</p>
</td>
</tr>
<?php } while ($row_usuarios_lista = mysql_fetch_assoc($usuarios_lista)); ?>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<center><button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button></center>
</div>
</div>
</div>
</div>
</div>
<!-- Fim do Listar usuarios -->
<!-- Modal Inserir Usuarios -->
<div class="modal fade" id="modalinsereusuarios" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"><b>Usuários Insere</b></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="col-lg-12">
<hr>
<form name="form-usuarios-insere" action="<?php echo $editFormAction; ?>" method="POST" id="form_usuarios_insere" enctype="multipart/form-data">
<label for="nome_usuario">Nome:</label>
<p class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
<input name="login_usuario" class="form-control input" type="text" id="login_usuario" maxlength="30" required placeholder="Digite o seu login">
</p>
<label for="senha_usuario">Senha:</label>
<p class="input-group">
<span class="input-group-addon">
<i class="fas fa-lock"></i></span>
<input name="senha_usuario" class="form-control input" type="password" id="senha_usuario" maxlength="16" required placeholder="Digite sua senha">
</p>
<br>
<h5>
Nivel de Usúario:
<h5>
<p class="hidden"><b>Nível de Permissão:</b><br>
<p>
<input name="nivel_usuario" type="radio" id="nivel_usuario" value="sup" required>
<label for="nivel_usuario_sup">Super Usuário</label>
<br>
<input name="nivel_usuario" type="radio" id="nivel_usuario" value="com" required >
<label for="nivel_usuario_com"> <b>Usuário Comum</b></label>
</p>
<p><input class="btn btn-success " type="submit" value="Registrar">
<input type="hidden" name="MM_insert" value="form-usuarios-insere">
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Final Inserir Usuarios -->
<!-- Modal Alterar Usuarios -->
<!-- Final Alterar Usuarios -->
<!-- Modal Listar Categoria -->
<div class="modal fade" id="modalcategoria" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"><b>Categoria de Eventos</b></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<section class="container-fluid">
<section class="col-lg-12">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th class="esconde-xs-xs">Rotulo</th>
<th>Sigla</th>
</tr>
</thead>
<tbody>
<?php do { ?>
<tr>
<td class="esconde-xs-xs"><?php echo $row_tipos_lista['rotulo_tipo']?></td>
<td><?php echo $row_tipos_lista['sigla_tipo']?></td>
<td>
<a href="tipo_altera.php?id_tipo=<?php echo $row_tipos_lista['id_tipo']?>">
<button class="btn btn-primary btn-xs btn-block"><span class="glyphicon glyphicon-pencil"></span></button></a>
</td>
<td>
<a href="tipo_deleta.php?id_tipo=<?php echo $row_tipos_lista['id_tipo']?>"><button class="btn btn-danger btn-xs btn-block"><span class="glyphicon glyphicon-trash"></span></button></a>
</td>
</tr>
<?php } while ($row_tipos_lista = mysql_fetch_assoc($tipos_lista)); ?>
</tbody>
</table>
</div>
</section>
</section>
</div>
</div>
</div>
</div>
<!-- Final Modal Categoria -->
<!-- Modal Inserir cat Eventos -->
<div class="modal fade" id="modalinserircateventos" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"><b>Inserir Categoria</b></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<section id="insere_centro" class="container-fluid">
<section id="form" class="container">
<section class="col-sm-5">
<form name="form_tipo_insere" action="<?php echo $editFormAction; ?>" method="POST" id="form_rotulo_insere" enctype="multipart/form-data">
<label for="rotulo_tipo">Rótulo:</label>
<p class="input-group">
<span class="input-group-addon"></span>
<input name="rotulo_tipo" class="form-control input" type="text" id="rotulo_tipo" maxlength="15" required placeholder="Digite o rótulo">
</p>
<label for="sigla_tipo">Sigla:</label>
<p class="input-group">
<span class="input-group-addon"></span>
<input name="sigla_tipo" class="form-control input" type="text" id="sigla_tipo" maxlength="3" required placeholder="Digite uma sigla" >
</p>
<p>
<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="Inserir">
</div>
<div class="btn-group" role="group">
<input class="btn btn-danger btn-block" type="reset" value="Limpar">
</div>
</div>
</p>
<input type="hidden" name="MM_insert" value="form_tipo_insere">
</form>
</section>
</section>
</section>
</div>
</div>
</div>
</div>
<!-- Final inserir cat eventos -->
<!-- Listar Eventos -->
<div class="modal fade bs-example-modal-lg" id="modallistareventos" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"><b>Listar Eventos</b></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<section class="container">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Nome</th>
<th class="esconde">Local</th>
<th class="esconde600">Público</th>
<th class="esconde600">Tipo</th>
<th class="hidden-sm hidden-xs">Imagem</th>
<th class="hidden-xs">Descrição</th>
<th class="hidden-xs"></th>
<th class="esconde-xs-xs"></th>
<th class="hidden-sm hidden-md hidden-lg"></th>
</tr>
</thead>
<tbody>
<?php do { ?>
<tr>
<td><?php echo mb_strimwidth($row_eventos_lista['nome_evento'],0,10,"...");?></td>
<td class="esconde"><?php echo $row_eventos_lista['local_evento']?></td>
<td class="esconde600"><?php echo $row_eventos_lista['publico_evento']?></td>
<td class="esconde600"><?php echo $row_eventos_lista['rotulo_tipo']?></td>
<td class="hidden-sm hidden-xs"><img src="../imagens/<?php echo $row_eventos_lista['imagem_evento']?>" class="img-thumbnail" width="100px">
<a href="evento_imagem.php?id_evento=<?php echo $row_eventos_lista['id_evento']?>"><button class="btn btn-primary btn-xs btn-block"><span class="glyphicon glyphicon-pencil"></span>&nbsp;Alterar Img</button></a>
</td>
<td class="hidden-xs"><?php echo mb_strimwidth($row_eventos_lista['descr_evento'],0,30,"...")?></td>
<td class="esconde-xs-xs">
<?php if ($row_eventos_lista['destaque_evento'] == 'Sim'){
echo("<span class='glyphicon glyphicon-star'></span>");
}else if ($row_eventos_lista['destaque_evento']== 'Nao'){
echo("<span class='glyphicon glyphicon-star-empty'></span>");
}?>
</td>
<td class="">
<a href="evento_altera.php?id_evento=<?php echo $row_eventos_lista['id_evento']?>"><button class="btn btn-primary btn-xs btn-block"><span class="glyphicon glyphicon-pencil"></span></button></a>
<a href="evento_deleta.php?id_evento=<?php echo $row_eventos_lista['id_evento']?>"><button class="btn btn-danger btn-xs btn-block"><span class="glyphicon glyphicon-trash"></span></button></a>
</td>
<td class="hidden-sm hidden-md hidden-lg"><a href="../eventos_detalhe.php?id_evento=<?php echo $row_eventos_lista['id_evento'];?>" ><span class="glyphicon glyphicon-eye-open"></span></a></td>
</tr>
<?php } while ($row_eventos_lista = mysql_fetch_assoc($eventos_lista)); ?>
</tbody>
</table>
</section>
<div class="modal-footer">
<center><button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button></center>
</div>
</div>
</div>
</div>
</div>
<!-- fim Listar Eventos -->
<!-- Modal Eventos Insere -->
<div class="modal fade" id="modaleventosinsere" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"><b>Inserir Eventos</b></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<section id="insere_centro" class="container-fluid">
<section id="form" class="container">
<section class="col-sm-5">
<form name="form_evento_insere" action="<?php echo $editFormAction; ?>" method="POST" id="form_evento_insere" enctype="multipart/form-data">
<input type="hidden" name="id_usuario">
<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="1500"></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>
</section>
</div>
</div>
</div>
</div>
<!-- Final eventos insere -->
<main class="container">
<section>
<hr>
<h1 id="h1areaadm">Área administrativa</h1>
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="thumbnail thumbnailadm">
<img src="../imagens/user.png" width="250px" height="250px" alt="...">
</center>
<br>
<center><font id="admimagens" size="5px" ><b>Usuários</b></font></center>
<br>
<div class="alert alert-success" role="alert">
<div class="btn-group btn-group-justified" role="group">
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modalusuarios" type="button" class="btn btn-default">Listar</button>
</div>
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modalinsereusuarios" type="button" class="btn btn-default">Inserir</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="thumbnail thumbnailadm">
<img src="../imagens/tipos evento.png" width="250px" height="250px" alt="">
<br>
<center><font id="admimagens2" size="5px"><b>Categorias de Eventos</b></font></center>
<br>
<div class="alert alert-success" role="alert">
<div class="btn-group btn-group-justified" role="group">
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modalcategoria" type="button" class="btn btn-default">Listar</button>
</div>
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modalinserircateventos" type="button" class="btn btn-default">Inserir</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="thumbnail thumbnailadm">
<img src="../imagens/eventos.png" width="250px" height="250px" alt="">
<br>
<center><font id="admimagens3" size="5px" ><b>Eventos</b></font></center>
<br>
<div class="alert alert-success" role="alert">
<div class="btn-group btn-group-justified" role="group">
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modallistareventos" type="button" class="btn btn-default">Listar</button>
</div>
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modaleventosinsere" type="button" class="btn btn-default">Inserir</button
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
<script src="../bootstrap/jquery.min.js"></script>
<script src="../bootstrap/js/bootstrap.min.js"></script>
</body>
<center><font size="2px" color="white">© 2019 SustentaItape - Sustentabilidade. Todos os direitos reservados.</font></center>
</html>

104
admin/backups/tipo_insere.php Executable file
View File

@ -0,0 +1,104 @@
<?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_tipo_insere")) {
$insertSQL = sprintf("INSERT INTO tbtipos (id_tipo, sigla_tipo, rotulo_tipo) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['id_tipo'], "int"),
GetSQLValueString($_POST['sigla_tipo'], "text"),
GetSQLValueString($_POST['rotulo_tipo'], "text"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($insertSQL, $conn_sustentabilidade) or die(mysql_error());
$insertGoTo = "tipo_lista.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Tipos - Insere</title>
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<section id="topo" class="container-fluid">
<a href="tipo_lista.php"><h4><span class="glyphicon glyphicon-menu-left "></span> Voltar</h4></a>
<section id="titulo" class="container">
<h1>Tipos - Insere</h1>
<hr>
</section>
</section>
<section id="insere_centro" class="container-fluid">
<section id="form" class="container">
<form name="form_tipo_insere" action="<?php echo $editFormAction; ?>" method="POST" id="form_rotulo_insere" enctype="multipart/form-data">
<label for="rotulo_tipo">Rótulo:</label>
<p class="input-group">
<span class="input-group-addon"></span>
<input name="rotulo_tipo" class="form-control input" type="text" id="rotulo_tipo" maxlength="15" required placeholder="Digite o rótulo">
</p>
<label for="sigla_tipo">Sigla:</label>
<p class="input-group">
<span class="input-group-addon"></span>
<input name="sigla_tipo" class="form-control input" type="text" id="sigla_tipo" maxlength="3" required placeholder="Digite uma sigla" >
</p>
<p><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="Atualizar">
</div>
<div class="btn-group" role="group">
<input class="btn btn-danger btn-block" type="reset" value="Limpar">
</div>
</div></p>
<input type="hidden" name="MM_insert" value="form_tipo_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>

92
admin/backups/tipo_lista.php Executable file
View File

@ -0,0 +1,92 @@
<?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;
}
}
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_tipos_lista = "SELECT * FROM tbtipos";
$tipos_lista = mysql_query($query_tipos_lista, $conn_sustentabilidade) or die(mysql_error());
$row_tipos_lista = mysql_fetch_assoc($tipos_lista);
$totalRows_tipos_lista = mysql_num_rows($tipos_lista);
?>
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Tipos</title>
<!-- CSS do Bootstrap -->
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<?php include_once ("menu_adm.php");?>
<section class="container" id=tabela>
<h1>Tabela de Tipos</h1>
<hr>
<table class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Rotulo</th>
<th>Sigla</th>
<th colspan="2">
<a href="tipo_insere.php"><button class="btn btn-success btn-xs btn-block"><span class="glyphicon glyphicon-plus"></span>&nbsp;Inserir</button></a>
</th>
</tr>
</thead>
<tbody>
<?php do { ?>
<tr>
<td><?php echo $row_tipos_lista['rotulo_tipo']?></td>
<td><?php echo $row_tipos_lista['sigla_tipo']?></td>
<td>
<a href="tipo_altera.php?id_tipo=<?php echo $row_tipos_lista['id_tipo']?>"><button class="btn btn-primary btn-xs btn-block"><span class="glyphicon glyphicon-pencil"></span>&nbsp;Alterar</button>
</td>
<td>
<a href="tipo_deleta.php?id_tipo=<?php echo $row_tipos_lista['id_tipo']?>"><button class="btn btn-danger btn-xs btn-block"><span class="glyphicon glyphicon-trash"></span> &nbsp;Deletar</button></a>
</td>
</tr>
<?php } while ($row_tipos_lista = mysql_fetch_assoc($tipos_lista)); ?>
</tbody>
</table>
</table>
</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($tipos_lista);
?>

View File

@ -0,0 +1,58 @@
<?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;
}
}
if ((isset($_GET['id_usuario'])) && ($_GET['id_usuario'] != "")) {
$deleteSQL = sprintf("DELETE FROM tbusuarios WHERE id_usuario=%s",
GetSQLValueString($_GET['id_usuario'], "int"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($deleteSQL, $conn_sustentabilidade) or die(mysql_error());
$deleteGoTo = "usuarios_lista.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Documento sem título</title>
</head>
<body>
</body>
</html>

146
admin/backups/usuarios_insere.php Executable file
View File

@ -0,0 +1,146 @@
<!-- Alterações do código -->
<!-- 28/11/2018 -->
<!-- Consertei erros gramaticais -->
<?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-usuarios-insere")) {
$insertSQL = sprintf("INSERT INTO tbusuarios (id_usuario, login_usuario, senha_usuario, nivel_usuario) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['id_usuario'], "int"),
GetSQLValueString($_POST['login_usuario'], "text"),
GetSQLValueString($_POST['senha_usuario'], "text"),
GetSQLValueString($_POST['nivel_usuario'], "text"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($insertSQL, $conn_sustentabilidade) or die(mysql_error());
$insertGoTo = "usuarios_lista.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Usuarios Insere</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://getbootstrap.com/dist/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
</head>
<body>
<section class="container-fluid">
<section class="container">
<section class="col-xs-12 col-sm-offset col-sm-8 col-md-offset col-md-6 col-lg-offset-4 col-lg-4">
<h4><a href="usuarios_lista.php">Voltar</a></h4>
<h1>Usuários-Insere</h1>
<hr>
<form name="form-usuarios-insere" action="<?php echo $editFormAction; ?>" method="POST" id="form_usuarios_insere" enctype="multipart/form-data">
<input type="hidden" name="id_usuario">
<label for="nome_usuario">Nome:</label>
<p class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
<input name="login_usuario" class="form-control input" type="text" id="login_usuario" maxlength="30" required placeholder="Digite o seu login">
</p>
<label for="senha_usuario">Senha:</label>
<p class="input-group">
<span class="input-group-addon">
<i class="fas fa-lock"></i></span>
<input name="senha_usuario" class="form-control input" type="password" id="senha_usuario" maxlength="16" required placeholder="Digite sua senha">
</p>
<br>
<h5>Nivel de Usúario:<h5>
<p class="hidden"><b>Nível de Permissão:</b><br>
<p>
<input name="nivel_usuario" type="radio" id="nivel_usuario" value="sup" required>
<label for="nivel_usuario_sup">Super Usuário</label>
<br>
<input name="nivel_usuario" type="radio" id="nivel_usuario" value="com" required checked>
<label for="nivel_usuario_com"> <b>Usuário Comum</b></label>
</p>
<p><input class="btn btn-success " type="submit" value="Registrar">
&nbsp;&nbsp;&nbsp;&nbsp;
<input class="btn btn-danger " type="submit" value="Limpar"></p>
<input type="hidden" name="MM_insert" value="form-usuarios-insere">
</section>
</section>
</section>
</form>
</body>
</html>

107
admin/backups/usuarios_lista.php Executable file
View File

@ -0,0 +1,107 @@
<!-- Alterações do código -->
<!-- 28/11/2018 -->
<!-- Willian, não acha que seria melhor deixar a "Senha Usuario" um monte de ****, mesmo não sendo do tamanho correto da senha? Por motivos de segurança mesmo -->
<!-- Corrigi o "jeito" que os botões "alterar" e "deletar" aparecem. -->
<!-- 03/12/2018 -->
<!-- Corrigi o bootstrap, fiz ficar responsível o menu (tava carregando o bootstrap 3.3.0 e não o 3.3.7) -->
<?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;
}
}
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_usuarios_lista = "SELECT * FROM tbusuarios";
$usuarios_lista = mysql_query($query_usuarios_lista, $conn_sustentabilidade) or die(mysql_error());
$row_usuarios_lista = mysql_fetch_assoc($usuarios_lista);
$totalRows_usuarios_lista = mysql_num_rows($usuarios_lista);
?>
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Eventos</title>
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<?php include_once ("menu_adm.php");?>
<div class="container-fluid">
<h4>Usuários-Lista</h4>
<div class="table-responsive">
<table id="mytable" class="table table-bordered table-striped">
<thead>
<th>Id</th>
<th>Login Usuário</th>
<th>Senha Usuário</th>
<th>Nivel Usúario</th>
<th colspan="2"><p data-placement="top" data-toggle="tooltip" title="Delete">
<a href="usuarios_insere.php"><button class="btn btn-success btn-xs"><span class="glyphicon glyphicon-plus"></span>&nbsp;Inserir</button></a>
</p></th>
</thead>
<tbody>
<?php do { ?>
<tr>
<td><?php echo $row_usuarios_lista['id_usuario']; ?></td>
<td><?php echo $row_usuarios_lista['login_usuario']; ?></td>
<td><?php echo $row_usuarios_lista['senha_usuario']; ?></td>
<td><?php echo $row_usuarios_lista['nivel_usuario']; ?></td>
<td>
<p data-placement="top" data-toggle="tooltip" title="Edit">
<a href="usuarios_altera.php?id_usuario=<?php echo $row_usuarios_lista['id_usuario']?>"><button class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-pencil"></span>&nbsp;Alterar</button></a>
</p>
</td>
<td>
<p data-placement="top" data-toggle="tooltip" title="Delete"><a href="usuarios_exclui.php?id_usuario=<?php echo $row_usuarios_lista['id_usuario']?>"><button class="btn btn-danger btn-xs" ><span class="glyphicon glyphicon-trash"></span>&nbsp;Deletar</button></a>
</p>
</td>
</tr>
<?php } while ($row_usuarios_lista = mysql_fetch_assoc($usuarios_lista)); ?>
</tbody>
</table>
</div>
</div>
<!-- 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($usuarios_lista);
?>