102 lines
4.1 KiB
PHP
102 lines
4.1 KiB
PHP
<?php
|
|
// SET ERROR REPORTING
|
|
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
|
|
ini_set('display_errors', TRUE);
|
|
|
|
// SET INCLUDE PATH TO ROOT OF SE
|
|
include "../../include/database_config.php";
|
|
include "../../include/functions_email.php";
|
|
//mail("leprakhauns@gmail.com", "Birthday Emails", "PPPPPPP");
|
|
mail("phil@b8world.com","Birthday Mail Sent", "Sent");
|
|
function user_displayname($user_info)
|
|
{
|
|
// SET DISPLAY NAME
|
|
if( !empty($user_info['user_displayname']) && trim($user_info['user_displayname']) )
|
|
return $user_info['user_displayname'];
|
|
elseif( !empty($user_info['user_fname']) && !empty($user_info['user_lname']) && trim($user_info['user_fname']) && trim($user_info['user_lname']) )
|
|
return $user_info['user_fname'].' '.$user_info['user_lname'];
|
|
elseif( !empty($user_info['user_fname']) && trim($user_info['user_fname']) )
|
|
return $user_info['user_fname'];
|
|
elseif( !empty($user_info['user_lname']) && trim($user_info['user_lname']) )
|
|
return $user_info['user_lname'];
|
|
elseif( !empty($user_info['user_username']) && trim($user_info['user_username']) )
|
|
return $user_info['user_username'];
|
|
else
|
|
return $user_info['user_id'];
|
|
}
|
|
|
|
function d2seCon($dbInfo)
|
|
{
|
|
$link = mysql_connect($dbInfo['dbHost'], $dbInfo['dbUser'], $dbInfo['dbPassword']);
|
|
return mysql_select_db ($dbInfo['dbName']);
|
|
}
|
|
|
|
$aSeCon = array( 'dbHost'=>$database_host,
|
|
'dbUser'=>$database_username,
|
|
'dbPassword'=>$database_password,
|
|
'dbName'=>$database_name
|
|
);
|
|
d2seCon( $aSeCon );
|
|
|
|
/////////SETTINGS
|
|
$aSttng = array();
|
|
$sSql = " SELECT
|
|
*
|
|
FROM `birthdayEmails_options` ";
|
|
$rResult = mysql_query($sSql);
|
|
while( ($aRow=mysql_fetch_assoc($rResult)) )
|
|
$aSttng[ $aRow['var'] ] = stripslashes($aRow['value']);
|
|
if( $aSttng['userlevels'] == "")
|
|
$aSttng['userlevels'] = 0;
|
|
//////////////////////////////////////////////////////////////////////////
|
|
if( $aSttng['enabled'] == 1 )
|
|
{
|
|
$search = array('[displayname]');
|
|
$sCol = "profilevalue_".mysql_real_escape_string($aSttng['bdayField']);
|
|
$aSttng['userlevels'] = mysql_real_escape_string($aSttng['userlevels']);
|
|
$iTime = time();
|
|
$iMonth = date('n', $iTime);
|
|
$iDay = date('j', $iTime);
|
|
$sql=" SELECT
|
|
`u`.`user_id`,
|
|
`u`.`user_displayname`,
|
|
`u`.`user_fname`,
|
|
`u`.`user_lname`,
|
|
`u`.`user_username`,
|
|
`u`.`user_email`,
|
|
`u`.`user_pdp_evc`,
|
|
u.user_enabled,
|
|
`v`.`{$sCol}` AS `bDate`,
|
|
DAY(`v`.`{$sCol}`) AS `day`,
|
|
MONTH(`v`.`{$sCol}`) AS `month`
|
|
FROM `se_users` AS `u`
|
|
INNER JOIN `se_profilevalues` AS `v`
|
|
ON `v`.`profilevalue_user_id` = `u`.`user_id`
|
|
WHERE
|
|
DAY(`v`.`{$sCol}`) = '{$iDay}' &&
|
|
MONTH(`v`.`{$sCol}`) = '{$iMonth}' &&
|
|
`u`.`user_level_id` IN ({$aSttng['userlevels']}) ";
|
|
$result=mysql_query($sql) or die(mysql_error());
|
|
$aSttng['subject'] = stripslashes($aSttng['subject']);
|
|
$aSttng['message'] = stripslashes($aSttng['message']);
|
|
$aSttng['message'].="<div style=\"padding-top:20px;font-size:80%;\"><p>If you do not wish to receive further communications like this you can change your Notification Preferences by <a href='http://bateworld.com/user_account_privacy.php'>clicking here</a>. Please note that it may take up to 10 days to process your request and you must be logged into your account. Alternatively, you can disable your BateWorld account by <a href='http://bateworld.com/user_account_delete.php'>clicking here</a>.
|
|
</p><p>Visit our <a href='http://bateworld.com/privacypolicy.php?refval=[pdp_uid]'>Privacy Policy</a> and <a href='http://bateworld.com/help_tos.php'>Terms of Service</a> if you have any questions.</p></div>";
|
|
|
|
while( ($aRow = mysql_fetch_assoc($result)) )
|
|
{
|
|
$aRow['name'] = user_displayname($aRow);
|
|
$replace = array($aRow['name']);
|
|
$message = str_replace('[pdp_uid]', $aRow['user_id'], $aSttng['message']);
|
|
if($aRow['user_pdp_evc'] == 1 || $aRow['user_pdp_evc']==3){
|
|
if($aRow["user_enabled"]==1){
|
|
//echo "abc";
|
|
// echo $aRow['user_email'];
|
|
// echo "<br />";
|
|
// $aRow['user_email']="bateworld@gmail.com";
|
|
send_birthday_email($aRow['user_email'], $aSttng['fromAddress'], $aSttng['subject'], $message, $search, $replace);
|
|
// exit();
|
|
}}
|
|
}
|
|
}
|
|
?>
|