Upload files to "install/html"
This commit is contained in:
338
install/html/settings.php
Normal file
338
install/html/settings.php
Normal file
@@ -0,0 +1,338 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
window.onload=function(){
|
||||
|
||||
setInterval(function() {
|
||||
var currentTime = new Date ( );
|
||||
var currentHours = currentTime.getHours ( );
|
||||
var currentMinutes = currentTime.getMinutes ( );
|
||||
var currentSeconds = currentTime.getSeconds ( );
|
||||
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
|
||||
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
|
||||
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
|
||||
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
|
||||
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
|
||||
var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
|
||||
document.getElementById("timer").innerHTML = currentTimeString;
|
||||
}, 1000);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
|
||||
//Var Setup
|
||||
$ftp_result=Pending;
|
||||
$overscan_result=Pending;
|
||||
$rotation_result=Pending;
|
||||
$net_result=Pending;
|
||||
$cron_result=Pending;
|
||||
|
||||
|
||||
//File setup
|
||||
$startup="/home/pi/config/autotest.sh";
|
||||
$hostname = gethostname();
|
||||
$hosts="/etc/hosts";
|
||||
$config="/boot/config.txt";
|
||||
$cron="/etc/cron.d/020_whit";
|
||||
$autotest="/home/pi/config/autotest.sh";
|
||||
$configtest="/home/pi/config/config1.txt";
|
||||
$wifitest="/home/pi/config/wifitest.sh";
|
||||
|
||||
/* Reboot call Requires
|
||||
add the following lines to:
|
||||
sudo nano /etc/sudoers.d/020_webdata
|
||||
www-data ALL=(root) NOPASSWD: /sbin/reboot
|
||||
www-data ALL=(root) NOPASSWD: /bin/cp
|
||||
www-data ALL=(root) NOPASSWD: /var/www/html/config/move.sh
|
||||
|
||||
sudo chmod 666 /etc/hosts
|
||||
sudo chmod 666 /etc/hostname
|
||||
sudo chmod 666 /var/www/html/config.txt
|
||||
sudo chmod 666 /etc/wpa_supplicant/wpa_supplicant.conf
|
||||
|
||||
*/
|
||||
// ifconfig info for mac settings.
|
||||
exec("ifconfig eth0 | grep 'inet ' | cut -d: -f2 | awk '{ print $2}'",$getipinfo);
|
||||
exec('ifconfig eth0 | grep ether ',$getipinfo);
|
||||
exec("ifconfig wlan0 | grep 'inet ' | cut -d: -f2 | awk '{ print $2}'",$getipinfo);
|
||||
exec('ifconfig wlan0 | grep ether ',$getipinfo);
|
||||
$getipinfo[1]=strtoupper(substr($getipinfo[1],14,-29));
|
||||
$getipinfo[3]=strtoupper(substr($getipinfo[3],14,-29));
|
||||
|
||||
|
||||
//get var for Overscan and Rotation
|
||||
$handle_cfg = file("$config");
|
||||
if (substr($handle_cfg[9],17,-1)==1){
|
||||
$getoverscan_d='checked';
|
||||
}
|
||||
else{
|
||||
$getoverscan_e='checked';
|
||||
}
|
||||
|
||||
if (substr($handle_cfg[10],15,-1)==0){
|
||||
$getrotate[0] = checked;
|
||||
}
|
||||
if (substr($handle_cfg[10],15,-1)==90){
|
||||
$getrotate[1] = checked;
|
||||
}
|
||||
if (substr($handle_cfg[10],15,-1)==180){
|
||||
$getrotate[2] = checked;
|
||||
}
|
||||
if (substr($handle_cfg[10],15,-1)==270){
|
||||
$getrotate[3] = checked;
|
||||
}
|
||||
|
||||
$autostart_cfg = file("$startup");
|
||||
//foreach($autostart_cfg as $fo) {
|
||||
//echo nl2br ($fo);
|
||||
//}
|
||||
|
||||
$getftp = (substr($autostart_cfg[13],7,-1));
|
||||
//echo nl2br ("\n");
|
||||
$getusername = (substr($autostart_cfg[14],5,-1));
|
||||
//echo nl2br ("\n");
|
||||
$getpassword = (substr($autostart_cfg[15],5,-1));
|
||||
//echo nl2br ("\n");
|
||||
$gettimeout = (substr($autostart_cfg[17],5,-1));
|
||||
//echo nl2br ("\n");
|
||||
$getapptype = (substr($autostart_cfg[20],8,-1));
|
||||
//echo nl2br ("\n");
|
||||
$getupdatewifi[0] = (substr($autostart_cfg[23],18,-1));
|
||||
//echo nl2br ("\n");
|
||||
$getssid = (substr($autostart_cfg[24],13,-1));
|
||||
//echo nl2br ("\n");
|
||||
$getpsk = (substr($autostart_cfg[25],20,-1));
|
||||
//echo nl2br ("\n");
|
||||
|
||||
if ($getupdatewifi[0]=='true'){
|
||||
$getupdatewifi[1]='checked';
|
||||
}
|
||||
else{
|
||||
$getupdatewifi[1]='not checked';
|
||||
}
|
||||
|
||||
|
||||
//setup vars for Cronjob
|
||||
$handle_cronjob = file($cron);
|
||||
$hselect = substr($handle_cronjob[0],3,-25);
|
||||
$mselect = substr($handle_cronjob[0],0,-28);
|
||||
|
||||
//Main Program
|
||||
|
||||
session_start();
|
||||
|
||||
//Write files to config file.
|
||||
|
||||
if(isset($_POST["update"])) {
|
||||
|
||||
// echo nl2br ("\n");
|
||||
// echo nl2br ("\n");
|
||||
|
||||
$autostart_cfg[14] = "USER=" . $_POST['username'] . ("\n");
|
||||
$autostart_cfg[15] = "PASS=" . $_POST['password'] . ("\n");
|
||||
$autostart_cfg[13] = "Server=" . $_POST['ftp'] . ("\n");
|
||||
$autostart_cfg[17] = "time=" . $_POST['timeout'] . ("\n");
|
||||
$autostart_cfg[23] = ("export wifiupdate=true\n");
|
||||
$autostart_cfg[24] = "export essid=" . $_POST['SSID'] . ("\n");
|
||||
$autostart_cfg[25] = "export wifipassword=" . $_POST['PSK'] . ("\n");
|
||||
$autostart_cfg[26] = "export updatehost=" . $_POST['netname'] . ("\n");
|
||||
|
||||
$autostart_cfg[36] = "export Reboottime=" . $_POST['crontime'] . ("\n");
|
||||
$autostart_cfg[37] = "export overscan=" . $_POST['overscan'] . ("\n");
|
||||
$autostart_cfg[38] = "export rotation=" . $_POST['rotate'] . ("\n");
|
||||
|
||||
|
||||
file_put_contents($autotest, $autostart_cfg);
|
||||
file_put_contents($configtest, $handle_cfg);
|
||||
header("refresh: 10;");
|
||||
exec('sudo /sbin/reboot');
|
||||
}
|
||||
|
||||
if(isset($_POST["reboot"])) {
|
||||
echo "Server is rebooting please wait.";
|
||||
exec('sudo /sbin/reboot');
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<body style="margin:0;">
|
||||
<head>
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th, td {
|
||||
text-align: left;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
tr:nth-child(even) {background-color: #f2f2f2;}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<!--<img src=".\logo.png">-->
|
||||
<table border="1" width ="90%" align= "top">
|
||||
<form name="input" action="" method="POST">
|
||||
<tr>
|
||||
<tr>
|
||||
<th align="center" width="30%"><b>Settings</b></th>
|
||||
<th align="center" width="20%"><b>Network</b></th>
|
||||
<th align="center" width="10%"><b>Overscan</b></th>
|
||||
<th align="center" width="10%"><b>Rotation</b></th>
|
||||
<th align="center" width="10%"><b>Update/reboot</b></th>
|
||||
</tr>
|
||||
<th align="left">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>Username:</td>
|
||||
<td><input name="username" type="text" value="<?php echo htmlspecialchars($getusername); ?>" class="username"></td>
|
||||
<!--<td>Site images:</td> -->
|
||||
<!--<td><input name="siteuser" type="checkbox" <?php echo $siteuser; ?> class="siteuser"></td>-->
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Password:</td>
|
||||
<td><input name="password" type="password" value="<?php echo htmlspecialchars($getpassword); ?>" class="password"></td>
|
||||
<!--<td>URL found:</td>-->
|
||||
<!--<td><input name="indexfound" type="checkbox" <?php echo $urlfound; ?> class="indexfound" disabled="disabled"></td>-->
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FTP Site:</td>
|
||||
<td><input name="ftp" type="text" value="<?php echo htmlspecialchars($getftp); ?>" class="ftp"></td>
|
||||
<!--<td>URL to image:</td>-->
|
||||
<!--<td><input name="indexyes" type="checkbox" <?php echo $urlused; ?> <?php echo $dis; ?> class="indexyes"></td>-->
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Time for next Slide:</td>
|
||||
<td><input name="timeout" type="text" value="<?php echo htmlspecialchars($gettimeout); ?>" class="timeout"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<th align="left">
|
||||
<table>
|
||||
<tr>
|
||||
<td>SSID</td>
|
||||
<td><input name="SSID" type="text" value="<?php echo htmlspecialchars($getssid); ?>" class="SSID"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PSK</td>
|
||||
<td><input name="PSK" type="password" value="<?php echo htmlspecialchars($getpsk); ?>" class="PSK"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Host Name</td>
|
||||
<td><input name="netname" type="text" value="<?php echo htmlspecialchars($hostname); ?>" class="netname"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</th>
|
||||
<th align="left">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Enabled</td>
|
||||
<td><input type="radio" name="overscan" value="0" <?php echo htmlspecialchars($getoverscan_e); ?> ></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Disabled</td>
|
||||
<td><input type="radio" name="overscan" value="1" <?php echo htmlspecialchars($getoverscan_d); ?> ></td>
|
||||
</tr>
|
||||
</table>
|
||||
</th>
|
||||
<th>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Normal 0°</td>
|
||||
<td><input type="radio" name="rotate" value="0" <?php echo htmlspecialchars($getrotate[0]); ?>></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>90°</td>
|
||||
<td><input type="radio" name="rotate" value="1" <?php echo htmlspecialchars($getrotate[1]); ?>></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>180°</td>
|
||||
<td><input type="radio" name="rotate" value="2" <?php echo htmlspecialchars($getrotate[2]); ?>></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>270°</td>
|
||||
<td><input type="radio" name="rotate" value="3" <?php echo htmlspecialchars($getrotate[3]); ?>></td>
|
||||
</tr>
|
||||
</table>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="settings.pdf" target="_blank">Help</a></td>
|
||||
<td >Lan info</td>
|
||||
<td colspan="2"> Wifi info</td>
|
||||
</tr>
|
||||
<td>
|
||||
<table border="0" width="100%">
|
||||
<td> Server time:</td>
|
||||
<td><div id="timer"></div>
|
||||
<script>
|
||||
// tell the embed parent frame the height of the content
|
||||
if (window.parent && window.parent.parent){
|
||||
window.parent.parent.postMessage(["resultsFrame", {
|
||||
height: document.body.getBoundingClientRect().height,
|
||||
slug: "pLsgJ"
|
||||
}], "*")
|
||||
}
|
||||
|
||||
// always overwrite window.name, in case users try to set it manually
|
||||
window.name = "result"
|
||||
</script>
|
||||
</td>
|
||||
<!--<td><iframe src="servertime.php" name="main" frameBorder="0" height="30px" width="140px" scrolling="no"></iframe></td>-->
|
||||
<td> Set a time for nightly Reboot: </td>
|
||||
<td><input type="time" id="crontime" value="<?php echo $hselect; ?>:<?php echo $mselect;?>" name="crontime" Required></td>
|
||||
|
||||
</table>
|
||||
<th align="left">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Lan IP address:</td>
|
||||
<td><?php echo $getipinfo[0]; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Lan Mac address:</td>
|
||||
<td><?php echo $getipinfo[1]; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</th>
|
||||
|
||||
<th align="left" colspan="2">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Wifi IP address:</td>
|
||||
<td><?php echo $getipinfo[2]; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Wifi Mac address:</td>
|
||||
<td><?php echo $getipinfo[3]; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</th>
|
||||
<th>
|
||||
<form name="restart" action="" method="POST">
|
||||
<input type="submit" class="button" value="Update and Reboot" name="update">
|
||||
<input type="submit" class="button" value="Reboot" name="reboot">
|
||||
</th>
|
||||
</table>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
?>
|
||||
Reference in New Issue
Block a user