Ver Mensaje Individual
  #2 (permalink)  
Antiguo 01/02/2011, 18:27
SonrisaCs
 
Fecha de Ingreso: diciembre-2010
Mensajes: 180
Antigüedad: 13 años, 4 meses
Puntos: 5
Respuesta: [Ayuda] Los users logeados ven el login.

Login.php
Código PHP:
Ver original
  1. <?php
  2.  
  3.  include("db-info.php");
  4.  $link = mysql_connect($server, $user, $pass);
  5.  if(!mysql_select_db($database)) die(mysql_error());
  6.  
  7.  include("session.inc.php");
  8.  include("loadsettings.inc.php");
  9. ?>
  10.  
  11.  
  12. <html>
  13.  
  14. <head>
  15.  
  16. <title><? echo $webtitle; ?> - Logearse</title>
  17. <link rel="stylesheet" href="style.css" type="text/css" />
  18.  
  19. <meta name="description" content="<? echo $description; ?>" />
  20. <meta name="keywords" content="<? echo $keywords; ?>" />
  21.  
  22. </head>
  23.  
  24.  
  25. <body link=#336699 vlink=#336699 alink=#336699>
  26. <?php include("header.php"); ?>
  27.  
  28. <center>
  29. <div class="content-container">
  30.  
  31. <center>
  32.   <h1>Logearse.</h1>
  33. </center>
  34. <div align="center"><br>
  35.  
  36.  
  37.     <?php
  38.  
  39. if (isset($_POST["username"]))  {
  40.  
  41.    $username = htmlspecialchars(trim($_POST["username"]));
  42.    $password = htmlspecialchars(trim($_POST["password"]));
  43.    
  44.    echo "<br />";    
  45.    if (($username != "") && ($password != ""))
  46.    {
  47.         $q = "SELECT username FROM `members` WHERE (username = '$username') and (password = '$password')";
  48.         if(!($result_set = mysql_query($q))) die(mysql_error());
  49.         $number = mysql_num_rows($result_set);
  50.  
  51.         if (!$number) {
  52.             echo "Lo sentimos! el usuario no existe, o introdujo un password incorrecto.";
  53.             showForm();
  54.         }
  55.         else {
  56.             $date = date("y-m-d");
  57.             mysql_query("UPDATE `members` SET access = '$date' WHERE username = '$username'");
  58.             $_SESSION["imagehost-user"] = $username;
  59.             $_SESSION["imagehost-pass"] = $password;
  60.             echo "<b>Usted se ah logeado correctamente.</b> <br><br>Sera redirigido la panel de Miembros.
  61.                  <br>
  62.                 <a href=\"account.php\">Click aqui</a> Para visitar el area de miembros.";
  63.             echo "<meta http-equiv=\"refresh\" content=\"3; url='account.php'\" />";
  64.         }
  65.    }
  66.    else
  67.      { echo "Por favor complera los campos primero!"; showForm(); }
  68. }
  69. else
  70. {
  71.   if ($session == false)
  72.     showForm();
  73.   else
  74.     echo "Lo sentimos! Usted ya esta registrado.";
  75. }
  76.  
  77.  
  78. ?>
  79.  
  80.  
  81.  
  82.  
  83.     <? function showForm() { ?>
  84.  
  85.  
  86. </div>
  87. <form method="POST" action="login.php" name="myForm">
  88.  
  89.   <div align="center">
  90.     <table>
  91.       <tr>
  92.         <td><LABEL id="title">Usuario: </td> <td> <input type="text" maxlength=30 size=30 name="username"> </td>
  93.     </tr>
  94.       <tr>
  95.         <td><LABEL id="title">Password: </td> <td> <input type="password" maxlength=30 size=30 name="password"> </td>
  96.     </tr>
  97.       <tr>
  98.         <td>&nbsp;</td> <td><br> <a href=#><img src="images/login.png" border=0 onClick="myForm.submit();"></a> </td>
  99.     </tr>
  100.     </table>
  101.   </div>
  102. </form>
  103. <div align="center"><br>
  104.     <br>
  105.  
  106. </div>
  107. <LABEL id="text">
  108. <div align="center"><b>Perdiste tu Password?</b> <a href="forgot.php">Click aqui</a> para enviar la password a su mail.
  109.   <br>
  110.   <br>
  111. </div>
  112. </LABEL>
  113.  
  114. <? } ?>
  115.  
  116.  
  117.  
  118. <?php  include("footer.php"); ?>
  119.  
  120.  
  121. </div>
  122. </center>
  123.  
  124.  
  125. </body>
  126.  
  127.  
  128. </html>


Y la web es http://www.ironpic.com.ar
Saludos (: