Erlo

PHP实现openSug.js参数调试

2019-01-18 15:02:47 发布   411 浏览  
页面报错/反馈
收藏 点赞

这是一款利PHP对百度搜索下拉框提示免费代码实现参数配置调试的程序源代码.

由想要对网站进行搜索下拉调试的站长朋友们进行方便、快速的效果演示,具体参考下面的PHP代码.

如何使用?

请新建一份PHP文档,并将下面PHP代码粘贴进去,然后通过浏览器访问访该文档即可进行预览openSug各种效果

  1 php
  2 $starttime = explode(' ',microtime());
  3 $title = array(
  4     'qun' => 'QQ群',
  5     'friend' => '分流节点',
  6     'api' => 'API进阶',
  7 );
  8 
  9 session_start();
 10 $n = empty($_GET["n"]) ? NULL : $_GET["n"];
 11 $f = empty($_POST["friend"]) ? NULL : $_POST["friend"];
 12 $q = empty($_POST["qun"]) ? NULL : $_POST["qun"];
 13 $l = empty($_POST["link"]) ? NULL : $_POST["link"];
 14 
 15 date_default_timezone_set("PRC");
 16 header("Refresh: 3600");
 17 header("Content-Type:text/html;charset=utf-8");
 18 header("Cache-Control: max-age=". 9E9);
 19 header("Expires: ". gmdate ("l, d F Y H:i:s",strtotime("+9 year"))." GMT");
 20 
 21 define("Q", "./qun.list");
 22 define("F", "./friend.list");
 23 define("D", "./js/opensug.js");
 24 define("WP_USE_THEMES", false);
 25 define("G", "aHR0cHM6Ly9vcGVuc3VnLmdpdGh1Yi5pby9qcy9vcGVuc3VnLmpz");
 26 define("I", substr($_SERVER["PHP_SELF"],strrpos($_SERVER["PHP_SELF"], "/")+1));
 27 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"]));
 28 define("S", $_SERVER["SERVER_NAME"]);
 29 define("client", '_'. md5($_SERVER['REMOTE_ADDR']) .'_');
 30 //empty($_SERVER['HTTP_VIA']) or exit('Access Denied!');
 31 if(isset($_SESSION[client])){
 32     list($s1, $s2) = explode(' ', microtime());
 33     if( (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000) - $_SESSION[client] ){
 34         header("Refresh:5");
 35         header("HTTP/1.1 403 Forbidden");
 36         exit('

[403]刷新过于频繁, 请稍后重试!

'); 37 } 38 $_SESSION[client] = (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000); 39 }else{ 40 list($s1, $s2) = explode(' ', microtime()); 41 $_SESSION[client] = (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000); 42 } 43 44 if($n == 'js') _down(D);elseif($n == 'php')_down(I); 45 if(!empty($_GET['dl'])) _down('./user/'. $_GET['dl']); 46 47 // update openSug.js 48 if($n == S) exit(G); 49 if(!file_exists(D)){/* || (time()-filemtime(D)) > 604800*/ 50 !is_dir("./js/")&&mkdir("./js/", 0755, true); 51 $res = _curl(base64_decode(G)); 52 if(strlen($res) > 10){ 53 if(!file_put_contents(D, $res )) exit("Error: execution failed."); 54 }else(exit("Update failed!")); 55 header("Refresh: 3"); 56 exit("Updating openSug.js file, please wait..."); 57 } 58 59 if(!empty($f)){ 60 $url = parse_url($f) ? parse_url($f) : NULL; 61 if(!empty($url["host"])){ 62 $auth = _curl($url["scheme"] ."://". $url["host"] . (!empty($url["path"]) ? $url["path"] : NULL) ."?n=". $url["host"]); 63 if($auth == G){ 64 if(!file_put_contents(F, $url["scheme"]."://".$url["host"].$url["path"]."|" )) exit("Error: execution failed."); 65 $Msg = "Subnode sharing is complete, thank you for your support!"; 66 header("Refresh: 0"); 67 }else($Msg ="Error:The submission failed and the site you submitted is not an openSug subnode."); 68 } 69 } 70 71 if(!empty($q)){ 72 if(preg_match("/^d*$/",$q) && strlen($q) > 4){ 73 if(!empty($l) && strlen($l) == 64 && preg_match('/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9a-zA-Z]+$/', $l) == 1) $links = $l; 74 else $qunt = 'Illegal IdKey!'; 75 if(!file_put_contents(Q, intval($q).','. (empty($links) ? NULL : $links) .'|', FILE_APPEND)) $qunt = 'Failed!'; 76 $qunt = 'Success.'; 77 }else $qunt='Illegal group number!'; 78 } 79 80 if((!empty($_POST['user']))){ 81 !is_dir("./user/")&&mkdir("./user/", 0755, true); 82 if(!file_exists(D))exit($Msg = "The openSug.js file is missing."); 83 $userJS = time() .'.js'; 84 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."); 85 } 86 87 88 function get($i="",$o=""){return empty($_GET[$i]) ? $o : $_GET[$i];} 89 function _down($d){ 90 if(!file_exists($d)){header("HTTP/1.0 404 Not Found");return"";} 91 header("Content-type: application/javascript"); 92 header("Content-Disposition: attachment; filename="". basename($d) ."""); 93 exit(file_get_contents($d)); 94 } 95 96 function _curl($url = ""){ 97 if(function_exists("curl_init") && strlen($url) > 6){ 98 $c = curl_init(); 99 curl_setopt($c, CURLOPT_URL, $url); 100 curl_setopt($c, CURLOPT_TIMEOUT,5); 101 curl_setopt($c, CURLOPT_RETURNTRANSFER,TRUE); 102 curl_setopt($c, CURLOPT_SSL_VERIFYPEER,false); 103 curl_setopt($c, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); 104 $res = curl_exec($c); 105 $sta = curl_getinfo($c)["http_code"]; 106 curl_close($c); 107 if($sta == '200') return $res; 108 return false; 109 }else(exit("Error:the current environment does not support cURL.")); 110 }?> 111 <?php <span style="color: #0000ff;">echo <span style="color: #0000ff;">empty</span>(<span style="color: #800080;">$n</span>) ? '' : <span style="color: #800080;">$title</span>[<span style="color: #800080;">$n</span>] .'['. (<span style="color: #0000ff;">empty</span>(<span style="color: #800080;">$_GET</span>["sugResult"]) ? 'BaiduSuggestion' : <span style="color: #800080;">$_GET</span>["sugResult"]) .'.bind()] - ';?>百度搜索下拉框提示免费代码 - openSug.js
.bind" /> 112 header role="banner" style="padding:2.5% 4.5455%;background-color:#191919;margin-bottom:1em;"> 113
114

百度搜索下拉框提示免费代码_openSug.js

115

只需引用一段JS即可获得带有“搜索框提示”功能的搜索框,让您的搜索更便捷! license:MIT

116
117 header> 118 class="header" title="百度搜索下拉框提示免费代码 - openSug.js">

openSug.js

119
class="container"> 120
下载: JS PHP NPMJS  Q群 分流
121 if($n=='api'){?> 122
class="list" style="margin-bottom:0;"> 123
class="item title">
class="c-list-title">API进阶
124
class="row" style="padding:5rem">
class="DEMO1">
class="msfo">
class="DEMO3 DEMO0 DEMO4" id="inputObj" maxlength="2048" name="wd" autocapitalize="off" autocomplete="off" autocorrect="off" autofocus="autofocus" placeholder="本输入框ID为:inputObj">
125

关于出现Uncaught TypeError: Cannot read property '_GUID' of null的解决方案,请点击此处...

126
127 128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
class="i"> class="i" for="act">
class="i"> class="i">
class="i"> " /> class="i">
class="i"> class="i">
class="i"> class="i">
class="i"> class="i">
166
登录查看全部

参与评论

评论留言

还没有评论留言,赶紧来抢楼吧~~

手机查看

返回顶部

给这篇文章打个标签吧~

棒极了 糟糕透顶 好文章 PHP JAVA JS 小程序 Python SEO MySql 确认