GIF89a;
| Direktori : /home/serb/www/m/lib/ |
| Current File : /home/serb/www/m/lib/common.php |
<?php
include_once __DIR__ . '/../phpmailer/PHPMailerAutoload.php';
function sendEmail($to, $subject, $message, $replyTo = '') {
$mail = new PHPMailer();
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = SMTP_SERVER; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = SMTP_USER; // SMTP username
$mail->Password = SMTP_PASS; // SMTP password
$mail->Port = SMTP_PORT; // TCP port to connect to
$mail->From = SMTP_FROM_EMAIL;
$mail->FromName = SMTP_FROM_NAME;
$mail->addAddress($to);
if ($replyTo) {
$mail->addReplyTo($replyTo);
}
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AltBody = strip_tags(str_replace(array('<br />', '<br>', '<BR>', '<BR/>', '<BR />'), "\n", $message));
try {
return $mail->send();
} catch(\Exception $e) {
return false;
}
}
function execute_query($query)
{
global $servername;
global $dbname;
global $dbusername;
global $dbpassword;
$con = mysql_connect($servername,$dbusername,$dbpassword);
if(!$con)
{
echo "Could not connect to MySQL : ".mysql_error();
exit();
}
mysql_select_db($dbname,$con) or die ("Can not connect to $con : Database $dbname");
$result = mysql_query($query,$con) or die ("Can not execute query $query");
return $result;
mysql_close($con);
}
function format_date($dt)
{
$var_totaldate=explode("/",$dt);
$var_date=$var_totaldate[0];
$var_month=settype($var_totaldate[1], integer);
$var_year=$var_totaldate[2];
$mon=array();
$mon[1]="January";
$mon[2]="February";
$mon[3]="March";
$mon[4]="April";
$mon[5]="May";
$mon[6]="June";
$mon[7]="July";
$mon[8]="August";
$mon[9]="September";
$mon[10]="October";
$mon[11]="November";
$mon[12]="December";
for($i=1;$i<=12;$i++)
{
if($i==$var_month)
{
$month_value=$mon[$i];
}
else
{
$month_value="";
}
}
$complete_date=$month_value." ".$var_date.", ".$var_year;
echo $complete_date;
}
?>