Pulizia vecchio sistema
This commit is contained in:
206
core/chkpasswd.php
Executable file
206
core/chkpasswd.php
Executable file
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
include_once ("config.php");
|
||||
$UTENTE = login();
|
||||
//isadmin();
|
||||
?>
|
||||
<?php include_once ("top.php"); ?>
|
||||
|
||||
<?php
|
||||
if (isset($_GET['id'])) {
|
||||
$bottone = "Modifica";
|
||||
$modifica = 1;
|
||||
$query = "SELECT * FROM utenti WHERE id =".$_GET['id'];
|
||||
$res = mysql_query( $query, $DB_ID );
|
||||
$dato = mysql_fetch_array ( $res );
|
||||
$dato['password'] = "ahg5t!frtb5@u&^!";
|
||||
} else if (isset ($_POST['id'])) {
|
||||
$modifica = 2;
|
||||
$id = $_POST['id'];
|
||||
$utente = $_POST['utente'];
|
||||
$password1 = $_POST['password1'];
|
||||
$password2 = $_POST['password2'];
|
||||
$admin = $_POST['admin'];
|
||||
$attivo = $_POST['attivo'];
|
||||
$mail = $_POST['mail'];
|
||||
|
||||
if (!$admin) $admin = 0;
|
||||
|
||||
if (!$attivo) $attivo = 0;
|
||||
|
||||
if (($password1 != "ahg5t!frtb5@u&^!") && ($password1 == $password2)) {
|
||||
$querypwd = "password = MD5('$password1'),";
|
||||
} else {
|
||||
$querypwd = "";
|
||||
}
|
||||
|
||||
if ($id > 0) {
|
||||
$testo = "L'utente e' stato correttamente modificato";
|
||||
$query = "UPDATE utenti SET $querypwd admin = $admin, attivo=$attivo, modifica = NOW(), mail='$mail' WHERE `id`=$id";
|
||||
} else {
|
||||
$testo = "L'utente e' stato correttamente inserito";
|
||||
$query = "INSERT INTO utenti SET utente = '$utente', $querypwd admin = $admin, attivo=$attivo, modifica = NOW(), creazione = NOW(), mail='$mail'";
|
||||
}
|
||||
?>
|
||||
<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 if (mysql_query( $query, $DB_ID )) { ?>
|
||||
<?php print $testo ?><br>
|
||||
<?php } else { ?>
|
||||
Non e' stato possibile eseguire l'operazione richiesta a causa di un errore: <?php print mysql_error() ?><br>
|
||||
<?php print $query ?><br>
|
||||
<?php } ?>
|
||||
</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 = 'utenti.php';"></button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="../img/spazio.gif" width="1" height="10" alt=""></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
} else {
|
||||
$bottone = "Aggiungi";
|
||||
$modifica = 0;
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if (($modifica == 0 || $modifica == 1) && !isset($_GET['rm'])) { ?>
|
||||
|
||||
|
||||
<script type="text/javascript" src="../jquery/jquery.js"></script>
|
||||
<script type="text/javascript" src="../jquery/jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="../jquery/jquery.validate.password.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../jquery/jquery.validate.password.css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("#modulo").validate( {
|
||||
rules: {
|
||||
utente: {
|
||||
required: true,
|
||||
minlength: 4
|
||||
},
|
||||
mail: {
|
||||
required: true,
|
||||
email: true,
|
||||
minlength: 4
|
||||
},
|
||||
password1: {
|
||||
password: "#utente",
|
||||
minlength: 0
|
||||
},
|
||||
password2: {
|
||||
equalTo: "#password1"
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
utente: {
|
||||
required: "Inserire uno nome utente",
|
||||
minlength: jQuery.format("Inserire almeno {0} caratteri")
|
||||
},
|
||||
mail: {
|
||||
required: "Inserire un indirizzo e-mail valido",
|
||||
},
|
||||
password2: {
|
||||
equalTo: "Le due password devono essere uguali"
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// the errorPlacement has to take the table layout into account
|
||||
errorPlacement: function(error, element) {
|
||||
error.prependTo( element.parent().next() );
|
||||
},
|
||||
// specifying a submitHandler prevents the default submit, good for the demo
|
||||
//submitHandler: function() {
|
||||
// alert("submitted!");
|
||||
//},
|
||||
// set this class to error-labels to indicate valid fields
|
||||
success: function(label) {
|
||||
// set as text for IE
|
||||
label.html(" ").addClass("checked");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<form action="modutenti.php" method="post" id="modulo">
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
||||
<?php if ($modifica == 1) { ?>
|
||||
<input type="hidden" name="id" value="<?php print $dato['id'] ?>">
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="id" value="-1">
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td><img src="../img/spazio.gif" width="30" height="1" alt=""></td>
|
||||
<td class="label"><label id="lusername" for="username">Nome Utente</label></td>
|
||||
<td class="field"><input id="utente" name="utente" type="text" value="<?php print $dato['utente']?>" maxlength="50" /></td>
|
||||
<td class="status" colspan="6"></td>
|
||||
</tr>
|
||||
<tr><td colspan="9"><img src="../img/spazio.gif" width="1" height="5" alt=""></td></tr>
|
||||
<tr>
|
||||
<td><img src="../img/spazio.gif" width="30" height="1" alt=""></td>
|
||||
<td class="label"><label id="lmail" for="mail">Indirizzo E-Mail</label></td>
|
||||
<td class="field"><input id="mail" name="mail" type="text" value="<?php print $dato['mail']?>" maxlength="50" /></td>
|
||||
<td class="status" colspan="6"></td>
|
||||
</tr>
|
||||
<tr><td colspan="9"><img src="../img/spazio.gif" width="1" height="5" alt=""></td></tr>
|
||||
<tr>
|
||||
<td><img src="../img/spazio.gif" width="80" height="1" alt=""></td>
|
||||
<td>Attivo <input name="attivo" type="checkbox" value=1 <?php if ($dato['attivo']) { print "checked=\"checked\""; } ?>></td>
|
||||
<td><img src="../img/spazio.gif" width="20" height="1" alt=""></td>
|
||||
<td>Admin <input name="admin" type="checkbox" value=1 <?php if ($dato['admin']) { print "checked=\"checked\""; } ?>></td>
|
||||
<td colspan="4"><img src="../img/spazio.gif" width="250" height="1" alt=""></td>
|
||||
</tr>
|
||||
<tr><td colspan="9"><img src="../img/spazio.gif" width="1" height="5" alt=""></td></tr>
|
||||
<tr>
|
||||
<td class="col1" colspan="9">
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td><img src="../img/spazio.gif" width="40" height="50" alt=""></td>
|
||||
<td class="label"><label id="lpassword" for="password">Password</label></td>
|
||||
<td><img src="../img/spazio.gif" width="10" height="1" alt=""></td>
|
||||
<td class="field" width="30"><input id="password1" name="password1" type="password" size="30" maxlength="32" value="<?php print $dato['password'] ?>" /></td>
|
||||
<td class="status" width="400">
|
||||
<div class="password-meter">
|
||||
<div class="password-meter-message"> </div>
|
||||
<div class="password-meter-bg">
|
||||
<div class="password-meter-bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="../img/spazio.gif" width="40" height="50" alt=""></td>
|
||||
<td class="label"><label id="lpassword_confirm" for="password_confirm">Password</label></td>
|
||||
<td><img src="../img/spazio.gif" width="10" height="1" alt=""></td>
|
||||
<td class="field" width="30"><input id="password2" name="password2" type="password" size="30" maxlength="32" value="<?php print $dato['password'] ?>" /></td>
|
||||
<td class="status" width="400"></td>
|
||||
</tr>
|
||||
<tr><td colspan="9" class="spaziov"><img src="../img/spazio.gif" width="1" alt=""></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td colspan="9"><img src="../img/spazio.gif" width="1" height="5" alt=""></td></tr>
|
||||
<tr><td align="center" colspan="9">
|
||||
<input type="submit" value="<?php print $bottone ?>">
|
||||
|
||||
<input type="button" value="Annulla" onclick="location.href = 'utenti.php';"></button>
|
||||
</td></tr>
|
||||
|
||||
<tr><td colspan="9"><img src="../img/spazio.gif" width="1" height="10" alt=""></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
<?php include_once ("footer.php"); ?>
|
||||
63
core/conf.php
Executable file
63
core/conf.php
Executable file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
include_once ("config.php");
|
||||
$UTENTE = login();
|
||||
isadmin();
|
||||
|
||||
include_once ("top.php"); ?>
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
||||
<tr><td class="spaziov" colspan=7><img src="../img/spazio.gif"></td></tr>
|
||||
<tr>
|
||||
<td width="50"><img src="../img/spazio.gif"></td>
|
||||
<td width="150" class="campo">Campo</td>
|
||||
<td width="20"><img src="../img/spazio.gif"></td>
|
||||
<td width="350" class="campo">Valore</td>
|
||||
<td width="20"><img src="../img/spazio.gif"></td>
|
||||
<td width="350" class="campo">Nota</td>
|
||||
<td><img src="../img/spazio.gif"></td>
|
||||
</tr>
|
||||
<tr><td class="spaziov" colspan=7><img src="../img/spazio.gif"></td></tr>
|
||||
|
||||
<?php
|
||||
$query = "SELECT * FROM conf WHERE vis=1 ORDER BY ordine";
|
||||
$res = mysql_query( $query, $DB_ID );
|
||||
while ($dato = mysql_fetch_array ( $res )) {
|
||||
$riga = "";
|
||||
$visualizza = 1;
|
||||
switch ($dato['variabile']) {
|
||||
case "POP3_Server":
|
||||
$riga = $dato['valore'];
|
||||
break;
|
||||
case "totale":
|
||||
case "permanenti":
|
||||
case "temporanei":
|
||||
case "tempo_temporanei":
|
||||
$visualizza = 0;
|
||||
break;
|
||||
case "template_base":
|
||||
$query = "SELECT nome FROM template WHERE id = ".$dato['valore'];
|
||||
$res_templ = mysql_query( $query, $DB_ID );
|
||||
$dato_templ = mysql_fetch_array ( $res_templ );
|
||||
$riga = $dato_templ['nome'];
|
||||
break;
|
||||
default:
|
||||
$riga = $dato['valore'];
|
||||
}
|
||||
|
||||
|
||||
if ($visualizza) {
|
||||
?>
|
||||
<tr>
|
||||
<td width="50"><img src="../img/spazio.gif"></td>
|
||||
<td width="150" class="valoretxt"><a class="menuatt" href="modconf.php?var=<?php print $dato['variabile'] ?>"><?php print $dato['variabile']?></a></td>
|
||||
<td width="20" bgcolor="#f3f3f3"><img src="../img/spazio.gif"></td>
|
||||
<td width="350" class="valoretxt"><?php print $riga?></td>
|
||||
<td width="20" bgcolor="#f3f3f3"><img src="../img/spazio.gif"></td>
|
||||
<td width="350" class="valoretxt"><?php print $dato['Commento']?></td>
|
||||
<td><img src="../img/spazio.gif"></td>
|
||||
</tr>
|
||||
<tr><td class="spaziov" colspan=7><img src="../img/spazio.gif"></td></tr>
|
||||
<?php }
|
||||
} ?>
|
||||
</table>
|
||||
<?php include_once ("footer.php"); ?>
|
||||
@@ -1,6 +1,4 @@
|
||||
<?php
|
||||
$aggiornamento = "02.03.2012";
|
||||
$versione = "0.2";
|
||||
|
||||
$db_data_server = "127.0.0.1";
|
||||
$db_data_name = "pannello_vbc";
|
||||
|
||||
17
core/footer.php
Executable file
17
core/footer.php
Executable file
@@ -0,0 +1,17 @@
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr bgcolor="#FFC350">
|
||||
<td nowrap class="lbottom"> <?php print $CONF['Versione'] ?></td>
|
||||
<td width="500"> </td>
|
||||
<?php if ($UTENTE['admin']) { ?>
|
||||
<td class="rtop"><a class="rtop" href="main.php">Admin </a></td>
|
||||
<?php } else {?>
|
||||
<td> </td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -69,7 +69,6 @@ function login () {
|
||||
$fUsername = $_POST['fUsername'];
|
||||
$fPassword = $_POST['fPassword'];
|
||||
if(db_login ($fUsername, $fPassword)) {
|
||||
print "-- ".$_POST['fUsername']." - ".$_POST['fPassword']." --<br>";
|
||||
$_SESSION = array();
|
||||
$_SESSION['passwd'] = $fPassword;
|
||||
$_SESSION['username'] = $fUsername;
|
||||
|
||||
18
core/main.php
Executable file
18
core/main.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
include_once ("config.php");
|
||||
$UTENTE = login();
|
||||
isadmin();
|
||||
?>
|
||||
<?php include_once ("top.php"); ?>
|
||||
|
||||
<META HTTP-EQUIV="Refresh" CONTENT="30" URL="main.php">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
||||
<tr><td class="spaziov" colspan="9"><img src="../img/spazio.gif"></td></tr>
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<img src="img/spazio.gif" width="1" height="20" alt="">
|
||||
<?php include_once ("footer.php"); ?>
|
||||
63
core/top.php
Executable file
63
core/top.php
Executable file
@@ -0,0 +1,63 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>SpazioFirewall</title>
|
||||
</head>
|
||||
<body>
|
||||
<link rel="stylesheet" type="text/css" href="../css/stile.css" />
|
||||
<table cellpadding="0" cellspacing="0" border="0" align="center" width="1000">
|
||||
<?php if ($_SESSION['auth']) { ?>
|
||||
<tr><td>
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr bgcolor="#FFC350">
|
||||
<td nowrap class="ltop">Utente: <?php print $_SESSION['username'] ?></td>
|
||||
<td width="200"> </td>
|
||||
<?php if ($_SESSION['auth']) { ?>
|
||||
<td class="rtop"><a class="rtop" href="logout.php">Logout</a></td>
|
||||
<?php } else {?>
|
||||
<td> </td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
<?php
|
||||
|
||||
if ($UTENTE['admin']) {
|
||||
$menu = array( array("Home", "main.php"),
|
||||
array("Configurazione", "conf.php"),
|
||||
array("Gestione utenti", "utenti.php"),
|
||||
array("Cambio password", "chkpasswd.php"),
|
||||
);
|
||||
} else {
|
||||
$menu = array( array("Cambio password", "chkpasswd.php"),
|
||||
);
|
||||
}
|
||||
|
||||
$pezzi = preg_split('/\//', $_SERVER["PHP_SELF"], -1);
|
||||
$self = $pezzi[count($pezzi)-1];
|
||||
?>
|
||||
<tr><td class="spaziov" colspan=2><img src="../img/spazio.gif"></td></tr>
|
||||
<tr><td align="center">
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
||||
<tr bgcolor="#d2f4df">
|
||||
<?php for ($i=0; $i<count($menu);$i++) {
|
||||
if ($self == $menu[$i][1]) {
|
||||
$classe = "menuatt";
|
||||
} else {
|
||||
$classe = "menu";
|
||||
}
|
||||
?>
|
||||
<td class="spaziol"><img src="../img/spazio.gif"></td>
|
||||
<td nowrap class="<?php echo $classe?>"><a class="<?php echo $classe?>" href="<?php print $menu[$i][1]?>"><?php print $menu[$i][0]?></a></td>
|
||||
<?php } ?>
|
||||
<td class="spaziol"><img src="../img/spazio.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php } else {?>
|
||||
<tr bgcolor="#FFC350"><td> </td></tr>
|
||||
<?php } ?>
|
||||
</td></tr>
|
||||
<tr><td class="spaziov" colspan=2><img src="../img/spazio.gif"></td></tr>
|
||||
<tr><td align="center">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user