Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu dieser Vergleichsansicht

nettalk:scripting:webserver [2006/04/12 11:15]
80.143.24.219
nettalk:scripting:webserver [2006/04/19 22:55] (aktuell)
84.150.76.181
Zeile 1: Zeile 1:
 +====== Webserver ======
 +===== Das Script =====
  
 +<code vb>
 +#​NewScriptBegin WebServer
 +
 +Dim MyConn
 +Dim MyWebPage
 +Dim MyNick
 +
 +Sub Load()
 +  OpenPort 80, 0, 1
 +  MyWebPage = ReadFile("​index.htm"​)
 +End Sub
 +
 +Sub DCCServAccept(LocalPort,​ RemoteIP, ConnID)
 +  MyConn = ConnID
 +End Sub
 +
 +Sub RecvDCCMsg(Text,​ Nick, FrameID, ConnID)
 +  if MyConn = ConnID Then
 +    if len(Text) = 0 Then
 +      OutText = Replace(MyWebPage,​ "<% CHANNEL %>",​ GetChannels)
 +      OutText = Replace(OutText,​ "<% NICK %>",​ MyNick)
 +      OutText = Replace(OutText,​ "<% DATE %>",​ Longdate)
 +      SendData "​HTTP/​1.1 200 OK", ConnID
 +      SendData "​Server:​ Nettalk/6 (Windows)",​ ConnID
 +      SendData "​Content-Length:​ " & (Len(OutText)),​ ConnID
 +      SendData "​Connection:​ Keep-Alive",​ ConnID
 +      SendData "​Content-Type:​ text/html; charset=iso-8859-1"​ + Chr(13) + Chr(10) + Chr(13)+ Chr(10) + OutText, ConnID, 1
 +    End if
 +  End if
 +End Sub
 +
 +Function GetChannels()
 +  Data=""​
 +  uri = ""​
 +  i=1
 +  do until i > FrameCount
 +    i2 = GetConn(GetFrameByIndex(i))
 +    MyNick = Getval(GetConn(GetFrameByIndex(i)),​5)
 +    if i2 > 0 and left(GetCaption(GetFrameByIndex(i)),​1)="#"​ Then
 +      nick = Getval(GetConn(GetFrameByIndex(i)),​2)
 +      uri = "​irc://"​ & Getval(GetConn(GetFrameByIndex(i)),​2) & "/"​ & GetCaption(GetFrameByIndex(i))
 +      Data=Data & "<a href=" & Chr(34) & uri & Chr(34) & ">"​ & uri & "</​a><​br>"​
 +    End if
 +    i=i+1
 +  loop
 +  GetChannels = Data
 +End Function
 +</​code>​
 +
 +
 +
 +===== Die HTML-Seite =====
 +
 +Der Inhalt muss als index.htm im Nettalkverzeichnis liegen
 +
 +<code xml>
 +<​html>​
 +
 +<​head>​
 +<​title>​Nettalk</​title>​
 +</​head>​
 +
 +<body bgcolor="#​E2E3E9"​ style="​font-family:​ Verdana">​
 +
 +<div align="​center">​
 + <br>
 + <table border="​0"​ width="​600"​ id="​table1"​ cellpadding="​5"​ cellspacing="​0"​ bgcolor="#​FFFFFF">​
 + <​tr>​
 + <td bgcolor="#​3366FF">​
 + <a href="​http://​www.ntalk.de"><​span style="​text-decoration:​ none">​
 + <font size="​7"​ color="#​FFFFFF">​Nettalk-Status</​font></​span></​a>​
 + </​td>​
 + </​tr>​
 + <​tr>​
 + <​td><​br>​
 + <font size="​5"><​% NICK %></​font>​
 + <​br>​
 + <​br>​
 + <% NICK %> ist in:
 + <​br>​
 + <​br>​
 + <% CHANNEL %>
 + <​br>​
 + <​br>​
 + </​td>​
 + </​tr>​
 + <​tr>​
 + <td bgcolor="#​C0C0C0">​Datum:​ <% DATE %></​td>​
 + </​tr>​
 + </​table>​
 +</​div>​
 +
 +</​body>​
 +
 +</​html>​
 +</​code>​

Eigene Werkzeuge