204 lines
4.7 KiB
PHP
204 lines
4.7 KiB
PHP
<?php
|
|
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', TRUE);
|
|
ini_set('display_startup_errors', TRUE);
|
|
|
|
$domaines = array(
|
|
array(
|
|
'name' => 'Local Transfer',
|
|
'url' => 'https://transfer.netdldata.net',
|
|
'img' => 'favicon_transfer.png'
|
|
),
|
|
array(
|
|
'name' => 'Keycloak',
|
|
'url' => 'https://keycloak.netdldata.net/realms/apps/account/',
|
|
'img' => 'favicon_keycloak.svg'
|
|
),
|
|
array(
|
|
'name' => 'Nextcloud',
|
|
'url' => 'https://cloud.netdldata.net',
|
|
'img' => 'favicon_Nextcloud.svg'
|
|
),
|
|
array(
|
|
'name' => 'Gitea',
|
|
'url' => 'https://git.netdldata.net',
|
|
'img' => 'favicon_gitea.svg'
|
|
),
|
|
array(
|
|
'name' => 'Jellyfin<br>Stream',
|
|
'url' => 'https://jellyfin.netdldata.net/SSO/oid/p/Keycloak?isLinking=true',
|
|
'img' => 'favicon_jellyfin.svg'
|
|
),
|
|
array(
|
|
'name' => 'Speed Test',
|
|
'url' => 'https://speedtest.netdldata.net',
|
|
'img' => 'favicon_openspeedtest.png'
|
|
),
|
|
array(
|
|
'name' => 'Proxmox',
|
|
'url' => 'https://proxmox.netdldata.net',
|
|
'real' => 'proxmox.lan',
|
|
'port' => 8006,
|
|
'img' => 'favicon_proxmox.png'
|
|
),
|
|
array(
|
|
'name' => 'Portainer',
|
|
'url' => 'https://portainer.netdldata.net',
|
|
'img' => 'favicon_portainer.png'
|
|
),
|
|
array(
|
|
'name' => 'Guacamole',
|
|
'url' => 'https://guacamole.netdldata.net',
|
|
'img' => 'favicon_guacamole.png'
|
|
),
|
|
array(
|
|
'name' => 'Grafana',
|
|
'url' => 'https://grafana.netdldata.net',
|
|
'realx' => 'grafana.lan',
|
|
'port' => 3000,
|
|
'img' => 'favicon_grafana.png'
|
|
),
|
|
array(
|
|
'name' => 'Mail',
|
|
'url' => 'https://mail.netdldata.net',
|
|
'img' => 'favicon_roundcube.svg'
|
|
),
|
|
array(
|
|
'name' => 'Filebrowser',
|
|
'url' => 'https://filebrowser.netdldata.net',
|
|
'img' => 'favicon_filebrowser.svg'
|
|
),
|
|
array(
|
|
'name' => 'Wake on LAN',
|
|
'url' => 'https://wolweb.netdldata.net',
|
|
'img' => 'favicon_wolweb.png'
|
|
),
|
|
array(
|
|
'name' => 'Grocy',
|
|
'url' => 'https://grocy.netdldata.net',
|
|
'img' => 'favicon_grocy.svg'
|
|
),
|
|
|
|
|
|
);
|
|
if (isset($_COOKIE['socket'])) {
|
|
$domaines = unserialize($_COOKIE['socket']);
|
|
}
|
|
else {
|
|
for ($i = 0; $i < sizeof($domaines); $i ++) {
|
|
if(array_key_exists('real', $domaines[$i])){
|
|
#$domaines[$i]['host'] = gethostbyname($domaines[$i]['real']);
|
|
$fp = @fsockopen($domaines[$i]['real'], $domaines[$i]['port'], $errno, $errstr, 0.1);
|
|
if ($fp) {
|
|
$domaines[$i]['running'] = true;
|
|
}
|
|
else {
|
|
$domaines[$i]['running'] = false;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$cookie = serialize($domaines);
|
|
$temps = 60*60*2; //2 heures
|
|
setcookie ("socket", $cookie, time() + $temps);
|
|
|
|
?>
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
|
|
|
|
<link rel="stylesheet" type="text/css" href="styles/Style.css">
|
|
<link rel="icon" href="images/majalis.png" />
|
|
|
|
<script src="js/jquery-3.4.1.js"></script>
|
|
|
|
<head>
|
|
<title>NetDLData</title>
|
|
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
|
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" />
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="titre">
|
|
<h2>Sites NetDLData</h2>
|
|
<button class="reload" id="reload" type="button" onclick="cookies()"><img src="images/cloud-reload.png"></button>
|
|
</div>
|
|
|
|
<div id="buttons"></div>
|
|
|
|
<?php
|
|
|
|
echo "<br><br>".$_SERVER['HTTP_USER_AGENT'];
|
|
|
|
#$browser = get_browser(null, true);
|
|
#echo "<br><br>You use navigator ".$browser["browser"];
|
|
#echo "<br>By ".$browser["browser_maker"];
|
|
#echo "<br>In Version ".$browser["version"];
|
|
#echo "<br>On system ".$browser["platform"];
|
|
#echo "<br>Your IP is ".$_SERVER['REMOTE_ADDR'];
|
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
var servers = <?php echo json_encode($domaines); ?>;
|
|
|
|
console.log(servers);
|
|
|
|
|
|
var orientation_etat = true;
|
|
|
|
for (var key in servers) {
|
|
orientation_etat = !orientation_etat;
|
|
var server = servers[key];
|
|
var div = $('<div />', {
|
|
class: 'button ' + orientation(orientation_etat)
|
|
});
|
|
var link = $('<a />', {
|
|
href: server.url,
|
|
});
|
|
div.append(link);
|
|
var button = $('<button />', {
|
|
class: 'server',
|
|
type: 'button',
|
|
html: '<img class="favicon" src="images/' + server.img + '"><div class="description">' + server.name + '</div>'
|
|
});
|
|
link.append(button);
|
|
$("#buttons").append(div);
|
|
if (server.hasOwnProperty('running')){
|
|
if (server.running) {
|
|
button.addClass('allumer');
|
|
}
|
|
else
|
|
button.prop("disabled",true);
|
|
}
|
|
else
|
|
button.addClass('allumer');
|
|
}
|
|
|
|
function cookies() {
|
|
document.getElementById("reload").style.cursor = "wait";
|
|
document.body.style.cursor = "wait";
|
|
var path = document.location.pathname;
|
|
document.cookie = "socket=; expires=Thu, 01 Jan 1970 00:00:00 UTC;";
|
|
window.location.href = path;
|
|
|
|
}
|
|
|
|
function orientation (status) {
|
|
if (status == false)
|
|
return "left";
|
|
else
|
|
return "right";
|
|
};
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|