PDA

View Full Version : str_replace username


woostar
04-04-2007, 08:36 PM
Hi there,

Hope someone can help. I'm trying to add tracking to certain links in Vb.
Assuming that the below code was in a new php file, what would I have to 'include' / add to the code below to make $username = username (if that makes sense).


<?php

$url = str_replace('[TRACKUSER]', $username, $url);
header('Location: ' . $url);

?>


Regards,
W.>

tbaleno
04-05-2007, 03:52 AM
I think you need something like this.

require_once('/forum/global.php');
require(DIR . '/includes/functions_user.php');
$username = $vbulletin->userinfo['username'];

Dismounted
04-05-2007, 05:25 AM
Just the below should be fine, as you do not require the user functions (which are used for retrieving avatars, etc.).
require_once('./global.php');
$username = $vbulletin->userinfo['username'];