Last active
August 29, 2015 14:06
-
-
Save jerry74/fe657519f7f9620a804a to your computer and use it in GitHub Desktop.
Revisions
-
jerry74 revised this gist
Sep 5, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,8 +32,8 @@ function findip($allips) { $realip = findip(array_reverse($allips)); $ip = findip(array_reverse($allips)); $username = "[email protected]"; //Cloudflare登入帳號 $api = "key"; //Cloudflare API KEY //Setting some variables for the request $hostname = 'xxx.domain.com'; //要更新的Domain -
jerry74 created this gist
Sep 5, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ <?php if( empty($_GET['key']) || $_GET['key'] != "Pv226Key" ) die("Not Authorized!"); $allips = array(); if (isset($_SERVER['HTTP_CLIENT_IP'])) { array_push($allips, $_SERVER['HTTP_CLIENT_IP']); } if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $proxyips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); $allips = array_merge($allips, $proxyips); } if (isset($_SERVER['HTTP_X_REMOTE_ADDR'])) { array_push($allips, $_SERVER['HTTP_X_REMOTE_ADDR']); } array_push($allips, $_SERVER['REMOTE_ADDR']); function findip($allips) { foreach($allips as $ip) { $ip = trim($ip); if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false) { if (substr($ip, 0, 3) !== '127') { return $ip; } } } return $_SERVER['REMOTE_ADDR']; } $fromip = findip($allips); $realip = findip(array_reverse($allips)); $ip = findip(array_reverse($allips)); $username = "[email protected]"; //cloudfare登入帳號 $api = "key"; //cloudfare API KEY //Setting some variables for the request $hostname = 'xxx.domain.com'; //要更新的Domain $cloudflare = "https://www.cloudflare.com/api_json.html"; $request = "?a=DIUP&hosts=$hostname&u=$username&tkn=$api&ip=$ip"; $request_url = $cloudflare . $request; file_get_contents($request_url); echo "Success!";