Şuanki Dizin: /home/wwwdreamtechnolo/www/panel.atsevairag.com/old2/atse_admin_panel007/ |
Şuanki Dosya : /home/wwwdreamtechnolo/www/panel.atsevairag.com/old2/atse_admin_panel007/upload-marks-data.php |
<?php //ob_start(); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); //import the functions file require_once("../lib/class/functions.php"); //create object of class file $db = new functions(); $success_flag =""; $current_page = ""; ?> <DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>ए. टी. एस. ई. वैराग</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <meta name="description" content=""> <meta name="keywords" content=""> <link rel="stylesheet" type="text/css" href="/css/stylesheet.css"/> <script type="text/javascript" src="/js/jquery-1.9.1.min.js"></script> <script type="text/javascript" src="/js/jssor.slider.mini.js"></script> <script type="text/javascript" src="/js/site.js"></script> </head> <body> <?php require_once("header.php"); $message_1 = ""; $attachement_error = ""; ?> <div name="tab_container" > <div class="main_container" style="min-height:610px;"> <div class="data_container" style="margin-top:0px; padding-top:0px;"> <div class="info-section"> <br /> <center><strong>रिजल्ट अपलोड करा</strong></center> <hr /> <br /> <a href="/atse_admin_panel007/import-sample-files/sample.xls" style="color:Orangered;">Download Upload Format</a><br /><br /> Note : If any value is not avaialable in cell, kindly fill it with "-" symbol<br /><br /> <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="login_btn" name="save_btn" style="width:30%;">Upload Excel</button> </div> </div> <?php if(isset($_POST['save_btn'])) { ?> <div style="width:700px; background-color:white; margin:auto;"> <table class="table table-bordered" border="1" style="border:1px solid black;" cellspacing="0"> <thead class="col_head" style="border:1px solid black;"> <th class="col_head"width="50" style="border:1px solid black;" >Sr. No</th> <th class="col_head"width="300" style="border:1px solid black;" >Student Reg No</th> <th class="col_head" width="200" style="border:1px solid black;" >Status</th> </thead> <tbody style="border:1px solid black;"> <?php $x = 1; $row_line = 1; $flag = 0; $selected_date = ""; ini_set('allow_url_fopen', 'On'); $fileName = $_FILES["file"]["tmp_name"]; if ($_FILES["file"]["size"] > 0) { $file = fopen($fileName, "r"); $new_cntr = 0; while (($column = fgetcsv($file, 10000, ",")) !== FALSE) { //echo $row_line; $reg_no = ""; $seat_no = ""; $bhasha_ganit = ""; $eng_buddhimatta= ""; $total = ""; if (isset($column[0])) { $reg_no = $column[0]; } if (isset($column[1])) { $seat_no = $column[1]; } if (isset($column[2])) { $bhasha_ganit = $column[2]; } if (isset($column[3])) { $eng_buddhimatta = $column[3]; } if (isset($column[4])) { $total = $column[4]; } echo "\t <tr> \n"; if($db->update_student_marks($reg_no,$seat_no,$bhasha_ganit,$eng_buddhimatta,$total)) { echo "<td>".$new_cntr."</td><td>".$reg_no."</td><td><span style='color:Green;'>Result added successfully</span></td>"; } else { echo "<td>".$new_cntr."</td> <td>".$reg_no."</td> <td style='color:red'> Failed to Add Result</td>"; } echo "\t</tr>\n"; $new_cntr++; } } //include 'Classes/PHPExcel/IOFactory.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; $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); $reg_no = $arrVals[0]; $seat_no = $arrVals[1]; $bhasha_ganit = $arrVals[2]; $eng_buddhimatta= $arrVals[3]; $total = $arrVals[4]; if($db->update_student_marks($reg_no,$seat_no,$bhasha_ganit,$eng_buddhimatta,$total)) { echo "<td>".$i."</td><td>".$reg_no."</td><td><span style='color:Green;'>Result added successfully</span></td>"; } else { echo "<td>".$i."</td> <td>".$reg_no."</td> <td style='color:red'> Failed to Add Result</td>"; } echo "\t</tr>\n"; } echo "<script> alert('Uploaded Successfully'); </script>"; } } } */ ?> </tbody> </table> </div> <?php } ?> </div> </div> </div> </div> </section> </div> </form> </div> </div> </div> </div> <?php require_once("footer.php"); ?> </body> </html>
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