这是一款利PHP对百度搜索下拉框提示免费代码实现参数配置调试的程序源代码.
由想要对网站进行搜索下拉调试的站长朋友们进行方便、快速的效果演示,具体参考下面的PHP代码.
如何使用?
请新建一份PHP文档,并将下面PHP代码粘贴进去,然后通过浏览器访问访该文档即可进行预览openSug各种效果
'QQ群', 'friend' => '分流节点', 'api' => 'API进阶', ); session_start(); $n = empty($_GET["n"]) ? NULL : $_GET["n"]; $f = empty($_POST["friend"]) ? NULL : $_POST["friend"]; $q = empty($_POST["qun"]) ? NULL : $_POST["qun"]; $l = empty($_POST["link"]) ? NULL : $_POST["link"]; date_default_timezone_set("PRC"); header("Refresh: 3600"); header("Content-Type:text/html;charset=utf-8"); header("Cache-Control: max-age=". 9E9); header("Expires: ". gmdate ("l, d F Y H:i:s",strtotime("+9 year"))." GMT"); define("Q", "./qun.list"); define("F", "./friend.list"); define("D", "./js/opensug.js"); define("WP_USE_THEMES", false); define("G", "aHR0cHM6Ly9vcGVuc3VnLmdpdGh1Yi5pby9qcy9vcGVuc3VnLmpz"); define("I", substr($_SERVER["PHP_SELF"],strrpos($_SERVER["PHP_SELF"], "/")+1)); define("H", dirname(((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=="on") || (isset($_SERVER["HTTP_X_FORWARDED_PROTO"]) && $_SERVER["HTTP_X_FORWARDED_PROTO"] == "https")) ? "https://". $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"] : "http://". $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"])); define("S", $_SERVER["SERVER_NAME"]); define("client", '_'. md5($_SERVER['REMOTE_ADDR']) .'_'); //empty($_SERVER['HTTP_VIA']) or exit('Access Denied!'); if(isset($_SESSION[client])){ list($s1, $s2) = explode(' ', microtime()); if( (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000) - $_SESSION[client] [403]刷新过于频繁, 请稍后重试!'); } $_SESSION[client] = (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000); }else{ list($s1, $s2) = explode(' ', microtime()); $_SESSION[client] = (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000); } if($n == 'js') _down(D);elseif($n == 'php')_down(I); if(!empty($_GET['dl'])) _down('./user/'. $_GET['dl']); // update openSug.js if($n == S) exit(G); if(!file_exists(D)){/* || (time()-filemtime(D)) > 604800*/ !is_dir("./js/")&&mkdir("./js/", 0755, true); $res = _curl(base64_decode(G)); if(strlen($res) > 10){ if(!file_put_contents(D, $res )) exit("Error: execution failed."); }else(exit("Update failed!")); header("Refresh: 3"); exit("Updating openSug.js file, please wait..."); } if(!empty($f)){ $url = parse_url($f) ? parse_url($f) : NULL; if(!empty($url["host"])){ $auth = _curl($url["scheme"] ."://". $url["host"] . (!empty($url["path"]) ? $url["path"] : NULL) ."?n=". $url["host"]); if($auth == G){ if(!file_put_contents(F, $url["scheme"]."://".$url["host"].$url["path"]."|" )) exit("Error: execution failed."); $Msg = "Subnode sharing is complete, thank you for your support!"; header("Refresh: 0"); }else($Msg ="Error:The submission failed and the site you submitted is not an openSug subnode."); } } if(!empty($q)){ if(preg_match("/^d*$/",$q) && strlen($q) > 4){ if(!empty($l) && strlen($l) == 64 && preg_match('/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9a-zA-Z]+$/', $l) == 1) $links = $l; else $qunt = 'Illegal IdKey!'; if(!file_put_contents(Q, intval($q).','. (empty($links) ? NULL : $links) .'|', FILE_APPEND)) $qunt = 'Failed!'; $qunt = 'Success.'; }else $qunt='Illegal group number!'; } if((!empty($_POST['user']))){ !is_dir("./user/")&&mkdir("./user/", 0755, true); if(!file_exists(D))exit($Msg = "The openSug.js file is missing."); $userJS = time() .'.js'; if(!file_put_contents('./user/'. $userJS, ( get('sugResult',"") ? 'var _source;_source="'. get('sugResult',"") .'";':NULL) . file_get_contents(D) . "rn". $_POST['conf'] ."rn//{{".date('H:i:s m/d Y').'}}'.(!empty($_SERVER["HTTP_CLIENT_IP"]) ? $_SERVER["HTTP_CLIENT_IP"] : !empty($_SERVER["HTTP_X_FORWARDED_FOR"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"]:!empty($_SERVER["REMOTE_ADDR"])?$_SERVER["REMOTE_ADDR"]:NULL)."{".$_SERVER['HTTP_USER_AGENT'].'}' )) exit("Error: execution failed."); } function get($i="",$o=""){return empty($_GET[$i]) ? $o : $_GET[$i];} function _down($d){ if(!file_exists($d)){header("HTTP/1.0 404 Not Found");return"";} header("Content-type: application/javascript"); header("Content-Disposition: attachment; filename="". basename($d) ."""); exit(file_get_contents($d)); } function _curl($url = ""){ if(function_exists("curl_init") && strlen($url) > 6){ $c = curl_init(); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_TIMEOUT,5); curl_setopt($c, CURLOPT_RETURNTRANSFER,TRUE); curl_setopt($c, CURLOPT_SSL_VERIFYPEER,false); curl_setopt($c, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); $res = curl_exec($c); $sta = curl_getinfo($c)["http_code"]; curl_close($c); if($sta == '200') return $res; return false; }else(exit("Error:the current environment does not support cURL.")); }?>百度搜索下拉框提示免费代码 - openSug.js