The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
i have been working on a script for a few weeks now, and nearly at
final stages of releasing it, but i need help with the following PHP Code:
basically the above writes a cookies to block access, so the idea is if the statement above is true the redirect to a given $varaiable set in admincp |
#2
|
|||
|
|||
![]()
You could use the vbulletin function print_standard_redirect():
Code:
// ############################################################################# /** * Returns eval()-able code to initiate a standard redirect * * The global variable $url should contain the URL target for the redirect * * @param mixed Name of redirect phrase, or array if constructing a phrase. * @param boolean If false, use the name of redirect phrase as the phrase text itself * @param boolean Whether or not to force a redirect message to be shown * @param integer Language ID to fetch the phrase from (-1 uses the page-wide default) * @param bool Force bypass of domain whitelist check * * @return none (the session is re-directed). */ function print_standard_redirect($redir_phrase, $isphrase = true, $forceredirect = false, $languageid = -1, $bypasswhitelist = false) { |
#3
|
|||
|
|||
![]() Quote:
if so, all i need to do is register the variable as follows PHP Code:
|
#4
|
|||
|
|||
![]() Quote:
Code:
$vbulletin->url = $vbulletin->options['myredirect']; print_standard_redirect($redir_phrase); That assumes that $redir_phrase is a phrase name. If it's the actual text, then you would want the second parameter to print_standard_redirect to be false (it's true by default). Also, print_standard_redirect will use http headers to do a redirect so that the user won't see the message unless their browser doesn't support header redirects (I have no idea if that even happens at all these days). If you want to be sure that the message is displayed, use true for the third parameter. Edit: also I forgot that I had the vb3 code loaded when I copied the description of print_standard_redirect() above - I replaced it with the vb4 version. This brings up another issue: if you're redirecting to a url that isn't part of your site, you might need to set the "bypasswhitelist" parameter to true. |
#5
|
|||
|
|||
![]()
i am not sure if you understand
all my functions are called as PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
#6
|
|||
|
|||
![]()
I don't know if I understand either. Are you not able to call print_standard_redirect(), or is it that you don't think it does what you want? Why not this:
Code:
function blockAccess($message) { global $forbidbad, $badcookie, $myredir; if ($forbidbad == true) { writeCookie($badcookie, $message, $myredir); } global $vbulletin; $vbulletin->url = $myredir; print_standard_redirect('phrase_to_show'); } |
#7
|
|||
|
|||
![]() Quote:
Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' |
#8
|
|||
|
|||
![]()
oops - it had a typo, it was missing a ';'. I fixed it in my post above.
|
#9
|
|||
|
|||
![]() Quote:
ok i have some progress but now i am getting PHP Code:
![]() |
#10
|
|||
|
|||
![]()
Is that a message from somewhere else in your code?
Edit: Maybe try this: Code:
print_standard_redirect('phrase_to_show', true, false, -1, true); |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|