Jump to content


Photo

O Que Esta De Errado Neste Chat


  • Faça o login para participar
1 reply to this topic

#1 zanelati2002

zanelati2002

    Normal

  • Usuários
  • 101 posts
  • Sexo:Não informado

Posted 19/06/2003, 16:25

vou postar pagina por pagina

chat.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Bate Papo do Site do Zanelati</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type><LINK 
href="chat.css" rel=stylesheet 
type=text/css>
<script language="JavaScript">
function validate(form) {
	if (form.elements[0].value=="") {
  alert('Não vai colocar o apelido?')
  form.elements[0].focus()
  return false
	}
	return true
}
</script>

<META content="Microsoft FrontPage 4.0" name=GENERATOR></HEAD>
<BODY class=frontpage>
<TABLE border=0 cellPadding=0 cellSpacing=0 
style="position: absolute; top: 90; left: 0" width="693" height="284">
  <TBODY>
  <TR>
    <TD 
    style="COLOR: #333333; FONT-SIZE: 10px; FONT-WEIGHT: bold; PADDING-BOTTOM: 8px; PADDING-RIGHT: 8px; TEXT-ALIGN: right">Participe 
      do Bate Papo do Site do Zanelati</TD></TR>
  <TR>
    <TD align=middle 
    style="BACKGROUND-COLOR: #0099cc; BORDER-BOTTOM: #ffffff 1px dashed; BORDER-TOP: #ffffff 1px dashed"><BR>
      <%
IF Request.QueryString("lotada") = "true" then
	Response.Write "<b>Você tentou entrar em uma sala lotada!!!!</b><br><br>"
End If
%>
      <form method="POST" action="frame.asp" onsubmit="return validate(this)">
      <TABLE border=0 cellPadding=2 cellSpacing=0 width=240>
        <TBODY>
        <TR>
          <TD>&nbsp;</TD>
          <TD align=right style="FONT-SIZE: 10px">Apelido:</TD>
          <TD width="100%"><INPUT class=editField maxLength=32 name=nome 
            size=28 tabIndex=1></TD>
          <TD>&nbsp;</TD></TR>
        <TR>
          <TD>&nbsp;</TD>
          <TD align=right colSpan=2><INPUT border=0 class=btn name=login tabIndex=2 title="Usuário no chat" type=submit value=entrar></TD>
          <TD>&nbsp;</TD></TR><INPUT name=mode type=hidden value=userLogin> 
</FORM>
        <TR>
          <TD>&nbsp;</TD>
          <TD align=middle colSpan=2 style="COLOR: #999999"><BR><BR><BR></TD>
          <TD>&nbsp;</TD></TR>
        <TR>
          <TD>&nbsp;</TD>
          <TD colSpan=2>
            <TABLE border=0 cellPadding=4 cellSpacing=0 
            style="BORDER-RIGHT: #003300 3px double" width="100%">
              <TBODY>
              <TR>
                <TD class=uocap colSpan=3>Entre e Participe</TD></TR>
              <TR>
                <TD class=uo colSpan=3>&nbsp;marque encontros com amigos</TD></TR></TBODY></TABLE></TD>
          <TD>&nbsp;</TD></TR></TBODY></TABLE>
      </form>
      <BR></TD></TR>
  <TR>
    <TD 
    style="COLOR: #666666; FONT-SIZE: 10px; FONT-WEIGHT: lighter; PADDING-BOTTOM: 8px; PADDING-LEFT: 8px; PADDING-RIGHT: 8px; PADDING-TOP: 8px; TEXT-ALIGN: justify">
      <P style="TEXT-ALIGN: center">[Site do Zanelati - Todos os direitos 
      reservados]</P></TD></TR></TBODY></TABLE><!-- Copyright(c) 2002, The Theill Web Site --></BODY></HTML>

expire.asp
<html>

<head>
<LINK 
href="chat.css" rel=stylesheet 
type=text/css>

</head>

<body>

<p><a href="chat.asp" target="_top">Sua sessão de chat expirou. Clique aqui
para entrar novamente</a></p>

</body>

</html>


f_msg.asp

<html>
<head>
<LINK 
href="chat.css" rel=stylesheet 
type=text/css>
</head>
<body topmargin="0" leftmargin="0" bgcolor="#3171AD" text="#FFFFFF">
</body>
</html>

f_post.asp

<html>

<head>
<title></title>
<LINK 
href="chat.css" rel=stylesheet 
type=text/css>
<script language=JavaScript>
function foco(){
var Form
Form = document.envia;
Form.msg.focus(); 
}
</SCRIPT>
</head>

