这是php内容[我加上注释了]
/*
PHP 源程序。
自定函数:
get_param(); 获得HTTP_POST_VARS 和 HTTP_GET_VARS & REQUEST_STR..
format_tags();==htmlspecialchar()
error();
*/
<?
if(get_param('action')=="add_products"){ $s_item=format_tags(get_param("item"));
$s_pnum=format_tags(get_param("p_num"));
$s_pdes=format_tags(get_param("p_des"));
$s_pfun=format_tags(get_param("p_fun")); if($s_pnum=="") error("ERROR:\\nProduct Number NULL!");
if($s_pdes=="") error("ERROR:\\nProduct Description NULL!"); if(!is_uploaded_file($_FILES['img']['tmp_name'][0])) error("ERROR:\\nUpload Product Small Photo Failed!"); if(!is_uploaded_file($_FILES['img']['tmp_name'][1])) error("ERROR:\\nUpload Product Large Photo Failed!"); $ext_name=substr($_FILES['img']['tmp_name'][0],-4,4);
$save_imgs=time().random('6','1').strtolower($ext_name);
if($ext_name!=".jpg" || $ext_name!=".gif" || $ext_name!=".JPG" || $ext_name!=".GIF" ) error("ERROR:\\nUpload File Type UNLL!\\nOnly support JPG/GIF");
Move_uploaded_file($_FILES['img']['tmp_name'][0], $pdt_dir.$save_imgs); $ext_name=substr($_FILES[img][tmp_name][1],-4,4);
$save_imgb=time().random('6','1').strtolower($ext_name);
if($ext_name!=".jpg" || $ext_name!=".gif" || $ext_name!=".JPG" || $ext_name!=".GIF" ) error("ERROR:\\nUpload File Type UNLL! Only support JPG/GIF");
Move_uploaded_file($_FILES[img][tmp_name][1], $pdt_dir.$save_imgb); $date="20".date('y-m-d h:i:s');
$db->query("Insert into products values ('','".get_session('s_user')."','$s_item','$s_pnum','$save_imgs','$save_imgb','$s_pdes','$s_pfun','$date')");
error("Add Product Successful,Please Continue...");
}
?>
/*
PHP 源程序。
自定函数:
get_param(); 获得HTTP_POST_VARS 和 HTTP_GET_VARS & REQUEST_STR..
format_tags();==htmlspecialchar()
error();
*/
<?
if(get_param('action')=="add_products"){ $s_item=format_tags(get_param("item"));
$s_pnum=format_tags(get_param("p_num"));
$s_pdes=format_tags(get_param("p_des"));
$s_pfun=format_tags(get_param("p_fun")); if($s_pnum=="") error("ERROR:\\nProduct Number NULL!");
if($s_pdes=="") error("ERROR:\\nProduct Description NULL!"); if(!is_uploaded_file($_FILES['img']['tmp_name'][0])) error("ERROR:\\nUpload Product Small Photo Failed!"); if(!is_uploaded_file($_FILES['img']['tmp_name'][1])) error("ERROR:\\nUpload Product Large Photo Failed!"); $ext_name=substr($_FILES['img']['tmp_name'][0],-4,4);
$save_imgs=time().random('6','1').strtolower($ext_name);
if($ext_name!=".jpg" || $ext_name!=".gif" || $ext_name!=".JPG" || $ext_name!=".GIF" ) error("ERROR:\\nUpload File Type UNLL!\\nOnly support JPG/GIF");
Move_uploaded_file($_FILES['img']['tmp_name'][0], $pdt_dir.$save_imgs); $ext_name=substr($_FILES[img][tmp_name][1],-4,4);
$save_imgb=time().random('6','1').strtolower($ext_name);
if($ext_name!=".jpg" || $ext_name!=".gif" || $ext_name!=".JPG" || $ext_name!=".GIF" ) error("ERROR:\\nUpload File Type UNLL! Only support JPG/GIF");
Move_uploaded_file($_FILES[img][tmp_name][1], $pdt_dir.$save_imgb); $date="20".date('y-m-d h:i:s');
$db->query("Insert into products values ('','".get_session('s_user')."','$s_item','$s_pnum','$save_imgs','$save_imgb','$s_pdes','$s_pfun','$date')");
error("Add Product Successful,Please Continue...");
}
?>
......上传文件不成功,这是最大的错误