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.23.103.203


Current Path : /proc/thread-self/root/var/www/misc/public_html/cuget16/src/
Upload File :
Current File : //proc/thread-self/root/var/www/misc/public_html/cuget16/src/applicationForm_closed5466545.php

 <?php
    
  class applicationForm
	{
    
		function __construct($aobj_context)
		  {
			session_start();
			$this->aobj_context=$aobj_context;
			$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);	
			$this->aobj_context=$aobj_context;
			$this->ip=$_SERVER["REMOTE_ADDR"];
		 }
		 function assignParams()
		 { 
			$this->edit_app_code=trim($this->aobj_context->mobj_data["edit_app_code"]);
			$this->fcntrcode=trim($this->aobj_context->mobj_data["fcntrcode"]);
			$this->fsubcode=trim($this->aobj_context->mobj_data["fsubcode"]);
			$this->fcntrcode2=trim($this->aobj_context->mobj_data["fcntrcode2"]);
			$this->fsubcode2=trim($this->aobj_context->mobj_data["fsubcode2"]);
			$this->fcntrcode3=trim($this->aobj_context->mobj_data["fcntrcode3"]);
			$this->fsubcode3=trim($this->aobj_context->mobj_data["fsubcode3"]);
			$this->ffname=trim($this->aobj_context->mobj_data["ffname"]);
			$this->fmotname=trim($this->aobj_context->mobj_data["fmotname"]);
			$this->ffatname=trim($this->aobj_context->mobj_data["ffatname"]);
			$this->fdob=trim($this->aobj_context->mobj_data["fdob"]);
			$this->fgender=trim($this->aobj_context->mobj_data["fgender"]);
			$this->fdomicile=trim($this->aobj_context->mobj_data["fdomicile"]);
			$this->fpob=trim($this->aobj_context->mobj_data["fpob"]);
			$this->fcatcode=trim($this->aobj_context->mobj_data["fcatcode"]);
			$this->freligion=trim($this->aobj_context->mobj_data["freligion"]);
			$this->fminority=trim($this->aobj_context->mobj_data["fminority"]);
			$this->fminoritydesc='';
			$this->fqualexam=trim($this->aobj_context->mobj_data["fqualexam"]);
			$this->fqualify=trim($this->aobj_context->mobj_data["fqualify"]);
			$this->funivname=trim($this->aobj_context->mobj_data["funiversity"]);
			$this->fpassyear=trim($this->aobj_context->mobj_data["fpassyear"]);
			$this->fsubjects=trim($this->aobj_context->mobj_data["fsubjects"]);
			$this->fmarks=trim($this->aobj_context->mobj_data["fmarks"]);
			$this->fcgpa=trim($this->aobj_context->mobj_data["fcgpa"]);
			$this->fgrade=trim($this->aobj_context->mobj_data["fgrade"]);
			$this->fucnet=trim($this->aobj_context->mobj_data["fucnet"]);
			$this->fucjrf=trim($this->aobj_context->mobj_data["fucjrf"]);
			$this->fucnetsubject=trim($this->aobj_context->mobj_data["fucnetsubject"]);
			$this->fucnetyear=trim($this->aobj_context->mobj_data["fucnetyear"]);
			$this->fucjrfsubject=trim($this->aobj_context->mobj_data["fucjrfsubject"]);
			$this->fucjrfyear=trim($this->aobj_context->mobj_data["fucjrfyear"]);
			$this->fadd1=trim($this->aobj_context->mobj_data["fadd1"]);
			$this->fperadd=trim($this->aobj_context->mobj_data["fperadd"]);
			$this->fpincode=trim($this->aobj_context->mobj_data["fpincode"]);
			$this->fperpincode=trim($this->aobj_context->mobj_data["fperpincode"]);
			$this->fphone=trim($this->aobj_context->mobj_data["fphone"]);
			$this->fmobile=trim($this->aobj_context->mobj_data["fmobile"]);
			$this->femail=trim($this->aobj_context->mobj_data["femail"]);
			$this->famount=trim($this->aobj_context->mobj_data["famount"]);
			
			$sql_feestatus =  "select IF(fpgetfee = 0,'success','') as paystatus from mascategory where fcategory = '{$this->fcatcode}'";
			$sql_feestatus_obj=$this->aobj_context->mobj_db->getRow($sql_feestatus);	
			$this->paySataus = $sql_feestatus_obj[paystatus];
	 }
		 
		function SaveDetails()
		{
			  $check_dup="select count(*) as dup_cnt from student
						where 
						ffname='{$this->ffname}'
						and fmotname='{$this->fmotname}'
						and ffatname='{$this->ffatname}'
						and fdob='{$this->fdob}'";
			$obj_check_dup=$this->aobj_context->mobj_db->GetRow($check_dup);
			
			if($obj_check_dup[dup_cnt]>0)
			{
				$data="You have allready Entered the details.";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;
			}  
			else if(empty($this->ffname))
			{
				$data="Please Enter the Candidate Name";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;
			}
			else if(empty($this->fphone))
			{
				$data="Please Enter the Phone Number";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;
			}else if(empty($this->fpincode))
			{
				$data="Please Enter the Pin Code";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;
			}else if(empty($this->fmobile))
			{
				$data="Please Enter the Mobile Number";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;
			} 
			
			$insert_qry=" insert into   student 
						(  
						fcntrcode, fcntrcode2, fcntrcode3, fsubcode, fsubcode2, 
						fsubcode3, ffname, fmotname, ffatname, 
						fdob, fpob, fgender,
						fdomicile, fcatcode, freligion, fminority, fminoritydesc, famount,
						fqualexam, fqualify, funivname, fsubjects,
						fmarks, fcgpa, fgrade,fucnet,fucnetsubject,fucnetyear,
						fucjrf, fucjrfsubject, fucjrfyear,
						fpassyear, fadd1, fpincode, fperadd, fperpincode, fphone, 
						fmobile, femail, created_date, 
						ip_address ,fpaystatus
						)
				values
				( 		'{$this->fcntrcode}','{$this->fcntrcode2}','{$this->fcntrcode3}',
						'{$this->fsubcode}', '{$this->fsubcode2}', '{$this->fsubcode3}', '{$this->ffname}', 
						'{$this->fmotname}','{$this->ffatname}', 
						'{$this->fdob}', '{$this->fpob}', '{$this->fgender}', 
						'{$this->fdomicile}','{$this->fcatcode}', '{$this->freligion}',	
						'{$this->fminority}','{$this->fminoritydesc}',
						'{$this->famount}', '{$this->fqualexam}', '{$this->fqualify}', 
						'{$this->funivname}','{$this->fsubjects}','{$this->fmarks}',
						'{$this->fcgpa}','{$this->fgrade}',
						'{$this->fucnet}','{$this->fucnetsubject}','{$this->fucnetyear}',
						'{$this->fucjrf}','{$this->fucjrfsubject}','{$this->fucjrfyear}',
						'{$this->fpassyear}', 
						'{$this->fadd1}', '{$this->fpincode}', 
						'{$this->fperadd}', '{$this->fperpincode}', '{$this->fphone}', 
						'{$this->fmobile}', '{$this->femail}', 
						now(),'{$this->ip}','{$this->paySataus}') ";
					 
			$insert_obj=$this->aobj_context->mobj_db->Execute($insert_qry);	
		  
			$error=mysql_error();;
			$this->last_inserted_id = $this->aobj_context->mobj_db->Insert_ID();
			if($this->last_inserted_id)
			{
				$this->UpdateApplicationUniqueNo();
			}
			else
			{
			$data="Error While Inserting".$error.$this->fabsence ;;
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;
			}
		}
		function UpdateApplicationUniqueNo()
		{
			$get_last_no="select last_no+1 as app_no from last_no";
			$obj =  $this->aobj_context->mobj_db->GetRow($get_last_no); 
			$this->app_no=$obj[app_no];
			
			$update_last_no="update last_no set last_no=last_no+1";
			$this->aobj_context->mobj_db->Execute($update_last_no); 
			
			$update_app_no="update student set app_no={$this->app_no} 
					where internal_code={$this->last_inserted_id}";
			$this->aobj_context->mobj_db->Execute($update_app_no);

		$college_path=$this->aobj_context->main_src."/student_photos/{$college_code}";
		$folder_path=$this->aobj_context->main_src."/student_photos";
		$file_name=basename($_FILES['student_entry_upload']['name']);
		$path_arr=pathinfo($_FILES['student_entry_upload']['name']);
		$file_nameSign = basename($_FILES['student_signature_upload']['name']);
		$path_arrSign = pathinfo($_FILES['student_signature_upload']['name']);
		$file_extSign=$path_arrSign['extension'];
		$file_ext=$path_arr['extension'];
		$full_file_path= $folder_path.'/'.$this->app_no."_p_".$file_name;;
		$image_path="student_photos/".$this->app_no."_p_".$file_name;;
		$full_file_pathSign= $folder_path.'/'.$this->app_no."_s_".$file_nameSign;;
		$image_pathSign="student_photos/".$this->app_no."_s_".$file_nameSign;;
		
		if(isset($_FILES['student_entry_upload']['name']) && $_FILES['student_entry_upload']['name'] != '')         
			{ 
				if(move_uploaded_file($_FILES['student_entry_upload']['tmp_name'],$full_file_path))
				 {
				 
				if(isset($_FILES['student_signature_upload']['name']) && $_FILES['student_signature_upload']['name'] != '')         
				{ 
					if(move_uploaded_file($_FILES['student_signature_upload']['tmp_name'],$full_file_pathSign))
					{
					$update="update student set photo_path='{$image_path}' ,sign_path = '{$image_pathSign}'
							where internal_code=  {$this->last_inserted_id} ";
					$up_obj=$this->aobj_context->mobj_db->Execute($update); 
 		
					$data="{$this->app_no}";
					echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
					return;
				 }
				 else
				 {
				 $data="Error While Moving the Image";
					echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
					return;
				 }
				 
				}
				}
			}
		}

		function callMailApplicationStatus()
		{
			
			$this->app_no=trim($this->aobj_context->mobj_data["app_no"]);
			$get_data=" select femail, fcatcode, ffname, date_format(fdob,'%d/%m/%Y') as fdob, fmobile from student where app_no ='{$this->app_no}'";
			$lobj_get_data=$this->aobj_context->mobj_db->GetRow($get_data);
			$this->emailid = $lobj_get_data[femail];
			$this->catcode = $lobj_get_data[fcatcode];
			
			$sql_feestatus =  "select IF(fpgetfee = 0,'Exempted','Payment pending') as paystatus from mascategory where fcategory = '{$this->catcode}'";
			$sql_feestatus_obj=$this->aobj_context->mobj_db->getRow($sql_feestatus);	
			$this->pysataus = $sql_feestatus_obj[paystatus];
			
			
			require_once("cManualMailer.php");
			$message="<html>";
			$message.="<body>";
			$message.="<style>";		
			$message.=".mail_tbl td{text-align:left; padding:2px; font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif;}";	
			$message.="</style>";
			$message.="<p style='font-size:15px; font-family: Verdana, Arial, Helvetica, sans-serif'>Dear Candidate,</p><br>";
			$message.="<p style='font-size:22px; font-family: Verdana, Arial, Helvetica, sans-serif'>Welcome To Central University of Gujarat</p><br><br>";
			$message.="<p style='font-size:15px; font-family: Verdana, Arial, Helvetica, sans-serif'>You have successfully registered for the Entrance Test - 2015</p><br>";
			$message.="<p style='font-size:15px; font-family: Verdana, Arial, Helvetica, sans-serif'>Following are the Application Details</p>";
			$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'> Application No. :{$this->app_no}</p>";			
			$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Candidate Name :{$lobj_get_data[ffname]}</p>";			
			$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Date of Birth :{$lobj_get_data[fdob]}</p>";								
			$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Mobile No. :{$lobj_get_data[fmobile]}</p>";
			$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Payment Status :{$this->pysataus}</p><br>";
			$message.="</br>";		
			$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'><u>Regards </u></p>";
			$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Support Team</p>";
			$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>CUG</p>";
			$message.="</body>";
			$message.="</html>";
		
			$subject="CUG - Registered Successfully - Payment pending" ;	 
			$data='true';
			$data= send_manual_mail($this->emailid,$subject,$message,$replay_to=null,$cc=null,$bcc=null);
			
			return  $data;
		
		
		}
		
		function GetApplicationDetails()
		{
			$this->app_no=trim($this->aobj_context->mobj_data["app_no"]);
			$get_data=" select s.app_no, s.fcntrcode, s.fcntrcode2, s.fcntrcode3,
					s.fsubcode, s.fsubcode2, s.fsubcode3, 
					s.ffname, s.fmotname, s.ffatname, 
					date_format(s.fdob,'%d/%m/%Y') as fdob,  
					s.fpob, 	s.fgender, s.fdomicile, 
					s.fcatcode, cat.fdescpn, s.freligion, s.fminority,s.fminoritydesc,
					s.fnational, s.famount,
					s.fqualexam, s.fqualify, s.funivname, 
					s.fpassyear,s.fsubjects,ifnull(fmarks,'') as fmarks,
					ifnull(fcgpa,'') as fcgpa,ifnull(fgrade,'') as fgrade,
					s.fucnet, s.fucnetsubject, s.fucnetyear, s.fucjrf,
					s.fucjrfsubject, s.fucjrfyear,
					s.fadd1, s.fpincode,s.fperadd, s.fperpincode, 	 
					s.fphone, s.fmobile, s.femail, 
					date_format(s.fdos,'%d/%m/%Y')  as  fdos,
					date_format(s.fdop,'%d/%m/%Y')  as  fdop,   
					s.photo_path,s.sign_path, s.created_date, s.ip_address ,
					s.fpaymode , s.fpaystatus
					from student s
					left join subject sub on sub.fsubcode=s.fsubcode
					left join mascategory cat on cat.FCATEGORY=s.fcatcode
					left join mascntr mas on mas.fcntrcode=s.fcntrcode
					where app_no={$this->app_no}";
						  
		   $lobj_get_data=$this->aobj_context->mobj_db->GetRow($get_data); 
		   if(count($lobj_get_data)>0)
		   {
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,0,"Success"); 
		   }
		   else
		   {
		   echo $this->aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,-1,"failure"); 
		   }
			return;
		}
	/* function UpdateAuditTrial()
	{
		$audit_trial=" insert into  student_audit_trial  
					( app_no, pget_val, subject, 
					candidate_name, mother_name, father_name, 
					spouse_name, dob, sex, pob, pob_others, 
					nationality, college, college_others, 
					univ, univ_others, cncl_reg_no, cncl_reg_name, 
					rotary, marks, u_pg, phq,  
					category_others, caste, sub_caste, dd_amt, 
					dd_no, dd_date, dd_bank, address, pin, 
					debared, email, phone, mobile, in_service_status, 
					dept, dept_others, plc_of_working, date_of_entry, 
					prob_period, prob_date, doing_pg, pg_degree_course, 
					pg_degree_date, pg_diploma_course, pg_diploma_date, 
					speciality, enq_pending, suspension, absence, 
					remarks, photo_path, f_max_marksa, f_sec_marksa, 
					f_no_attaa, f_max_marksb, f_sec_marksb, 
					f_no_attbb, f_max_marksc, f_sec_marksc, 
					f_no_attcc, f_max_marksd, f_sec_marksd, 
					f_no_attdd, f_tot_max_marks, f_tot_sec_marks, 
					f_percentage, created_date, ip_address, 
					updated_date, updated_ip_addres)
					
					select  app_no, pget_val, subject, 
					candidate_name, mother_name, father_name, 
					spouse_name, dob, sex, pob, pob_others, 
					nationality, college, college_others, 
					univ, univ_others, cncl_reg_no, cncl_reg_name, 
					rotary, marks, u_pg, phq, 
					category_others, caste, sub_caste, dd_amt, 
					dd_no, dd_date, dd_bank, address, pin, 
					debared, email, phone, mobile, in_service_status, 
					dept, dept_others, plc_of_working, date_of_entry, 
					prob_period, prob_date, doing_pg, pg_degree_course, 
					pg_degree_date, pg_diploma_course, pg_diploma_date, 
					speciality, enq_pending, suspension, absence, 
					remarks, photo_path, f_max_marksa, f_sec_marksa, 
					f_no_attaa, f_max_marksb, f_sec_marksb, 
					f_no_attbb, f_max_marksc, f_sec_marksc, 
					f_no_attcc, f_max_marksd, f_sec_marksd, 
					f_no_attdd, f_tot_max_marks, f_tot_sec_marks, 
					f_percentage, created_date, ip_address, 
					 
					date_add(date_add(now(),INTERVAL 13 hour),interval 30 minute),'{$this->ip}'
					from student
					where app_no='{$this->edit_app_code}' ";
			 $up_obj=$this->aobj_context->mobj_db->Execute($audit_trial);  ;
			 
	} */	
