Questions about session php

Source: Internet
Author: User
Session problems php This post was last edited by redenn from 2012-11-11:37:21 today to view the session video. & Nbsp; the instructor said that a session was created when the browser accessed the server. & Nbsp; then & nbs questions about session php
At last, this post was edited by redenn at 15:37:21 on February 11,. Today, we watched a video about the session. The teacher said that a session was created when the browser accessed the server. On the php page, session_start creates

Session_id, which returns session_id to the browser as a cookie. The browser cookie uses this id to access other pages, so that the corresponding id of the server can be found.

Session file to execute data exchange.

However, some questions are not clear:

1. the server passes session_id to the cookie of the browser. does this cookie exist in the default cookie folder of the browser client? how long does it exist?

What about it?

2. how can I obtain the session_id of the session prepared by session_start when I access the website. And the content in it.


3. how can I use this session_id to simulate curl login?
 

I hope all of you will be able to confuse me or give me some ideas.
------ Solution --------------------
1. session_id is stored in the memory used by the browser search, rather than in the corresponding cookie file. Because session_id is created only when the browser is closed, it is used to save cookie variables that have not expired.

2. after session_start, you can use the session_id function to obtain the current session_id and use the $ _ SESSION array to manage the session variable.

3. simulate login not through session_id, but through cookie simulation login
Curl provides
CURLOPT_COOKIE send cookie variable
CURLOPT_COOKIEFILE: Send the cookie file
CURLOPT_COOKIEJAR receives the cookie to the file
------ Solution --------------------
Reference:
1. session_id is stored in the memory used by the browser search, rather than in the corresponding cookie file. Because session_id is created only when the browser is closed, it is used to save cookie variables that have not expired.

2. after session_start, you can use the session_id function to obtain the current session_id, and use the $ _ SESSION array to manage sessio ......


1. does the session survive for 1440 seconds (24 minutes)? if the cookie is disabled by the browser, the session_id generated by session_start () will not work for browser operations. So is session_id related to cookies?

2. because I want to access other people's websites and then get the session_id generated by session_start () on other people's websites, how can I get it.

3. because many websites use session for authentication, and I use cookies to invalidate them. Therefore, we want to use the content in the file corresponding to session_id as a simulated login verification.
------ Solution --------------------
The reply was deleted by the administrator at 14:13:03, January 8 ,.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.