[insert_php] require_once(‘Connections/pmextranet.php’); [/insert_php]
[insert_php]
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = “”;
$MM_donotCheckaccess = “true”;
// *** 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 == “”) && true) {
$isValid = true;
}
}
return $isValid;
}
// $MM_restrictGoTo = “login_adherente.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;
}
[/insert_php]
[insert_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;
}
}
$barra_usuario = "-1";
if (isset($_SESSION['MM_Barra'])) {
$barra_usuario = $_SESSION['MM_Barra'];
}
$colname_usuario = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_usuario = $_SESSION['MM_Username'];
}
mysql_select_db($database_pmextranet, $pmextranet);
$query_usuario = sprintf("SELECT
se_asociados.IDASOCIADO,
se_asociados.IDCLIENTE,
se_asociados.BARRA,
se_asociados.C_IDCLIENTE,
se_asociados.C_IDBARRA,
se_asociados.NOMBRE,
se_asociados.SEXO,
se_asociados.TIPODOCUM,
se_asociados.NRODOC,
se_asociados.ESTADOCIVIL,
se_clientes.PLANGERENCIADO
FROM
se_asociados
INNER JOIN se_clientes ON se_asociados.IDCLIENTE = se_clientes.IDCLIENTE WHERE C_IDCLIENTE = %s AND C_IDBARRA = %s AND FECHAEGRESO IS NULL", GetSQLValueString($colname_usuario, "text"),GetSQLValueString($barra_usuario, "text"));
$usuario = mysql_query($query_usuario, $pmextranet) or die(mysql_error());
$row_usuario = mysql_fetch_assoc($usuario);
$totalRows_usuario = mysql_num_rows($usuario);
[/insert_php]
<[insert_php] if($row_usuario['SEXO'] == 'M'){ echo('Bienvenido');} else { echo('Bienvenida'); } echo $row_usuario['NOMBRE']; echo $row_usuario['PLANGERENCIADO'];[/insert_php]
[insert_php]
mysql_free_result($usuario);
[/insert_php]