1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| <?php
if(isset($_POST["octets"])) {
echo str_pad("", $_POST["octets"], 0);
exit;
}
?>
<html>
<head>
<script type="text/javascript">
function load_data(octets) {
var xmlHttp = GetXmlHttpObject();
if(xmlHttp == null) return false;
else {
method = "POST";
target = window.location.href.substring(window.location.href.lastIndexOf("/")+1,window.location.href.length) + "?sid="+Math.random();
asynchronous = true;
xmlHttp.onreadystatechange = function() {
if(xmlHttp.readyState == 4) {
var el = document.createElement('div');
el.setAttribute('data', xmlHttp.responseText);
document.body.appendChild(el);
el.style.border = "2px solid #0000FF";
el.style.width = "250px";
el.style.height = "25px";
el.innerHtml = octets;
el.onclick = function(e) { document.body.removeChild(this); delete this; };
delete(xmlHttp);
delete el;
};
}
xmlHttp.open(method,target,asynchronous);
xmlHttp.setRequestHeader('Cache-Control', 'no-cache');
xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=ISO-8859-15');
xmlHttp.send("octets="+octets);
}
}
function GetXmlHttpObject(){
var objXMLHttp = null;
if (window.XMLHttpRequest){
try { objXMLHttp = new XMLHttpRequest(); }
catch(e) { objXMLHttp = false; }
}
else {
if(window.createRequest) {
try { objXMLHttp = new window.createRequest(); }
catch(e) { objXMLHttp = false; }
}
else {
if(window.ActiveXObject) {
try { objXMLHttp = new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e) {
try { objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e) { objXMLHttp = false; }
}
}
}
}
return objXMLHttp;
}
</script>
</head>
<body>
<input type="button" value="1 Mo" style="width:150px; float:left;" onclick="load_data(1048576);" /><br /><br />
</body>
</html> |
Partager