Ver Mensaje Individual
  #4 (permalink)  
Antiguo 24/11/2014, 17:10
Avatar de geovannimendoza
geovannimendoza
 
Fecha de Ingreso: noviembre-2013
Mensajes: 15
Antigüedad: 10 años, 6 meses
Puntos: 0
Pregunta Respuesta: Iniciar sesión, pero el estado del usuario es desactivado

Hola danistrein definitivamente no puede con los header y muchísimo menos si el usuario esta en estado 1 ósea activo.

Por favor me regalas una ayuda, no soy experto en eso. gracias.

Tal vez sea porque utilizo DreamWeaver.

Código PHP:
<?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;

}
}

?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  
session_start();
}

$loginFormAction $_SERVER['PHP_SELF'];
if (isset(
$_GET['accesscheck'])) {
  
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset(
$_GET['recordSEG'])) {
$_SESSION['recordSEG']= $_GET["recordSEG"];
}



if (isset(
$_POST['strEmail'])) {
  
$loginUsername=$_POST['strEmail'];
  
$password=md5($_POST['strPassword']);
  
$MM_fldUserAuthorization "";
  
$MM_redirectLoginSuccess $_SESSION['PaginaActual']; 
  
$MM_redirectLoginFailed "".$_SESSION['recordSEG']."/error_de_acceso.html";
  
$MM_redirecttoReferrer false;
  
mysql_select_db($database_conexionzk$conexionzk);
  
  
$LoginRS__query=sprintf("SELECT idUsuario, strEmail, strPassword, intEstado FROM tblusuario WHERE strEmail=%s AND strPassword=%s AND intEstado = 1",
    
GetSQLValueString($loginUsername"text"), GetSQLValueString(    $password"text")); 
   
  
$LoginRS mysql_query($LoginRS__query$conexionzk) or die(mysql_error());
  
$row_LoginRS mysql_fetch_assoc($LoginRS);
  
$loginFoundUser mysql_num_rows($LoginRS);
  if (
$loginFoundUser) {
     
$loginStrGroup "";
    
    if (
PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    
//declare two session variables and assign them
    
$_SESSION['MM_Username'] = $loginUsername;
    
$_SESSION['MM_UserGroup'] = $loginStrGroup;     
    
$_SESSION['MM_IdUsuario'] = $row_LoginRS['idUsuario'];     

    if (isset(
$_SESSION['PrevUrl']) && false) {
      
$MM_redirectLoginSuccess $_SESSION['PrevUrl'];    
    }
    
header("Location: " $MM_redirectLoginSuccess );
  }
  else {
    
header("Location: "$MM_redirectLoginFailed );
  }
}

?>