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 8755155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:47:33+00:00 2026-06-13T13:47:33+00:00

I am trying to implement the logout procedure for my website. When the user

  • 0

I am trying to implement the logout procedure for my website.
When the user clicks the sign out button I redirect him to the following home controller script.

http : // mydomain/php/ci/index.php/index/?logout=set

And in my home controller index function I check if logout=set then destroy all sessions.

    echo @$_GET['logout'];
    exit();
    if(@$_GET['logout'] == "set")
    {
        unset($_SESSION['userid']);
        @$_SESSION = array();
        @session_unset();
        @session_destroy();
    }

But when I reach here nothing gets printed because the logout param is not passing.
I see the following url when i get here on clicking the sign out button.

http://localhost/php/ci/home/

Why is this happening?

  • 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-06-13T13:47:34+00:00Added an answer on June 13, 2026 at 1:47 pm

    You can get all the get data with CodeIgniter like this:

    var_dump($this->input->get());
    

    However, don’t use the index method to log users out, but make a method for it, like i.e. this:

    class Users extends CI_Controller() {
        public function index() {
            // Index stuff here        
        }
    
        public function logout() {
            // Your check if a user is logged in, instead of the dirty @
            if(isSet($_SESSION['userid'])) {
                unset($_SESSION['userid']);
            }
    
            redirect();
        }
    }
    

    Then in your view make a link like this:

    site_url("users/logout");
    

    You will want to use the CodeIgniter session handler for this, but this is just a quick solution for your problem. I can advice you to read the CodeIgniter manual. As your “solution” for logging out is quite dirty and does not fit the MVC principle

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

Sidebar

Related Questions

I am trying to implement a code in which when user clicks on Logout
I am trying to implement the Facebook Login and Logout in my website. I
I am trying to implement simple login and logout mechanism. When the user logs
I'm trying to implement proper logout for my Java EE / JSF2 application. It
really need your help with log-in-with-facebook feature I'm trying to implement on my website.
I need to keep the session live unless until the user clicks logout in
I am trying to implement Facebook Connect functionality into a website that I am
I am tring to implement the comments box into my website, providing the following
I was trying to implement facebook logout functionality for my django app. In my
I'm trying to implement some automatic logout code for my Application on Android. I

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.