01.
<?
02.
$password
=
$_POST
[
'password'
];
03.
04.
function
randomname()
05.
{
06.
$re
=
""
;
07.
$strl
=
"abcdefghijklmnopqrstuvwxyz0123456789"
;
08.
09.
for
(
$i
=0;
$i
<15;
$i
++)
10.
$re
.=
$strl
[rand(0,36)];
11.
12.
return
$re
;
13.
}
14.
require
(
"config.inc.php"
);
15.
16.
if
(
$pic
!=none)
17.
{
18.
19.
20.
21.
if
(
$pic_type
==
"image/png"
){
$dot
=
".png"
;}
elseif
(
$pic_type
==
"image/gif"
){
$dot
=
".gif"
;}
22.
elseif
(
$pic_type
==
"image/jpeg"
){
$dot
=
".jpeg"
;}
elseif
(
$pic_type
==
"image/jpg"
){
$dot
=
".jpg"
;}
23.
24.
25.
if
((
$pic_type
==
"image/png"
)
or
(
$pic_type
==
"image/gif"
)
26.
or
(
$pic_type
==
"image/jpeg"
)
or
(
$pic_type
==
"image/jpg"
)) {
27.
28.
29.
$path
=
"myfile"
;
30.
31.
$temp
=randomname();
32.
$newname
=
$temp
.
$dot
;
33.
34.
if
(!
copy
(
$pic
,
"$path/$newname"
))
35.
{
36.
echo
"error copy."
;
exit
();
37.
}
38.
else
39.
{
40.
41.
$link
= mysql_connect(
$dbserver
,
$dbuser
,
$dbpass
)
or
42.
die
(
'can not connect mysql '
.mysql_error() );
43.
mysql_select_db(
$dbname
)
or
die
(
'error'
.mysql_error());
44.
$sql
=
"insert into imbloo (im,logo,password) values ('','logo/myfile/$newname','$password')"
;
45.
mysql_query(
$sql
,
$link
);
46.
$im
= mysql_insert_id();
47.
48.
}
49.
}
else
{
50.
echo
"<br><center><span class='ms_14_red_bold'>File Fail !!??</span></center>"
;
51.
echo
"<center><span class='ms_14_nor'><a href='javascript:history.back(1)' class='ms_14_blue2_nor'>back</a></span></center>"
;
52.
exit
();
53.
}
54.
55.
}
56.
57.
?>