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

Ya realize de cero no me vota errores pero en la pagina de recibo no me muestra las variables de sesion: MM_NumIngreso, MM_UltimoIngreso, MM_IngresoHora. ALguien ayudeme a ver que me hace falta, gracias

este es el codigo donde logueo:


Código PHP:
<?php require_once('../Connections/conex.php'); ?>
<?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;
}
}
?>
<?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(
$_POST['Usuario'])) {
  
$loginUsername=$_POST['Usuario'];
  
$password=$_POST['Password'];
  
$MM_fldUserAuthorization "Estatus";
  
$MM_redirectLoginSuccess "PanelControl/Administradores/Validar.php";
  
$MM_redirectLoginFailed "Admin.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")); 
   
  
$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;          

    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">
    <style type="text/css">
<!--
.Estilo1 {
    color: #FFFFFF;
    font-weight: bold;
}
-->
    </style>
</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="http://www.forosdelweb.com/f18/images/logo.gif" with="154" height="74" alt="" title=""/></a>
                                        
                                        
                              <ul class="navigation">
                                                <li><a  href="http://www.forosdelweb.com/f18/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="http://www.forosdelweb.com/f18/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 action="<?php echo $loginFormAction?>" method="POST" name="form1" class="Estilo1">
Usuario:
  <label>
  <input type="text" name="Usuario" id="Usuario">
  </label>
<p>Contrase&ntilde;a:
<label>
                                                         <input type="text" name="Password" id="Password">
                                                         </label>
                                                       </p>
                                                       <p>
                                                         <label>
                                                         <input type="submit" name="Logearse" id="Logearse" value="Enviar">
                                                         </label>
                                                       </p>
                                                     </form>
                                                   </li>
                                                 </ul>
                                               </ul>
                </div>
                              </div>
                            </div>
                        </div>
                     </div>
                     <div class="shadow">
                     </div>
              </div>    
      </div>    
    
</body>
</html>
y este donde recibo:

Código PHP:
<?php

  session_start
();


?>

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Insertar datos en MySQL</title>
<style type="text/css">
    <!--
    body {
        font-family: "Trebuchet MS", Tahoma, Arial;
        font-size: 12px;
        color: #333333;
    }
    h2 {
        font-size: 16px;
        color: #CC0000;
    }
    input, select {
        font-family: "Trebuchet MS", Tahoma, Arial;
        font-size: 11px;
        color: #666666;
    }
    -->
    </style>
</head>
<body>
<p><strong>Bienvenido:</strong>  <?php echo $_SESSION['MM_Username']; ?></p>
<p><strong>Permiso:</strong> <?php echo $_SESSION['MM_UserGroup']; ?></p>
<p><strong>Nombres:<?php echo $_SESSION['MM_Nombres']; ?></strong></p>
<p><strong>Numero ingresos:</strong><?php echo $_SESSION['MM_NumIngreso']; ?></p>
<p><strong>Dia de ultimo ingreso:</strong><?php echo $_SESSION['MM_UltimoIngreso']; ?></p>
<p><strong>Hora de Ultimo ingreso:</strong><?php echo $_SESSION['MM_IngresoHora']; ?></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>