Tempcode for templates/LOGIN_SCREEN.tpl
Posted
#3400
(In Topic #673)
Is there a way to redirect on-the-fly?
I'm working on templates/LOGIN_SCREEN.tplWhen the site is CLOSED, people have to register and login, in order to use the site. To do that, they first meet a screen that tells then they have to register, and they click OK to be forwarded to the login screen (LOGIN_SCREEN.tpl). On this closed-site welcome screen, I've removed the OK button and I've added 5 buttons of my own. Each button links to LOGIN_SCREEN.tpl, but also carries with it a unique number in the url (GET, POST methods).
When LOGIN_SCREEN.tpl is loaded, I use…
Code
{+START,IF,{$EQ,{$_GET,my_value_variable},555}}
{+END}
yes
{+END}
…to get the value of the passed variable.
If the value of the passed variable is equal to 555, I want to redirect the page immediately to an off-site webpage. So as soon as they are sent to the login screen, if the passed variable is 555, I want the page to go to a different page without a link or anything. I can't find the Tempcode I'm looking for to do that. Anyone have any ideas?
Posted
The login form actually supports a 'redirect' GET parameter. So just pass in like &redirect=http://... differently on each button.
Posted
If that's right, then on adding the ip to the database, should the ip be masked at that point (44.55.66.*), and then added?
for cms_banned_ip...
ip (varchar) is the masked ip?
i_ban_positive (tinyint) is a boolean for what purpose?
i_ban_until (int 10) is the unix format date to lift the ban...but will the system monitor this by itself and lift the ban by itself when the unix-time is met?
i_descrip (longtext) is just the description of the ban?
Is there any known Tempcode to ban an ip, or should I just create some php to do it as perhaps a miniblock, and then call the miniblock? ( I hope to put this all in LOGIN_SCREEN.tpl )
Posted
For banning an ip (not the member because they can simply create a new account), it's just a matter of adding an entry to cms_banned_ip…is that correct?
Yes.
You but it is easier to do this:
Code
require_code('failure');
add_ip_ban('12.34.56.78');
should the ip be masked at that point (44.55.66.*), and then added?
Your choice.
p (varchar) is the masked ip?
i_ban_positive (tinyint) is a boolean for what purpose?
i_ban_until (int 10) is the unix format date to lift the ban…but will the system monitor this by itself and lift the ban by itself when the unix-time is met?
i_descrip (longtext) is just the description of the ban?
If i_ban_positive is zero then this is used internally to represent an IP that has been seen not to be banned by a RBL (DNS remote block list). i.e. we're using it internally as a cache value, as we only do RBL checks once per IP. It's only peripherally related to the IP banning you're thinking of.
Rest is correct.
Is there any known Tempcode to ban an ip, or should I just create some php to do it as perhaps a miniblock, and then call the miniblock? ( I hope to put this all in LOGIN_SCREEN.tpl )
Well, definitely not in Tempcode - as that's for display, not for backend actions.
You could put it in a miniblock code, although that's a bit hackerish.
If you're specifically trying to just target the login page, it is a clean enough solution regardless.
Depending on exactly what you're trying to do here, a startup hook may also be an option.
2 guests and 0 members have recently viewed this.
