I have created a login page using CodeIgniter 1.7. its code is shown below:

class login extends Controller {
    function login()
    function index()
function verify()
  if ($this->input->post('username')){
    $uname = $this->input->post('username');
    $upass = $this->input->post('password');
/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */

there is an external model for selecting users from database. if you enter correct details, it displays a blank page but if you enter invalid credentials, it will display the error message. can somebody put it better to redirect to dashboards controller.

Recommended Answers

All 2 Replies

Point the redirect to a controller not to a view. So change 'dashboard' to '/dashboard' or '/your_controller/dashboard'. You can also remove 'refresh' it will speed up the redirect. Add an ELSE statement:

    echo 'error';

And remember to load the url helper before the redirect or in your autoload.php config file: $this->load->helper('url');

add this line before redirect code

Be a part of the DaniWeb community

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