Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/11/2010, 20:08
Avatar de ylellan
ylellan
 
Fecha de Ingreso: mayo-2010
Ubicación: en un lugar de Veracruz
Mensajes: 432
Antigüedad: 13 años, 10 meses
Puntos: 36
Pregunta ayuda a hacer mas seguro mi login

HOla amores, disculpen comunmente mi login sirve de maravilla (bueno a mi parecer), pero me tope que me dicen que es muy sencillo he inseguro, quiero hacerlo un poco mas seguro porque me dijeron le falta algunas cosas de seguridad, espero me puedan auxiliar en esto:

index.php
Código HTML:
Ver original
  1. <?php
  2. session_start();
  3. ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  7. <title>Documento sin t&iacute;tulo</title>
  8. .msj
  9. {
  10.     font:Arial, Helvetica, sans-serif;
  11.     color:red;
  12.     font-weight:bold;
  13.     background:#FFFF00;
  14. }
  15. </head>
  16.  
  17. <form action="procesar_pas.php" method="post">
  18. <?php if(isset($_GET['mensaje'])){ echo '<div class="msj">'.$_GET['mensaje'].'</div>'; } ?>
  19. <table width="304" border="1" align="center">
  20. <?php
  21. if(isset($_GET['pai'])){?><tr><td colspan="3"><span style="font-size:12px; color:red;"><?php echo $_GET['pai'];?></span></td></tr><?php } ?>
  22.   <tr>
  23.     <td width="98">NOMBRE:</td>
  24.     <td width="190"><input name="nombre" type="text" id="nombre" value="<?php if(isset($_GET['usuario'])){echo $_GET['usuario'];}if(!empty($_SESSION['usuario'])){echo $_SESSION['usuario'];}?>" /><?php echo '<span style=" color:red;">'.$_GET['user'].'</span>'?></td>
  25.   </tr>
  26.   <tr>
  27.     <td>PASSOWORD</td>
  28.     <td><input name="pass" type="password" id="pass" value="<?php if(isset($_GET['password'])){ echo $_GET['password'];}?>"/><?php echo '<span style=" color:red;">'.$_GET['pas'].'</span>'?></td>
  29.   </tr>
  30.   <tr>
  31.     <td>
  32.       <input name="enviar" type="submit" id="enviar" value="ENTRAR" />    </td>
  33.     <td><input name="cancel" type="reset" id="cancel" value="CANCELAR" /></td>
  34.   </tr>
  35. </form>
  36. </body>
  37. </html>

procesar_pas.php
Código PHP:
<?php
session_start
();
include 
"conexion.php";
if(isset(
$_POST['enviar'])){
if(!empty(
$_POST['nombre']) && !empty($_POST['pass'])){
    
$nombre=$_POST['nombre'];
    
$pass=md5($_POST['pass']);
    
conectar();
    
$b=mysql_query("select *from usuarios where usuario='$nombre'") or die ("error".mysql_error());
    
$existe=mysql_num_rows($b);
    
$c=mysql_fetch_array($b);
    
desconectar();
    if(
$existe>0){
    
$_SESSION['usuario']=$nombre;
    if(
$pass==$c['password'] && !empty($pass)){
    
$_SESSION['admitio']="si";
    
header("location:frame.php");
    exit();
    }else{
    
header("location:index.php?pai=EL PASSWORD ESTA MAL");
    exit();
    }
    }
    else{
    
header("location:index.php?pai=NO EXISTE USUARIO");
    exit();
    }
}
else{
//si no hay valores en los inputs
if(empty($_POST['nombre'])){
$user="*FALTA NOMBRE";
}
if(empty(
$_POST['pass'])){
$pas="*FALTA PASSWORD";
}
header("location:index.php?mensaje=LLENAR TODOS LOS DATOS&user=".$user."&pas=".$pas."&usuario=".$_POST['nombre']."&password=".$_POST['pass']);
exit();
}
}
?>
conexion.php
Código PHP:
<?php 
function conectar()
{
    
mysql_connect("localhost","user","*****");
    
mysql_select_db("login");
}
function 
desconectar()
{
    
mysql_close();
}
?>
espero me den alguna idea