Server IP : 103.53.40.154 / Your IP : 18.191.93.18 Web Server : Apache System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : ppcad7no ( 715) PHP Version : 8.2.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home2/ppcad7no/fastelevator.in/../digitala2z.com/down-hrms/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php ob_start(); require_once("includes/dbsmain.inc.php"); if($_SESSION['admin_user_id']==''){ header("location:login.php"); exit; } if(isset($_REQUEST['importSubmit'])){ //validate whether uploaded file is a csv file $csvMimes = array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'); if(!empty($_FILES['file']['name']) && in_array($_FILES['file']['type'],$csvMimes)){ if(is_uploaded_file($_FILES['file']['tmp_name'])){ //open uploaded csv file with read only mode $csvFile = fopen($_FILES['file']['tmp_name'], 'r'); //skip first line fgetcsv($csvFile); //parse data from csv file line by line while(($line = fgetcsv($csvFile)) !== FALSE){ $name = $line[0]; $mobile =$line[1]; $location =$line[2]; $remark =$line[3]; $user=$_SESSION['admin_user_id']; if($_SESSION['admin_user_id']=='h1admin'){ $candidates_alloted = 'No'; }else{ $candidates_alloted = 'Yes'; } //$value = $line[1]; // $db->query("INSERT INTO tbl_dc (dc_code,dc_detail) VALUES ('".$code."','".$detail."')"); db_query("INSERT INTO tbl_candidates (candidates_name, candidates_mobile, candidates_address, candidates_extra_remark, candidates_add_date, candidates_alloted, candidates_user) VALUES ('".$name."','".$mobile."','".$location."','".$remark."', now(),'$candidates_alloted','".$user."')"); $id=mysqli_insert_id(); $addPartySql = db_query("insert into party_statusdate set user_id='$_SESSION[admin_user_id]', party_id='$id', fresh_party_date=now(), status='1'"); } //close opened csv file fclose($csvFile); ?> <script> alert("File uploaded successfully!"); window.location.href="https://www.digitala2z.com/hrms/upload-excel.php"; </script> <? }else{ ?> <script> alert("File could not uploaded!"); window.location.href="https://www.digitala2z.com/hrms/upload-excel.php"; </script> <? } }else{ ?> <script> alert("Invalid File!"); window.location.href="https://www.digitala2z.com/hrms/upload-excel.php"; </script> <? } } ?> <!DOCTYPE html> <html lang="en"> <head> <title>HR Management System</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" > <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> </head> <body> <a style="text-align:right !important;" href="https://www.digitala2z.com/hrms/">Go Back</a> <div class="container" style="margin-top:30px;"> <h2 class="text-center">HR Management System</h2> <hr> <form action="" method="post" enctype="multipart/form-data" style="margin-top:50px;"> <div class="row"> <div class="col-md-4"></div> <div class="col-md-4 "> <div class="input-group mb-3"> <input type="file" class="form-control" aria-label="Enter DC Code" aria-describedby="basic-addon2" name="file" required> <div class="input-group-append"> <button class="btn btn-outline-secondary" type="submit" name="importSubmit">Upload</button> </div> </div> </div> </div> </form> </div> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" ></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" ></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" ></script> </body> </html>