Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7684

Re: when receiving the mail(php mail function), the variable's last value is getting converted to $ or # replacing the digit

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: when receiving the mail(php mail function), the variable's last value is getting converted to $ or # replacing the digit
Date 2012-12-03 11:14 -0500
Organization A noiseless patient Spider
Message-ID <k9ij5f$gi6$1@dont-email.me> (permalink)
References <e8d70433-eb79-437f-ac7e-bd0d29da0461@googlegroups.com>

Show all headers | View raw


On 12/3/2012 3:21 AM, hara.acharya@gmail.com wrote:
> Below is my code:
> But when I receive the mail, I don't get the last two digits in the $post_url.
> I tried displaying the same message on the page and it displayes $post_url properly.
> But when I receive the mail, I get the value of $post_url as www.32minutesforum.com/post_clicked.php?id$.
> where as I should get www.32minutesforum.com/post_clicked.php?id<some number>.
> i.e. www.32minutesforum.com/post_clicked.php?id15
> Please help!
> File:
> <?php
> include 'connect.php';
> include 'header.php';
>
> echo '<div class="holder_content">';
> echo '<section class="group_text">';
> echo 'Posted successfully. Check your post <a href="'.$_SESSION['reply_post_id'].'">HERE</a>';
>
> $post_url = $_SESSION['reply_post_id'];
> $to= $_SESSION['post_email'];
> $subject="You just got a reply for your post in 32minutesforum.com";
> $message='
> <html>
>     <head>
>        <title>32 Minutes Forum</title>
>     </head>
>     <body>
>        <p>You got a reply for your post title: '. $_SESSION['post_title'].'.</p>
>        <p>Check your post in:<br/>www.32minutesforum.com/'.$post_url.'.</p>
>
>        <p>Thanks for using 32minutesforum.com.<br/>
>           Thank you,<br/>
>           32minutesforum.com Team.</p>
>     </body>
> </html>';
>
> $message=stripslashes($message);
> //$message = wordwrap($message, 90);
> echo '<br/>message:'.$message.'<br/>';
> $headers  = 'MIME-Version: 1.0' . "\r\n";
> $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
> $headers .= "Content-Transfer-Encoding: quoted-printable". "\n";
> $headers .= 'Reply-To: '.$from_email.' . "\r\n";
> $headers .= 'From: 32 Minutes Forum<'.$from_email.'>' . "\r\n";
>
> if(mail($to, $subject, $message, $headers))
> {
>     $to=$_SESSION['reply_email'];
>
>     $message='
> <html>
>     <head>
>       <title>32 Minutes Forum</title>
>     </head>
>        <body>
>           <p>You replied to the post title: '. $_SESSION['post_title'].'.</p>
>           <p>Please check for updates and further replies in: www.32minutesforum.com/'.htmlentities($post_url).'.</p><br/>
>
>           <p>Thanks for using 32minutesforum.com.<br/>
>           Thank you,<br/>
>           32minutesforum.com Team.</p>
>        </body>
> </html>';
>
>     //$message=stripslashes($message);
>     $message = wordwrap($message, 90);
>     echo '<br/>message:'.$message.'<br/>';
>     $subject="You just replied for a post in 32minutesforum.com";
>
>     $headers  = 'MIME-Version: 1.0' . "\r\n";
>     $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
>     $headers .= "Content-Transfer-Encoding: quoted-printable". "\n";
>     $headers .= 'Reply-To: '.$from_email.' . "\r\n";
>     $headers .= 'From: 32 Minutes Forum<'.$from_email.'>' . "\r\n";
>
>
>
>     if(mail($to, $subject, $message, $headers))
>     {
>        //header("Location:thank_you.php?a=1");
>        echo "<br/>A mail has been sent to you and the post creator.";
>     }
>     else
>     {
>        echo "<br/>Could not Send Mail to you.";
>        exit;
>     }
> }
> else
> {
>     echo "Could not send an intimation to the post owner but both owner and you can always check <a href=".$_SESSION['reply_post_id'].">here </a>for details, replies and updates...";
>     exit;
> }
>
>
> echo '</section></div>';
> include 'footer.php';
> ?>
>

Insufficient information.  For instance, what's in 
$_SESSION['reply_post_id'] when you send the email?  What's actually in 
the source of the email you receive?

Also, why are you using stripslashes()?  Is magic_quotes_gpc() enabled 
on your system?  If so, it should be OFF.

BTW - your routine is VERY UNSAFE.  It would be very easy for a hacker 
to use your script to send spam to a lot of people.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

when receiving the mail(php mail function), the variable's last value is getting converted to $ or # replacing the digit hara.acharya@gmail.com - 2012-12-03 00:21 -0800
  Re: when receiving the mail(php mail function), the variable's last value is getting converted to $ or # replacing the digit Jerry Stuckle <jstucklex@attglobal.net> - 2012-12-03 11:14 -0500
    Re: when receiving the mail(php mail function), the variable's last value is getting converted to $ or # replacing the digit hara.acharya@gmail.com - 2012-12-03 15:38 -0800
      Re: when receiving the mail(php mail function), the variable's last value is getting converted to $ or # replacing the digit Jerry Stuckle <jstucklex@attglobal.net> - 2012-12-03 20:39 -0500
      Re: when receiving the mail(php mail function), the variable's last value is getting converted to $ or # replacing the digit John-Paul Stewart <jpstewart@sympatico.ca> - 2012-12-04 13:20 -0500
        Re: when receiving the mail(php mail function), the variable's last value is getting converted to $ or # replacing the digit hara.acharya@gmail.com - 2012-12-04 23:39 -0800

csiph-web