main.php
4.38 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE html>
<html>
<head>
<title>Commande Appareil</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x"
crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
crossorigin="anonymous">
</script>
</head>
<body style="background-color:grey;">
<form method="post" action="index.html">
<input type="submit" value="Retour a l'accueil" class="btn btn-secondary"/>
</form><br/>
<form method="post" action="decouvre.php">
<input type="submit" value="Retourner à la recherche d'appareil" class="btn btn-success"/>
</form><br/>
<div class="text-white">
<?php
/* Recuperation de l'adresse et du nom de l'appareil choisi */
session_start();
if(isset($_POST['App'])){
/* Methode POST (quand on vient de la page de recherche/choix d'appareils */
$number = 0;
$App = $_POST['App'];
$_SESSION['App']=$App;
foreach($App as $element){
$number++;
$donnees=explode("$",$element);
$nom = $donnees[0];
$type = $donnees[1];
$adresse = $donnees[2];
/* DEBUG */
/* Affichage des données de l'appareil (nom,type et adresse IP) */
/*echo "Données de l'appareil $number choisi : <br/>";
echo "Nom : ".$nom."<br/>";
echo "Adresse : ".$adresse."<br/>";
echo 'Type : '.$type.'<br/>';
echo "<br/>";*/
$Appareil[$number-1]['nom'] = $nom;
$Appareil[$number-1]['type'] = $type;
$Appareil[$number-1]['adresse'] = $adresse;
}
}else if(isset($_SESSION['App'])){
/* Session (quand on vient de la page main) */
$number = 0;
$App = $_SESSION['App'];
foreach($App as $element){
$number++;
$donnees=explode("$",$element);
$nom = $donnees[0];
$type = $donnees[1];
$adresse = $donnees[2];
/* DEBUG */
/* Affichage des données de l'appareil (nom,type et adresse IP) */
/*echo "Données de l'appareil $number choisi : <br/>";
echo "Nom : ".$nom."<br/>";
echo "Adresse : ".$adresse."<br/>";
echo 'Type : '.$type.'<br/>';
echo "<br/>";*/
$Appareil[$number-1]['nom'] = $nom;
$Appareil[$number-1]['type'] = $type;
$Appareil[$number-1]['adresse'] = $adresse;
}
}else{
/* Si par erreur on arrive sur cette page : redirection vers la page principale */
echo "Pas de sélection réalisée, vous allez être redirigé";
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.html\">";
}
/*if(isset($_GET['tab'])){
$tab=$_GET['tab'];
}else{
$tab="Global";
}*/
/* TODO : Noms des variables plus clair */
for($i=0;$i<count($Appareil);$i++){
$chemin = getcwd().'/'.$Appareil[$i]['type'];
$adresse = $Appareil[$i]['adresse'];
$files = array_diff(scandir($chemin),array('..','.'));
foreach($files as $type_cmd){
$new_cmd = $chemin.'/'.$type_cmd;
if(is_file($new_cmd) and strpos($new_cmd,"/commandes")!=false){
include($new_cmd);
}
}
}
/*for($i=0;$i<count($Appareil);$i++){
$chemin = getcwd().'/'.$Appareil[$i]['type'];
$adresse = $Appareil[$i]['adresse'];
$files = array_diff(scandir($chemin),array('..','.'));
foreach($files as $dir){
$chemin2 = $chemin.'/'.$dir;
if(is_dir($chemin2)){
$new_dir = array_diff(scandir($chemin2),array('..','.'));
foreach($new_dir as $fichiers){
$chemin3 = $chemin2."/".$fichiers;
if(is_dir($chemin3)){
$cmd_files = array_diff(scandir($chemin3),array('..','.'));
foreach($cmd_files as $cmd){
$path = $chemin3.'/'.$cmd;
if(is_file($path) && strpos($path,"cmd")!=false){
include($path);
}
}
}
}
}
}
}*/
?>
</div>
<br/>
<?php
for($i=0;$i<count($Appareil);$i++){
$chemin = getcwd().'/'.$Appareil[$i]['type'];
$adresse = $Appareil[$i]['adresse'];
$files = array_diff(scandir($chemin),array('..','.'));
foreach($files as $type_form){
$new_form = $chemin.'/'.$type_form;
if(is_file($new_form) and strpos($new_form,"/main")!=false){
include($new_form);
}
}
}
for($i=0;$i<count($Appareil);$i++){
include(getcwd().'/Scripts/refresh_img.php');
}
?>
</body>
</html>