Page 1 of 1

PHPBB $userdata['user_lastvisit'] trouble

Posted: Wed Mar 10, 2004 10:04 pm
by The Monkey
Hello again!

I'm trying to have some code displaying under the menu of my regular site if the user is logged into my forums.

Using a tutorial by this guy, it's gone great so far... but after scouring the phpbb code multiple times in a ton of different pages, I have no clue how to turn the unintelligable numbers of user_lastvisit in the mysql phpbb_users table into something like "Wed March 10..."

My code:

Code: Select all

<?php
include('data/global/config.php');
define('IN_PHPBB', true);
$site_root_path = '/home/yolegoma/public_html/'; //<-- Modify
 $phpbb_root_path2 = '/themonkey/'; //<-- Modify
$phpbb_root_path = $site_root_path . $phpbb_root_path2;
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.php');

$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
$loggedin = $userdata['session_logged_in'];
$username = $userdata['username'];


// Jump down to troublesome code

echo 'Welcome, ' .$username. '!';
echo '<br />';

// This is the code we are looking at

// It comes out as wierd numbers such as 1078949351

echo 'You last visited ' .$userdata['user_lastvisit']. '.';
echo '<br />';
$authorized = '<a href="admin.php">Admin Page</a>';
	if($username == "myname") {
echo $authorized;
}
if($username == "myfriendsname") {
echo $authorized;
}

?>
I guess what I'm asking is how do I turn $userdata['user_lastvisit'] into something intelligable?

1078949351 into Wed March 10 blah blah.

If this has been asked before, I apologize. I spent an hour looking through the phpbb code, google, and these forums before asking!

- The Monkey

Posted: Wed Mar 10, 2004 10:08 pm
by markl999
echo 'You last visited ' .date('D F d', $userdata['user_lastvisit']). '.';

See http://php.net/date for more date() options.

Posted: Thu Mar 11, 2004 9:42 am
by The Monkey
D'oh! Why didn't I think of php.net/date? :D

Thanks mark!