Click to See Complete Forum and Search --> : Phpsessid


chramya
February 27th, 2008, 02:45 AM
Hi,

anybody tell what is PHPSESSID and how can i use it to secure my page..
And how can i send that through url and get it in another page...

tell me if any samples is there..
with thanks..

hspc
February 27th, 2008, 03:30 AM
You don't need to pass anything by yourself, session is handled by PHP by cookies.
Check session handling functions at: http://www.php.net/session

PeejAvery
February 27th, 2008, 07:52 AM
If you use session_name('YOUR_SESSION_NAME') before you call the session_start(), it will be handled for you. If not, you will have to store it in a cookie. If you plan to have multiple users, you might want to have a database to check for currently used session ids.

<?php
if(@$_COOKIE['YOUR_SESSION_ID'] == ""){
$sesid = 'YOUR_SESSION_ID' . mt_rand(0, 9999999);
setcookie("YOUR_SESSION_ID", $sesid);
}
else{$sesid = $_COOKIE['YOUR_SESSION_ID'];}
session_id($sesid);
session_start();
?>

chramya
February 28th, 2008, 12:57 AM
whether it is possible to send PHPsessID through url and get it in another page..
How to do this

with thanks

hspc
February 28th, 2008, 02:07 AM
it is possible that PHP use url to pass the session id, you need to set session.use_trans_sid in php.ini to true it's disabled by default and not recommended.
You can find more info at the url I sent in my previous reply.

PeejAvery
February 28th, 2008, 08:48 AM
I still would ask...WHY? It is a huge security hole. Anyone can then go and hijack someone else's session. It used to be common, but now people have realized the threat.