Page 1 of 1
php "stay logged on"
Posted: Tue Feb 24, 2009 9:27 am
by Dredwerkz
I recently set up a phpBB board not really having a clue what I'm doing. The problem I have is that when checking the "log me in automatically each visit" check box even by opening a new tab the user is signed out. What do I need to do in order to fix this?
I have my php.ini file ready and waiting to be edited, but am not clear what sections I need to fill out and with what.
Help is very much appreciated.
Re: php "stay logged on"
Posted: Tue Feb 24, 2009 10:00 am
by mattpointblank
Set a cookie when they log in and check for its presence when you show them stuff. Or use a session, in the same way.
Re: php "stay logged on"
Posted: Tue Feb 24, 2009 10:57 am
by Dredwerkz
how though?
Re: php "stay logged on"
Posted: Tue Feb 24, 2009 11:27 am
by ~BlitZ
If you can, Try and show us the code for the login please, Thank you.
Re: php "stay logged on"
Posted: Tue Feb 24, 2009 12:18 pm
by watson516
You shouldn't have to edit the code of the phpbb. Are your cookies enabled?
Re: php "stay logged on"
Posted: Tue Feb 24, 2009 3:38 pm
by ~BlitZ
Yeah, Good point

, Is it just you or your users too?
Re: php "stay logged on"
Posted: Tue Feb 24, 2009 6:24 pm
by yorkcoparamedic
If you are using PHPBB3 the latest version you can access the session variables easily to check if they are working and/or reuse them in your website.
make a blank page and name it anything.php and save it in the phpbb directory.
Add this code to the top of the page:
Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>
<html><head>
<title></title>
</head>
<body>
<?php
if ($user->data['user_id'] == ANONYMOUS)
{
echo 'You are not logged in!';
}
else
{
echo 'You are logged in as, ' . $user->data['username_clean'];
}
?>
</body></html>
Here is a list user session vars you can access.
Code: Select all
Here's a list of all the user data variables you can access or check:
* user_id - ID number of the user
* user_type - 2
* group_id - 1
* user_perm_from - 0
* user_ip -
* user_regdate - UNIX timestamp of the user's registration date
* username - user's username
* username_clean - clean version of the username
* user_password - MD5 encoded version of the user's password
* user_passchg - 0
* user_pass_convert - 0
* user_email - user's email address
* user_email_hash - 0
* user_birthday -
* user_lastvisit - 0
* user_lastmark - 0
* user_lastpost_time - 0
* user_lastpage -
* user_last_confirm_key -
* user_last_search - UNIX timestamp of the last search the user performed
* user_warnings - total number of warnings
* user_last_warning - UNIX timestamp of last warning
* user_login_attempts - number of login attempts this session
* user_inactive_reason - 0
* user_inactive_time - 0
* user_posts - total number of posts made by the user
* user_lang - user's language
* user_timezone - 0.00
* user_dst - 0
* user_dateformat - d M Y H:i
* user_style - 1
* user_rank - 0
* user_colour -
* user_new_privmsg - 0
* user_unread_privmsg - 0
* user_last_privmsg - 0
* user_message_rules - 0
* user_full_folder - -3
* user_emailtime - 0
* user_topic_show_days - 0
* user_topic_sortby_type - t
* user_topic_sortby_dir - d
* user_post_show_days - 0
* user_post_sortby_type - t
* user_post_sortby_dir - a
* user_notify - 0
* user_notify_pm - 1
* user_notify_type - 0
* user_allow_pm - 1
* user_allow_viewonline - 1
* user_allow_viewemail - 1
* user_allow_massemail - 0
* user_options - 895
* user_avatar -
* user_avatar_type - 0
* user_avatar_width - 0
* user_avatar_height - 0
* user_sig - the user's signature
* user_sig_bbcode_uid -
* user_sig_bbcode_bitfield -
* user_from - user's location
* user_icq - user's ICQ address
* user_aim - user's AIM address
* user_yim - user's Yahoo Messenger address
* user_msnm - user's MSN Live address
* user_jabber - user's Jabber address
* user_website - user's website
* user_occ - user's occupation
* user_interests -
* user_actkey -
* user_newpasswd -
* session_id - cf4eaea2eb0a0a1257bada05cd901ca7
* session_user_id - 1
* session_last_visit - UNIX timestamp of when the user last logged in
* session_start - UNIX timestamp of when the user logged in
* session_time - UNIX timestamp of the last time the user clicked on a page
* session_ip - current IP address
* session_browser - Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7
* session_forwarded_for -
* session_page - test.php
* session_viewonline - 1
* session_autologin - 0
* session_admin - 0
* is_registered -
* is_bot -
I hope this helps.
Re: php "stay logged on"
Posted: Fri Feb 27, 2009 10:24 am
by Dredwerkz
http://www.dredwerkz.eu/Forum/index.php
There's the page. It's me any my users. I just want it to remain logged in for x amount of time even though a new browser session has started. btw html isn't but this is way over my head.
Re: php "stay logged on"
Posted: Sat Feb 28, 2009 6:13 pm
by Dredwerkz
Alright, I have a page as above but all it does is tell me what I already know, what I want to do is figure out why staying logged in isn't working. Could anyone give me the criteria in my php.ini file I need to fulfil and what my settings need to be on the phpBB control panel. This is really getting on my nerves now.
Having just tried something, it seems sensible now. I had my php.ini in the root directory but not in the Forum directory. tit?

Re: php "stay logged on"
Posted: Mon Mar 02, 2009 2:59 am
by mattpointblank
php.ini shouldn't be in any folder accessible by the web...