if
(
$_FILES
[
"loadfile"
][
"size"
] >
$max_file_size
*1024*1024)
{
$t_sz
->assign(
array
(
'FSIZE'
=>
$max_file_size
,
));
$plugin_body
.=
$t_sz
->parse(
'STEP_ERR_FSIZE'
)->text(
'STEP_ERR_FSIZE'
);
}
elseif
(move_uploaded_file(
$_FILES
[
"loadfile"
][
"tmp_name"
],
$uploaddir
.
basename
(
$_FILES
[
"loadfile"
][
"tmp_name"
])))
{
$t_sz
->assign(
array
(
'FNAME'
=>
$_FILES
[
"loadfile"
][
"name"
],
));
$plugin_body
.=
$t_sz
->parse(
'STEP_SUC_FILELOAD'
)->text(
'STEP_SUC_FILELOAD'
);
if
(!setlocale(LC_ALL,
'ru_RU.utf8'
)) setlocale(LC_ALL,
'en_US.utf8'
);
if
(setlocale(LC_ALL, 0) ==
'C'
)
die
(
'Your server does not suport LOCALS'
);
fwrite(
$file
, iconv(
'CP1251'
,
'UTF-8'
,
file_get_contents
(
$uploaddir
.
basename
(
$_FILES
[
"loadfile"
][
"tmp_name"
]))));
rewind
(
$file
);
$r
= 0;
while
((
$row
=
fgetcsv
(
$file
, 1500,
";"
)) != FALSE)
{
$r
++;
if
(
$r
== 1) {
continue
;}
$arr_client
=
array
(
'pol'
=>
$row
[0],
'name'
=>
$row
[1],
'fam'
=>
$row
[2],
'otch'
=>
$row
[3],
'email'
=>
$row
[4],
'tel'
=>
$row
[5],
'city'
=>
$row
[6],
'adress'
=>
$row
[7],
'comm'
=>
$row
[8]
);
$db
->insert(
$table_klient
,
$arr_client
);
}
fclose(
$file
);
}