Ver Mensaje Individual
  #2 (permalink)  
Antiguo 12/10/2006, 14:27
slope
 
Fecha de Ingreso: febrero-2004
Mensajes: 20
Antigüedad: 20 años, 2 meses
Puntos: 0
Bueno he conseguido mejoras, la verdad es que ahora ya me sale si el user es correcto o no, pero lamentosamente solo una vez, o sea..le clicas a enviar, te dice si estas identificado o no..pero si le vuelves a clicar te carga la pagina desde 0 como si la abrieras de nuevo y no ejecuta el script.. a algien se le ocurre porque?
PD: Sigue sin funcionar en FireFox pero si en Internet Explorer
Los codes son:

identificar.php (mismo que antes, no lo pongo)
login.php(alguna pequeña modificación):
Código:
<?php
if(!isset($_GET['admin']) && $_GET['admin'] != 'log')
{
	header("Location: ../../index.php");
}
?>
<script type="text/javascript" src="ajax.js"></script>
<div align="center">
	<strong>Identificació</strong>
	<br>
	<div id="error" align="center" style="color:#FF0000;"></div>
	<form method="POST" onSubmit="javascript:validaradmin(); return false">
		<div align="left">&nbsp;<strong>Usuari: </strong><input id="asunto" name="asunto" type="text" size="25" maxlength="30"><br>
		&nbsp;<strong>Contrasenya: </strong><input id="asunto" name="password" type="password" size="25" maxlength="25"></div>
		<input type="submit" value="Enviar">
		<input type="submit" value="Cancelar">
	</form>
</div>
ajax.js(el mas modificado de todos..pero sigue sin funcionar en FF y me pasa lo que comenté)
Código:
function iniciar() {
    try {
        iniciar = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            iniciar = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (E) {
            iniciar = false;
        }
    }
    if (!iniciar && typeof XMLHttpRequest!='undefined') {
       iniciar= new XMLHttpRequest();
    }
    return iniciar;
}

function validaradmin() {
    var error, user, pass;
    error = document.getElementById("error");
    user = document.getElementById("asunto").value;
    pass = document.getElementById("password").value;
    ajax=iniciar();
    ajax.open("POST", "Admin/Log/identificar.php",true);
    ajax.onreadystatechange=function() {
    	if (ajax.readyState==4) {
    		if(ajax.status==200)
    		{
    			if(ajax.responseText == 'No')
    			{
    				error.innerHTML = "Identificació incorrecte";
    			}
    			else
    			{
    				error.innerHTML = "Identificació correcte";
    			}
    		}
     	}
    }  
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    ajax.send("user="+user+"&password="+pass);
    return;
}
Muchas gracias de adelanto, si consigo arreglarlo avisaré, si alguien sabe como ayudarme me hará un favor.