Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

discuz X2.5 avatar.php文件bug

[复制链接]
iifeng2012 发表于 2012-8-30 13:14:47 | 显示全部楼层 |阅读模式
我之前把discuz X2版本升级到X2.5版本,昨天又重新安装了一次。

昨天网站老是出现cpu迅速上升又下降的情况,今天服务器相关人员帮我检查,他们说安装程序中的一个文件有问题,但我自己看不出来。我已经对照了官方的源文件,代码都是一样的,不知道怎么回事。麻烦各位帮我看看有没有问题?谢谢。

文件地址:uc_server/avatar.php
代码如下:

<?php

/*
[UCenter] (C)2001-2099 Comsenz Inc.
This is NOT a freeware, use is subject to license terms

$Id: avatar.php 1059 2011-03-01 07:25:09Z monkey $
*/


error_reporting(0);

define('UC_API', strtolower(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))));

$uid = isset($_GET['uid']) ? $_GET['uid'] : 0;
$size = isset($_GET['size']) ? $_GET['size'] : '';
$random = isset($_GET['random']) ? $_GET['random'] : '';
$type = isset($_GET['type']) ? $_GET['type'] : '';
$check = isset($_GET['check_file_exists']) ? $_GET['check_file_exists'] : '';

$avatar = './data/avatar/'.get_avatar($uid, $size, $type);
if(file_exists(dirname(__FILE__).'/'.$avatar)) {
if($check) {
  echo 1;
  exit;
}
$random = !empty($random) ? rand(1000, 9999) : '';
$avatar_url = empty($random) ? $avatar : $avatar.'?random='.$random;
} else {
if($check) {
  echo 0;
  exit;
}
$size = in_array($size, array('big', 'middle', 'small')) ? $size : 'middle';
$avatar_url = 'images/noavatar_'.$size.'.gif';
}

if(empty($random)) {
header("HTTP/1.1 301 Moved Permanently");
header("Last-Modified:".date('r'));
header("Expires: ".date('r', time() + 86400));
}

header('Location: '.UC_API.'/'.$avatar_url);
exit;

function get_avatar($uid, $size = 'middle', $type = '') {
$size = in_array($size, array('big', 'middle', 'small')) ? $size : 'middle';
$uid = abs(intval($uid));
$uid = sprintf("%09d", $uid);
$dir1 = substr($uid, 0, 3);
$dir2 = substr($uid, 3, 2);
$dir3 = substr($uid, 5, 2);
$typeadd = $type == 'real' ? '_real' : '';
return $dir1.'/'.$dir2.'/'.$dir3.'/'.substr($uid, -2).$typeadd."_avatar_$size.jpg";
}

?>
mark35 发表于 2012-8-30 15:10:12 | 显示全部楼层
他要说明是啥问题,超时还是抛出错误
回复

使用道具 举报

m.king 发表于 2012-8-30 17:04:29 | 显示全部楼层
请详细告知该问题什么问题?
是否方便提供相关权限我们看看。
回复

使用道具 举报

 楼主| iifeng2012 发表于 2012-8-30 18:20:08 | 显示全部楼层
m.king 发表于 2012-8-30 17:04
请详细告知该问题什么问题?
是否方便提供相关权限我们看看。

具体的问题和原因,我也不懂。我能提供什么权限?
回复

使用道具 举报

IDC866.com 发表于 2012-8-30 18:50:09 | 显示全部楼层
用 X25  负载高很常见了。。。  
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-2-27 20:45 , Processed in 0.018577 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表