-
✘✘✘ WIBUHAX0R1337 ✘✘✘
-
✘
PATCH :
/
var
/
www
/
clients
/
client4
/
web4
/
web
/
ris
/
mods
/
Upload File:
files >> /var/www/clients/client4/web4/web/ris/mods/researcher_act.php
<?php $g_db->pk = "id"; $do = $g_util->getParam('do', ''); $name = $g_util->getParam('name', ''); $ordering1 = $g_util->getParam('ordering1', '0'); $ordering2= $g_util->getParam('ordering', '0'); $dir_picture = "pics/researcher/"; $url = "admin.php?mod="; $table = "researcher"; switch ($do) { case "save"; if (!check_dup($id, $name)) { $data = map_data(); $g_db->insertData($table, $data); $id = $g_db->getLastID($table); //master_ordering($table, $id, $ordering1, $ordering2); $url .= "researcher_lst"; }else{ $url .= "researcher_frm&error=dup"; } break; case "update"; if (!check_dup($id, $name)) { $data = map_data(); $g_db->updateData($table, $data, $id); //master_ordering($table, $id, $ordering1, $ordering2); $url .= "researcher_lst"; }else{ $url .= "researcher_frm&error=dup&id=".$id; } break; case "del_pic"; $sql = "SELECT picture FROM researcher WHERE id='".$id."' "; $picture = $g_db->getValue($sql); if ($picture!='') { $picture = $dir_picture.$picture; if (is_file($picture)) { unlink($picture); } $sql = "UPDATE researcher SET picture='' WHERE id='".$id."' "; $g_db->query($sql); } $url .= "researcher_frm&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 .= "researcher_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 .= "researcher_lst"; break; } $g_util->forwardPage($url."&kw=".$kw."&fac_id=".$fac_id."&res_id=".$res_id."&page=".$page); function check_dup($id, $name) { global $g_db; $sql = "SELECT id FROM ".$table." WHERE id<>'".$id."' AND name='".$name."' "; //return $g_db->hasData($sql); return false; } function map_data() { global $g_util; global $g_date; global $dir_picture; $binds = array(); $binds['tname'] = $g_util->getParam('tname', ''); $binds['name'] = $g_util->getParam('name', ''); $binds['faculty_id'] = $g_util->getParam('faculty_id', ''); $binds['department'] = $g_util->getParam('department', ''); $binds['education'] = $g_util->getParam('education', ''); $binds['expertise'] = $g_util->getParam('expertise', ''); $binds['email'] = $g_util->getParam('email', ''); $picture = $g_util->fileUpload('picture', $dir_picture); if ($picture!='') { $binds['picture'] = $picture; } 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 ♥