Hi,
This is a page on my site to send PMs to members. I want the page to email the person who has just recieved a PM. Please help!
[QUOTE]
<?php
include(“./admin/config.php”);
include(“$include_path/common.php”);
include(“$include_path/pm_check.php”);
global $HTTP_POST_VARS,$HTTP_GET_VARS,$HTTP_SESSION_VARS;
global $_SESSION;
if ($HTTP_POST_VARS!=””)
$_POST=$HTTP_POST_VARS;
if ($HTTP_GET_VARS!=””)
$_GET=$HTTP_GET_VARS;
if ($HTTP_SESSION_VARS!=””)
$_SESSION=$HTTP_SESSION_VARS;
check_user_login();
include(“$include_path/$table_file”);
include(“$include_path/doc_head.php”);
include(“$include_path/styles.php”);
if(!isset($_POST[‘submit_message’]) && !isset($
header(“Location: $base_url/”);
exit();
}
$user_id = isset($_GET[‘i’]) ? $
$i = 0;
$error = false;
$subject_msg = “”;
$post_msg = “”;
$reply_subject = “”;
$reply_post = “”;
$preview_content = “”;
$quoted = “”;
$resubject = “”;
if(isset($_POST[‘submit_message’])){
if(!isset($_POST[‘i’])){
header(“Location: $base_url/”);
exit();
} else {
$user_id = $_POST[‘i’];
}
if(!strlen($_POST[‘reply_subject’])){
$error = true;
$subject_msg = “<br>No subject submitted.”;
} else {
$reply_subject = $_POST[‘reply_subject’];
}
if(strlen($_POST[‘reply_post’])){
if(strlen($_POST[‘reply_post’]) > 4096){
$length = strlen($_POST[‘reply_post’]) – 4096;
$error = true;
$post_msg = “<br>4K or less. ” . $length . ” bytes too large.”;
} else {
$reply_post = $_POST[‘reply_post’];
}
} else {
$error = true;
$post_msg = “<br>No message submitted.”;
}
if(!$error){
// $reply_subject=addslashes($reply_subject);
// $reply_post=addslashes($reply_post);
insert_private_message($user_id, $reply_subject, $reply_post, $_SESSION[‘userid’]);
header(“Location: $base_url/my_messages.php?i=$user_id”);
exit();
}
}
$final_output .= <<<FO
</head>
<body bgcolor=”$page_bg_color” leftmargin=”0″ topmargin=”0″ marginwidth=”0″ marginheight=”0″ >
<table border=”0″ cellpadding=”0″ cellspacing=”0″ width=”100%” align=”center”>
<tr>
<td colspan=”3″ width=”100%” valign=”bottom”>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ width=”100%”>
<tr>
<td align=”right” valign=”bottom”>
FO;
// include (“Ads_new.php”);
include (“header.php”);
$final_output .= <<<FO
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width=”20%” valign=”top”>
FO;
include(“$include_path/left.php”);
$final_output .= <<<FO
</td>
<td width=”80%” valign=”top”>
FO;
include(“$include_path/show_user_links.php”);
$title = “Private Message”;
$uid = $_SESSION[‘userid’];
$check_blocked = check_user_blocked($uid,$user_id);
IF($check_blocked == 0){
$content = <<<EOF
EOF;
$comment_user_name = get_username($user_id);
$p_user=$comment_user_name;
if(check_approved_image($user_id)){
$comment_user_name = <<<EOF
<a class=”bold” href=”$base_url/?i=$user_id”>$comment_user_name</a>
EOF;
}
$content .= <<<EOF
<table cellpadding=”3″ cellspacing=”0″ border=”0″ width=”100%”>
<tr>
<td class=”bold” align=”right”>Leave Private Message For: $comment_user_name </td>
</tr>
<tr>
<td class=”regular”>
EOF;
if($p_user == $_SESSION[username]) {
$comment_reply_table = <<<EOF
<table cellpadding=”3″ cellspacing=”1″ border=”0″ width=”100%”>
<tr>
<input type=”hidden” name=”i” value=”$user_id”>
<td class=”bold-rv” colspan=”2″> Leave Private Message</td>
</tr>
<tr class=”alt1″>
<td class=”regular” colspan=”2″ align=”left”>You cannot send Private Message to yourself.</td>
</tr>
</table>
EOF;
}
else {
$comment_reply_table = <<<EOF
<table cellpadding=”3″ cellspacing=”1″ border=”0″ width=”100%”>
<tr><form method=”post” action=”$base_url/message.php”>
<input type=”hidden” name=”i” value=”$user_id”>
<td class=”bold-rv” colspan=”2″> Leave Private Message</td>
</tr>
<tr class=”alt2″>
<td class=”regular” align=”right”>Logged in as:</td>
<td class=”regular”><a href=”$base_url/?i=$
</tr>
<tr class=”alt1″>
<td class=”regular” align=”right”>Subject:</td>
<td class=”regular”><input class=”input” type=”text” name=”reply_subject” size=”67″ value=”$reply_subject”><span class=”error”>$subject_msg</span></td>
</tr>
<tr class=”alt1″>
<td class=”regular” align=”right” valign=”top”><br>Message:</td>
<td class=”regular”><textarea class=”input” name=”reply_post” rows=”16″ cols=”70″ wrap=”virtual”>$reply_post</textarea><span class=”error”>$post_msg</span></td>
</tr>
<tr class=”alt2″>
<td class=”regular” align=”center” colspan=”2″ nowrap><input class=”button” type=”submit” name=”submit_message” value=”Leave Private Message”></td>
</form></tr>
</table>
EOF;
}
$content .= table_no_title($comment_reply_table);
$content .= <<<EOF
</td>
</tr>
</table>
EOF;
}
ELSE
{
$content = <<<EOF
<br><br>Sorry this user has blocked you, therefore you cannot contact them<br><br><br>
EOF;
}
$final_output .= table($title, $content);
$final_output .= <<<FO
</td>
</tr>
</table>
FO;
include(“$include_path/footer.php”);
$final_output .= $contents;
$final_output .= <<<FO
</body>
</html>
FO;
echo $final_output;
?>