Login
·
Signup
Home
»
XtGem
»
Tips and code snippets
»
xt varible with banned user?
» View post
Graham
GIGAWAP
Try something like this
<!--parser:xtscript--> var $banned_names= comma,separated,list,of,banned,names var $len =call strlen $val=$banned_names var $self=<xt:url /> get logout if $logout call cookie::delete $name=mycookie;$force_current=1; endif get username var $username = call cookie::get $name=mycookie;$default=$username var $checkname = call strtolower $val=$username var $start=0 @loop var $end= call strpos $haystack=$banned_names,;$needle=,;$offset=$start var $value= call substr $val=$banned_names;$start=$start;$length=($end-$start) if $value == $checkname del $username print <b>Name not allowed</b><br /> goto @end endif if $end < $len var $start=($end+1) goto @loop endif @end if $username call cookie::set $name=mycookie; $val=$username; $expire=99999999;$force_current=1; print {{<span class="">$username</span> <form action="$self" method="post"> <input name="logout" type="hidden" value="1"/> <input type="submit" value="logout" /> </form>}} else print {{ <form action="$self" method="post"> <input name="username" type="text" value=""/> <input type="submit" value="login" /> </form>}} endif <!--/parser:xtscript-->
#
2015-02-10 14:33 (edited 2015-02-10 14:35 by
Graham
) ·
(0)
Home
»
XtGem
»
Tips and code snippets
»
xt varible with banned user?
» View post
Online: Guests: 1
Log in