$_SESSION[SpAclInputHash]在没有用密码输入框时为什么也会变动?
发布于:2022-01-17 09:50:54
#1 php
为什么在没有密码输入框的页面,刷新一次页面$_SESSION[SpAclInputHash]也跟着变动一次?
import('md5password.php'); 放在入口文件的reqire(SP_PATH.'/SpeedPHP.php');和spRun()的中间。
只有main,login和main,index有密码输入框使用了pwinput,但在其他页面刷新时,dump($_SESSION)查看到$_SESSION[SpAclInputHash]也在变动,这样导致我的main,login里spClass('md5password')->pwvalue()永远也收不到值
2010-05-09 16:09:17
#2 jake的马甲
1. $_SESSION["SpAclInputHash"]是在函数pwinput内赋值的,如果没有调用pwinput的话,那么$_SESSION["SpAclInputHash"]又为什么会被赋值呢,所以好好检查哪里有调用了pwinput是非常有必要的。
2. 第二个问题也是相同,如果$_SESSION["SpAclInputHash"]只是一次赋值,那么你的pwvalue应该是正确的,但是在你没有注意的地方,又另外赋值了一次,那么就pwvalue就一直都不准确了。
2010-05-09 18:29:05
#3 php
main,index调用了一次pwinput,首页打开后就有$_SESSION["SpAclInputHash"],然后点击到其他页面,刷新时发现$_SESSION["SpAclInputHash"]值会变动,经过下午的检查,发现当把main,index里的$this->display('main_index.html');注释掉后,其他页面再刷新$_SESSION["SpAclInputHash"]就不会变动。('main_index.html'这个模板下有pwinput)
2010-05-09 20:01:59
#4 jake的马甲
正常来说,访问其他的controller/action,也不会执行到main/index的$this->display('main_index.html');的,注释掉和不注释掉,是一样的情况。
2010-05-09 20:23:14
#5 php
是啊,我也是这样认为,只是搞不明白注释掉后,再刷新其他页面,下面的显示dump($_SESSION)里的["SpAclInputHash"]就不再变化了。
这个问题是升级到3.0才发现的,2.5没这个问题。
2010-05-09 20:45:45
#6 jake
$_SESSION["SpAclInputHash"]只有在md5password中的pwinput中有赋值,你可以在md5password文件的pwinput函数中,加入spError("运行到这里");
这样,你就可以看到,在赋值到$_SESSION["SpAclInputHash"]之前的整个过程,看看是否从其他的控制器或者类似general控制器父类中有调用了pwinput函数导致$_SESSION["SpAclInputHash"]重新赋值。
另外,在用这个的同时,你更新了新的spAcl类(不包括pwinput的acl)吗?
2010-05-09 20:59:17
#7 php
很奇怪,在md5password文件的pwinput函数中,加入spError("运行到这里")后,页面下的dump($_SESSION["SpAclInputHash"])就不再变化(去掉spError("运行到这里")后刷新又开始变动),页面一直都是正常显示。
2010-05-09 21:09:49
#8 jake
页面一直都没有显示出spError的效果,那么,对$_SESSION["SpAclInputHash"]赋值的就不是md5password的pwinput函数了。毕竟如果对$_SESSION["SpAclInputHash"]赋值了,那么spError也会执行的,对吗?
建议你一下,全文件夹搜索$_SESSION["SpAclInputHash"]字样,包括框架文件和程序文件,这种全文件夹搜索在emeditor或者dreamweaver里面都有,搜索看看,除了md5password文件外,还有其他什么地方有$_SESSION["SpAclInputHash"]的存在。
2010-05-09 21:22:56
#9 php
我搜索了整个项目文件,有SpAclInputHash的只有md5password.php
md5password.php是放在model目录下。
2010-05-09 21:36:13
#10 php
只有下面2个用到md5password.php,都在main控制器下面。main使用跟winblog一样的
import (APP_PATH.'/controller/general.php');
class main extends general
public function login()
{
$this->title = '账户登录';
import("md5password.php"); // 载入spAcl.php文件
if($username = $this->spArgs("username")) {
if( $_SESSION['verify_code'] == md5(strtoupper($this->spArgs("ValidateCode"))) ){
$password = spClass('md5password')->pwvalue();
$rows = array(
'username' => $username,
'password' => $password
);
$userinfo = spClass('lib_user')->userlogin($rows);
if( false != $userinfo ){
/*
if( strlen($this->spArgs("ref")) > 2 )
$this->jump(urldecode($this->spArgs("ref"))); // 跳回来源页
*
*/
$this->jump(spUrl('business','index')); // 跳回用户首页
}else{
$this->errmsg = "用户名/密码错误!";
}
} else {
$this->errmsg = "验证码错误!";
}
}
$this->ref = urlencode($this->spArgs("ref",$_SERVER['HTTP_REFERER']));
$this->display("main_login.html");
public function index()
{
import("md5password.php"); // 载入spAcl.php文件
$this->display('main_index.html');
}
general.php下面有跟围脖同样的
public function display($tplname, $output = TRUE)
{
if( FALSE == $output)return parent::display($tplname, $output);
$this->sitesets = $this->siteset; // 将站点配置输入模板中
// 主题路径
$this->themes = $GLOBALS['G_SP']['theme_path'];
// 页面title
$this->template_title = $this->title. ( ($this->title != "") ? " - " : "" );
// 页面keywords
$this->template_keywords = $this->keywords ? $this->keywords : $this->siteset[keywords];
// 页面keywords
$this->template_description = $this->description ? $this->description : $this->siteset[description];
parent::display($tplname, $output);
}
2010-05-09 21:41:31
#11 jake
看看spAcl内有没有这个函数,另外,也可以修改一下md5password里面的$_SESSION["SpAclInputHash"],改个名字,这样试试吧。
2010-05-09 21:54:24
#12 php
:(换成$_SESSION["hellopw"] = $raphash;后 $_SESSION["hellopw"]又开始变动了
spAcl里面没有pwinput,是用的SP3.0,里面没有改任何文件
2010-05-09 22:11:19
#13 php
昨晚经常Jake的检查,原来是CSS里面的一个背景图片不存在,而我使用了rewrite,不存在的图片请求被转发到index.php,导致默认控制器main,index被访问了,就产生一次新的$_SESSION["SpAclInputHash"]。
感谢Jake:victory:
2010-05-10 10:34:16