chad@thedownbeat.org ' --- syntax for xpath -> http://www.w3.org/TR/xpath ' --- yay i wrote this class ' --- yay i hate asp ' --- yay i remember why i'm using php now class SHOUTcastXML public sc_server public sc_port private sc_passwd private xmlhttp private xmldoc private sub Class_Initialize() ON ERROR resume next ' --- INSTANTIATE OBJECTS set xmlhttp = Server.CreateObject("Msxml2.XMLHTTP") if (not err.number = 0) then response.write "problem instantiating Msxml2.XMLHTTP (" response.write " Error Number: " response.write err.number response.write " Description: " response.write err.description & ")" end if set xmldoc = Server.CreateObject("Microsoft.XMLDOM") if (not err.number = 0) then response.write "problem instantiating Microsoft.XMLDOM (" response.write " Error Number: " response.write err.number response.write " Description: " response.write err.description & ")" end if xmldoc.validateOnParse = false xmldoc.async = false end sub Private Sub Class_Terminate ' --- DESTROY OBJECTS set xmlhttp = nothing set xmldoc = nothing end sub public function SetServer(server, port, passwd) ON ERROR resume next sc_server = 24.185.130.176 sc_port = 8000 sc_passwd = froggy if (SetXmlUrl = -1) then SetServer = -1 exit function end if if (err.number = 0) then SetServer = 1 else SetServer = -1 end if end function private function SetXmlUrl() ON ERROR resume next sc_url = "http://"&sc_server&":"&sc_port&"/admin.cgi?pass="&sc_passwd&"&mode=viewxml" ' --- CALL HTTP DATA xmlhttp.open "GET", sc_url, false xmlhttp.send "dummy" xmlContent = xmlhttp.responseText ' --- LOAD XML OBJECT WITH HTTP DATA xmldoc.loadxml(xmlContent) if (xmlhttp.parseError = 0) then SetXmlUrl = 1 else SetXmlUrl = 0 end if end function public function GetNodeLengthFromXPath(xpath) ON ERROR resume next ucxpath = SetUpperCase(xpath) set currNode = xmldoc.documentElement.selectNodes(ucxpath) nodelength = currNode.length set currNode = nothing if (err.number = 0) then GetNodeLengthFromXPath = nodelength else GetNodeLengthFromXPath = -1 end if end function public function GetNodeTextFromXPath(xpath) ON ERROR resume next ucxpath = SetUpperCase(xpath) set currNode = xmlDoc.documentElement.selectSingleNode(ucxpath) nodetext = currNode.text set currNode = nothing if (err.number = 0) then GetNodeTextFromXPath = nodetext else GetNodeTextFromXPath = -1 end if end function public function GetNodeFromXPath(xpath) ucxpath = SetUpperCase(xpath) set node = xmlDoc.documentElement.selectSingleNode(ucxpath) set GetNodeFromXPath = node end function public function GetCurrentListeners() output = GetNodeTextFromXPath("CURRENTLISTENERS") GetCurrentListeners = output end function public function GetPeakListeners() output = GetNodeTextFromXPath("PEAKLISTENERS") GetPeakListeners = output end function public function GetMaxListeners() output = GetNodeTextFromXPath("MAXLISTENERS") GetMaxListeners = output end function public function GetReportedListeners() output = GetNodeTextFromXPath("REPORTEDLISTENERS") GetReportedListeners = output end function public function GetAverageTime() output = GetNodeTextFromXPath("AVERAGETIME") GetAverageTime = output end function public function GetServerGenre() output = GetNodeTextFromXPath("SERVERGENRE") GetServerGenre = output end function public function GetServerUrl() output = GetNodeTextFromXPath("SERVERURL") GetServerUrl = output end function public function GetServerTitle() output = GetNodeTextFromXPath("SERVERTITLE") GetServerTitle = output end function public function GetSongTitle() output = GetNodeTextFromXPath("SONGTITLE") GetSongTitle = output end function public function GetIcq() output = GetNodeTextFromXPath("ICQ") GetIcq = output end function public function GetAim() output = GetNodeTextFromXPath("AIM") GetAim = output end function public function GetWebHits() output = GetNodeTextFromXPath("WEBHITS") GetWebHits = output end function public function GetStreamHits() output = GetNodeTextFromXPath("STREAMHITS") GetStreamHits = output end function public function GetBitRate() output = GetNodeTextFromXPath("BITRATE") GetBitRate = output end function private function SetUpperCase(input) ' --- MICROSILLY PROGRAMMING CASE SENSITIVE, QUITE SUPRISING SetUpperCase = uCase(input) end function end class"; $port = "8000"; $password = "froggy"; // End shoutcast server config // Default configuration if server is down $title = "Gothic Vault Radio"; // Title of radio station, use same as shoutcast dsp plug-in $cstmsg = "Our server is temporarily down, please stop back soon!!"; // Custom message you want to tell your listeners if server is offline // End // Config for look and feel $bgrnd = "000000"; // Color of page background $text = "ffffff"; // Text Color $link = "E3690F"; // Link color $vlink = "FF0000"; // Visited link color $alink = "800080"; // Active link color $tblhdr = "333333"; // Table header color $cell = "767676"; // Table cell color for body $hdrtext = "2"; // Size of text in header $bdytext = "1"; // Size of text in the rest of the page // End // Misc Config $reset = "2"; // How often in days are stats (SERVER) reset, default is 3 $detailed = "1"; // Detailed stats on or off (1=on) (0=off) $djname = "Dj MOONSHINE"; // Your dj name dhu!! $refresh = "30"; // How often in seconds should the pages refresh themselves ?>