The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Plugins and Agents and Scripts, Oh my...
And I thought that I was trying something simple...
I have a little plugin, short and stout: PHP Code:
PHP Code:
sAgent = Request.ServerVariables ("HTTP_USER_AGENT") I'd like to disregard requests from web crawlers. If I request Rotator.asp from the browser, everything's fine. Once I embed it as shown above into the PHP Scripting and template in vBulletin, sAgent always returns an empty string. Googling, I stumbled on this, but don't know to what extent it's true: "file("yoururl"); will read the page and send an empty UA [User Agent] by default, this is sometimes done to filter your page, remove javascript, flash or java."I expect that file and file_get_contents act in a similar way in this regard (?). My question: is there any way to get at the user agent within the asp within the plugin called by PHP script within the VBulletin template? Thanks in advance for any input. |
#2
|
||||
|
||||
Add a GET variable to the end of the URL string appending the UA, maybe?
|
#3
|
|||
|
|||
Thanks for the prompt reply. I'm afraid I don't see what you're suggesting, though.
Within the ASP the syntax is correct and works fine outside of the scripted PHP VBulletin environment. It seems as if the environment available when processing the ASP doesn't give access to the request elements (?) somehow. |
#4
|
||||
|
||||
Exactly - so pass the variable from within PHP onto the ASP application (e.g. as a GET variable on the end of the URL).
|
#5
|
|||
|
|||
...the light slowly dawns, even on me.
Last bonus question (honest) - do you happen to know the vBulletin / PHP syntax of the user agent from within a header template? I've been coding all manner of things for years, but have had PHP foisted on me to support the forum. Thanks from the other side of the planet. |
#6
|
||||
|
||||
PHP Code:
|
#7
|
|||
|
|||
Superb.
It took a bit more tweaking than I thought, but for anyone who cares, the final plugin code looks like this: PHP Code:
sAgent = Request.QueryString ("UA") and all is right with the world. Thanks for your help! |
#8
|
||||
|
||||
Instead of doing a S&R on the string, use rawurlencode(). I'm sure ASP has a "reverse" function.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|