Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ahoadon
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Phạm Quang Huy
ahoadon
Commits
5e16320d
Commit
5e16320d
authored
Feb 20, 2020
by
Pham Huy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update form dki tu van
parent
f4a8b0ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
47 deletions
+49
-47
register-customer.php
...t/themes/ahoadonviet/template-parts/register-customer.php
+49
-47
No files found.
wp-content/themes/ahoadonviet/template-parts/register-customer.php
View file @
5e16320d
...
@@ -63,14 +63,14 @@ $message_unsent = "Đã xảy ra lỗi, vui lòng kiểm tra lại.";
...
@@ -63,14 +63,14 @@ $message_unsent = "Đã xảy ra lỗi, vui lòng kiểm tra lại.";
$message_sent
=
"Cảm ơn khách hàng đã đăng ký! Chúng tôi sẽ liên hệ lại sớm nhất."
;
$message_sent
=
"Cảm ơn khách hàng đã đăng ký! Chúng tôi sẽ liên hệ lại sớm nhất."
;
//user posted variables
//user posted variables
$taxcode
=
$_POST
[
'customer_taxcode'
]
;
$taxcode
=
trim
(
$_POST
[
'customer_taxcode'
])
;
$company
=
$_POST
[
'customer_company'
]
;
$company
=
trim
(
$_POST
[
'customer_company'
])
;
$address
=
$_POST
[
'customer_address'
]
;
$address
=
trim
(
$_POST
[
'customer_address'
])
;
$city
=
$_POST
[
'customer_city'
]
;
$city
=
trim
(
$_POST
[
'customer_city'
])
;
$email
=
$_POST
[
'customer_email'
]
;
$email
=
trim
(
$_POST
[
'customer_email'
])
;
$name
=
$_POST
[
'customer_name'
]
;
$name
=
trim
(
$_POST
[
'customer_name'
])
;
$phone
=
$_POST
[
'customer_phone'
]
;
$phone
=
trim
(
$_POST
[
'customer_phone'
])
;
$message
=
$_POST
[
'customer_message'
]
;
$message
=
trim
(
$_POST
[
'customer_message'
])
;
$submitted
=
$_POST
[
'submitted'
];
$submitted
=
$_POST
[
'submitted'
];
//php mailer variables
//php mailer variables
...
@@ -80,45 +80,47 @@ $headers = 'From: '. $email . "\r\n" . 'Reply-To: ' . $email . "\r\n";
...
@@ -80,45 +80,47 @@ $headers = 'From: '. $email . "\r\n" . 'Reply-To: ' . $email . "\r\n";
// var_dump($email);
// var_dump($email);
$check_form
=
true
;
$check_form
=
true
;
if
(
!
validate_taxcode
(
$taxcode
)
&&
!
empty
(
$taxcode
))
{
if
(
$submitted
==
1
){
//taxcode is valid
if
(
!
validate_taxcode
(
$taxcode
)
&&
!
empty
(
$taxcode
))
{
form_response
(
"error"
,
$taxcode_invalid
);
// taxcode is valid
$check_form
=
false
;
form_response
(
"error"
,
$taxcode_invalid
);
}
$check_form
=
false
;
if
(
!
filter_var
(
$email
,
FILTER_VALIDATE_EMAIL
)
&&
!
empty
(
$email
))
{
}
//email is valid
if
(
!
filter_var
(
$email
,
FILTER_VALIDATE_EMAIL
)
&&
!
empty
(
$email
))
{
form_response
(
"error"
,
$email_invalid
);
// email is valid
$check_form
=
false
;
form_response
(
"error"
,
$email_invalid
);
}
$check_form
=
false
;
if
(
preg_match
(
"/^[0-9]
{
12
}
$/"
,
$phone
)
&&
!
empty
(
$phone
))
{
}
// $phone is valid
if
(
!
preg_match
(
"/^[0-9]
{
10,12
}
$/"
,
$phone
)
&&
!
empty
(
$phone
))
{
form_response
(
"error"
,
$email_invalid
);
// phone is valid
$check_form
=
false
;
form_response
(
"error"
,
$phone_invalid
);
}
$check_form
=
false
;
}
//validate form to sent mail
if
(
$check_form
&&
$submitted
==
1
){
//validate form to sent mail
//validate presence of name and message
if
(
$check_form
){
if
(
empty
(
$taxcode
)
||
empty
(
$company
)
||
empty
(
$name
)
||
empty
(
$phone
)){
//validate presence of name and message
form_response
(
"error"
,
$missing_content
);
if
(
empty
(
$taxcode
)
||
empty
(
$company
)
||
empty
(
$name
)
||
empty
(
$phone
)){
}
else
{
form_response
(
"error"
,
$missing_content
);
//ready to go!
}
else
{
$content_mail
=
"Gửi đến từ: Ahoadon.com<br>
//ready to go!
Khách hàng: "
.
$name
.
" đã đăng ký tư vấn trở thành đại lý Ahoadon<br>
$content_mail
=
"Gửi đến từ: ahoadon.com
Khách hàng: "
.
$name
.
" đã đăng ký tư vấn trở thành đại lý Ahoadon
Công ty : "
.
$company
.
"<br>
Mã số thuế : "
.
$taxcode
.
"<br>
Công ty : "
.
$company
.
"
Số điện thoại : "
.
$phone
.
"<br>
Mã số thuế : "
.
$taxcode
.
"
Địa chỉ : "
.
$address
.
"<br>
Số điện thoại : "
.
$phone
.
"
Tỉnh/ Thành phố: "
.
$city
.
"<br>
Địa chỉ : "
.
$address
.
"
Nội dung : "
.
$message
.
"
Tỉnh/ Thành phố: "
.
$city
.
"
Nội dung : "
.
$message
.
"
-----------------
Email này được gửi đến từ form Đăng ký tư vấn đại lý của website ahoadon.com"
;
-----------------
Email này được gửi đến từ form Đăng ký tư vấn đại lý của website ahoadon.com"
;
$sent
=
wp_mail
(
$to
,
$subject
,
$content_mail
,
$headers
);
if
(
$sent
)
form_response
(
"success"
,
$message_sent
);
//message sent!
$sent
=
wp_mail
(
$to
,
$subject
,
$content_mail
,
$headers
);
else
form_response
(
"error"
,
$message_unsent
);
//message wasn't sent
if
(
$sent
)
form_response
(
"success"
,
$message_sent
);
//message sent!
else
form_response
(
"error"
,
$message_unsent
);
//message wasn't sent
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment