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.";
$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
$taxcode
=
$_POST
[
'customer_taxcode'
]
;
$company
=
$_POST
[
'customer_company'
]
;
$address
=
$_POST
[
'customer_address'
]
;
$city
=
$_POST
[
'customer_city'
]
;
$email
=
$_POST
[
'customer_email'
]
;
$name
=
$_POST
[
'customer_name'
]
;
$phone
=
$_POST
[
'customer_phone'
]
;
$message
=
$_POST
[
'customer_message'
]
;
$taxcode
=
trim
(
$_POST
[
'customer_taxcode'
])
;
$company
=
trim
(
$_POST
[
'customer_company'
])
;
$address
=
trim
(
$_POST
[
'customer_address'
])
;
$city
=
trim
(
$_POST
[
'customer_city'
])
;
$email
=
trim
(
$_POST
[
'customer_email'
])
;
$name
=
trim
(
$_POST
[
'customer_name'
])
;
$phone
=
trim
(
$_POST
[
'customer_phone'
])
;
$message
=
trim
(
$_POST
[
'customer_message'
])
;
$submitted
=
$_POST
[
'submitted'
];
//php mailer variables
...
...
@@ -80,45 +80,47 @@ $headers = 'From: '. $email . "\r\n" . 'Reply-To: ' . $email . "\r\n";
// var_dump($email);
$check_form
=
true
;
if
(
!
validate_taxcode
(
$taxcode
)
&&
!
empty
(
$taxcode
))
{
//taxcode is valid
form_response
(
"error"
,
$taxcode_invalid
);
$check_form
=
false
;
}
if
(
!
filter_var
(
$email
,
FILTER_VALIDATE_EMAIL
)
&&
!
empty
(
$email
))
{
//email is valid
form_response
(
"error"
,
$email_invalid
);
$check_form
=
false
;
}
if
(
preg_match
(
"/^[0-9]
{
12
}
$/"
,
$phone
)
&&
!
empty
(
$phone
))
{
// $phone is valid
form_response
(
"error"
,
$email_invalid
);
$check_form
=
false
;
}
//validate form to sent mail
if
(
$check_form
&&
$submitted
==
1
){
//validate presence of name and message
if
(
empty
(
$taxcode
)
||
empty
(
$company
)
||
empty
(
$name
)
||
empty
(
$phone
)){
form_response
(
"error"
,
$missing_content
);
}
else
{
//ready to go!
$content_mail
=
"Gửi đến từ: Ahoadon.com<br>
Khách hàng: "
.
$name
.
" đã đăng ký tư vấn trở thành đại lý Ahoadon<br>
Công ty : "
.
$company
.
"<br>
Mã số thuế : "
.
$taxcode
.
"<br>
Số điện thoại : "
.
$phone
.
"<br>
Địa chỉ : "
.
$address
.
"<br>
Tỉnh/ Thành phố: "
.
$city
.
"<br>
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"
;
$sent
=
wp_mail
(
$to
,
$subject
,
$content_mail
,
$headers
);
if
(
$sent
)
form_response
(
"success"
,
$message_sent
);
//message sent!
else
form_response
(
"error"
,
$message_unsent
);
//message wasn't sent
if
(
$submitted
==
1
){
if
(
!
validate_taxcode
(
$taxcode
)
&&
!
empty
(
$taxcode
))
{
// taxcode is valid
form_response
(
"error"
,
$taxcode_invalid
);
$check_form
=
false
;
}
if
(
!
filter_var
(
$email
,
FILTER_VALIDATE_EMAIL
)
&&
!
empty
(
$email
))
{
// email is valid
form_response
(
"error"
,
$email_invalid
);
$check_form
=
false
;
}
if
(
!
preg_match
(
"/^[0-9]
{
10,12
}
$/"
,
$phone
)
&&
!
empty
(
$phone
))
{
// phone is valid
form_response
(
"error"
,
$phone_invalid
);
$check_form
=
false
;
}
//validate form to sent mail
if
(
$check_form
){
//validate presence of name and message
if
(
empty
(
$taxcode
)
||
empty
(
$company
)
||
empty
(
$name
)
||
empty
(
$phone
)){
form_response
(
"error"
,
$missing_content
);
}
else
{
//ready to go!
$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
.
"
Mã số thuế : "
.
$taxcode
.
"
Số điện thoại : "
.
$phone
.
"
Địa chỉ : "
.
$address
.
"
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"
;
$sent
=
wp_mail
(
$to
,
$subject
,
$content_mail
,
$headers
);
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