Şuanki Dizin: /home/wwwdreamtechnolo/www/spmsolapur.org/mis_software/bkp/ |
Şuanki Dosya : /home/wwwdreamtechnolo/www/spmsolapur.org/mis_software/bkp/upload-student-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 Excel-Update 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="col-lg-6"> <label>Select Column For Update:</label> <select name="column" class="form-control"> <option value="Select Category"> Select Category </option> <option value="class">Department </option> <option value="medium"> Year</option> <option value="division"> Division </option> <option value="roll_no"> Roll No</option> <option value="surname"> Surname</option> <option value="student_name">Student Name</option> <option value="father_name">Father Name</option> <option value="mother_name">Mother Name</option> <option value="stud_cont_no">Student Contact No</option> <option value="father_cont_no">Father Contact No</option> <option value="mother_cont_no">Mother Cont No</option> <option value="residential_no"> Residential No</option> <option value="address">Address</option> <option value="corres_address">Corresponding Address</option> <option value="child_desc">Student Descrption</option> <option value="email">Email</option> <option value="aadhar_number">Aadhar Number</option> <option value="religion">Religion</option> <option value="caste">Caste</option> <option value="category">Category</option> <option value="mother_tongue">Mother Tongue</option> <option value="nationality">Nationality</option> <option value="place_of_birth">Place Of Birth</option> <option value="birth_date"> Birth Date</option> <option value="birth_district">Birth District</option> <option value="birth_state">Birth State</option> <option value="birth_country">Birth Country</option> <option value="gender">Gender</option> <option value="last_school">Last School</option> <option value="admission_date">Admission Date</option> <option value="blood_group"> Blood Group</option> <option value="other"> Other</option> <option value="stud_id_for_lc">Student Id For Lc</option> <option value="certificate_no">Certificate No</option> <option value="progress">Progress</option> <option value="conduct">Conduct</option> <option value="leaving_school_date">Leaving School Date</option> <option value="standard_sinse_when">Standard Sinse When</option> <option value="leaving_school_reason">Leaving School Reason</option> <option value="academic_year">Academic Year</option> </select> </div> <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-12" 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'])) { $column = $_POST['column']; ?> <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); $gr_no = $arrVals[0]; $class = $arrVals[1]; if($db->update_student_data_with_gr_no($gr_no,$column,$class,$acd_year)) { echo "<td>".$i."</td><td>".$gr_no."</td><td><span style='color:Green;'>Record Updated successfully</span></td>"; } else { echo "<td>".$i."</td><td>".$gr_no."</td><td><span style='color:red;'>Failed To Update Record.</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="update-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'); ?>
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