How to use php to implement parameter debugging of openSug.js (code example)

不言
Release: 2023-04-04 19:44:01
forward
2658 people have browsed it

本篇文章给大家带来的内容是关于如何使用php实现openSug.js的参数调试(代码示例),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。

这是一款利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] < 2000){
        header("Refresh:5");
        header("HTTP/1.1 403 Forbidden");
        exit('

[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) . "\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."); } 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.")); }?> <?php echo empty($n) ? '' : $title[$n] .'['. (empty($_GET["sugResult"]) ? 'BaiduSuggestion' : $_GET["sugResult"]) .'.bind()] - ';?>百度搜索下拉框提示免费代码 - openSug.js.bind" />

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

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

API进阶

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

" />

本页面仅供参数调试,请调整参数以配合实际生产环境!
您的专属openSug.js文件:'. H .'/user/'. $userJS .' [下载]

';?>
加入QQ群讨论
'.$tt[0].' ':''.$tt[0].' ';}}?>
shang.qq.com/wpa/qunwpa?idkey=
群号码:
节点:

openSug分流节点
'. $url['host'] .' '; } }?>

baiduSug = "1"
选中词条时默认执行表单提交动作
<form action="https://www.baidu.com/baidu" target="_blank">
<input type="text" baiduSug="1" name="word" size="30" />
<input type="submit" value="百度搜索" />
</form>
baiduSug = "2"
选中词条时不执行表单提交动作
<form action="https://www.baidu.com/baidu" target="_blank">
<input type="text" baiduSug="2" name="word" size="30" />
<input type="submit" value="百度搜索" />
</form>
API
提供“百度搜索框提示”API,打造您的个性化搜索框提示功能! 获得开始...
更新日志'; if(file_exists('./faq/wp-load.php')){ // 加载wp-load.php占用内存超过32倍. require('./faq/wp-load.php'); query_posts('showposts=5&orderby=new'); while(have_posts()) : the_post();?> '; ?>
* 浏览器支持:IE6+, Firefox, Chrome, Safari, Opera, Edge...
* 在网页中引入Javascript文件,Javascript代码请尽量添加到网页中 </body> 闭合标签之前.
* 如使用utf-8编码,请务必在script标签中设置 charset="gbk" 属性,否则搜索提示词会出现乱码.已修正!
<script type="text/javascript" src="https://cdn.jsdelivr.net/g/opensug/"></script>
为受窘的人说一句解围的话;为沮丧的人说一句鼓励的话;为疑惑的人说一句提醒的话;为自卑的人说一句自信的话;为痛苦的人说一句安慰的话...因为,更多时候,我们需要的是雪中送炭,而不是锦上添花.

DNS: charles.ns.cloudflare.com、janet.ns.cloudflare.com
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.";?>
var _source;_source="'. get('sugResult',"") .'";';?>
Copy after login

The above is the detailed content of How to use php to implement parameter debugging of openSug.js (code example). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!