prepare("$sql");
$res->execute();
list($descr_cons,$tipo_cons,$id_cons) = $res->fetch(PDO::FETCH_NUM);
include("modules/Elezioni/ele.php");
include("inc/funzioni.php");
function come() {
global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $id_cons, $tipo_cons, $id_cons,$id_cons_gen, $editimage1,
$add_content, $add_preamble, $add_title, $vai,$mid,$tab,$op,$editor;
if ($tab=='_ele_come') echo "
"._ADMINCOME."
";
elseif ($tab=='_ele_numeri') echo ""._ADMINNUMERI."
";
elseif ($tab=='_ele_servizi') echo ""._ADMINSERVIZI."
";
elseif ($tab=='_ele_link') echo ""._ADMINLINK."
";
//echo "
";
echo ""._ALLCOME."
\n
\n
"._TITOLO." | \n
"._FUNZIONI." | \n";
$sql="select mid, title,preamble, content, editimage from ".$prefix.$tab." where id_cons='$id_cons'";
$result = $dbi->prepare("$sql");
$result->execute();
while(list($mid2, $title, $preamble, $content, $editimage) = $result->fetch(PDO::FETCH_NUM)) {
echo ""
."$title | "
."
"._EDIT." -
"._DELETE."
"
." |
";
}
echo "
";
echo "";
echo " ";
if($vai=='editedit'){
$sql="select title, preamble,content, editimage from ".$prefix.$tab." WHERE mid='$mid' AND id_cons='$id_cons'";
$result = $dbi->prepare("$sql");
$result->execute();
list($add_title,$add_preamble, $add_content, $editimage) = $result->fetch(PDO::FETCH_NUM);
}
//25.05.2009
$sql="SELECT editor,ed_user FROM ".$prefix."_config";
$res = $dbi->prepare("$sql");
$res->execute();
list($editor,$ed_user) = $res->fetch(PDO::FETCH_NUM);
//
echo ""._ADDCOME." ";
echo "";
echo " |
";
echo"";
include ("footer.php");
}
function saveedit($mid, $title, $preamble, $content) {
global $prefix, $dbi,$id_cons,$id_cons_gen,$tab,$op;
$temp=$title.$preamble.$content;
if (preg_match("/script/i",$temp)) die("La parola script e' proibita, devi toglierla dal testo.");
$sql="update ".$prefix.$tab." set title='$title', preamble='$preamble', content='$content' WHERE mid='$mid' AND id_cons='$id_cons'";
$res = $dbi->prepare("$sql");
$res->execute();
Header("Location: admin.php?op=$op&vai=come&id_cons_gen=$id_cons_gen");
}
function addedit($add_title, $add_preamble, $add_content) {
global $prefix, $dbi,$id_cons, $id_cons_gen,$tab,$op;
$sql="insert into ".$prefix.$tab." (id_cons,title,preamble,content) values ('$id_cons', '$add_title', '$add_preamble','$add_content')";
$res = $dbi->prepare("$sql");
$res->execute();
if (!$res->rowCount()) {
exit();
}
Header("Location: admin.php?op=$op&vai=come&id_cons_gen=$id_cons_gen");
}
function deleteedit($mid, $ok=0) {
global $prefix, $dbi, $id_cons,$id_cons_gen,$tab,$op;
if($ok) {
$sql="delete from ".$prefix.$tab." where mid=$mid and id_cons='$id_cons'";
$res = $dbi->prepare("$sql");
$res->execute();
if (!$res->rowCount()) {
return;
}
Header("Location: admin.php?op=$op&vai=come&id_cons_gen=$id_cons_gen");
} else {
ele();
OpenTable();
echo ""._ADMINCOME."";
CloseTable();
echo "
";
OpenTable();
echo ""._REMOVEINFO."";
echo "
[ "._NO." | "._YES." ]";
CloseTable();
echo"";
include("footer.php");
}
}
switch ($vai){
// or "come" or "servizi" or "editedit"
case "come":
ele();
come();
break;
case "editedit":
ele();
come();
break;
case "saveedit":
saveedit($mid, $add_title, $add_preamble,$add_content);
break;
case "numeri":
ele();
come();
break;
case "servizi":
ele();
come();
break;
case "link":
ele();
come();
break;
case "addedit":
addedit($add_title, $add_preamble,$add_content);
break;
case "deleteedit":
deleteedit($mid, $ok);
break;
}
?>