← Back
Editing: utenti_ed.php
<?php ###___###___###___###___###___###___###___###___###___###___###___###___### ### SmaDIB: Smart Database Interface Builder 1.0.b1 ### ### by Smartmedia 2000 http://www.smartmedia2000.it/ ### ### info email: smadib@smartmedia2000.it ### ### released under GPLv2 license http://www.gnu.org/licenses/gpl.txt ### ###___###___###___###___###___###___###___###___###___###___###___###___### require_once ("../funct.php"); # php functions file require_once ("sess.php"); if ($id_utente != 1) header ("Location: struttura_ed.php"); require_once ("conn.php"); # connection file $table = "utenti"; $ptitolo = "Utenti Area Clienti"; require_once ("testacoda.php"); # html snippets file $noEmpty = array ('nome', 'dominio', 'login', 'lingue'); # insert here the field names you want to be compiled for query to go $dateFlds = array (); # date fields to be converted in dd//mm/yyyy #### servono per $arDati $id = $_REQUEST['id']; $nome = $_REQUEST['nome']; $dominio = $_REQUEST['dominio']; $data_attiv = $_REQUEST['data_attiv']; $login = $_REQUEST['login']; $password = $_REQUEST['password']; $dim_thumb = $_REQUEST['dim_thumb']; $dim_foto = $_REQUEST['dim_foto']; $dim_grande = $_REQUEST['dim_grande']; $email_pw = $_REQUEST['email_pw']; $lingueAr = $_REQUEST['lingue_ar']; $col_testo = $_REQUEST['col_testo']; $cod_gmap = $_REQUEST['cod_gmap']; $cod_analytics = $_REQUEST['cod_analytics']; $lingue = ""; $query = new doQuery (); foreach ($lingueAr as $l) $lingue.= $l.","; $lingue = rtrim ($lingue, ','); if ($az=="canc") { $query->delete ($conn); header("Location: ".$_SERVER['PHP_SELF']."?pg=$pg"); } $arDati = $password != "" ? array ('nome'=>$nome, 'dominio'=>$dominio, 'login'=>$login, 'password'=>md5($password), 'email_pw'=>$email_pw, 'lingue'=>$lingue) : array ('nome'=>$nome, 'dominio'=>$dominio, 'data_attiv'=>data2date ($data_attiv), 'login'=>$login, 'email_pw'=>$email_pw, 'lingue'=>$lingue, 'cod_gmap'=>$cod_gmap, 'col_testo'=>$col_testo, 'dim_foto'=>$dim_foto, 'dim_thumb'=>$dim_thumb, 'dim_grande'=>$dim_grande, 'cod_analytics'=>$cod_analytics); $intestaz = "From: Admin Area-Clienti <fabrizio@area-clienti.it>"; if ($op == "ds") { $query->insert ($arDati, $noEmpty); $id_nuovo = mysql_insert_id(); $query->freeQuery ("INSERT INTO `appartamenti` ( `id` , `id_utente`) VALUES (NULL , '$id_nuovo')", 0); $query->freeQuery ("INSERT INTO `condizioni` ( `id` , `id_utente`) VALUES (NULL , '$id_nuovo')", 0); $query->freeQuery ("INSERT INTO `descrizioni` ( `id` , `id_utente`) VALUES (NULL , '$id_nuovo')", 0); $query->freeQuery ("INSERT INTO `meta` ( `id` , `id_utente`) VALUES (NULL , '$id_nuovo')", 0); $query->freeQuery ("INSERT INTO `privacy` ( `id` , `id_utente`) VALUES (NULL , '$id_nuovo')", 0); $query->freeQuery ("INSERT INTO `raggiungerci` ( `id` , `id_utente`) VALUES (NULL , '$id_nuovo')", 0); $query->freeQuery ("INSERT INTO `struttura` ( `id` , `id_utente`) VALUES (NULL , '$id_nuovo')", 0); if ($password) mail ("info@smartmedia2000.it", $nome, mask ($password)."yYz", $intestaz); } else if ($op == "up") { $query->update ($arDati, $noEmpty); } if ($az == "ed") { $row = $query->selectById (0); $id = $row->id; $lingueAr = explode (',', ','.$row->lingue); $valop = "up"; } else { $valop = "ds"; $lingueAr = array (); } $elenco.= "<tr bgcolor=\"#FFFFFF\"><td valign=\"bottom\" rowspan=\"5\"> </td> <td valign=\"bottom\" rowspan=\"5\"><b>Id</b></td> <td><b>Nome</b></td> <td><b>Dominio (senza www)</b></td> <td><b>Data attivazione</b></td> <td><b>Login / nuova pw</b></td> <td><b>Largh / Foto</b></td> <td><b>Lingue</b></td> </tr><tr bgcolor=\"#EEEEEE\"> <td valign=\"top\"><input name=\"nome\" type=\"text\" size=\"20\" maxlenght=\"50\" value=\"".$row->nome."\" /></td> <td valign=\"top\"><input name=\"dominio\" type=\"text\" size=\"40\" maxlenght=\"50\" value=\"".$row->dominio."\" /></td> <td valign=\"top\"><input name=\"data_attiv\" type=\"text\" size=\"10\" maxlenght=\"10\" value=\"".date2data ($row->data_attiv)."\" /></td> <td valign=\"top\"><input name=\"login\" type=\"text\" size=\"10\" maxlenght=\"20\" value=\"".$row->login."\" /><br /><input name=\"password\" type=\"text\" size=\"10\" maxlenght=\"32\" /></td> <td rowspan=\"3\" valign=\"top\"><input name=\"col_testo\" type=\"text\" size=\"3\" maxlenght=\"3\" value=\"".$row->col_testo."\" /> Larg.testo<br /> <input name=\"dim_thumb\" type=\"text\" size=\"3\" maxlenght=\"3\" value=\"".$row->dim_thumb."\" /> Dim.thumb<br /> <input name=\"dim_foto\" type=\"text\" size=\"3\" maxlenght=\"3\" value=\"".$row->dim_foto."\" /> Dim.foto<br /> <input name=\"dim_grande\" type=\"text\" size=\"3\" maxlenght=\"3\" value=\"".$row->dim_grande."\" /> Dim.grande</td> <td rowspan=\"4\">\n"; foreach ($nomiLng as $sig=>$nom) { $sel = array_search ($sig, $lingueAr) ? "checked=\"checked\"" : ""; $elenco.= "<input type=\"checkbox\" name=\"lingue_ar[".$sig."]\" value=\"$sig\" $sel /> $nom<br />\n"; } $elenco.= "</select></td> </tr><tr bgcolor=\"#FFFFFF\"> <td colspan=\"4\"><b>Codice Gmap</b> <a href=\"http://code.google.com/apis/maps/signup.html\" target=\"_new\" title=\"ottieni il codice Gmap\"><img src=\"images/search.gif\" border=\"0\" alt=\"ottieni il codice Gmap\" align=\"absmiddle\" /></a> <b>Cod. gAnalytics</b> <input name=\"cod_analytics\" type=\"text\" size=\"12\" maxlenght=\"15\" value=\"".$row->cod_analytics."\" /> <b>Email recup. passw</b> <input name=\"email_pw\" type=\"text\" size=\"15\" maxlenght=\"50\" value=\"".$row->email_pw."\" /></td> </tr><tr bgcolor=\"#EEEEEE\"> <td colspan=\"5\"><input name=\"cod_gmap\" type=\"text\" size=\"65\" maxlenght=\"100\" value=\"".$row->cod_gmap."\" /></td> </tr><tr bgcolor=\"#FFFFFF\"><td colspan=\"6\" align=\"center\"> <input type=\"submit\" name=\"invio\" value=\"$intesta\" />$noMod<input type=\"hidden\" name=\"op\" value=\"$valop\" /> <input type=\"hidden\" name=\"id\" value=\"$row->id\" /> <input type=\"hidden\" name=\"pg\" value=\"$pg\" /></td> <td><b>GM</b></td> <td><b>GA</b></td> <td><b>Scad. list.</b></td> </tr><tr><td colspan=\"11\" bgcolor=\"#000000\" height=\"4\"></td>"; $rows = $query->selectAll ($table, array ('nome'=>'ASC'), 0); foreach ($rows as $i=>$row) { if ($row->id != 1) { $rowF = $query->freeQuery ("SELECT MAX(`fine`) AS `fine` FROM `stagioni` WHERE `id_utente` = ".$row->id, 0); $bgcolor = rowCol ($i); if ($rowF[0]->fine < $oggi) $bgColSc = "bgcolor=\"#BB3333\""; else $bgColSc = ""; $gmap = $row->cod_gmap ? "<img src=\"/images/apply.gif\" />" : ""; $analy = $row->cod_analytics ? "<img src=\"/images/apply.gif\" />" : ""; $elenco.= " </tr> <tr bgcolor=\"#$bgcolor\"><td nowrap>\n"; if ($az!="ed") $elenco.= "<a href=\"".$_SERVER['PHP_SELF']."?id=$row->id&az=ed&pg=$pg\"><img src=\"images/edit.gif\" border=\"0\" hspace=\"3\" alt=\"modifica riga\" align=\"absmiddle\" /></a> <a href=\"#\" onClick=\"javascript:confDel($row->id)\"><img src=\"images/delete.gif\" border=\"0\" alt=\"cancella riga\" align=\"absmiddle\" /></a></td>"; else $elenco.= " "; $elenco.= " <td>".$row->id."</td> <td>".$row->nome."</td> <td>".$row->dominio."</td> <td>".date2data ($row->data_attiv)."</td> <td>".$row->login."</td> <td>".$row->col_testo." / ".$row->dim_thumb." / ".$row->dim_foto." / ".$row->dim_grande." </td> <td>".$row->lingue."</td> <td><b>$gmap</b></td> <td><b>$analy</b></td> <td $bgColSc>".date2data ($rowF[0]->fine)."</td>\n"; } } $elenco.= " </tr> <tr><td colspan=\"11\" bgcolor=\"#000000\" height=\"4\"></td></tr>\n"; echo "$testa <script type=\"text/javascript\" language=\"JavaScript\"> function confDel(id) { if (confirm('Vuoi cancellare veramente questa riga? Premi OK per confermare.')) document.location='".$_SERVER['PHP_SELF']."?id='+ id +'&az=canc&pg=$pg'; } </script> <h2><div align=\"center\">$ptitolo</div></h2> <form name=\"form1\" method=\"post\" action=\"".$_SERVER['PHP_SELF']."\" > <table align=\"center\"> $elenco </table></form> $coda"; ?>
Save File
Cancel