<%
Dim xmldoc,nodeList,node,i,j
'create and load your xml document
Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")
xmldoc.async = false
xmldoc.load(Server.MapPath("/portal/chat/chat_emotes.xml"))
'check for errors
'P/S: you can also validate here against your schema
if xmldoc.parseError.errorCode=0 Then
'create a list of all plants
Set nodeList = xmldoc.documentElement.getElementsByTagName("emote")
&nbs p;
'navigate list and print records
for i = 0 to xmlDoc.documentElement.childNodes.length -1
Set node = nodeList(i)
response.Write(node.ChildNodes(2).Text & " " & cInt(node.ChildNodes(1).Text) & "<br>")
x = len(node.ChildNodes(2).Text)
' Check whether or not this emote is the one that has been keyed in .....
If left(msg, x) = trim(lcase(node.ChildNodes(2).Text)) then
' Strip out the actual emote
tempUsername = replace(lcase(msg), trim(lcase(node.ChildNodes(2).Text)), "")
' Make sure we only keep in the name of the user the emote is for
tempUsername = trim(tempUsername)
' Now check to see whether this is an admin only emote
If cInt(node.ChildNodes(1).Text) = 1 then
' Only allow admins to use admin emotes
If blnAdmin = True then
blnIsEmote = True ' Set the is emote variable to true
strTempMsg = node.ChildNodes(4).Text
' Strip out the nasty stuff from the variable :-D
msg = replace(strTempMsg, tempUsername, strusername)
' End admin only check
End If
' Check to see whether or not this is a moderator emote
ElseIf cInt(node.ChildNodes(1).Text) = 3 then
' Only allow admins/mods to use mod emotes
If blnAdmin OR blnModerator then
blnIsEmote = True ' Set the is emote variable to true
strTempMsg = node.ChildNodes(4).Text
' End admin/mod only check
End If
' If this is an emote for any other user group
Else
' Now check that the user is actually authorised to type the emote
If intGroupID => cInt(node.ChildNodes(1).Text) then
blnIsEmote = True ' Set the is emote variable to true
' Or if the user is not authorised to view the emote return a bot message to them
Else
' End the authorisation check for this emote
End If
' End check to see if this is for an administrator/ any other user group
End If
' End check to see whether the emote is the one that has been keyed in
End If
Next
&nbs p;
'clear objects & free memory
Set node = Nothing
Set nodelist = Nothing
' If there is an error with the XML then we need to write that out and show to the user
Else
msg = "<font color=red>" & replace(xmldoc.parseError.reason, """", "\""") & "</font>"
End If
'clear objects & free memory
Set xmldoc = Nothing
If blnIsEmote = true then
response.Write("true")
Else
response.Write("false")
End If
%>