Re: Help with an error...
| From: | Wolf | Date: | Fri, 25 Jul 2008 02:09:17 +0000 |
| Subject: | Re: Help with an error... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-277281@lists.php.net to get a copy of this message | ||
<!-- SNIP -->
Here is the updated code....
Notice!!
$message doesn't contain any PHP code within it
$query only has a single ; within the whole line, right at the end of the "; to complete the
PHP assignment string. Placing one inside it will barf the script typically.
$headers are all concactenated together, you were overwriting them all with your last statement.
================================
<?php
//VAR Are set here....
$hostname =
hostname -f;
//This is a simple email to give me the status from yester day.
//This connect the script to the db
//To use ',' between e-mail address for multiple recipents
$to = 'terrorpup@yahoo.co.uk';
//Set the Subject here...
$subject = "The IPs that Attacked ".$hostname." report from Fyre";
//Database Set is here...
require_once('mysql_connect.inc');
$query = "Select ip, date, time, CONCAT(city, ', ',country) as location from ips
where country !=' ' and date = current_date() order by date,time,country asc";
$result = mysql_query($query) ;
if ($result) //if that ran ok, display the record
{
$data = "<table width='150'><tr><th> Country </th><th>
# of Attacks </th></tr>";
//fetch and print the records
while ($row = mysql_fetch_array($result,MYSQL_NUM))
{
$data.= "<tr><td align=left>$row[0]</td><td><div
align=right>$row[1]</div></td></tr>";
}
$data.= "</table>";
mysql_free_result ($result); //free up the resources
}
else //if did not run ok
{
$data="<p>This could not be display due to a system error. We apologize fore any
incovenience.</p><p>".mysql_error()."</p>";
}
mysql_close(); //Close the database connection.
//The Message goes here....
$message = "<html>
<head>
<title>Attack's on $hostname</title>
</head>
<body>";
$message .=$data;
$message .="</body>
</html>";
//To Send HTML Mail; The Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: FYRE REPORT <root@magidesign.com>';
// Mail it
mail($to, $subject, $message, $headers);
?>