function UpdateDetails()
	{
		$update="update student set 
						fcntrcode='{$this->fcntrcode}',
						fcntrcode2='{$this->fcntrcode2}', 
						fcntrcode3='{$this->fcntrcode3}', 
						fsubcode='{$this->fsubcode}', 
						fsubcode2='{$this->fsubcode2}',
						fsubcode3='{$this->fsubcode3}',
						ffname='{$this->ffname}', 
						fmotname='{$this->fmotname}', 
						ffatname='{$this->ffatname}', 
						fdob='{$this->fdob}', 
						fpob='{$this->fpob}', 
						fgender='{$this->fgender}', 
						fdomicile='{$this->fdomicile}', 
						fcatcode='{$this->fcatcode}', 
						freligion='{$this->freligion}', 
						fminority='{$this->fminority}', 
						fminoritydesc='{$this->fminoritydesc}', 
						fnational='{$this->fnational}', 
						fqualexam='{$this->fqualexam}', 
						fqualify='{$this->fqualify}', 
						funivname='{$this->funivname}', 
						fpassyear='{$this->fpassyear}',
						fsubjects='{$this->fsubjects}',
						fmarks='{$this->fmarks}',
						fcgpa='{$this->fcgpa}',
						fucnet='{$this->fucnet}',
						fucnetsubject='{$this->fucnetsubject}',
						fucnetyear='{$this->fucnetyear}',
						fucjrf='{$this->fucjrf}',
						fucjrfsubject='{$this->fucjrfsubject}',
						fucjrfyear='{$this->fucjrfyear}',
						fgrade='{$this->fgrade}',
						fadd1='{$this->fadd1}', 
						fpincode='{$this->fpincode}', 
						fperadd='{$this->fperadd}', 
						fperpincode='{$this->fperpincode}', 
						fphone='{$this->fphone}', 
						fmobile='{$this->fmobile}', 
						femail='{$this->femail}', 
						fdos='{$this->fdos}', 
						fdop='{$this->fdop}',
						famount='{$this->famount}',
						fpaystatus = '{$this->paySataus}'
						  where app_no='{$this->edit_app_code}' ";
			 $up_obj=$this->aobj_context->mobj_db->Execute($update); 
			  //echo "<pre>";
			  //print_r($update);die();
				if($up_obj)
				{
				
					 
					echo $this->aobj_context->mobj_output->ToJSONEnvelope($this->edit_app_code,9,"success"); 
					return;
				}
				else
				{
					$data=$update;
					echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
					return;
				}	
						
	
	}		
	function CheckPrintAppNo()
		 {
			$this->app_no=trim($this->aobj_context->mobj_data["app_no"]);
			$this->fdob=trim($this->aobj_context->mobj_data["fdob"]);
			$get_data="select count(app_no) as cnt   
							from student  	
							where app_no='{$this->app_no}'
							and fdob='{$this->fdob}'";
			$obj_get_data=$this->aobj_context->mobj_db->GetRow($get_data); 
		//	echo $get_data;
			$cnt=$obj_get_data['cnt'];
			if($cnt==0)
			{
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($obj_get_data,-1,"failure"); 
				return;
			}
			else
			{	
				$get_data="select count(app_no) as cnt   
								from student  	
								where app_no='{$this->app_no}'
								and fdob='{$this->fdob}'
								and fpaystatus='success'";
				$obj_get_data=$this->aobj_context->mobj_db->GetRow($get_data);
				$cnt=$obj_get_data['cnt'];
				if($cnt==0)
				{
					echo $this->aobj_context->mobj_output->ToJSONEnvelope($obj_get_data,-2,"failure"); 
					return;
				}
				else
				{
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($obj_get_data,0,"success"); 
				return;
				}
			} 
		}function CheckPrintChallan()
		 {
			$this->app_no=trim($this->aobj_context->mobj_data["app_no"]);
			$this->fdob=trim($this->aobj_context->mobj_data["fdob"]);
			$get_data="select count(app_no) as cnt   
							from student  	
							where app_no='{$this->app_no}'
							and fdob='{$this->fdob}'";
			$obj_get_data=$this->aobj_context->mobj_db->GetRow($get_data); 
		//	echo $get_data;
			$cnt=$obj_get_data['cnt'];
			if($cnt==0)
			{
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($obj_get_data,-1,"failure"); 
				return;
			}
			else
			{	
				/* $get_data="select count(app_no) as cnt   
								from student  	
								where app_no='{$this->app_no}'
								and fdob='{$this->fdob}'
								and fapproved='T'";
				$obj_get_data=$this->aobj_context->mobj_db->GetRow($get_data);
				$cnt=$obj_get_data['cnt'];
				if($cnt==0)
				{
					echo $this->aobj_context->mobj_output->ToJSONEnvelope($obj_get_data,-2,"failure"); 
					return;
				}
				else
				{ */
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($obj_get_data,0,"success"); 
				return;
				//}
			} 
		}	 
}
		
 
 
