Jump to content


Photo

Session.lcid=1046 Não Funciona Nem A Pau!


  • Faça o login para participar
8 replies to this topic

#1 Welington

Welington

    Ativo

  • Usuários
  • 305 posts
  • Sexo:Não informado
  • Localidade:Taubaté - SP
  • Interesses:Sandra Bullock<br>Alias<br>---<br>Webdesign<br>ASP<br>PHP<br>---

Posted 09/04/2004, 09:52

Criei um sisteminha de comentários para o meu site, e como o server não tá no brasil, tive que usar Session.LCID=1046 pra puxar a data do banco de dados no formato brasileiro. Só que simplesmente isso deixou de funcionar e a data agora ta sendo mostrada no padrão americano.
Façam um teste: http://www.sandrabul...fia/default.asp
Cliquem em algum link "Hotsite" e tentem cadastrar e depois ver o comentário, aparece com a data em inglês. Será que eu coloquei a session.lcid em lugar errado ou o q?

aí vai o código da pagina onde sao mostrados os comentarios:
<!-- #include virtual="home/includes/replace_query.asp" -->
<!-- #include virtual="home/conexao.asp" -->
<%
Session.LCID = 1046
If Request.QueryString("Id_Filme") = "" Then
Response.Write "<strong><font face=Verdana color=FF0000 size=1>Query inválida e/ou inexistente na barra de endereços.</font></strong>" 
Response.End
Else
If not IsNumeric(TrocaQuery(Request.QueryString("Id_Filme"))) Then
Response.Write "<strong><font face=Verdana color=FF0000 size=1>Query inválida e/ou inexistente na barra de endereços.</font></strong>"
Response.End
End if
End if

If Request.QueryString("pagina") = "" Then
Response.Write ""
Else
If not IsNumeric(TrocaQuery(Request.QueryString("pagina"))) Then
Response.Write "<strong><font face=Verdana color=FF0000 size=1>Query inválida e/ou inexistente na barra de endereços.</font></strong>"
Response.End
End if
End if

vIdFilme = Request.QueryString("Id_Filme")
Set RS1 = vConexao.execute("Select * From Filmografia Where Id_Filme = " & vIdFilme & "")
If RS1.EOF Then
Response.Write "<strong><font face=Verdana color=FF0000 size=1>Nenhum filme encontrado.</font></strong>"
Response.End
End if

If RS1("Comentar") = False Then
Response.Write "<strong><font face=Verdana color=FF0000 size=1>Não são permitidos comentários para este filme.</font></strong>"
Response.End
End if
%>
<html>
<head>
<title>Sandra Bullock Brasil</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../layouts/outros/pop_ups.css" rel="stylesheet" type="text/css">
</head>

<body background="../layouts/principal/fnd_total_pgint.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="400" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td><img src="<%= RS1("Layout_Topo") %>""></td>
  </tr>
  <tr> 
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td background="layouts/imagens/fnd_menu1.gif"><div align="right"> 
              <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr> 
                  <td><div align="right"></div></td>
                </tr>
              </table>
            </div></td>
        </tr>
        <tr> 
          <td background="layouts/imagens/fnd_menu1.gif"><div align="right"> 
              <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr> 
                  <td width="3%"><img src="../layouts/principal/spacer.gif" width="1" height="20"></td>
                  <td width="97%" class="menu1">
<div align="right" id="menu1"> <strong><a href="infosprincipais.asp?Id_Filme=<%= RS1("Id_Filme") %>">INFORMA&Ccedil;&Otilde;ES 
                      GERAIS</a> 
                      <%
       If Len(RS1("Elenco")) > 1 or Len(RS1("Sinopse")) > 1 or Len(RS1("Diretor")) > 1 or Len(RS1("Site_Oficial")) > 1 or Len(RS1("Produtoras")) > 1 or Len(RS1("Distribuidoras")) > 1 Then
       %>
                      | <a href="infosfilme.asp?Id_Filme=<%= RS1("Id_Filme") %>">O 
                      FILME</a> 
                      <% End if 
       If Len(RS1("Audio")) > 1 or Len(RS1("Legendas")) > 1 or Len(RS1("Tela")) > 1 or Len(RS1("Extras")) > 1 or Len(RS1("Duracao")) > 1 Then%>
                      | <a href="infosdvd.asp?Id_Filme=<%= RS1("Id_Filme") %>">DVD</a> 
                      <% End if %>
                      </strong></div></td>
                </tr>
              </table>
            </div></td>
        </tr>
      </table></td>
  </tr>
  <% If RS1("Comentar") = False Then %>
  <tr> 
    <td><img src="layouts/imagens/sombra_menu1.gif" width="400" height="5"></td>
  </tr>
     <% Else %>
  <tr>
    <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="3%">
