kc-interface/info.php

242 lines
4.5 KiB
PHP
Raw Normal View History

2022-12-20 14:30:30 +01:00
<!doctype html>
<?php
$lang=$_GET['lang'];
if ( in_array ($lang, array('en-US'))){
$loc = "$lang".".utf8";
$loc1 = $lang;
}
else {
$loc = "de-DE";
$loc1 = "de-DE";
}
$color=$_GET['color'];
if (strlen($color) <= 1){
$color = "deeppink";
}
include "Spyc.php";
$localeYaml = Spyc::YAMLLoad('locale.yaml');
$domain = "messages";
setlocale(LC_MESSAGES, $loc);
setlocale(LC_ALL, $loc);
$results = putenv("LC_ALL=$loc");
$results = putenv("LC_MESSAGES=$loc");
?>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title><?php echo $localeYaml['title'][$loc1]?></title>
2022-12-20 14:30:30 +01:00
<link rel="stylesheet" href="css/index.css">
</head>
<style>
body {
background: <?php echo $color?>;
2022-12-20 14:30:30 +01:00
}
input[type="text"] {
background: <?php echo $color?>;
2022-12-20 14:30:30 +01:00
}
input[type="text"]:focus {
background: <?php echo $color?>;
2022-12-20 14:30:30 +01:00
}
</style>
<body>
<center>
<div id="containerdiv">
<a href="/"><p id="linktext"><b><?php echo $localeYaml['connect'][$loc1]?></b></p></a>
<a href="changeKCPW.php"><p id="linktext"><?php echo $localeYaml['changePassword'][$loc1]?></p></a>
<a href="info.php"><p id="linktext"><?php echo $localeYaml['info'][$loc1]?></p></a>
<a href="onion.php"><p id="linktext"><?php echo $localeYaml['onionFeatures'][$loc1]?></p></a>
<a href="freedom.php"><p id="linktext"><?php echo $localeYaml['freedom'][$loc1]?></p></a>
2022-12-20 14:30:30 +01:00
</div>
</center>
<br><br><br>
<center>
<img src="images/info_graffiti_digitalized.png">
</center>
2022-12-20 14:30:30 +01:00
<?php
$shellcommand2 = "nmcli c show > connections.csv";
$output = shell_exec($shellcommand2);
?>
<br><br><br><br><br><br>
<center>
<?php echo $localeYaml['connections'][$loc1]?>
2022-12-20 14:30:30 +01:00
<table id="demo"><tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<?php
// (A) OPEN CSV FILE
$stream = fopen("connections.csv", "r");
// (B) EXTRACT ROWS & COLS
while (($row = fgets($stream)) !== false) {
echo "<tr>";
$col = preg_split( '/\s{2,}/', $row, -1, PREG_SPLIT_NO_EMPTY );
// var_dump( preg_split( '/\s{2,}/', $row ) );
$n = 0;
$id = 'oi';
foreach ($col as $c)
{
$n+=1;
echo "<td>$c</td>";
if ($n==1)
{
$id=substr($c, 0, -1);
}
}
echo "</tr>";
}
// (C) CLOSE CSV FILE
fclose($stream);
?></table>
</center>
</br></br></br></br>
<?php
$shellcommand3 = "nmcli dev status > devices.csv";
$output = shell_exec($shellcommand3);
?>
<br><br><br><br><br><br>
<center>
<?php echo $localeYaml['devices'][$loc1]?>
2022-12-20 14:30:30 +01:00
<table id="demo"><tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<?php
// (A) OPEN CSV FILE
$stream = fopen("devices.csv", "r");
// (B) EXTRACT ROWS & COLS
while (($row = fgets($stream)) !== false) {
echo "<tr>";
$col = preg_split( '/\s{2,}/', $row, -1, PREG_SPLIT_NO_EMPTY );
// var_dump( preg_split( '/\s{2,}/', $row ) );
$n = 0;
$id = 'oi';
foreach ($col as $c)
{
$n+=1;
echo "<td>$c</td>";
if ($n==1)
{
$id=substr($c, 0, -1);
}
}
echo "</tr>";
}
// (C) CLOSE CSV FILE
fclose($stream);
?></table>
</center>
</br></br></br></br>
<?php
$shellcommand2 = "nmcli -t --fields SSID,RATE,BARS,SECURITY dev wifi list > ssids.csv";
$output = shell_exec($shellcommand2);
?>
<center>
<?php echo $localeYaml['ssids'][$loc1]?>
2022-12-20 14:30:30 +01:00
<table id="demo"><tr>
<th>SSID</th>
<th>RATE</th>
<th>BARS</th>
<th>SEC</th>
</tr>
<?php
// (A) OPEN CSV FILE
$stream = fopen("ssids.csv", "r");
// (B) EXTRACT ROWS & COLS
while (($row = fgets($stream)) !== false) {
echo "<tr>";
$col = preg_split( '/:/', $row, -1, PREG_SPLIT_NO_EMPTY );
// var_dump( preg_split( '/\s{2,}/', $row ) );
$n = 0;
$id = 'oi';
foreach ($col as $c)
{
$n+=1;
echo "<td>$c</td>";
if ($n==1)
{
$id=substr($c, 0, -1);
}
}
echo "</tr>";
}
// (C) CLOSE CSV FILE
fclose($stream);
?></table>
</center>
</br></br></br></br>
<footer>
<center>
<a href="mailto:contact@cannabinieri.de"><p id="linktext"><?php echo $localeYaml['contact'][$loc1]?></p></a>
2022-12-20 14:30:30 +01:00
<p>© 2022 by Cannabinieri </p>
<address>
https://www.cannabinieri.de<br>
E-Mail: contact@cannabinieri.de<br><br>
</address>
</center>
</footer>
</center>
<center>
<div id="containerdiv2">
<a href="?color=deeppink"><p id="linktext"><b>pink</b></p></a>
<a href="?color=lightblue"><p id="linktext">azurro</p></a>
</div>
</center>
</body>
</html>