Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7086671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:34:44+00:00 2026-05-28T07:34:44+00:00

I am trying to direct the user to my main page when the user

  • 0

I am trying to direct the user to my main page when the user is authorized. I am doing the user check in my login_check controller and add $this->load->view('main'); The page can be load but the site address in the main page still show

http://myprojectname/login_check

but I want it to show

http://myprojectname/main.

Do i have to create a new ‘main’ controller and load the view? It sounds redundant to me. Here is my code.

part of my login_check.php

private function _user_check()
{
    $this->load->model('user_query');  //load my model
    $result=$this->user_query->query($this->input->post('username'),$this->input->post('password'))             

    if($result)  //the user is in DB
    {
        $data['view']='main'; 
        $this->load->view('include/template', $data);
        //the address bar shows http://myproject/login_check in main page       

    }else{  //the user is not in DB

        $data['view']='login';
        $this->load->view('include/template', $data);
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:34:44+00:00Added an answer on May 28, 2026 at 7:34 am

    First of all, you are doing a very poor job of checking if the user is authenticated (just passing username/pass to model isn’t best, should process / check it before sending to model).

    You can make redirects easily by including the helper ‘URL’ and simply use:

    redirect('/controller/method');
    

    or in a real world example:

    redirect('/main');
    

    Reference Link

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to direct the user to a certain page on my site (VB,
I'm trying to use JS to direct a user to their profile page on
I am trying to user header() to direct to a page above the document
I am trying to direct user to a error page when maximum fileupload size
I'm trying to let a user "make his own service". most direct method I
I'm trying to load an image slider via AJAX. When typing in the direct
On session timeout we re-direct to the login page and if the user logs
I'm trying to get a Formmail form to re-direct back to it's own page.
I'm trying to add an attribute to a model object. Direct access works but
I'm trying to add a vCard from a web link to the user's contact

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.