Re: Help with an error...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<!-- 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@xxxxxxxxxxx'; 

//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@xxxxxxxxxxxxxx>'; 

// Mail it 
mail($to, $subject, $message, $headers); 
?> 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux