From 5991a0c6354954e6bca213e6791d67ec23c3a654 Mon Sep 17 00:00:00 2001 From: cmaffio Date: Tue, 10 May 2016 09:24:53 +0200 Subject: [PATCH] gestione utenze e fix vari --- core/function.php | 36 ++++++++++++++++++++ proxy/acl_edit.php | 11 ++++--- proxy/pool_acl.php | 2 +- proxy/pool_ip.php | 2 +- proxy/pool_lista.php | 2 +- proxy/squid_acl/squid_acl.pl | 3 +- proxy/users_edit.php | 64 ++++++++++++++++++++++++++++-------- proxy/users_gest.php | 6 +++- proxy/users_lista.php | 16 ++++++--- proxy/users_pwd.php | 21 ++++++++++++ 10 files changed, 136 insertions(+), 27 deletions(-) create mode 100755 proxy/users_pwd.php diff --git a/core/function.php b/core/function.php index e0c17e3..7886077 100755 --- a/core/function.php +++ b/core/function.php @@ -505,4 +505,40 @@ function byteConvert($bytes) { return sprintf('%.2f '.$s[$e], ($bytes/pow(1024, $e))); } +function generateStrongPassword($length = 9, $add_dashes = false, $available_sets = 'luds') { + $sets = array(); + + if(strpos($available_sets, 'l') !== false) + $sets[] = 'abcdefghjkmnpqrstuvwxyz'; + if(strpos($available_sets, 'u') !== false) + $sets[] = 'ABCDEFGHJKMNPQRSTUVWXYZ'; + if(strpos($available_sets, 'd') !== false) + $sets[] = '23456789'; + if(strpos($available_sets, 's') !== false) + $sets[] = '!@#$%&*?'; + + $all = ''; + $password = ''; + foreach($sets as $set) + { + $password .= $set[array_rand(str_split($set))]; + $all .= $set; + } + $all = str_split($all); + for($i = 0; $i < $length - count($sets); $i++) + $password .= $all[array_rand($all)]; + $password = str_shuffle($password); + if(!$add_dashes) + return $password; + $dash_len = floor(sqrt($length)); + $dash_str = ''; + while(strlen($password) > $dash_len) + { + $dash_str .= substr($password, 0, $dash_len) . '-'; + $password = substr($password, $dash_len); + } + $dash_str .= $password; + return $dash_str; +} + ?> diff --git a/proxy/acl_edit.php b/proxy/acl_edit.php index 54d7402..7cd07f7 100755 --- a/proxy/acl_edit.php +++ b/proxy/acl_edit.php @@ -61,6 +61,7 @@ if ($id) { id, nome, attivo, + dflt, DATE_FORMAT(data, '%d.%m.%Y %H:%i:%s') AS data FROM proxy_acl_list @@ -80,6 +81,8 @@ if ($id) { proxy_acl WHERE idacllist = $id + ORDER BY + rif "; $res = mysql_query( $query, $DB_ID ); } @@ -114,13 +117,13 @@ if ($dato['attivo']) { Default Nega - Ignora + Default Autorizza - > - > - > + > + > + > diff --git a/proxy/pool_acl.php b/proxy/pool_acl.php index bfacd74..c18ce56 100755 --- a/proxy/pool_acl.php +++ b/proxy/pool_acl.php @@ -94,7 +94,7 @@ function do_submit() { Indirizzo IP Nega - Ignora + Default Autorizza Nome Lista diff --git a/proxy/pool_ip.php b/proxy/pool_ip.php index 66318ff..d99f53e 100755 --- a/proxy/pool_ip.php +++ b/proxy/pool_ip.php @@ -61,7 +61,7 @@ if (isset($_GET['ip'])) { Utente non limitato - + diff --git a/proxy/pool_lista.php b/proxy/pool_lista.php index e389b81..5ff23db 100755 --- a/proxy/pool_lista.php +++ b/proxy/pool_lista.php @@ -1,7 +1,7 @@ + + + + +
@@ -121,10 +153,14 @@ if ($dato['attivo']) { - + - - + + + + +

+ diff --git a/proxy/users_gest.php b/proxy/users_gest.php index aadfd07..bd567d5 100755 --- a/proxy/users_gest.php +++ b/proxy/users_gest.php @@ -30,6 +30,11 @@ if (isset($_GET['id'])) { mysql_query( $query, $DB_ID ); $testo = "Utente Disabilitato"; break; + case "rimuovi": + $query = "DELETE FROM proxy_utenti WHERE id = $id"; + mysql_query( $query, $DB_ID ); + $testo = "Utente Eliminato"; + break; default: $testo = "Regola non implementata"; break; @@ -38,6 +43,5 @@ if (isset($_GET['id'])) { } ?> diff --git a/proxy/users_lista.php b/proxy/users_lista.php index ecb8b73..f58d125 100755 --- a/proxy/users_lista.php +++ b/proxy/users_lista.php @@ -6,6 +6,11 @@ view_top(); ?> + + + + + + - + - + - + + + @@ -48,7 +56,7 @@ while ($dato = mysql_fetch_array ( $res )) { - + diff --git a/proxy/users_pwd.php b/proxy/users_pwd.php new file mode 100755 index 0000000..5464437 --- /dev/null +++ b/proxy/users_pwd.php @@ -0,0 +1,21 @@ + + + + +
Utente AttivoUtente Attivo Utente non AttivoUtente non Attivo DettaglioDettaglio