Re: troca do campo from em mensagens (longo)
Pessoal,
Algumas respostas que obtive pediram mais informacoes, entao aki vao
elas, o que deixou a mensagem beeemmm longa :)
Este e o log do apache, falando a hora que o usuario mandou a mensagem:
----inicio----
10.0.48.11 - - [23/Mar/2004:12:59:38 -0300] "POST
/ccp/Sala_De_Aula/contate_seu_
tutor.php?cod_turma=11 HTTP/1.0" 200 3631
"http://prodabel815.pbh/ccp/Sala_De_Au
la/contate_seu_tutor.php?cod_turma=11" "Mozilla/4.0 (compatible; MSIE
6.0; Windo
ws NT 5.1)"
----------------fim---------------------
Este e o script contate_seu_tutor.php, que monta o formulario da
mensagem para enviar!
---------------inicio----------------------
<?
include('../Scripts/scripts.php');
Validado();
$cod_turma=$_GET['cod_turma'];
$num_modulo=$_GET['num_modulo'];
$db=new MySQL();
$db->selecionar("SELECT * FROM TB_TURMA WHERE COD_TURMA = ".$cod_turma);
if ($db->count) {
$des_turma = $db->result[DES_TURMA];
}
?>
<HTML>
<HEAD>
<style type="text/css">
<!--
.botton {
font-family:Verdana,sans-serif;
font-weight:bold;
font-size:8pt;
color:rgb(204,204,204);
letter-spacing:5%;
text-align:center;
text-decoration:none;
background-color:rgb(0,102,0);
border-width:1;
border-color:rgb(0,51,0);
border-style:solid;
}
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13;
}
.textopeq {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 7pt;
font-style: normal;
font-weight: normal;
font-variant: normal;
color: #000000;
}
.caixa {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
background-position: left center;
height: 17px;
width: auto;
font-style: normal;
line-height: normal;
font-weight: bold;
text-align: center;
vertical-align: middle;
}
a:link {
text-decoration:none;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13;
font-weight: bold;
color: #000000;
text-decoration: none;
}
a:visited {
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13;
color: #000000;
text-decoration: none;
}
a:hover {
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13;
color: #005500;
text-decoration: none;
}
a:active {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13;
color: #000000;
text-decoration: none;
font-weight: bold;
}
.paragrafo {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
font-style: normal;
color: #0066FF;
text-decoration: none;
text-align: center;
line-height: 15px;
}
.padrao {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #000000;
text-decoration: none;
text-align: center;
line-height: 15px;
}
-->
</style>
<script language="javascript">
function testa_campos(campo1, campo2){
if (campo1.value == "" || campo2.value == ""){
alert("Ambos os campos são de preenchimento obrigatório!");
return false;
}
else
return true;
}
</script>
</HEAD>
<!--<BODY bgcolor="#182973">-->
<BODY bgcolor="#F7F7F7">
<TABLE width="50%" align="center" cellpadding="2" cellspacing="2"
border="0">
<?
$db_r=new MySQL();
$db=new MySQL();
$sql = "SELECT * FROM TB_PESSOA , TB_MATRICULA ";
$sql = $sql."WHERE COD_PESSOA=COD_TUTOR AND COD_TURMA =
".$cod_turma;
$db->selecionar($sql);
if ($db->count){
echo "<TR><TD><p align='center'>".$des_turma."</p></TD></TR>";
echo "<TR><TD>Envie uma mensagem para seu tutor,
<U>".$db->result[NOME_PESSOA]."</U>.</TD></TR>";
echo "<TR><TD align='center'>";
echo "<form onsubmit='return testa_campos(this.assunto,
this.mensagem)' method='post'
action='contate_seu_tutor.php?cod_turma=".$cod_turma."'
name='envia_msg'>";
echo "<table border=0>";
echo "<tr><td align='right'>Assunto: </td><td><input
type='text' class='text1' size='65' name='assunto'></td></tr>";
echo "<tr valign='top'><td align='right'
class='header5'>Mensagem: </td><td><textarea name='mensagem'
class='text1' rows='5' cols='80'></textarea></td></tr>";
echo "</table>";
echo "<table border=0><tr><td align='center'><input
type='hidden' name='submetido' value='envia_msg'>";
echo "<input type='submit' class='button3' value='Enviar
mensagem'> <input type='reset' class='button3' value='Limpar
mensagem'></td></tr>";
echo "</table>";
echo "</form></TD></TR>";
if ($_POST['submetido'] == "envia_msg"){
$To = $db->result[EMAIL_PESSOA];
$db->fechar();
$sql = "SELECT EMAIL_PESSOA FROM TB_PESSOA WHERE
COD_PESSOA=".$_SESSION['id'];
$db_r->selecionar($sql);
if ($db->count){
$From = $db_r->result[EMAIL_PESSOA];
$Cc = $db_r->result[EMAIL_PESSOA];
$Subject = $_POST['assunto'];
$Body = $_POST['mensagem'];
$headers = "From:".$From."\n";
$headers = "cc:".$Cc."\n";
$headers .= "Return-Path:".$From."\n";
mail($To,$Subject,$mensagem,$headers);
Alertbox("Sua mensagem foi enviada com
sucesso!","javascript:history.go(-1)");
}
}
}
else
Alertbox("Não existe nenhum tutor disponível para esta
turma!","javascript:history.go(-1)");
?>
</TABLE>
</BODY>
</HTML>
-------------------------------fim----------------------
Esta e a mensagem enviada, com todos os headers, reparem que o from da
mensagem foi trocado pelo www-data@prodabel815.pbh, e o remetente
original foi suprimido. Ja o campo Com Copia mantem certinho o endereco
do remetente, que e passado ao formulario atraves da consulta ao campo
e-mail na tabela de cadastro dos alunos, ja que ele recebe uma copia no
e-mail dele da mensagem que ele enviou ao tutor.
---------------inicio-----------------------
Return-Path: <www-data@prodabel815.pbh>
X-Original-To: china@mercurio.pbh
Delivered-To: china@mercurio.pbh
Received: from correio.mercurio.pbh [10.0.25.189] by localhost with POP3
(fetchmail-6.2.5) for china@localhost (single-drop); Tue, 23 Mar
2004
13:00:11 -0300 (BRT)
Received: from localhost (unknown [127.0.0.1]) by netuno.pbh.gov.br
(Postfix) with ESMTP id 0A92B24473C for <china@mercurio.pbh>;
Tue, 23 Mar
2004 15:56:36 +0000 (UTC)
Received: from netuno.pbh.gov.br ([127.0.0.1]) by localhost (netuno.pbh
[127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08231-01
for
<china@mercurio.pbh>; Tue, 23 Mar 2004 12:56:35 -0300 (BRT)
Received: from mail.pbh.gov.br (unknown [200.186.217.138]) by
netuno.pbh.gov.br (Postfix) with ESMTP id 9E0A3244738 for
<china@mercurio.pbh>; Tue, 23 Mar 2004 12:56:35 -0300 (BRT)
Received: from netuno.pbh.gov.br ([10.0.24.37]) by mail.pbh.gov.br
(8.11.6/linuxconf) with ESMTP id i2NFvFg10499 for
<china@pbh.gov.br>; Tue,
23 Mar 2004 12:57:16 -0300
Received: from localhost (unknown [127.0.0.1]) by netuno.pbh.gov.br
(Postfix) with ESMTP id 2737B24473B; Tue, 23 Mar 2004 15:56:35
+0000 (UTC)
Received: from netuno.pbh.gov.br ([127.0.0.1]) by localhost (netuno.pbh
[127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08190-04;
Tue, 23 Mar
2004 12:56:34 -0300 (BRT)
Received: from prodabel815.pbh (prodabel815.pbh [10.0.26.158]) by
netuno.pbh.gov.br (Postfix) with ESMTP id CEA78244738; Tue, 23
Mar 2004
12:56:34 -0300 (BRT)
Received: from www-data by prodabel815.pbh with local (Exim 3.35 #1
(Debian)) id 1B5oJW-0000ou-00; Tue, 23 Mar 2004 12:59:38 -0300
To: china@pbh.gov.br
Subject: Exerc?cios
Cc: mauranc@yahoo.com.br
Message-Id: <E1B5oJW-0000ou-00@prodabel815.pbh>
From: www-data@prodabel815.pbh
Date: Tue, 23 Mar 2004 12:59:38 -0300
X-Virus-Scanned: by amavisd-new at pbh.gov.br
X-Virus-Scanned: by amavisd-new at pbh.gov.br
X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char ED hex) in
message
header 'Subject' Subject: Exerc\355cios\n ^
Status: RO
X-Status: A
Content-Length: 166
Lines: 4
Mime-Version: 1.0
CHINA, COMO FA?O PARA ENVIAR OS EXERC?CIOS QUE J? RESOLV??
MAURA
-----------------------fim-----------------------
Onde esta o gato? COmo impedir que o campo From seja substituido?
O MTA e o EXIM.
[]'s
--
_________________________________________
| .''`. | Márcio de Araújo Benedito |
| : :' : | http://www.minaslivre.org |
| `. `' | china@minaslivre.org |
| `- | Powered by Debian GNU/Linux!!! |
|_________________________________________|
Reply to: