Ver Mensaje Individual
  #13 (permalink)  
Antiguo 30/07/2012, 11:57
Zota
 
Fecha de Ingreso: julio-2012
Mensajes: 51
Antigüedad: 11 años, 10 meses
Puntos: 0
Respuesta: Error al crear variable de sesion

El error esta en la apgina de logueo, como no se trabajar con variables de sesiones no se bieb donde esta el error.

Código PHP:
<?php
    session_start
();
     
    require_once(
'../Connections/conex.php');
     
    if (!
function_exists("GetSQLValueString")) {
    function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue "")
    {
      
$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;
    }
    }
     
    
$loginFormAction $_SERVER['PHP_SELF'];
    if (isset(
$_GET['accesscheck'])) {
      
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
    }
     
    if (isset(
$_POST['Usuario'])) {
      
$loginUsername=$_POST['Usuario'];
      
$password=$_POST['Password'];
      
$MM_fldUserAuthorization "Estatus";
      
$MM_redirectLoginSuccess "PanelControl/Administradores/Validar.php";
      
$MM_redirectLoginFailed "Error.php";
      
$MM_redirecttoReferrer false;
      
mysql_select_db($database_conex$conex);
         
      
$LoginRS__query=sprintf("SELECT Usuario, Password, Estatus FROM usuarios WHERE Usuario=%s AND Password=%s",
      
GetSQLValueString($loginUsername"text"), GetSQLValueString($password"text"));
     
      
$row mysql_fetch_assoc($LoginRS);//ESTO LO PUSE A VER SI FUNCIONABA
      
$LoginRS mysql_query($LoginRS__query$conex) or die(mysql_error());
      
$loginFoundUser mysql_num_rows($LoginRS);
      if (
$loginFoundUser) {
       
        
$loginStrGroup  mysql_result($LoginRS,0,'Estatus');
       
        
//declare two session variables and assign them
        
$_SESSION['MM_Username'] = $loginUsername;
        
$_SESSION['MM_UserGroup'] = $loginStrGroup;    
        
$_SESSION['MM_Nombres'] = $row['Nombres'];
        
$_SESSION['MM_NumIngreso'] = $row['NumIngreso'];//ESTO LO NECESITO IMPLEMENTAR
        
$_SESSION['MM_UltimoIngreso'] = $row['UltimoIngreso'];//ESTO LO NECESITO IMPLEMENTAR
        
$_SESSION['MM_IngresoHora'] = $row['IngresoHora'];//ESTO LO NECESITO IMPLEMENTAR
     
        
if (isset($_SESSION['PrevUrl']) && false) {
          
$MM_redirectLoginSuccess $_SESSION['PrevUrl'];    
        }
        
header("Location: " $MM_redirectLoginSuccess );
      }
      else {
        
header("Location: "$MM_redirectLoginFailed );
      }
    }
    
?>
<!DOCTYPE html >

<html>

<head>
    <title></title>
    <meta  charset="iso-8859-1" />
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
        <link href="css/ie6.css" rel="stylesheet" type="text/css" />
    <![endif]-->
    <!--[if IE 7]>
        <link href="css/ie7.css" rel="stylesheet" type="text/css" />  
    <![endif]-->
    <link href="../css/style.css" rel="stylesheet" type="text/css">
</head>

<body>

      <div id="background">
              <div id="page">
              
                     <div class="header">
                        <div class="footer">
                            <div class="body">
                                    <div id="sidebar">
                                        <a href="index.html"><img id="logo" src="../images/logo.gif" with="154" height="74" alt="" title=""/></a>
                                        
                                        
                              <ul class="navigation">
                                                <li><a  href="../index.php">INICIO</a></li>
                                <li ><a href="Guia/index.php" >CONSULTA</a></li>
                                <li class="active"><a href="Admin.php">ADMINISTRADOR</a></li>
                                              <li class="last"><a href="Usuarios.php">USUARIOS</a></li>
                                      </ul>
                                        
                                        <div class="connect">
                                             <a href="#" class="facebook">&nbsp;</a>
                                            <a href="#" class="twitter">&nbsp;</a>
                                            <a href="#" class="vimeo">&nbsp;</a>                                        </div>
                                        
                        <div class="footenote">
                                          <span>&copy; Copyright &copy; 2012.</span>
                                          <span>Petrominerales all rights reserved</span>                                        </div>
                                        
                              </div>
              <div id="content">
                                                <div class="content">
                                               <ul class="article">
                                                    <li><a href="#"><img src="../images/Icons/Panel/usario.png" width="48" height="48" alt="" title=""></a>
                                                      <h2><a href="about.html">IDENTIFICACI&Oacute;N EN EL SISTEMA DE ADMINISTRADOR.</a></h2>
                                                        <p>    
                                                           Por    favor    digite    su    nombre    de    usuario    y    contrase&ntilde;a    para    ser    validado    por    el    sistema.</p>
                                                 </li>
                                                    
                                                 <li>Digite: Usuario: admin - Contrase&ntilde;a: 123</li>
                                                 <ul>
                                                   <li>
                                                     <form name="form1" method="POST" action="<?php echo $loginFormAction?>">
                                                       <ul>
                                                         <li>Usuario:
                                                           <input type="text" name="Usuario" id="Usuario">
                                                           Contrase&ntilde;a:
                                                           <input type="password" name="Password" id="Password">
                                                           <input type="submit" name="button" id="button" value="Identificarse">
                                                         </li>
                                                       </ul>
                                                     </form>
                                                   </li>
                                                 </ul>
                                               </ul>
                </div>
                              </div>
                            </div>
                        </div>
                     </div>
                     <div class="shadow">
                     </div>
              </div>    
      </div>    
    
</body>
</html>