loguear.php -> este php contiene el formulario para introducir los datos, así como el javascript necesario y la llamada a la funcion login.php
Código PHP:
   <?php 
session_start();
session_register();
include_once("../BBDD/conexDBTMusik.php");
/* LLAMAMOS AL ARCHIVO FUNCIONES Y OBTENEMOS EL IDIOMA ACTUAL */
if (!isset($_SESSION['lang'])) { 
    require('../lang/espanol.php');
    //require('espanol.php');
    $_SESSION['lang']='espanol';
} #por defecto, llamamos al archivo espanol.php (español)
else { 
    require('../lang/'. $_SESSION['lang'] .'.php'); 
} #llamamos al archivo php seleccionado…
?>
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 transitional//ES" "http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<head>
    <title>Introducir</title>
<script>
//acá cada uno crea el objeto a su manera
function aj(){
    if(window.XMLHttpRequest){
        return new XMLHttpRequest();
    }
    else{
        try{
            return new ActiveXObject('Microsoft.XMLHTTP');
        }catch(e){
            alert('tu navegador no soporta ajax');
            return false;
        }
    }
}
function sendAndLoad(){
    var rpc=aj();
    if(rpc){
        //si pudo crearse el objeto, avanzamos (respetar el orden)
        rpc.open('POST','./cuenta/login.php',true);
        rpc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        //preparamos las variables a enviar
        var aEnviar='';
        for(ii=0; ii<arguments.length;ii++){
//usamos el objeto arguments para obtener y parsear los datos a enviar
//encodeURI es semejante a urlencode de PHP
            aEnviar+=arguments[ii].desc+'='+encodeURI(arguments[ii].dato)+'&';
        }
        //creamos una función anónima que sirva de handler
        rpc.onreadystatechange=function(){
            if(rpc.readyState==4){
                //nos conectamos, recibimos y hacemos algo con lo que recibimos si queremos
                //en este caso, mostramos lo que enviamos
                document.getElementById('pp').style.display='block';
                document.getElementById('pp').style.color='green';
                document.getElementById('pp').innerHTML=rpc.responseText;
            }else{
                //no nos conectamos todavía y mostramos la precarga
                document.getElementById('pp').style.display='block';
            }
        }
//Recién ahora, que tenemos todo lo anterior terminado, podemos enviar el request
        rpc.send(aEnviar);
    }
}
//asignamos la función al botón de envío al cargar la página, así no tocamos el html
window.onload=function(){
    document.getElementById('Submit').onclick=function(){
        //pasamos objetos escritos en notación json como argumentos
sendAndLoad({desc:'meil',dato:document.getElementById('meil').value},{desc:'clave1',dato:document.getElementById('clave1').value},{desc:'Submit',dato:document.getElementById('Submit').value});
    }
}
</script>
</head>
<body onLoad="ponerfoco(0,0);">
    <table width="100%" height="28%" border=0 style="height:100%;width:100%;">
        <tr align="center" bottom="middle">
            <td height="144">
                  <table width="100%" height="28%" border=0 style="height:100%;width:100%;">
                    <tr align="center" bottom="middle">
                      <td height="106">
                          <form id="acceso" name="acceso" method="post" action="">
                        <table border=0>                    
    
                        <tr>
                            <td align="left">Email:</td>
                            <td align="left"><input type="text" name="meil" id="meil" maxlength="50" size="10"> </td>
                        </tr>
                        <tr>
                            <td align="left"><?php echo $lng['usuario']['clau'];?></td>
                            <td align="left"><input type=PASSWORD name="clave1" id="clave1" maxlength="20" size="10" > </td>
                        </tr>
        
                        <tr>
                            <td align="left">
                            <input type="button" name="submit" id="submit" value=<?php echo $lng['cuentanueva']['acceder'];?> onClick="return principal('./cuenta/login.php','mainContent');"
                            </td>
                            <td align="left">
                            <input type="reset" name="resetb" value=<?php echo $lng['contacto']['5'];?> >
                            </td>
                      </tr>
                      
                      <tr>
                            
                            <td align="left" ><div id="mensaje" align="center"><?php echo $lng['usuario']['olvido'];?></div>
                            <div id="mensaje" align="center"> <input type="button" name="clave0" value="Reenviar Clave" align="center" onClick="envmail.php"></div></td>
                            
                      </tr>                 
                      </table>
                      </form>
                       </td>
                      </tr>
                      </table>    
    </td>
    </tr>
    <div id="pp" style="display:none;color:#F00"></div> 
    </table>
</body>
</html>
<?php include_once("../BBDD/desconexDBTMusik.php"); ?>    Código PHP:
   <?php
session_start();
session_register();
/* LLAMAMOS AL ARCHIVO FUNCIONES Y OBTENEMOS EL IDIOMA ACTUAL */
if (!isset($_SESSION['lang'])) 
{ 
    require('../lang/espanol.php');
    //require('espanol.php');
    $_SESSION['lang']='espanol';
} #por defecto, llamamos al archivo espanol.php (español)
else 
{ 
    require('../lang/'. $_SESSION['lang'] .'.php'); 
} #llamamos al archivo php seleccionado…
include_once('../Gestor/BBDD/conexDBTMusik.php');
$meil=$_REQUEST['meil'];
$clave1=$_REQUEST['clave1'];
// To protect MySQL injection 
$meil = stripslashes($meil);
$clave1 = stripslashes($clave1);
$meil = mysql_real_escape_string($meil);
$clave1 = mysql_real_escape_string($clave1);
$sql="SELECT * FROM clientes WHERE Mail='".$meil."' AND Clave='".$clave1."' GROUP BY Mail";
$result=mysql_query($sql)or die( mysql_error());
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1)
{
/*    if (($meil!="")&&(!ereg('^[a-z0-9]+([\.]?[a-z0-9_-]+)*@'.'[a-z0-9]+([\.-]+[a-z0-9]+)*\.[a-z]{2,}$',$meil)))
    {*/
        if(($meil!="") || ($clave1!=""))
        {
                $sel=mysql_fetch_array($result);    
                //crear la nueva sesión y asignarle como valor, la hora actual --> para controlar los tiempos de sesion
                session_start();
                //asigno un nombre a la sesión para poder guardar diferentes datos
                $_SESSION["usuario"]=$sel->Id_Cliente;
                //asigno el usuario a la sesión
                session_name($_SESSION["usuario"]);
                // inicio la sesión
                $_SESSION["autentificado"]= "SI";
                //defino la sesión que demuestra que el usuario está autorizado
                $_SESSION["ultimoAcceso"]= date("Y-n-j H:i:s");
                //defino la fecha y hora de inicio de sesión en formato aaaa-mm-dd hh:mm:ss
                $_SESSION["tipocliente"]=$sel['TipoCliente'];
                header("location:login_success.php");
        }
        else
        {
            $error = $lng['login']['3'];
        }
    }
/*    else
    {
        $error = $lng['login']['5'];
    }
}*/
else 
{
    $error = $lng['login']['2'];
}
if ($error != "" )
{
    header("location:loguear2.php?error=$error&meil=$meil");
}
include_once("../Gestor/BBDD/desconexDBTMusik.php");
?>    Espero me puedan ayudar. Muchas gracias!
 
