240 lines
5.8 KiB
PHP
240 lines
5.8 KiB
PHP
<?php
|
|
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', TRUE);
|
|
ini_set('display_startup_errors', TRUE);
|
|
|
|
$domaines = array(
|
|
array(
|
|
'id' => 'ORION',
|
|
'protocol' => 'https',
|
|
'proxy' => 'orion.netdldata.net/',
|
|
'name' => 'orion.lan',
|
|
'port' => 5001
|
|
),
|
|
array(
|
|
'id' => 'Nextcloud',
|
|
'protocol' => 'http',
|
|
'proxy' => 'cloud.netdldata.net/',
|
|
'name' => 'nextcloud.lan',
|
|
'port' => 80
|
|
),
|
|
array(
|
|
'id' => 'Gitea',
|
|
'protocol' => 'http',
|
|
'proxy' => 'git.netdldata.net',
|
|
'name' => '192.168.110.1',
|
|
'port' => 3000
|
|
),
|
|
array(
|
|
'id' => 'Transmission',
|
|
'protocol' => 'http',
|
|
'proxy' => 'torrent.netdldata.net',
|
|
'name' => '192.168.110.1',
|
|
'port' => 9091
|
|
),
|
|
array(
|
|
'id' => 'Webmin',
|
|
'protocol' => 'https',
|
|
'proxy' => 'webmin.netdldata.net',
|
|
'name' => '192.168.110.53',
|
|
'port' => 10000
|
|
),
|
|
);
|
|
if (isset($_COOKIE['socket'])) {
|
|
$domaines = unserialize($_COOKIE['socket']);
|
|
}
|
|
else {
|
|
for ($i = 0; $i < sizeof($domaines); $i ++) {
|
|
$domaines[$i]['host'] = gethostbyname($domaines[$i]['name']);
|
|
$fp = @fsockopen($domaines[$i]['name'], $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);
|
|
|
|
$browser = get_browser(null, true);
|
|
|
|
?>
|
|
|
|
<!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.3.1.min.js"></script>
|
|
<script src="js/angular-1.6.10.min.js"></script>
|
|
<script type="text/javascript" src="js/script.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 class="button left">
|
|
<button id="Project" class="server allumer" type="button" onclick="document.location.href='/projects/'">
|
|
<img class="favicon" src="images/favicon_apache.ico">
|
|
<div class="description">Projects</div>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="button right">
|
|
<button id="Transfer" class="server allumer" type="button" onclick="document.location.href='/transfer/'">
|
|
<img class="favicon" src="images/favicon_transfer.png">
|
|
<div class="description">Local Transfer</div>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="button left">
|
|
<button id="Nextcloud" class="server" type="button" onclick="site(this.id)" disabled>
|
|
<img class="favicon" src="images/favicon_Nextcloud.png">
|
|
<div class="description">Nextcloud</div>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="button right">
|
|
<button id="ORION" class="server" type="button" onclick="site(this.id)" disabled>
|
|
<img class="favicon" src="images/favicon_DSM.ico">
|
|
<div class="description">Orion</div>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="button left">
|
|
<button id="Gitea" class="server" type="button" onclick="site(this.id)" disabled>
|
|
<img class="favicon" src="images/favicon-gitea.png">
|
|
<div class="description">Gitea</div>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="button right">
|
|
<button id="Transmission" class="server" type="button" onclick="site(this.id)" disabled="true">
|
|
<img class="favicon" src="images/favicon_transmission.png">
|
|
<div class="description">Transmission</div>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="button left">
|
|
<button id="Webmin" class="server" type="button" onclick="site(this.id)" disabled>
|
|
<img class="favicon" src="images/favicon_webmin.png">
|
|
<div class="description">Webmin</div>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="button right">
|
|
<button id="RAS" class="server" type="button" onclick="site(this.id)" disabled>
|
|
<img class="favicon" src="images/raspberry-pilogo.png">
|
|
<div class="description">Raspberry</div>
|
|
</button>
|
|
</div>
|
|
|
|
<a download="" href="NetDLData.crt">Télécharger le Certificat SSL NetDLData</a>
|
|
|
|
<?php
|
|
|
|
echo "<br><br>".$_SERVER['HTTP_USER_AGENT'];
|
|
|
|
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 host = document.location.hostname;
|
|
|
|
var domaine;
|
|
|
|
if(host.includes("netdldata")) {
|
|
domaine = "LOCAL_NAME";
|
|
}
|
|
if(host.includes("192.168.110.")) {
|
|
domaine = "LOCAL_IP";
|
|
}
|
|
if(host.includes("192.168.1.")) {
|
|
domaine = "LIVEBOX_IP";
|
|
}
|
|
if(host.includes("liolo70.ddns.net")) {
|
|
domaine = "INTERNET";
|
|
}
|
|
|
|
console.log(domaine);
|
|
|
|
for (var key in servers) {
|
|
var server = servers[key];
|
|
var button = document.getElementById(server.id);
|
|
if (server.running) {
|
|
button.disabled = false;
|
|
button.className += " 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 site(button) {
|
|
for (var key in servers) {
|
|
var server = servers[key];
|
|
if(button == server.id) {
|
|
switch(domaine) {
|
|
case "LOCAL_NAME":
|
|
if (typeof server.proxy != "undefined")
|
|
url=server.protocol+"://"+server.proxy;
|
|
else
|
|
url=server.protocol+"://"+server.name+":"+server.port;
|
|
break;
|
|
case "LOCAL_IP":
|
|
url=server.protocol+"://"+server.host+":"+server.port;
|
|
break;
|
|
case "LIVEBOX_IP":
|
|
break;
|
|
case "INTERNET":
|
|
break;
|
|
default:
|
|
console.log("erreur");
|
|
}
|
|
}
|
|
|
|
}
|
|
console.log(url);
|
|
document.location.href=url;
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|