You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
143 lines
6.1 KiB
143 lines
6.1 KiB
<div class="row">
|
|
<div class="col-12">
|
|
<div class="section-title">Importa utenti</div>
|
|
</div>
|
|
<div class="col-12">
|
|
|
|
<div class="sheet-box p-4">
|
|
|
|
<?php
|
|
|
|
if($_POST['go']){
|
|
|
|
/*
|
|
[0] => N_Albo
|
|
[1] => Data_Iscrizione
|
|
[2] => COGNOME
|
|
[3] => NOME
|
|
[4] => INDIRIZZO
|
|
[5] => CAP
|
|
[6] => LOCALITA
|
|
[7] => PROVINCIA
|
|
[8] => DATA DI NASCITA
|
|
[9] => LOCALITÀ DI NASCITA
|
|
[10] => DATA DI LAUREA
|
|
[11] => UNIVERSITÀ DI LAUREA
|
|
[12] => LAUREA
|
|
[13] => ANNO
|
|
[14] => UNIVERSITÀ ABILITAZIONE
|
|
[15] => E-MAIL
|
|
|
|
0 iscrizione
|
|
- usr
|
|
- pwd
|
|
15 email
|
|
2 cognome
|
|
3 nome
|
|
8 data_nascita
|
|
9 luogo_nascita
|
|
1 data_iscr
|
|
4 indirizzo
|
|
5 cap
|
|
6 citta
|
|
7 provincia
|
|
11 laurea_a
|
|
10 laurea_il
|
|
12 laurea_in
|
|
13 abilitazione_nel
|
|
14 abilitazione_a
|
|
- abilitato
|
|
- specializzazioni
|
|
*/
|
|
|
|
if(is_uploaded_file($_FILES['file']['tmp_name'])){
|
|
|
|
$dest="tmpfiles/tmpusers";
|
|
|
|
if(move_uploaded_file($_FILES['file']['tmp_name'],$dest)){
|
|
|
|
$myfile = fopen($dest, "r") or die("Unable to open file!");
|
|
|
|
while(!feof($myfile)) {
|
|
$r = explode("|",fgets($myfile));
|
|
|
|
if($r[0]!='N_Albo' && $r[0]!=''){
|
|
$q="INSERT INTO board VALUES(
|
|
'".addslashes(trim(anyToUTF8($r[0])))."','','','".addslashes(trim(anyToUTF8($r[15])))."','".addslashes(trim(anyToUTF8($r[2])))."',
|
|
'".addslashes(trim(anyToUTF8($r[3])))."','".addslashes(trim(anyToUTF8($r[8])))."','".addslashes(trim(anyToUTF8($r[9])))."',
|
|
'".addslashes(trim(anyToUTF8($r[1])))."','".addslashes(trim(anyToUTF8($r[4])))."','".addslashes(trim(anyToUTF8($r[5])))."',
|
|
'".addslashes(trim(anyToUTF8($r[6])))."','".addslashes(trim(anyToUTF8($r[7])))."','".addslashes(trim(anyToUTF8($r[11])))."',
|
|
'".addslashes(trim(anyToUTF8($r[10])))."','".addslashes(trim(anyToUTF8($r[12])))."','".addslashes(trim(anyToUTF8($r[13])))."',
|
|
'".addslashes(trim(anyToUTF8($r[14])))."',0,'',0,0)
|
|
ON DUPLICATE KEY UPDATE
|
|
email='".addslashes(trim(anyToUTF8($r[15])))."',
|
|
last_name='".addslashes(trim(anyToUTF8($r[2])))."',
|
|
first_name='".addslashes(trim(anyToUTF8($r[3])))."',
|
|
birth_date='".addslashes(trim(anyToUTF8($r[8])))."',
|
|
birth_place='".addslashes(trim(anyToUTF8($r[9])))."',
|
|
register_date='".addslashes(trim(anyToUTF8($r[1])))."',
|
|
address='".addslashes(trim(anyToUTF8($r[4])))."',
|
|
zip_code='".addslashes(trim(anyToUTF8($r[5])))."',
|
|
city='".addslashes(trim(anyToUTF8($r[6])))."',
|
|
province='".addslashes(trim(anyToUTF8($r[7])))."',
|
|
degree_place='".addslashes(trim(anyToUTF8($r[11])))."',
|
|
degree_date='".addslashes(trim(anyToUTF8($r[10])))."',
|
|
degree='".addslashes(trim(anyToUTF8($r[12])))."',
|
|
qualification_date='".addslashes(trim(anyToUTF8($r[13])))."',
|
|
qualification_place='".addslashes(trim(anyToUTF8($r[14])))."'";
|
|
}
|
|
|
|
mysqli_query($conn, $q);
|
|
}
|
|
|
|
fclose($myfile);
|
|
|
|
echo '<div class="col-10 text-center mx-auto my-5">
|
|
<p><i class="fa fa-exclamation-triangle font-alert p-4"></i></p>
|
|
<p>File importato correttamente!</p>
|
|
</div>';
|
|
}else{
|
|
echo '<div class="col-10 text-center mx-auto my-5">
|
|
<p><i class="fa fa-exclamation-triangle font-alert p-4"></i></p>
|
|
<p>ATENZIONE: Errore nell\'importazione del file!</p>
|
|
</div>';
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
?>
|
|
<form method="post" enctype="multipart/form-data">
|
|
<div class="row">
|
|
|
|
<div class="col-12">
|
|
<span class="font-12">File *.CSV</span>
|
|
<div class="files-list">
|
|
<div class="list">
|
|
<div class="row master">
|
|
<div class="col">
|
|
<input type="file" name="file">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<p>ATTENZIONE: assicurarsi che il file sia del formato corretto.</p>
|
|
</div>
|
|
<div class="col-12 text-right">
|
|
<button type="submit" name="go" value="1">Importa da file</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|