weil ich weiß einfach nicht wie ich das NetWorkID Handling handhaben soll... :'(
hie rmal der jetzige Source mit mienen proben die aber irgendwie nicht gehn.... der scheint meine if zu ignorieren oder so....
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 t = 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"
t = 1
NewList shuffletest.user()
AddElement(shuffletest())
shuffletest()\networkid = NetworkClientID()
shuffletest()\login = 1
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 t = 1
ResetList(shuffletest())
While NextElement(shuffletest())
Debug shuffletest()\networkid
Debug shuffletest()\login
If shuffletest()\networkid = NetworkClientID()
If shuffletest()\login = 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
Wend
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