Log in

View Full Version : where is the $vbulletin->GPC[] array set up?


StephenKay
07-07-2008, 09:19 PM
I want to add my own additional HTML query variable to some of the regular query strings, and I gather that this is how the queries are handled in vBulletin: somewhere, they are put into an array that the functions can then reference, but I can't locate where in the code it is initially set up....

Thanks!

Opserty
07-07-2008, 09:21 PM
You don't need to worry about where it is set up.

Using the vBulletin Input Cleaner (https://vborg.vbsupport.ru/showthread.php?t=119372&highlight=input+cleaner)

StephenKay
07-07-2008, 09:43 PM
Uhmmm... thanks, but for example, say that I want to add a variable to the string:

showthread.php?goto=newpost&t=XXXXX

such that it would be:

showthread.php?goto=newpost&t=XXXXX&translate=en_fr

In the showthread.php code, they do things like:

switch($vbulletin->GPC['goto'])
{
case 'newpost':

...so I am wondering how to get my variable into that array, or is there some other way I should be trying to read this...

Dismounted
07-08-2008, 05:58 AM
// run it through the cleaner
$vbulletin->input->clean_gpc('g', 'translate', TYPE_STR);

// access it like so
echo $vbulletin->GPC['translate'];
If you are using it directly in a query, make sure you use escape_string(). If you are displaying it on a page, make sure you use TYPE_NOHTML instead.

StephenKay
07-08-2008, 10:54 PM
Thank you! worked great. :)