check if user is logged in
Posted: Thu Feb 05, 2004 1:03 pm
I'm running winXp pro
Fireserv Apache
Phpbb2 plus 1.3
Ive created the base of my website using the phpbb2 styles all the pages ive created are in fireserv/www/phbb2/mysite/
I want my web site to act as part of ez portal which is installed as part of phpbb2 plus so that I can access all the variables that phbb2 uses from my own pages i.e $username etc.
I want to be able to check if a user is logged in when they try to open my website pages
I think my problem is because my website is stored in phpbb2/mysite/ and not in the phpbb2 root if this is the problem is there a way around this
here is the code im using
and i get this error
Warning: Failed opening './extension.inc' for inclusion (include_path='.;c:\php4\pear') in c:\fireserv\www\phpbb2\music_site\index.php on line 4
Warning: Failed opening './common.' for inclusion (include_path='.;c:\php4\pear') in c:\fireserv\www\phpbb2\music_site\index.php on line 5
Fatal error: Call to undefined function: session_pagestart() in c:\fireserv\www\phpbb2\music_site\index.php on line 10
I made a test page using
and saved it in the phpbb2 root and it works fine
Fireserv Apache
Phpbb2 plus 1.3
Ive created the base of my website using the phpbb2 styles all the pages ive created are in fireserv/www/phbb2/mysite/
I want my web site to act as part of ez portal which is installed as part of phpbb2 plus so that I can access all the variables that phbb2 uses from my own pages i.e $username etc.
I want to be able to check if a user is logged in when they try to open my website pages
I think my problem is because my website is stored in phpbb2/mysite/ and not in the phpbb2 root if this is the problem is there a way around this
here is the code im using
Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './'; // relative directory path to your phpBB page
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if ($userdata['session_logged_in'])
{
echo "you r logged in";
?>
<?php include("music_header.tpl") ?>
<?php include("music_navbar.tpl") ?>
<?php
echo "<table width='100%' border='1' cellpadding='2' cellspacing='2' bordercolor='#006699' align='center'>";
echo "<tr>";
echo "<td width='100%' background='../templates/fisubsilversh/images/cellpic3.gif'><div align='center' class='style2 style3'><strong>
UK Number 1 Singles</strong></div></td>";
echo "</tr>";
echo "</table>";
echo "<table width='100%' border='1' cellpadding='2' cellspacing='2' bordercolor='#006699' align='center'>";
// set up field bar
echo "<td width='100%' background='../templates/fisubsilversh/images/cellpic1.gif'><div align='center' class='style1'>display some text to tell users about this part of the site and maybe add some flash animation and music
hggjhghjgjgjgjgjjgbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb</div></td>";
// Finally we close off the table
echo "</table>";
?>
<?php include("music_footer.tpl") ?>
<?php
}
else
{
echo "You r not logged in";
} ?>
?>Warning: Failed opening './extension.inc' for inclusion (include_path='.;c:\php4\pear') in c:\fireserv\www\phpbb2\music_site\index.php on line 4
Warning: Failed opening './common.' for inclusion (include_path='.;c:\php4\pear') in c:\fireserv\www\phpbb2\music_site\index.php on line 5
Fatal error: Call to undefined function: session_pagestart() in c:\fireserv\www\phpbb2\music_site\index.php on line 10
I made a test page using
Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './'; // relative directory path to your phpBB page
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if ($userdata['session_logged_in'])
{
echo "you r logged in";
}
else
{
echo "You r not logged in";
}
?>