<body topmargin="0" leftmargin="0" bgcolor="#3171AD" text="#FFFFFF"
style="border-top-style: solid; border-top-color: #FFFF00">

<%
If Session("logon") = false then
	Response.Redirect("expire.asp")
End IF
%>
<%
Function mau(msg)
msg=lcase(msg)
mau=false
	if instr(1, msg, "xxxxx que pariu") then mau=true
	if instr(1, msg, "xxxxx") then mau=true
	if instr(1, msg, "xxxxx") then mau=true
	if instr(1, msg, "xxxxxx") then mau = true
	if instr(1, msg, "xxxxxx") then mau = true
	if instr(1, msg, "vai tomar no") then mau = true
	if instr(1, msg, "xxxxx") then mau = true
	if instr(1, msg, "xxxxx") then mau = true
	if instr(1, msg, "xxxxxx") then mau = true
end function
Function image(pic, post)
if pic <> "none" then
	post = post & ".........<img src='../s_gif/" & pic & "'><br>"
	image = post
else
	image = post
End If
End Function

'************************************************
dim origem, destino, reserv, msg, id, acao, varid1, varid2, p3, p4, p5, pic
reserv = Request.Form("Reservado")
msg = Request.Form("msg")
id = Request.Form("destinatario")
acao = Request.Form("action")
if id = "1234" then destino = "TODOS" & reserv
pic = Request.Form("imagem")

'Transforma msg para evitar erros no JavaScript
msg = Server.HTMLencode(msg)

If trim(msg) <> "" then     	 'Postou mensagem
	a = Application("id01")
	b = Application("nome01")
	c = Application("msg01")
	l = Application("last01")
	For i = 0 to 29      'Procura usuario
  if a(i) = Session.SessionID then
 	 origem = b(i)
 	 exit for
  End if
	next
	If origem="" then 
  Session("logon") = false
  session("last") = true
  response.redirect("expire.asp")
	End If
	for i = 0 to 29      'Procura vitima
  if a(i) = id then
 	 destino = b(i)
 	 exit for
  end if
	next

	'personaliza as acoes
	Select Case acao
  Case "grita com"
 	 msg = "<b>" & ucase(msg) & "</b>"
	End Select
	
	if reserv <> false then     	 'Prive
  p1 = "<font color = cyan>(" & FormatDateTime(now, 3) & ")</font> "
  p2 = "<font color = yellow><b>" & origem & "</b></font> "
  p3 = "<font color = white>reservadamente " & acao & " </font>"
  p4 = "<font color = yellow><b>" & destino & "</b></font>: "
  p5 = "<font color = white><i>" & msg & "</i></font><br>"
  post = p1 & p2 & p3 & p4 & p5
  post = image(pic, post)
  if mau(msg) then
 	 post = post & "<b>BOT para " & origem & ": BOCA-SUJA!<b><br>"
  end if
  if id = "1234" then
 	 post = "<b>BOT para " & origem & ": pra quê falar reservadamente com todos???</b><br>"
  End If
  for i = 0 to 29
 	 if a(i) = id or a(i) = Session.SessionID then
    c(i) = c(i) & post
 	 end if
  next
	else         	 'todos veem a msg
  p1 = "<font color = cyan>(" & FormatDateTime(now, 3) & ")</font> "
  p2 = "<font color = yellow><b>" & origem & "</b></font> "
  p3 = "<font color = white> " & acao & " </font>"
  p4 = "<font color = yellow><b>" & destino & "</b></font>: "
  p5 = "<font color = white>" & msg & "</font><br>"
  post = p1 & p2 & p3 & p4 & p5
  post = image(pic, post)
  if mau(msg) then
 	 post = post & "<b>BOT para " & origem & ": BOCA-SUJA!<b><br>"
  end if
  for i = 0 to 29
 	 'if c(i) <> "" then
    c(i) = c(i) & post
 	 'end if
  next
  
  'Adiciona as 10 ultimas
  for i = 1 to 8
 	 l(i) = l(i+1)
  next
  l(9) = post
	end if
	Application.lock
	Application("msg01") = c
	Application("last01") = l
	Application.unlock
else
	a = Application("id01")
	b = Application("nome01")
	For i = 0 to 29      'Procura usuario
  if a(i) = Session.SessionID then
 	 origem = b(i)
 	 exit for
  End if
	next
