示例#1
0
$limitprice = 200;

$subject = "Клуб Нумизмат |  Вы хотели сделать заказ?";
$headers = "From: Numizmatik.Ru<*****@*****.**>\nContent-type: text/html; charset=\"windows-1251\"";

$cron_class = new crons($cfg['db']);

$timenow = mktime(0,0,0, date("m", time()), date("d", time()), date("Y", time()));

$sql = "select shopcoins_search.*,user.fio,user.email,user.user from `order`, orderdetails,shopcoins_search,`user` where orderdetails.order=order.order and order.check=0 and order.user!=811 and order.user=user.user and user.userstatus=0 and user.sumlimit=0 and order.date>".($timenow-($lastday+1)*24*3600)." and order.date<".($timenow-$lastday*24*3600)." 
and (shopcoins_search.shopcoins=orderdetails.catalog or (shopcoins_search.parent=orderdetails.catalog and shopcoins_search.materialtype in (7,8))) and shopcoins_search.check=1 and order.user>0 and orderdetails.status=0 and shopcoins_search.price>=$limitprice
and shopcoins_search.shopcoins not in(select expouserid.shopcoins from expouserid,calling where calling.result=2 and calling.calling=expouserid.calling and expouserid.check!=2 and expouserid.user=order.user and expouserid.dateinsert>".($timenow - 60*24*3600).") 
and user.email like '%@%' 
 order by user.user,user.email ;";

$result = $cron_class->getDataSql($sql);

$fio = '';
$user = 0;
$email = '';
$mailmessage = '';
$arrayshopcoins = array();
$content ='';

foreach ($result as $rows) {
	if ($email != $rows['email']) {
	
		if ($email !='') {		
			$href = '';
			
			if (sizeof($arrayshopcoins)>0) {