PDA

View Full Version : Get username outside forum folder


Taringa! CS
12-14-2009, 11:25 AM
Hi!

I've got my vb installed in a folder called /foros/ and i'm trying to get vb logged in username for an irc chat located in /chat/ (outside forum folder)

I'm using this piece of code i found to get a clean username

<?php
$vwd = '/var/www/myweb.com/public_html/foros';
$cwd = getcwd();

chdir($vwd);
require_once($vwd . '/global.php');

$lcnick = strtolower($vbulletin->userinfo['username']);
$lcnick = ucfirst($lcnick);
$cleanchr = ereg_replace("[^0-9a-zA-Z]", "", $lcnick);
$cleannum = ereg_replace("^[0-9]*[0-9]", "", $cleanchr);

$nick = ereg_replace(" ", "_", $cleannum);

chdir($cwd);

But when i do an echo of $nick i only get "Unregistered"

If that piece of code it's located inside forum folder, it works fine and my username it's echo when running that script.

Any ideas of how i can fix this?

Thanks in advance