";
echo "
";
$resmod = mysql_query("SELECT * FROM ".$prefix."_authors where id_cons='$id_cons' and id_comune='$id_comune'", $dbi);
echo " ";
CloseTable();
}
function operatori($do,$aid2,$name,$email,$passwd,$passwd2,$id_comune) {
global $aid, $prefix, $dbi, $id_cons,$id_cons_gen,$currentlang;
$perms=ChiSei($id_cons_gen);
if ($perms!=256) $id_comune=$_SESSION['id_comune'];
if ($perms>32 and $aid2) {
if ($do == "add") {
$sql="select * from ".$prefix."_authors where aid='$aid2' and id_comune=$id_comune";
$res=mysql_query($sql,$dbi);
$max=mysql_num_rows($res);
if ($passwd==$passwd2 and $max==0){
if ($aid2=='admin') $super='1,0,0,'; else $super = '0,1,0,';
$sql="insert into ".$prefix."_authors (aid,name,id_comune,email,pwd,counter,adminop,admincomune,adminsuper,admlanguage) values ('$aid2','$name','$id_comune' , '$email','".md5($passwd)."',0,$super'$currentlang')";
$result = mysql_query($sql, $dbi)||die("Errore 1301: Non e' stato possibile inserire l'utente! $sql ".mysql_error());
if ($perms==256 and $aid2=='admin'){
$result = mysql_query("insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid) values ('0','0','$id_comune','64','$aid2')", $dbi) || die("
Errore di inserimento: ".mysql_error());
}
Header("Location: admin.php?op=operatori&id_cons_gen=$id_cons_gen");
}else{
$mex='';
if($passwd!=$passwd2) $mex="- Le password non coincidono! - ";
if($max>0) $mex.=" - Utente $aid2 presente in archivio! - ";
header("location:admin.php?op=operatori&id_cons_gen=$id_cons_gen&aid2=$aid2&name=$name&email=$email&mex=$mex");
}
} elseif ($do == "update") {
$result = mysql_query("update ".$prefix."_authors set name='$name',pwd='".md5($passwd)."', email='$email' where id_comune='$id_comune' and aid='$aid2' ", $dbi);
if (!$result) return;
if ($aid2==$aid) $_SESSION['pwd']=md5($passwd);
Header("Location: admin.php?op=operatori&id_cons_gen=$id_cons_gen");
}
}
}
//****************************
// switch
//****************************
if ($do) operatori($do,$aid2,$name,$email,$passwd,$passwd2,$id_comune);
ele();
all();
echo" |
";
include("footer.php");
?>