notify_verify(); if($verify_result) { // out_trade_no= $_POST["out_trade_no"] // status = $_POST["trade_status"] // put the database string here, to update the database if ( $_POST["trade_status"] == 'TRADE_FINISHED' ){ $sql="UPDATE `order_record` SET `payment_status` = '1' where `order_no` = '".escapeit($_POST["out_trade_no"])."'"; $db->query($sql); $k=0; $print_fav = ''; $sql = "SELECT * FROM `order_record` WHERE `order_no` = '".escapeit($_POST["out_trade_no"])."'"; $row = $db->getrow($sql); $sql_item = "SELECT * FROM `order_item` WHERE `order_id` = '".$row['id']."' ORDER BY `id` ASC"; $rs_item = $db->query($sql_item); while ( $row_item = $db->fetch_array($rs_item) ){ $print_fav.='
#'.($k+1).'
Name'.$cart_item[$row_item["product_id"]]["name"].'
Item No.'.$cart_item[$row_item["product_id"]]["item_no"].'
Qty'.$row_item["quantity"].'
Unit Price'.$currency_unit['Hong Kong'].' '.number_format($cart_item[$row_item["product_id"]]["price"]['Hong Kong'],2).'
'; $k++; } $clientname=$row['name']; $clientemail=$row['email']; if($clientemail==""){ exit; } $email_head="Lepora Limited"; $body=' �L���D���

Name'.$row['name'].'
Email'.$row['email'].'
Address'.$row['address'].'
Phone'.$row['phone'].'
Order Detail '.($print_fav).'
Shipping'.$currency_unit['Hong Kong'].' '.number_format($row['shipping'],2).'
Tax'.$currency_unit['Hong Kong'].' '.number_format($row['tax'],2).'
Order Total'.$currency_unit['Hong Kong'].' '.number_format($row['order_total'],2).'





 

'; $sendername="YourOrder@leporaltd.com"; $from="YourOrder@leporaltd.com"; $mail = new PHPMailer(); $name = trim($clientname); $email = trim($clientemail); $mail->From = trim($from);//??? address //$mail->ReplyTo = trim($from); $mail->AddReplyTo(trim($from), $sendername); $mail->FromName = trim($sendername);//??? name $mail->Sender = trim($from); $mail->Subject = "Order Invoice [#".$row['order_no']."] - ".$email_head; $mail->Body = $body;//??html???????? $mail->isHTML(true); clearstatcache(); $mail->AddAddress($clientemail); $mail->AddCC("orders@leporaltd.com"); $mail->AddBCC("kaze@smartinfo.com.hk"); $result = $mail->Send(); header("LOCATION: ../pour_through.php"); exit; } else { echo "fail"; } } else { echo "fail"; } ?>