CasperSecurity

Current Path : /var/www/acasv2.uiet.co.in/v.2.0/api/request/stock_transfer_api/
Upload File :
Current File : /var/www/acasv2.uiet.co.in/v.2.0/api/request/stock_transfer_api/stock_transfer__insert_api.php

   <?php
session_start();
include '../../../web/connection/connectionv2.php';
include '../../../web/connection/con.php';		
include '../../../web/connection/encryption.php';

 
     
	

	date_default_timezone_set('Asia/Kolkata');
	 $date = date("Y-m-d H:i:s");
	$active = 'yes';
	 $userId   = $_SESSION['USER_ID'];
 

	foreach($_SESSION['exp_items'] as $k => $v) {
	   $totalqy = $v['adjustqty'];
	    $purchase_item_id = $v['puritem_id'];
	   $stock_transfer_date = $v['stocktrnsdt'];
	  // $stock_transfer_no = $v['stocktrnsno'];
	   $posd_id = $v['pos'];
	   $quantity = $v['qty'];
	   $purchase_amount = $v['amount'];
	   $totalweight = $v['totalweight'];
	   $loose_rate = $v['lrate'];
		
	

	
if(!empty($stock_transfer_date)){
	
	$db_handle = new DBController();
    $newUpdate = $db_handle->runMyUpdate("UPDATE canteen_purchase_item SET adjust_quantity = -'$totalqy' WHERE purchase_item_id = '$purchase_item_id'");

	
     $st_nomrow = $db_handle-> numRows("SELECT * FROM stock_transfer WHERE stock_transfer_no = '$stock_transfer_no'");
    if($st_nomrow == 0){
	
		
		$selectst ="SELECT * FROM stock_transfer ORDER BY stock_transfer_id DESC";
		 $queryst=mysqli_query($con,$selectst);
		 $resultst=mysqli_fetch_assoc($queryst);
		 $stock_transfer_id = $resultst['stock_transfer_id']+1;
		 $zero = 0;
		 $qut = 'STA';
		 $year = date("Y");
		  $stock_transfer_noyy = $qut.'-'.$year.'-'.$zero.''.$zero.''.$zero.''.$zero.''.$stock_transfer_id;
		if(($stock_transfer_id >= '10') && ($stock_transfer_id < '100')){
		$stock_transfer_no	 = $qut.'-'.$year.'-'.$zero.''.$zero.''.$zero.''.$stock_transfer_id;
		}elseif(($stock_transfer_id >= '100')&&($stock_transfer_id < '1000')){
		   $stock_transfer_no	 = $qut.'-'.$year.'-'.$zero.''.$zero.''.$stock_transfer_id;	
		}elseif($stock_transfer_id >= '1000'){
			$stock_transfer_no	 = $stock_transfer_id;
		}else{
			 $stock_transfer_no	 = $stock_transfer_noyy;
		}
	  
	$db_handle = new DBController();
	$newInsert = $db_handle->tableinsert("INSERT INTO stock_transfer(stock_transfer_no,stock_transfer_date,pos_id,created_on,created_by,is_active) 
	VALUES ('$stock_transfer_no','$stock_transfer_date','$posd_id','$date','$userId','$active')");
    
	
	$db_handle = new DBController();
	$newInsert2 = $db_handle->tableinsert("INSERT INTO stock_transfer_item(stock_transfer_id,purchase_item_id,item_quantity,purchase_amount,totalpacket_weight,loose_rate) 
	VALUES ('$newInsert','$purchase_item_id','$quantity','$purchase_amount','$totalweight','$loose_rate')");
	}else{
		
		$db_handle = new DBController();
        $stocktransfer = $db_handle-> runQuery("SELECT * FROM stock_transfer WHERE stock_transfer_no = '$stock_transfer_no' ORDER BY stock_transfer_id DESC LIMIT 1");
		$db_handle = new DBController();
		foreach( $stocktransfer as  $stocktransferd){
			
	         $newInsert =  $stocktransferd['stock_transfer_id'];
		}
	 $db_handle = new DBController();
	$newInsert2 = $db_handle->tableinsert("INSERT INTO stock_transfer_item(stock_transfer_id,purchase_item_id,item_quantity,purchase_amount,totalpacket_weight,loose_rate) 
	VALUES ('$newInsert','$purchase_item_id','$quantity','$purchase_amount','$totalweight','$loose_rate')");
	
	}
	
	}
	}	

if($newInsert2 == TRUE){ 
	unset($_SESSION['exp_items']);
			$_SESSION['ERROR_MSG'] = "STA no '$stock_transfer_no' successfully inserted";
		  $_SESSION['MSG_ALRT'] = "TRUE";
		header('location:../../../web/home/modules/university/Canteen/stock_transfer/stock_transfer_grid.php');
		
		}else{
		$_SESSION['ERROR_MSG'] = "Sorry! Try Again";
		  $_SESSION['MSG_ALRT'] = "TRUE";
		 header('location:../../../web/home/modules/university/Canteen/stock_transfer/stock_transfer_grid.php');
		
		}		
	

$stocktransfer_ide =amebi_crypt($newInsert,e);
$stocktranfenos =amebi_crypt($stock_transfer_no,e);

$stocktransfer_date = amebi_crypt($stock_transfer_date,e);
$posd_idqe = amebi_crypt($posd_id,e);

	

//header('location:../../../web/home/modules/stock/stock_transfer/stock_transfer_grid.php?stocktransferid='.$stocktransfer_ide.'&stocktransferdate='.$stocktransfer_date.'&posidd='.$posd_idqe.'&stocktransferno='.$stocktranfenos);
//header('location:../../../web/home/modules/stock/stock_transfer/stock_transfer_grid.php?stocktransferid='.$stocktransfer_ide.'&stocktransferdate='.$stocktransfer_date.'&posidd='.$posd_idqe.'&stocktransferno='.$stocktranfenos);

?>
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY