Ver Mensaje Individual
  #6 (permalink)  
Antiguo 30/07/2012, 09:53
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: Error al crear variable de sesion

lo estas haciendo mal , LO HAS PUESTO FUERA DE PHP.


Código PHP:
Ver original
  1. <?php
  2.  
  3. require_once('../Connections/conex.php');
  4.  
  5. if (!function_exists("GetSQLValueString")) {
  6. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  7. {
  8.   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. $loginFormAction = $_SERVER['PHP_SELF'];
  35. if (isset($_GET['accesscheck'])) {
  36.   $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  37. }
  38.  
  39. if (isset($_POST['Usuario'])) {
  40.   $loginUsername=$_POST['Usuario'];
  41.   $password=$_POST['Password'];
  42.   $MM_fldUserAuthorization = "Estatus";
  43.   $MM_redirectLoginSuccess = "PanelControl/Administradores/Validar.php";
  44.   $MM_redirectLoginFailed = "Error.php";
  45.   $MM_redirecttoReferrer = false;
  46.   mysql_select_db($database_conex, $conex);
  47.      
  48.   $LoginRS__query=sprintf("SELECT Usuario, Password, Estatus FROM usuarios WHERE Usuario=%s AND Password=%s",
  49.   GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  50.  
  51.   $row = mysql_fetch_assoc($LoginRS);//ESTO LO PUSE A VER SI FUNCIONABA
  52.   $LoginRS = mysql_query($LoginRS__query, $conex) or die(mysql_error());
  53.   $loginFoundUser = mysql_num_rows($LoginRS);
  54.   if ($loginFoundUser) {
  55.    
  56.     $loginStrGroup  = mysql_result($LoginRS,0,'Estatus');
  57.    
  58.     //declare two session variables and assign them
  59.     $_SESSION['MM_Username'] = $loginUsername;
  60.     $_SESSION['MM_UserGroup'] = $loginStrGroup;    
  61.     $_SESSION['MM_Nombres'] = $row['Nombres'];
  62.     $_SESSION['MM_NumIngreso'] = $row['NumIngreso'];//ESTO LO NECESITO IMPLEMENTAR
  63.     $_SESSION['MM_UltimoIngreso'] = $row['UltimoIngreso'];//ESTO LO NECESITO IMPLEMENTAR
  64.     $_SESSION['MM_IngresoHora'] = $row['IngresoHora'];//ESTO LO NECESITO IMPLEMENTAR
  65.  
  66.     if (isset($_SESSION['PrevUrl']) && false) {
  67.       $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];    
  68.     }
  69.     header("Location: " . $MM_redirectLoginSuccess );
  70.   }
  71.   else {
  72.     header("Location: ". $MM_redirectLoginFailed );
  73.   }
  74. }
  75. ?>

Última edición por webankenovi; 30/07/2012 a las 10:06