Tuesday, October 23, 2012
Class for change date into Arabic format
<?php
class dateTime {
function __construct() {
}
/*
function changetoArabic($date)
*/
function changetoArabic($date) {
$date_array = explode("/", $date);
if(!$date_array['1']) {
$date_array = explode("-", $date);$superator = '-';
}
else $superator = '/';
$d = $date_array['0'];
$m = $date_array['1'];
$y = $date_array['2'];
if(is_numeric($d) && is_numeric($m) && is_numeric($y)) {
$num['0']='٠';
$num['1']='١';
$num['2']='٢';
$num['3']='٣';
$num['4']='٤';
$num['5']='٥';
$num['6']='٦';
$num['7']='٧';
$num['8']='٨';
$num['9']='٩';
$num['/']='/';
$num['-']='-';
$element = str_split($date);
$d_ar = '';
if(is_array($element)) {
foreach ($element as $k=>$v) {
$d_ar .= $num[$v];
}
}else $d_ar .= $num['0'];
return $d_ar;
}
else {
return "Error:Wrong Format";
}
}
}
?>
Monday, October 1, 2012
PHP Mail sending code with HTML Body to multiple recipients
<?php
// multiple recipients
//$to = 'satheesh@iv.bh' . ', '; // note the comma
//$to .= 'satheesh.tasks@gmail.com';
// subject
$subject = 'Birthday Reminders for August';
// message
$message = '
<html>
<head>
<title>'.$subject.'</title>
</head>
<body>
<p>Hi, <br>Please find the login credentials</p>
<p>Username : <br> Password : </p>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$to1 = 'Satheesh <satheesh.tasks@gmail.com>';
$to2 = 'Satheesh <satheesh@iv.bh>';
$headers .= 'To: '.$to1.', '.$to2.'' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
//$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
//$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
// Mail it
if(mail($to, $subject, $message, $headers))
echo "Mail sent";
else echo "Can't send";
?>
Subscribe to:
Comments (Atom)