Prev | Current Page 518 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

However, if you plan on using sessions throughout
450 CHAPTER 18 ?–  SESSION HANDLERS
the site, you can forgo using this function by setting session.auto_start to 1. Its prototype
follows:
session.auto_start = 0|1
One drawback to enabling this directive is that it prohibits you from storing objects
within sessions, because the class definition would need to be loaded prior to starting
the session in order for the objects to be re-created. Because session.auto_start would
preclude that from happening, you need to leave this disabled if you want to manage
objects within sessions.
Setting the Session Name
By default PHP will use a session name of PHPSESSID. However, you??™re free to change
this to whatever name you desire using the session.name directive. Its prototype follows:
session.name = string
Choosing Cookies or URL Rewriting
If you??™d like to maintain a user??™s session over multiple visits to the site, you should use
a cookie so the SID can be later retrieved. If user data is to be used only over the course of
a single site visit, then URL rewriting will suffice (although you should keep in mind
the URL rewriting security issues mentioned earlier in this chapter). You can choose
the method using session.use_cookies. Setting this directive to 1 (the default) results
in the use of cookies for SID propagation; setting it to 0 causes URL rewriting to be
used.


Pages:
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530