Inizio abilitazione modulo proxy

This commit is contained in:
cmaffio
2016-03-09 15:02:46 +01:00
parent 1bacc3232e
commit a5ed0d219d
30 changed files with 576 additions and 1153 deletions

View File

@@ -1,10 +1,8 @@
<?php
include_once ("config.php");
$UTENTE = login();
?>
<?php include_once ("top.php"); ?>
view_top();
<?php
if (isset ($_POST['id'])) {
$modifica = 2;
$id = $_POST['id'];
@@ -169,4 +167,4 @@ $(document).ready(function()
</form>
<?php } ?>
<?php include_once ("footer.php"); ?>
<?php view_footer(); ?>

View File

@@ -3,7 +3,8 @@ include_once ("config.php");
$UTENTE = login();
isadmin();
include_once ("top.php"); ?>
view_top();
?>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr><td class="spaziov" colspan=7><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
@@ -60,4 +61,4 @@ while ($dato = mysql_fetch_array ( $res )) {
<?php }
} ?>
</table>
<?php include_once ("footer.php"); ?>
<?php view_footer (); ?>

View File

@@ -7,5 +7,5 @@ $db_data_pwd = "Lx7w3e8dNPfwwc3z";
require_once ("function.php");
$DB_ID = db_data_connect ();
carica_conf();
$CONF = carica_conf();
?>

View File

