Ver Mensaje Individual
  #5 (permalink)  
Antiguo 14/10/2010, 08:46
servidigital
 
Fecha de Ingreso: abril-2010
Mensajes: 182
Antigüedad: 14 años, 1 mes
Puntos: 8
Respuesta: restringir acceso a cierto contenido

gracias.
mira encontre este codigo
Código PHP:
Ver original
  1. <?php
  2. if (!isset($_SESSION)) {
  3. }
  4. $MM_authorizedUsers = "alto";
  5. $MM_donotCheckaccess = "false";
  6.  
  7. // *** Restrict Access To Page: Grant or deny access to this page
  8. function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
  9.   // For security, start by assuming the visitor is NOT authorized.
  10.   $isValid = False;
  11.  
  12.   // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
  13.   // Therefore, we know that a user is NOT logged in if that Session variable is blank.
  14.   if (!empty($UserName)) {
  15.     // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
  16.     // Parse the strings into arrays.
  17.     $arrUsers = Explode(",", $strUsers);
  18.     $arrGroups = Explode(",", $strGroups);
  19.     if (in_array($UserName, $arrUsers)) {
  20.       $isValid = true;
  21.     }
  22.     // Or, you may restrict access to only certain users based on their username.
  23.     if (in_array($UserGroup, $arrGroups)) {
  24.       $isValid = true;
  25.     }
  26.     if (($strUsers == "") && false) {
  27.       $isValid = true;
  28.     }
  29.   }
  30.   return $isValid;
  31.  
  32. }
  33.  
  34. $MM_restrictGoTo = "../main.php";
  35. if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {  
  36.   $MM_qsChar = "?";
  37.   $MM_referrer = $_SERVER['PHP_SELF'];
  38.   if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  39.   if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
  40.   $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  41.   $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  42.   header("Location: ". $MM_restrictGoTo);  
  43.   exit;
  44. }
  45. ?>

este codigo sirve me dirrecciona a otro pagina al empleado pero lo unico q me falta es que me envie una alerta o algo que le diga al empleado que no tiene acceso a ese modulo o algo asi espero me ayuden gracias