Hi, I want to call a dynamically construction page during differents updates or upgraded, I have this simple php code in main index.php
<?php
include_once('admin/config/config.php');
if($mantenimiento == 1) {
include 'mantenimiento.php';
} else {
include 'login.php';
}
?>
Now the config.php file only have these simple lines, protect file externally and a variable to make the condition above to works.
<?php
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) {
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 );
die( header( 'location: /' ) );
}
$mantenimiento=1;
?>
But I want a way to change this variable $mantenimiento into wappler using dynamic binding, for example I have a backend and I would like to change this value of $mantenimiento=1;
to $mantenimiento=0;
maybe using a form with checkbox or changing with text input storing this value in a table in database to call it dynamically.
I means something like:
$mantenimiento={{serverconnect1.data.config_mantenimiento}}
Of course it doesn’t works,
I’m trying with _SESSION using globals and then call it into the var, something like:
session_start();
$mantenimiento=_SESSION['config_mantenimiento'];
It works, but half, I mean, this method it’s perfect if where not in the main index, that’s because the _session needs to be store firts before using it (I don’t know if I’m doing something wrong but this is my case), so, been the index the main file it need a second refresh to get the store _session and the conditions start working.
Thanks.
Last updated: