The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Conditional Help
Hi guys
I need a little help and i hope that one of you guys can help me here i'm using the conditional below, in my header Code:
<if condition="$bbuserinfo['usergroupid'] == x"> <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.ukbusinesslive.co.uk/warning.html"> </if> Is there a way to make a conditional run once and then end?? Thanks in advance Gerry |
#2
|
||||
|
||||
Try:
Code:
<if condition="THIS_SCRIPT != "index" && $bbuserinfo['usergroupid'] == x"> <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.ukbusinesslive.co.uk/warning.html"> </if> |
#3
|
|||
|
|||
Thanks Tiger, will give it a shot
|
#4
|
||||
|
||||
Are you saying when you get redirected to http://www.ukbusinesslive.co.uk/warning.html then it keeps repeating?
|
#5
|
|||
|
|||
Quote:
Firstly the above url is only an example its not working, What i've done is written a piece of code which re-directs back to the forum upon completion, But to get someone to go to that code when they type the forums url i used this conditional Code:
<if condition="$bbuserinfo['usergroupid'] == x"> <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.ukbusinesslive.co.uk/warning.html"> </if> is there a way that the above conditional can be changed, so that it onlt works the once?? The only other way would be with some form of cookie control using javascript, like the code below?? Code:
var expDays = 1; How long the cookie lasts for var page = "warning.html"; var windowprops = "width=100%,height=100%,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes"; function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie (name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } function DeleteCookie (name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = GetCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); } var exp = new Date(); exp.setTime(exp.getTime() + (expDays*24*60*60*1000)); function amt(){ var count = GetCookie('count') if(count == null) { SetCookie('count','1') return 1 } else { var newcount = parseInt(count) + 1; DeleteCookie('count') SetCookie('count',newcount,exp) return count } } function getCookieVal(offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function checkCount() { var count = GetCookie('count'); if (count == null) { count=1; SetCookie('count', count, exp); window.open(page, "", windowprops); } else { count++; SetCookie('count', count, exp); } } // End --> </script> |
#6
|
||||
|
||||
Why don't you have the redirect pass a variable and if that variable exists then don't redirect anymore?
User gets redirected to http://www.ukbusinesslive.co.uk/warning.html and then when that is done, they get sent back to index.php except the url would be index.php?myscript=done. And then on the page, if $_GET[myscript] == done, don't redirect again? A cookie would work also (as you said). Look in the API to see about a function to set cookies using vB. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|