Fix path
This commit is contained in:
206
utenti/modutenti.php
Executable file
206
utenti/modutenti.php
Executable file
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
include_once ("../core/config.php");
|
||||
$UTENTE = login();
|
||||
//isadmin();
|
||||
?>
|
||||
<?php include_once ("../core/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="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/jquery/jquery.js"></script>
|
||||
<script type="text/javascript" src="<?php print $CONF['base_url'] ?>/jquery/jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="<?php print $CONF['base_url'] ?>/jquery/jquery.validate.password.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="5" alt=""></td></tr>
|
||||
<tr>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="5" alt=""></td></tr>
|
||||
<tr>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="250" height="1" alt=""></td>
|
||||
</tr>
|
||||
<tr><td colspan="9"><img src="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="40" height="50" alt=""></td>
|
||||
<td class="label"><label id="lpassword" for="password">Password</label></td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" alt=""></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td colspan="9"><img src="<?php print $CONF['base_url'] ?>/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="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="10" alt=""></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
<?php include_once ("footer.php"); ?>
|
||||
Reference in New Issue
Block a user