Ver Mensaje Individual
  #6 (permalink)  
Antiguo 14/07/2015, 14:14
Avatar de xfxstudios
xfxstudios
 
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 9 años, 4 meses
Puntos: 263
Respuesta: No permite acceso por link a usuarios si no estan logeados en mi web

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