$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;
}
?>
Linux (KDE) 中使用Network Settings设置静态ip-阿南达文事网
Linux (KDE) 中使用Network Settings设置静态ip
编程日记10
更新时间:2025-05-10 18:59:56
Linux (KDE) 中使用Network Settings设置静态ip
在 Linux (KDE) 中使用 Network Settings 设置s5静态IP详细教程 。
首先,打开 KDE 的设置面板。可以通过点击桌面上的设置图标,或者在开始菜单中搜索 “Settings” 并打开。
在设置面板中,点击 “Network” 选项。
接下来,你会看到一个 “Network Connections” 的窗口。在这个窗口中,你需要点击 “Add” 按钮以添加一个新的网络连接。
在 “Create New Connection” 对话框中,选择 “Manual” 选项,并点击 “Next” 按钮。
在 “Connection Type” 页面上,选择 “Proxy”,然后点击 “Next” 按钮。
在 “Proxy Settings” 页面上,选择 “HTTP” 作为IP类型,并填入 “ip地址” 以及端口号 “20508”。确保 “Use proxy for all protocols” 选项已选中。
点击 “Apply” 按钮以应用ip设置。
最后,在 “Network Connections” 窗口中,找到新创建的HTTP爬虫ip连接,并将其激活(点亮)。这样,你的 Linux (KDE) 系统就已经成功设置了ip了。
贴心提示:如果你需要为某些应用程序设置HTTP爬虫ip,可以在应用程序的设置或首选项中找到 “Proxy” 或 “Network” 选项,并输入相同的ip地址和端口。
恭喜你,你已经成功地在 Linux (KDE) 中使用 Network Settings 设置了ip!现在你可以通过这个ip来访问 Internet,并且应用程序也会使用这个S5来连接网络。如果你有任何问题或需要帮助,请随时提问,我们会尽快为您解答。
本文发布于:2023-12-06,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Linux (KDE) 中使用Network Settings设置静态ip
发布评论