0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.137.159.163


Current Path : /proc/thread-self/root/var/www/oasis/src/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/src/execute_query.php

<?php 
function saveExcuteUserDefinedQuery($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);	
	$execute_query=stripslashes(trim($aobj_context->mobj_data["execute_query"]));	
	
	$arr_execute_query=explode(';',$execute_query);
	
	foreach($arr_execute_query as $k=>$v)
		{
			if(!empty($v))
			{
			$lobj_execute_query = $aobj_context->mobj_db->Execute(($v));
			 
   			}							
		 }
		 
		if($lobj_execute_query)
			{
				$rdata = "Query Executed Successfully.";
				print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
				return $rdata;        
			 }
			else
			{
				$rdata = "Execution Failed-----------".mysql_error();
				print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  						
			    return $rdata;
			}   
}
function GetQueryResultSet($aobj_context)
{
ini_set("display_errors","On");
error_reporting(E_ALL ^ E_NOTICE);
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);	
	$execute_query=stripcslashes(trim($aobj_context->mobj_data["execute_query"]));	
	$lobj_data = $aobj_context->mobj_db->GetAll($execute_query);
	
	$row_cnt=count($lobj_data);
	$header_row=(array_keys($lobj_data[0]));
	$col_span_cnt=count($header_row);	
	$html ="<div align='center' style='padding-left:11px'>"; 
			$html.="<table align='center' class='tr_ventor_row' cellspacing='0' cellpadding='0' border='0' width='99%'>";			
			$html.="<th align='left' colspan='{$col_span_cnt}' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='padding-left:6px; height:24px;'>Result Set -Returned row count:{$row_cnt}</th>";
			$html.="<tr class='ui-state-default ui-jqgrid-hdiv'>";

	$i=0;$border_left="";
	foreach($header_row as $key1=> $value1)
	{		if($i==0)
			{
			$border_left=" border-left:1px solid #C5DBEC; ";  $i++;
			}
			$html.="<td  style='padding:2px;  {$border_left} border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>{$value1}</td>";
			$border_left='';
	}
	$html.="</tr>";
	
	foreach($lobj_data as $key=> $value)
	{
		 $html.="<tr class='ui-widget-content jqgrow'>";
		 	$i=0;$border_left="";
		foreach($value as $k=> $v)
		{
			if($i==0)
			{
			$border_left=" border-left:1px solid #C5DBEC; ";  $i++;
			}
			 $html.="<td class='tbl_row_new' align='left'style='{$border_left} border-right:1px solid #C5DBEC; border-right:1px solid #C5DBEC;  padding:2px;'  >{$v}</td>";
			$border_left='';
		}
		$html.="</tr>";
	}
		$html.="</table></div>"; 
		
		print_r($aobj_context->mobj_output->ToJSONEnvelope($html,0,"success"));
		return $html;  
}	
?>