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

45
admin/acesso.php Executable file
View File

@@ -0,0 +1,45 @@
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "com,sup";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && false) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>

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);
?>

177
admin/evento_altera.php Executable file
View File

@@ -0,0 +1,177 @@
<?php require_once('../Connections/conn_sustentabilidade.php'); ?>
<?php include('acesso.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_update"])) && ($_POST["MM_update"] == "form_evento_insere")) {
$updateSQL = sprintf("UPDATE tbeventos SET nome_evento=%s, local_evento=%s, publico_evento=%s, descr_evento=%s, destaque_evento=%s, tipo_evento=%s WHERE id_evento=%s",
GetSQLValueString($_POST['nome_evento'], "text"),
GetSQLValueString($_POST['local_evento'], "text"),
GetSQLValueString($_POST['publico_evento'], "text"),
GetSQLValueString($_POST['descr_evento'], "text"),
GetSQLValueString($_POST['destaque_evento'], "text"),
GetSQLValueString($_POST['tipo_evento'], "int"),
GetSQLValueString($_POST['id_evento'], "int"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($updateSQL, $conn_sustentabilidade) or die(mysql_error());
$updateGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_atualiza_evento = "-1";
if (isset($_GET['id_evento'])) {
$colname_atualiza_evento = $_GET['id_evento'];
}
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_atualiza_evento = sprintf("SELECT * FROM tbeventos WHERE id_evento = %s", GetSQLValueString($colname_atualiza_evento, "int"));
$atualiza_evento = mysql_query($query_atualiza_evento, $conn_sustentabilidade) or die(mysql_error());
$row_atualiza_evento = mysql_fetch_assoc($atualiza_evento);
$totalRows_atualiza_evento = mysql_num_rows($atualiza_evento);
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_select_tipo = "SELECT * FROM tbtipos";
$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);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Evento - Altera</title>
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<nav>
<?php include("menu_adm.php"); ?>
</nav>
<section id="topo" class="container-fluid">
<section id="titulo" class="container">
<h1>Evento - Altera</h1>
<hr>
</section>
</section>
<section id="insere_centro" class="container-fluid">
<section id="form" class="container">
<form action="<?php echo $editFormAction; ?>" name="form_evento_insere" method="POST" id="form_evento_insere" enctype="multipart/form-data">
<input type="hidden" name="id_evento" id="id_evento" value="<?php echo $row_atualiza_evento['id_evento']; ?>">
<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" value="<?php echo $row_atualiza_evento['nome_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" value="<?php echo $row_atualiza_evento['publico_evento']?>">
</p>
<label for="tipo_evento">Tipo:</label>
<select name="tipo_evento" id="tipo_evento" required>
<?php do { ?>
<option value="<?php echo $row_select_tipo['id_tipo']?>"<?php if(!(strcmp($row_select_tipo['id_tipo'],$row_atualiza_evento['tipo_evento']))) {echo "selected=\selected\"";} ?>>
<?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.: Todos" value="<?php echo $row_atualiza_evento['local_evento']?>">
</p>
<label for="descr_evento">Descrição:</label>
<p class="input-group">
<textarea name="descr_evento" id="descr_evento" cols="35" rows="5" maxlength="1500"><?php echo $row_atualiza_evento['descr_evento']?></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 <?php echo ($row_atualiza_evento['destaque_evento']=="Sim") ? "active" : null; ?>">
<input name="destaque_evento" type="radio" id="destaque_evento" value="Sim" <?php echo ($row_atualiza_evento['destaque_evento']=="Sim") ? "checked" : null; ?> required> Sim
</label>
<label class="btn btn-warning <?php echo ($row_atualiza_evento['destaque_evento']=="Nao") ? "active" : null; ?>">
<input name="destaque_evento" type="radio" id="destaque_evento" value="Nao" <?php echo ($row_atualiza_evento['destaque_evento']=="Nao") ? "checked" : null; ?> required> Não
</label>
</div>
</div>
<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_update" 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($atualiza_evento);
mysql_free_result($select_tipo);
?>

49
admin/evento_deleta.php Executable file
View File

@@ -0,0 +1,49 @@
<?php require_once('../Connections/conn_sustentabilidade.php'); ?>
<?php include('acesso.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_evento'])) && ($_GET['id_evento'] != "")) {
$deleteSQL = sprintf("DELETE FROM tbeventos WHERE id_evento=%s",
GetSQLValueString($_GET['id_evento'], "int"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($deleteSQL, $conn_sustentabilidade) or die(mysql_error());
$deleteGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
?>

126
admin/evento_imagem.php Executable file
View File

@@ -0,0 +1,126 @@
<?php require_once('../Connections/conn_sustentabilidade.php'); ?>
<?php include('acesso.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_update"])) && ($_POST["MM_update"] == "form_evento_atualiza")) {
$updateSQL = sprintf("UPDATE tbeventos SET imagem_evento=%s WHERE id_evento=%s",
GetSQLValueString($_FILES['imagem_evento']['name'], "text"),
GetSQLValueString($_POST['id_evento'], "int"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($updateSQL, $conn_sustentabilidade) or die(mysql_error());
$updateGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_atualiza_imagem = "-1";
if (isset($_GET['id_evento'])) {
$colname_atualiza_imagem = $_GET['id_evento'];
}
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_atualiza_imagem = sprintf("SELECT * FROM tbeventos WHERE id_evento = %s", GetSQLValueString($colname_atualiza_imagem, "int"));
$atualiza_imagem = mysql_query($query_atualiza_imagem, $conn_sustentabilidade) or die(mysql_error());
$row_atualiza_imagem = mysql_fetch_assoc($atualiza_imagem);
$totalRows_atualiza_imagem = mysql_num_rows($atualiza_imagem);
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 lang="pt-br">
<head>
<meta charset="utf-8">
<title>Evento - Altera Imagem</title>
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<nav>
<?php include("menu_adm.php"); ?>
</nav>
<section>
<h4> <a href="index.php">Voltar</a></h4>
<h1>Alterar Imagem</h1>
<article>
<img src="../imagens/<?php echo $row_atualiza_imagem['imagem_evento']; ?>" alt="" width="300px">
<form action="<?php echo $editFormAction; ?>" enctype="multipart/form-data" method="POST" name="form_evento_imagem">
<input type="hidden" name="id_evento" id="id_evento" value="<?php echo $row_atualiza_imagem['id_evento']; ?>">
<p>
Escolha o arquivo:
<input type="file" name="imagem_evento" id="imagem_evento" required>
</p>
<p>
<input type="submit" value="Atualizar" name="enviar" id="enviar">
</p>
<input type="hidden" name="MM_update" value="form_evento_atualiza">
</form>
</article>
</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($atualiza_imagem);
?>

568
admin/index.php Executable file
View File

@@ -0,0 +1,568 @@
<?php require_once('../Connections/conn_sustentabilidade.php'); ?>
<?php include("acesso.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>
<?php if($_SESSION['MM_UserGroup'] == 'sup') : ?>
<!-- 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">
<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" style="color:black;">Fechar</button></center>
</div>
</div>
</div>
</div>
</div>
<!-- Fim do Listar usuarios -->
<?php endif; ?>
<?php if($_SESSION['MM_UserGroup'] == 'sup') : ?>
<!-- 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">
<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 -->
<?php endif;?>
<!-- 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">
<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">
<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" style="color:black;">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 <?php if($_SESSION['MM_UserGroup'] == 'com'){ echo "disabled";}?>">Listar</button>
</div>
<div class="btn-group" role="group">
<button data-toggle="modal" data-target="#modalinsereusuarios" type="button" class="btn btn-default <?php if($_SESSION['MM_UserGroup'] == 'com'){ echo "disabled";}?>">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>

70
admin/invasor-user.php Executable file
View File

@@ -0,0 +1,70 @@
<?php include('acesso.php')?>
<!doctype html>
<html>
<head>
<!-- <meta http-equiv="refresh" content="30;URL=../index.php">-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Erro no Login</title>
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="../css/estilo.css" rel="stylesheet" type="text/css">
<link href="../css/font-face/stylesheet.css" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<main class="capa">
<section>
<article>
<div class="row">
<!-- DIV USUÁRIOS -->
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3" >
<h1 class="breadcrumb text-danger text-center">Atenção!</h1>
<div class="thumbnail text-center">
<p class="text-danger">
<i class="fa fa-user fa-4x"></i>
<i class="fa fa-exclamation fa-3x"></i>
</p>
<br>
<div class="alert" role="alert">
<h4>USUÁRIO NÃO AUTORIZADO</h4>
<p>
<a class="btn btn-custom btn-danger" href="index.php"><span class="glyphicon glyphicon-lock"></span>&nbsp;Área Administrativa</a>
<a class="btn btn-custom btn-green espacado" href="../index.php"><span class="glyphicon glyphicon-log-out"></span>&nbsp;Área Pública</a>
</p>
<p><br>
Caso não faça uma escolha em 30 segundos será redirecionado automaticamente para página inicial.
</p>
</div>
</div>
</div>
</div>
</article>
</section>
</main>
<!-- 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>

69
admin/invasor.php Executable file
View File

@@ -0,0 +1,69 @@
<!doctype html>
<html>
<head>
<meta http-equiv="refresh" content="30;URL=../index.php">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Erro no Login</title>
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="../css/estilo.css" rel="stylesheet" type="text/css">
<link href="../css/font-face/stylesheet.css" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<main class="capa">
<section>
<article>
<div class="row">
<!-- DIV USUÁRIOS -->
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3" >
<h1 class="breadcrumb text-danger text-center">Atenção!</h1>
<div class="thumbnail text-center">
<span class="fa-stack fa-5x">
<i class="fa fa-user fa-stack-1x"></i>
<i class="fa fa-ban fa-stack-2x" style="color:#C80003"></i>
</span>
<br>
<div class="alert" role="alert">
<h4>Usuário ou senha Inválido</h4>
<p>
<a class="btn btn-custom btn-danger" href="login.php"><span class="glyphicon glyphicon-refresh"></span>&nbsp;Tentar Novamente</a>
<a class="btn btn-custom btn-green espacado" href="../index.php"><span class="glyphicon glyphicon-log-out"></span>&nbsp;Área Pública</a>
</p>
<p><br>
Caso não faça uma escolha em 30 segundos será redirecionado automaticamente para página inicial. Se não for redirecionado, <a href="../index.php">clique aqui</a>
</p>
</div>
</div>
</div>
</div>
</article>
</section>
</main>
<!-- 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>

69
admin/invasor_user.php Executable file
View File

@@ -0,0 +1,69 @@
<!doctype html>
<html>
<head>
<meta http-equiv="refresh" content="30;URL=../index.php">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Erro no Login</title>
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="../css/estilo.css" rel="stylesheet" type="text/css">
<link href="../css/font-face/stylesheet.css" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<main class="capa">
<section>
<article>
<div class="row">
<!-- DIV USUÁRIOS -->
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3" >
<h1 class="breadcrumb text-danger text-center">Atenção!</h1>
<div class="thumbnail text-center">
<p class="text-danger">
<i class="fa fa-user fa-4x"></i>
<i class="fa fa-exclamation fa-3x"></i>
</p>
<br>
<div class="alert" role="alert">
<h4>USUÁRIO NÃO AUTORIZADO</h4>
<p>
<a class="btn btn-custom btn-danger" href="index.php"><span class="glyphicon glyphicon-lock"></span>&nbsp;Área Administrativa</a>
<a class="btn btn-custom btn-green espacado" href="../index.php"><span class="glyphicon glyphicon-log-out"></span>&nbsp;Área Pública</a>
</p>
<p><br>
Caso não faça uma escolha em 30 segundos será redirecionado automaticamente para página inicial. Se não for redirecionado, <a href="../index.php">clique aqui</a>
</p>
</div>
</div>
</div>
</div>
</article>
</section>
</main>
<!-- 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>

152
admin/login.php Executable file
View File

@@ -0,0 +1,152 @@
<?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;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['login_usuario'])) {
$loginUsername=$_POST['login_usuario'];
$password=$_POST['senha_usuario'];
$MM_fldUserAuthorization = "nivel_usuario";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "invasor.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$LoginRS__query=sprintf("SELECT login_usuario, senha_usuario, nivel_usuario FROM tbusuarios WHERE login_usuario=%s AND senha_usuario=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $conn_sustentabilidade) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'nivel_usuario');
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="../css/estilo.css" rel="stylesheet" type="text/css">
<link href="../css/font-face/stylesheet.css" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous"><!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<main class="container">
<section>
<article>
<div class="row">
<!-- DIV USUÁRIOS -->
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3" style="margin-top: 15px;">
<div class="breadcrumb">
<h1 class="text-success text-center">Faça seu login</h1>
<hr>
<img src="../imagens/sustentaitape1.png" class="img-responsive" alt="...">
<br>
<div class="alert alert-success" role="alert">
<form METHOD="POST" action="<?php echo $loginFormAction; ?>" name="form_login" id="form_login">
<label for="login_usuario">Login</label>
<p class="input-group">
<span class="input-group-addon">
<i class="fa fa-user fa-lg text-success" aria-hidden="true"></i>
</span>
<input type="text" name="login_usuario" id="login_usuario" class="form-control input" placeholder="Digite seu Login">
</p>
<label for="senha_usuario">Senha</label>
<p class="input-group">
<span class="input-group-addon">
<i class="fa fa-key fa-lg text-success" aria-hidden="true"></i>
</span>
<input type="password" name="senha_usuario" id="senha_usuario" class="form-control input" placeholder="Digite sua senha">
</p>
<p class="text-right">
<input class="btn btn-custom btn-primary" type="submit" value="Entrar">
</p>
</form>
<hr>
<p class="text-center">
<a class="btn btn-custom btn-green " href="../index.php"><span class="glyphicon glyphicon-log-out"></span>&nbsp;Área Pública</a>
</p>
</div>
</div>
</div>
</div>
</article>
</section>
</main>
</body>
</html>

24
admin/logout.php Executable file
View File

@@ -0,0 +1,24 @@
<?php
// *** Logout the current user.
$logoutGoTo = "../index.php";
if (!isset($_SESSION)) {
session_start();
}
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
if ($logoutGoTo != "") {header("Location: $logoutGoTo");
exit;
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Documento sem título</title>
</head>
<body>
</body>
</html>

48
admin/menu_adm.php Executable file
View File

@@ -0,0 +1,48 @@
<!-- Comentários do código -->
<!-- Começei hoje, 28/11, o menu administrativo -->
<style>
.hamburgmenu{
color: white;
border: none;
}
.navbar-wf{
color: white !important;
background-color: darkgreen !important;
border-radius: 0;
}
.navbar-wf #linksadm a{
color: white;
background-color: darkgreen !important;
}
.navbar-wf #linksadm a:hover{
color: darkgreen !important;
background-color: white !important;
}
</style>
<nav class="navbar navbar-wf">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed hamburgmenu" data-toggle="collapse" data-target="#linksadm" aria-expanded="false" id="botaomenu">
<span class="glyphicon glyphicon-menu-hamburger"></span>
</button>
<a href='index.php' target='_SELF'><img src="../imagens/sustentaitape2.png" width="200px" alt=""></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="linksadm">
<ul class="nav navbar-nav navbar-right">
<li><a href="../index.php"><span class="glyphicon glyphicon-home"></span>&nbsp;&nbsp;Home</a></li>
<?php if (basename($_SERVER['PHP_SELF']) == 'index.php'){
echo "<li><a data-toggle='modal' data-target='#modalusuarios'>Usuários</a></li>
<li><a data-toggle='modal' data-target='#modalcategoria'>Tipos de Eventos</a></li>
<li><a data-toggle='modal' data-target='#modallistareventos'>Eventos</a></li>";
}else{
echo "<li><a href='index.php' target='_SELF'>Voltar</a></li>";
}?>
<li><a href="logout.php"><span class="glyphicon glyphicon-log-out"></span>&nbsp;&nbsp;Sair</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>

125
admin/tipo_altera.php Executable file
View File

@@ -0,0 +1,125 @@
<?php require_once('../Connections/conn_sustentabilidade.php'); ?>
<?php include('acesso.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_update"])) && ($_POST["MM_update"] == "form_tipo_insere")) {
$updateSQL = sprintf("UPDATE tbtipos SET sigla_tipo=%s, rotulo_tipo=%s WHERE id_tipo=%s",
GetSQLValueString($_POST['sigla_tipo'], "text"),
GetSQLValueString($_POST['rotulo_tipo'], "text"),
GetSQLValueString($_POST['id_tipo'], "int"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($updateSQL, $conn_sustentabilidade) or die(mysql_error());
$updateGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_atualiza_tipos = "-1";
if (isset($_GET['id_tipo'])) {
$colname_atualiza_tipos = $_GET['id_tipo'];
}
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_atualiza_tipos = sprintf("SELECT * FROM tbtipos WHERE id_tipo = %s", GetSQLValueString($colname_atualiza_tipos, "int"));
$atualiza_tipos = mysql_query($query_atualiza_tipos, $conn_sustentabilidade) or die(mysql_error());
$row_atualiza_tipos = mysql_fetch_assoc($atualiza_tipos);
$totalRows_atualiza_tipos = mysql_num_rows($atualiza_tipos);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Tipos - Insere</title>
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<nav>
<?php include("menu_adm.php"); ?>
</nav>
<section id="topo" class="container-fluid">
<section id="titulo" class="container">
<h1>Tipos - Altera</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">
<input type="hidden" name="id_tipo" id="id_tipo" value="<?php echo $row_atualiza_tipos['id_tipo'];?>">
<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" value="<?php echo $row_atualiza_tipos['rotulo_tipo']?>" 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" value="<?php echo $row_atualiza_tipos['sigla_tipo']?>"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>
<input type="hidden" name="MM_update" value="form_tipo_insere">
</p>
</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($atualiza_tipos);
?>

49
admin/tipo_deleta.php Executable file
View File

@@ -0,0 +1,49 @@
<?php require_once('../Connections/conn_sustentabilidade.php'); ?>
<?php include('acesso.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_tipo'])) && ($_GET['id_tipo'] != "")) {
$deleteSQL = sprintf("DELETE FROM tbtipos WHERE id_tipo=%s",
GetSQLValueString($_GET['id_tipo'], "int"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($deleteSQL, $conn_sustentabilidade) or die(mysql_error());
$deleteGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
?>

196
admin/usuarios_altera.php Executable file
View File

@@ -0,0 +1,196 @@
<?php require_once('../Connections/conn_sustentabilidade.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "sup";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && false) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "invasor_user.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?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_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 = "index.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);
?>
<!doctype html>
<html>
<!-- Alterações do código -->
<!-- 28/11/2018 -->
<!-- Willian, acertei o problema na hora de alterar, você deixou "atualiza_usuarios" e não "usuarios_atualiza" -->
<head>
<meta charset="utf-8">
<title>Usuarios Altera</title>
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<nav>
<?php include("menu_adm.php"); ?>
</nav>
<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">
<h1>Usuários-Altera</h1>
<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">
<span class="glyphicon glyphicon-lock"></span></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>
<!-- 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_atualiza);
?>

103
admin/usuarios_exclui.php Executable file
View File

@@ -0,0 +1,103 @@
<?php require_once('../Connections/conn_sustentabilidade.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "sup";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorizado($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && false) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "invasor_user.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorizado("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?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 = "index.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>