$conf, $time;
$_uid = user_token_get_do();
empty($_uid) and user_token_clear(); // 退出登录
return $_uid;
}
// 用户
function user_token_get_do()
{
global $conf, $time, $ip, $useragent;
$token = param($conf['cookie_pre'] . 'token');
if (empty($token)) return FALSE;
$tokenkey = md5(xn_key());
$s = xn_decrypt($token, $tokenkey);
if (empty($s)) return FALSE;
$arr = explode("\t", $s);
if (count($arr) != 5) return FALSE;
list($_ip, $_time, $_uid, $_pwd, $ua_md5) = $arr;
if (array_value($conf, 'login_ip') && $ip != $_ip) return FALSE;
if (array_value($conf, 'login_ua') && md5($useragent) != $ua_md5) return FALSE;
$_user = user_read($_uid);
if (empty($_user)) return FALSE;
if (array_value($conf, 'login_only') && $_user['login_date'] != $_time) return FALSE;
// 密码是否被修改
if (md5($_user['password']) != $_pwd) return FALSE;
return $_uid;
}
// 设置 token,防止 sid 过期后被删除
function user_token_set($uid)
{
global $conf, $time;
if (empty($uid)) return '';
$token = user_token_gen($uid);
setcookie($conf['cookie_pre'] . 'token', $token, $time + 86400000, $conf['cookie_path'], $conf['cookie_domain'], '', TRUE);
return $token;
}
function user_token_clear()
{
global $conf, $time;
setcookie($conf['cookie_pre'] . 'token', '', $time - 8640000, $conf['cookie_path'], $conf['cookie_domain'], '', TRUE);
}
function user_token_gen($uid)
{
global $conf, $time, $ip, $useragent;
$key = 'user_token' . $uid;
static $cache = array();
if (isset($cache[$key])) return $cache[$key];
$user = user_read($uid);
$pwd = md5($user['password']);
$ua_md5 = md5($useragent);
$tokenkey = md5(xn_key());
$cache[$key] = xn_encrypt("$ip $time $uid $pwd $ua_md5", $tokenkey);
return $cache[$key];
}
// 前台登录验证
function user_login_check()
{
global $user;
empty($user) and http_location(url('user-login'));
}
// 获取用户来路
function user_http_referer()
{
global $conf;
$referer = param('referer'); // 优先从参数获取 | GET is priority
empty($referer) and $referer = array_value($_SERVER, 'HTTP_REFERER', '');
$referer = str_replace(array('\"', '"', '<', '>', ' ', '*', "\t", "\r", "\n"), '', $referer); // 干掉特殊字符 strip special chars
if (
!preg_match('#^(http|https)://[\w\-=/\.]+/[\w\-=.%\#?]*$#is', $referer)
|| FALSE !== strpos($referer, url('user-login'))
|| FALSE !== strpos($referer, url('user-logout'))
|| FALSE !== strpos($referer, url('user-create'))
|| FALSE !== strpos($referer, url('user-setpw'))
|| FALSE !== strpos($referer, url('user-resetpw_complete'))
) {
$referer = $conf['path'];
}
return $referer;
}
function user_auth_check($token)
{
global $time, $ip;
$auth = param(2);
$s = xn_decrypt($auth);
empty($s) and message(-1, lang('decrypt_failed'));
$arr = explode('-', $s);
count($arr) != 4 and message(-1, lang('encrypt_failed'));
list($_ip, $_time, $_uid, $_pwd) = $arr;
$_user = user_read($_uid);
empty($_user) and message(-1, lang('user_not_exists'));
$time - $_time > 3600 and message(-1, lang('link_has_expired'));
return $_user;
}
?>权限没有,则隐藏
function forum_list_access_filter($forumlist, $gid, $allow = 'allowread')
{
global $grouplist;
if (empty($forumlist)) return array();
if (1 == $gid) return $forumlist;
$forumlist_filter = $forumlist;
$group = $grouplist[$gid];
foreach ($forumlist_filter as $fid => $forum) {
if (empty($forum['accesson']) && empty($group[$allow]) || !empty($forum['accesson']) && empty($forum['accesslist'][$gid][$allow])) {
unset($forumlist_filter[$fid]);
}
unset($forumlist_filter[$fid]['accesslist']);
}
return $forumlist_filter;
}
function forum_filter_moduid($moduids)
{
$moduids = trim($moduids);
if (empty($moduids)) return '';
$arr = explode(',', $moduids);
$r = array();
foreach ($arr as $_uid) {
$_uid = intval($_uid);
$_user = user_read($_uid);
if (empty($_user)) continue;
if ($_user['gid'] > 4) continue;
$r[] = $_uid;
}
return implode(',', $r);
}
function forum_safe_info($forum)
{
//unset($forum['moduids']);
return $forum;
}
function forum_filter($forumlist)
{
foreach ($forumlist as &$val) {
unset($val['brief'], $val['announcement'], $val['seo_title'], $val['seo_keywords'], $val['create_date_fmt'], $val['icon_url'], $val['modlist']);
}
return $forumlist;
}
function forum_format_url($forum)
{
global $conf;
if (0 == $forum['category']) {
// 列表URL
$url = url('list-' . $forum['fid'], '', FALSE);
} elseif (1 == $forum['category']) {
// 频道
$url = url('category-' . $forum['fid'], '', FALSE);
} elseif (2 == $forum['category']) {
// 单页
$url = url('read-' . trim($forum['brief']), '', FALSE);
}
if ($conf['url_rewrite_on'] > 1 && $forum['well_alias']) {
if (0 == $forum['category'] || 1 == $forum['category']) {
$url = url($forum['well_alias'], '', FALSE);
} elseif (2 == $forum['category']) {
// 单页
$url = ($forum['threads'] && $forum['brief']) ? url($forum['well_alias'] . '-' . trim($forum['brief']), '', FALSE) : url($forum['well_alias'], '', FALSE);
}
}
return $url;
}
function well_forum_alias()
{
$forumlist = forum_list_cache();
if (empty($forumlist)) return '';
$key = 'forum-alias';
static $cache = array();
if (isset($cache[$key])) return $cache[$key];
$cache[$key] = array();
foreach ($forumlist as $val) {
if ($val['well_alias']) $cache[$key][$val['fid']] = $val['well_alias'];
}
return array_flip($cache[$key]);
}
function well_forum_alias_cache()
{
global $conf;
$key = 'forum-alias-cache';
static $cache = array(); // 用静态变量只能在当前 request 生命周期缓存,跨进程需要再加一层缓存:redis/memcached/xcache/apc
if (isset($cache[$key])) return $cache[$key];
if ('mysql' == $conf['cache']['type']) {
$arr = well_forum_alias();
} else {
$arr = cache_get($key);
if (NULL === $arr) {
$arr = well_forum_alias();
!empty($arr) AND cache_set($key, $arr);
}
}
$cache[$key] = empty($arr) ? '' : $arr;
return $cache[$key];
}
?>return FALSE;
$r = well_tag_thread__update(array('id' => $id), $update);
return $r;
}
function well_tag_thread_find($tagid, $page, $pagesize)
{
$arr = well_tag_thread__find(array('tagid' => $tagid), array('id' => -1), $page, $pagesize);
return $arr;
}
function well_tag_thread_find_by_tid($tid, $page, $pagesize)
{
$arr = well_tag_thread__find(array('tid' => $tid), array(), $page, $pagesize);
return $arr;
}
?>
上传速度影响的因素编程频道|福州电脑网
上传速度影响的因素
系统教程1320
更新时间:2026-04-09 22:39:40 2023年12月11日发(作者:)
上传速度影响的因素
上传速度受以下几个因素影响:
1. 网络带宽:网络带宽是指网络连接中传输数据的容量,上传速度受到网络带宽的限制。如果网络带宽较小,上传速度会相应较慢。
2. 网络拥塞:如果网络中有大量用户同时上传数据,网络可能会拥塞,导致上传速度变慢。
3. 服务器性能:如果上传的数据需要存储到服务器上,服务器的性能也会影响上传速度。如果服务器性能较差,上传速度可能会受到限制。
4. 上传文件的大小:较大的文件需要更多的时间来上传。文件大小越大,上传所需时间越长。
5. 上传方式:不同的上传方式有不同的上传速度。例如,使用有线连接的上传速度可能比无线连接更快。
6. 网络质量:网络质量差、延迟高的情况下,上传速度也会受到影响。
7. 客户端设备性能:如果上传文件的设备性能较低,如 CPU、内存等,可能会限制上传速度。 8. 使用的上传工具或应用程序:不同的上传工具或应用程序可能对上传速度有所限制。一些上传工具或应用程序可能会进行数据压缩、数据加密等操作,这可能会影响上传速度。
以上是影响上传速度的一些因素,需要综合考虑。
本文发布于:2023-12-11,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:上传速度可能网络影响
发布评论