PDA

View Full Version : Simple PHP Issue


Spybot S&D
14 Apr 2008, 20:15
Well, what I need done isn't very hard, I just don't know PHP.

What it is is just a page that displays certain member information (If you are logged in) and if you aren't, it will show 2 blank fields and a command button (Login).

If you are logged in, you will see this:

#username#<Your Username>#/username#
#IP#<Your IP>#/IP#
#post#<your post count>#/post#
#group#<Your User Group>#/Group#

You can add more stuff if you want, those are just the needed ones. This is for an authorization system for a program of mine ;)

Thanks,
Alex.

Adrian Schneider
14 Apr 2008, 21:07
Try this,

<?php

error_reporting(E_ALL & ~E_NOTICE);

// chdir('./path/to/vbulletin');
require('./global.php');

if ($vbulletin->userinfo['userid'])
{
$data = array(
'username' => $vbulletin->userinfo['username'],
'IP' => IPADDRESS,
'post' => $vbulletin->userinfo['posts'],
'group' => $vbulletin->usergroupcache[$vbulletin->userinfo['usergroupid']]['usertitle']
);


foreach ($data as $key => $value)
{
echo sprintf('#%1$s#%2$s#/%1$2s#', $key, $value) . "\n";
}
}
else
{
// display login form
}

?>

Spybot S&D
14 Apr 2008, 21:43
Thanks. One problem... after I log out, and visit that page, the original content is still there :S