求助 很迷惑的问题
$username=$this->input->post('username',TRUE);$password=md5($this->input->post('password',TRUE));
$user=$this->user_model->login($username,$password);
if($user['password'] != $password) redirect('admin/login');//我这样写 这里报错
是什么原因哦
A PHP Error was encountered
Severity: Notice
Message: Undefined index: password
Filename: admin/login.php
Line Number: 31
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at C:\XXX\xx\system\libraries\Exceptions.php:166)
Filename: helpers/url_helper.php
Line Number: 541 忘记说了,我在登录的时候 密码不写 或者用户名不写 就爆这个错误 ,用户和密码全都写 正常 登陆程序贴出来 <form action="<?php echo site_url('admin/login/check') ?>" method="post" onsubmit="this.submit.disabled=true;" name="form" onsubmit="try{
check_login_form(this);
return false;}catch(e){return false;}">
<span><h2 style="color:#99AA33;">This IS login__#//</h2></span>
<fieldset>
<legend>Userame</legend>
<input name="username" id="username" type="text" size="30" onBlur="checkusername();" onclick="javascript:check_user();" tabindex="1" maxlength="40" value="" class="text-medium" />
<span id="checkusername"></span>
</fieldset>
<fieldset>
<legend>Password</legend>
<input name="password" id="password" type="password" size="30" onBlur="checkpassword();" tabindex="2" maxlength="50" value="" class="text-medium" />
<span id="checkpassword"></span>
</fieldset>
<input type="hidden" name="status" value="1">
<p class="button-submit">
<input type="submit" name="submit" value="Submit" /> 贴处理程序,不是html代码 楼主,你后台做了表单验证么???比如空值验证.... 登录未做空值验证 你没有做空值验证当然会报错,因为你把空值插入到了sql语句查询。。。。会报sql语句错误的。
你要用ci的表单验证做个空值判断
页:
[1]