Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

br1

trabalho

Recommended Posts

Pessoal estou trabalhando em um chat esta blzinha so que o problema que ele nao esta apagando as mensagens, alias apaga mais demora muito...

 

http://www.portalcatalao.com.br/uniminas

 

 

Segue o Atualiza.asp

 

<% @LANGUAGE = VBScript %>

<!--#include file="expire.asp"-->

<!--#include file="texto.asp"-->

<!-- Este site pode ser visualizado tambem na url "www.portalcatalao.com/uniminas/chat/" -->

 

<%

Dim intGrupo, strApelido, intNum, intN, strTexto, blnInicio

Dim intAtual, intMinhaAtu, arrDe, arrPara, arrPVT, arrMsgs

Dim arrTimes, arrNomes, intNumUsers, Hora

blnInicio = False

Hora = 0

'Pega as variáveis do usuário...

intGrupo = CInt(Session("Grupo"))

strApelido = Session("Nick")

intMinhaAtu = CInt(Session("Atual"))

 

'Atualiza a hora no array "Time" para a hora atual...

 

Application.Lock

arrNomes = Application("Nicks" & intGrupo)

arrTimes = Application("Time" & intGrupo)

intNumUsers = CInt(Application("Users" & intGrupo))

intAtual = CInt(Application("Atual" & intGrupo))

arrDe = Application("De" & intGrupo)

arrPara = Application("Para" & intGrupo)

arrPVT = Application("PVT" & intGrupo)

arrMsgs = Application("Msgs" & intGrupo)

If intMinhaAtu = 30 Then

intMinhaAtu = intAtual - 3

If intMinhaAtu < -1 Then intMinhaAtu = 30 - intMinhaAtu

blnInicio = True

End If

If Not IsArray(arrMsgs) Then

Redim arrMsgs(29)

intMinhaAtu = intAtual

End If

If Not IsArray(arrDe) Then Redim arrDe(29)

If Not IsArray(arrPara) Then Redim arrPara(29)

If Not IsArray(arrPVT) Then Redim arrPVT(29)

If Not IsArray(arrNomes) Then Redim arrNomes(29)

If Not IsArray(arrTimes) Then Redim arrTimes(29)

If intNumUsers = 0 Then intNumUsers = 1

intNum = 0

Do While intNum < (intNumUsers - 2)

If arrNomes(intNum) = strApelido Then

arrTimes(intNum) = Time

Else

Hora = DateDiff("n", arrTimes(intNum), Time)

If Hora > 1 Then

intAtual = intAtual + 1

If intAtual = 30 Then intAtual = 0

'strTexto = "<FONT FACE=VERDANA color=#000000 SIZE=2><br>(" & Now & ")</FONT> <B>" & PrepareEncod(arrNomes(intNum) & " saiu da sala...") & "</B>"

arrDe(intAtual) = arrNomes(intNum)

arrPara(intAtual) = "Todos"

arrMsgs(intAtual) = strTexto

arrPVT(intAtual) = 0

For intN = intNum To 29

If intN < 29 Then

arrNomes(intN) = arrNomes(intN + 1)

arrTimes(intN) = arrTimes(intN + 1)

Else

arrNomes(intN) = ""

arrTimes(intN) = ""

End If

Next

intNumUsers = intNumUsers - 1

If intNumUsers < 0 Then intNumUsers = 0

intNum = intNum - 1

End If

End If

intNum = intNum + 1

Loop

Application("Atual" & intGrupo) = intAtual

Application("De" & intGrupo) = arrDe

Application("Para" & intGrupo) = arrPara

Application("Msgs" & intGrupo) = arrMsgs

Application("PVT" & intGrupo) = arrPVT

Application("Users" & intGrupo) = intNumUsers

Application("Nicks" & intGrupo) = arrNomes

Application("Time" & intGrupo) = arrTimes

Application.Unlock

%>

<HTML>

<HEAD>

 

<META HTTP-EQUIV="REFRESH" CONTENT="4;atualiza.asp">

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

<script LANGUAGE='JavaScript1.1'>

<!--

