Tools, FAQ, Tutorials:
How Sessoion IDs Are Transferred in PHP
How Session IDs Are Transferred on Your Web Server in PHP?
✍: FYIcenter.com
As you know there are two options the PHP engine can use to transfer session IDs to the client browsers. But how to do know which option is your PHP engine is using? The PHP sample script will help you to find out:
<?php session_start(); print("<html><pre>"); $queryString = $_SERVER["QUERY_STRING"]; print("Query string of the incoming URL: ".$queryString."\n"); print("Cookies received:\n"); foreach ($_COOKIE as $name => $value) { print " $name = $value\n"; } $myLogin = $_SESSION["MyLogin"]; print("Value of MyLogin has been retrieved: ".$myLogin."\n"); $myColor = $_SESSION["MyColor"]; print("Value of MyColor has been retrieved: ".$myColor."\n"); print("</pre></html>\n"); ?>
You need to save this script to your Web server as next_page.php. Now visit first_page.php and click the "Next Page" hyper like, you will get something like this:
Query string of the incoming URL: PHPSESSID=meml483hk4dvm1n2ii8k9hvjj1 Cookies received: Value of MyLogin has been retrieved: FYICenter Value of MyColor has been retrieved: Blue
Base on the output, your PHP engine is using URL parameters to transfer session IDs, because you can see the session ID parameter in the query string of the incoming URL, and there is no cookies related to session ID.
Another way to confirm that your PHP engine is using URL parameters to transfer session IDs is to look at the address field of your browser, it will show something like:
http://localhost/next_page.php?PHPSESSID=meml483hk4dvm1n2ii8k9hvjj1
⇒ Using Cookies to Transfer Session IDs in PHP
⇐ Options to Transfer Session IDs in PHP
2016-10-25, 1527🔥, 0💬
Popular Posts:
How to use the "set-variable" Policy Statement to create custom variables for an Azure API service o...
How to add request URL Template Parameters to my Azure API operation 2017 version to make it more us...
How to use the "Ctrl-p Ctrl-q" sequence to detach console from the TTY terminal of container's runni...
How To Merge Cells in a Column? If you want to merge multiple cells vertically in a row, you need to...
How to convert JSON Objects to PHP Associative Arrays using the json_decode() function? Actually, JS...