[Phpwm] Basic PHP Query (Very basic!)
Justin Joyce
justin.joyce at cit.coop
Thu Apr 27 12:02:39 BST 2006
Thanks for input Jon - I know there was / is a CRON job running due to
previously having access to the mailbox that received the job. This
windows account has now been closed so it is no longer possible to get
them. Code for the cron.php file used on the site is below:
<?
$mysql_link = mysql_connect("217.8.240.11", "birthday", "card");
$sdp=mysql_select_db("emp_data");
$adminemail = "happybirthday at coopbirthday.co.uk ";
$dt = date("Y/m/d");
$str = "Select empid,firstname,lastname,email from
employeemaster where dayofmonth(dateofbirth)='" .date("d") . "' and
month(dateofbirth)='" . date("m") . "'" ;
//echo $str;
$rs = mysql_query($str) or die(mysql_error());
$num_rows = mysql_num_rows($rs);
if ($num_rows > 0)
{
$strf = "select cardurl from birthdaycardmaster";
$resultf = mysql_query($strf) or die(mysql_error());
if (mysql_num_rows($resultf) > 0)
list($cardfile) = mysql_fetch_array($resultf);
if (isset($cardfile) && $cardfile <> "" &&
file_exists($cardfile))
{
$msgsubj = "";
$sql="Select msgid,msgsubj from messagemaster
order by msgid desc limit 1";
$result=mysql_query($sql);
if(mysql_num_rows($result)>0)
list($msgid,$msgsubj)=mysql_fetch_array($result);
//echo $msgid . " " . $msgsubj . "dd";
if (isset($msgsubj) && $msgsubj <> "")
{
while(list($empid,$firstname,$lastname,$email) = mysql_fetch_array($rs))
{
//echo $cardfile .
$email . "<br>";
/*$m= new Mail; //
create the mail
$m->From($adminemail);
$m->To($email);
$m->Subject($msgsubj);
//$m->Attach($cardfile,
"application/x-zip-compressed" ,"attachment") ; // attach a file
of type image/gif
$msg = "<font
face='Arial, Helvetica, sans-serif' size='2'><b>Dear " .
ucfirst($firstname) . "</b>,<br>Many happy returns of the day<br><br>To
view your card, click on the following link. <br><br> <a
href=\"http://www.coopbirthday.co.uk/cardview.php?id=$empid\">http://www
.coopbirthday.co.uk/cardview.php?id=$empid</a><br><br>Best
Wishes<br><br>The Management Team.<br></font>";
//
$m->Body( $msg);
// set the body
$m->Priority(2) ;
// set the priority to Low
$m->Send(); //
send the mail
*/
$subject = $msgsubj;
$emal = $adminemail ; //
from
$eml = $email; //to
$headers = "From:" .
$emal ."\nReply-To: " .$emal. "\nContent-Type: text/html;
charset=iso-8859-1;";
$msg =
"<html><body><p><font face='Arial, Helvetica, sans-serif'
size='2'><b>Dear " . ucfirst($firstname) . "</b>,<br>Many happy returns
of the day<br><br>To view your card, click on the following link.
<br><br> <a
href=\"http://www.coopbirthday.co.uk/cardview.php?id=$empid\">http://www
.coopbirthday.co.uk/cardview.php?id=$empid</a><br><br>Best
Wishes<br><br>The Management Team.<br></font></p></body></html>" ;
//echo $eml . " " .
$subject . " " . $msg . " " . $headers;
if
(!mail("$eml","$subject","$msg","$headers"))
$mailmsg=1;
else
$mailmsg=2;
$strEmp = "Update
employeemaster set msgid = $msgid,msgdate = '" . $dt . "' where empid =
" . $empid;
mysql_query($strEmp);
}
}
}
}
//echo $str;
?>
Thanks
Justin
-----Original Message-----
From: phpwm-bounces at mailman.lug.org.uk
[mailto:phpwm-bounces at mailman.lug.org.uk] On Behalf Of Jon Spriggs
Sent: 27 April 2006 11:59
To: phpwm at mailman.lug.org.uk
Subject: Re: [Phpwm] Basic PHP Query (Very basic!)
How do you know there was a CRON job running this task?
If you can get the crontab file for the account running the task, then
you can see which file is doing the e-mailing.
Jon
On 4/27/06, Justin Joyce <justin.joyce at cit.coop> wrote:
>
> -----Original Message-----
> From: phpwm-bounces at mailman.lug.org.uk
> [mailto:phpwm-bounces at mailman.lug.org.uk] On Behalf Of David Goodwin
> Sent: 27 April 2006 11:44
> To: phpwm at mailman.lug.org.uk
> Subject: Re: [Phpwm] Basic PHP Query (Very basic!)
>
> David Goodwine wrote :
> > Ladies and Gents,
> >
> >Hello,
> >
> >You'll probably need to just edit /etc/aliases, which should have a
> format of :
> >
> >user: destination
> >
> >e.g.
> >root: fred at spam.com
> >
> >
> >Just change the destination address, and run the command "newaliases"
> >
> >Thanks
> >David.
>
> Thanks David, however I should have been clearer in my original
> message and stated that I do not have any direct access to the box
> itself - only FTP access to wwwroot and phpmyadmin for the databases.
> I'm beginning to wonder if it was perhaps initiated somewhere else and
> this has stopped working.
>
> Thanks,
>
> Justin
>
> Co-operative IT is part of The Midcounties Co-operative The
> Midcounties Co-operative is an innovative co-operative business, owned
by its customers and staff in the 9 counties it spans. We trade in a
number of retail sectors including food, travel, funerals, motors,
childcare, pharmacy, post offices and IT. We are proud to be a
successful co-operative, founded on co-operative values and principles
that co-ops share throughout the world.
>
>
>
> This e-mail is confidential and is for the named recipient(s) only. If
you are not the named recipient(s) please do not disseminate or copy
this e-mail, but please delete it and any copies from your computer.
The Midcounties Co-operative has taken reasonable precautions to ensure
that any attachment to this e-mail has been checked for viruses.
However, we cannot accept liability for any damage sustained as a result
of any such viruses and advise you to carry out your own virus checks
before opening any attachment. Furthermore, we do not accept
responsibility for any change made to this message after it was sent by
the sender.
>
> _______________________________________________
> Phpwm mailing list
> Phpwm at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/phpwm
>
_______________________________________________
Phpwm mailing list
Phpwm at mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/phpwm
------------------------------------------------------------------------
--------
This Message has been Scanned by SurfControl(c) Email Filter
------------------------------------------------------------------------
--------
Co-operative IT is part of The Midcounties Co-operative
The Midcounties Co-operative is an innovative co-operative business, owned by its customers and staff in the 9 counties it spans. We trade in a number of retail sectors including food, travel, funerals, motors, childcare, pharmacy, post offices and IT. We are proud to be a successful co-operative, founded on co-operative values and principles that co-ops share throughout the world.
This e-mail is confidential and is for the named recipient(s) only. If you are not the named recipient(s) please do not disseminate or copy this e-mail, but please delete it and any copies from your computer. The Midcounties Co-operative has taken reasonable precautions to ensure that any attachment to this e-mail has been checked for viruses. However, we cannot accept liability for any damage sustained as a result of any such viruses and advise you to carry out your own virus checks before opening any attachment. Furthermore, we do not accept responsibility for any change made to this message after it was sent by the sender.
More information about the Phpwm
mailing list