3Talks 港人自講討論區 » Xanga & MSN Space 部落格專區 » 【xanga】Private Blogging Script


2006-8-17 11:37 PM [kae′]
【xanga】Private Blogging Script

PLACE IN WEBSITE STATS

<!-- begin code provided by createblog.com -->
<script>

// Private Blogging
// By Paul Chen
//  --- Coyote
// Put your list of (exact) names here.
// Make sure they are all lowercase.
// "join" = unregistered viewers
// Go to end of the script and change
// the custom alert message.

var allowed = new Array(
"USERNAME HERE",
"USERNAME HERE",
"USERNAME HERE",
"USERNAME HERE",
"USERNAME HERE"
)

var links = document.getElementsByTagName('a');
name="";

for(i=0;i<links.length;i++)
{
if(links.innerText.match(/xanga/i) && links[i+2].innerText.match(/sign out/i)){
i++;
if(links.href.match('/private/home.aspx') || links.innerText.match('join')){
  name = links.innerText.toLowerCase();
  break;
}  
}
}
enter=false;

for(j=0;j<allowed.length;j++)
{
users = allowed[j];
if(users.indexOf(name)==0 && users.length==name.length){
enter=true;
break;
}
}

if(enter!=true){
alert('Sorry, this is a private blog!'); //change the message
history.go(-1);
}
</script>
<!-- end code provided by createblog.com -->

頁: [1]


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.