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.

I've noticed that you link to urls at localhost a lor you realize thr link doesnt work for anyone other than you, right?

I am assuming you are using Codeigniter ..

  1. Check your route.php file for correct route entry.
  2. Check if your local server is running properly. (Like WAMP)

I think it's a routing problem.

Please reply with your route.php code. If you are using Codeigniter.

I wonder how to route it:

routes.php

$route['default_controller'] = 'cpages/login';

$route['cpages/login'] = 'cpages/login';

Can anyone help me find out? Why Object not found appears?

What does your config.php file look like?

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = 'http://localhost/masterlinkci2/admin/';

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.