function escreve() {

<%

If intMinhaAtu <> intAtual Then

If blnInicio Then

Response.Write " parent.fraMsgs.document.write('<LINK REL=""stylesheet"" HREF=""uniminas.css"" TYPE=""TEXT/CSS"">\n');" & vbCrLf

Response.Write " parent.fraMsgs.document.write('<LINK REL=""stylesheet"" HREF=""uniminas.css"" TYPE=""TEXT/CSS"">\n');" & vbCrLf

End If

Do While intMinhaAtu <> intAtual

intMinhaAtu = intMinhaAtu + 1

If intMinhaAtu > 29 Then intMinhaAtu = 0

If arrDe(intMinhaAtu) = strApelido OR arrPara(intMinhaAtu) = strApelido Then

strTexto = "<P CLASS=""Destaque"">" & arrMsgs(intMinhaAtu) & "</P>"

Response.Write " parent.fraMsgs.document.write('" & strTexto & "\n');" & vbCrLf

Else

If CInt(arrPVT(intMinhaAtu)) = 0 Then

strTexto = "<P>" & arrMsgs(intMinhaAtu) & "</P>"

Response.Write " parent.fraMsgs.document.write('" & strTexto & "\n');" & vbCrLf

ElseIf arrPara(intMinhaAtu) = "Todos" Then

strTexto = "<P>" & arrMsgs(intMinhaAtu) & "</P>"

Response.Write " parent.fraMsgs.document.write('" & strTexto & "\n');" & vbCrLf

End If

End If

Loop

Response.Write " parent.fraMsgs.window.scrollBy(0,1000000);"

Session("Atual") = intMinhaAtu

End If

%>

}

window.onload = escreve

-->

</SCRIPT>

</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000">

 

<P ALIGN="CENTER">Chat Uniminas</P>

</BODY>

</HTM>

// quando um entra na sala( acho que tinha que usar uma função para apagar as mensagens que estão atualmente ) o sistema nao usa bd,

 

Segue o Msg.asp http://forum.imasters.com.br/public/style_emoticons/default/joia.gif

Obrigado pela atenção

 

<% @LANGUAGE = VBScript %>

<!-- #include file="expire.asp" -->

<!-- #include file="texto.asp" -->

 

<%

Dim intGrupo, strApelido, intAtual, arrMsgs, arrDe, arrPara, arrPVT, strTexto, SALA1

SALA1 = Application("Msgs" )

intGrupo = Session("Grupo")

strApelido = Session("Nick")

Application.Lock

intAtual = CInt(Application("Atual" & intGrupo))

intAtual = intAtual + 1

If intAtual = 30 Then intAtual = 0

arrMsgs = Application("Msgs" & intGrupo)

arrDe = Application("De" & intGrupo)

arrPara = Application("Para" & intGrupo)

arrPVT = Application("PVT" & intGrupo)

If Not IsArray(arrMsgs) Then Redim arrMsgs(29)

If Not IsArray(arrDe) Then Redim arrDe(29)

If Not IsArray(arrPara) Then Redim arrPara(29)

If Not IsArray(arrPVT) Then Redim arrPVT(29)

'Guarda Valores na tela

strTexto = "<FONT FACE=VERDANA color=#000000 SIZE=2><br>(" & Now & ") - <B>" & prepareEncod(strApelido & " entrou na sala... ") & "</FONT></B>"

arrDe(intAtual) = strApelido

arrPara(intAtual) = "Todos"

arrMsgs(intAtual) = strTexto

arrPVT(intAtual) = 0

Application("Atual" & intGrupo) = intAtual

Application("De" & intGrupo) = arrDe

Application("Para" & intGrupo) = arrPara

Application("Msgs" & intGrupo) = arrMsgs

Application("PVT" & intGrupo) = arrPVT

Application.Unlock

%>

<HTML>

<HEAD>

<TITLE></TITLE>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

</HEAD>

 

<BODY BGCOLOR="#FFFFFF" TEXT="#000000">

<br>

</BODY>

</HTML>

Compartilhar este post


Link para o post
Compartilhar em outros sites

ele armazena quantas emnsagens?? 30??

Compartilhar este post


Link para o post
Compartilhar em outros sites

quando um user novo entra ele nao limpa as mensagens entra com aquele tanto de msg postada.

Compartilhar este post


Link para o post
Compartilhar em outros sites

isso é porque as mensagens estão sen do armazenadas em application, então todos, mas todos mesmo verão as mesmas mensagens, a não ser que tenha alguma privativa...

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.