Re: Help with an error...

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

 



On Thu, Jul 24, 2008 at 1:52 PM, <payne@xxxxxxxxxxxxxxxxxxx> wrote:

> Hi,
>
> I am  currently working on a php script that will be called by cron. But I
> have an error that keeps coming up.
>
> Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on
>
> What I am trying to do is a simple php script to send me a report
> everynight. Any clues as to why? Also does anyone know of a site with mail
> srcipts that are ran on the cli?
>
> ---------------------------------------------
> <?php
> $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
>
> //This is a simple email to give me the status from yesterday.
> //This connect the script to the db
> 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)
>
>        $mailsend = mail("terrorpup@xxxxxxxxx","The IP's that Attacked
> $hostname", "The following are ip's that have try to attack your
> system.\r\n\r\
>
>
>        if ($result) { //if that ran ok, display the record
>                echo "<table width=\'150\'><tr><td> Country </td><td> # of
> Attacks
> </td></tr>";
>
>                //fetch and print the records
>
>                while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
>                echo "<tr><td align=\'left\'>$row[0]</td><td><div
> align=\'right\'>$row[1]</div></td></tr>";
>                }
>
>                echo '</table>';
>
>                mysql_free_result ($result); //free up the resources
>
>                } else {  //if did not run ok
>
>                echo '<p>This could not be display due to a system error.
> We apologize
> fore any incovenience.</p><p>'. mysql_error() . '</p>';
>
>                }
>
> ","From:fyre@xxxxxxxxxxxx <From%3Afyre@xxxxxxxxxxxx>\r\nReply
> To:fyre@xxxxxxxxxxxx <To%3Afyre@xxxxxxxxxxxx>");
> print("$mailsend");
> ?>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
first off, you are missing the ending semi-colon from line 11

$result = mysql_query($query); //  <-- missing semi colon

secondly, the whole mail thing is really f**ked up. I suggest that you buils
the message body separately and then include it at the end. You just can't
start off with a mail call and drop other stuff into the middle of it



-- 

Bastien

Cat, the other other white meat

[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