unificazione gestioni proxy
This commit is contained in:
@@ -54,6 +54,33 @@ if (isset($_GET['id'])) {
|
||||
mysql_query( $query, $DB_ID );
|
||||
break;
|
||||
|
||||
case "pool_ins":
|
||||
$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 );
|
||||
genera($DB_ID);
|
||||
break;
|
||||
case "pool_rem":
|
||||
$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 );
|
||||
genera($DB_ID);
|
||||
break;
|
||||
|
||||
case "user_up":
|
||||
$query = "UPDATE proxy_utenti SET attivo = 1 WHERE id = $id";
|
||||
mysql_query( $query, $DB_ID );
|
||||
$testo = "Utente Abilitato";
|
||||
break;
|
||||
case "user_down":
|
||||
$query = "UPDATE proxy_utenti SET attivo = 0 WHERE id = $id";
|
||||
mysql_query( $query, $DB_ID );
|
||||
$testo = "Utente Disabilitato";
|
||||
break;
|
||||
case "user_rm":
|
||||
$query = "DELETE FROM proxy_utenti WHERE id = $id";
|
||||
mysql_query( $query, $DB_ID );
|
||||
$testo = "Utente Eliminato";
|
||||
break;
|
||||
|
||||
default:
|
||||
$testo = "Regola non implementata";
|
||||
break;
|
||||
@@ -64,3 +91,19 @@ if (isset($_GET['id'])) {
|
||||
<script type="text/javascript">
|
||||
document.location.href='<?php print $_SERVER['HTTP_REFERER']?>'
|
||||
</script>
|
||||
|
||||
<?php
|
||||
function genera ($DB_ID) {
|
||||
$file = 'squid_acl/listip';
|
||||
$fp = fopen($file, 'w');
|
||||
|
||||
$query = "SELECT ip FROM proxy_pool WHERE attivo = 1 AND pool = 1";
|
||||
$res = mysql_query( $query, $DB_ID );
|
||||
while ($dato = mysql_fetch_array ( $res )) {
|
||||
fwrite($fp, $dato['ip']."\n");
|
||||
}
|
||||
fclose($fp);
|
||||
exec ("sudo /opt/squid/sbin/squid -k reconfigure");
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user