gestione utenze e fix vari
This commit is contained in:
@@ -505,4 +505,40 @@ function byteConvert($bytes) {
|
|||||||
return sprintf('%.2f '.$s[$e], ($bytes/pow(1024, $e)));
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ if ($id) {
|
|||||||
id,
|
id,
|
||||||
nome,
|
nome,
|
||||||
attivo,
|
attivo,
|
||||||
|
dflt,
|
||||||
DATE_FORMAT(data, '%d.%m.%Y %H:%i:%s') AS data
|
DATE_FORMAT(data, '%d.%m.%Y %H:%i:%s') AS data
|
||||||
FROM
|
FROM
|
||||||
proxy_acl_list
|
proxy_acl_list
|
||||||
@@ -80,6 +81,8 @@ if ($id) {
|
|||||||
proxy_acl
|
proxy_acl
|
||||||
WHERE
|
WHERE
|
||||||
idacllist = $id
|
idacllist = $id
|
||||||
|
ORDER BY
|
||||||
|
rif
|
||||||
";
|
";
|
||||||
$res = mysql_query( $query, $DB_ID );
|
$res = mysql_query( $query, $DB_ID );
|
||||||
}
|
}
|
||||||
@@ -114,13 +117,13 @@ if ($dato['attivo']) {
|
|||||||
<tr>
|
<tr>
|
||||||
<td rowspan=2 class="descrizione_c">Default</td>
|
<td rowspan=2 class="descrizione_c">Default</td>
|
||||||
<td class="descrizione_c">Nega</td>
|
<td class="descrizione_c">Nega</td>
|
||||||
<td class="descrizione_c">Ignora</td>
|
<td class="descrizione_c">Default</td>
|
||||||
<td class="descrizione_c">Autorizza</td>
|
<td class="descrizione_c">Autorizza</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="radio"><input type="radio" name="dflt" value=-1 <?php if ($dflt == -1) { print "checked=\"checked\""; } ?> ></td>
|
<td class="radio"><input type="radio" name="dflt" value=-1 <?php if ($dato['dflt'] == -1) { print "checked=\"checked\""; } ?> ></td>
|
||||||
<td class="radio"><input type="radio" name="dflt" value=0 <?php if ($dflt == 0) { print "checked=\"checked\""; } ?> ></td>
|
<td class="radio"><input type="radio" name="dflt" value=0 <?php if ($dato['dflt'] == 0) { print "checked=\"checked\""; } ?> ></td>
|
||||||
<td class="radio"><input type="radio" name="dflt" value=1 <?php if ($dflt == 1) { print "checked=\"checked\""; } ?> ></td>
|
<td class="radio"><input type="radio" name="dflt" value=1 <?php if ($dato['dflt'] == 1) { print "checked=\"checked\""; } ?> ></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ function do_submit() {
|
|||||||
<td class="descrizione">Indirizzo IP</td>
|
<td class="descrizione">Indirizzo IP</td>
|
||||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||||
<td class="radio">Nega</td>
|
<td class="radio">Nega</td>
|
||||||
<td class="radio">Ignora</td>
|
<td class="radio">Default</td>
|
||||||
<td class="radio">Autorizza</td>
|
<td class="radio">Autorizza</td>
|
||||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||||
<td class="descrizione">Nome Lista</td>
|
<td class="descrizione">Nome Lista</td>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ if (isset($_GET['ip'])) {
|
|||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<td rowspan=2 class="col3btn"><a href="pool_gest.php?azione=limita&ip=<?php print $dato['ip']?>"><img src="<?php print $CONF['base_url'] ?>/img/attivo.gif" ALT="Utente non limitato" TITLE="Utente non limitato"></a></td>
|
<td rowspan=2 class="col3btn"><a href="pool_gest.php?azione=limita&ip=<?php print $dato['ip']?>"><img src="<?php print $CONF['base_url'] ?>/img/attivo.gif" ALT="Utente non limitato" TITLE="Utente non limitato"></a></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<td rowspan=2 class="colip"><?php print $dato['ip'] ?></td>
|
<td rowspan=2 class="colip"><?php print $ip ?></td>
|
||||||
|
|
||||||
<td rowspan=2 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
<td rowspan=2 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||||
<td class="colip"><?php print $dato['first'] ?></td>
|
<td class="colip"><?php print $dato['first'] ?></td>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once ("../core/config.php");
|
include_once ("../core/config.php");
|
||||||
$UTENTE = login();
|
$UTENTE = login();
|
||||||
$DIRITTI = diritti(1);
|
$DIRITTI = diritti(10);
|
||||||
view_top();
|
view_top();
|
||||||
|
|
||||||
if (isset($_POST['tempo'])) {
|
if (isset($_POST['tempo'])) {
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ while($limit) {
|
|||||||
print "OK\n";
|
print "OK\n";
|
||||||
} else {
|
} else {
|
||||||
print LOG "$param[0] - $param[1] - $param[2] - ERR\n";
|
print LOG "$param[0] - $param[1] - $param[2] - ERR\n";
|
||||||
print "DENY2\n";
|
# print "DENY\n";
|
||||||
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,23 +26,55 @@ if (isset($_POST['id'])) {
|
|||||||
if ($pwd == -1) {
|
if ($pwd == -1) {
|
||||||
print "ERRORE le password devono coincidere";
|
print "ERRORE le password devono coincidere";
|
||||||
} else {
|
} else {
|
||||||
$query = " UPDATE
|
if ($id) {
|
||||||
proxy_utenti
|
$query = " UPDATE
|
||||||
SET
|
proxy_utenti
|
||||||
user = '$user',
|
SET
|
||||||
fullname = '$fullname',
|
user = '$user',
|
||||||
ip = '$ip',
|
fullname = '$fullname',
|
||||||
$pwd
|
ip = '$ip',
|
||||||
modifica = NOW()
|
$pwd
|
||||||
WHERE
|
modifica = NOW()
|
||||||
id = $id
|
WHERE
|
||||||
";
|
id = $id
|
||||||
|
";
|
||||||
|
} else {
|
||||||
|
$query = " INSERT INTO
|
||||||
|
proxy_utenti
|
||||||
|
SET
|
||||||
|
user = '$user',
|
||||||
|
fullname = '$fullname',
|
||||||
|
ip = '$ip',
|
||||||
|
$pwd
|
||||||
|
data = NOW(),
|
||||||
|
modifica = NOW(),
|
||||||
|
attivo = 0
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
$res = mysql_query( $query, $DB_ID );
|
$res = mysql_query( $query, $DB_ID );
|
||||||
|
if ($id == "") {
|
||||||
|
$id = mysql_insert_id();
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
document.location.href='users_edit.php?id=<?php print $id ?>'
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} elseif (isset($_GET['id'])) {
|
} elseif (isset($_GET['id'])) {
|
||||||
$id = $_GET['id'];
|
$id = $_GET['id'];
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function getvalue() {
|
||||||
|
MyIFrame = document.getElementById("chkpwd");
|
||||||
|
MyIFrame.src = "users_pwd.php";
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<iframe id="chkpwd" style="display:none; visibility:hidden;"></iframe>
|
||||||
|
|
||||||
<form name="" method="post">
|
<form name="" method="post">
|
||||||
<input type="hidden" name="id" value="<?php print $id ?>">
|
<input type="hidden" name="id" value="<?php print $id ?>">
|
||||||
@@ -121,10 +153,14 @@ if ($dato['attivo']) {
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||||
<td class="colip"><input type="password" size="16" name=pwd1></td>
|
<td class="colip"><input type="password" size="16" name=pwd1 id=pwd1></td>
|
||||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||||
<td class="colip"><input type="password" size="16" name=pwd2></td>
|
<td class="colip"><input type="password" size="16" name=pwd2 id=pwd2></td>
|
||||||
<td colspan="7" class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||||
|
<td class="spazioh"><input type="button" value="Genera password" onclick="window.open('users_pwd.php','_blank','width=1,toolbar=0,resizable=0,scrollbars=no,height=1,top=0,left=0,visible=none');"></td>
|
||||||
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||||
|
<td class="colip"><input id=pwd type=text></p></td>
|
||||||
|
<td colspan="3" class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td class="spaziov" colspan=10><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
<tr><td class="spaziov" colspan=10><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||||
<tr><td class="spaziov" colspan=10><input type="submit" value="Conferma"></td></tr>
|
<tr><td class="spaziov" colspan=10><input type="submit" value="Conferma"></td></tr>
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ if (isset($_GET['id'])) {
|
|||||||
mysql_query( $query, $DB_ID );
|
mysql_query( $query, $DB_ID );
|
||||||
$testo = "Utente Disabilitato";
|
$testo = "Utente Disabilitato";
|
||||||
break;
|
break;
|
||||||
|
case "rimuovi":
|
||||||
|
$query = "DELETE FROM proxy_utenti WHERE id = $id";
|
||||||
|
mysql_query( $query, $DB_ID );
|
||||||
|
$testo = "Utente Eliminato";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$testo = "Regola non implementata";
|
$testo = "Regola non implementata";
|
||||||
break;
|
break;
|
||||||
@@ -38,6 +43,5 @@ if (isset($_GET['id'])) {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
confirmation ('<?php print "$testo" ?>');
|
|
||||||
document.location.href='<?php print $_SERVER['HTTP_REFERER']?>'
|
document.location.href='<?php print $_SERVER['HTTP_REFERER']?>'
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ view_top();
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
||||||
|
<tr>
|
||||||
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||||
|
<td class="spazioh"><a href="users_edit.php"><img src="<?php print $CONF['base_url'] ?>/img/addresource.png"></a></td>
|
||||||
|
<td colspan=9 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||||
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$query = " SELECT
|
$query = " SELECT
|
||||||
id,
|
id,
|
||||||
@@ -24,15 +29,18 @@ $res = mysql_query( $query, $DB_ID );
|
|||||||
while ($dato = mysql_fetch_array ( $res )) {
|
while ($dato = mysql_fetch_array ( $res )) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<?php
|
<?php
|
||||||
if ($dato['attivo']) {
|
if ($dato['attivo']) {
|
||||||
?>
|
?>
|
||||||
<td class="col3btn"><a href="users_gest.php?azione=blocca&id=<?php print $dato['id']?>"><img src="<?php print $CONF['base_url'] ?>/img/attivo.gif" ALT="Utente Attivo" TITLE="Utente Attivo"></a></td>
|
<td class="spazioh"><a href="users_gest.php?azione=blocca&id=<?php print $dato['id']?>"><img src="<?php print $CONF['base_url'] ?>/img/attivo.gif" ALT="Utente Attivo" TITLE="Utente Attivo"></a></td>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<td class="col3btn"><a href="users_gest.php?azione=abilita&id=<?php print $dato['id']?>"><img src="<?php print $CONF['base_url'] ?>/img/non_attivo.gif" ALT="Utente non Attivo" TITLE="Utente non Attivo"></a></td>
|
<td class="spazioh"><a href="users_gest.php?azione=abilita&id=<?php print $dato['id']?>"><img src="<?php print $CONF['base_url'] ?>/img/non_attivo.gif" ALT="Utente non Attivo" TITLE="Utente non Attivo"></a></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<td class="col3btn"><a href="users_edit.php?id=<?php print $dato['id'] ?>"><img src="<?php print $CONF['base_url'] ?>/img/modify.gif" ALT="Dettaglio" TITLE="Dettaglio"></a></td>
|
<td class="spazioh"><a href="users_gest.php?azione=rimuovi&id=<?php print $dato['id']?>"><img src="<?php print $CONF['base_url'] ?>/img/trash.png"></a></td>
|
||||||
|
|
||||||
|
<td class="spazioh"><a href="users_edit.php?id=<?php print $dato['id'] ?>"><img src="<?php print $CONF['base_url'] ?>/img/modify.gif" ALT="Dettaglio" TITLE="Dettaglio"></a></td>
|
||||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||||
|
|
||||||
<td class="colip"><?php print $dato['user'] ?></td>
|
<td class="colip"><?php print $dato['user'] ?></td>
|
||||||
@@ -48,7 +56,7 @@ while ($dato = mysql_fetch_array ( $res )) {
|
|||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td class="spaziov" colspan=13><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
<tr><td class="spaziov" colspan=11><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
} ?>
|
} ?>
|
||||||
|
|||||||
21
proxy/users_pwd.php
Executable file
21
proxy/users_pwd.php
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
include_once ("../core/config.php");
|
||||||
|
$UTENTE = login();
|
||||||
|
$DIRITTI = diritti(1);
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<!--
|
||||||
|
function invia(value) {
|
||||||
|
window.opener.document.getElementById('pwd').value = value;
|
||||||
|
window.opener.document.getElementById('pwd1').value = value;
|
||||||
|
window.opener.document.getElementById('pwd2').value = value;
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
invia ('<?php print generateStrongPassword(9, false, "lud") ?>');
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user