Server IP : 108.163.255.210 / Your IP : 3.145.108.87 Web Server : Apache System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64 User : ( 1172) PHP Version : 7.2.34 Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/unilinki/www/Intellilead/leads/ |
Upload File : |
<?php $conn=mysql_connect("localhost","aetholq5_intelli","intel@2017$#") or die("Could not connect"); mysql_select_db("aetholq5_intellilead",$conn) or die("could not connect database"); include('../template/header.php'); if(isset($_POST["Import"])){ //print_r($_POST); die; $filename=$_FILES["file"]["tmp_name"]; $mimes = array('application/vnd.ms-excel','text/csv'); if(in_array($_FILES['file']['type'],$mimes)){ if($_FILES["file"]["size"] > 0) { $file = fopen($filename, "r"); while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE) { //It wiil insert a row to our leads table from our csv file` $sql = "INSERT into tmp_leads (lead_code,project_name,source,name,email,mobile,phone,city,country,status,tol,tsr,msg,plan_to_buy,contacted_by,msg_date,interested,budget,high_lead,pref_loc,look_for,subject,other_detail,company_id,user_id) values('AA','$emapData[0]','$emapData[1]','$emapData[2]','$emapData[3]','$emapData[4]','$emapData[5]','$emapData[6]','$emapData[7]','$emapData[8]','$emapData[9]','$emapData[10]','$emapData[11]','$emapData[12]','$emapData[13]','$emapData[14]','$emapData[15]','$emapData[16]','$emapData[17]','$emapData[18]','$emapData[19]','$emapData[20]','$emapData[21]','".$_SESSION['company_id']."','".$_SESSION['user_id']."')"; //we are using mysql_query function. it returns a resource on true else False on error $result = mysql_query( $sql, $conn ); if(!$result) { echo "<script type=\"text/javascript\"> alert(\"Invalid File : Please Upload CSV File.\"); window.location = \"upload.php\" </script>"; } } fclose($file); //throws a message if data successfully imported to mysql database from excel file echo "<script type=\"text/javascript\"> alert(\"CSV File has been successfully Imported.\"); window.location = \"upload_lead.php\" </script>"; //close of connection mysql_close($conn); } } else { echo "<script type=\"text/javascript\"> alert(\"Invalid File : Please Upload CSV File.\"); window.location = \"upload.php\" </script>"; } } ?> <!-- page heading start--> <div class="panel box-shadow-none content-header"> <div class="panel-body"> <div class="col-md-12"> <h3 class="animated fadeInLeft">Upload Leads</h3> <p class="animated fadeInDown"> Leads <span class="fa-angle-right fa"></span>Upload Leads </p> </div> </div> </div> <!-- page heading end--> <div class="col-md-12"> <div class="panel"> <div class="panel-heading"></div> <div class="panel-body"> <div class="row"> <form method="post" action="upload.php" enctype="multipart/form-data"> <div class="col-lg-6"> <div class="input-group fileupload-v1"> <input type="file" name="file" class="fileupload-v1-file hidden"/> <input type="text" class="form-control fileupload-v1-path" placeholder="File Path..." disabled> <span class="input-group-btn"> <button class="btn fileupload-v1-btn" type="button"><i class="fa fa-folder"></i> Choose File</button> </span> </div><!-- /input-group --> </div><!-- /.col-lg-6 --> <div class="col-md-3"> <button class="btn ripple btn-raised btn-success" type="submit" name="Import" > <div> <span>Upload Data</span> </div> </button> </div> </form> </div><!-- /.row --> </div> </div> </div> <div class="col-md-12"> <a class="btn ripple-infinite btn-gradient btn-info" href="SampleLeadFile.csv"> <div> <span>Click Here to download Sample data file.</span> </div> </a> </div> <!--body wrapper end--> <?php include('../template/footer.php');?>