also needing
cotonouhome.php
cotonoutrack.php
cotonoutrack.txt automatically created
*/
//alert("978\n");
var globalisp;
var globalipaddress;
function nowyyyymmdd()
{
var now = new Date();
var yearnow = now.getFullYear(); //webdata2009.js
var monthnow = now.getMonth() + 1; //1 - 12
var datenow = now.getDate();
var yyyymmdd = yearnow*10000 + monthnow*100 + datenow;
//yyyymmdd = ("00000000" + yyyymmdd).slice(-8); //last 8 chars for leading zero
return yyyymmdd;
}
function nowhhmm() //with leading zero
{
var now = new Date();
var hournow = now.getHours(); //webdata2009.js
var minutenow = now.getMinutes();
var hhmm = hournow*100 + minutenow;
hhmm = ("0000" + hhmm).slice(-4); //last 4 chars for leading zero
return hhmm;
}
function getstarttime()
{
var now = new Date();
return now.getTime();
}
function postipaddress()
{
//alert("1012\n");
var httppost = new XMLHttpRequest();
var postnum = 7;
httppost.open("POST", "cotonouhome.php", true);
var postdata = "action="+'ipaddress';
postdata += "&"+"postnum="+postnum;
//alert("1018\n" + postdata);
httppost.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //loop
httppost.setRequestHeader("Content-length", postdata.length); //loop
httppost.send(postdata);
httppost.onreadystatechange = function()
{
//Call a function when the state changes.
if(httppost.readyState == 4 && httppost.status == 200)
{
var resp = httppost.responseText;
//alert("1030\n" + resp);
afterwaitingforipaddress(resp);
}
}
}
function afterwaitingforipaddress(resp) //must wait
{
globalipaddress = resp;
globalisp = getispfromipaddress(resp);
//alert("1040\n" + globalisp);
initialpost();
}
function nowms()
{
var now = new Date();
var ms = now.getTime(); //ms since 19700101.000
var sec = (ms/1000).toFixed(2);
//var sec = (ms/1000).toFixed(0);
//return ms; //1484941629578
return ms%1000000; //629578
}
function initialpost()
{
//alert("1056\n");
var httppost = new XMLHttpRequest();
httppost.open("POST", "cotonouhome.php", true);
var documentreferrer = document.referrer;
if (document.referrer == "")
{
documentreferrer = "self";
}
var windowlocation = window.location + "";
var navigatoruserAgent = navigator.userAgent + "";
var postdata = "action="+'initialpost';
postdata += "&"+"startyyyymmdd="+startyyyymmdd;
postdata += "&"+"starthhmm="+starthhmm;
postdata += "&"+"documentreferrer="+documentreferrer;
postdata += "&"+"windowlocation="+windowlocation;
//postdata += "&"+"documentreferrer="+documentreferrer;
postdata += "&"+"navigatoruserAgent="+navigatoruserAgent;
postdata += "&"+"isp="+globalisp;
postdata += "&"+"ipaddress="+globalipaddress;
postdata += "&"+"ms="+nowms();
//alert("1078\n" + postdata);
//Send the proper header information along with the request
httppost.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //loop
httppost.setRequestHeader("Content-length", postdata.length);
httppost.send(postdata);
httppost.onreadystatechange = function()
{
//Call a function when the state changes.
if(httppost.readyState == 4 && httppost.status == 200)
{
var resp = httppost.responseText;
//alert("1091\n" + resp);
//afterwaitingforipaddress(resp);
posteachminute();
}
}
}
function posteachminute() //loop
{
var now = new Date();
//alert("1101\n" + now.getTime() );
var milliseconds = now.getTime() - starttime;
var duration2 = (milliseconds/60000).toFixed(1); //7.3
var duration = ("00000" + duration2).slice(-5);; //0007.3
//alert(duration);
////C:\0internet2017\Sending an HTTP Request by POST method with XMLHttpRequest • mozillaZine Forums.html
var httppost = new XMLHttpRequest(); //loop
httppost.open("POST", "cotonouhome.php", true); //loop
//httppost.open("POST", "cotonouhome.php", true); //loop
var hhmm = nowhhmm();
var minute = hhmm%10; //units of minutes
var postdata = "action="+'posteachminute';
postdata += "&"+"minute="+duration; //units of minutes
//alert("1116\n" + postdata);
////Send the proper header information along with the request
httppost.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //loop
httppost.setRequestHeader("Content-length", postdata.length); //loop
httppost.send(postdata); //loop
////httppost.close(); //not with a loop
setTimeout("posteachminute()", globalinterval); //to loop each minute/3000 msec
}
var starttime = getstarttime(); //milliseconds
var startyyyymmdd = nowyyyymmdd();
var starthhmm = nowhhmm();
postipaddress(); //and then send initial data
var globalinterval = 6000;
//posteachminute();
//stop hiding-->