top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

Question about session_id() and session_start()

0 votes
27 views

I find the Note in PHP document. http://www.php.net/manual/en/function.session-id.php

"Note: When using session cookies, specifying an id for session_id() will always send a new cookie when session_start() is called, regardless if the current session id is identical to the one being set."

I feel puzzled about this feature. Even if the current session id is identical to the one one being set, session_start will send a new cookie. I want to know why session_start behave in this way.

posted May 20, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

2 Answers

0 votes

You will find the answer in the PHP source code. If you don't want this to happen, check if the current session id matches with the value you want to set it to, and don't set if they match.

answer May 20, 2013 by anonymous
There are well over half a million lines of source code in PHP. It seems a little unhelpful to tell someone to go and read half a million lines of C when you could just tell them the answer?
0 votes

I guess it would be to help prevent session hijacks like explained here
http://stackoverflow.com/questions/12233406/preventing-session-hijacking

answer May 20, 2013 by anonymous
Similar Questions
+3 votes

1) Implement both algorithms
2) Test both on three cases of data:
a) sorted in increase order,
b) sorted in decrease order,
c) randomly
3) Use data of different sizes: 10000, 100000, 1000000.

+1 vote

I want to use Git in a project but only some developers can Access in some folders (not all folders of the Project). Can Git limits the access to folders to users? How?

An example:
Project p_example
/scripts
/src
/docs
Users: A, B and C

Only B and C can access into scripts, src and docs folders but A only can access into scripts folder.

+1 vote

I have some doubts about pool of connections with my application developed in PHP. I want optimize the use of resources and database connections has a high computational cost. So the idea is keep a pool of open connections with database.
I'm using Apache webserver, language PHP and PostgreSQL database. In this case the pool of conections must be configured on Apache, PHP or PostgreSQL?

+1 vote

Our team lead and I recently discussed the pros and cons of breaking up a long source file into multiple source files. I tend to prefer one class per file, because I find the individual files easier to read and easier to find (with ctrl-p in Sublime). On the other hand, our team lead doesnt have issues with long source files. He argues that they are quite common in open-source projects. As an example, he pointed to the ActionDispatch::Routing::Mapper class in Rails as a case of a long file with multiple inline classes.

I am curious to learn the intent behind keeping all the contents of Mapper class within a single file. What were the advantages of taking this approach?


Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.
QUERY HOME
...