This code works great in Firefox, but in IE or Opera, after send the
form with wrong data, the html of #form is null, see line 77
in firefox line 77 print the form source, in Opera or IE print NULL
the ideia of script is:
- try to log in orkut
- if success, reload some vars of index page and close the login page,
that is in iframe using colorbox
- while send form, change error var
- if fail login, change error var and show form again
someone help me?
<?php
session_start();
set_time_limit(0);
header("Content-Type: text/html; charset=UTF-8");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "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=utf-8" />
<link type="text/css" media="screen" rel="stylesheet" href="css/
colorbox.css" />
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="js/jquery.colorbox.js"></script>
<link rel="stylesheet" href="css/general.css" type="text/css"
media="screen" />
<title>Orkut API Login - by Octane FX</title>
</head>
<body>
<center>
<span id="error"><b>Use seu login do orkut</span><br><br>
<form name="formlogin" id="formlogin" method="POST" action=""
target="iframe_profile">
<br><b>email:</b><br>
<input name="Email" id="Email" type="text" name="Email">
<br><b>senha:</b><br>
<input name="Passwd" id="Passwd" type="password" name="Passwd">
<br><br>
<input id="enviar" type="submit" value="enviar">
</form>
</center>
<script type="text/javascript">
$(window.document).ready(function(){
function reloadinfo(){
$('#screenname', window.parent.document).text("<?php
echo ((isset
($_SESSION['screenname']) )?$_SESSION['screenname']:"");?>");
$('#avatar img',
window.parent.document).attr('src',"<?php echo
((isset($_SESSION['avatar']) )?$_SESSION['avatar']:"");?>");
$('#numrecados', window.parent.document).html("<?php
echo ((isset
($_SESSION['recados']) )?$_SESSION['recados']:"");?>");
$('#numfotos', window.parent.document).html("<?php echo
((isset
($_SESSION['fotos']) )?$_SESSION['fotos']:"");?>");
$('#numfotoscomigo',
window.parent.document).html("<?php echo
((isset($_SESSION['fotoscomigo']) )?$_SESSION['fotoscomigo']:"");?>");
$('#numvideos', window.parent.document).html("<?php
echo ((isset
($_SESSION['videos']) )?$_SESSION['videos']:"");?>");
$('#numfas', window.parent.document).html("<?php echo
((isset
($_SESSION['fas']) )?$_SESSION['fas']:"");?>");
$('#numtrusty', window.parent.document).html("<?php
echo ((isset
($_SESSION['trusty']) )?$_SESSION['trusty']:"");?>");
$('#numcool', window.parent.document).html("<?php echo
((isset
($_SESSION['cool']) )?$_SESSION['cool']:"");?>");
$('#numsexy', window.parent.document).html("<?php echo
((isset
($_SESSION['sexy']) )?$_SESSION['sexy']:"");?>");
parent.$.fn.colorbox.close();
}
$("#formlogin").submit(function() {
// pequenas validações (small validations)
var Email = $("input#Email").val();
if (Email == "") { $("input#Email").focus(); return
false; }
var Passwd = $("input#Passwd").val();
if (Passwd == "") { $("input#Passwd").focus(); return
false; }
var dataString = 'Email='+ Email + '&Passwd=' + Passwd;
$.ajax({
type: "POST",
url: "checklogin.php",
data: dataString,
async: false
});
return false;
});
$("#formlogin").ajaxSend(function(evt, request, settings){
//$("#formlogin").hide();
$('#error').html("<b>Efeturando login<br>aguarde!</
b><br><br><br><br><img src='css/images/loading.gif'>");
});
$("#formlogin").ajaxError(function(){
$('#error').html("<b>Erro no envio!</b>");
$("#formlogin").show();
});
$("#formlogin").ajaxComplete(function(event,request, settings){
if(request.responseText=="logged"){
reloadinfo();
} else if(request.responseText=="error"){
$('#error').html("<b>Usuário ou senha
inválidos!</b>");
alert($('#formlogin').html());
//$("#formlogin").show();
} else{ $('#error').html(request.responseText); }
});
});
</script>
</body>
</html>