<?php require 'config.php'; require 'auth.php'; if ($config['salt'] == '') { header('Content-Type: text/plain'); die('Please check and configure config.php first.'); } if (!$config['skip_log_in'] && ($message = LogInMessage()) !== true) { ?> <!DOCTYPE html> <html> <head> <title><?php echo strip_tags($config['title']); ?> - Login</title> <link rel="stylesheet" media="screen" href="style.css"/> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> </head> <body> <h1><?php echo $config['title']; ?> - Login</h1> <form action="" method="post"> <div id="login"> <?php if ($message) { echo '<div class="error">' . $message . '</div>'; }
$path = getenv('PATH'); // split by : $path = explode(':', $path); foreach ($config['paths'] as &$p) { if (!in_array($p, $path)) { // not already in PATH; append it $path[] =& $p; } } // compile again $path = implode(':', $path); // update environment putenv('PATH=' . $path); } } if (!$config['skip_log_in'] && LogInMessage() !== true) { die('Not authenticated.'); } if (!isset($_POST['cmd'])) { die('Nothing to do! Needs `cmd\' parameter.'); } if (!isset($_POST['cd'])) { die('`cd\' parameter is required.'); } $cmd = $_POST['cmd']; $cd = $_POST['cd']; // response $json = array(); // `cd' does nothing but move back home if (trim($cmd) == 'cd') { // change to home