<div align="right"><img src="layouts/imagens/menu2_esq.gif" width="17" height="18"></div></td>
          <td width="94%" height="0" valign="middle" background="layouts/imagens/menu2_fnd.gif" class="menu2"> 
            <div align="center" id="menu2"><a href="comentar.asp?Id_Filme=<%= RS1("Id_Filme") %>">Comentar 
              filme</a> | <a href="vercomentarios.asp?Id_Filme=<%= RS1("Id_Filme") %>">Ver 
              coment&aacute;rios</a> | <a href="avaliar.asp?Id_Filme=<%= RS1("Id_Filme") %>">Avaliar 
              filme </a></div>
          </td>
          <td width="3%">
<div align="left"><img src="layouts/imagens/menu2_dir.gif" width="17" height="18"></div></td>
        </tr>
  <% End if %>
      </table></td>
  </tr>
  <tr> 
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td><div align="center"><img src="../layouts/principal/spacer.gif" width="100" height="5"></div></td>
        </tr>
        <tr> 
          <td><table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td><div align="center"><strong>COMENT&Aacute;RIOS - <%= Ucase(RS1("Titulo")) %></strong></div></td>
              </tr>
              <tr> 
                <td><div align="center"><img src="../layouts/principal/spacer.gif" width="100" height="5"></div></td>
              </tr>
              <tr> 
                <td><div align="center"><img src="../layouts/principal/pnt.gif" width="390" height="1"></div></td>
              </tr>
              <tr> 
                <td><div align="center"><img src="../layouts/principal/spacer.gif" width="100" height="5"></div></td>
              </tr>
              <tr> 
                <td height="126" valign="top"> 
                  <div align="left" id="menu1"> 
                    <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
   	 
                      <tr valign="top"> 
       <%
       SQL = "Select * From Comentarios_Filmes Where Id_Filme = " & vIdFilme & " Order by Id_Comentario DESC"
       RS.Open SQL, vConexao,3,3
      If RS.EOF Then
      vFim = "Sim"
       %>
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr> 
                              <td width="100%"><div align="center">Não há comentários para este filme.<br>
         <a href="comentar.asp?Id_Filme=<%= RS1("Id_Filme") %>">Clique aqui e seja o primeiro a comentar.</a>
                            </tr>
                          </table>
                        <td>
      <% 
        Else
        
        RS.Pagesize = 15
        If Request.QueryString("pagina") = "" Then
        mnpagina = 1
        Else
        If Cint(Request.QueryString("pagina"))  < 1 Then
        mnpagina = 1
        Else
        If Cint(Request.QueryString("pagina")) > RS.PageCount then
        mnpagina = RS.PageCount
        Else
        mnpagina = Request.QueryString("pagina")
        End if
        End if
        End if
        
        RS.AbsolutePage = mnpagina
     	 
         	 
        While mncontar < RS.PageSize and not RS.EOF
        %>
                          <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr> 
                              <td width="58%"><strong>Nome: </strong><%= RS("Nome") %></td>
                              <td width="42%"><strong>Data: </strong><%= RS("Data") %></td>
                            </tr>
                            <tr> 
                              <td colspan="2"><strong>E-mail: </strong><a href="mailto:<%= RS("E_mail") %>"><%= RS("E_mail") %></a></td>
                            </tr>
                            <tr> 
                              <td colspan="2"><div align="center"><img src="../layouts/principal/spacer.gif" width="100" height="5"></div></td>
                            </tr>
                            <tr> 
                              <td colspan="2"><strong>
         <%= RS("Titulo") %></strong><br>
         <%= RS("Comentario") %></td>
                            </tr>
                            <tr>
                              <td colspan="2"><div align="center"><img src="../layouts/principal/pnt_sep_com.gif" width="377" height="9"></div></td>
                            </tr>
                          </table>
        <% 
        RS.MoveNext
             
        mncontar = mncontar + 1
             
              If RS.EOF Then
        Response.Write ""
        End if
        Wend
        End if
        %></td>
                      </tr>
                      <tr valign="top"> 
                        <td><div align="center"><img src="../layouts/principal/spacer.gif" width="100" height="5"></div></td>
                      </tr>
                      <tr valign="top">
                        <td>
      <%
     	 If not vFim = "Sim" Then
     	 %><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td width="28%"><strong>P&aacute;gina atual: </strong><%= mnpagina %></td>
                              <td width="72%">
