added 5m cache to the parameters.php
This commit is contained in:
@@ -1742,7 +1742,7 @@ def performPholusScan (timeout):
|
|||||||
temp = subnet.split("--interface=")
|
temp = subnet.split("--interface=")
|
||||||
|
|
||||||
if len(temp) != 2:
|
if len(temp) != 2:
|
||||||
file_print(" Skip interface (need subnet in format '192.168.1.0/24 --inteface=eth0'), got: ", subnet)
|
file_print(" Skip scan (need subnet in format '192.168.1.0/24 --inteface=eth0'), got: ", subnet)
|
||||||
return
|
return
|
||||||
|
|
||||||
mask = temp[0].strip()
|
mask = temp[0].strip()
|
||||||
|
|||||||
@@ -21,9 +21,6 @@
|
|||||||
// Set maximum execution time to 15 seconds
|
// Set maximum execution time to 15 seconds
|
||||||
ini_set ('max_execution_time','15');
|
ini_set ('max_execution_time','15');
|
||||||
|
|
||||||
// Open DB
|
|
||||||
OpenDB();
|
|
||||||
|
|
||||||
// Action functions
|
// Action functions
|
||||||
if (isset ($_REQUEST['action']) && !empty ($_REQUEST['action'])) {
|
if (isset ($_REQUEST['action']) && !empty ($_REQUEST['action'])) {
|
||||||
$action = $_REQUEST['action'];
|
$action = $_REQUEST['action'];
|
||||||
@@ -39,19 +36,41 @@
|
|||||||
// Get Parameter Value
|
// Get Parameter Value
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
function getParameter() {
|
function getParameter() {
|
||||||
global $db;
|
|
||||||
|
|
||||||
$parameter = $_REQUEST['parameter'];
|
$parameter = $_REQUEST['parameter'];
|
||||||
$sql = 'SELECT par_Value FROM Parameters
|
$value = "";
|
||||||
WHERE par_ID="'. quotes($_REQUEST['parameter']) .'"';
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
// get the value from the cookie if available
|
||||||
$row = $result -> fetchArray (SQLITE3_NUM);
|
if(getCache($parameter) != "")
|
||||||
$value = $row[0];
|
{
|
||||||
|
$value = getCache($parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
// query the database if no cache entry found
|
||||||
|
if($parameter == "Back_App_State" || $value == "" )
|
||||||
|
{
|
||||||
|
// Open DB
|
||||||
|
OpenDB();
|
||||||
|
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$sql = 'SELECT par_Value FROM Parameters
|
||||||
|
WHERE par_ID="'. quotes($parameter) .'"';
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
$row = $result -> fetchArray (SQLITE3_NUM);
|
||||||
|
$value = $row[0];
|
||||||
|
|
||||||
|
// Close DB
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
// update cookie cache
|
||||||
|
setCache($parameter, $value);
|
||||||
|
}
|
||||||
|
|
||||||
// displayMessage ($value);
|
// displayMessage ($value);
|
||||||
|
|
||||||
echo (json_encode ($value));
|
echo (json_encode ($value));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -59,11 +78,18 @@ function getParameter() {
|
|||||||
// Set Parameter Value
|
// Set Parameter Value
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
function setParameter() {
|
function setParameter() {
|
||||||
|
|
||||||
|
$parameter = $_REQUEST['parameter'];
|
||||||
|
$value = $_REQUEST['value'];
|
||||||
|
|
||||||
|
// Open DB
|
||||||
|
OpenDB();
|
||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
// Update value
|
// Update value
|
||||||
$sql = 'UPDATE Parameters SET par_Value="'. quotes ($_REQUEST['value']) .'"
|
$sql = 'UPDATE Parameters SET par_Value="'. quotes ($value) .'"
|
||||||
WHERE par_ID="'. quotes($_REQUEST['parameter']) .'"';
|
WHERE par_ID="'. quotes($parameter) .'"';
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if (! $result == TRUE) {
|
if (! $result == TRUE) {
|
||||||
@@ -75,8 +101,8 @@ function setParameter() {
|
|||||||
if ($changes == 0) {
|
if ($changes == 0) {
|
||||||
// Insert new value
|
// Insert new value
|
||||||
$sql = 'INSERT INTO Parameters (par_ID, par_Value)
|
$sql = 'INSERT INTO Parameters (par_ID, par_Value)
|
||||||
VALUES ("'. quotes($_REQUEST['parameter']) .'",
|
VALUES ("'. quotes($parameter) .'",
|
||||||
"'. quotes($_REQUEST['value']) .'")';
|
"'. quotes($value) .'")';
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if (! $result == TRUE) {
|
if (! $result == TRUE) {
|
||||||
@@ -85,6 +111,12 @@ function setParameter() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close DB
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
// update cookie cache
|
||||||
|
setCache($parameter, $value);
|
||||||
|
|
||||||
echo 'OK';
|
echo 'OK';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user