Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/05/2010, 20:25
den_22
 
Fecha de Ingreso: enero-2010
Mensajes: 198
Antigüedad: 14 años, 3 meses
Puntos: 1
Respuesta: Enviar mensaje queda pagina en blanco

Hola, cambié un par de cosas, me dice "Tu mensaje se ha enviado a usuario" , pero no me lo inserta en la base de datos.

Código PHP:
Ver original
  1. <?php
  2.  error_reporting(E_ALL ^ E_NOTICE);
  3. session_name('pLogin');
  4. include("connect.php");
  5. include("date_time_format.php");
  6.  
  7. $id=$_SESSION['id'];
  8. $usuario=$_SESSION['usuario'];
  9. $from_mem=$_SESSION['id'];
  10.  
  11.  
  12.  
  13. $tid=$_REQUEST["id"];
  14. $fid=$_SESSION["id"];
  15.  
  16. $to_mem=mysql_fetch_array(mysql_query("select * from members where id=$tid"));
  17. $from_mem=mysql_fetch_array(mysql_query("select * from members where id=$fid"));
  18.  
  19.  
  20.             if (!get_magic_quotes_gpc()) {
  21.             $message=str_replace('$', '\$',addslashes($_REQUEST["message"]));
  22.             $subject=str_replace('$', '\$',addslashes($_REQUEST["subject"]));
  23.             }
  24.             else
  25.             {
  26.             $message=str_replace('$', '\$',$_REQUEST["message"]);
  27.             $subject=str_replace('$', '\$',$_REQUEST["subject"]);
  28.             }
  29.  
  30.        
  31. mysql_query ("Insert into `dm_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())."')");
  32.  
  33.  
  34.  
  35.    
  36.  
  37. //Gets member info
  38.     $sql = "SELECT max(dm_id) FROM dm_messages" ;
  39.     $rs_query=mysql_query($sql);
  40.     $rs=mysql_fetch_array($rs_query);
  41.     $id=$rs[0];
  42.    
  43.     $rs0=mysql_fetch_array(mysql_query("select *,UNIX_TIMESTAMP(dm_onstamp) as ondate  from dm_messages where dm_id=" .$id));
  44.     $rs1=mysql_fetch_array(mysql_query("select * from members where id=" .$rs0["dm_tid"]));
  45.     $rs2=mysql_fetch_array(mysql_query("select * from members where id=" .$rs0["dm_fid"]));
  46.     $ondate=dm_date($rs0["ondate"]);
  47.    
  48.    
  49.     $sql= "SELECT * FROM dm_mails where dm_mailid=23";
  50.     $rs_query=mysql_query($sql);
  51.    
  52.     if ( $rs=mysql_fetch_array($rs_query)  )
  53.       {
  54.          if($rs["sb_status"]=="yes")    
  55.           {
  56.                      $from =$rs["dm_fromid"];
  57.                      $to = $rs1["email"];
  58.                      $subject =$rs["dm_subject"];
  59.            
  60.              $body=str_replace("%email%", $sb_null_char,str_replace("%pass%",$sb_null_char,$sb_null_char,str_replace("%lastname%", $rs1["lastname"],str_replace("%firstname%", $rs1["firstname"],str_replace("%usuario%",$rs1["usuario"], $rs["email"]) ))));
  61.                
  62.             $body=str_replace("%signup_url%",$sb_null_char,str_replace("%login_url%",$login_url,$body));
  63.  
  64.          $body=str_replace("%message_text%",$rs0["dm_message"],str_replace("%message_title%",$rs0["dm_subject"],str_replace("%sender_username%",$rs2["usuario"],str_replace("%message_date%",$ondate,$body))));
  65.              
  66.               $header="From:" . $from . "\r\n" ."Reply-To:". $from  ;
  67.              if(isset($rs["sb_html_format"])&&($rs["sb_html_format"]=="yes"))
  68.             {
  69.             $header .= "\r\nMIME-Version: 1.0";
  70.             $header .= "\r\nContent-type: text/html; charset=iso-8859-1\r\n";
  71.         //  $body=str_replace("\n","<br>",$body);
  72.             }
  73.  
  74. //  echo "--from:-$from----to:-$to---sub:-$subject----head:-$header----";
  75.     //echo "<pre>$body</pre>";
  76.     //die();
  77.                 if( $rs["sb_status"]=='yes')
  78.                      mail($to,$subject,$body,$header);
  79.  
  80.           }// end if status is on
  81.  
  82.          
  83.       }
  84.     $errmsg="Tu mensaje ha sido enviado a  ".$to_mem["usuario"];
  85.  
  86.  
  87.  
  88. header("Location:"."msg_confirm_mem.php?tid=$tid&id=".$fid."&sb_type=".$_REQUEST["sb_type"]."&errmsg=".urlencode($errmsg));
  89. die();
  90. ?>