Ver Mensaje Individual
  #85 (permalink)  
Antiguo 26/11/2011, 13:43
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

user_mod

Código PHP:
Ver original
  1. <?php
  2. $MM_authorizedUsers = "";
  3. $MM_donotCheckaccess = "true";
  4.  
  5. // *** Restrict Access To Page: Grant or deny access to this page
  6. function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
  7. // For security, start by assuming the visitor is NOT authorized.
  8. $isValid = False;
  9.  
  10. // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
  11. // Therefore, we know that a user is NOT logged in if that Session variable is blank.
  12. if (!empty($UserName)) {
  13. // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
  14. // Parse the strings into arrays.
  15. $arrUsers = Explode(",", $strUsers);
  16. $arrGroups = Explode(",", $strGroups);
  17. if (in_array($UserName, $arrUsers)) {
  18. $isValid = true;
  19. }
  20. // Or, you may restrict access to only certain users based on their username.
  21. if (in_array($UserGroup, $arrGroups)) {
  22. $isValid = true;
  23. }
  24. if (($strUsers == "") && true) {
  25. $isValid = true;
  26. }
  27. }
  28. return $isValid;
  29. }
  30.  
  31. $MM_restrictGoTo = "index.php";
  32. if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
  33. $MM_qsChar = "?";
  34. $MM_referrer = $_SERVER['PHP_SELF'];
  35. if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  36. if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
  37. $MM_referrer .= "?" . $QUERY_STRING;
  38. $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  39. header("Location: ". $MM_restrictGoTo);
  40. }
  41.  
  42. if (!function_exists("GetSQLValueString")) {
  43. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  44. {
  45. if (PHP_VERSION < 6) {
  46. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  47. }
  48.  
  49. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  50.  
  51. switch ($theType) {
  52. case "text":
  53. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  54. break;
  55. case "long":
  56. case "int":
  57. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  58. break;
  59. case "double":
  60. $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  61. break;
  62. case "date":
  63. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  64. break;
  65. case "defined":
  66. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  67. break;
  68. }
  69. return $theValue;
  70. }
  71. }
  72.  
  73. mysql_select_db($database_config, $config);
  74. $query_Recordset1 = "SELECT * FROM ft_usuarios";
  75. $Recordset1 = mysql_query($query_Recordset1, $config) or die(mysql_error());
  76. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  77. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  78. mysql_free_result($Recordset1);
  79. ?>