lehrfeld
03-30-2005, 05:12 PM
I have this JavaScript I got from some site that can redirect someone to a different page automatically based on two criteria: (1) if they're not signed in to the site, and (2) if they're username is a list of usernames to block. I figure that if this "decision" can be made based on their usernames, then can't the code be switched around to (1) block anyone not signed in (which it already does), but also to (2) only allow people who are on a list of usernames to allow? It would redirect anyone not on that list and anyone not signed into the site as well to a different page, to be specified by me. So I have this code, but I don't know how to edit it to make that change. I'm really sorry if I'm being confusing, but if you've followed this so far and you can help me out, I'd really appreciate it. Thanks so much! Here's the code:
This part is in my Custom Header box:
<script LANGUAGE="JavaScript">
function redirect () {
location.href = 'http://www.albinoblacksheep.com/flash/youare.swf';
}
</SCRIPT>
This part is in my Website Stats box:
<script language="javascript">
function getXName() {
for (var i = 0; i < document.links.length; i++) {
if (document.links[i].href.substring(0,38)=="http://www.xanga.com/private/home.aspx") {
var link = document.links[i];
var text = document.all ? link.innerText : link.text ? link.text : '';
return text;
break;
}}
return null;
}
xName = getXName();
if (xName == 'USERNAME' || xName == 'USERNAME' || xName == null) {
redirect();
}
</script>
Thanks so much for the help!
- Jonathan
This part is in my Custom Header box:
<script LANGUAGE="JavaScript">
function redirect () {
location.href = 'http://www.albinoblacksheep.com/flash/youare.swf';
}
</SCRIPT>
This part is in my Website Stats box:
<script language="javascript">
function getXName() {
for (var i = 0; i < document.links.length; i++) {
if (document.links[i].href.substring(0,38)=="http://www.xanga.com/private/home.aspx") {
var link = document.links[i];
var text = document.all ? link.innerText : link.text ? link.text : '';
return text;
break;
}}
return null;
}
xName = getXName();
if (xName == 'USERNAME' || xName == 'USERNAME' || xName == null) {
redirect();
}
</script>
Thanks so much for the help!
- Jonathan