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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:09:27+00:00 2026-05-21T16:09:27+00:00

I’m new to PHP, I’ve read a lot of tutorials about cookies and sessions

  • 0

I’m new to PHP, I’ve read a lot of tutorials about cookies and sessions but I don’t understand some things clearly:

  1. The session values are stored on the server, only the session id is stored in the users computer. Right?

  2. Can I make a session that never expires, that is never deleted from the server and to save the session id in a cookie ? If yes than how ? (please provide me some code)

  3. It`s not good to store data like passwords in cookies because cookies are not secure ? Right ?

  4. It`s possible for a hacker to create a cookie with a session id of an another user ? Can a hacker guess the session id of a session or worst, the list with each session id ?

  5. For a good login system (used for forums or websites where the user have some data) that can remember an user is better to use cookies, sessions or a combination of both with session id stored in cookies ?

  6. Please provide me some code about how could I store the session id in a cookie and than how I can access a session if I know the session id

Thanks!

  • 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-21T16:09:28+00:00Added an answer on May 21, 2026 at 4:09 pm

    Let’s see…

    1. right
    2. session that never expires ? Not quite a good idea :
      • your served would get filled with old, useless, sessions
      • Instead, you should store some data in a long-lasting cookie ; and use that cookie to re-create the session (auto-connecting the user, for example) when the user comes back later
    3. cookies are not secure indeed : they are stored unencrypted, and go through the network unencrypted (unless you use HTTS).
    4. If your hacker can get the session id of another user (by reading his cookies, typically), yes, he can access his session
    5. I would use both : anyway, if using a session, you need a way to store its identifier.
    6. storing the session id in a cookie ? PHP will do that for you, if configured properly 😉
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

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.