The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Reading $_POST in PHP / vB
New at php and vB:
I am using PHP direct-eval and using $_POST to read posted data but it seems it is not available with vB? I can not read the passed variable name / value: PHP Code:
HTML Code:
content.php?305&mystr=hi What are my options to pass / read data with vB / php? I would like to have a simple pull-down menue and read it's value at post / submit, posting to the same page. Is there another / better way to do this? I also have a related post problem discribed here: https://vborg.vbsupport.ru/showthread.php?t=248700 Any input appreciated... |
#2
|
||||
|
||||
As far as input ($_POST/$_GET/etc), try reading this:
http://www.vbulletin.com/docs/html/codestandards_gpc So, for example: PHP Code:
PHP Code:
|
#3
|
|||
|
|||
Many thanks!
Looks exactly like what I needed to progress. I am trying to use this in a php direct eval page and php gadget. |
#4
|
|||
|
|||
Sorry but I am stuck on the first line. Pasted this into a php direct eval page:
PHP Code:
HTML Code:
Fatal error: Call to a member function clean_gpc() on a non-object in /var....../phpeval.php(97) : eval()'d code on line 1 |
#5
|
|||
|
|||
Try this:
vB::$vbulletin->input->clean_gpc('r', 'mystr', TYPE_STR); |
#6
|
|||
|
|||
Are you sure that $vbulletin is in scope?
Try adding a: PHP Code:
|
#7
|
|||
|
|||
You also need to understand the difference between GET, POST and REQUEST. In general...
GET = Anything passed via a URL POST = Anything passed via an input (<input type=...etc>) REQUEST = All GET, POST and COOKIE data. Using these with vB and not cleaning them with $vbulletin->input->clean.. is bad practice as this could possibly introduce rogue code into the system. This code.. Code:
$vbulletin->input->clean_gpc('r', 'mystr', TYPE_STR); It's best to narrow down what you need with Code:
$vbulletin->input->clean_gpc('p', 'mystr', TYPE_STR); Code:
$vbulletin->input->clean_gpc('g', 'mystr', TYPE_STR); |
#8
|
|||
|
|||
I'm not an expert on the matter, but I agree with what nhawk says above, except that I think I'd make the decision on using GET, POST, or REQUEST based on if I thought the script was useful as something that would be used as a link or url. That is, even if you're using it to process form data, if you could see it being useful for someone to enter the paramters in a url or to create a link to it, then you could use REQUEST instead of POST.
Also, I think it's important to note that calling clean_gpc() with TYPE_STR does almost nothing to the value, so you still need to be careful if you're using it in a database query or including it directly in the output. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|