vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Allowed Variables (https://vborg.vbsupport.ru/showthread.php?t=100502)

Cash4Cookies 11-09-2005 11:51 PM

Allowed Variables
 
Hello Everyone!

I had a script running perfectly fine in VBulletin 3.0.x which allowed me to do this:

Basically, the script is offers.php and if you go to offers.php?action=blah then it registers action=blah like PHP would normally do, however, VB blocks this and only allows certain variables go through as *WAS* defined in init.php:

$_allowedvars

Now, I upgraded to VB 3.5.x and I just can't find where on Earth they moved the $_allowedvars so that I can throw all the variables in there.

Anyone know where they moved it?

Yes, I searched numerous times with numerous keywords. Result: nada.

Thanks in advance,
Matt

Sorry for the bump, I just really need this answered. Can anyone help? TIA

sgtryan 11-10-2005 08:09 PM

This is interesting, I would like an answer for this too! :P

akanevsky 11-10-2005 08:19 PM

I don't know why they would possibly need this.
With GPC, the GLOBALS cleanup becomes useless, so I suppose they removed that code.

sgtryan 11-10-2005 08:57 PM

Say you are creating a script that integrates with vBulletin.

The script: test.php

Inside of test.php (which is integrated and includes global.php) includes:

Code:

if($action == "blah")
{

echo ("hi");
}

Now, if you go to http://url.com/forum/test.php?action=blah

It only sees test.php without the declartion of "action" being "blah." In the earlier version of VB, you could just add in "action" to the "allowedvars" in init.php and bam, that fixed the problem.

I am just trying to find out where on earth that went in 3.5.x

Adrian Schneider 11-10-2005 09:34 PM

PHP Code:

if ($_GET['action'] == 'blah')
{
    echo 
'hi';


or

PHP Code:

$vbulletin->input->clean_array_gpc('g', array(
    
'do' => TYPE_STR,
    
'threadid' => TYPE_INT,
    
'action' => TYPE_STR
));

if (
$vbulletin->GPC['action'] == 'value')
{
    echo 
'eggnog';


If you are going to use the values for anything other than script nav, you should pass it through the gpc functions first to sanitize the data.

kbadr 11-14-2005 06:26 PM

Can $vbulletin->GPC be accessed from a style template, though?

The reason that $_allowedvars was needed in previous versions was that there was VB code that explicitly called "deregister_globals" on anything that was not in the $_allowedvars array.

Somewhere in the new version, similar code is being executed (though not with the deregister_globals function -- I grep'd for it), because the globals I've defined are getting cleared out.

akanevsky 11-14-2005 07:26 PM

No, you may not access GPC from templates.
You must put
$myvar =& $vbulletin->GPC['myvar'];
if you want to use the variable in a template (note the "&" sign - it establishes a reference rather than copying the variable - for memory saving purposes).

Quote:

Somewhere in the new version, similar code is being executed (though not with the deregister_globals function -- I grep'd for it), because the globals I've defined are getting cleared out.
You should not be defining globals unless it's after you've included global.php.

sgtryan 11-15-2005 03:38 AM

Problem has been solved.

I placed a $_GET on all of my variables, passes through globals.php just fine.

Thanks SirAdrian.

Marco van Herwaarden 11-15-2005 06:21 AM

There is no reason why you can't use $vbulletin->GPC[myvar] in templates.


All times are GMT. The time now is 08:40 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01220 seconds
  • Memory Usage 1,736KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete