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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:43:28+00:00 2026-06-16T00:43:28+00:00

When a user logs in to my site I grab all their user info

  • 0

When a user logs in to my site I grab all their user info and store it in a session called user_info. This is so that I don’t have to make continious database lookups to get common info about the user that is required on almost every page. A user info session looks like this when var dumped:

array(17) {
  ["user_id"]=>
  string(7) "1165771"
  ["username"]=>
  string(2) "Jake"
  ["who"]=>
  string(1) "1"
  ["seeking"]=>
  string(1) "2"
  ["orientation"]=>
  string(1) "1"
  ["dob"]=>
  string(10) "1985-07-08"
  ["zip"]=>
  string(5) "25140"
  ["email"]=>
  string(17) "foo@bar.com"
  ["account_status"]=>
  string(1) "1"
  ["role"]=>
  string(1) "1"
  ["paused"]=>
  string(1) "0"
  ["latitude"]=>
  string(11) "37.89955100"
  ["longitude"]=>
  string(12) "-81.52641100"
  ["region"]=>
  string(2) "WV"
  ["city"]=>
  string(5) "NAOMA"
  ["avatar"]=>
  string(21) "1165771_50c6816a8fad1"
  ["email_setting"]=>
  string(1) "1"
}

Now there is an “account settings” page where the user can update some of their info. So if they change their username for example I do this to update their session so that it now contains the new value:

$_SESSION['user_info']['username'] = 'NEW VALUE';

Now here’s the problem. If I decide to ban a user while moderating in the admin panel, then their account status will be updated from 1 (meaning active) to 2 (meaning banned) in the database. However to have this change be reflected in their user_info session I can’t do this:

$_SESSION['user_info']['account_status'] = 2;

Because it will only be updating my user info on my computer rather than the user’s session on his/her computer. They will be able to continue using the site even though they are technically banned until they log out and try to log back in.

Then they will be prevented entry because for the log in SQL query to return true in addition to getting the credentials correct the user must also have an account status of 1.

Questions

  1. How can I update the session of an individual user when I make a
    change to their account.

  2. How I can delete a user’s session completely from my server so they are immediately logged out.

  • 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-16T00:43:29+00:00Added an answer on June 16, 2026 at 12:43 am

    If you need this change to take immediate effect then as far as I know, you will have to check the users status on each page and if the user is banned take appropriate action.

    This answer suggests changing the files as an alternative but even the author doesn’t recommend that.

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

Sidebar

Related Questions

When a user logs into my site, I need to persist that login session.
My site logs clicks to a database whenever a user views an article. This
Quick (probably foolish) question. This is the flow of my site: User logs in
I have a site that uses the SqlMembershiprovider. Its is a webshop. The user
I have an e-commerce site where when a user logs in, they can make
I have a PHP / Javascript page that automatically logs a user into different
We have a website (foo.com) that does online training. A user logs in, then
I'd like to track how many times a user logs in to my site
I have a facebook app and a user logs in and uses it. Simple.
I have a pop-up window a user logs into, once they are logged in

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.