122 lines
4.6 KiB
PHP
Executable File
122 lines
4.6 KiB
PHP
Executable File
<?php
|
|
include_once ("core/config.php");
|
|
$UTENTE = login();
|
|
isadmin();
|
|
?>
|
|
<?php include_once ("top.php"); ?>
|
|
|
|
<?php
|
|
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">
|
|
|
|
<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 include_once ("footer.php"); ?>
|