subdomain去除尾部.

This commit is contained in:
Wayne 2024-03-13 11:13:34 +08:00
parent da866552d1
commit 2f7fee69bb

View File

@ -207,17 +207,16 @@ if ($_REQUEST['act'] == 'edit') {
if (strlen($_POST['domain'])) {
if (strpos($_POST['domain'], $_CFG['cf_domain']) !== false) {
$sub_domain = str_replace($_CFG['cf_domain'], '', $_POST['domain']);
// 如果sub_domain最後有.,則去掉
// sub_domain是為.結束,是的話就去掉
if (substr($sub_domain, -1) == '.') {
$sub_domain = substr($sub_domain, 0, -1);
}
include_once(ROOT_PATH . 'back/includes/cls_cloudflare.php');
$cf_obj = new cloudflare;
$ret = $cf_obj->update_domain($cf['cf_iden'], trim($sub_domain));
if (!$ret) {
// sys_msg('網域自動修改失敗,請重新操作',1, array(), false);
$cf_iden = 0;
sys_msg('網域自動修改失敗,請重新操作',1, array(), false);
// $cf_iden = 0;
} else {
$cf_iden = $ad_ret;
}
@ -228,7 +227,7 @@ if ($_REQUEST['act'] == 'edit') {
if (strlen($_REQUEST['domain'])) {
if (strpos($_REQUEST['domain'], $_CFG['cf_domain']) !== false) {
$sub_domain = str_replace($_CFG['cf_domain'], '', $_REQUEST['domain']);
// 如果sub_domain最後有.,則去掉
// sub_domain是為.結束,是的話就去掉
if (substr($sub_domain, -1) == '.') {
$sub_domain = substr($sub_domain, 0, -1);
}
@ -236,8 +235,8 @@ if ($_REQUEST['act'] == 'edit') {
$cf_obj = new cloudflare;
$ad_ret = $cf_obj->add_domain(trim($sub_domain));
if (!$ad_ret) {
// sys_msg('網域自動新增失敗,請重新操作',1, array(), false);
$cf_iden = 0;
sys_msg('網域自動新增失敗,請重新操作',1, array(), false);
// $cf_iden = 0;
} else {
$cf_iden = $ad_ret;
}