codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Cant quite get this code to work  Inny at 01:31 on Friday, April 21, 2006
 

It appears as it should but after updating blocklist, user is still visible, please help? This is for an ipb forum with templets.

[code]
<script>
var blocklist

function block()
{
getlist()
var span = document.getElementsByTagName('span')
if (span == null || blocklist.length <= 0) return false
blocklist = blocklist.split(', ')
for (x=0; x<blocklist.length; x++)
{
for (i=0; i<span.length; i++)
{
if (span.className == "normalname" && span.innerHTML.toLowerCase().match(blocklist[x].toLowerCase()))
{
var tempid = span
var found = 0
for (a=0; found!=1; a++)
{
var parenttable = tempid.parentNode
if (parenttable.tagName == "TABLE") var found = 1
tempid = parenttable
}
if (found == 0) return false

var div = parenttable.getElementsByTagName('div')
if (div == null) return false
var found2 = 0
for (b=0; b<div.length; b++)
{
if (div.className == "postcolor" && found2 != 1)
{
div.innerHTML = "<CENTER><FONT color='red'><B>Post Blocked</B></FONT><BR><A href='" + loc.substring(0,loc.indexOf('showtopic=')) + "act=UserCP&CODE=rblocker'>Manage Block List</A></CENTER>"
found2 = 1
}
else if (div.className == "postcolor" && found2 == 1) div.style.display = 'none'
}
}
}
}
}

function getlist()
{
var allcookies = document.cookie
if (allcookies == ""){ blocklist = ""; return false }
var pos = allcookies.indexOf("rblocker=")
if (pos == -1){ blocklist = ""; return false }
start = pos + 9
var end = allcookies.indexOf(";", start)
if (end == -1) end = allcookies.length
var value = allcookies.substring(start, end)

value = unescape(value)
blocklist = value
}

function setblocklist()
{
if (loc.match('act=UserCP&CODE=rblocker'))
{
getlist()
var e = document.getElementById('ucpcontent')
e.innerHTML = "<div class='maintitle'>Welcome to your control panel </div>" + "<div class='pformstrip'>Reply-Blocker List</div>"
e.innerHTML += ("\n<div align='center'><p>" +
"\nType in the names of the users whose posts you want to block<BR>" +
"\n<b>Separate each name with a comma and a space (e.g. billy, bob, joe)</b><BR> <BR>" +
"\n<form name='rblockerpage'><textarea cols='65' rows='7' name='userlist' class='forminput'>" + blocklist + "</textarea><BR>" +
"\n<input type='button' value='Update Reply-Blocker' class='forminput' onClick='writecookie()'></form></p></div>")
}
var ucpsection = document.getElementById('ucpmenu').getElementsByTagName('P')
for (x=0; x<ucpsection.length; x++)
{
if (ucpsection[x].innerHTML.match("Change Password"))
{
ucpsection[x].innerHTML += "<BR>· <a href='" + loc.substring(0,loc.indexOf('act=')) + "act=UserCP&CODE=rblocker'>Set Reply-Blocker</a>"
}
}
}

function writecookie()
{
var exp = new Date()
exp.setFullYear(exp.getFullYear() + 1)
var val = document.rblockerpage.userlist.value
document.cookie = "rblocker=" + escape(val) + "; expires=" + exp.toGMTString()
window.location = loc
}



var loc = window.location.toString()
if (loc.match('showtopic=')) window.onload=block
else if (loc.match('act=UserCP') || loc.match('act=Msg')) window.onload=setblocklist
</script>
[/code]










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Making a simple game
•  Re: Conversion
•  disable radio button
•  problem with recurssion
•  session values
•  Re: array names
•  how to call java script function in input tag ,that java script function written in another javascript file
•  Re: button color
•  Access denied error when submit form


Recent Articles
What is a pointer in C?
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net


© Copyright codetoad.com 2001-2006