2020-04-27 23:27:39 +02:00
|
|
|
<?php
|
2020-05-02 12:06:45 +02:00
|
|
|
include_once 'core.php';
|
2020-04-27 23:27:39 +02:00
|
|
|
init_class();
|
|
|
|
if(isset($_SESSION)){
|
2020-05-25 22:43:56 +02:00
|
|
|
$user = $user->name();
|
2020-04-27 23:27:39 +02:00
|
|
|
} else {
|
|
|
|
$user = "test";
|
|
|
|
}
|
|
|
|
$string = <<<EOT
|
|
|
|
<script>
|
|
|
|
ciao = 0;
|
|
|
|
function onLine() {
|
|
|
|
ciao = ciao + 1;
|
|
|
|
console.log(ciao);
|
|
|
|
console.log("onLine");
|
|
|
|
var xhr = new XMLHttpRequest();
|
2020-05-25 22:43:56 +02:00
|
|
|
xhr.open('GET', 'http://62.171.139.86/allerta/online_check.php?user=$user');
|
2020-04-27 23:27:39 +02:00
|
|
|
xhr.onload = function () {
|
|
|
|
if (xhr.status === 200) {
|
|
|
|
console.log('Text ' + xhr.responseText);
|
|
|
|
} else {
|
|
|
|
console.log('Request failed. Returned status of ' + xhr.status);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
xhr.send();
|
|
|
|
}
|
|
|
|
|
|
|
|
function offLine() {
|
|
|
|
console.log("offLine");
|
|
|
|
}
|
|
|
|
|
|
|
|
function check() {
|
|
|
|
console.log("dfcghfhdt");
|
|
|
|
var i = new Image();
|
|
|
|
i.onload = onLine;
|
|
|
|
i.onerror = offLine;
|
|
|
|
i.src = 'https://www.google-analytics.com/__utm.gif';
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
EOT;
|
|
|
|
echo($string);
|