hlstriker Posted August 20, 2006 Share Posted August 20, 2006 Hi, I need to somehow check to see if a user is already logged in to phpbb or not. I am putting a login section to the forums on my main page, but it is always there even if the user is already logged in. If the user is already logged in I want it to say something like, "Hello, *name*. You are already logged in." instead of displaying the input boxes.Here is the code for the form...[code]<form action="./#" method="post"> <table border="0" width="100%"> <tr> <td width="30%"> Username: </td> <td width="70%"> <input type="text" name="username" style="width: 90%;" /> </td> </tr> <tr> <td> Password: </td> <td> <input type="password" name="password" style="width: 90%;" /> </td> </tr> <tr> <td></td> <td> <div align="center"> <input type="submit" value=" Log in " /> </div> </td> </tr> </table></form>[/code]If anyone can help me with this please do! Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/18108-how-to-see-if-a-user-is-already-logged-in-phpbb/ Share on other sites More sharing options...
tippy_102 Posted August 22, 2006 Share Posted August 22, 2006 The phpBB Login integration tutorial: [url=http://www.phpbb.com/kb/article.php?article_id=143]http://www.phpbb.com/kb/article.php?article_id=143[/url] contains the script you need. Quote Link to comment https://forums.phpfreaks.com/topic/18108-how-to-see-if-a-user-is-already-logged-in-phpbb/#findComment-78438 Share on other sites More sharing options...
hlstriker Posted August 22, 2006 Author Share Posted August 22, 2006 Hi, I viewed that link and tryed what it said. It didn't work so I searched around for more session id things. Now I modified my code and it still doesn't work :( If someone can help me debug this and make it work please help![code]<?define('IN_PHPBB', true);$phpbb_root_path = './forum/';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);$username = $userdata['username'];$u_logout = 'login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id'];$u_login = 'login.'.$phpEx.'?amp;sid=' . $userdata['session_id'];//// End session management//if( $userdata['session_logged_in'] ){?><table border="0" width="100%" height='65'> <tr> <td align='center'> You are logged in,<br> <? echo $username; ?><br><br> <a href="<? './forum/'.$u_logout; ?>">Logout</a> </td> </tr></table><?}else{?><form action="<? './forum/'.$u_login; ?>" method="post"> <table border="0" width="100%"> <tr> <td width="30%"> Username: </td> <td width="70%"> <input type="text" name="username" style="width: 90%;" /> </td> </tr> <tr> <td> Password: </td> <td> <input type="password" name="password" style="width: 90%;" /> </td> </tr> <tr> <td><a href='./forum/profile.php?mode=register'>Register</a></td> <td> <div align="center"> <input type="submit" value=" Log in " /> </div> </td> </tr> </table></form><? } ?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/18108-how-to-see-if-a-user-is-already-logged-in-phpbb/#findComment-78783 Share on other sites More sharing options...
tippy_102 Posted August 23, 2006 Share Posted August 23, 2006 What is the cookie path in phpBB? It should be a single forward slash and not /phpBB2/ Quote Link to comment https://forums.phpfreaks.com/topic/18108-how-to-see-if-a-user-is-already-logged-in-phpbb/#findComment-79013 Share on other sites More sharing options...
Slodge Posted September 5, 2006 Share Posted September 5, 2006 Use phpbb_fetch_all for that, you can have a login area, latest form post, whois online etc on your main page. [url=http://www.phpbbfetchall.com/]http://www.phpbbfetchall.com/[/url] Quote Link to comment https://forums.phpfreaks.com/topic/18108-how-to-see-if-a-user-is-already-logged-in-phpbb/#findComment-86657 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.