Ver Mensaje Individual
  #5 (permalink)  
Antiguo 11/11/2010, 16:52
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
Respuesta: ayuda a hacer mas seguro mi login

haber mis amores, que tal esto, ahora sera mas seguro o puedo hacer algo mas:

Código PHP:
<?php
session_start
();
include 
"conexion.php";
if(isset(
$_POST['enviar'])){
if(!empty(
$_POST['nombre']) && !empty($_POST['pass'])){
conectar();
    
$nombre=strip_tags(mysql_real_escape_string($_POST['nombre']));
    
$pass=md5(strip_tags(mysql_real_escape_string($_POST['pass'])));
    
    
$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();
}
}
?>