How many ways can we get the value of current session id?
By admin on Apr 8, 2007 in PHP Interview Questions
session_id() returns the session id for the current session.
Java Interview Questions | IT interview questions | Software Testing Interview questions | .Net Interview Questions | Job Interview Questions & Answers | Tough Interview Questions | Technology Interview Questions | Tech Interview Questions | Testing Interview Questions | SAP Interview Questions | ABAP Interview Questions | Data Warehousing Interview Questions
Current ArticleBy admin on Apr 8, 2007 in PHP Interview Questions
session_id() returns the session id for the current session.
2 Comment(s)
By Milena Dimitrova on Mar 30, 2008 | Reply
<?php
session_start();
// variant 1 to find session ID
echo session_id();
echo ”;
// variant 2 to find session ID
$session_ccokies=explode(’;',$_SERVER['HTTP_COOKIE']);
foreach($session_ccokies as $cookie)
{
list($cookie_name, $cookie_value)=explode(’=',$cookie);
if (trim($cookie_name)==’PHPSESSID’)
{
$session_id=$cookie_value;
}
}
echo $session_id;
?>
By lizzeelike on Aug 13, 2008 | Reply
thanks for the 2nd variant. its very nice of u that, u post a easily understandable code instated of complex explanation. its very helpful for beginner’s