PHP实现openSug.js参数调试
程序员文章站
2022-07-02 17:02:36
这是一款利PHP对百度搜索下拉框提示免费代码实现参数配置调试的程序源代码. 由想要对网站进行搜索下拉调试的站长朋友们进行方便、快速的效果演示,具体参考下面的PHP代码. 如何使用? 请新建一份PHP文档,并将下面PHP代码粘贴进去,然后通过浏览器访问访该文档即可进行预览openSug各种效果 1 < ......
这是一款利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] < 2000){ 34 header("refresh:5"); 35 header("http/1.1 403 forbidden"); 36 exit('<p style="margin:0px;text-align:center;background-color:#fdffce;font-size:12px;padding:5px 30px;border:1px #ffba43 solid;font-weight:700;color:#ff0000;">[403]刷新过于频繁, 请稍后重试!</p>'); 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 = '<span style="color:red;">illegal idkey!</span>'; 75 if(!file_put_contents(q, intval($q).','. (empty($links) ? null : $links) .'|', file_append)) $qunt = '<span style="color:red">failed!</span>'; 76 $qunt = '<span style="color:green">success.</span>'; 77 }else $qunt='<span style="color:red;">illegal group number!</span>'; 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) . "\r\n". $_post['conf'] ."\r\n//{{".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 <!doctype html><html><head><meta charset="utf-8"><title><?php echo empty($n) ? '' : $title[$n] .'['. (empty($_get["sugresult"]) ? 'baidusuggestion' : $_get["sugresult"]) .'.bind()] - ';?>百度搜索下拉框提示免费代码 - opensug.js</title><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"><link rel="dns-prefetch" href="//img.shields.io"/><link rel="dns-prefetch" href="//data.jsdelivr.com"/><link rel="dns-prefetch" href="//www.bountysource.com"/><link rel="dns-prefetch" href="//travis-ci.org"/><link rel="dns-prefetch" href="//ghbtns.com"/><link rel="dns-prefetch" href="//cloudflare.com"/><link rel="dns-prefetch" href="//api.travis-ci.org"/><link rel="dns-prefetch" href="//api.github.com"/><link rel="dns-prefetch" href="//www.opensug.eu.org"/><link rel="dns-prefetch" href="//hm.baidu.com"/><link rel="dns-prefetch" href="//cdn.jsdelivr.net"/><link rel="dns-prefetch" href="//www.baidu.com"/><link rel="dns-prefetch" href="//opensug.github.io"/><style type="text/css">html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;font-size:62.5%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;padding:3px;outline:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer;margin-left:-6px}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input[type=text]{width:61%}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-scrollbar-track-piece{background-color:#f8f8f8;}::-webkit-scrollbar{width:9px;height:9px;}::-webkit-scrollbar-thumb{background-color:#dddddd;background-clip:padding-box;min-height:28px;}::-webkit-scrollbar-thumb:hover{background-color:#bbb;}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}.list:after,.list:before,.item:after,.item:before{content:"";display:table}.list:after,.item:after{clear:both;overflow:hidden}.c-list-title,.item-1st,.item-2nd,.item-3rd{float:left}body{color:#333;font-size:16px;font-family:verdana,helvetica,"lihei pro","microsoft jhenghei",sans-serif;line-height:1.6;background:#fff}a{color:#008b8b;text-decoration:none}a:hover{text-decoration:underline}.container,.detail{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0 auto;max-width:1080px;padding-left:10px;padding-right:10px}.header{background:#eee;margin-bottom:30px;width:100%;line-height:50px;height:50px}.header h1{margin:0 auto;text-align:center;line-height:2em;font-size:1.5em}.header h1 a{color:#008b8b}.header h1 a:focus,.header h1 a:hover{text-decoration:none}.examples{height:130px;margin-bottom:1em;padding-top:2em}.demo{float:right;margin:20px 0 0 0;max-width:230px;-webkit-transition:all .5s ease-in-out;-moz-transition:all .5s ease-in-out;-ms-transition:all .5s ease-in-out;-o-transition:all .5s ease-in-out;transition:all .5s ease-in-out}.demo1{position:relative}.demo1:focus{color:red}.demo2{display:-webkit-box;-webkit-box-ordinal-group:1;-webkit-order:1;order:1;-webkit-box-flex:0;flex:0 0 auto;margin:-5px 0 margin-left:5px}.demo3{padding-left:0;padding-right:8px;font-size:18px;border-left:none;color:#000;line-height:25px;background-color:transparent;border:none;margin:0;padding:0}.demo3.demo0{-webkit-appearance:none;-webkit-tap-highlight-color:transparent;display:-webkit-box;-webkit-box-ordinal-group:2;-webkit-order:2;order:2;-webkit-box-flex:1;-webkit-flex:1 0;flex:1 0;padding-left:8px}.demo4{font-size:18px}.demo4:focus{outline:0}.demo5{font-family:"microsoft yahei"!important;cursor:pointer;-webkit-border-radius:0;color:#fff;padding:0;position:absolute;right:0;top:0;background-color:#3385ff;box-sizing:border-box;-webkit-border-top-right-radius:2px;background:-webkit-gradient(linear,left top,left bottom,from(#3385ff),to(#cae6ff))!important;border:1px solid #2d78f4;height:37px;width:50px;-webkit-border-bottom-right-radius:2px}#config input[type=text],input[type=color],input[type=number],select{width:60%}.footer{background-color:#fff;text-align:center;color:#999;font-size:.6em;position:fixed;bottom:0;width:100%;padding:10px 0}.list{background:#fff;margin-bottom:30px;width:100%}.item{-moz-transition-property:background;-o-transition-property:background;-webkit-transition-property:background;transition-property:background;-moz-transition-duration:.3s;-o-transition-duration:.3s;-webkit-transition-duration:.3s;transition-duration:.3s}.item:focus,.item:hover{background:#eff7f7}.item.title{background:#eee;border-bottom:1px solid #e3e3e3}.item.title:focus,.item.title:hover{background:#e1e1e1}.c-list-title{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;padding:5px 20px;float:none;}form{margin:30px auto}.c-list-title a{-moz-transition-property:color;-o-transition-property:color;-webkit-transition-property:color;transition-property:color;-moz-transition-duration:.3s;-o-transition-duration:.3s;-webkit-transition-duration:.3s;transition-duration:.3s}.c-list-title{max-width:100%}.c-list-title a{color:#008b8b}.c-list-title a:focus,.c-list-title a:hover{color:#005858}.detail{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;border:1px solid #e3e3e3;padding-bottom:20px;margin-bottom:80px}.article-title{border-bottom:1px solid #e3e3e3;color:#44321b;padding-bottom:.83em}.article-box img{display:block;max-width:100%;margin-top:10px;margin-bottom:10px}.item-1st,.item-2nd,.item-3rd{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;margin-right:20px}.item-1st{width:32%;width:calc(35% - 20px)}.item-2nd{width:32%;width:calc(35% - 20px)}.item-3rd{width:30%;margin-right:0}@media (max-width:768px){.item-1st{width:45%;width:calc(50% - 10px);margin-right:10px}.item-2nd{width:45%;width:calc(50% - 10px);margin-left:10px;margin-right:0}.item-3rd{width:100%;margin-left:0;margin-right:0;margin-top:20px}}@media (max-width:480px){.item-1st,.item-2nd,.item-3rd{width:100%;margin-left:0;margin-right:0}.item-2nd,.item-3rd{margin-top:20px}}.code{padding:5px;border:1px solid #e1e1e1;background-color:#f0f0f0;border-left:10px solid #e0e0e0;}.src{word-wrap:break-word;text-align:left;padding:10px 5px;margin-bottom:1em;border-left:3px solid #e1e1e1;background:#eee;border-bottom:1px solid #e3e3e3;}</div></style><link rel="canonical" href="https://www.opensug.org/" /><meta content="always" name="referrer"><meta name="theme-color" content="#191919"><link rel="shortcut icon" href="https://www.baidu.com/favicon.ico" type="image/x-icon" /><link rel="icon" sizes="any" mask href="https://www.baidu.com/img/baidu.svg" /><meta name="description" content="百度搜索框提示免费代码(opensug.js):只需引用一段js即可获得带有“搜索框提示”功能的搜索框,让您的搜索更便捷!" /><meta name="keywords" content="opensug,opensug.js,百度搜索框提示免费代码,搜索下拉框,jquery,<?php echo(empty($_get["sugresult"]) ? 'baidusuggestion' : $_get["sugresult"]);?>.bind" /></head><body> 112 <header role="banner" style="padding:2.5% 4.5455%;background-color:#191919;margin-bottom:1em;"> 113 <div style="-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;margin:0 auto;max-width:1060px;color:#ffffff;"> 114 <h1 style="-webkit-margin-after:0;"><a href="<?php echo i;?>" rel="home" style="color:#d7d7d7;text-decoration:none;" title="百度搜索下拉框提示免费代码_opensug.js">百度搜索下拉框提示免费代码_opensug.js</a></h1> 115 <p style="color:#686868;-webkit-margin-before:0;vertical-align:middle;">只需引用一段js即可获得带有“搜索框提示”功能的搜索框,让您的搜索更便捷! <img src="https://img.shields.io/badge/license-mit-brightgreen.svg?style=flat" alt="license:mit" style="vertical-align:text-top;" /></p> 116 </div> 117 </header> 118 <!--div class="header" title="百度搜索下拉框提示免费代码 - opensug.js"><a href="<?php echo i;?>" style="text-decoration:none;"><h1>opensug.js</h1></a></div--> 119 <div class="container"> 120 <div style="text-align:left;padding:10px 5px;margin-top:.2em;margin-bottom:.7em;background-color:#eeeeee;border-left:3px solid #999999;color:#008b8b;border-bottom:1px solid #e3e3e3">下载: <a href="?n=js" style="color:red" title="下载opensug.js代码">js</a> <a href="?n=php" style="color:blue" title="下载本页面源码" onclick="alert('请下载后上传到你的主机空间[限php]');">php</a> <a target="_blank" href="https://www.npmjs.com/package/opensug">npmjs</a> <span style="float:right"><a href="?n=qun" style="color:#f60">q群</a> <a href="?n=friend" style="color:green">分流</a></span></div> 121 <?php if($n=='api'){?> 122 <div class="list" style="margin-bottom:0;"> 123 <div class="item title"><div class="c-list-title">api进阶</div></div> 124 <div class="row" style="padding:5rem"><form style="background:none;width:80%" action="https://www.baidu.com/s" method="get" target="_blank" onsubmit="return wd.value!=""" role="search"><input type="hidden" name="si" value="<?php echo s;?>" /><input name="ct" type="hidden" value="2097152" /><div class="demo1"><div class="msfo"><div style="background-color:#fff !important;border-color:#cae6ff;border-style:solid;border-width:2px 1px 2px 2px;border-right:none;margin-top:-1px;padding:0;padding-right:0;height:35px;padding-right:0;border:1px solid #e3e3e3 !important;border-right:none !important;border-top:1px solid #e3e3e3 !important;zoom:1;position:relative"><div style="display:-webkit-box;display:-webkit-flex;display:flex;padding:5px 0;"><input type="text" class="demo3 demo0 demo4" id="inputobj" maxlength="2048" name="wd" autocapitalize="off" autocomplete="off" autocorrect="off" autofocus="autofocus" placeholder="本输入框id为:inputobj"></div></div></div><button type="submit" class="demo5"><div class="sbico">搜索</div></button></div></form></div> 125 <a href="https://www.opensug.org/faq/uncaught-typeerror-cannot-read-property-guid-of-null/" target="_blank"><p style="text-align:left;color:red;padding:.3em;background-color:#ffc">关于出现uncaught typeerror: cannot read property '_guid' of null的解决方案,请点击此处...</p></a> 126 <form action="" method="get" style="margin:0;"><input type="hidden" name="n" value="api"> 127 <table width="100%" border="0" cellspacing="5" cellpadding="0" id="config"> 128 <tr> 129 <td class="i"><label for="id">输入框id</label></td> 130 <td><input type="text" id="id" name="id" value="<?php echo get('id', 'inputobj');?>" onfocus="select();" /></td> 131 <td class="i" for="act"><label for="sugsubmit">动作</label></td> 132 <td><select id="sugsubmit" name="sugsubmit"><option value="true"<?php if(get('sugsubmit', '-1')!='false')echo ' selected="selected"';?> >选中提交</option><option value="false"<?php if(get('sugsubmit', '-1')=='false')echo ' selected="selected"';?> >手动提交</option></select></td> 133 </tr> 134 <tr> 135 <td class="i"><label for="xoffset">横向偏移</label></td> 136 <td title="提示框位置横向偏移量,负值向右偏移,单位px"><input type="number" id="xoffset" name="xoffset" value="<?php echo get('xoffset', '-15');?>" /></td> 137 <td class="i"><label for="yoffset">纵向偏移</label></td> 138 <td title="提示框位置纵向偏移量,负值向下偏移,单位px"><input type="number" id="yoffset" name="yoffset" value="<?php echo get('yoffset', '-30');?>" /></td> 139 </tr> 140 <tr> 141 <td class="i"><label for="width">宽度</label></td> 142 <td><input type="number" id="width" name="width" onfocus="select();" value="<?php echo get('width', "");?>" /></td> 143 <td class="i"><label for="bordercolor">边框颜色</label></td> 144 <td><input type="color" id="bordercolor" name="bordercolor" value="<?php echo get('bordercolor', '#008000');?>" /></td> 145 </tr> 146 <tr> 147 <td class="i"><label for="fontfamily">字体</label></td> 148 <td><input type="text" id="fontfamily" name="fontfamily" onfocus="select();" value="<?php echo get('fontfamily', 'microsoft yahei');?>" /></td> 149 <td class="i"><label for="fontcolor">提示框文字颜色</label></td> 150 <td><input type="color" id="fontcolor" name="fontcolor" value="<?php echo get('fontcolor', '#ff0000');?>" /></td> 151 </tr> 152 <tr> 153 <td class="i"><label for="fontsize">字体大小</label></td> 154 <td><input type="text" id="fontsize" name="fontsize" onfocus="select();" value="<?php echo get('fontsize', '28px');?>" /></td> 155 <td class="i"><label for="bgcolorhi">背景高亮颜色</label></td> 156 <td><input type="color" id="bgcolorhi" name="bgcolorhi" value="<?php echo get('bgcolorhi', '#ff6600');?>" /></td> 157 </tr> 158 <tr> 159 <td class="i"><label for="confirmcallback">回调函数</label></td> 160 <td><input type="text" id="confirmcallback" name="confirmcallback" onfocus="select();" value="<?php echo get('confirmcallback', 'function(callback){}');?>" /></td> 161 <td class="i"><label for="fontcolorhi">字体高亮颜色</label></td> 162 <td><input type="color" id="fontcolorhi" name="fontcolorhi" value="<?php echo get('fontcolorhi', '#ffffff');?>" /></td> 163 </tr> 164 <tr> 165 <td colspan="4" style="text-align:center;padding-top:10px;"> 166 <select id="sugresult" name="sugresult" style="width:120px;color:blue;"><option value=""<?php if(get('sugresult', '-1')=="")echo ' selected="selected"';?> >百度[缺省]</option><option value="google"<?php if(get('sugresult', "")=='google')echo ' selected="selected"';?> >google</option><option value="haoso"<?php if(get('sugresult', "")=='haoso')echo ' selected="selected"';?> >奇虎好搜</option><option value="kugou"<?php if(get('sugresult', "")=='kugou')echo ' selected="selected"';?> >酷狗[音乐]</option><option value="yahoo"<?php if(get('sugresult', "")=='yahoo')echo ' selected="selected"';?> >雅虎</option><option value="yandex"<?php if(get('sugresult', "")=='yandex')echo ' selected="selected"';?> >yandex</option><option value="youku"<?php if(get('sugresult', "")=='youku')echo ' selected="selected"';?> >优酷[视频]</option><option value="taobao"<?php if(get('sugresult', "")=='taobao')echo ' selected="selected"';?> >淘宝[购物]</option></select> <input type="reset" value="重 设" /> <input type="submit" value="更 新" /></form> 167 <?php if(get('id',"")){?><p><form action="" method="post" style="margin:0;"><input type="submit" name="user" value="保存调试后的opensug在当前服务器上"></form><?php }?></td> 168 </tr> 169 <tr> 170 <td colspan="4" style="text-align:center;color:red;font-size:16px;">本页面仅供参数调试,请调整参数以配合实际生产环境!</td> 171 </tr> 172 173 <tr> 174 <td colspan="4"><textarea style="width:99%;border:none;overflow-y:visible;resize:none;font-size:14px;color:blue;" rows="13" cols="10" id="out" spellcheck="false" onfocus="select();" name="conf"><?php echo !empty($_get['sugresult'])?strtolower($_get['sugresult']):'baidusuggestion'?>.bind('<?php echo get('id', 'inputobj'). "', { //输入框id\r\n \"xoffset\": \"".get('xoffset', '-15')."\",// 提示框位置横向偏移量,单位px\r\n \"yoffset\": \"".get('yoffset', '-30')."\",// 提示框位置纵向偏移量,单位px\r\n \"width\": \"".get('width', "")."\",// 提示框宽度,单位px\r\n \"fontcolor\": \"".get('fontcolor', '#ff0000')."\",// 提示框文字颜色\r\n \"fontcolorhi\": \"".get('fontcolorhi', '#ffffff')."\",// 提示框高亮选择时文字颜色\r\n \"fontsize\": \"".get('fontsize', '28px')."\",// 文字大小\r\n \"fontfamily\": \"".get('fontfamily', 'microsoft yahei')."\",// 文字字体\r\n \"bordercolor\": \"".get('bordercolor', '#008000')."\",// 提示框的边框颜色\r\n \"bgcolorhi\": \"".get('bgcolorhi', '#ff6600')."\",// 提示框高亮选择的颜色\r\n";?> 175 "sugsubmit": <?php if(get('sugsubmit', '-1')!='false')echo 'true';else echo 'false';?>// 选中提示框中词条时是否提交表单 176 }<?php if(!empty($_get['confirmcallback'])){echo ', '. $_get['confirmcallback'];}?>);</textarea><?php if(!empty($userjs))echo '<p style="background-color:#b0e0b0;color:#006000;padding:5px;">您的专属opensug.js文件:<a href="'. h .'/user/'. $userjs .'" target="_blank">'. h .'/user/'. $userjs .'</a> [<a href="?dl='. $userjs .'" target="_blank">下载</a>]</p>';?></td> 177 </tr> 178 </table> 179 180 </div> 181 <?php }elseif($n=='qun'){?> 182 <div class="list"> 183 <div class="item title"> 184 <div class="c-list-title">加入qq群讨论</div> 185 </div> 186 <div class="item" style="padding:10px;word-wrap:break-word;"> 187 <?php if(file_exists(q)){$tmp=explode('|',file_get_contents(q));$cou=count($tmp)-2;for($i=0;$i<=$cou;$i++){$tt=explode(',',$tmp[$i]);$last=$i==$cou?' style="color:red;font-weight:bold;text-decoration:underline" title="最新分享群讨论 '.$tt[0].'"'.$tt[0]:"";echo empty($tt[1])?'<span'.$last.' onclick="prompt(\'请手动加群:\','.$tt[0].');">'.$tt[0].'</span> ':'<a href="https://shang.qq.com/wpa/qunwpa?idkey='.$tt[1].'" target="_blank"'.$last.'>'.$tt[0].'</a> ';}}?> 188 </div> 189 <form action="" method="post"> 190 <a href="https://qun.qq.com/join.html" target="_blank">shang.qq.com/wpa/qunwpa?idkey=</a><input type="text" name="link" style="width:30%" autocapitalize="off" autocomplete="off" autocorrect="off" autofocus="autofocus" value="<?php echo $l;?>" /><br /> 191 群号码:<input type="text" name="qun" style="width:15%" autocapitalize="off" autocomplete="off" autocorrect="off" value="<?php echo $q;?>" /><input type="submit" value="提交" /> 192 <?php if(isset($qunt))echo ' '.$qunt;?> 193 </form> 194 </div> 195 <?php }elseif($n=='friend'){?> 196 <div class="list"> 197 <form action="" method="post" style="text-align:center">节点:<input type="text" name="friend" style="width:70%" autocapitalize="off" autocomplete="off" autocorrect="off" autofocus="autofocus" value="<?php echo $f;?>" /><input type="submit" value="提交" /></form> 198 <p> 199 <div class="item title"><div class="c-list-title">opensug分流节点</div></div> 200 <div class="item" style="padding:10px;word-wrap:break-word;"> 201 <?php if(file_exists(f)){ 202 $tmp=explode('|',file_get_contents(f)); 203 $cou=count($tmp)-2; 204 for($i=0;$i<=$cou;$i++){ 205 $url = parse_url($tmp[$i]); 206 echo '<a style="color:red;font-weight:bold;text-decoration:underline" href="'. $tmp[$i] .'" target="_blank">'. $url['host'] .'</a> '; 207 } 208 }?></div> 209 </p> 210 </div> 211 <?php }else{?> 212 <div class="list"> 213 <div class="item-1st"> 214 <div class="item title"> 215 <div class="c-list-title">baidusug = "1"</div> 216 </div> 217 <div class="item"> 218 <div class="c-list-title"> 219 <form style="background:none" action="https://www.baidu.com/s" method="get" name="gs" target="_blank" onsubmit="return q.value!=""" role="search"><input type="hidden" name="si" value="<?php echo s;?>" /><input name="ct" type="hidden" value="2097152" /><div class="demo1"><div class="msfo"><div style="background-color:#fff !important;border-color:#cae6ff;border-style:solid;border-width:2px 1px 2px 2px;border-right:none;margin-top:-1px;padding:0;padding-right:0;height:35px;padding-right:0;border:1px solid #e3e3e3 !important;border-right:none !important;border-top:1px solid #e3e3e3 !important;zoom:1;position:relative"><div style="display:-webkit-box;display:-webkit-flex;display:flex;padding:5px 0;"><input type="text" class="demo3 demo0 demo4" maxlength="2048" name="wd" autocapitalize="off" autocomplete="off" autocorrect="off" autofocus="autofocus" placeholder="baidusug = '1'" baidusug="1" /></div></div></div><button type="submit" class="demo5"><div class="sbico">搜索</div></button> </div> 220 </form> 221 选中词条时<span style="color:red;">默认执行</span>表单提交动作 222 </div> 223 </div> 224 <div class="code"> 225 <pre><form action="https://www.baidu.com/baidu" target="_blank"><br /> <input <span style="color:blue">type</span>="<span style="color:red">text</span>" <span style="color:blue">baidusug</span>="<span style="color:red">1</span>" name="word" size="30" /><br /> <input type="submit" value="百度搜索" /><br /></form></pre> 226 </div> 227 </div> 228 <div class="item-2nd"> 229 <div class="item title"> 230 <div class="c-list-title">baidusug = "2"</div> 231 </div> 232 <div class="item"> 233 <div class="c-list-title"> 234 <form style="background:none" action="https://www.baidu.com/s" method="get" name="gs" target="_blank" onsubmit="return q.value!=""" role="search"> 235 <input type="hidden" name="si" value="<?php echo s;?>" /> 236 <input name="ct" type="hidden" value="2097152" /> 237 <div class="demo1"> 238 <div class="msfo"> 239 <div style="background-color:#fff !important;border-color:#cae6ff;border-style:solid;border-width:2px 1px 2px 2px;border-right:none;margin-top:-1px;padding:0;padding-right:0;height:35px;padding-right:0;border:1px solid #e3e3e3 !important;border-right:none !important;border-top:1px solid #e3e3e3 !important;zoom:1;position:relative"> 240 <div style="display:-webkit-box;display:-webkit-flex;display:flex;padding:5px 0;"> 241 <input type="text" class="demo3 demo0 demo4" id="inputobj" maxlength="2048" name="wd" autocapitalize="off" autocomplete="off" autocorrect="off" placeholder="baidusug = '2'" baidusug="2" /> 242 </div> 243 </div> 244 </div> 245 <button type="submit" class="demo5"><div class="sbico">搜索</div></button> 246 </div> 247 </form> 248 选中词条时<span style="color:red;">不执行</span>表单提交动作 249 </div> 250 </div> 251 <div class="code"> 252 <pre><form action="https://www.baidu.com/baidu" target="_blank"><br /> <input <span style="color:blue">type</span>="<span style="color:red">text</span>" <span style="color:blue">baidusug</span>="<span style="color:red">2</span>" name="word" size="30" /><br /> <input type="submit" value="百度搜索" /><br /></form></pre> 253 </div> 254 </div> 255 <div class="item-3rd"> 256 <div class="item title"> 257 <div class="c-list-title">api</div> 258 </div> 259 <div class="item"> 260 <div class="c-list-title" style="padding:53px 10px;"> 261 <center><a href="?n=api">baidusuggestion.bind();</a></center> 262 </div> 263 </div> 264 <div class="code">提供“百度搜索框提示”api,打造您的个性化搜索框提示功能! <a href="?n=api">获得开始...</a></div> 265 </div> 266 </div> 267 268 <?php } 269 echo '<div style="margin-bottom:.7em;border-bottom:3px solid #eff7f7;padding-bottom:.2rem;overflow:hidden;"><a target="_blank" href="https://www.opensug.org/faq/">更新日志</a>'; 270 if(file_exists('./faq/wp-load.php')){ 271 // 加载wp-load.php占用内存超过32倍. 272 require('./faq/wp-load.php'); 273 query_posts('showposts=5&orderby=new'); 274 while(have_posts()) : the_post();?> 275 <a target="_blank" title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a> 276 <?php 277 endwhile; 278 wp_tag_cloud('number=8&orderby=count&order=rand&smallest=16&largest=16&unit=px'); 279 }else echo '<iframe src="https://www.opensug.org/faq/new_post.php" frameborder="0" style="width:100%;height:3rem;overflow:hidden;" scrolling="no"></iframe>'; 280 ?> 281 </div> 282 <span style="color:red">*</span> 浏览器支持:ie6+, firefox, chrome, safari, opera, edge...<br /> 283 <span style="color:red">*</span> 在网页中引入javascript文件,javascript代码请尽量添加到网页中 </body> 闭合标签之前.<br /> 284 <span style="text-decoration:line-through"><span style="color:red">*</span> 如使用utf-8编码,请务必在script标签中设置 <span style="color:blue">charset</span>="<span style="color:red">gbk</span>" 属性,否则搜索提示词会出现乱码.</span><span style="color:green">已修正!</span><div class="src" onclick="prompt('请把以下代码添加到网页</body>后面','<script type="text/javascript" src="https://opensug.github.io/js/opensug.js"></script>');"><script type="text/javascript" src="https://cdn.jsdelivr.net/g/opensug/"></script></div></div> 285 <div style="text-align:center;color:#009a61;font-size:12px;">为受窘的人说一句解围的话;为沮丧的人说一句鼓励的话;为疑惑的人说一句提醒的话;为自卑的人说一句自信的话;为痛苦的人说一句安慰的话...因为,更多时候,我们需要的是雪中送炭,而不是锦上添花.<br /><a target="_blank" href="https://cdn.jsdelivr.net/npm/opensug/"><img align="hits/month" src="https://data.jsdelivr.com/v1/package/gh/baiduinc/opensug/badge?style=rounded" style="vertical-align:middle" /></a> <a href="https://www.bountysource.com/teams/opensugjs/bounties?utm_source=opensugjs&utm_medium=shield&utm_campaign=bounties_posted" target="_blank"><img src="https://www.bountysource.com/badge/team?team_id=60650&style=bounties_posted" style="vertical-align:middle" /></a> <img src="https://travis-ci.org/opensug/js.svg?branch=master" style="vertical-align:middle" /> <iframe src="//ghbtns.com/github-btn.html?user=opensug&repo=js&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" style="vertical-align:middle;width:98px;height:20px;" title="为opensug.js点个赞"></iframe><br /><a target="_blank" href="https://su.baidu.com/">dns: charles.ns.cloudflare.com、janet.ns.cloudflare.com</a><br /><?php echo date('y.m.d h:i:s[d|z]');?> <?php if(function_exists('memory_get_usage')){$mem = round(memory_get_usage() / 1024, 2);echo $mem > 1000 ? round($mem / 1024, 2) .'mb': $mem .'kb';}$endtime = explode(' ',microtime());$thistime=$endtime[0]+$endtime[1]-($starttime[0]+$starttime[1]);echo " ". round($thistime,2) ."second.";?></div> 286 <?php if(get('sugresult',""))echo '<script type="text/javascript">var _source;_source="'. get('sugresult',"") .'";</script>';?> 287 <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/opensug/js@2.1.1/opensug.js"></script> 288 <?php if($n=='api'){?><script type="text/javascript"><?php echo !empty($_get['sugresult'])?strtolower($_get['sugresult']):'baidusuggestion'?>.bind('inputobj', {"xoffset":"<?php echo get('xoffset', '-15');?>","yoffset":"<?php echo get('yoffset', '-30');?>", "width":"<?php echo get('width', "");?>","fontcolor":"<?php echo get('fontcolor', '#ff0000');?>","fontcolorhi":"<?php echo get('fontcolorhi', '#ffffff');?>","fontsize":"<?php echo get('fontsize', '28px');?>","fontfamily":"<?php echo get('fontfamily', 'microsoft yahei');?>","bordercolor":"<?php echo get('bordercolor', '#008000');?>","bgcolorhi":"<?php echo get('bgcolorhi', '#ff6600');?>","sugsubmit":<?php if(get('sugsubmit', '-1')!='false')echo 'true';else echo 'false';?>}<?php if(!empty($_get['confirmcallback'])){echo ', '. $_get['confirmcallback'];}?>);</script><?php }?> 289 <script>window._bd_share_config={"common":{"bdsnskey":{},"bdtext":"","bdmini":"2","bdminilist":false,"bdpic":"","bdstyle":"0","bdsize":"16"},"slide":{"type":"slide","bdimg":"4","bdpos":"left","bdtop":"109.5"},"image":{"viewlist":["sqq","qzone","tsina","tqq","renren","weixin"],"viewtext":"分享到:","viewsize":"16"},"selectshare":{"bdcontainerclass":null,"bdselectminilist":["sqq","qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getelementsbytagname('head')[0]||body).appendchild(createelement('script')).src='https://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new date()/36e5)];var _hmt=_hmt||[];(function(){var hm=document.createelement("script");hm.src="https://hm.baidu.com/hm.js?746c3f6346fae8612933e5921803ee32";var s=document.getelementsbytagname("script")[0];s.parentnode.insertbefore(hm,s)})();<?php if(isset($msg ))echo'alert("'. $msg .'");';?></script> 290 <center><script language="javascript" type="text/javascript" src="//js.users.51.la/<?php echo rand(1,5999999);?>.js"></script></center> 291 <noscript><img alt="百度搜索框提示免费代码 - openSug.js" src="//img.users.51.la/<?php echo rand(1,5999999);?>.asp" style="border:none" /></noscript><script language="javascript" type="text/javascript" src="//js.users.51.la/18937340.js"></script> 292 </body> 293 </html>
下一篇: 好的学习带给我什么