Send mail with credit card encryption in joomla

Your code modifications and patches you want to share with others.
Locked
User avatar
arjuninfo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Sat Aug 08, 2009 12:50 pm
Location: India ,chennai

Send mail with credit card encryption in joomla

Post by arjuninfo » Thu Apr 22, 2010 1:21 pm

Hi,

IF you want send the encrypted credit card information in mail .please follow this


function sendMailFunc($invoiceNo="")
{
$to = $_POST['emailId'];

$subject = "Payment Confirmation - ".$invoiceNo;

$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1;\n";
$headers .= "X-Mailer: PHP 5\n";
$headers .= "X-Priority: 3 \n";

$headers .= 'From: juju from@yourmail.com'."\r\n";
$ccEmails = $_POST['ccemail'];
$headers .= 'Cc: '.$ccEmails.''."\r\n";

$message .= "<br><br>Dear ".$_POST['cname'].",<br><br>";
$message .= "Thank you for the payment done for ".$_POST['projectName']." project.";

$message .= "Invoice Number: ".$invoiceNo."<br>";
$message .= "Paid through Credit Card<br>";
$message .= "-----------Project Details---------------------------<br>";
$message .= "Project Name : ".$_POST['projectName']."<br>";
$message .= "Project Description : ".$_POST['projectDesc']."<br>";
$message .= "Amount : ".$_POST['amount']."<br>";

if(strlen($_POST['ccemail']) > 1)
{
$message .= "CC Email Id : ".$_POST['ccemail']."<br>";
}
else
{
$message .= "CC Email Id : --- "."<br>";
}
$message .= "Payee Name : ".$_POST['cname']."<br>";
$message .= "Card Type : ".$_POST['creditCardType']."<br>";

// Encrypted Credit card
$number = $_POST['creditCardNumber'];
$lastFourdigit = substr($number,strlen($number)-4,strlen($number));
$length = strlen($number);
$encrypted = array();
for($i=0; $i<$length-4; $i++)
{
$encrypted[] = substr_replace($number, "x", $length[$i]);
}
$encCreditCardNumber = implode("", $encrypted).$lastFourdigit;


$message .= "Card Number : ".$encCreditCardNumber."<br>";
$message .= "Card Security Code : ***<br>";
$message .= "Expiration Date : ".$_POST['expDateMonth']." ".$_POST['expDateYear']."<br><br>";

$message .= "First Name : ".$_POST['fname']."<br>";
$message .= "Last Name : ".$_POST['lname']."<br>";
$message .= "Phone : ".$_POST['phone']."<br>";
$message .= "Address 1 : ".$_POST['address1']."<br>";
$message .= "Address 2 : ".$_POST['address2']."<br>";
$message .= "City : ".$_POST['city']."<br>";
$message .= "State : ".$_POST['state']."<br>";
$message .= "Country : ".$_POST['country']."<br>";
$message .= "Zip code : ".$_POST['zip']."<br>";

mail($to, $subject, $message, $headers);
return true;
}
M.Arjun

User avatar
arjuninfo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Sat Aug 08, 2009 12:50 pm
Location: India ,chennai

Re: Send mail with credit card encryption in joomla

Post by arjuninfo » Thu Apr 22, 2010 1:21 pm

For encrypt credit card

// Encrypted Credit card
$number = $_POST['creditCardNumber'];
$lastFourdigit = substr($number,strlen($number)-4,strlen($number));
$length = strlen($number);
$encrypted = array();
for($i=0; $i<$length-4; $i++)
{
$encrypted[] = substr_replace($number, "x", $length[$i]);
}
$encCreditCardNumber = implode("", $encrypted).$lastFourdigit;


$message .= "Card Number : ".$encCreditCardNumber."<br>";
M.Arjun

User avatar
arjuninfo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Sat Aug 08, 2009 12:50 pm
Location: India ,chennai

Re: Send mail with credit card encryption in joomla

Post by arjuninfo » Thu Apr 22, 2010 1:23 pm

To call this function use like like this

if($this->sendMailFunc($invoice_no))
{
$mainframe->redirect('index.php?option=com_me');
}
else
{
$mainframe->redirect('index.php?option=com_me');
}
M.Arjun


Locked

Return to “Core Hacks and Patches”