我想弄清楚我的简单登录本地主机程序中导致错误的原因。403禁止您无权访问此服务器上的/ mytesting/<。错误
我BASE_URL = http://localhost/MYTESTING
我有这个我loginpage.php
控制器
public function login(){
$data['title'] = "TEST LOGIN";
$username = $this->input->post('username');
$password = $this->input->post('password');
$this->load->view("loginheaderTest.php",$data);
$this->load->view("loginpage.php",$data);
$this->load->view("footerTest.php",$data);
if(isset($_POST['login']))
{
$data['authenticate'] = $this->AuthenticationTest->authenticate_acount($username,$password);
if(!empty($data['authenticate']))
{
echo"<script>
alert('Success');
</script>
";
}
else
{
echo"<script>
alert('Invalid Username or Password');
</script>
";
}
}
}
上,我有这个在我的模型
public function authenticate_account($username,$password){
$this->db->select("username");
$this->db->from("accounts");
$this->db->where("username",$username);
$this->db->where("password",$password);
$query = $this->db->get();
return $query->row_array();
,这对我的看法:
<div class="panel-body">
<form action = "<?base_url();?>" method = "POST">
<fieldset>
<div class="form-group">
<input class="form-control" placeholder="Username" name="username">
</div>
<div class="form-group">
<input class="form-control" placeholder="Password" name="password" type="password" value="">
</div>
<input type = "submit" class="btn btn-lg btn-success btn-block" value = "Login" name = "login">
</fieldset>
</form>
</div>
当我访问localhost/mytesting并单击登录时,我很确定我的数据库配置中的配置正确。
403是Apache错误。您的PHP代码无关紧要,您永远无法运行代码。 – RiggsFolly
您似乎正在使用用户在where子句中输入的密码。你是不是应该加密/散列密码来匹配存储在数据库中的密码?我不是代码点火器用户,但我不确定认证用户的最佳方式是在数据库中搜索匹配的密码。 – Gavin
这是一个新的服务器设置? – Gavin