controllers/admin/clogin.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/* Author: Jorge Torres
* Description: Login controller class
*/
class Clogin extends CI_Controller{

    function __construct(){
        parent::__construct();
    }

    public function index(){
        // Load our view to be displayed
        // to the user

        $this->data['assets'] = array('logincss' => base_url().'assets/css/login.css',
                                'logo2' => base_url().'assets/images/logo2.png'
                                );

        $this->load->view('admin/login', $this->data['assets']);
    }

     public function process(){
        // Load the model
        $this->load->model('login_model');
        // Validate the user can login
        $result = $this->login_model->validate();
        // Now we verify the result
        if(! $result){
            // If user did not validate, then show them login page again
            $this->index();
        }else{
            // If user did validate,
            // Send them to members area
            redirect('home');
        }        
    }
}
?>

routes.php

/* admin */

$route['admin/login'] = 'admin/clogin';

views/admin/login.php

<link href="<?php echo $logincss; ?>"  rel="stylesheet" type="text/css" media="screen">

<div id="logoadmin"></div>

<div id="loginbox">

<img src="<?php echo $logo2; ?>" width="150">
<br><br>

<div id="username">
<br><br>
<div id="position">
Username: <input type="text" name="username"><br><br>
Password: <input type="password" name="password"> 
</div>
<br>
<div id="submit"><input type="submit" value="login" class="button"></div>
</div>

</div>

I wonder why the stylesheet and the logo does not show up?

Recommended Answers

All 2 Replies

I finally figure out why:

The link start going into chaos after I replace the .htaccess with:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

because I am trying to erase the ../index.php/..

How to erase the ../index.php/.. without turning some links into chaos (doesn't work anylonger after revising the .htaccess )

Maybe this could help?

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
2- from the config file change $config['index_page'] = 'index.php'; to $config['index_page'] = '';
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.