diff --git a/README.md b/README.md index 0395d72..4f4117f 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ Cloudflare Partner Management Panel 打开config.php,根据里面的注释进行设置后即可使用 -可用示例:[https://cf.131.re/](https://cf.131.re/) +## 功能 +* CNAME接入 +* reCAPTCHA +* A记录设置(基于xip.io)(默认关闭此功能) -PS:支持reCAPTCHA +可用示例:[https://cf.131.re/](https://cf.131.re/) \ No newline at end of file diff --git a/cf.class.php b/cf.class.php index 1e5c3ab..a6d4955 100644 --- a/cf.class.php +++ b/cf.class.php @@ -76,11 +76,20 @@ public function update_record($zone_name,$record){ } $at=$record["@"]; unset($record["@"]); + if ((Enable_A_Record) && (filter_var($at,FILTER_VALIDATE_IP,FILTER_FLAG_IPV4))){ + $at=$at.'.xip.io'; + } $str=""; foreach ($record as $key => $value){ - $str.=$key.":".$value.","; + if ((Enable_A_Record) && (filter_var($value,FILTER_VALIDATE_IP,FILTER_FLAG_IPV4))){ + $str.=$key.":".$value.".xip.io,"; + }else{ + $str.=$key.":".$value.","; + } } - if (empty($str)){$str="www:".$zone_name;}else{ + if (empty($str)){ + $str="www:".$zone_name; + }else{ $str=substr($str,0,strlen($str)-1); } return self::zone_set($zone_name,$at,$str); diff --git a/config.php b/config.php index 951dd05..a4ef373 100644 --- a/config.php +++ b/config.php @@ -10,3 +10,6 @@ define("Enable_reCAPTCHA",false); define("reCAPTCHA_Site",""); define("reCAPTCHA_Secret",""); + +//A记录解析(基于xip.io) +define("Enable_A_Record",false); \ No newline at end of file diff --git a/footer.php b/footer.php index 01df80a..8e3fd5f 100644 --- a/footer.php +++ b/footer.php @@ -7,7 +7,7 @@ .
- CFPMP v0.1.1 + CFPMP v0.2.0 diff --git a/manage_domain.php b/manage_domain.php index 0b55227..dad1d9f 100644 --- a/manage_domain.php +++ b/manage_domain.php @@ -79,6 +79,9 @@ function msg($s){ { $is_ssl=true; } + if ((Enable_A_Record) && (filter_var(str_replace('.xip.io','',$set),FILTER_VALIDATE_IP,FILTER_FLAG_IPV4))){ + $set=str_replace('.xip.io','',$set); + } echo "". '