<div align="right" id="menu2">| 
                                  <%
         For vpagina = 1 to RS.PageCount
         %>
         <a href="vercomentarios.asp?Id_Filme=<%= RS1("Id_Filme") %>&pagina=<%= vpagina %>">
         <% 
         Response.Write vpagina
         %></a><% Next %> | <% End if %>
         </div></td>
                            </tr>
                          </table></td>
                      </tr>
                    </table>
                  </div></td>
              </tr>
            </table></td>
        </tr>
        <tr>
          <td><div align="center"><img src="../layouts/principal/spacer.gif" width="100" height="5"></div></td>
        </tr>
        <tr> 
          <td><div align="center"><img src="../layouts/principal/pnt.gif" width="390" height="1"></div></td>
        </tr>
        <tr> 
          <td><div align="center"><img src="../layouts/principal/spacer.gif" width="100" height="5"></div></td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr> 
    <td> <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td><img src="../layouts/principal/risco_inf.gif" width="400" height="2"></td>
        </tr>
        <tr> 
          <td><img src="<%= RS1("Layout_Inferior") %>" border="0" usemap="#Map""></td>
        </tr>
      </table></td>
  </tr>
</table>
<map name="Map">
  <area shape="rect" coords="345,1,398,14" href="javascript:window.close()">
</map>
</body>
</html>
<%
vConexao.close
Set RS = Nothing
Set RS1 = Nothing
Set vConexao = Nothing
%>

valeu

#2 yakko

yakko

    Turista

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

Posted 09/04/2004, 10:34

ola Welington,

velinhu por favor me mostre a sua sql de insert, pois vc deve colocar tb o session.lcid = 1046, no topo da pagina onde vc faz o insert.... pelo menos comigo eu sempre fiz isto... bele
[]´s

yakko

#3 Welington

Welington

    Ativo

  • Usuários
  • 305 posts
  • Sexo:Não informado
  • Localidade:Taubaté - SP
  • Interesses:Sandra Bullock<br>Alias<br>---<br>Webdesign<br>ASP<br>PHP<br>---

Posted 09/04/2004, 11:26

A página que faz o insert tb está com a Session.LCID=1046. Olha o código:

<% Response.Buffer = True %>
<!-- #include virtual="home/includes/replace_caracteres.asp" -->
<!-- #include virtual="home/conexao.asp" -->
<title>Sandra Bullock Brasil</title>
<%
Session.LCID = 1046

If Len(Request.Form("Nome")) < 2 Then
%>
<script>
alert("Digite seu nome.");
javascript:history.back(1);
</script>
<%
Response.End
End if

If Len(Request.Form("Email")) < 8 Then
%>
<script>
alert("Digite um e-mail válido.");
javascript:history.back(1);
</script>
<%
Response.End
End if
If Len(Request.Form("Titulo")) < 2 Then
%>
<script>
alert("Digite um título para o seu comentário.");
javascript:history.back(1);
</script>
<%
Response.End
End if
If Len(Request.Form("Comentario")) < 15 Then
%>
<script>
alert("Seu comentário deve ter no mínimo 15 caractéres.");
javascript:history.back(1);
</script>
<%
Response.End
End if
If Len(Request.Form("Comentario")) > 5000 Then
%>
<script>
alert("Seu comentário deve ter no máximo 5000 caractéres.");
javascript:history.back(1);
</script>
<%
Response.End
End if
If Request.Form("Divulgar_Email") = "Sim" Then
vdivulgar = "True"
Else
vdivulgar = "False"
End if

vData = DateAdd("h",2,Now)
vIdFilme = Request.Form("Id_Filme")
vNome = Trocar(Request.Form("Nome"))
vEmail = Trocar(Request.Form("Email"))
vTitulo = Trocar(Request.Form("Titulo"))
vComentario = Trocar(Request.Form("Comentario"))
vIp = Request.ServerVariables("Remote_ADDR")

Response.Cookies("Comentarios_Nome") = vNome
Response.Cookies("Comentarios_Nome").Expires = #Dec 31, 2020#
Response.Cookies("Comentarios_Email") = vEmail
Response.Cookies("Comentarios_Email").Expires = #Dec 31, 2020#

Set RS1 = vConexao.execute("Insert Into Comentarios_Filmes(Id_Filme, Nome, E_mail, Data, Titulo, Comentario, Ip, Permite_Email) Values('" & vIdFilme & "','" & vNome & "','" & vEmail & "','" & vData & "','" & vTitulo & "','" & vComentario & "','" & vIp & "'," & vdivulgar & ")")
vConexao.close
Set RS1 = Nothing
Set vConexao = Nothing
Response.redirect "comentar_agradecimento.asp?Id_Filme="&vIdFilme&""
%>


#4 [webmaster]®

[webmaster]®

    Hobby por criar funções genérica, semânticas e otimizadas

  • Usuários
  • 310 posts
  • Sexo:Não informado
  • Localidade:Canoas - RS
  • Interesses:ASP<br>CSS<br>JavaScript - DOM - ECMASCRIPT - JSCRIPT<br>XHTML<br>HTML<br>DHTML, AJAX, JSON, TABLELESS<br>ACESS<br>MYSQL<br>SQL SERVER<br><br>SEO, WEBSTANDARDS, ACESSIBILIDADE, USABILIDADE, AI

