Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/01/2008, 04:38
Avatar de eddwinpaz
eddwinpaz
 
Fecha de Ingreso: noviembre-2007
Ubicación: Merida , Venezuela
Mensajes: 1.066
Antigüedad: 16 años, 6 meses
Puntos: 25
Re: corroborar login con datos de MySQL

Código PHP:
<?php
  
if(isset($_POST['login'])) {
   
$error '';
   
$usuario $_POST['usuario'];
   
$password $_POST['password'];
   if(!isset(
$usuario) || !isset($password)) {
      
$error .= '<table width="276" height="50" border="0" cellpadding="0" cellspacing="0">
                           <tr>
                           <td width="276"><table width="292" border="0" cellspacing="0" cellpadding="0">
                           <tr>
                           <td width="274" height="39" align="center" bgcolor="#FF0000">
                           <span class="Error">Dejastes un campo en blanco</span></td>
                           </tr>
                           </table></td>
                           </tr>
                           </table>'
;
   }
  
   if(
get_magic_quotes_gpc()) {
      
$usuario $usuario;
   }else{
      
$usuario addslashes($usuario);
   }
   @
$resultado    mysql_query('SELECT * FROM controlers  WHERE usuario="'.$usuario.'" AND  clave="'.$password.'"');
   @
$valido_login mysql_num_rows($resultado);
   if(
$valido_login == 0) {
      
$error .= '<table width="297" border="0" cellspacing="0" cellpadding="0">
                           <tr>
                           <td width="297" height="39" align="center" bgcolor="#FF0000">
                           <span class="Error">Dejastes un campo en blanco</span></td>
                           </tr>
                           </table>'
;
   }
   if(
$error == '') {
      
$data mysql_fetch_array($resultado);
      
$_SESSION['admin_name'] = $data['Nombre'];
      
$_SESSION['admin_id']   = $data['id'];
      
      echo 
'<meta http-equiv="Refresh" Content="0; URL=admin_news.php">';
      die();
   }else{
      echo 
'<table width="276" height="50" border="0" cellpadding="0" cellspacing="0">
                           <tr>
                           <td width="276"><table width="292" border="0" cellspacing="0" cellpadding="0">
                           <tr>
                           <td width="274" height="39" align="center" bgcolor="#FF0000">
                           <span class="Error">'
.$error.'</span></td>
                           </tr>
                           </table></td>
                           </tr>
                           </table>'
;
   }
}
?>
Haber haber intenta con ese , lo uso actualmente. deberia de servirte solo cambia las tablas y listo.