end if
chatn = Session("chatn")
%>
<form action="f_post.asp" method="post" name="envia">
  <table border="0" cellpadding="2" cellspacing="2" width="100%">
    <tbody>
      <tr>
        <td colspan="2"><b><% Response.write origem %></b><input
          name="Reservado" type="checkbox" value="false"><font face="Arial"
          size="2">reservadamente&nbsp; </font><select name="Action" size="1">
            <option selected value="fala para">fala para</option>
            <option value="pergunta para">pergunta para</option>
            <option value="responde para">responde para</option>
            <option value="concorda com">concorda com</option>
            <option value="discorda de">discorda de</option>
            <option value="desculpa-se com">desculpa-se com</option>
            <option value="surpreende-se com">surpreende-se com</option>
            <option value="murmura para">murmura para</option>
            <option value="sorri para">sorri para</option>
            <option value="suspira por">suspira por</option>
            <option value="flerta com">flerta com</option>
            <option value="não tá nem aí com">não tá nem aí com</option>
            <option value="entusiasma-se com">entusiasma-se com</option>
            <option value="ri de">ri de</option>
            <option value="dá um fora em">dá um fora em</option>
            <option value="briga com">briga com</option>
            <option value="grita com">grita com</option>
            <option value="xinga">xinga</option>
          </select> <select name="destinatario" size="1">
            <option selected value="1234">TODOS</option>
           <%
        varid1 = application("nome01")
        varid2 = application("id01")
        for i = 0 to 29
       	 if varid2(i) <> Session.SessionID and varid2(i) <> "" then
          response.write "<option value=" & varid2(i) & ">" & varid1(i) & "</option>" & vbcrlf
       	 End If
        next
            %>
          </select></td>
      </tr>
      <tr>
        <td width="32"><a href="sai.asp" target="_top"><img alt="Sair"
          border="0" src="../s_gif/sair.gif" width="32" height="32"></a></td>
        <td>&nbsp;&nbsp;&nbsp;<select name="imagem" size="1">
            <option selected value="none">Enviar imagem</option>
            <option value="boia.gif">Bóia</option>
            <option value="briga.gif">Briga</option>
            <option value="cerveja.gif">Cerveja</option>
            <option value="coco.gif">Cocô</option>
            <option value="desculpa.gif">Desculpa</option>
            <option value="drink.gif">Drink</option>
            <option value="entusiasmo.gif">Entusiasmo</option>
            <option value="flerta.gif">Tubarão</option>
            <option value="naotanemai.gif">Não tô nem aí</option>
            <option value="nuvem.gif">Nuvem</option>
            <option value="presente.gif">Presente</option>
            <option value="rosa.gif">Rosa</option>
            <option value="sapo.gif">Sapo</option>
            <option value="xixarrao.gif">Xixarrão</option>
            <option value="pergunta.gif">Interrogação</option>
            <option value="ride.gif">Riso</option>
            <option value="sorri.gif">Sorriso</option>
          </select> &nbsp;<input name="msg" size="50"> <input name="Submit"
          type="submit" value="Enviar">&nbsp;&nbsp;&nbsp; Sala: </td>
      </tr>
    </tbody>
  </table>
</form>
     <script language=JavaScript>
  function foco(){
   var Form
   Form = document.envia;
   Form.msg.focus(); 
  }
	</SCRIPT>



f_proc.asp
<html>

<head>
<%
If Session("logon") = false then
	Response.Redirect("expire.asp")
End If
%>
<meta http-equiv="Refresh" content="3; url=f_proc.asp">
<title></title>
</head>

<body bgcolor="#000000" text="#FFFFFF">