Posted 09/04/2004, 12:46

Faça o tratamento pra ser exibido no formato que você, dá até pra criar uma função.
A lógica é você só mudar na hora de imprimir os dados na tela:

<%=Day(rs("data"))%>/<%=Month(rs("data"))%>/<%=Year(rs("data"))%>

Meus sites:
- Guia Camaquã
- Laroya atacadista
- Emílio confecções

Ocupação: WebDeveloper avançado

Contato:
Email: gutoasp[at]gmail[dot]com
MSN: gutoasp[at]hotmail[dot]com
Trabalhando desde 1999 com websites.

Para saber mais sobre meu trabalho, sobre o que faço, e o que sei, clique aqui!

#5 Welington

Welington

    Ativo

  • Usuários
  • 305 posts
  • Sexo:Não informado
  • Localidade:Taubaté - SP
  • Interesses:Sandra Bullock<br>Alias<br>---<br>Webdesign<br>ASP<br>PHP<br>---

Posted 09/04/2004, 13:20

Valeu Webmaster...
Agora eu percebi que o problema é que o servidor está interpretando o dia como mês e o mês como dia. Mesmo fazendo com DatePart ou do tipo que você ensinou, o dia é mostrado no lugar do mês e vice-versa.
Teria como modificar isso?

#6 [webmaster]®

[webmaster]®

    Hobby por criar funções genérica, semânticas e otimizadas

  • Usuários
  • 310 posts
  • Sexo:Não informado
  • Localidade:Canoas - RS
  • Interesses:ASP<br>CSS<br>JavaScript - DOM - ECMASCRIPT - JSCRIPT<br>XHTML<br>HTML<br>DHTML, AJAX, JSON, TABLELESS<br>ACESS<br>MYSQL<br>SQL SERVER<br><br>SEO, WEBSTANDARDS, ACESSIBILIDADE, USABILIDADE, AI

Posted 09/04/2004, 14:07

Cara se isso q eu disse não funcionar então eu não sei!
Meus sites:
- Guia Camaquã
- Laroya atacadista
- Emílio confecções

Ocupação: WebDeveloper avançado

Contato:
Email: gutoasp[at]gmail[dot]com
MSN: gutoasp[at]hotmail[dot]com
Trabalhando desde 1999 com websites.

Para saber mais sobre meu trabalho, sobre o que faço, e o que sei, clique aqui!

#7 yakko

yakko

    Turista

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

Posted 09/04/2004, 16:08

velinhu tenta colocar antes da sua conexao ao banco de dados.

hoje esta assim:
<% Response.Buffer = True %>
<!-- #include virtual="home/includes/replace_caracteres.asp" -->
<!-- #include virtual="home/conexao.asp" -->
<title>Sandra Bullock Brasil</title>
<%
Session.LCID = 1046

tente assim:
<%
Response.Buffer = True
Session.LCID = 1046
%>
<!-- #include virtual="home/includes/replace_caracteres.asp" -->
<!-- #include virtual="home/conexao.asp" -->
<title>Sandra Bullock Brasil</title>
[]´s

yakko

#8 Agente Linhares

Agente Linhares

    fuis...abraços!

  • Ex-Admins
  • 3138 posts
  • Sexo:Não informado
  • Localidade:Biritiba Mirim-SP

Posted 09/04/2004, 16:27

sempre usei isto:

<% Session.LCID = 1046 %>

e sempre funfo legal quando precisei..
> Busca On-line - A Busca que faltava na Internet! - Cadastre-se!
---------------------------------------------------------------------------
> BRdesign.NET - Soluções em Websites e Sistemas E-Commerce.
---------------------------------------------------------------------------
> BR-ecommerce - Sua loja virtual na internet! - Apenas R$99,90 mensais (hospedagem inclusa)!

#9 Welington

Welington

    Ativo

  • Usuários
  • 305 posts
  • Sexo:Não informado
  • Localidade:Taubaté - SP
  • Interesses:Sandra Bullock<br>Alias<br>---<br>Webdesign<br>ASP<br>PHP<br>---

Posted 09/04/2004, 16:44

Bem, tentei de todas as formas com LCID, mas nao deu.. Então transformei o campo que era Data em Texto.. aí eu faço a montagem da data pelo script, assim deu certo... Já vi outros casos em que o Session.LCID não funciona, acho que deve ser alguma coisa no servidor...

Valeu a todos que ajudaram!




0 user(s) are reading this topic

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

IPB Skin By Virteq