Hola gracias por responder, ahora cambié un par de cosas; el tema es que no se insertan los mensajes en la bd.
el contactuser.php:
Código PHP:
Ver original<?php
include("connect.php");
$usuario=$_SESSION['usuario'];
$id=$_SESSION['mid'];
$fid=$_SESSION["id"];
$subject="";
$msg="";
$label="Reply";
$tid=0;
if(isset($_REQUEST["tid"])) {
$tid=$_REQUEST["tid"];
}
elseif(isset($_REQUEST["id"])) {
$label="Contact Member";
$id=$_REQUEST["id"];
$tid=$_REQUEST["id"];
}
if(isset($_REQUEST["type"])&&($_REQUEST["type"]=="contact")) {
$label="Send IM";
}
if(isset($_REQUEST["mid"])) {
$mid=$_REQUEST["mid"];
$subject="Re:".$rst0["dm_subject"];
$msg="MESSAGE:: ".$rst0["dm_message"];
}
if(!$row)
{
echo "<p> </p><p> </p><br><br><br><div align='center'><font size=2 color='#333333' face='Arial, Helvetica, sans-serif'>Recipient Not Found. Click <a href='index.php' class='insidelink'>here</a> to continue</font></div><p> </p><p> </p><p> </p><p> </p><p> </p>";
return;
}
else
{
?>
<script language="javascript" >
//<!--
function Validate(form)
{
if(form.subject.value== "")
{
alert ('Ingresa el Asunto!');
form.subject.focus();
return false;
}
if(form.subject.value.match(/[&<>]+/))
{
alert("Remueve los caracteres inválidos del Asunto (e.j. & < >)");
form.subject.focus();
return(false);
}
if(form.message.value== "")
{
alert ('Ingresa tu Mensaje!');
form.message.focus();
return false;
}
if(form.message.value.match(/[&<>]+/))
{
alert("Remueve los caracteres inválidos del Mensaje (e.j. & < >)");
form.message.focus();
return(false);
}
return true;
}
//-->
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" align="center"><font class="normal">
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" class="onepxtable">
<tr>
<td height="25" class="titlestyle"> <?php echo $label;?></td>
</tr>
<tr>
<td>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="5" ><form name="form1" method="post" onSubmit="return Validate(this);" action="insert_message.php">
<tr>
<td width="40%" height="25" valign="top" class="innertablestyle">
<div align="right"><strong>Para</strong></div></td>
<td width="6" height="25" valign="top"> </td>
<td width="60%" height="25" valign="top"><font class='normal'>
<input type="text" name="to" readonly="" value=" <?php
echo $row["usuario"];?>">
</font> </td>
</tr>
<tr>
<td width="40%" height="25" valign="top" class="innertablestyle">
<div align="right"><strong><font size="2">Asunto:</font></strong></div></td>
<td width="6" height="25" valign="top"><font size="2"><strong><font class='normal'><font class='red'>*</font>
</font></strong></font></td>
<td width="60%" height="25" valign="top"><font class='normal'>
<input name="subject" type="text" size="60" <?php
echo "value='" .$subject. "'";
?> >
<input name="fid" type="hidden" value="<?php echo $fid; ?>">
<input name="id" type="hidden" value="<?php echo $tid; ?>">
<input name="sb_type" type="hidden" id="sb_type" value="<?php
if(isset($_REQUEST["sb_type"])) { echo $_REQUEST["sb_type"];}
else
{echo 0;} ?>">
<input name="id" type="hidden" id="id" value="<?php
if(isset($_REQUEST["id"])) { echo $_REQUEST["id"];}
else
{echo 0;} ?>">
</font></td>
</tr>
<tr>
<td width="40%" height="25" valign="top" class="innertablestyle">
<div align="right"><font size="2"><strong>Mensaje<font class='normal'></font> </strong></font></div></td>
<td width="6" height="25" valign="top"><font size="2"><strong><font class='normal'><font class='red'>*</font>
</font></strong></font></td>
<td width="60%" height="25" valign="top"> <div align="left"><font class='normal'>
</font>
<textarea name="message" cols="60" rows="10"><?php echo $msg;?></textarea>
</div></td>
</tr>
<tr>
<td width="40%" height="25" valign="top" class="innertablestyle"></td>
<td width="6" height="25" valign="top"> </td>
<td width="60%" height="25" valign="top"> <input type="submit" name="Submit" value="Post Message"></td>
</tr>
</form> </table>
</td>
</tr>
</table>
</font></td>
</tr>
</table></td>
</tr>
</table>
<?php
}
?>
el insert_message.php:
Código PHP:
Ver original<?php
include("connect.php");
$id=$_SESSION['id'];
$usuario=$_SESSION['usuario'];
$from_mem=$_SESSION['id'];
$tid=$_REQUEST["id"];
$fid=$_SESSION["id"];
}
else
{
}
mysql_query ("Insert into 'messages' ( dm_fid , dm_tid , dm_message , dm_subject , dm_msg_read,d_f_del,d_t_del, dm_onstamp) VALUES ( '$fid','$tid','$message'," ."'$subject'" .",'No','No','No','" .date("YmdHis",time())."')");
//Gets member info
$sql = "SELECT max(id) FROM messages" ;
$id=$rs[0];
{
if($rs["sb_status"]=="yes")
{
$from =$rs["dm_fid"];
$to = $rs1["email"];
$subject =$row["dm_subject"];
$body=str_replace("%email%", $sb_null_char,str_replace("%pass%",$sb_null_char,str_replace("%lastname%", $rs1["lastname"],str_replace("%firstname%", $rs1["firstname"],str_replace("%usuario%",$rs1["usuario"], $row["email"]) ))));
$header="From:" . $from . "\r\n" ."Reply-To:". $from ;
if(isset($rs["sb_html_format"])&&($rs["sb_html_format"]=="yes")) {
$header .= "\r\nMIME-Version: 1.0";
$header .= "\r\nContent-type: text/html; charset=iso-8859-1\r\n";
// $body=str_replace("\n","<br>",$body);
}
// echo "--from:-$from----to:-$to---sub:-$subject----head:-$header----";
//echo "<pre>$body</pre>";
//die();
if( $rs["sb_status"]=='yes')
mail($to,$subject,$body,$header);
}// end if status is on
}
$errmsg="Tu mensaje ha sido enviado a ".$row["usuario"];
header("Location:"."msg_confirm_mem.php?tid=$tid&id=".$fid."&sb_type=".$_REQUEST["sb_type"]."&errmsg=".urlencode($errmsg)); ?>
entonces ahora si muestra en la url
$tid --- esta es la id a la que va dirigido el mensaje
$fid---esta es la id del usuario que lo envia
Pero al ir a la base de datos no se insertan los mensajes.
Debe haber algun error en el insert_message