On my website, I have a reportpost.php piece of code. I have set it up so that when you click the report button, this code launches. In the e-mail part, I don't get the posts content.
<?php
session_start();
$con = mysql_connect("---","---","---");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ecerca", $con);
//$result = mysql_query("SELECT Content FROM Entries ORDER BY id");
$result = mysql_query("SELECT * FROM Posts WHERE Username='$_SESSION[Username]' ORDER BY ID");
mysql_close($con);
$row = mysql_fetch_array($result);
while ($row = mysql_fetch_array($result))
{
if ($row['ID'] == $_GET['id']){
echo "$row[Content]";
}
}
$to1 = "ecerserver@outlook.com";
$subject = "Reported Post | Ecer Forums";
$message = "Someone has reported a post on Ecer Forums!
This is a message to inform you that
Username: '" . $usr . "'
has reported the following post: '" . $row['Content'] . "'";
$from = "admin@ecer.ca";
$headers = "From: $from";
mail($to1,$subject,$message,$headers);
mail($to2,$subject,$message,$headers);
header("location:http://www.ecer.ca/myposts/?msg=1");
exit();
?>