Page Index Toggle Pages: 1 Print
Add Welcome "UserName" to PHP Webpage (Read 5848 times)
Captain John
Ex Member


Add Welcome "UserName" to PHP Webpage
Apr 14th, 2008 at 3:54pm
Print Post  
HTML PHP Welcome
You just need to use the yabb cookies and vars files.

create yabbuserfile.php

Code
Select All
<?php
$username = $_REQUEST['Y2User-77511'];
$file = "/yabb/members/".$username.".vars";
$lines = file($file);
foreach ($lines as $line_num => $line)
{
htmlspecialchars($line) . "<br />\n";
$var = explode(",", $line);
$var[0] = eregi_replace("'", "", $var[0]);
$userinfo[$var[0]] = eregi_replace('"', '', $var[1]);
}
?> 




At the top of your index.php place:

Code
Select All
<?
include 'yabbuserfile.php';
$realname = $userinfo['realname'];
?> 




Then after <body> in your index.php

Code
Select All
<?
if ($realname) {
echo <<<EOF
<strong>$realname</strong> | <a href="/yabb/YaBB.pl?action=viewprofile;username=$username" rel="nofollow">Profile</a> | <a href="/yabb/YaBB.pl?action=get_cal;calshow=1">Event Calendar | <a href="/yabb/YaBB.pl?action=logout">Sign out</a><p>
EOF;
 } else {
echo <<<EOF
<strong>Welcome, Guest. Please <a href="/yabb/YaBB.pl?action=login">Login</a> or <a href="/yabb/YaBB.pl?action=register">Register</a>.</strong>
EOF;
 }
?> 

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Print
 
  « Board Index ‹ Board  ^Top