Was soll den diese hardkodierte "Uwe Zimmer"?? Und wieso wird die gesamte admin tabelle gel�scht, wenn er gekickt wird?
Claudius > -----Original Message----- > From: Thomas Beckert [mailto:[EMAIL PROTECTED]] > Sent: Freitag, 30. August 2002 12:50 > To: AspGerman Kaffeehaus > Subject: [aspdecoffeehouse] ich bin blind... > > > also das hat bestimmt am server gelegen... jetzt geht er > wieder flotter... > nur habe ihc nun das problem, dass ich bei meinem > seitenaufruf einen fehler > bekomme, mit dem ich nun rein gar nichts anfangen kann. > angeblich wird in zeile 1 ein objekt erwartet, was nicht da ist... > javascript fehler... aber in zeile eins steht bei mir nichts > mit java... > > hier mal der code (ist �brigens das herzst�ck meines chats - > wenn jemand > also verbesserungen sieht, ich bin ganz offen ... ): > > <% @LANGUAGE=VBSCRIPT %> > <% Response.Buffer = true > If (Session("loggedIn") <> "loggedIn") then > Response.Clear > response.redirect("chatroom_logout.asp") > else > > '************* FUNKTION ZUM UMWANDELN VON SQLSTRINGS IN JAVATAUGLICHE > STRINGS > function SQLString( stri ) > Dim neu > Dim neu2 > > if len(stri) = 0 or isnull(stri) then > SQLString = "NULL" > exit function > end if > > > neu = replace( stri, """", "\""" ) > > SQLString = neu > end function > '************************************************************* > ************** > ** > > > '*********** ZUR VERHINDERUNG DES CACHENS DER SEITE > > Response.Expires=0 > Response.AddHeader "Pragma","no-cache" > Response.AddHeader "cache-control", "no-store" > Response.Buffer = true > '**************************************************** > > '*************************************************** > ' Variablen f�r das Schreiben in die Datenbank werden definiert > ' newDate ist die amerikanische Formatierung des Datums, da die > ' SQL Abfrage dies verlangt > ' Es werden alle Eintr�ge selektiert, seit dem letzten Eintrag, der > ' ausgelesen wurde. > ' Startpunkt ist now beim Einloggen des Chats > > user = Session("name") > logintime = Session("loginZeit") > empfaenger = "alle" > > newdate = month(logintime) & "/" & day(logintime) & "/" & > year(logintime) & > " " & hour(logintime) & ":" & minute(logintime)& ":" & > second(logintime) > > set conn=Server.CreateObject("adodb.connection") > cnpath="DBQ=" & server.mappath("../cgi-bin/chat.mdb") > conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & cnpath > > sql = "SELECT * FROM chatdialog WHERE (sender = '"&user&"' > OR (empfaenger = > '"&empfaenger&"' OR empfaenger = '"&user&"')) AND datum > #" > & newdate & "# > ORDER BY datum DESC" > set RS = conn.Execute(sql) > > sql = "SELECT * FROM loggedIn ORDER BY name" > set RSLoggedIn = conn.Execute(sql) > > ' Ueberpruefen, ob Admin eingeloggt ist > sql = "SELECT * FROM admin" > set RS4 = conn.Execute(sql) > > if(NOT rs4.EOF) then > Session("AdminOn") = true > else > Session("AdminOn") = false > end if > > RS4.close > '************************************************************* > ************** > **************** > > '*********** UEBERPRUEFUNG DER NOCH WIRKLICH EINGELOGGTEN USER > ***************************** > ' Jeder User, der online ist, schreibt alle 5 Sekunden seine > neue Zeit in > das Datenbankfeld > sql = "UPDATE kicker SET zeit = '" & logintime & "' WHERE > user = '" & user > & "'" > set RSKick = conn.Execute(sql) > > ' Dann werden alle Eintraege in der Tabelle kicker > selektiert und mit dem > momentanen Datum > ' verglichen. Ist ein Datum kleiner als 1 Minute ist der > User offline und > wird aus der DB > ' loggedIn geloescht. > sql = "SELECT * FROM kicker" > set RSKick = conn.Execute(sql) > > do while(NOT RSKick.EOF) > datumOld = RSKick.fields.item("zeit") > Differenz = DateDiff("s",datumOld,logintime) > > if(Differenz > 120)then > > userToKill = RSKick.fields.item("user") > > if(userToKill = "Uwe Zimmer")then > sql="DELETE * FROM admin" > set RSDel = conn.Execute(sql) > > sql="DELETE * FROM kicker WHERE user = '"&userToKill&"'" > set RSDel = conn.Execute(sql) > else > sql="DELETE * FROM loggedIn WHERE name = '"&userToKill&"'" > set RSDel = conn.Execute(sql) > > sql="DELETE * FROM kicker WHERE user = '"&userToKill&"'" > set RSDel = conn.Execute(sql) > end if > > out = " hat den Raum verlassen" > raum = "standard" > smiley= Session("smiley") > timeout = now > > sql = "INSERT INTO chatdialog VALUES > ('"&userToKill&"','"&empfaenger&"','"&out&"','"&timeout&"','"& > raum&"','"&tim > eout&"','"&smiley&"')" > set RSDel = conn.Execute(sql) > end if > > RSKick.moveNext > loop > > RSKick.close > '************************************************************* > ************** > **************** > > %> > <html> > <head> > <title>Untitled Document</title> > <meta http-equiv="Content-Type" content="text/html; > charset=iso-8859-1"> > <script language="JavaScript"> > <!-- > > function update() > { > top.ChatRoomFrame.chatFrame.document.write("<font > face=\"Arial\" size=2 > color=\"#3366FF\"><i>"); > top.ChatRoomFrame.chatFrame.document.write("<% > if(NOT rs.EOF) then > > do while (NOT rs.EOF) > > inhalt = rs.fields.item("inhalt") > smiley = rs.fields.item("smiley") > > output = output&"<BR>"&SQLString(smiley)&" > "&rs.fields.item("sender")&"(an: > "&rs.fields.item("empfaenger")&"): "&SQLString(inhalt) > > Session("loginZeit") = rs.fields.item("datum") > rs.movenext > loop > rs.close > response.write(output) > > end if > %>"); > > > if(top.ChatRoomFrame.howisinFrame.document.getElementsByName(" > chatters")[0]. > length != 0) > > top.ChatRoomFrame.howisinFrame.document.getElementsByName("cha > tters")[0].len > gth=0; > > if(top.bottomFrame.document.getElementsByName("select")[0].len > gth != 0) > top.bottomFrame.document.getElementsByName("select")[0].length=0; > > top.ChatRoomFrame.chatFrame.document.write("</i></font>"); > > var positionBottom = > top.bottomFrame.document.getElementsByName("select")[0].length; > var EintragBottom = > top.bottomFrame.document.createElement("option"); > > EintragBottom.text = "an alle"; > EintragBottom.value = "alle"; > > > top.bottomFrame.document.getElementsByName("select")[0].add(Ei > ntragBottom,po > sitionBottom); > > <% > if(Session("AdminOn")) then > %> > var positionBottom = > top.bottomFrame.document.getElementsByName("select")[0].length; > var EintragBottom = > top.bottomFrame.document.createElement("option"); > > EintragBottom.text = "an Uwe Zimmer"; > EintragBottom.value = "Uwe Zimmer"; > > > top.bottomFrame.document.getElementsByName("select")[0].add(Ei > ntragBottom,po > sitionBottom); > > > <% > end if > %> > > <% do while (NOT RSloggedIn.EOF) > > %> > > var position = > top.ChatRoomFrame.howisinFrame.document.getElementsByName("cha > tters")[0].len > gth; > var Eintrag = > top.ChatRoomFrame.howisinFrame.document.createElement("option"); > > Eintrag.text = "<% = RSloggedIn.fields.item("name") %>"; > Eintrag.value = "<% = RSloggedIn.fields.item("name") %>"; > > > top.ChatRoomFrame.howisinFrame.document.getElementsByName("cha > tters")[0].add > (Eintrag,position); > > <% > if(Session("name") <> RSloggedIn.fields.item("name"))then > %> > > var positionBottom = > top.bottomFrame.document.getElementsByName("select")[0].length; > var EintragBottom = > top.bottomFrame.document.createElement("option"); > > EintragBottom.text = "<% = RSloggedIn.fields.item("name") %>"; > > EintragBottom.value = "<% = RSloggedIn.fields.item("name") %>"; > > > top.bottomFrame.document.getElementsByName("select")[0].add(Ei > ntragBottom,po > sitionBottom); > > <% > end if > RSloggedIn.moveNext > loop > > if(Session("AdminOn") and NOT Session("AdminGreen")) then > Session("AdminGreen")=true > %> > top.ChatRoomFrame.hiddenFrame.mainFrame.location.reload(); > <% > end if > > if(NOT Session("AdminOn") and Session("AdminGreen")) then > Session("AdminGreen")=false > %> > top.ChatRoomFrame.hiddenFrame.mainFrame.location.reload(); > <% > end if > %> > } > file://--> > </script> > > </head> > > <body bgcolor="#FF9900" onload="<% if > (Session("FramesLoaded")>=4) then > %>update();<% end if %>window.setInterval('reload()',5000)"> > <div align="right"> </div> > </body> > </html> > > <% > RSloggedIn.close > conn.close > set conn = nothing > end if %> > > > > | [aspdecoffeehouse] als [EMAIL PROTECTED] subscribed > | http://www.aspgerman.com/archiv/aspdecoffeehouse/ = Listenarchiv > | Sie k�nnen sich unter folgender URL an- und abmelden: > | > http://www.aspgerman.com/aspgerman/listen/anmelden/aspdecoffee house.asp | [aspdecoffeehouse] als [email protected] subscribed | http://www.aspgerman.com/archiv/aspdecoffeehouse/ = Listenarchiv | Sie k�nnen sich unter folgender URL an- und abmelden: | http://www.aspgerman.com/aspgerman/listen/anmelden/aspdecoffeehouse.asp
