Inserimento richiesta di conferma

This commit is contained in:
cmaffio
2016-05-12 16:57:15 +02:00
parent b161737537
commit 2ecc6266d9
2 changed files with 47 additions and 23 deletions

6
TODO
View File

@@ -1,7 +1,9 @@
# Moduli da implementare # Moduli da implementare
- Proxy - Accesso Desktop
- Firewall - Firewall
- DHCP - DHCP
- Routing - Routing
# Proxy
- Possibilita' per gli utenti proxy di cambiarsi la password
- gestione generazione gruppi utenze

View File

@@ -2,6 +2,11 @@
include_once ("../core/config.php"); include_once ("../core/config.php");
$UTENTE = login(); $UTENTE = login();
$DIRITTI = diritti(1); $DIRITTI = diritti(1);
// _SERVER["HTTP_REFERER"]
// _SERVER["PHP_SELF"]
// _SERVER["REQUEST_URI"]
?> ?>
<html> <html>
<head> <head>
@@ -19,78 +24,95 @@ if (isset($_GET['id'])) {
$id = $_GET['id']; $id = $_GET['id'];
if (isset($_GET['azione'])) { if (isset($_GET['azione'])) {
$azione = $_GET['azione']; $azione = $_GET['azione'];
$genera = 0;
switch ($azione) { switch ($azione) {
case "net_up": case "net_up":
$query = "UPDATE proxy_net SET attivo = 1 WHERE id = $id"; $query = "UPDATE proxy_net SET attivo = 1 WHERE id = $id";
mysql_query( $query, $DB_ID ); $testo = "Confermate l'abilitazione della rete?";
break; break;
case "net_down": case "net_down":
$query = "UPDATE proxy_net SET attivo = 0 WHERE id = $id"; $query = "UPDATE proxy_net SET attivo = 0 WHERE id = $id";
mysql_query( $query, $DB_ID ); $testo = "Confermate la disabilitazione della rete?";
break; break;
case "net_rm": case "net_rm":
$query = "DELETE FROM proxy_net WHERE id = $id"; $query = "DELETE FROM proxy_net WHERE id = $id";
mysql_query( $query, $DB_ID ); $testo = "Confermate la rimozione della rete?";
break; break;
case "acl_up": case "acl_up":
$query = "UPDATE proxy_acl_list SET attivo = 1, data = NOW() WHERE id = $id"; $query = "UPDATE proxy_acl_list SET attivo = 1, data = NOW() WHERE id = $id";
mysql_query( $query, $DB_ID ); $testo = "Confermate l'abilitazione della ACL?";
break; break;
case "acl_down": case "acl_down":
$query = "UPDATE proxy_acl_list SET attivo = 0, data = NOW() WHERE id = $id"; $query = "UPDATE proxy_acl_list SET attivo = 0, data = NOW() WHERE id = $id";
mysql_query( $query, $DB_ID ); $testo = "Confermate la disabilitazione della ACL?";
break; break;
case "link_up": case "link_up":
$query = "UPDATE proxy_acl SET attivo = 1, data = NOW() WHERE id = $id"; $query = "UPDATE proxy_acl SET attivo = 1, data = NOW() WHERE id = $id";
mysql_query( $query, $DB_ID ); $testo = "Confermate l'abilitazione dell'URL?";
break; break;
case "link_down": case "link_down":
$query = "UPDATE proxy_acl SET attivo = 0, data = NOW() WHERE id = $id"; $query = "UPDATE proxy_acl SET attivo = 0, data = NOW() WHERE id = $id";
mysql_query( $query, $DB_ID ); $testo = "Confermate la disabilitazione dell'URL?";
break; break;
case "link_rm": case "link_rm":
$query = "DELETE FROM proxy_acl WHERE id = $id"; $query = "DELETE FROM proxy_acl WHERE id = $id";
mysql_query( $query, $DB_ID ); $testo = "Confermate la cancellazione dell'URL?";
break; break;
case "pool_ins": case "pool_ins":
$query = "INSERT INTO proxy_pool (ip, pool, attivo, ins) VALUES ('$id', 1, 1, NOW()) ON DUPLICATE KEY UPDATE attivo = 1"; $query = "INSERT INTO proxy_pool (ip, pool, attivo, ins) VALUES ('$id', 1, 1, NOW()) ON DUPLICATE KEY UPDATE attivo = 1";
mysql_query( $query, $DB_ID ); $testo = "Confermate l'inserimento dell'indirizzo IP nel pool di limitazione?";
genera($DB_ID); $genera = 1;
break; break;
case "pool_rem": case "pool_rem":
$query = "INSERT INTO proxy_pool (ip, pool, attivo, ins) VALUES ('$id', 1, 0, NOW()) ON DUPLICATE KEY UPDATE attivo = 0"; $query = "INSERT INTO proxy_pool (ip, pool, attivo, ins) VALUES ('$id', 1, 0, NOW()) ON DUPLICATE KEY UPDATE attivo = 0";
mysql_query( $query, $DB_ID ); $testo = "Confermate la rimozione dell'indirizzo IP dal pool di limitazione?";
genera($DB_ID); $genera = 1;
break; break;
case "user_up": case "user_up":
$query = "UPDATE proxy_utenti SET attivo = 1 WHERE id = $id"; $query = "UPDATE proxy_utenti SET attivo = 1 WHERE id = $id";
mysql_query( $query, $DB_ID ); $testo = "Confermate l'abilitazione dell'utente?";
$testo = "Utente Abilitato";
break; break;
case "user_down": case "user_down":
$query = "UPDATE proxy_utenti SET attivo = 0 WHERE id = $id"; $query = "UPDATE proxy_utenti SET attivo = 0 WHERE id = $id";
mysql_query( $query, $DB_ID ); $testo = "Confermate la disabilitazione dell'utente?";
$testo = "Utente Disabilitato";
break; break;
case "user_rm": case "user_rm":
$query = "DELETE FROM proxy_utenti WHERE id = $id"; $query = "DELETE FROM proxy_utenti WHERE id = $id";
mysql_query( $query, $DB_ID ); $testo = "Confermate la cancellazione dell'utente?";
$testo = "Utente Eliminato";
break; break;
default: default:
$testo = "Regola non implementata"; $testo = "Regola non implementata";
break; break;
} }
if (isset($_GET['ref'])) {
$ref = pack ('H*', $_GET['ref']);
mysql_query( $query, $DB_ID );
if ($genera) genera($DB_ID);
?>
<script type="text/javascript">
document.location.href="<?php print $ref ?>"
</script>
<?php } else {
$ref = unpack ('H*', $_SERVER["HTTP_REFERER"]);
?>
<script type="text/javascript">
var r = confirm("<?php print $testo ?>");
if (r == true) {
document.location.href="<?php print $_SERVER['REQUEST_URI']?>&ref=<?php print $ref[1] ?>"
} else {
document.location.href="<?php print $_SERVER['HTTP_REFERER']?>"
}
</script>
<?php }
} }
} }
?> ?>
<script type="text/javascript">
document.location.href='<?php print $_SERVER['HTTP_REFERER']?>'
</script>
<?php <?php
function genera ($DB_ID) { function genera ($DB_ID) {