|
 |
|
รบกวนช่วยดูหน่อยนะคะ บันทึกข้อมูลลงฐานข้อมูลได้ แต่ส่งเมลล์ไม่ได้ค่ะ |
|
 |
|
|
 |
 |
|
Code (PHP)
<?PHP
$globals_test = @ini_get('register_globals');
if ( isset($globals_test) && empty($globals_test) ) {
$types_to_register = array('GET', 'POST', 'COOKIE', 'SESSION', 'SERVER');
foreach ($types_to_register as $type) {
$arr = @${'_' . $type};
if (@count($arr) > 0)
extract($arr, EXTR_SKIP);
}
}
error_reporting(E_ALL & ~E_NOTICE);
session_start();
$Ip=$_SERVER['REMOTE_ADDR'];
include "../config.inc.php";
include "../function.inc.php";
if(session_is_registered("valid_user")){
$orderCode=date("YmdHis");
$sql2="INSERT INTO orderlist SET ssId='$PHPSESSID',custCode='$valid_user',orderCode='$orderCode',orderNote='$orderNote',dTypeId='$dTypeId',totalWeight='$totalWeight',dCost='$dCost',totalQty='$totalQty',orderDate=NOW(),Ip='$Ip',lastUpdate=NOW(),lastUpdateBy='$valid_user'";
$query2=mysql_query($sql2);
if($query2){
$sql="INSERT INTO orderdetail(ssId,pId,pQuantity,pPrice,custCode) SELECT
`transaction`.`ssId`,
`transaction`.`pId`,
`transaction`.`pQuantity`,
`product`.`b_price`,'$valid_user'
FROM
`product`
INNER JOIN `transaction` ON (`product`.`id` = `transaction`.`pId`)
WHERE `transaction`.`ssId`='$PHPSESSID'";
$query=mysql_query($sql);
/////////////send Email
$msg="<strong>ลููกค้าทำรายการสั่งซื้อสินค้า</strong><br>
<br>
จากทางเว็บไซต์ <strong>exd.com</strong>
<br>
<br>
กรุณาคลิก link ด้านล่างนี้ (หรือ copy link ไปเปิด) เพื่อตรวจสอบรายการสั่งซื้อ<br>
<br>
<font color='#FF0000'>http://www.innoread.com/exd/admin</font><br>
<br>
<strong>EXD : Electronic Express Delivery</strong><br>
โทร (6674) 289369<br>
E-mail: [email protected] <br>
http://www.innoread.com/exd ";
$boundary=uniqid("");
$header="From: Electronic Express Delivery\n";
$header.="Content-type: multipart/mixed; boundary=\"$boundary\"\n";
$body="--$boundary\n";
$body.="Content-type: text/html; charset=utf-8;\n";
$body.="Content-disposition: inline;\n";
$body.="Content-transfer-encoding : 8bit\n\n";
$body.="$msg\n";
$body.="--$boundary--\n";
$to="[email protected]";
$mTopic="=?UTF-8?B?".base64_encode("ลูกค้าทำรายการสั่งซื้อสินค้า")."?=";
if(@mail($to,$mTopic,$body,$header)){
showMessage("สั่งซื้อเรียบร้อย","listorder.php");
}else{
showMessage("Error! ไม่สามารถส่ง E-Mail ได้","listorder.php");
}
/////////////End Send Email
if($query){
$sql3="DELETE FROM transaction WHERE ssId='$PHPSESSID'";
@mysql_query($sql3);
@session_regenerate_id();
}else{
showMessage("Error!! ไม่สามารถทำรายได้".mysql_error(),"listorder.php");
}
}else{
showMessage("Error!! เกิดข้อผิดพลาด ไม่สามารถทำรายการได้".mysql_error(),"listorder.php");
}
}else{
showMessage("กรุณา Login ก่อนทำรายการ","index.php");
}
?>
จาก code นี้ มีเงื่อนไขตรงไหนผิดไปรึป่าวคะ
มันบันทึกข้อมูลลงฐานข้อมูล แต่ไม่ส่งเมลล์ค่ะ
ขึ้น massage box ว่า Error! ไม่สามารถส่ง E-Mail ได้
รบกวนด้วยนะคะ
ขอบคุณค่ะ
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2013-05-25 10:33:08 |
By :
tidaangle |
View :
742 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้แระค่ะ ปรับใหม่ละ
Code (PHP)
<?PHP
$globals_test = @ini_get('register_globals');
if ( isset($globals_test) && empty($globals_test) ) {
$types_to_register = array('GET', 'POST', 'COOKIE', 'SESSION', 'SERVER');
foreach ($types_to_register as $type) {
$arr = @${'_' . $type};
if (@count($arr) > 0)
extract($arr, EXTR_SKIP);
}
}
error_reporting(E_ALL & ~E_NOTICE);
session_start();
$Ip=$_SERVER['REMOTE_ADDR'];
include "../config.inc.php";
include "../function.inc.php";
if(session_is_registered("valid_user")){
$orderCode=date("YmdHis");
$sql2="INSERT INTO orderlist SET ssId='$PHPSESSID',custCode='$valid_user',orderCode='$orderCode',orderNote='$orderNote',dTypeId='$dTypeId',totalWeight='$totalWeight',dCost='$dCost',totalQty='$totalQty',orderDate=NOW(),Ip='$Ip',lastUpdate=NOW(),lastUpdateBy='$valid_user'";
$query2=mysql_query($sql2);
if($query2){
$sql="INSERT INTO orderdetail(ssId,pId,pQuantity,pPrice,custCode) SELECT
`transaction`.`ssId`,
`transaction`.`pId`,
`transaction`.`pQuantity`,
`product`.`b_price`,'$valid_user'
FROM
`product`
INNER JOIN `transaction` ON (`product`.`id` = `transaction`.`pId`)
WHERE `transaction`.`ssId`='$PHPSESSID'";
$query=mysql_query($sql);
/////////////send Email
$strTo = "[email protected]";
$strSubject = "=?UTF-8?B?".base64_encode("ลูกค้าทำรายการสั่งซื้อสินค้า")."?=";
$strHeader = "From: [email protected]";
$strMessage = "ลููกค้าทำรายการสั่งซื้อสินค้าจากทางเว็บไซต์ Exd.com
กรุณาคลิก link ด้านล่างนี้ (หรือ copy link ไปเปิด) เพื่อตรวจสอบรายการสั่งซื้อ
http://www.innoread.com/exd/admin
EXD : Electronic Express Delivery
โทร (6674) 289369
E-mail: [email protected]
http://www.innoread.com/exd ";
$flgSend = @mail($strTo,$strSubject,$strMessage,$strHeader); // @ = No Show Error //
if($flgSend)
{
showMessage("สั่งซื้อเรียบร้อย","listorder.php");
}
else
{
showMessage("Error! ไม่สามารถส่ง E-Mail ได้","listorder.php");
}
/////////////End Send Email
if($query){
$sql3="DELETE FROM transaction WHERE ssId='$PHPSESSID'";
@mysql_query($sql3);
@session_regenerate_id();
}else{
showMessage("Error!! ไม่สามารถทำรายได้".mysql_error(),"listorder.php");
}
}else{
showMessage("Error!! เกิดข้อผิดพลาด ไม่สามารถทำรายการได้".mysql_error(),"listorder.php");
}
}else{
showMessage("กรุณา Login ก่อนทำรายการ","index.php");
}
?>

|
 |
 |
 |
 |
Date :
2013-05-25 14:27:35 |
By :
tidaangle |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|