Created
September 4, 2014 03:03
-
-
Save brunoziie/07a2d52ff827715e9944 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php require_once('../Connections/conexao.php'); ?> | |
<?php | |
if (!isset($_SESSION)) { | |
session_start(); | |
} | |
$MM_authorizedUsers = "2,3"; | |
$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 = "../home.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($QUERY_STRING) && strlen($QUERY_STRING) > 0) | |
$MM_referrer .= "?" . $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_insert"])) && ($_POST["MM_insert"] == "formperfil")) { | |
$insertSQL = sprintf("INSERT INTO historico (USUARIO_idUSUARIO, dataHISTORICO, descricaoHISTORICO) VALUES (%s, %s, %s)", | |
GetSQLValueString($_SESSION['MM_UserId'], "int"), | |
GetSQLValueString(date('Y-m-d'), "date"), | |
GetSQLValueString("cadastrou um perfil ".$_POST['perfil'], "text")); | |
mysql_select_db($database_conexao, $conexao); | |
$Result1 = mysql_query($insertSQL, $conexao) or die(mysql_error()); | |
} | |
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formperfil")) { | |
$insertSQL = sprintf("INSERT INTO grupo (nomeGRUPO) VALUES (%s)", | |
GetSQLValueString($_POST['perfil'], "text")); | |
mysql_select_db($database_conexao, $conexao); | |
$Result1 = mysql_query($insertSQL, $conexao) or die(mysql_error()); | |
$insertGoTo = "perfil.php?perfil=ok"; | |
if (isset($_SERVER['QUERY_STRING'])) { | |
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; | |
$insertGoTo .= $_SERVER['QUERY_STRING']; | |
} | |
header(sprintf("Location: %s", $insertGoTo)); | |
} | |
$maxRows_verPerfil = 3; | |
$pageNum_verPerfil = 0; | |
if (isset($_GET['pageNum_verPerfil'])) { | |
$pageNum_verPerfil = $_GET['pageNum_verPerfil']; | |
} | |
$startRow_verPerfil = $pageNum_verPerfil * $maxRows_verPerfil; | |
mysql_select_db($database_conexao, $conexao); | |
$query_verPerfil = "SELECT * FROM grupo ORDER BY nomeGRUPO ASC"; | |
$query_limit_verPerfil = sprintf("%s LIMIT %d, %d", $query_verPerfil, $startRow_verPerfil, $maxRows_verPerfil); | |
$verPerfil = mysql_query($query_limit_verPerfil, $conexao) or die(mysql_error()); | |
$row_verPerfil = mysql_fetch_assoc($verPerfil); | |
if (isset($_GET['totalRows_verPerfil'])) { | |
$totalRows_verPerfil = $_GET['totalRows_verPerfil']; | |
} else { | |
$all_verPerfil = mysql_query($query_verPerfil); | |
$totalRows_verPerfil = mysql_num_rows($all_verPerfil); | |
} | |
$totalPages_verPerfil = ceil($totalRows_verPerfil/$maxRows_verPerfil)-1; | |
$maxRows_infoPerfil = 10; | |
$pageNum_infoPerfil = 0; | |
if (isset($_GET['pageNum_infoPerfil'])) { | |
$pageNum_infoPerfil = $_GET['pageNum_infoPerfil']; | |
} | |
$startRow_infoPerfil = $pageNum_infoPerfil * $maxRows_infoPerfil; | |
mysql_select_db($database_conexao, $conexao); | |
$query_infoPerfil = "SELECT * FROM grupo ORDER BY nomeGRUPO ASC"; | |
$query_limit_infoPerfil = sprintf("%s LIMIT %d, %d", $query_infoPerfil, $startRow_infoPerfil, $maxRows_infoPerfil); | |
$infoPerfil = mysql_query($query_limit_infoPerfil, $conexao) or die(mysql_error()); | |
$row_infoPerfil = mysql_fetch_assoc($infoPerfil); | |
if (isset($_GET['totalRows_infoPerfil'])) { | |
$totalRows_infoPerfil = $_GET['totalRows_infoPerfil']; | |
} else { | |
$all_infoPerfil = mysql_query($query_infoPerfil); | |
$totalRows_infoPerfil = mysql_num_rows($all_infoPerfil); | |
} | |
$totalPages_infoPerfil = ceil($totalRows_infoPerfil/$maxRows_infoPerfil)-1; | |
?> | |
<?PHP require_once("../config.php"); ?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/geral_root.dwt.php" codeOutsideHTMLIsLocked="false" --> | |
<head> | |
<!-- Latest compiled and minified CSS --> | |
<link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css"> | |
<!-- Optional theme --> | |
<link rel="stylesheet" href="../bootstrap/css/bootstrap-theme.min.css"> | |
<!-- Latest compiled and minified JavaScript --> | |
<script src="../bootstrap/js/bootstrap.min.js"></script> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<!-- InstanceBeginEditable name="doctitle" --> | |
<title>SCRUM MANAGER</title> | |
<!-- InstanceEndEditable --> | |
<!-- InstanceBeginEditable name="head" --> | |
<!-- InstanceEndEditable --> | |
<style type="text/css"> | |
<!-- | |
body { | |
background-color: #EEE; | |
} | |
--> | |
</style></head> | |
<body> | |
<p class="bg-primary"><BR /><img src="../img/logo.png" width="254" height="148" alt="SCRUM MANAGER" /><BR /><BR /></p> | |
<!-- InstanceBeginEditable name="menugeral" --> | |
<ul class="nav nav-tabs" role="tablist"> | |
<li><a href="../home.php">Home</a></li> | |
<li><a href="#">Projetos</a></li> | |
<li><a href="#">Usuarios</a></li> | |
<li class="active"><a href="#">Perfil</a></li> | |
<li class="navbar-text navbar-right">Logando com <?php echo $_SESSION['MM_Username']; ?></li> | |
</ul> | |
<!-- InstanceEndEditable --> | |
<div class="jumbotron"> | |
<h3> | |
<!-- InstanceBeginEditable name="subtitulo" -->PERFIL USUARIO<br /> | |
<h6> | |
<?PHP | |
if(isset($_GET["perfil"])){ | |
if ($_GET["perfil"] == "erro"){ | |
echo "<div class=\"alert alert-danger\" role=\"alert\">ERRO AO CADASTRAR UM PERFIL!</div>"; | |
}else if ($_GET["perfil"] == "ok"){ | |
echo "<div class=\"alert alert-success\" role=\"alert\">PERFIL CADASTRADO COM SUCESSO!</div>"; | |
} | |
} | |
?> | |
</h6> | |
<!-- InstanceEndEditable --> | |
</h3> | |
<p><div class="panel panel-default"> | |
<div class="panel-body"> | |
<!-- InstanceBeginEditable name="conteudo" --> | |
<table width="100%" border="0"> | |
<tr> | |
<td width="60%" valign="top"><table width="98%" border="0"> | |
<tr> | |
<td><div class="panel panel-primary"> | |
<div class="panel-heading"> | |
<h5># PERFIS DISPONIVEIS</h5> | |
</div> | |
<div class="panel-body"> | |
<table width="100%" class="table table-striped"> | |
<?php do { ?> | |
<tr> | |
<td width="61%"><?php echo $row_verPerfil['nomeGRUPO']; ?></td> | |
</tr> | |
<?php } while ($row_verPerfil = mysql_fetch_assoc($verPerfil)); ?> | |
</table> | |
</div> | |
</div></td> | |
</tr> | |
</table></td> | |
<td valign="top"><table width="100%" border="0"> | |
<tr> | |
<td><div class="panel panel-default"> | |
<div class="panel-heading"> | |
<h5># INFORMAÇÕES DOS PIRFIS</h5> | |
</div> | |
<table width="100%" class="table table-striped"> | |
<?php do { ?> | |
<tr> | |
<td><span class="h4"><?php echo $row_infoPerfil['nomeGRUPO']; ?></span><br /> | |
<br /> | |
<span class="h6"><?php echo $row_infoPerfil['descGRUPO']; ?></span><br /></td> | |
</tr> | |
<?php } while ($row_infoPerfil = mysql_fetch_assoc($infoPerfil)); ?> | |
</table> | |
</div> | |
</td> | |
</tr> | |
<tr> | |
<td> </td> | |
</tr> | |
</table></td> | |
</tr> | |
</table> | |
<!-- InstanceEndEditable --> | |
</div> | |
</div> | |
</p> | |
</div> | |
</body> | |
<!-- InstanceEnd --> | |
</html> | |
<?php | |
mysql_free_result($verPerfil); | |
mysql_free_result($infoPerfil); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment