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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:14:08+00:00 2026-06-16T21:14:08+00:00

I looked this up a while ago and it was and still is quite

  • 0

I looked this up a while ago and it was and still is quite vague to me. I’d like to know if the following things about sessions are correct when I use this: $_SESSION['username'] = "pete";

  • $_SESSION is a global variable that can only be changed on the server
  • When $_SESSION['username'] is declared a cookie will be set on the client-side
  • This means the client can view the data but not edit it
  • When $_SESSION['username'] is declared a cookie will be set on the server-side as well

If the third statement is true then why cant I find the cookie with the username inside it if I log in? I do find a session cookie but it contains a code like tkcsq66lucpra9m7j3ogqol5h7. Not quite a name now is it?

  • 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-16T21:14:09+00:00Added an answer on June 16, 2026 at 9:14 pm

    $_SESSION is a global variable that can only be changed on the server

    It’s a super-global … but one that is populated with saved data between executions of scripts.

    When $_SESSION['username'] is declared a cookie will be set on the client-side

    No. A cookie (unless the settings have been fiddled with) will be created when the session is started

    This means the client can view the data but not edit it

    No. The cookie contains the session id, not the data

    When $_SESSION['username'] is declared a cookie will be set on the server-side as well

    Cookies are stored only on the client. Data will be stored on the server, and will be associated with an identifier that is stored in the cookie sent to the browser.

    If the third statement is true then why cant I find the cookie with the username inside it if I log in?

    It isn’t true.

    I do find a session cookie but it contains a code like tkcsq66lucpra9m7j3ogqol5h7.

    That’s the identifier.

    If you were building a session system yourself (instead of using PHP’s built in library for it) then you might store something like this in a database:

    session                     key       value
    tkcsq66lucpra9m7j3ogqol5h7  username  pete
    

    The session library can then populate $_SESSION with "username" => "pete" when a session is started and it receives a cookie with sessionId=tkcsq66lucpra9m7j3ogqol5h7 in it.

    PHP’s built in system isn’t so cheap and nasty (and does it transparently so you don’t need to worry about the implementation details).

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

Sidebar

Related Questions

Disclaimer While this question looked like a potential duplicate , it was resolved by
I've looked at a number of questions but still can't quite figure this out.
I've looked for a while on this subject and there doesn't seem to be
This looked like a very simple question but I couldn't find the answer. How
I looked for this but i found how to use it with ScrollTo. This
I just looked at this posting: What is the best or most interesting use
I want to convert an array of hashes that I create like this: while(...)
I had finished this website a while ago but something happened to it and
So having looked this up for a while now, I have read probably twenty
A while ago I asked this question: using xslt stylesheet to convert xhtml blank

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.