<%
dim l, i, a, c, d, texto
Response.Write "<script language=javascript>" & vbcrlf
if Session("last") then   	 'mostra as 10 ultimas
	l = application("last01")
	for i = 0 to 9
  If l(i) <> "" then
 	 texto = l(i)
 	 Response.Write "parent.msgpost(""" & texto & """)" & vbcrlf
  End if
	next
	Session("last") = false
else
	a = Application("id01")
	c = Application("msg01")
	For i = 0 to 29
  if a(i) = Session.SessionID then
 	 texto = c(i)
 	 if len(texto) <> 0 then
    Response.Write "parent.msgpost(""" & texto & """)" & vbcrlf
 	 end if
 	 c(i) = ""
 	 Application.lock
 	 Application("msg01") = c
 	 Application.unlock
 	 exit for
  end if
	next
end if
Response.Write "</script>" & vbcrlf
%>

</body>

</html>


frame.asp
<%
Dim a, b, c, d, t, logon, u, i, nome, p1, p2
nome = Request.Form("nome")
if nome = "" then
	Response.Redirect("../default.asp")
end if
If Application("chatn") = 30 then
	Response.Redirect("../default.asp?lotada=true")
End If
If Session("logon") = false then          'Entrou agora
	'Adiciona usuario
	'Procura uma vaga
	a = Application("id01")
	For i = 0 to 29
  If a(i) = "" then exit for
	next
	Session("vaga") = i
	a = Application("id01")
	b = Application("nome01")
	a(i) = Session.SessionID
	b(i) = nome
	p1 = "<font color=cyan>(" & FormatDateTime(now, 3) & ")</font> "
	p2 = "<font color=white>" & nome & " entrou na sala...</font><br>"
	logon = p1 & p2
	Application.Lock
	Application("id01") = a
	Application("nome01") = b
	Application.unlock
	
	'Adiciona logon as 10 ultimas
	u = Application("last01")
	for i = 0 to 8
  u(i) = u(i+1)
	next
	u(9) = logon
	Application.Lock
	Application("last01") = u
	chatn = Application("chatn") + 1
	Application("chatn") = chatn
	Application.unlock
	Session("logon") = true
	
	'Avisa o restante dos usuarios que alguem entrou...
	c = Application("msg01")
	for i = 0 to 29
  if i <> Session("vaga") Then
     c(i) = c(i) & logon
  End If
	next
	Application.lock
	Application("msg01") = c
	Application.unlock
End If
%>
<html>

<script language="javascript">
var docflag = new String("C")


function msgpost(msg) {
var destino = parent.frames[0].document
var as = unescape("%34")
if (docflag == "C") {
	destino.write("<html><link rel='stylesheet' href='../style.css' type='text/css'>")
	destino.write("<body topmargin=4 leftmargin=4 bgcolor='#3171AD' text='#FFFFFF'><p>")
	docflag="O" }
destino.write(msg)
parent.frames[1].scroll(0,900000000)
}
</script>

<head>
<% Response.Write "<title>" & nome & " no Chat</title>" %>

</head>

<frameset framespacing="0" border="0" frameborder="0" rows="100%,0,80">
  <frame name="fmsg" scrolling="yes" src="f_msg.asp">
  <frame name="fproc" scrolling="no" noresize src="f_proc.asp">
  <frame name="fpost" src="f_post.asp" scrolling="no" noresize>
  <noframes>
  <body>

  <p>Esta página usa quadros mas seu navegador não aceita quadros.</p>

  </body>
  </noframes>
</frameset>

</html>


sai.asp
<%
If Session("logon") = false then
	Response.Redirect("expire.asp")
End IF
%>
<%
Dim sID, a, b, c, l, t, i, nome, p1, p2, post, a2, b2, c2, d2, chatn

sID = Session.SessionID
a = Application("id01")
b = Application("nome01")
c = Application("msg01")
l = Application("last01")
'Remove usuario da sala

i = Session("vaga")
nome = b(i)
Session("logon") = false
Session("last") = true
v = Session("vaga")
set Session("vaga") = nothing

p1 = "<font color=cyan>(" & FormatDateTime(now, 3) & ")</font> "
p2 = "<font color=white>" & nome & " saiu da sala...</font><br>"
post = p1 & p2

for i = 1 to 8
	l(i) = l(i+1)
next
l(9) = post

'Avisa a turma
for i = 0 to 29
  c(i) = c(i) & post
next
a(v) = ""
b(v) = ""
c(v) = ""
Application.lock
Application("id01") = a
Application("nome01") = b
Application("msg01") = c
Application("last01") = l
chatn = Application("chatn") - 1
Application("chatn") = chatn
Application.unlock
response.redirect("chat.asp")


este chat e o go chat so mudei um pouco o chat.asp que seria a inde.asp de uma olhada se algo foi postado errado http://www.vipcodigo...asp?codfonte=61 e o link do codigo

#2 Tarkan

Tarkan

    Powered by Linux - Que inglês! ;)

  • Ex-Admins
  • 651 posts
  • Sexo:Masculino
  • Localidade:Copacabana - RJ

Posted 19/06/2003, 18:13

Qual o erro que dá exatamente no código?
Em qual página?

:D
' nome: gustavo veiga
' profissão: ALOG Data Centers do Brasil (analista de sistemas)
' publicidade: ALOG Data Centers do Brasil




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq