13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Examining the Script Architecture<br />

661<br />

Listing 29.2<br />

Continued<br />

if($header->reply_toaddress) {<br />

$to = $header->reply_toaddress;<br />

} else {<br />

$to = $header->fromaddress;<br />

}<br />

$cc = $header->ccaddress;<br />

$subject = "Re: ".$header->subject;<br />

$body = add_quoting(stripslashes(imap_body($imap, $messageid)));<br />

imap_close($imap);<br />

display_new_message_form($_SESSION['auth_user'],<br />

$to, $cc, $subject, $body);<br />

}<br />

break;<br />

case 'reply':<br />

//set to address as reply-to or from of the current message<br />

if(!$imap) {<br />

$imap = open_mailbox($_SESSION['auth_user'],<br />

$_SESSION['selected_account']);<br />

}<br />

if($imap) {<br />

$header = imap_header($imap, $messageid);<br />

if($header->reply_toaddress) {<br />

$to = $header->reply_toaddress;<br />

} else {<br />

$to = $header->fromaddress;<br />

}<br />

$subject = "Re: ".$header->subject;<br />

$body = add_quoting(stripslashes(imap_body($imap, $messageid)));<br />

imap_close($imap);<br />

}<br />

display_new_message_form($_SESSION['auth_user'],<br />

$to, $cc, $subject, $body);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!