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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:29:03+00:00 2026-06-10T13:29:03+00:00

I have been rebuilding my social network in code igniter and am looking for

  • 0

I have been rebuilding my social network in code igniter and am looking for an optimal way to start a session as logged in when the user logs in ( maybe contrary to using code igniters session class? as I want to use their id that is created when they make their account)

I have been able to CREATE a user and hash and salt their password and log them in using the hashed password.

My site is going to have a lot of ‘logged in’ and ‘logged out’ views that vary due to if the user is signed in or not.

That being said, upon login I want to start a logged in session with the id that is created upon sign-up.

Here is my controller that logs the user in minus what I’m trying to do.

function validate_credentials()
{
    $this->load->model('user_model', 'um');
    $login = $this->input->post('submit');
        $this->load->library('encrypt');

    if($login) {
        $user = $this->um->
                    validate(array('email' => $this->input->post('email')));
        if( $user ) {
            if($user->password == $this->encrypt->sha1( $user->salt .
                         $this->encrypt->sha1($this->input->post('password')))) {
                  $this->session->set_userdata( array('email' => 
                                   $this->input->post('email')
                  ));
                  redirect('account/dashboard');
                  exit;
            }
        }
    }
    $this->index();
}

/*---------- EDIT ----------*/
Getting these errors:



  Message: Cannot modify header information - headers already sent by (output started at /Users/mycomputer/Sites/cl_ci_new/application/controllers/auth.php:44)

    Filename: libraries/Session.php

    Line Number: 672

    Message: Cannot modify header information - headers already sent by (output started at /Users/mycomputer/Sites/cl_ci_new/application/controllers/auth.php:44)

    Filename: helpers/url_helper.php

    Line Number: 542

and here are those lines in my code or the Session.php file:

    // Set the cookie
        setcookie(
            this->sess_cookie_name,
            $cookie_data,
            $expire,
            $this->cookie_path,
            $this->cookie_domain,
            $this->cookie_secure
                );

and the url_helpers.php:

switch($method)
        {
            case 'refresh'  : header("Refresh:0;url=".$uri);
                break;
            default         : header("Location: ".$uri, TRUE, $http_response_code);
                break;
        }

I’m not understanding what the problem is….

  • 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-10T13:29:05+00:00Added an answer on June 10, 2026 at 1:29 pm

    On successful validation save a variable in session:

    if ($user->password == ...) {
         $this->session->set_userdata('logged_in', TRUE);
    }
    else {
         $this->session->set_userdata('logged_in', FALSE);
    }
    

    Later on, when needed, check:

    if ($this->session->userdata('logged_in')) {
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have been looking on some tutorials for drawing canvas using SurfaceView, but the only
I've started bumping into errors when my session has been lost, or upon rebuilding
I have been having intermittent trouble with data access so I'm rebuilding my project.
Have been trying to encrypt an xml file to a string so that I
Have been working on this question for a couple hours and have come close
Have been reading about async and tasks and been attempting to convert the CopyFileEx
Have been searching how to convert a dictionary to a string. But the results
Have have been trying to make a validator for my xml files. I have
I have been tracking emails for years using a "beacon" image and for those
I have been working with SQL Server as a Developer a while. One thing

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.