Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- function backToPrevious($time) {
- echo '<meta http-equiv="refresh" content="',$time,';url=',$_SERVER['HTTP_REFERER'],'" />';
- }
- if(isset($_SESSION['admin']) && $_SESSION['admin']==true && isset($_POST['entity_search'])) {
- include_once "db_connect.php";
- if($_POST['entity_choice']=="author") {
- $sql='UPDATE author SET Name=\''.$_POST['name'].'\' WHERE Name=\''.$_POST['entity_search'].'\'';
- $send=$db->query($sql);
- if($send) {
- echo 'Success';
- backToPrevious(5);
- }
- else {
- echo 'Failure';
- echo $sql;
- backToPrevious(5);
- }
- }
- else if($_POST['entity_choice']=="editor") {
- $sql='UPDATE editor SET Name=\''.$_POST['name'].'\' WHERE Name=\''.$_POST['entity_search'].'\'';
- $send=$db->query($sql);
- if($send) {
- echo 'Success';
- backToPrevious(5);
- }
- else {
- echo 'Failure';
- backToPrevious(5);
- }
- }
- else if($_POST['entity_choice']=="publisher") {
- $sql='UPDATE publisher SET Name=\''.$_POST['name'].'\' WHERE Name=\''.$_POST['entity_search'].'\'';
- $send=$db->query($sql);
- if($send) {
- echo 'Success';
- backToPrevious(5);
- }
- else {
- echo 'Failure';
- backToPrevious(5);
- }
- }
- else if($_POST['entity_choice']=="article" || $_POST['entity_choice']=="book" || $_POST['entity_choice']=="incollection" || $_POST['entity_choice']=="master_thesis" || $_POST['entity_choice']=="phd_thesis") {
- $paramArray=array();
- if(isset($_POST['key']))
- $paramArray[]='PubKey=\''.$_POST['key'].'\'';
- if(isset($_POST['title']))
- $paramArray[]='Title=\''.$_POST['title'].'\'';
- if(isset($_POST['year']))
- $paramArray[]='Year=\''.$_POST['year'].'\'';
- if(isset($_POST['url']))
- $paramArray[]='url=\''.$_POST['url'].'\'';
- if(isset($_POST['ee']))
- $paramArray[]='ee=\''.$_POST['ee'].'\'';
- $paramArray[]='mdate=CURDATE()';
- if(count($paramArray)>0) {
- $qry_param=implode(', ',$paramArray);
- $sql='UPDATE publication SET '.$qry_param.' WHERE PubKey=\''.$_POST['entity_search'].'\'';
- $send=$db->query($sql);
- }
- if($_POST['entity_choice']=="article") {
- $paramArray=array();
- if(isset($_POST['volume']))
- $paramArray[]='Volume=\''.$_POST['volume'].'\'';
- if(isset($_POST['number']))
- $paramArray[]='Number=\''.$_POST['number'].'\'';
- if(isset($_POST['pages']))
- $paramArray[]='Pages=\''.$_POST['pages'].'\'';
- if(count($paramArray)>0) {
- $qry_param=implode(', ',$paramArray);
- $sql='UPDATE pub_article SET '.$qry_param.' WHERE PubID=\''.$_POST['entity_search'].'\'';
- $send=$db->query($sql);
- if($send) {
- echo 'Success';
- backToPrevious(5);
- }
- else {
- echo 'Failure';
- backToPrevious(5);
- }
- }
- }
- else if($_POST['entity_choice']=="book") {
- $paramArray=array();
- if(isset($_POST['volume']))
- $paramArray[]='Volume=\''.$_POST['volume'].'\'';
- if(isset($_POST['number']))
- $paramArray[]='Series=\''.$_POST['series'].'\'';
- if(isset($_POST['isbn']))
- $paramArray[]='isbn=\''.$_POST['isbn'].'\'';
- if(count($paramArray)>0) {
- $qry_param=implode(', ',$paramArray);
- $sql='UPDATE pub_book SET '.$qry_param.' WHERE PubID=\''.$_POST['entity_search'].'\'';
- $send=$db->query($sql);
- if($send) {
- echo 'Success';
- backToPrevious(5);
- }
- else {
- echo 'Failure';
- backToPrevious(5);
- }
- }
- }
- else if($_POST['entity_choice']=="incollection") {
- $paramArray=array();
- if(isset($_POST['chapter']))
- $paramArray[]='Chapter=\''.$_POST['chapter'].'\'';
- if(isset($_POST['pages']))
- $paramArray[]='Pages=\''.$_POST['pages'].'\'';
- if(count($paramArray)>0) {
- $qry_param=implode(', ',$paramArray);
- $sql='UPDATE pub_incollection SET '.$qry_param.' WHERE PubID=\''.$_POST['entity_search'].'\'';
- $send=$db->query($sql);
- if($send) {
- echo 'Success';
- backToPrevious(5);
- }
- else {
- echo 'Failure';
- backToPrevious(5);
- }
- }
- }
- else if($_POST['entity_choice']=="master_thesis") {
- $paramArray=array();
- if(isset($_POST['school']))
- $paramArray[]='School=\''.$_POST['school'].'\'';
- if(count($paramArray)>0) {
- $qry_param=implode(', ',$paramArray);
- $sql='UPDATE pub_master_thesis SET '.$qry_param.' WHERE PubID=\''.$_POST['entity_search'].'\'';
- $send=$db->query($sql);
- if($send) {
- echo 'Success';
- backToPrevious(5);
- }
- else {
- echo 'Failure';
- backToPrevious(5);
- }
- }
- }
- else if($_POST['entity_choice']=="phd_thesis") {
- $paramArray=array();
- if(isset($_POST['school']))
- $paramArray[]='School=\''.$_POST['school'].'\'';
- if(isset($_POST['isbn']))
- $paramArray[]='isbn=\''.$_POST['isbn'].'\'';
- if(count($paramArray)>0) {
- $qry_param=implode(', ',$paramArray);
- $sql='UPDATE pub_phd_thesis SET '.$qry_param.' WHERE PubID=\''.$_POST['entity_search'].'\'';
- $send=$db->query($sql);
- if($send) {
- echo 'Success';
- backToPrevious(5);
- }
- else {
- echo 'Failure';
- backToPrevious(5);
- }
- }
- }
- }
- else if($_POST['entity_choice']=="journal") {
- $paramArray=array();
- if(isset($_POST['journal']))
- $paramArray[]='Title=\''.$_POST['journal'].'\'';
- if(count($paramArray)>0) {
- $qry_param=implode(', ',$paramArray);
- $sql='UPDATE journal SET '.$qry_param.' WHERE Title=\''.$_POST['entity_search'].'\'';
- $send=$db->query($sql);
- if($send) {
- echo 'Success';
- backToPrevious(5);
- }
- else {
- echo 'Failure';
- echo $sql;
- backToPrevious(5);
- }
- }
- }
- }//Fin if isset($_session(admin)
- else {
- echo 'Only admin can access this area.';
- backToPrevious(5);
- }
- exit();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment