Forum Moderators: open
<?php
if ($_GET['confirm'] == 'true') {
$to = 'report@example.com';
$headers = "From: {$_COOKIE['user']} <$to>\r\n" .
'X-Mailer: php';
$subject = 'Whatever';
if ($_GET['why']) $body .= 'Why: ' . $_GET['why'] . "\n\n";
if ($_GET['summary']) $body .= 'Summary: ' . $_GET['summary'];
$body = stripslashes($body);
mail($to, $subject, $body, $headers);
}
echo <<<EOF
<form name="report" method="GET"
onSubmit="
var val;
for (i=0; i < 4; i++)
if (document.report.why[i].checked == true)
val = document.report.why[i].value;
$(#lightbox).ajax('$home/report.php?confirm=true&why=' + val + '&summary=' + this.summary.value);
return false">
Summary<br>
<textarea name="summary"></textarea>
</form>
EOF; <?php
if ($_GET['confirm'] == 'true') {
//// Converts the <br> in the URI to \n
$_GET['summary'] = str_replace('<br>', "\n", $_GET['summary']);
////
$to = 'report@example.com';
$headers = "From: {$_COOKIE['user']} <$to>\r\n" .
'X-Mailer: php';
$subject = 'Whatever';
if ($_GET['why']) $body .= 'Why: ' . $_GET['why'] . "\n\n";
if ($_GET['summary']) $body .= 'Summary: ' . $_GET['summary'];
$body = stripslashes($body);
mail($to, $subject, $body, $headers);
}
echo <<<EOF
<form name="report" method="GET"
onSubmit="
var val;
for (i=0; i < 4; i++)
if (document.report.why[i].checked == true)
val = document.report.why[i].value;
//// Converts the \n to <br> before sending, then encodes the whole thing for URI
var summary = this.summary.value.replace(/(\\r\\n|\\r|\\n)/g, '<br>');
summary = encodeURIComponent(summary);
$(#lightbox).ajax('$home/report.php?confirm=true&why=' + val + '&summary=' + summary);
////
return false">
Summary<br>
<textarea name="summary"></textarea>
</form>
EOF;