Topic: How to customize the website homepage and display the visitor username
I was previously using this code in my punbb 1.2 to display a customized welcome message in the homepage of my website:
<h3><p><font size="5">Welcome <?php
define('PUN_ROOT', './forum/');
require PUN_ROOT.'include/common.php';
if($pun_user['username'] == 'Guest'){
echo '';
}
else
{
echo pun_htmlspecialchars($pun_user['username']);
}
?> to mysite.fr</font></p></h3>
This displayed
"Welcome to mysite.fr"
if the visitor was not logged in, and
"Welcome user-name to mysite.fr"
when the visitor was logged in. I'm trying to get the same result with my punbb 1.3.2, so I changed the code to:
<h3><p><font size="5">Welcome <?php
define('FORUM_ROOT', './forum/');
require FORUM_ROOT.'include/common.php';
if($pun_user['username'] == 'Guest'){
echo '';
}
else
{
echo pun_htmlspecialchars($pun_user['username']);
}
?> to mysite.fr</font></p></h3>
But I get this as html output:
Notice: Undefined variable: pun_user in /web/mysite/www/index.php on line 41
Fatal error: Call to undefined function pun_htmlspecialchars() in /web/mysite/www/index.php on line 46
I created databases with a prefix, so I add the database prefix in the code but it still gives a notice and a fatal error. As I'm using a french language, I'm using "Invité" instead of "Guest" in the code, but it still gives an error. I changed "pun-user" with "pun-users" and it is still the same...
A little help would be much appreciated, thanks