Viewing file: index.php (28.97 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/********************************************************************************
- MemHT Portal -
Copyright (C) 2007-2008 by Miltenovik Manojlo
http://www.memht.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your opinion) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, see <http://www.gnu.org/licenses/> (GPLv2)
or write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth Floor, Boston, MA02110-1301, USA.
********************************************************************************/
if (!defined("_LOAD_PAGE_")) {
die("<table style='padding: 2px; border: 1px solid #999; background-color: #EEE; font-family: Verdana; font-size: 10px;' align='center'><tr><td><b>Error:</b> This file cannot be opened directly!</td></tr></table>");
}
if (isSet($_GET['id'])) { $id = intval($_GET['id']); } else { $id = 0; }
if (isSet($_GET['op'])) { $op = inCode($_GET['op']); } else { $op = ""; }
if (isSet($_GET['ok'])) { $ok = inCode($_GET['ok']); } else { $ok = false; }
if (isSet($_POST['pname'])) { $pname = inCode($_POST['pname']); } else { $pname = ""; }
if (isSet($_POST['pemail'])) { $pemail = inCode($_POST['pemail']); } else { $pemail = ""; }
if (isSet($_POST['psite'])) { $psite = inCode($_POST['psite']); } else { $psite = ""; }
if (isSet($_POST['pnote'])) { $pnote = inCode($_POST['pnote']); } else { $pnote = ""; }
if (isSet($_POST['pcustomer'])) { $pcustomer = inCode($_POST['pcustomer']); } else { $pcustomer = ""; }
if (isSet($_POST['pposition'])) { $pposition = inCode($_POST['pposition']); } else { $pposition = ""; }
if (isSet($_POST['ptitle'])) { $ptitle = inCode($_POST['ptitle']); } else { $ptitle = ""; }
if (isSet($_POST['ptype'])) { $ptype = inCode($_POST['ptype']); } else { $ptype = ""; }
if (isSet($_POST['pcontent'])) { $pcontent = mysql_real_escape_string($_POST['pcontent']); } else { $pcontent = ""; }
if (isSet($_POST['pdimx'])) { $pdimx = inCode($_POST['pdimx']); } else { $pdimx = ""; }
if (isSet($_POST['pdimy'])) { $pdimy = inCode($_POST['pdimy']); } else { $pdimy = ""; }
if (isSet($_POST['ptarget'])) { $ptarget = inCode($_POST['ptarget']); } else { $ptarget = ""; }
if (isSet($_POST['pimpdone'])) { $pimpdone = inCode($_POST['pimpdone']); } else { $pimpdone = ""; }
if (isSet($_POST['pimptarget'])) { $pimptarget = inCode($_POST['pimptarget']); } else { $pimptarget = ""; }
if (isSet($_POST['pclickdone'])) { $pclickdone = inCode($_POST['pclickdone']); } else { $pclickdone = ""; }
if (isSet($_POST['pclicktarget'])) { $pclicktarget = inCode($_POST['pclicktarget']); } else { $pclicktarget = ""; }
if (isSet($_POST['penabled'])) { $penabled = intval($_POST['penabled']); } else { $penabled = 0; }
function bannersMain() {
global $dblink;
$rbc = $dblink->get_list("SELECT * FROM memht_banners_clienti ORDER BY nome");
foreach ($rbc as $row_bc) {
$cid = intval($row_bc['id']);
$cnome = outCode($row_bc['nome']);
$cemail = outCode($row_bc['email']);
$csito = outCode($row_bc['sito']);
$cnote = outCode($row_bc['note']);
if ($cemail=="") { $cemail = "-"; }
if ($csito=="") { $csito = "-"; }
echo "<table width='100%' align='center' cellspacing='1' cellpadding='0' class='std_nicetable'>";
echo "<thead>\n";
echo "<tr><td>$cnome</td><td width='1%' align='right' nowrap><a href='admin.php?page=banners&op=editCustomer&id=$cid' title='"._MODIFY_."'><img src='images/edit.gif' alt='Edit' border='0'></a> <a href='admin.php?page=banners&op=deleteCustomer&id=$cid' title='"._DELETE_."'><img src='images/delete.gif' alt='Delete' border='0'></a></td></tr>\n";
echo "</thead>\n";
echo "</table>\n";
echo "<table width='100%' align='center' cellspacing='1' cellpadding='0' class='std_nicetable' style='margin:2px 0 10px 0;'>";
echo "<thead>\n";
echo "<tr><td width='30%'>"._NAME_."</td><td width='15%'>"._BANNERTARGET_."</td><td width='20%'>"._IMPRESSIONS_."</td><td width='10%'>"._CLICKS_."</td><td width='1%'> </td></tr>";
echo "</thead>\n";
echo "<tbody>\n";
$n = 0;
$rbb = $dblink->get_list("SELECT * FROM memht_banners_banner WHERE cliente='$cid' ORDER BY titolo");
foreach ($rbb as $row_bb) {
$bid = intval($row_bb['id']);
$bcliente = intval($row_bb['cliente']);
$bposizione = intval($row_bb['posizione']);
$btitolo = outCode($row_bb['titolo']);
$btipo = intval($row_bb['tipo']);
$bcontenuto = outCode($row_bb['contenuto'],0);
$burl = outCode($row_bb['url']);
$bdim_x = intval($row_bb['dim_x']);
$bdim_y = intval($row_bb['dim_y']);
$blink_click = intval($row_bb['link_click']);
$bimp_done = intval($row_bb['imp_done']);
$bimp_target = intval($row_bb['imp_target']);
$bclick_done = intval($row_bb['click_done']);
$bclick_target = intval($row_bb['click_target']);
$benabled = intval($row_bb['enabled']);
$info = ($benabled==0) ? "<img src='images/off.gif' alt='"._OFF_."' border='0' title='"._OFF_."'>" : "<img src='images/on.gif' border='0' alt='"._ON2_."' title='"._ON2_."'>" ;
$blink_click = ($blink_click==0) ? _IMPRESSIONS_ : _CLICKS_ ;
$class = (($n++%2)!=0) ? "hlight" : "clean" ;
echo "<tr><td class='$class'><a href='javascript:void(0);' onClick=\"javascript:showBanner($bid,$bdim_x,$bdim_y)\" title='"._SHOWBANNER_."'><b>$btitolo</b></a></td><td id='info' class='$class'>$blink_click</td><td id='info' class='$class'>$bimp_done/$bimp_target</td><td id='info' class='$class'>$bclick_done/$bclick_target</td><td align='right' class='$class' nowrap><a href='admin.php?page=banners&op=editBanner&id=$bid' title='"._MODIFY_."'><img src='images/edit.gif' alt='Edit' border='0'></a> <a href='admin.php?page=banners&op=deleteBanner&id=$bid' title='"._DELETE_."'><img src='images/delete.gif' alt='Delete' border='0'></a> $info</td></tr>";
}
echo "</tbody>\n";
echo "</table>\n";
}
echo "</table>";
}
function addCustomer($pname,$pemail,$psite,$pnote,$ok=false) {
global $dblink;
if (!$ok) {
echo "<table width='100%' align='center' cellspacing='0' cellpadding='1'>\n";
echo "<form name='form_bnr' method='post' action='admin.php?page=banners&op=addCustomer&ok=true'>\n";
echo "<tr><td width='25%'><b>"._CUSTOMER_NAME_."</b></td><td><input type='text' name='pname' size='40' maxlength='255'></td></tr>\n";
echo "<tr><td><b>"._EMAIL_."</b></td><td><input type='text' name='pemail' size='40' maxlength='255'></td></tr>\n";
echo "<tr><td><b>"._SITE_."</b></td><td><input type='text' name='psite' size='40' maxlength='255'></td></tr>\n";
echo "<tr><td valign='top'><b>"._NOTE_."</b></td><td>";
textarea("pnote","100%","200px",1,"fulladmin");
echo "</td></tr>\n";
echo "<tr><td colspan='2'><input type='submit' name='Submit' value='"._ADD_."'></td></tr>\n";
echo "</form>\n";
echo "</table>\n";
} else {
$save = true;
if ($pname=="") { $save = false; }
if (!validEmail($pemail)) { $save = false; }
if ($save) {
$dblink->query("INSERT INTO memht_banners_clienti VALUES (null,'$pname','$pemail','$psite','$pnote')");
echo "<meta http-equiv='refresh' content='0;URL=admin.php?page=banners'>";
} else {
echo "<div align='center' id='errorText'><b>"._FIELDINVALID_."</b></div>";
}
}
}
function editCustomer($id,$pname,$pemail,$psite,$pnote,$ok=false) {
global $dblink;
$id = intval($id);
$row = $dblink->get_row("SELECT * FROM memht_banners_clienti WHERE id=$id");
$cname = outCode($row['nome']);
$cemail = outCode($row['email']);
$csite = outCode($row['sito']);
$cnote = outCode($row['note']);
if (!$ok) {
echo "<table width='100%' align='center' cellspacing='0' cellpadding='1'>\n";
echo "<form name='form_bnr' method='post' action='admin.php?page=banners&op=editCustomer&id=$id&ok=true'>\n";
echo "<tr><td width='25%'><b>"._CUSTOMER_NAME_."</b></td><td><input type='text' name='pname' size='40' maxlength='255' value=\"$cname\"></td></tr>\n";
echo "<tr><td><b>"._EMAIL_."</b></td><td><input type='text' name='pemail' size='40' maxlength='255' value=\"$cemail\"></td></tr>\n";
echo "<tr><td><b>"._SITE_."</b></td><td><input type='text' name='psite' size='40' maxlength='255' value=\"$csite\"></td></tr>\n";
echo "<tr><td valign='top'><b>"._NOTE_."</b></td><td>";
textarea("pnote","100%","200px",1,"fulladmin",$cnote);
echo "<tr><td colspan='2'><input type='submit' name='Submit' value='"._MODIFY_."'></td></tr>\n";
echo "</form>\n";
echo "</table>\n";
} else {
$save = true;
if ($pname=="") { $save = false; }
if (!validEmail($pemail)) { $save = false; }
if ($save) {
$dblink->query("UPDATE memht_banners_clienti SET nome='$pname',email='$pemail',sito='$psite',note='$pnote' WHERE id=$id");
echo "<meta http-equiv='refresh' content='0;URL=admin.php?page=banners'>";
} else {
echo "<div align='center' id='errorText'><b>"._FIELDINVALID_."</b></div>";
}
}
}
function deleteCustomer($id,$ok=false) {
global $dblink;
$id = intval($id);
if ($ok) {
$dblink->query("DELETE FROM memht_banners_clienti WHERE id=$id");
$dblink->query("DELETE FROM memht_banners_banner WHERE cliente='$id'");
echo "<meta http-equiv='refresh' content='0;URL=admin.php?page=banners'>";
} else {
echo "<div align='center'><b>"._SUREDELETECUSTOMER_."</b><br><a href='admin.php?page=banners&op=deleteCustomer&id=$id&ok=true' title='"._YES_."'>"._YES_."</a> - <a href='admin.php?page=banners' title='"._NO_."'>"._NO_."</a></div>";
}
}
function addBanner($pcustomer,$pposition,$ptitle,$ptype,$pcontent,$psite,$pdimx,$pdimy,$ptarget,$pimptarget,$pclicktarget,$penabled,$ok=false) {
global $dblink;
if (!$ok) {
echo "<table width='100%' align='center' cellspacing='0' cellpadding='1'>\n";
echo "<form name='form_arg' method='post' action='admin.php?page=banners&op=addBanner&ok=true'>\n";
echo "<tr><td width='25%'><b>"._CUSTOMER_."</b></td><td>\n";
echo "<select name='pcustomer'>\n";
$rescust = $dblink->get_list("SELECT * FROM memht_banners_clienti ORDER BY nome");
foreach ($rescust as $row_cust) {
$cust_id = intval($row_cust['id']);
$cust_name = outCode($row_cust['nome']);
echo "<option value='$cust_id'>$cust_name</option>\n";
}
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td><b>"._POSITION_."</b> <img src='images/info.gif' alt='Info' title=\"header=["._INFORMATIONS_."] body=["._INFO_BANNER_POSITION_."]\"></td><td>\n";
echo "<select name='pposition'>\n";
$respos = $dblink->get_list("SELECT * FROM memht_banners_posizioni ORDER BY nome");
foreach ($respos as $row_pos) {
$pos_id = intval($row_pos['id']);
$pos_name = outCode($row_pos['nome']);
echo "<option value='$pos_id'>$pos_name</option>\n";
}
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td><b>"._TITLE_."</b></td><td><input type='text' name='ptitle' size='40' maxlength='255'></td></tr>\n";
echo "<tr><td><b>"._TYPE_."</b> <img src='images/info.gif' alt='Info' title=\"header=["._INFORMATIONS_."] body=["._INFO_BANNER_TYPE_."]\"></td><td>";
echo "<select name='ptype'>\n";
echo "<option value='0' selected>"._IMAGE_."</option>\n";
echo "<option value='1'>"._SCRIPT_."</option>\n";
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td valign='top'><b>"._CONTENT_."</b></td><td>";
textarea("pcontent","100%","200px",0);
echo"</td></tr>\n";
echo "<tr><td><b>"._LINK_."</b> <img src='images/info.gif' alt='Info' title=\"header=["._INFORMATIONS_."] body=["._INFO_BANNER_LINK_."]\"></td><td><input type='text' name='psite' size='30' maxlength='255'> <span id='info'>"._ONLYIFIMAGE_."</span></td></tr>\n";
echo "<tr><td><b>"._DIMX_."</b></td><td><input type='text' name='pdimx' size='10' maxlength='255'></td></tr>\n";
echo "<tr><td><b>"._DIMY_."</b></td><td><input type='text' name='pdimy' size='10' maxlength='255'></td></tr>\n";
echo "<tr><td><b>"._TARGET_."</b> <img src='images/info.gif' alt='Info' title=\"header=["._INFORMATIONS_."] body=["._INFO_BANNER_TARGET_."]\"></td><td>";
echo "<select name='ptarget'>\n";
echo "<option value='0' selected>"._IMPRESSIONS_."</option>\n";
echo "<option value='1'>"._CLICKS_."</option>\n";
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td><b>"._IMPTARGET_."</b> <img src='images/info.gif' alt='Info' title=\"header=["._INFORMATIONS_."] body=["._INFO_BANNER_IMPTARGET_."]\"></td><td><input type='text' name='pimptarget' size='20' maxlength='255'> <span id='info'>"._ONLYIFIMPTARGET_."</span></td></tr>\n";
echo "<tr><td><b>"._CLICKTARGET_."</b> <img src='images/info.gif' alt='Info' title=\"header=["._INFORMATIONS_."] body=["._INFO_BANNER_CLICKTARGET_."]\"></td><td><input type='text' name='pclicktarget' size='20' maxlength='255'> <span id='info'>"._ONLYIFCLICKTARGET_."</span></td></tr>\n";
echo "<tr><td><b>"._ENABLED_."</b></td><td>";
echo "<select name='penabled'>\n";
echo "<option value='1' selected>"._YES_."</option>\n";
echo "<option value='0'>"._NO_."</option>\n";
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td colspan='2'><input type='submit' name='Submit' value='"._ADD_."'></td></tr>\n";
echo "</form>\n";
echo "</table>\n";
} else {
$save = true;
if ($pcustomer=="") { $save = false; $msg = _CUSTOMER_NAME_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($pposition=="") { $save = false; $msg = _POSITION_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($ptitle=="") { $save = false; $msg = _TITLE_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($ptype=="") { $save = false; $msg = _TYPE_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($pcontent=="") { $save = false; $msg = _CONTENT_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($ptype==0 AND $psite=="") { $save = false; $msg = _LINK_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($pdimx=="") { $save = false; $msg = _DIMX_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($pdimy=="") { $save = false; $msg = _DIMY_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($ptarget=="") { $save = false; $msg = _TARGET_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if (($ptarget==0) AND ($pimptarget=="")) { $save = false; $msg = _IMPTARGET_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if (($ptarget==1) AND ($pclicktarget=="")) { $save = false; $msg = _CLICKTARGET_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($save) {
$dblink->query("INSERT INTO memht_banners_banner VALUES (null,'$pcustomer','$pposition','$ptitle','$ptype','$pcontent','$psite','$pdimx','$pdimy','$ptarget','','$pimptarget','','$pclicktarget','$penabled')");
echo "<meta http-equiv='refresh' content='0;URL=admin.php?page=banners'>";
} else {
echo "<div align='center' id='errorText'><b>$msg</b></div>";
}
}
}
function editBanner($id,$pcustomer,$pposition,$ptitle,$ptype,$pcontent,$psite,$pdimx,$pdimy,$ptarget,$pimpdone,$pimptarget,$pclickdone,$pclicktarget,$penabled,$ok=false) {
global $dblink;
$id = intval($id);
$row = $dblink->get_row("SELECT * FROM memht_banners_banner WHERE id=$id");
$customer = intval($row['cliente']);
$position = intval($row['posizione']);
$title = outCode($row['titolo']);
$type = intval($row['tipo']);
$content = outCode($row['contenuto'],0);
$url = outCode($row['url']);
$dimx = intval($row['dim_x']);
$dimy = intval($row['dim_y']);
$target = intval($row['link_click']);
$impdone = intval($row['imp_done']);
$imptarget = intval($row['imp_target']);
$clickdone = intval($row['click_done']);
$clicktarget = intval($row['click_target']);
$enabled = intval($row['enabled']);
if (!$ok) {
echo "<table width='100%' align='center' cellspacing='0' cellpadding='1'>\n";
echo "<form name='form_arg' method='post' action='admin.php?page=banners&op=editBanner&id=$id&ok=true'>\n";
echo "<tr><td width='25%'><b>"._CUSTOMER_."</b></td><td>\n";
echo "<select name='pcustomer'>\n";
$rescust = $dblink->get_list("SELECT * FROM memht_banners_clienti ORDER BY nome");
foreach ($rescust as $row_cust) {
$cust_id = intval($row_cust['id']);
$cust_name = outCode($row_cust['nome']);
if ($customer==$cust_id) {
echo "<option value='$cust_id' selected>$cust_name</option>\n";
} else {
echo "<option value='$cust_id'>$cust_name</option>\n";
}
}
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td><b>"._POSITION_."</b> <img src='images/info.gif' alt='Info' title=\"header=["._INFORMATIONS_."] body=["._INFO_BANNER_POSITION_."]\"></td><td>\n";
echo "<select name='pposition'>\n";
$respos = $dblink->get_list("SELECT * FROM memht_banners_posizioni ORDER BY nome");
foreach ($respos as $row_pos) {
$pos_id = intval($row_pos['id']);
$pos_name = outCode($row_pos['nome']);
if ($position==$pos_id) {
echo "<option value='$pos_id' selected>$pos_name</option>\n";
} else {
echo "<option value='$pos_id'>$pos_name</option>\n";
}
}
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td><b>"._TITLE_."</b></td><td><input type='text' name='ptitle' size='40' maxlength='255' value=\"$title\"></td></tr>\n";
echo "<tr><td><b>"._TYPE_."</b></td><td>";
echo "<select name='ptype'>\n";
if ($type==0) {
echo "<option value='0' selected>"._IMAGE_."</option>\n";
echo "<option value='1'>"._SCRIPT_."</option>\n";
} else {
echo "<option value='0'>"._IMAGE_."</option>\n";
echo "<option value='1' selected>"._SCRIPT_."</option>\n";
}
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td valign='top'><b>"._CONTENT_."</b></td><td>";
textarea("pcontent","100%","200px",0,"",$content);
echo"</td></tr>\n";
echo "<tr><td><b>"._LINK_."</b> <img src='images/info.gif' alt='Info' title=\"header=["._INFORMATIONS_."] body=["._INFO_BANNER_LINK_."]\"></td><td><input type='text' name='psite' size='30' maxlength='255' value=\"$url\"> <span id='info'>"._ONLYIFIMAGE_."</span></td></tr>\n";
echo "<tr><td><b>"._DIMX_."</b></td><td><input type='text' name='pdimx' size='10' maxlength='255' value=\"$dimx\"></td></tr>\n";
echo "<tr><td><b>"._DIMY_."</b></td><td><input type='text' name='pdimy' size='10' maxlength='255' value=\"$dimy\"></td></tr>\n";
echo "<tr><td><b>"._TARGET_."</b> <img src='images/info.gif' alt='Info' title=\"header=["._INFORMATIONS_."] body=["._INFO_BANNER_TARGET_."]\"></td><td>";
echo "<select name='ptarget'>\n";
if ($target==0) {
echo "<option value='0' selected>"._IMPRESSIONS_."</option>\n";
echo "<option value='1'>"._CLICKS_."</option>\n";
} else {
echo "<option value='0'>"._IMPRESSIONS_."</option>\n";
echo "<option value='1' selected>"._CLICKS_."</option>\n";
}
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td><b>"._IMPDONE_."</b></td><td><input type='text' name='pimpdone' size='20' maxlength='255' value=\"$impdone\"></td></tr>\n";
echo "<tr><td><b>"._IMPTARGET_."</b> <img src='images/info.gif' alt='Info' title=\"header=["._INFORMATIONS_."] body=["._INFO_BANNER_IMPTARGET_."]\"></td><td><input type='text' name='pimptarget' size='20' maxlength='255' value=\"$imptarget\"> <span id='info'>"._ONLYIFIMPTARGET_."</span></td></tr>\n";
echo "<tr><td><b>"._CLICKDONE_."</b></td><td><input type='text' name='pclickdone' size='20' maxlength='255' value=\"$clickdone\"></td></tr>\n";
echo "<tr><td><b>"._CLICKTARGET_."</b> <img src='images/info.gif' alt='Info' title=\"header=["._INFORMATIONS_."] body=["._INFO_BANNER_CLICKTARGET_."]\"></td><td><input type='text' name='pclicktarget' size='20' maxlength='255' value=\"$clicktarget\"> <span id='info'>"._ONLYIFCLICKTARGET_."</span></td></tr>\n";
echo "<tr><td><b>"._ENABLED_."</b></td><td>";
echo "<select name='penabled'>\n";
if ($enabled==1) {
echo "<option value='1' selected>"._YES_."</option>\n";
echo "<option value='0'>"._NO_."</option>\n";
} else {
echo "<option value='1'>"._YES_."</option>\n";
echo "<option value='0' selected>"._NO_."</option>\n";
}
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td colspan='2'><input type='submit' name='Submit' value='"._MODIFY_."'></td></tr>\n";
echo "</form>\n";
echo "</table>\n";
} else {
$save = true;
if ($pcustomer=="") { $save = false; $msg = _CUSTOMER_NAME_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($pposition=="") { $save = false; $msg = _POSITION_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($ptitle=="") { $save = false; $msg = _TITLE_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($ptype=="") { $save = false; $msg = _TYPE_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($pcontent=="") { $save = false; $msg = _CONTENT_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($ptype==0 AND $psite=="") { $save = false; $msg = _LINK_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($pdimx=="") { $save = false; $msg = _DIMX_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($pdimy=="") { $save = false; $msg = _DIMY_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($ptarget=="") { $save = false; $msg = _TARGET_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if (($ptarget==0) AND ($pimptarget=="")) { $save = false; $msg = _IMPTARGET_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if (($ptarget==1) AND ($pclicktarget=="")) { $save = false; $msg = _CLICKTARGET_." ".strtolower(_FIELD_)." ".strtolower(_REQUIRED_); }
if ($save) {
$dblink->query("UPDATE memht_banners_banner SET cliente='$pcustomer',posizione='$pposition',titolo='$ptitle',tipo='$ptype',contenuto='$pcontent',url='$psite',dim_x='$pdimx',dim_y='$pdimy',link_click='$ptarget',imp_done='$pimpdone',imp_target='$pimptarget',click_done='$pclickdone',click_target='$pclicktarget',enabled='$penabled' WHERE id=$id");
echo "<meta http-equiv='refresh' content='0;URL=admin.php?page=banners'>";
} else {
echo "<div align='center' id='errorText'><b>$msg</b></div>";
}
}
}
function deleteBanner($id,$ok=false) {
global $dblink;
$id = intval($id);
if ($ok) {
$dblink->query("DELETE FROM memht_banners_banner WHERE id=$id");
echo "<meta http-equiv='refresh' content='0;URL=admin.php?page=banners'>";
} else {
echo "<div align='center'><b>"._SUREDELETEBANNER_."</b><br><a href='admin.php?page=banners&op=deleteBanner&id=$id&ok=true' title='"._YES_."'>"._YES_."</a> - <a href='admin.php?page=banners' title='"._NO_."'>"._NO_."</a></div>";
}
}
function banner_pos($id,$ok=false) {
global $dblink;
$id = intval($id);
if (isSet($_GET['subop'])) { $subop = incode($_GET['subop']); } else { $subop = ""; }
if (isSet($_POST['name'])) { $name = inCode($_POST['name']); } else { $name = ""; }
switch ($subop) {
case "addPos":
if (!$ok) {
echo "<table width='100%' align='center' cellspacing='0' cellpadding='1'>\n";
echo "<form name='form_spid' method='post' action='admin.php?page=banners&op=bannerPos&subop=addPos&ok=true'>";
echo "<tr><td width='25%'><b>"._NAME_."</b><td><input type='text' name='name' size='30' maxlength='255'>\n";
echo "<tr><td colspan='2'><input type='submit' name='Submit' value='"._ADD_."'>\n";
echo "</form>\n";
echo "</table>\n";
} else {
$save = true;
if ($name=="") { $save = false; $msg = _NAMEEMPTY_; }
if ($save) {
$dblink->query("INSERT INTO memht_banners_posizioni (id,nome)
VALUES (null,'$name')");
echo "<meta http-equiv='refresh' content='0;URL=admin.php?page=banners&op=bannerPos'>";
} else {
echo "<div align='center' id='errorText'><b>"._FIELDINVALID_."</b><br>$msg</div>";
}
}
break;
case "editPos":
if (!$ok) {
$row = $dblink->get_row("SELECT nome FROM memht_banners_posizioni WHERE id=$id");
$name = outCode($row['nome']);
echo "<table width='100%' align='center' cellspacing='0' cellpadding='1'>\n";
echo "<form name='form_spid' method='post' action='admin.php?page=banners&op=bannerPos&subop=editPos&id=$id&ok=true'>";
echo "<tr><td width='25%'><b>"._NAME_."</b><td><input type='text' name='name' value=\"$name\" size='30' maxlength='255'>\n";
echo "<tr><td colspan='2'><input type='submit' name='Submit' value='"._MODIFY_."'>\n";
echo "</form>\n";
echo "</table>\n";
} else {
$save = true;
if ($name=="") { $save = false; $msg = _NAMEEMPTY_; }
if ($save) {
$dblink->query("UPDATE memht_banners_posizioni SET nome='$name' WHERE id=$id");
echo "<meta http-equiv='refresh' content='0;URL=admin.php?page=banners&op=bannerPos'>";
} else {
echo "<div align='center' id='errorText'><b>"._FIELDINVALID_."</b><br>$msg</div>";
}
}
break;
case "deletePos":
if ($ok) {
$dblink->query("DELETE FROM memht_banners_posizioni WHERE id=$id");
echo "<meta http-equiv='refresh' content='0;URL=admin.php?page=banners&op=bannerPos'>";
} else {
echo "<div align='center'><b>"._SUREDELETE_."</b><br><a href='admin.php?page=banners&op=bannerPos&subop=deletePos&id=$id&ok=true' title='"._YES_."'>"._YES_."</a> - <a href='admin.php?page=banners&op=bannerPos' title='"._NO_."'>"._NO_."</a></div>";
}
break;
default:
$n = 0;
echo "<table width='100%' align='center' cellspacing='1' cellpadding='0' class='std_nicetable'>";
echo "<thead>\n";
echo "<tr><td width='60%'>"._NAME_."</td><td width='35%'>"._POSITION_."</td><td width='1%'> </td></tr>\n";
echo "</thead>\n";
echo "<tbody>\n";
$result = $dblink->get_list("SELECT * FROM memht_banners_posizioni ORDER BY id");
foreach ($result as $row) {
$id = intval($row['id']);
$nome = outCode($row['nome']);
$class = (($n++%2)!=0) ? "hlight" : "clean" ;
if ($id<=5) { $nome = "<font color='#990000'>$nome</font>"; }
echo "<tr><td class='$class'><b>$nome</b></td><td class='$class' id='info'>$id</td><td width='5%' class='$class' nowrap><div align='right'><a href='admin.php?page=banners&op=bannerPos&subop=editPos&id=$id' title='"._MODIFY_."'><img src='images/edit.gif' alt='Edit' border='0'></a> <a href='admin.php?page=banners&op=bannerPos&subop=deletePos&id=$id' title='"._DELETE_."'><img src='images/delete.gif' alt='Delete' border='0'></a></div></td></tr>\n";
}
echo "</tbody>\n";
echo "</table>";
echo "<div class='box' style='margin-top:4px;'><ul><li>"._USEINPHPPAGESTOSHOWBANNER_."</li><li>"._ATTENTIONDEFINIEDBANNERPOSITIONS_."</li></ul></div>\n";
break;
}
}
echo "<script>\n";
echo "function showBanner(bannerid,dimx,dimy) {\n";
echo "window.open( \"admin/pages/banners/showbanner.php?id=\"+bannerid, \"\",\"resizable=0,width=\"+dimx+\",height=\"+dimy+\",\");\n";
echo "}\n";
echo "</script>\n";
require_once("admin/inc/inc_header.php");
admin_page_title($page);
openTable();
echo "<div align='center' class='box'>";
echo "<a href='admin.php?page=banners' title='"._MAIN_."'><img src='admin/icons/banners.png' border='0' title='"._MAIN_."' align='top'> "._MAIN_."</a>";
echo " - <a href='admin.php?page=banners&op=addCustomer' title='"._ADD_CUSTOMER_."'><img src='admin/icons/add.png' border='0' title='"._ADD_CUSTOMER_."' align='top'> "._ADD_CUSTOMER_."</a>";
echo " - <a href='admin.php?page=banners&op=addBanner' title='"._ADD_BANNER_."'><img src='admin/icons/add.png' border='0' title='"._ADD_BANNER_."' align='top'> "._ADD_BANNER_."</a>";
echo " - <a href='admin.php?page=banners&op=bannerPos' title='"._BANNER_POSITION_."'><img src='admin/icons/banners.png' border='0' title='"._BANNER_POSITION_."' align='top'> "._BANNER_POSITION_."</a>";
echo " - <a href='admin.php?page=banners&op=bannerPos&subop=addPos' title='"._ADD_." "._BANNER_POSITION_."'><img src='admin/icons/add.png' border='0' title='"._ADD_." "._BANNER_POSITION_."' align='top'> "._ADD_." "._BANNER_POSITION_."</a>";
echo "</div>";
closeTable();
openTable();
switch($op) {
case "addCustomer":
addCustomer($pname,$pemail,$psite,$pnote,$ok);
break;
case "editCustomer":
editCustomer($id,$pname,$pemail,$psite,$pnote,$ok);
break;
case "deleteCustomer":
deleteCustomer($id,$ok);
break;
case "addBanner":
addBanner($pcustomer,$pposition,$ptitle,$ptype,$pcontent,$psite,$pdimx,$pdimy,$ptarget,$pimptarget,$pclicktarget,$penabled,$ok);
break;
case "editBanner":
editBanner($id,$pcustomer,$pposition,$ptitle,$ptype,$pcontent,$psite,$pdimx,$pdimy,$ptarget,$pimpdone,$pimptarget,$pclickdone,$pclicktarget,$penabled,$ok);
break;
case "deleteBanner":
deleteBanner($id,$ok);
break;
case "bannerPos":
banner_pos($id,$ok);
break;
default:
bannersMain();
break;
}
closeTable();
require_once("admin/inc/inc_footer.php");
?>
|