admin/views/login.php
<?php $this->load->library('form_validation'); ?> <?php echo validation_errors(); ?> <?php echo form_open('cpages/ceklogin'); ?> <div class="login-card"> <center><?php //echo $warning; ?> <?php echo $this->session->flashdata('warning'); ?> </center> <h2>Gionda CMS Login</h2><br> <form> <div class="login"><input type="text" name="username" placeholder="Username"></div> <div class="login"><input type="password" name="password" placeholder="Password"></div> <br> <input type="submit" name="login" class="login login-submit" value="login"> </form> <div class="login-help"> <a href="#">Register</a> • <a href="#">Forgot Password</a> </div> </div>
controllers/Cpages.php
public function ceklogin() {
$username = $this->input->post('username', TRUE);
$password = $this->input->post('password', TRUE);
$this->db->where('username', $username);
$this->db->where('password', $password);
$query=$this->db->get('login');
if ($query->num_rows() >= 1)
{
// echo 'LOGIN BERHASIL !';
$this->load->model('Mpages');
$data['login']=$this->db->get('login');
$data['login']=$this->Mpages->login();
$this->load->view('index', $data);
}
else
{
// echo 'LOGIN GAGAL !';
$this->session->set_flashdata('warning', 'Your username and password are wrong !');
//$data['warning']='Your username and password are wrong !';
$this->load->view('login');
}
}
models/Mpages.php
public function login()
{
$query = $this->db->get('login');
return $query->result();
}
username email password role
user user@mail.com 12345 administrator
user2 user2@mail.com $2y$10$PrDTzzETQ.NzI9eIN0WYDubhBZhkg9XEo10MxRYpv4M manager
I have tried to login with username: user password: 12345 and have not been successful to login yet. I wonder why?
http://localhost/masterlinkci2/cpages/ceklogin
Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.