Hab das zwar kapiert aber das Funktioniert nicht.... ich will das der das der festen NetworkID zuweist.... hab das nun so gemacht aber der kann trotzdem noch das ausgeben.... ist das ein bug oder was??? PB 3.93 Release
Code: Alles auswählen
If Server = #True
SEvent.l = NetworkServerEvent()
If SEvent
ClientID.l = NetworkClientID()
Select SEvent
Case 1 ; When a new client has been connected...
Case 4 ; When a client has closed the connection...
Default
RequestLength.l = ReceiveNetworkData(ClientID, *Buffer, 2000)
a$ = PeekS(*Buffer)
MaxPosition = FindString(a$, Chr(13), 5)
Position = FindString(a$, " ", 5)
If Position < MaxPosition
RequestedFile$ = Mid(a$, 6, Position-5) ; Automatically remove the leading '/'
RequestedFile$ = Trim(RequestedFile$)
Else
RequestedFile$ = Mid(a$, 6, MaxPosition-5) ; When a command like 'GET /' is sent..
EndIf
If RequestedFile$ = ""
RequestedFile$ = DefaultPage$
EndIf
Abschnitt.s = StringField(RequestedFile$, 1, "?")
If Abschnitt = ""
Abschnitt = "index"
EndIf
If ClientLoggedIN = 0;
html_output$ = "<head><meta http-equiv='cache-Control' content='no-cache'><style type='text/css'> input {font-family: verdana, arial, san-serif, helvetica; color: black; font-size: 10;} body {font-family: verdana, arial, san-serif, helvetica; color: black; font-size: 10;} table {font-family: verdana, arial, san-serif, helvetica; color: black; font-size: 10; border-collapse: collapse; border-color: black} td{font-family: verdana, arial, san-serif, helvetica; color: black; font-size: 10; border-collapse: collapse; border-color: black} a:link {text-decoration: none; color: black} a:visited {text-decoration: none; color: black} a:active {text-decoration: none; color: black} a:hover {text-decoration: underline; color: black} </style></head>" + #CRLF$
html_output$ = html_output$+"<form action='"+Abschnitt+"' method='post'><table width='100%' height='100%'><tr><td align='center'><table cellpadding='1' cellspacing='1' border='1'><tr bgcolor='#cccccc'><td align='center'>Login</td></tr><tr bgcolor='#cccccc'><td><input name='pw'></td></tr><tr bgcolor='#cccccc'><td align='center'><input type='submit' Value='Login'></td></tr></table></td></tr></table></form>"+ #CRLF$
Post.s = Right(a$, Len(a$)-FindString(a$, #CRLF$+#CRLF$, 1)-3)
vorne.s = StringField(Post, 1, "=")
hinten.s = StringField(Post, 2, "=")
If hinten = "test"
ClientLoggedIN = 1
NewList ClientID.l()
AddElement(ClientID()): ClientID() = NetworkClientID()
NewList ClientLoggedIN.l()
AddElement(ClientLoggedIN()): ClientLoggedIN() = ClientLoggedIN
EndIf
StringLength.l = Len(html_output$)
*FileBuffer = AllocateMemory(StringLength+200)
*BufferOffset = BuildRequestHeader(*FileBuffer, StringLength, "text/html")
PokeS(*BufferOffset,html_output$,StringLength)
SendNetworkData(ClientID, *FileBuffer, *BufferOffset-*FileBuffer+StringLength)
FreeMemory(*FileBuffer)
EndIf
;If ClientLoggedIN = 1
; ForEach ClientID()
; If ClientID
; If ClientLoggedIN() = 1
; LoggedIN = 1
; ClientLoggedIN = 0
; EndIf
; EndIf
; Next
;EndIf
Debug NetworkClientID()
;If ClientLoggedIN=1
; ForEach ClientID()
; Next
;EndIf
If ClientLoggedIN = 1
ForEach ClientID()
Debug Str(ListIndex(ClientID())) + ": " + Str(ClientID()) + " - " + Str(ClientLoggedIN())
Debug Str(NetworkClientID()) +" - "+Str(ClientID())
If NetworkClientID() = ClientID()
If ClientLoggedIN() = 1
html_output$ = "<head><meta http-equiv='cache-Control' content='no-cache'><style type='text/css'> input {font-family: verdana, arial, san-serif, helvetica; color: black; font-size: 10;} body {font-family: verdana, arial, san-serif, helvetica; color: black; font-size: 10;} table {font-family: verdana, arial, san-serif, helvetica; color: black; font-size: 10; border-collapse: collapse; border-color: black} td{font-family: verdana, arial, san-serif, helvetica; color: black; font-size: 10; border-collapse: collapse; border-color: black} a:link {text-decoration: none; color: black} a:visited {text-decoration: none; color: black} a:active {text-decoration: none; color: black} a:hover {text-decoration: underline; color: black} </style></head>"+ #CRLF$
Select Abschnitt
Case "index"
html_output$ = html_output$+"<center>Willkommen auf der Weboberfläche vom BlackMP3-Player Version: 1.1 Beta3"+br$+ #CRLF$
html_output$ = html_output$+"<a href='index'>Zum Refreshen bitte hier Klicken</a></center>"+br$+br$+ #CRLF$
If Str(Lied) <> Str(0)
Post.s = Right(a$, Len(a$)-FindString(a$, #CRLF$+#CRLF$, 1)-3)
vorne.s = StringField(Post, 1, "=")
hinten.s = StringField(Post, 2, "=")
Select vorne
Case "item"
GetDataAlone.s = StringField(Post, 1, "&")
item.s = StringField(GetDataAlone, 2, "=")
GetDataAlone.s = StringField(Post, 2, "&")
aktion.s = StringField(GetDataAlone, 1, "=")
Select aktion
Case "del"
GadgetState.l = Val(item)
RemoveGadgetItem(#Playlist, GadgetState)
Case "select"
GadgetState.l = Val(item)
SetGadgetState(#Playlist, GadgetState)
EndSelect
html_output$ = html_output$+"<meta http-equiv='refresh' content='0; URL=index'> "+ #CRLF$
Case "play"
Play()
Case "stop"
Stop()
Case "resume"
Resume()
Case "pause"
Pause()
Case "close"
End
EndSelect
EndIf
html_output$ = html_output$+"<table align='center' cellpadding='1' cellspacing='1' border='1'>" + #CRLF$
If CountGadgetItems(#Playlist) <> 0
html_output$ = html_output$+"<form action='"+Abschnitt+"' method='Post'>"+ #CRLF$
html_output$ = html_output$+"<tr bgcolor='#cccccc'><td><Select name='item'>"+ #CRLF$
For zaehler=0 To CountGadgetItems(#Playlist)
option$ = GetGadgetItemText(#Playlist,zaehler,0)
If option$
If option$ = Lied
html_output$ = html_output$+"<option value='"+Str(zaehler)+"' selected>"+option$+"</option>"+ #CRLF$
Else
html_output$ = html_output$+"<option value='"+Str(zaehler)+"'>"+option$+"</option>"+ #CRLF$
EndIf
EndIf
Next
html_output$ = html_output$+"</select>"+ #CRLF$
html_output$ = html_output$+"<input type='submit' name='select' Value='Auswählen'><input type='submit' name='del' Value='Delete'></td></tr></form>"+ #CRLF$
EndIf
If Play
;lied$ = GetGadgetItemText(#Playlist,CurrentPlayLied,0)
doppelt$ = Chr(34)
;html_output$ = html_output$+"Zurzeit wird ist das Lied: "+lied$+" gespielt."+br$
html_output$ = html_output$+"<tr bgcolor='#cccccc'><td align='center'><input type='text' size='9' readonly value='"+PositionAudioZTime(Current)+"'><input type='text' size='9' readonly value='"+PositionAudioZTime(Total)+"'></td></tr>"+ #CRLF$
EndIf
If CountGadgetItems(#Playlist) <> 0
html_output$ = html_output$+"<form action='"+Abschnitt+"' method='post'><tr bgcolor='#cccccc'><td align='center'>"+ #CRLF$
html_output$ = html_output$+"<input type='submit' value='Play' name='play'><input type='submit' value='Pause' name='pause'><input name='resume' value='Resume' type='submit'><input name='stop' value='Stop' type='submit'>"+ #CRLF$
html_output$ = html_output$+"</td></tr></table></form>"+ #CRLF$
EndIf
If CountGadgetItems(#Playlist) = 0
html_output$ = html_output$+"<tr bgcolor='#cccccc'><td align='center'>Sie müssen erst mindestens ein Lied laden.</td></tr></table>"+ #CRLF$
EndIf
EndSelect
;SEND$ = Str(1)
;EndIf
EndIf
EndIf
Next
StringLength.l = Len(html_output$)
*FileBuffer = AllocateMemory(StringLength+200)
*BufferOffset = BuildRequestHeader(*FileBuffer, StringLength, "text/html")
PokeS(*BufferOffset,html_output$,StringLength)
SendNetworkData(ClientID, *FileBuffer, *BufferOffset-*FileBuffer+StringLength)
FreeMemory(*FileBuffer)
EndIf
EndSelect
EndIf
EndIf
wäre cool wenn da einer den fehler findet.....