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

  • Home
  • SEARCH
  • 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 3626956
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:49:39+00:00 2026-05-18T23:49:39+00:00

When my users log into the website their first name, last name and ID

  • 0

When my users log into the website their first name, last name and ID are missing from the session data because my session data is coded to take post data and submit into the session table in my database.

Because user logs in with email and password in my session data only email appears and nothing else does.

How can I make first name, last name and id appear in my session table in my db? I want to some how grab these details from the database when user is logging in and provide it in my $u_data array so it get’s posted upload login success.

Here is my code:

<?php
class Login_Model extends CI_Model {


    public function checkLogin() {

            $this->db->where('email', $this->input->post('email')); //compare db email to email entered in form
            $this->db->where('password', $this->hashed()); //compare db password to hashed user password
            $query = $this->db->get('users'); //get the above info from 'user' table

            if ($query->num_rows() == 1) { //if number of rows returned is 1

            $u_data = array( //new variable with session data
                'user_id' => $this->db->insert_id(),
                'email' => $this->input->post('email'),
                'first_name' => $this->input->post('first_name'),
                'last_name' => $this->input->post('last_name'),
                'logged_in' => TRUE
            );

            $this->session->set_userdata($u_data); //send data from variable to db session
            return TRUE;

       } else {
            return FALSE;
       }
 }


   public function hashed() { //hashing method

            // sha1 and salt password
            $password = $this->encrypt->sha1($this->input->post('password')); //encrypt user password
            $salt = $this->config->item('encryption_key'); //grab static salt from config file

            $start_hash = sha1($salt . $password);
            $end_hash = sha1($password . $salt);
            $hashed = sha1($start_hash . $password . $end_hash);
            return $hashed;
}

}

alt text

  • 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-18T23:49:40+00:00Added an answer on May 18, 2026 at 11:49 pm

    The following solved this issue for me. I looked at one of my old questions on here and used my common sense.

    I made this edit to my code.

    if ($query->num_rows() == 1) { //if number of rows returned is 1
    
          $user = $query->result();
    
                    $u_data = array( //new variable with session data
                        'user_id' => $user[0]->id,
                        'email' => $this->input->post('email'),
                        'first_name' => $user[0]->first_name,
                        'last_name' => $user[0]->last_name,
                        'logged_in' => TRUE
                    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a internal website that users log into. This data is saved as
I need to make a pop-up window for users to log-in to my website
I've been having trouble getting my ASP.NET application to automatically log users into the
Hi guys I have a simple membership based website where users log in and
I've got a web system where users log in, and it stores a cookie
I've got a rails application where users have to log in. Therefore in order
Is there a way to log(/var/log) commands executed by users in the Unix shell?
I have a log in page where I valid my users and based on
I have several WPF apps, and I want users to be able to log
I understand that when the customer logs into PayPal and uses their PayPal account,

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.