Code Monkey home page Code Monkey logo

fix-ze3kr-cloudflare's Introduction

Fix-ZE3kr-Cloudflare

其实和白嫖不白嫖的关系不大。白嫖一样能用,不过CF的API解析参数严格了一些。

问题出现在:

添加DNS记录:

actions/add_record.php 第20行往后

	$options = [
		'type' => $_POST['type'],
		'name' => $_POST['name'],
		'content' => $_POST['content'],
		'proxied' => $_POST['proxied'],
		'ttl' => intval($_POST['ttl']),
		'data' => $dns_data, 
	];

	if ($_POST['type'] == 'MX') {
		$options['priority'] = intval($_POST['priority']);
	}
	try {
		$dns = $adapter->post('zones/' . $_GET['zoneid'] . '/dns_records', $options);

上面的data在非CAA、SRV记录中是空的(见record_data.php中定义)。但是CF的API无法解析这个空数组,所以就无法添加DNS记录。

修改DNS记录:

actions/edit_record.php 第31行记录

巴拉巴拉巴拉吧(同样的问题,不再赘述)

解决:

传入之前删除这个空数组。

$options = [
	'type' => $_POST['type'],
	'name' => $_POST['name'],
	'content' => $_POST['content'],
	'proxied' => $_POST['proxied'],
	'ttl' => intval($_POST['ttl']),
	'data' => $dns_data, 
];

if ($_POST['type'] == 'MX') {
	$options['priority'] = intval($_POST['priority']);
}
try {
	if(empty($options['data']))unset($options['data']);##就是这一行啦。
	$dns = $adapter->post('zones/' . $_GET['zoneid'] . '/dns_records', $options);

当然你也可以直接下载

https://github.com/yumusb/Fix-ZE3kr-Cloudflare/blob/master/add_record.php 替换掉 actions/add_record.php

https://github.com/yumusb/Fix-ZE3kr-Cloudflare/blob/master/edit_record.php 替换掉 actions/edit_record.php

最后

如果有帮助到你,请不要吝啬。 http://33.al/donate

fix-ze3kr-cloudflare's People

Contributors

yumusb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.