function saveStudentEntry($aobj_context)
{ 
	$obj=new applicationForm($aobj_context);
	$obj->assignParams();
	if($obj->edit_app_code==0)
	{
	$obj->SaveDetails();
	}
	else
	{
	//$obj->UpdateAuditTrial();
	$obj->UpdateDetails();
	}
}
function CheckPrintAppNo($aobj_context)
{ 
	$obj=new applicationForm($aobj_context);
	$obj->CheckPrintAppNo();
}function CheckPrintChallan($aobj_context)
{ 
	$obj=new applicationForm($aobj_context);
	$obj->CheckPrintChallan();
}
function GetApplicationDetails($aobj_context)
{ 
	$obj=new applicationForm($aobj_context);
	return $obj->GetApplicationDetails();
	 
}
function mailApplicationDetails($aobj_context)
{ 
	$obj=new applicationForm($aobj_context);
	return $obj->callMailApplicationStatus();
	 
}
function DiaplayUserSelectedPhoto($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	session_start();
	 
	 $get_login_cnt="select login_cnt from login_counter";
	 $lobj_get_get_login_cnt = $aobj_context->mobj_db->getRow($get_login_cnt);
	 $login_cnt=$lobj_get_get_login_cnt[login_cnt];
	 $file_name=replaceChars(basename($_FILES['student_entry_upload']['name']));
				$path_arr=pathinfo($_FILES['student_entry_upload']['name']);
				$file_ext=$path_arr['extension'];
	 
	$temp_path=$aobj_context->main_src."/student_photos/temp";
	if(!file_exists($temp_path))
	{
	 mkdir($temp_path);
	}
	$file_path="/{$login_cnt}_p_{$file_name}";
 	$temp_path.=$file_path;
  
		if(isset($_FILES['student_entry_upload']['name']) && $_FILES['student_entry_upload']['name'] != '')         
			{ 
			$size=($_FILES['student_entry_upload']['size']/1024);
			if($size>1024)
			{
			$data="Please Upload the Photo of size less than 1 MB";
				echo $aobj_context->mobj_output->ToJSONEnvelope($data,-2,"success"); 
				return;
			}
			if(move_uploaded_file($_FILES['student_entry_upload']['tmp_name'],$temp_path))
			 {
				$data="student_photos/temp/{$file_path}";
				echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
				return;
			 }
			}
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;	
	
	 
}

