. * * home.php * * Invenktory home page. * * @author Daniele Bonini * @copyrights (c) 2021, 2024, 5 Mode */ $cmdHistory = []; $cmd = PHP_STR; $opt = PHP_STR; $param1 = PHP_STR; $param2 = PHP_STR; $param3 = PHP_STR; $cmdRecallHistory = []; $editBoard = []; $editBoardParams = []; function showHistory() { global $cmdHistory; $i = 1; foreach($cmdHistory as $val) { echo(str_replace("\n", "
", $val)); $i++; } } function updateHistory(&$update, $maxItems) { global $cmdHistory; // Making enough space in $cmdHistory for the update.. $shift = (count($cmdHistory) + count($update)) - $maxItems; if ($shift > 0) { $cmdHistory = array_slice($cmdHistory, $shift, $maxItems); } // Adding $cmdHistory update.. if (count($update) > $maxItems) { $beginUpd = count($update) - ($maxItems-1); } else { $beginUpd = 0; } $update = array_slice($update, $beginUpd, $maxItems); foreach($update as $val) { $cmdHistory[] = $val; } // Writing out $cmdHistory on disk.. $filepath = dirname(__DIR__) . PHP_SLASH . "logs" . PHP_SLASH . ".INV_history"; file_put_contents($filepath, implode('', $cmdHistory)); } function loadRecallHistory() { global $cmdRecallHistory; $tmpcmdRecallHistory = file(dirname(__DIR__) . PHP_SLASH . "logs" . PHP_SLASH . ".INV_Recallhistory"); foreach($tmpcmdRecallHistory as $val) { $cmdRecallHistory[left($val, strlen($val)-1)]=$val; } } function updateRecallHistory($update, $maxItems) { global $cmdRecallHistory; if (!array_key_exists($update, $cmdRecallHistory)) { // Making enough space in $cmdHistory for the update.. $shift = (count($cmdRecallHistory) + 1) - $maxItems; if ($shift > 0) { $cmdRecallHistory = array_slice($cmdRecallHistory, $shift, $maxItems); } $cmdRecallHistory[$update] = $update . "\n"; } // Writing out $cmdRecallHistory on disk.. $filepath = dirname(__DIR__) . PHP_SLASH . "logs" . PHP_SLASH . ".INV_Recallhistory"; file_put_contents($filepath, implode('', $cmdRecallHistory)); } function updateHistoryWithErr(string $err, bool $withCommand = true) { global $prompt; global $command; $output = []; if ($withCommand) { $output[] = $prompt . " " . $command . "\n"; } $output[] = "$err\n"; updateHistory($output, HISTORY_MAX_ITEMS); } function myExecCommand() { global $prompt; global $command; // Exec command.. $output = []; $output[] = $prompt . " " . $command . "\n"; exec($command, $output); // Update history.. foreach ($output as &$val) { if (right($val,1)!="\n") { $val = $val . "\n"; } } updateRecallHistory($command, RECALL_HISTORY_MAX_ITEMS); updateHistory($output, HISTORY_MAX_ITEMS); } function myExecCPCommand() { global $prompt; global $command; $realCommand = str_replace("cp", "cp -Rp", $command); // Exec command.. $output = []; $output[] = $prompt . " " . $command . "\n"; exec($realCommand, $output); // Update history.. foreach ($output as &$val) { if (right($val,1)!="\n") { $val = $val . "\n"; } } updateRecallHistory($command, RECALL_HISTORY_MAX_ITEMS); updateHistory($output, HISTORY_MAX_ITEMS); } function myExecCopy() { global $prompt; global $command; global $param1; global $param2; // Exec command.. $output = []; $output[] = $prompt . " " . $command . "\n"; copy($param1, $param2); // Update history.. foreach ($output as &$val) { if (right($val,1)!="\n") { $val = $val . "\n"; } } updateRecallHistory($command, RECALL_HISTORY_MAX_ITEMS); updateHistory($output, HISTORY_MAX_ITEMS); } function myExecCDFolderCommand() { global $prompt; global $command; global $param1; global $curPath; // Exec command.. $output = []; $output[] = $prompt . " " . $command . "\n"; //exec($command, $output); $newPath = $curPath . PHP_SLASH . $param1; chdir($newPath); $curPath = $newPath; $curDir = $param1; // Creating the Download folder if doesn't exist.. $downloadPath = $curPath . PHP_SLASH . ".HCdownloads"; if (!file_exists($downloadPath)) { //copy(APP_INV_PATH . PHP_SLASH . ".HCsampledir", $downloadPath); $mycmd = "cp -Rp " . APP_INV_PATH . PHP_SLASH . ".HCsampledir" . " " . $downloadPath; $myret = exec($mycmd); } $prompt = str_replace("$1", $curDir, APP_PROMPT); // Update history.. foreach ($output as &$val) { if (right($val,1)!="\n") { $val = $val . "\n"; } } updateRecallHistory($command, RECALL_HISTORY_MAX_ITEMS); updateHistory($output, HISTORY_MAX_ITEMS); } function myExecCDBackwCommand() { global $prompt; global $command; global $curPath; // Exec command.. $output = []; $output[] = $prompt . " " . $command . "\n"; //exec($command, $output); $ipos = strripos($curPath, PHP_SLASH); $newPath = substr($curPath, 0, $ipos); chdir($newPath); $curPath = getcwd(); $ipos = strripos($curPath, PHP_SLASH); $curDir = substr($curPath, $ipos); $prompt = str_replace("$1", $curDir, APP_PROMPT); // Update history.. foreach ($output as &$val) { if (right($val,1)!="\n") { $val = $val . "\n"; } } updateRecallHistory($command, RECALL_HISTORY_MAX_ITEMS); updateHistory($output, HISTORY_MAX_ITEMS); } function myarray_filter_cb($val) { return isset($val); } function myExecLSCommand() { global $prompt; global $command; global $curPath; $downloadPath = $curPath . PHP_SLASH . ".HCdownloads"; $realCommand = "ls -a"; // Exec command.. $output = []; $output[] = $prompt . " " . $command . "\n"; exec($realCommand, $output); // Creating the Download path for the current folder.. /* if (!file_exists($downloadPath)) { //copy(APP_INV_PATH . PHP_SLASH . ".HCsampledir", $downloadPath); $mycmd = "cp -Rp " . APP_INV_PATH . PHP_SLASH . ".HCsampledir" . " " . $downloadPath; $myret=exec($mycmd); } // Cleaning the Download folder.. if (file_exists($downloadPath)) { $files1 = scandir($downloadPath); foreach($files1 as $file) { if (!is_dir($downloadPath . PHP_SLASH . $file) && $file !== "." && $file !== "..") { unlink($downloadPath . PHP_SLASH . $file); } } }*/ // Update history.. foreach ($output as &$val) { if ($val === $prompt . " " . $realCommand . "\n") { } else if ($val === "." || $val === "..") { $val = null; } else { if (right($val,1)==="\n") { $val = left($val, strlen($val)-1); } // Creating the tmp download for the file entry and generating the virtual path.. /* $virtualPath = PHP_STR; if (file_exists($downloadPath)) { if (!is_dir($curPath . PHP_SLASH . $val) && filesize($curPath . PHP_SLASH . $val)<=651000) { $fileext = strtolower(pathinfo($val, PATHINFO_EXTENSION)); if ($fileext === "php" || $fileext === "inc") { copy($curPath . PHP_SLASH . $val, $downloadPath . PHP_SLASH . $val . ".hcd"); $virtualPath = getVirtualPath($downloadPath . PHP_SLASH . $val . ".hcd"); } else { copy($curPath . PHP_SLASH . $val, $downloadPath . PHP_SLASH . $val); $virtualPath = getVirtualPath($downloadPath . PHP_SLASH . $val); } } } else { $virtualPath=PHP_STR; } if ($virtualPath!==PHP_STR) { $val = "" . $val . "\n"; } else { $val = $val . "\n"; } */ $val = $val . "\n"; } } $output = array_filter($output, "myarray_filter_cb"); updateRecallHistory($command, RECALL_HISTORY_MAX_ITEMS); updateHistory($output, HISTORY_MAX_ITEMS); } function myExecHelpCommand() { global $prompt; global $command; // Exec command.. $output = []; $output[] = $prompt . " " . $command . "\n"; //exec($command, $output); //cd, cd.., cp, help, ls, ls -lsa, mv, pwd $output[] = "Copyright 2021, 2024 5 Mode" . "\n"; $output[] = "Invenktory is licensed GNUv3" . "\n"; $output[] = "" . "\n"; $output[] = "Supported commands are:" . "\n"; $output[] = "cd" . "\n"; $output[] = "cd .." . "\n"; $output[] = "cp" . "\n"; $output[] = "edit" . " " . "[CTRL]+[X]=Close [CTRL]+[S]=Save" . "\n"; $output[] = "help" . "\n"; $output[] = "ls" . "\n"; $output[] = "mv" . "\n"; $output[] = "pwd" . "\n"; $output[] = "show" . "\n"; $output[] = "\n"; $output[] = "Thx for using Invenktory! :)" . "\n"; $output[] = "\n"; // Update History updateRecallHistory($command, RECALL_HISTORY_MAX_ITEMS); updateHistory($output, HISTORY_MAX_ITEMS); } function myExecPWDCommand() { global $prompt; global $command; global $curPath; // Exec command.. $output = []; $output[] = $prompt . " " . $command . "\n"; exec($command, $output); // Update history.. foreach ($output as &$val) { if (mb_stripos("~".$val,APP_INV_PATH)) { $val = str_replace(dirname(APP_INV_PATH), "~ ", $val) . "\n"; } } updateRecallHistory($command, RECALL_HISTORY_MAX_ITEMS); updateHistory($output, HISTORY_MAX_ITEMS); } function myExecShowCommand() { global $prompt; global $command; global $param1; global $curPath; // Exec command.. $output = []; $output[] = $prompt . " " . $command . "\n"; //exec($command, $output); $path = $curPath . DIRECTORY_SEPARATOR . $param1; $xml = simplexml_load_file($path); $output[] = "\n"; $output[] = "Location: " . $xml->attributes()['location'] . "\n"; $output[] = "\n"; // Printing out the item descriptions foreach ($xml->children() as $child) { $text = $child->DESCRIPTION; $text = ltrim($text,PHP_SPACE); $text = rtrim($text,PHP_SPACE); $text = ltrim($text,"\n"); $text = rtrim($text,"\n"); $output[] = $child->attributes()['type'] . " #" . $child->INDEX . ":\n" . $text . "\n"; } $output[] = "\n"; // Update History updateRecallHistory($command, RECALL_HISTORY_MAX_ITEMS); updateHistory($output, HISTORY_MAX_ITEMS); } function parseCommand() { global $command; global $cmd; global $opt; global $param1; global $param2; global $param3; $str = trim($command); $ipos = stripos($str, PHP_SPACE); if ($ipos > 0) { $cmd = left($str, $ipos); $str = substr($str, $ipos+1); } else { $cmd = $str; return; } if (left($str, 1) === "-") { $ipos = stripos($str, PHP_SPACE); if ($ipos > 0) { $opt = left($str, $ipos); $str = substr($str, $ipos+1); } else { $opt = $str; return; } } $ipos = stripos($str, PHP_SPACE); if ($ipos > 0) { $param1 = left($str, $ipos); $str = substr($str, $ipos+1); } else { $param1 = $str; return; } $ipos = stripos($str, PHP_SPACE); if ($ipos > 0) { $param2 = left($str, $ipos); $str = substr($str, $ipos+1); } else { $param2 = $str; return; } $ipos = stripos($str, PHP_SPACE); if ($ipos > 0) { $param3 = left($str, $ipos); $str = substr($str, $ipos+1); } else { $param3 = $str; return; } } function cdparamValidation() { global $curPath; global $opt; global $param1; global $param2; global $param3; //opt=="" if ($opt!=PHP_STR) { updateHistoryWithErr("invalid options"); return false; } //param1=="" if ($param1===PHP_STR) { updateHistoryWithErr("invalid parameters"); return false; } //param1!="" and !isword if (($param1!==PHP_STR) && !is_word($param1)) { updateHistoryWithErr("invalid dir"); return false; } //param2=="" if ($param2!==PHP_STR) { updateHistoryWithErr("invalid parameters"); return false; } //param3=="" if ($param3!=PHP_STR) { updateHistoryWithErr("invalid parameters"); return false; } //param1 exist and is_dir $path = $curPath . PHP_SLASH . $param1; if (!file_exists($path) || !is_dir($path)) { updateHistoryWithErr("dir doesn't exist"); return false; } return true; } function is_subfolderdest(string $path): bool { global $curPath; $ret=false; if ($path === "../") { return $ret; } if ($path!=PHP_STR) { $folderName = left($path, strlen($path)-1); if (!is_word($folderName)) { return $ret; } if (is_dir($curPath . PHP_SLASH . $folderName) && (right($path,1)==="/")) { $ret=true; } } return $ret; } function cpparamValidation() { global $curPath; global $opt; global $param1; global $param2; global $param3; //ori opt!="" and opt!="-R" and opt!="-Rp" //ori if (($opt!==PHP_STR) && ($opt!=="-R") && ($opt!=="-Rp") && ($opt!=="-p")) { if ($opt!==PHP_STR) { updateHistoryWithErr("invalid options"); return false; } //param1!="" and isword if (($param1===PHP_STR) || !is_word($param1)) { updateHistoryWithErr("invalid source path"); return false; } //param2!="" and (isword or param2=="../" or is_subfolderdest) if (($param2===PHP_STR) || (!is_word($param2) && ($param2!="../") && !is_subfolderdest($param2))) { updateHistoryWithErr("invalid destination path"); return false; } //param3=="" if ($param3!=PHP_STR) { updateHistoryWithErr("invalid parameters"); return false; } //param1 != param2 if ($param1 === $param2) { updateHistoryWithErr("source same as destination"); return false; } //param1 exist $path = $curPath . PHP_SLASH . $param1; if (!file_exists($path)) { updateHistoryWithErr("source must exists"); return false; } //isword(param2) && doesn't exist if (is_word($param2)) { $path = $curPath . PHP_SLASH . $param2; if (file_exists($path)) { updateHistoryWithErr("destination already exists"); return false; } } // param2=="../" && is_root // param2=="../" && dest exists if ($param2==="../") { if ($curPath === APP_INV_PATH) { updateHistoryWithErr("out of root boundary"); return false; } $path = dirname($curPath) . PHP_SLASH . $param1; if (file_exists($path)) { updateHistoryWithErr("destination already exists"); return false; } } return true; } function mvparamValidation() { global $curPath; global $opt; global $param1; global $param2; global $param3; //opt!="" if ($opt!=PHP_STR) { updateHistoryWithErr("invalid options"); return false; } //param1!="" and isword if (($param1===PHP_STR) || !is_word($param1)) { updateHistoryWithErr("invalid source path"); return false; } //param2!="" and (isword or param2=="../" or is_subfolderdest) if (($param2===PHP_STR) || (!is_word($param2) && ($param2!="../") && !is_subfolderdest($param2))) { updateHistoryWithErr("invalid destination path"); return false; } //param3!="" if ($param3!=PHP_STR) { updateHistoryWithErr("invalid parameters"); return false; } //param1 != param2 if ($param1 === $param2) { updateHistoryWithErr("source same as destination"); return false; } //param1 exist $path = $curPath . PHP_SLASH . $param1; if (!file_exists($path)) { updateHistoryWithErr("source must exists"); return false; } //isword(param2) && doesn't exist if (is_word($param2)) { $path = $curPath . PHP_SLASH . $param2; if (file_exists($path)) { updateHistoryWithErr("destination already exists"); return false; } } // param2=="../" && is_root // param2=="../" && dest exists if ($param2==="../") { if ($curPath === APP_INV_PATH) { updateHistoryWithErr("out of root boundary"); return false; } $path = dirname($curPath) . PHP_SLASH . $param1; if (file_exists($path)) { updateHistoryWithErr("destination already exists"); return false; } } return true; } function myExecEditCommand() { global $prompt; global $command; global $param1; global $curPath; // Exec command.. $output = []; $output[] = $prompt . " " . $command . "\n"; //exec($command, $output); $path = $curPath . DIRECTORY_SEPARATOR . $param1; loadEditBoard($path); // Update History updateRecallHistory($command, RECALL_HISTORY_MAX_ITEMS); updateHistory($output, HISTORY_MAX_ITEMS); } function loadEditBoard($file) { global $editBoard; $xml = simplexml_load_file($file); $editBoard[] = "\n"; $editBoard[] = "\n"; } function showEditBoard() { global $editBoard; $i = 1; foreach($editBoard as $val) { //echo(str_replace("\n", "
", $val)); echo($val); $i++; } } function showparamValidation() { global $curPath; global $opt; global $param1; global $param2; global $param3; //opt!="" if ($opt!==PHP_STR) { updateHistoryWithErr("invalid options"); return false; } //param1!="" and isword if (($param1===PHP_STR) || !is_word($param1)) { updateHistoryWithErr("invalid inventory file"); return false; } //param2!="" and (isword or param2=="../" or is_subfolderdest) if ($param2!=PHP_STR) { updateHistoryWithErr("invalid parameters"); return false; } //param3=="" if ($param3!=PHP_STR) { updateHistoryWithErr("invalid parameters"); return false; } //param1 exist $path = $curPath . PHP_SLASH . $param1; if (!file_exists($path)) { updateHistoryWithErr("file must exists"); return false; } //param1 is_file if (!is_file($path)) { updateHistoryWithErr("invalid inventory file"); return false; } //param1 file extension == xml $fileExt = pathinfo($param1, PATHINFO_EXTENSION); if ($fileExt != "xml") { updateHistoryWithErr("invalid inventory file"); return false; } return true; } function editparamValidation() { global $curPath; global $opt; global $param1; global $param2; global $param3; //opt!="" if ($opt!==PHP_STR) { updateHistoryWithErr("invalid options"); return false; } //param1!="" and isword if (($param1===PHP_STR) || !is_word($param1)) { updateHistoryWithErr("invalid inventory file"); return false; } //param2!="" and (isword or param2=="../" or is_subfolderdest) if ($param2!=PHP_STR) { updateHistoryWithErr("invalid parameters"); return false; } //param3=="" if ($param3!=PHP_STR) { updateHistoryWithErr("invalid parameters"); return false; } //param1 exist $path = $curPath . PHP_SLASH . $param1; if (!file_exists($path)) { updateHistoryWithErr("file must exists"); return false; } //param1 is_file if (!is_file($path)) { updateHistoryWithErr("invalid inventory file"); return false; } //param1 file extension == xml $fileExt = pathinfo($param1, PATHINFO_EXTENSION); if ($fileExt != "xml") { updateHistoryWithErr("invalid inventory file"); return false; } return true; } function upload() { global $curPath; global $prompt; //if (!empty($_FILES['files'])) { if (!empty($_FILES['files']['tmp_name'][0])) { // Updating history.. $output = []; $output[] = $prompt . " " . "File upload" . "\n"; updateHistory($output, HISTORY_MAX_ITEMS); $uploads = (array)fixMultipleFileUpload($_FILES['files']); //no file uploaded if ($uploads[0]['error'] === PHP_UPLOAD_ERR_NO_FILE) { updateHistoryWithErr("No file uploaded.", false); return; } foreach($uploads as &$upload) { switch ($upload['error']) { case PHP_UPLOAD_ERR_OK: break; case PHP_UPLOAD_ERR_NO_FILE: updateHistoryWithErr("One or more uploaded files are missing.", false); return; case PHP_UPLOAD_ERR_INI_SIZE: updateHistoryWithErr("File exceeded INI size limit.", false); return; case PHP_UPLOAD_ERR_FORM_SIZE: updateHistoryWithErr("File exceeded form size limit.", false); return; case PHP_UPLOAD_ERR_PARTIAL: updateHistoryWithErr("File only partially uploaded.", false); return; case PHP_UPLOAD_ERR_NO_TMP_DIR: updateHistoryWithErr("TMP dir doesn't exist.", false); return; case PHP_UPLOAD_ERR_CANT_WRITE: updateHistoryWithErr("Failed to write to the disk.", false); return; case PHP_UPLOAD_ERR_EXTENSION: updateHistoryWithErr("A PHP extension stopped the file upload.", false); return; default: updateHistoryWithErr("Unexpected error happened.", false); return; } if (!is_uploaded_file($upload['tmp_name'])) { updateHistoryWithErr("One or more file have not been uploaded.", false); return; } // name $name = (string)substr((string)filter_var($upload['name']), 0, 255); if ($name == PHP_STR) { updateHistoryWithErr("Invalid file name: " . $name, false); return; } $upload['name'] = $name; // fileType $fileType = substr((string)filter_var($upload['type']), 0, 30); $upload['type'] = $fileType; // tmp_name $tmp_name = substr((string)filter_var($upload['tmp_name']), 0, 300); if ($tmp_name == PHP_STR || !file_exists($tmp_name)) { updateHistoryWithErr("Invalid file temp path: " . $tmp_name, false); return; } $upload['tmp_name'] = $tmp_name; //size $size = substr((string)filter_var($upload['size'], FILTER_SANITIZE_NUMBER_INT), 0, 12); if ($size == "") { updateHistoryWithErr("Invalid file size.", false); return; } $upload["size"] = $size; $tmpFullPath = $upload["tmp_name"]; $originalFilename = pathinfo($name, PATHINFO_FILENAME); $originalFileExt = pathinfo($name, PATHINFO_EXTENSION); $FileExt = strtolower(pathinfo($name, PATHINFO_EXTENSION)); if ($originalFileExt!==PHP_STR) { $destFileName = $originalFilename . "." . $originalFileExt; } else { $destFileName = $originalFilename; } $destFullPath = $curPath . PHP_SLASH . $destFileName; if (file_exists($destFullPath)) { updateHistoryWithErr("destination already exists", false); return; } copy($tmpFullPath, $destFullPath); // Updating history.. $output = []; $output[] = $destFileName . " " . "uploaded" . "\n"; updateHistory($output, HISTORY_MAX_ITEMS); // Cleaning up.. // Delete the tmp file.. unlink($tmpFullPath); } } } function saveEditBoard() { global $editBoardParams; if (!empty($editBoardParams) && $editBoardParams[0]['location']!=PHP_STR) { $xml = PHP_STR; $xml .= ""; $xml .= ""; for($i=1;$i<=10;$i++) { if ($editBoardParams[$i]['type']!=PHP_STR) { $xml .= ""; $xml .= ""; $xml .= ""; $xml .= ""; $xml .= "" . $i . ""; $xml .= ""; } else { break; } } $xml .= ""; file_put_contents($editBoardParams[0]['file'], $xml); } } $password = filter_input(INPUT_POST, "Password"); $command = filter_input(INPUT_POST, "CommandLine"); $pwd = filter_input(INPUT_POST, "pwd"); $hideSplash = filter_input(INPUT_POST, "hideSplash"); $hideHCSplash = filter_input(INPUT_POST, "hideHCSplash"); //EditBoard if (filter_input(INPUT_POST, "txtLocation")!==PHP_STR) { $editBoardParams[0] = [ 'file' => filter_input(INPUT_POST, "editBoardDest"), 'location' => filter_input(INPUT_POST, "txtLocation") ]; for($i=1;$i<=10;$i++) { $editBoardParams[$i] = [ 'type' => filter_input(INPUT_POST, "txtType" . $i), 'desc' => filter_input(INPUT_POST, "txtDesc" . $i) ]; } } if ($password !== PHP_STR) { $hash = hash("sha256", $password . APP_SALT, false); if ($hash !== APP_HASH) { $password=PHP_STR; } } $curPath = APP_INV_PATH; if ($pwd!==PHP_STR) { if (left($pwd, strlen(APP_INV_PATH)) === APP_INV_PATH) { $curPath = $pwd; chdir($curPath); } } $ipos = strripos($curPath, PHP_SLASH); $curDir = substr($curPath, $ipos); $prompt = str_replace("$1", $curDir, APP_PROMPT); if ($password !== PHP_STR) { loadRecallHistory(); $cmdHistory = file(dirname(__DIR__) . PHP_SLASH . "logs" . PHP_SLASH . ".INV_history"); parseCommand($command); //echo("cmd=" . $cmd . "
"); //echo("opt=" . $opt . "
"); //echo("param1=" . $param1 . "
"); //echo("param2=" . $param2 . "
"); upload(); saveEditBoard(); if (mb_stripos(CMDLINE_VALIDCMDS, "|" . $command . "|")) { if ($command === "cd ..") { $ipos = strripos($curPath, PHP_SLASH); $nextPath = substr($curPath, 0, $ipos); if (strlen(APP_INV_PATH) > strlen($nextPath)) { updateHistoryWithErr("out of root boundary"); } else { myExecCDBackwCommand(); } } else if ($command === "help") { myExecHelpCommand(); } else if ($command === "ls") { myExecLSCommand(); } else if ($command === "pwd") { myExecPWDCommand(); } else { myExecCommand(); } } else if (mb_stripos(CMDLINE_VALIDCMDS, "|" . $cmd . "|")) { if ($cmd === "cd") { if (cdparamValidation()) { myExecCDFolderCommand(); } } else if ($cmd === "cp") { if (cpparamValidation()) { myExecCPCommand(); } } else if ($cmd === "mv") { if (mvparamValidation()) { myExecCommand(); } } else if ($cmd === "show") { if (showparamValidation()) { myExecShowCommand(); } } else if ($cmd === "edit") { if (editparamValidation()) { myExecEditCommand(); } } } else { // if I'm not saving data.. if (empty($editBoardParams) || $editBoardParams[0]['location']===PHP_STR) { if (empty($_FILES['files']['tmp_name'][0])) { updateHistoryWithErr("invalid command"); } } } } else { $cmdHistory = []; } ?> Invenktory: every device its place..
;">
 Invenktory       on github      for feedback       get support  
 Upload


HC Genius  


 
 
 Hash Me!
Hello and welcome to Invenktory!

Invenktory is a light and simple software on premise to track your devices.

Invenktory is released under GPLv3 license, it is supplied AS-IS and we do not take any responsibility for its misusage.

First step, use the left side panel password and salt fields to create the hash to insert in the config file. Remember to manually set there also the salt value.

As you are going to run Invenktory in the PHP process context, using a limited web server or phpfpm user, you must follow some simple directives for an optimal first setup:
  1. Check the permissions of your "Inventory" folder in your web app private path; and set its path in the config file.
  2. In the Inventory path create a ".INVsampledir" folder and give to this folder the write permission. This folder will be the sample folder to copy from new folders inside the inventory path.
  3. Likewise, in the Inventory path must exist ".INVsamplefile.xml" and give to this file the write permission. This file will be the sample file to copy from new inventory files.
  4. Configure the max devices per xml file as required (default: 10).
  5. Configure the max history items and max recall history items as required (default: 50).

Invenktory understands a limited set of commands with a far limited set of parameters:
cd, cd.., cp, edit, help, ls, mv, pwd, show

In edit mode press [CTRL]+[X] to exit or [CTRL]+[S] to save.

Hope you can enjoy it and let us know about any feedback: info@invenktory.com
 Console


 
\n"); ?>