-
✘✘✘ WIBUHAX0R1337 ✘✘✘
-
✘
PATCH :
/
var
/
www
/
clients
/
client4
/
web4
/
web
/
ris
/
mods
/
Upload File:
files >> /var/www/clients/client4/web4/web/ris/mods/research_act.php
<?php $g_db->pk = "id"; $do = $g_util->getParam('do', ''); $title = $g_util->getParam('title', ''); $fac_id = $g_util->getParam('fac_id', 'all'); $res_id = $g_util->getParam('res_id', 'all'); $ordering1 = $g_util->getParam('ordering1', '0'); $ordering2= $g_util->getParam('ordering', '0'); $url = "admin.php?mod="; $table = "research"; switch ($do) { case "save"; if (!check_dup($id, $title)) { $data = map_data(); //print_r($data); $g_db->insertData($table, $data); $id = $g_db->getLastID($table); //master_ordering($table, $id, $ordering1, $ordering2); $url .= "research_lst"; }else{ $url .= "research_frm&error=dup"; } break; case "update"; if (!check_dup($id, $title)) { $data = map_data(); //print_r($data); $g_db->updateData($table, $data, $id); //master_ordering($table, $id, $ordering1, $ordering2); $url .= "research_lst"; }else{ $url .= "research_frm&error=dup&id=".$id; } break; case "delete"; $sql = "SELECT ordering FROM ".$table." WHERE id='".$id."' "; $ordering = $g_db->getValue($sql); $sql = "DELETE FROM ".$table." WHERE id='".$id."' "; $g_db->query($sql); //master_ordering($table, $id, $ordering, 0); $url .= "research_lst"; break; case "status"; $status = $g_util->getParam('status', '0'); $field = $g_util->getParam('field', '0'); $sql = "UPDATE ".$table." SET `".$field."`='".$status."' WHERE id='".$id."' "; $g_db->query($sql); $url .= "research_lst"; break; } $g_util->forwardPage($url."&kw=".$kw."&page=".$page."&fac_id=".$fac_id."&res_id=".$res_id); function check_dup($id, $title) { global $g_db; $sql = "SELECT id FROM ".$table." WHERE id<>'".$id."' AND title='".$title."' "; //return $g_db->hasData($sql); return false; } function map_data() { global $g_db; global $g_util; global $g_date; $sql = "SELECT id, faculty_id FROM researcher WHERE name='".$g_util->getParam('researcher', '')."' "; $researcher = $g_db->getObject($sql); $binds = array(); $binds['res_type_id'] = $g_util->getParam('res_type_id', '0'); $binds['title'] = $g_util->getParam('title', ''); $binds['faculty_id'] = $researcher->faculty_id; $binds['researcher_id'] = $researcher->id; $binds['keyword'] = $g_util->getParam('keyword', ''); $binds['reg_no'] = $g_util->getParam('reg_no', ''); $binds['abstract'] = $g_util->getParam('abstract', ''); $binds['abstract_en'] = $g_util->getParam('abstract_en', ''); $binds['fund_id'] = $g_util->getParam('fund_id', '0'); $binds['fund_year'] = $g_util->getParam('fund_year', '0'); $binds['fund_received'] = $g_util->getParam('fund_received', '0'); $binds['cooperation'] = $g_util->getParam('cooperation', ''); $binds['co1'] = $g_util->getParam('co1', '0'); $binds['co2'] = $g_util->getParam('co2', '0'); $binds['area_lat'] = $g_util->getParam('area_lat', ''); $binds['area_long'] = $g_util->getParam('area_long', ''); $binds['area_address'] = $g_util->getParam('area_address', ''); $binds['area_province'] = $g_util->getParam('area_province', '0'); $binds['area_amphur'] = $g_util->getParam('area_amphur', '0'); $binds['area_district'] = $g_util->getParam('area_district', '0'); return $binds; } function master_ordering($table, $id, $ordering1, $ordering2) { global $g_db; global $g_util; if ($ordering1==0 && $ordering2>0) { $sql = "UPDATE ".$table." SET ordering=ordering+1 WHERE ordering>='".$ordering2."' AND id<>'".$id."' "; $g_db->query($sql); }else if ($ordering2==0 && $ordering1>0) { $sql = "UPDATE ".$table." SET ordering=ordering-1 WHERE ordering>='".$ordering1."' AND id<>'".$id."' "; $g_db->query($sql); }else{ $diff = $ordering2 - $ordering1; if ($diff>0) { $sql = "UPDATE ".$table." SET ordering=ordering-1 WHERE ordering<='".$ordering2."' AND ordering>'".$ordering1."' AND id<>'".$id."' "; $g_db->query($sql); }else if ($diff<0) { $sql = "UPDATE ".$table." SET ordering=ordering+1 WHERE ordering>='".$ordering2."' AND ordering<'".$ordering1."' AND id<>'".$id."' "; $g_db->query($sql); } } } ?>
2022 - 2023 Copyright By Lutfifakee || Padang Blackhat ♥