function DiaplayUserSelectedSignature($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	session_start();
	 
	 $get_login_cnt="select login_cnt from login_counter";
	 $lobj_get_get_login_cnt = $aobj_context->mobj_db->getRow($get_login_cnt);
	 $login_cnt=$lobj_get_get_login_cnt[login_cnt];
	 $file_name=replaceChars(basename($_FILES['student_signature_upload']['name']));
				$path_arr=pathinfo($_FILES['student_signature_upload']['name']);
				$file_ext=$path_arr['extension'];
	 
	$temp_path=$aobj_context->main_src."/student_photos/temp";
	if(!file_exists($temp_path))
	{
	 mkdir($temp_path);
	}
	$file_path="/{$login_cnt}_s_{$file_name}";
 	$temp_path.=$file_path;
  
		if(isset($_FILES['student_signature_upload']['name']) && $_FILES['student_signature_upload']['name'] != '')         
			{ 
			$size=($_FILES['student_signature_upload']['size']/1024);
			if($size>1024)
			{
			$data="Please Upload the Photo of size less than 1 MB";
				echo $aobj_context->mobj_output->ToJSONEnvelope($data,-2,"success"); 
				return;
			}
			if(move_uploaded_file($_FILES['student_signature_upload']['tmp_name'],$temp_path))
			 {
				$data="student_photos/temp/{$file_path}";
				echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
				return;
			 }
			}
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;	
	
	 
}

function GetSubjectListDetails($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	session_start();
		$getdentalcollData="select fsubcode as code,
						fsubname  as name , fsession from subject order by fsubcode";
		$obj_dental_data =  $aobj_context->mobj_db->GetAll($getdentalcollData); 
		
		if($obj_dental_data)
		{
			echo $aobj_context->mobj_output->ToJSONEnvelope($obj_dental_data,0,"success"); 
			
		}
		else
		{
			$data = 'Error in data retrieval';
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
			
		}
}

function replaceChars($name)
{
	$spl_char = array("*","/","~","!","@","#","$","%","^","&",":",";","?","/","\\","_","-","'"," ","");
	$link_name = strtolower(str_replace($spl_char,"_",$name));
	return str_ireplace("__","_",$link_name);
}

?>