Avatar billede python Nybegynder
27. oktober 1999 - 03:16 Der er 3 kommentarer og
1 løsning

Har ændret lidt på activeserverpages.dk's chat .. meen :

Paster lige det relevante (Jeg smider source koden op når jeg engang har det til at virke ..)
    strMessage = "<font face=Verdana size=2>" & Server.HTMLEncode(Trim(Request.Form("message")))
if strMessage <>"" then
strMessage = CStr(Replace(strMessage,"'","`"))
strMessage = CStr(Replace(strMessage,"<","&lt;"))
strMessage = CStr(Replace(strMessage,">","&gt;"))
strMessage = CStr(Replace(strMessage,":)","<img src='images/smiley1.gif'>"))
strMessage = CStr(Replace(strMessage,";)","<img src='images/smiley2.gif'>"))
strMessage = CStr(Replace(strMessage,":(","<img src='images/smiley3.gif'>"))
strMessage = CStr(Replace(strMessage,":|","<img src='images/smiley4.gif'>"))
strMessage = CStr(Replace(strMessage,":@","<img src='images/smiley5.gif'>"))
strMessage = CStr(Replace(strMessage,":?","<img src='images/smiley6.gif'>"))
strMessage = CStr(Replace(strMessage,":!","<img src='images/smiley7.gif'>"))
strMessage = CStr(Replace(strMessage,":*","<img src='images/smiley9.gif'>"))

    ' // Her ryddede han chat loggen hvis den oversteg 10000 caracters .. :\ dårlig ide .. jeg laver 10 msg linier istedet
APPLICATION.LOCK

Application("txt10") = Application("txt9")
Application("txt9") = Application("txt8")
Application("txt8") = Application("txt7")
Application("txt7") = Application("txt6")
Application("txt6") = Application("txt5")
Application("txt5") = Application("txt4")
Application("txt4") = Application("txt3")
Application("txt3") = Application("txt2")
Application("txt2") = Application("txt1")
Application("txt1") = "<font face=Verdana size=2 color=""#0000FF"">** " & Session("nick") & " enters chatroom **</font>"
APPLICATION.UNLOCK
'    If Len(Application("ChatLog")) > 10000 Then
'        Application.Lock
'        Application("ChatLog") = ""
'        Application.UnLock
'    End If

'    If Request.Form("Action") = "Send" Then
'        If Len(strMessage) > 0 Then
'            strChatContent = strUser & strMessage & "<br>" & Application("ChatLog")
'            Application.Lock
'            Application("ChatLog") = strChatContent
'            Application.UnLock
'        End If
'    End If

If not Request.Form("Action")="" THEN
APPLICATION.LOCK
Application("txt10") = Application("txt9")
Application("txt9") = Application("txt8")
Application("txt8") = Application("txt7")
Application("txt7") = Application("txt6")
Application("txt6") = Application("txt5")
Application("txt5") = Application("txt4")
Application("txt4") = Application("txt3")
Application("txt3") = Application("txt2")
Application("txt2") = Application("txt1")
Application("txt1") = "<font face=Verdana size=2 color=" & Server.HTMLEncode(Trim(Request.Form("color"))) & "><b>" & Session("name") & "<font face=Verdana size=1>&nbsp;" & time() & "</b>: " & strMessage
APPLICATION.UNLOCK
END IF

<%=Application("txt10")%><BR>
<%=Application("txt9")%><BR>
<%=Application("txt8")%><BR>
<%=Application("txt7")%><BR>
<%=Application("txt6")%><BR>
<%=Application("txt5")%><BR>
<%=Application("txt4")%><BR>
<%=Application("txt3")%><BR>
<%=Application("txt2")%><BR>
<%=Application("txt1")%><BR>

' her kommer problemet vidst :\ serveren skriver :
' Error Type:
' Microsoft VBScript compilation (0x800A0400)
' Expected statement
' /asp/chat.asp, line 79
' <%=Application("txt10")
' Og jeg har lavet en global.asa fil der adder alle Application's som "" .. men virker ik ? :
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
Application("txt1")=""
Application("txt2")=""
Application("txt3")=""
Application("txt4")=""
Application("txt5")=""
Application("txt6")=""
Application("txt7")=""
Application("txt8")=""
Application("txt9")=""
Application("txt10")=""
End Sub
</SCRIPT>
Skal jeg ligge global.asa et bestemt sted .. og den skulle køre det der onstart ik ? altså ved en restart .. har også prøvet bare at lave en ASP fil med det der er i global.asa og køre den .. men det virker heller ikke ..

håber der er en der kan hjælpe ;) .. så vi kan få en lidt sjovere chat ind ;)
Avatar billede python Nybegynder
27. oktober 1999 - 03:18 #1
DOHHHHH hehe .. ja HOLD KÆFT ! har fundet en mini fejl *G*
Avatar billede python Nybegynder
29. oktober 1999 - 18:34 #2
bla
Avatar billede python Nybegynder
29. oktober 1999 - 18:35 #3
bla2
Avatar billede python Nybegynder
29. oktober 1999 - 18:35 #4
bla3
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester