Tema: Sesiones
Ver Mensaje Individual
  #48 (permalink)  
Antiguo 09/06/2011, 16:22
ofertasdiariass
 
Fecha de Ingreso: mayo-2011
Mensajes: 38
Antigüedad: 12 años, 11 meses
Puntos: 4
Respuesta: Sesiones

PONGO MI PROBLEMA HABER SI ALGUIEN SE DA CUENTA QUE SUCEDE QUE NO CIERRA SESION?

-- Estructura de tabla para la tabla `userlist`

Base de Datos
Código MySQL:
Ver original
  1. -- Base de datos: `diarias`
  2. --
  3.  
  4.  
  5. CREATE TABLE IF NOT EXISTS `userlist` (
  6.   `userId` bigint(20) NOT NULL AUTO_INCREMENT,
  7.   `userName` varchar(255) NOT NULL,
  8.   `userPassword` varchar(255) NOT NULL,
  9.   PRIMARY KEY (`userId`)
  10. ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='List of Members' AUTO_INCREMENT=15 ;

los otros articulos. :

login.php

Código PHP:
Ver original
  1. <?php session_start();
  2. $_SESSION['isLoged']='isLoged';
  3. header("Location:micuenta.php");
  4. ?>
  5. <?php
  6.  
  7. /*
  8. This script was downloaded at:
  9. LightPHPScripts.com
  10. Please support us by visiting
  11. out website and letting people
  12. know of it.
  13. Produced under: LGPL
  14. */
  15.  
  16. /* Start session */
  17. if($startSession == TRUE){ session_start();}
  18.  
  19. /* Config file */
  20. include('config.php');
  21.  
  22. /* Check for submition */
  23. if($_POST['submitID'] == 1){
  24.    
  25.     /* Connect to database */
  26.     if($connectDatabase == TRUE){$action=TRUE;include('connect.php');}
  27.        
  28.     /* sanitize and check info */
  29.     $userName = mysql_real_escape_string($_POST['userName'],$dbc);
  30.     $password = mysql_real_escape_string($_POST['password'],$dbc);
  31.    
  32.     if($userName == NULL) { $message = 'Por favor ingrese nombre de usuario.';}
  33.     if($message == NULL && $password == NULL){ $message = 'Por favor, introduzca la Clave.';}
  34.    
  35.     if($message == NULL)
  36.     {              
  37.         $userQuery = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM " . $tableName .
  38.         " WHERE `" . $userNameField . "`='$userName' AND `" . $userPasswordField . "`='$password'"));      
  39.        
  40.         /* If usercount is more than 0 -> ok */
  41.         if($userQuery[0] > 0){
  42.             /* Disconnect from database */
  43.             if($connectDatabase == TRUE){$action=FALSE;include('connect.php');}
  44.    
  45.             $_SESSION['isLoged'] = 'yes';
  46.             $_SESSION['userName'] = $userName;
  47.            
  48.             /* add cookies ?*/
  49.             /* expire in 1 hour */
  50.             if($useCookies == TRUE)
  51.             {
  52.                 setcookie("isLoged", 'yes', time()+logedInFor, "/", ".$domainName", 1);
  53.                 setcookie("userName", $userName, time()+logedInFor, "/", ".$domainName", 1);
  54.             }
  55.  
  56.             /* Redirect to login page */
  57.             header("Location:$loginPage");
  58.             exit();
  59.         } else {
  60.             $message = 'No válido nombre de usuario y / o Clave!';
  61.         }
  62.     }
  63.     /* Disconnect from database */
  64.     if($connectDatabase == TRUE){$action=FALSE;include('connect.php');}
  65. }
  66. ?><style type="text/css">
  67. <!--
  68. #Layer8 {
  69.     position:absolute;
  70.     left:510px;
  71.     top:220px;
  72.     width:100px;
  73.     height:300px;
  74.     z-index:1;
  75.     font-family: Arial, Helvetica, sans-serif;
  76.     font-size: 14px;
  77.     color: #0099CC;
  78. }
  79. #Layer9 {
  80.     position:absolute;
  81.     left:200px;
  82.     top:500px;
  83.     width:900px;
  84.     height:50px;
  85.     z-index:1;
  86.     font-family: Arial, Helvetica, sans-serif;
  87.     font-size: 12px;
  88.     color: #0099FF;
  89.     border-top-width: thin;
  90.     border-top-style: dashed;
  91.     border-top-color: #3399FF;
  92. }
  93. #Layer10 {
  94.     position:absolute;
  95.     left:34px;
  96.     top:257px;
  97.     width:49px;
  98.     height:18px;
  99.     z-index:1;
  100. }
  101. -->
  102. </style>
  103. <div id="Layer8">
  104. <!--
  105. /*
  106. This script was downloaded at:
  107. LightPHPScripts.com
  108. Please support us by visiting
  109. out website and letting people
  110. know of it.
  111. Produced under: LGPL
  112. */
  113. -->
  114. <?php
  115.  
  116. /* Display error messages */
  117. if($message != NULL){?>
  118. <div align="center">
  119.   <table width="250"  border="0" cellpadding="3" cellspacing="0" bgcolor="#FFCCCC">
  120.     <tr>
  121.       <td><div align="center"><strong><font color="#FF0000"><?=$message;?></font></strong></div></td>
  122.     </tr>
  123.   </table>
  124.   <?php } ?><form action="<? echo $_SERVER['PHP_SELF'];?>" method="post" name="login" id="login" style="display:inline;">
  125.   <table width="250" align="center" cellpadding="5" cellspacing="0">
  126.     <tr bgcolor="#99CC99">
  127.       <td colspan="2" bgcolor="B3D9EC"><div align="center"><font color="#FFFFFF"><strong>Validaci&oacute;n de Usuario y Clave:</strong></font></div></td>
  128.     </tr>
  129.     <tr>
  130.       <td width="47%"><strong>Usuario:</strong></td>
  131.       <td width="53%"><input name="userName" type="text" id="userName"></td>
  132.     </tr>
  133.     <tr>
  134.       <td><strong>Clave:</strong></td>
  135.       <td><input name="password" type="password" id="password"></td>
  136.     </tr>
  137.     <tr>
  138.       <td colspan="2"><div align="center"><font face="Georgia, Times New Roman, Times, serif"><strong>
  139.           <input name="Submit" type="submit" id="Submit" value="Ingresar"> <a href="register.php">Registrarme</a>
  140.           <input name="submitID" type="hidden" id="submitID" value="1">
  141. </strong></font> </div></td>
  142.     </tr>
  143.     <tr>
  144.       <td colspan="2"><div align="center">Compartilo <a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fofertasdiarias.net%2F&amp;t="><img src="imagenes/facebook.gif" alt="2" width="16" height="16" border="0" /></a> <a href="https://www.google.com/accounts/ServiceLogin?passive=1209600&amp;continue=https%3A%2F%2Fwww.google.com%2Fbookmarks%2Fmark%3Fop%3Dedit%26bkmk%3Dhttp%253A%252F%252Fofertasdiarias.net%252F&amp;hl=es"><img src="imagenes/google.gif" alt="3" width="16" height="16" border="0" /></a> <a href="http://twitter.com/?status=Hoy - Ofertasdiarias Comprar y vender http%3A//ofertasdiarias.net/"><img src="twitter.gif" alt="4" width="16" height="16" border="0" /></a> <a href="https://secure.delicious.com/login?jump=http%3A%2F%2Fwww.delicious.com%2Fsave%3Furl%3Dhttp%253A%252F%252Fofertasdiarias.net%252F%26title%3DHoy%2520-%2520Ofertasdiarias%2520Comprar%2520y%2520vender%26notes%3D%26tags%3D%26noui%3Dno%26jump%3Dyes%26time%3D1306946854%26share%3Dyes%26recipients%3D&amp;v=5"><img src="imagenes/delicious.gif" alt="1" width="16" height="16" border="0" /></a></div></td>
  145.     </tr>
  146.   </table>
  147. </form>
  148. </div>
  149.  
  150. </div>
  151. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  152. <head>
  153. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  154. <link href="css/estilos.css" rel="stylesheet" type="text/css" />
  155. <title> OfertasDiarias.net en Español</title>
  156. <style type="text/css">
  157. <!--
  158. #Layer2 {
  159.     position:absolute;
  160.     left:200px;
  161.     top:21px;
  162.     width:60px;
  163.     height:42px;
  164.     z-index:1;
  165. }
  166. #Layer3 {
  167.     position:absolute;
  168.     left:818px;
  169.     top:7px;
  170.     width:300px;
  171.     height:42px;
  172.     z-index:1;
  173.     font-family: Arial, Helvetica, sans-serif;
  174.     font-size: 14px;
  175.     color: #0099CC;
  176. }
  177. #Layer4 {
  178.     position:absolute;
  179.     left:550px;
  180.     top:50px;
  181.     width:350px;
  182.     height:50px;
  183.     z-index:1;
  184.     font-family: Arial, Helvetica, sans-serif;
  185.     font-size: 14px;
  186.     font-weight: normal;
  187.     color: #0099CC;
  188. }
  189. #Layer5 {
  190.     position:absolute;
  191.     left:900px;
  192.     top:53px;
  193.     width:50px;
  194.     height:25px;
  195.     z-index:1;
  196.     font-family: Arial, Helvetica, sans-serif;
  197.     font-size: 14px;
  198.     color: #0066FF;
  199. }
  200. #Layer6 {
  201.     position:absolute;
  202.     left:500px;
  203.     top:33px;
  204.     width:600px;
  205.     height:60px;
  206.     z-index:1;
  207.     background-color: #95E3F4;
  208.     border-top-width: thin;
  209.     border-top-style: dashed;
  210.     border-top-color: #00CCCC;
  211. }
  212. #Layer7 {
  213.     position:absolute;
  214.     left:818px;
  215.     top:98px;
  216.     width:300px;
  217.     height:25px;
  218.     z-index:1;
  219.     font-family: Arial, Helvetica, sans-serif;
  220.     font-size: 14px;
  221.     color: #0099CC;
  222. }
  223. -->
  224. </style>
  225. </head>
  226. <body>
  227. <div id="Layer9"></div>
  228. <div id="Layer7"> &iquest;Te Gusta Ofertas ?  Compartilo <a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fofertasdiarias.net%2F&amp;t="><img src="imagenes/facebook.gif" width="16" height="16" border="0" /></a> <a href="https://www.google.com/accounts/ServiceLogin?passive=1209600&amp;continue=https%3A%2F%2Fwww.google.com%2Fbookmarks%2Fmark%3Fop%3Dedit%26bkmk%3Dhttp%253A%252F%252Fofertasdiarias.net%252F&amp;hl=es"><img src="imagenes/google.gif" width="16" height="16" border="0" /></a> <a href="http://twitter.com/?status=Hoy - Ofertasdiarias Comprar y vender http%3A//ofertasdiarias.net/"><img src="twitter.gif" width="16" height="16" border="0" /></a> <a href="https://secure.delicious.com/login?jump=http%3A%2F%2Fwww.delicious.com%2Fsave%3Furl%3Dhttp%253A%252F%252Fofertasdiarias.net%252F%26title%3DHoy%2520-%2520Ofertasdiarias%2520Comprar%2520y%2520vender%26notes%3D%26tags%3D%26noui%3Dno%26jump%3Dyes%26time%3D1306946854%26share%3Dyes%26recipients%3D&amp;v=5"><img src="imagenes/delicious.gif" width="16" height="16" border="0" /></a> </div>
  229. <div id="Layer6"></div>
  230. <div id="Layer5"><a href="login.php">Entrar</a></div>
  231. <div id="Layer4">
  232.   <form id="form1" name="form1" method="post" action="buscar.php">
  233.     <input name="textfield" type="text" size="40" />
  234.     <input type="submit" name="Submit" value="Buscar" />
  235.   </form>
  236. </div>
  237. <div id="Layer3"> <a href="index.php">Inicio</a> | <a href="register.php">Regístrate</a> | <a href="micuenta.php">Mi Cuenta</a> | <a href="ayuda.php">Ayuda</a> | <a href="mapa.php">Mapa</a> </div>
  238. <div id="Layer2"><a href="index.php"><img src="imagenes/logo.png" width="300" height="80" border="0" /></a></div>
  239. </body>
  240. </html>

SIGUE