if (isset($_GET['status']) && !isset($message)) {
if ($_GET['status'] == "sn") {
$message = $locale['zaid_010'];
} elseif ($_GET['status'] == "su") {
$message = $locale['zaid_011'];
} elseif ($_GET['status'] == "deln") {
$message = $locale['zaid_012']."<br />\n<span class='small'>".$locale['zaid_015']."</span>";
} elseif ($_GET['status'] == "dely") {
$message = $locale['zaid_013'];
}
if ($message) { echo "<div class='admin-message'>".$message."</div>\n"; }
}
opentable ($locale['zaid_014']);
require_once INFUSIONS."atp_zaidejai/inc/panel_tab.php";
closetable();
if ((isset($_GET['action']) && $_GET['action'] == "delete") && (isset($_GET['zaid_id']) && isnum($_GET['zaid_id']))) {
$result = dbquery("SELECT * FROM ".DB_ATP_ZAID." WHERE zaid_id='".$_GET['zaid_id']."'");
if (dbrows($result) != 0) {
redirect(FUSION_SELF.$aidlink."&status=deln");
} else {
$result = dbquery("DELETE FROM ".DB_ATP_ZAID." WHERE zaid_id='".$_GET['zaid_id']."'");
redirect(FUSION_SELF.$aidlink."&status=dely");
}
} else {
if (isset($_POST['save_cat'])) {
$pav_var = stripinput($_POST['pav_var']);
$reit = stripinput($_POST['reit']);
$amzius = stripinput($_POST['amzius']);
$gim_vieta = stripinput($_POST['gim_vieta']);
$gyv_vieta = stripinput($_POST['gyv_vieta']);
$ugis = stripinput($_POST['ugis']);
$svoris = stripinput($_POST['svoris']);
$ranka = stripinput($_POST['ranka']);
$sporte_nuo = stripinput($_POST['sporte_nuo']);
$treneris = stripinput($_POST['treneris']);
$info = addslash($_POST['info']);
$laimejimai = addslash($_POST['laimejimai']);
if ($pav_var) {
if ((isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['zaid_id']) && isnum($_GET['zaid_id']))) {
$result = dbquery("UPDATE ".DB_ATP_ZAID." SET (zaid_pav_var, zaid_reit, zaid_amzius, zaid_gim_vieta, zaid_gyv_vieta, zaid_ugis, zaid_svoris, zaid_ranka, zaid_sporte_nuo, zaid_treneris, zaid_info, zaid_laimejimai) VALUES('$pav_var', '$reit', '$amzius', '$gim_vieta', '$gyv_vieta', '$ugis', '$svoris', '$ranka', '$sporte_nuo', '$treneris', '$info', '$laimejimai') WHERE zaid_id='".$_GET['zaid_id']."'");
redirect(FUSION_SELF.$aidlink."&status=su");
} else {
$result = dbquery("INSERT INTO ".DB_ATP_ZAID." (zaid_pav_var, zaid_reit, zaid_amzius, zaid_gim_vieta, zaid_gyv_vieta, zaid_ugis, zaid_svoris, zaid_ranka, zaid_sporte_nuo, zaid_treneris, zaid_info, zaid_laimejimai) VALUES('$pav_var', '$reit', '$amzius', '$gim_vieta', '$gyv_vieta', '$ugis', '$svoris', '$ranka', '$sporte_nuo', '$treneris', '$info', '$laimejimai')");
redirect(FUSION_SELF.$aidlink."&status=sn");
}
} else {
redirect(FUSION_SELF.$aidlink);
}
}
if ((isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['zaid_id']) && isnum($_GET['zaid_id']))) {
$result = dbquery("SELECT * FROM ".DB_ATP_ZAID." WHERE zaid_id='".$_GET['zaid_id']."'");
if (dbrows($result)) {
$data = dbarray($result);
$pav_var = $data['zaid_pav_var'];
$reit = $data['zaid_reit'];
$amzius = $data['zaid_amzius'];
$gim_vieta = $data['zaid_gim_vieta'];
$gyv_vieta = $data['zaid_gyv_vieta'];
$ugis = $data['zaid_ugis'];
$svoris = $data['zaid_svoris'];
$ranka = $data['zaid_ranka'];
$sporte_nuo = $data['zaid_sporte_nuo'];
$treneris = $data['zaid_treneris'];
$info = $data['zaid_info'];
$laimejimai = $data['zaid_laimejimai'];
$formaction = FUSION_SELF.$aidlink."&action=edit&zaid_id=".$data['zaid_id'];
opentable($locale['zaid_016']);
} else {
redirect(FUSION_SELF.$aidlink);
}
} else {
$pav_var = "";
$reit = "";
$amzius = "";
$gim_vieta = "";
$gyv_vieta = "";
$ugis = "";
$svoris = "";
$ranka = "";
$sporte_nuo = "";
$treneris = "";
$info = "";
$laimejimai = "";
$formaction = FUSION_SELF.$aidlink;
opentable($locale['zaid_009']);
}