I should know this, but how do you echo a session id in PHP?
I should know this, but how do you echo a session id in PHP?
I can customise your phpBB board. Send me a PM.
lynxphp - info, tutorials and scripts
"A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."
[php]
<?PHP
//hopefully you've started your session....
echo "Session ID =. $_SESSION['sessionname'];
?>
█ Neil Hanlon | x10Hosting Support Representative
█ Neil[at]x10hosting.com
█ I'm always happy to help. Just ask a question in Free Hosting
█ Terms of Service IRC
I think its:
Easy!!!PHP Code:<?PHP
session_start();
$ses_id = session_id();
echo 'Session ID = ' . $sid;
session_destroy();
?>
supajason was here
<?PHP
ob_start();
session_start();
$ses_id = session_id();
echo 'Session ID = ' . $sid;
session_destroy();
?>
You can used it this way.
leafypiggy: sorry, doesn't work
supajason: neither does yours
phpasks: nor yours
I think it must be me, not you...
phpbb.php:
index.php:PHP Code:<?php
define('IN_PHPBB', true);
$phpbb_root_path = "forum/";
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('');
$username = request_var('username', '');
$count = request_var('count', 0);
$submit = request_var('submit', '');
$done = false;
if($user->data['is_registered'])
{
$ses_id = session_id();
$res = "<a href=\"" . $phpbb_root_path . "ucp.php?mode=logout&sid=" . $sid . "\">Logout [" . $user->data['username'] . "]</a>";
}
else
{
$res = "<a href=\"" . $phpbb_root_path . "ucp.php?mode=login\">Login</a>";
}
?>
includes.php:PHP Code:<?php
include("includes.php");
//...
include("phpbb.php");
echo $res;
?>
I've removed quite a lot of unwanted code.PHP Code:<?php
//security code - removed
session_start();
function startPige()
{
echo "<html><head><title>The Paper Hub</title></head><body>
//...";
}
function endPige()
{
echo "//...
</body></html>";
}
?>
I can customise your phpBB board. Send me a PM.
lynxphp - info, tutorials and scripts
"A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."
check this out:
http://us.php.net/manual/en/function.session-id.php
you have to set the session ID or session_id() returns ""
Edit:
also make sure you set the session id before starting a session
Last edited by garrettroyce; 07-10-2008 at 12:45 PM. Reason: Automerged Doublepost
"But you have access to the greatest source of knowledge in the universe."
"Well I do talk to myself sometimes, yes."
"I'm back, and I'm bad! Obviously within certain, sensible, preset parameters"