织梦系统Dedecms上传图片弹出302错误,有什么办法解决?

织梦系统Dedecms上传图片弹出302错误,解决方案如下:

1、在include/userlogin.class.php文件中的第二行session_start();前加上如下代码:

 

if (isset($_POST[“PHPSESSID”])) {

session_id($_POST[“PHPSESSID”]);

} else if (isset($_GET[“PHPSESSID”])) {

session_id($_GET[“PHPSESSID”]);

}

 

修改之后为:

 

<?php if(!defined(‘DEDEINC’)) exit(‘Request Error!’);

/**

* 管理员登陆类

*

* @version $Id: userlogin.class.php 1 15:59 2010年7月5日Z tianya $

* @package DedeCMS.Libraries

* @copyright Copyright (c) 2007 – 2010, DesDev, Inc.

* @license http://help.dedecms.com/usersguide/license.html

* @link http://www.dedecms.com

*/

if (isset($_POST[“PHPSESSID”])) {

session_id($_POST[“PHPSESSID”]);

} else if (isset($_GET[“PHPSESSID”])) {

session_id($_GET[“PHPSESSID”]);

}

session_start();

 

2、include/uploadsafe.inc.php 里的第45行的 imtypes 改成imgtypes,并进行漏洞修复

 

/* 限制上传文件类型 */

$imgtypes = array

(

“image/pjpeg”, “image/jpeg”, “image/gif”, “image/png”,

“image/xpng”, “image/wbmp”, “image/bmp”

);

 

/* 漏洞修复20160810 by Sunco www.ithov.net */

if(in_array(strtolower(trim(${$_key.’_type’})), $imgtypes))

{

$image_dd = @getimagesize($$_key);

 

if($image_dd == false){

continue;

}

if (!is_array($image_dd)) {

exit(‘Upload filetype not allow !’);

}

}

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容