@@ -98,13 +98,24 @@ function login () {
}
}
function carica_conf () {
function carica_conf ($modulo="") {
global $CONF, $DB_ID;
$query = "SELECT variabile, valore FROM conf";
if ($modulo != "") {
$query = "SELECT prefisso FROM moduli WHERE nome = '$modulo'";
$res = mysql_query( $query, $DB_ID );
$dato = mysql_fetch_array ( $res );
$tabella = $dato['prefisso']."conf";
} else {
$tabella = "conf";
}
$query = "SELECT variabile, valore FROM $tabella";
$res = mysql_query( $query, $DB_ID );
while ($dato = mysql_fetch_array ( $res )) {
$CONF[$dato[0]] = $dato[1];
$tmp[$dato[0]] = $dato[1];
}
return $tmp;
}
function isadmin () {
@@ -390,7 +401,7 @@ function lista_moduli () {
<?php
}
function diritti () {
function diritti ($minimo) {
global $UTENTE, $DB_ID, $CONF;
preg_match ('/^'.preg_replace('/\//','\/',$CONF['base_url']).'\/([^\/]+)\/.*/', $_SERVER['REQUEST_URI'], $trovato);
@@ -423,7 +434,7 @@ function diritti () {
$risposta = 0;
}
if ($risposta) {
if ($risposta >= $minimo) {
return $risposta;
} else {
header("location: ".$CONF['base_url']."/index.php");
@@ -443,4 +454,14 @@ function get_levels () {
return $livelli;
}
function view_top () {
global $CONF, $UTENTE;
include_once ($_SERVER["CONTEXT_DOCUMENT_ROOT"].$CONF['base_url']."/core/top.php");
}
function view_footer () {
global $CONF, $UTENTE;
include_once ($_SERVER["CONTEXT_DOCUMENT_ROOT"].$CONF['base_url']."/core/footer.php");
}
?>

View File

@@ -1,9 +1,8 @@
<?php
include_once ("config.php");
$UTENTE = login();
//isadmin();
view_top();
?>
<?php include_once ("top.php"); ?>
<META HTTP-EQUIV="Refresh" CONTENT="30" URL="main.php">
@@ -12,4 +11,4 @@ $UTENTE = login();
</table>
<img src="img/spazio.gif" width="1" height="20" alt="">
<?php include_once ("footer.php"); ?>
<?php view_footer(); ?>

119
core/modconf.php Executable file
View File

@@ -0,0 +1,119 @@
<?php
include_once ("config.php");
$UTENTE = login();
isadmin();
view_top();
if (isset ($_GET['var'])) {
$var = $_GET['var'];
$query = "SELECT * FROM conf WHERE variabile='$var'";
$res = mysql_query( $query, $DB_ID );
$dato = mysql_fetch_array ( $res );
?>
<form action="modconf.php" method="post">
<input type="hidden" name="variabile" value="<?php print $var ?>">
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr>
<td><img src="img/spazio.gif" width="50" height="1" alt=""></td>
<td class="valoretxt" width="150">Variabile</td>
<td><img src="img/spazio.gif" width="20" height="1" alt=""></td>
<td class="valore" width="500"><?php print $dato['variabile'] ?></td>
<td><img src="img/spazio.gif" width="180" height="1" alt=""></td>
</tr>
<tr><td class="spaziov" colspan="5"><img src="img/spazio.gif"></td></tr>
<tr>
<td><img src="img/spazio.gif" width="50" height="1" alt=""></td>
<td class="valoretxt" width="150">Commento</td>
<td><img src="img/spazio.gif" width="20" height="1" alt=""></td>
<td class="valore" width="500"><?php print $dato['Commento'] ?></td>
<td><img src="img/spazio.gif" width="180" height="1" alt=""></td>
</tr>
<tr><td class="spaziov" colspan="5"><img src="img/spazio.gif"></td></tr>
<tr>
<td><img src="img/spazio.gif" width="50" height="1" alt=""></td>
<td class="valoretxt" width="150">Valore</td>
<td><img src="img/spazio.gif" width="20" height="1" alt=""></td>
<td class="valore" width="500">
<?php
switch ($dato['variabile']) {
case "template_base":
$query = "SELECT * FROM template WHERE attivo = 1";
$restempl = mysql_query( $query, $DB_ID );
print "\t<select name='valore'>\n";
while ($datotempl = mysql_fetch_array ( $restempl )) {
if ($datotempl['id'] == $dato['valore'])
$check = "selected";
else
$check = "";
print "\t\t<option name='valore' value='".$datotempl['id']."' $check>".$datotempl['nome']."</option>\n";
}
print "\t</select>\n";
break;
default:
print "<input type=\"text\" name=\"valore\" size=\"80\" maxlength=\"256\" value=\"".$dato['valore']."\">";
}
?>
</td>
<td><img src="img/spazio.gif" width="180" height="1" alt=""></td>
</tr>
<tr><td class="spaziov" colspan="5"><img src="img/spazio.gif"></td></tr>
<tr><td colspan="5"><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr><td align="center" colspan="5">
<input type="submit" value="Modifica">
&nbsp;&nbsp;&nbsp;
<input type="button" value="Annulla" onclick="location.href = 'conf.php';"></button>
</td></tr>
<tr><td colspan="5"><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
</table>
</form>
<?php } else if (isset ($_POST['variabile'])) {
$variabile = $_POST['variabile'];
$valore = $_POST['valore'];
switch ($variabile) {
case "template_base":
$query = "SELECT * FROM template WHERE id = $valore";
$res = mysql_query( $query, $DB_ID );
$dato = mysql_fetch_array ( $res );
$val = $dato['max_perm'];
$query = "UPDATE conf SET valore = $val WHERE variabile = 'permanenti'";
mysql_query( $query, $DB_ID );
$val = $dato['max_temp'];
$query = "UPDATE conf SET valore = $val WHERE variabile = 'temporanei'";
mysql_query( $query, $DB_ID );
$val = $dato['max_tempo'];
$query = "UPDATE conf SET valore = $val WHERE variabile = 'tempo_temporanei'";
mysql_query( $query, $DB_ID );
$val = $dato['totale'];
$query = "UPDATE conf SET valore = $val WHERE variabile = 'totale'";
mysql_query( $query, $DB_ID );
default:
$query = "UPDATE conf SET valore = '$valore' WHERE variabile = '$variabile'";
if (mysql_query( $query, $DB_ID ))
$testo = "Modifica della variabile $variabile effettuata con successo";
else
$testo = "Modifica della variabile $variabile non avvenuta: ".mysql_error();
}?>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr><td><img src="img/spazio.gif" width="1" height="10" alt=""><td></tr>
<tr><td><?php print $testo ?></td></tr>
<tr><td><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr><td><input type="button" value="Ok" onclick="location.href = 'conf.php';"></button></td></tr>
<tr><td><img src="img/spazio.gif" width="1" height="10" alt=""></td></tr>
</table>
<?php } else { ?>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr><td><img src="img/spazio.gif" width="1" height="10" alt=""><td></tr>
<tr><td>Operazione non permessa</td></tr>
<tr><td><input type="button" value="Ok" onclick="location.href = 'main.php';"></button></td></tr>
<tr><td><img src="img/spazio.gif" width="1" height="10" alt=""><td></tr>
<?php
}
?>
<?php view_footer(); ?>

View File

@@ -1,4 +1,4 @@
<?php include_once ("top.php"); ?>
<?php view_top(); ?>
<form name="login" method="post">
<table cellpadding="0" cellspacing="10" border="0" id="login_table">
<tr align="center" valign="middle">
@@ -20,4 +20,4 @@
</tr>
</table>
</form>
<?php include_once ("footer.php"); ?>
<?php view_footer(); ?>