forked from kua5/baidu-prm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclose.php
1551 lines (1502 loc) · 178 KB
/
close.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* @file 可以改成任意后缀为 .php 的文件名
* @author maas(ausdruck@163.com)
* @date 2017/12/23
* @version v1.46
* @brief 百度搜索结果参数分析工具
*/
header ('Cache-Control: max-age=86400');
header("Content-type: text/html; charset=utf-8");
if (isset($_GET['s'])) {
$s = $_GET['s'];
}
else {
$s = null;
}
if (isset($_GET['pn'])) {
$pn = $_GET['pn'];
}
else {
$pn = null;
}
if (isset($_GET['rn'])) {
$rn = $_GET['rn'];
}
else {
$rn = null;
}
$crawl = 2; // 0 较少抓取 1 中等抓取 2 较多抓取 3 全面抓取
$dir = '/'; // 自定义文件所在目录,例如想把文件放在根目录下 a 目录,'/' 改为 '/a/'
$ist = 'picstore/'; // 自定义存储图片目录
$cp = 1; // 想展现百度图片请把 0 改为 1
$adr = 0; // 想用绝对地址请把 0 改为 1
$len = 63; // 自定义标题字数上限(48 相当于 24 个汉字长度)
$pt = '请您自定义标题后缀'; // 自定义标题后缀
$des = '请您自定义默认元描述'; // 默认元描述
$stk = './stc/'; // 临时缓存目录
$ct = 86400; // 缓存时间 以秒数计算 如 1分钟=60 1天=86400 1周=604800 30天=2592000
$lk = 0; // 改为 1 启用伪静态(不推荐使用)
$noad = 0; // 改为 1 启用特定时间段不展现广告
$tongji = './tongji/'; // 自定义存放内置统计日志目录
$st1 = './cwhtr/'; // 首页更新记号
if (!file_exists($st1)) {
mkdir($st1, 0755);
}
if ($noad == 1) {
// 下面为半夜3点后,到早晨7点前,不出现广告
$previous_time = 3;
$next_time = 7;
}
if ($lk == 1) {
$l = ''; // 如果会修改服务器配置和写伪静态规则,在这里修改对应的伪静态网址
}
else {
$l = '?s=';
}
$ws = ''; // 自定义想展现的站内搜索域名 如 'www.baidu.com' 或 'baike.baidu.com'
if (strlen($ws) > 0) {
$si = '&tn=json&rn=2&ct=2097152&si='.$ws;
}
else {
$si = '';
}
$token = ''; // 使用自动更新代理 IP 功能请先关注 天香空城 微信号 ulisse 免费申请注册码,然后将注册码填进单引号内保存
if (strlen($token) == 0) {
// 手动添加代理 IP,用于反百度自动屏蔽机制(建议至少添加 1 个中国内地 IP)
$proxy = array(
'',
);
}
else {
$timer = 'updatetimer/';
if (!file_exists($timer)) {
mkdir($timer, 0755);
}
if (!file_exists($timer.'cache')) {
file_put_contents($timer.'cache', '', LOCK_EX);
}
if ((time() - filemtime($timer.'cache') + 86400) > 1) {
unlink($timer.'cache');
$rand = rand();
$time = time();
$biz = password_hash($token.$rand.$time, PASSWORD_BCRYPT);
$data = array (
'biz' => $biz,
'nonce' => $rand,
'timestamp' => $time,
);
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, $data);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 8);
curl_setopt($c, CURLOPT_TIMEOUT, 8);
curl_setopt($c, CURLOPT_URL, 'https://linxphp.org/uppx.php');
$up = curl_exec($c);
curl_close($c);
file_put_contents($timer.'cache', '', LOCK_EX);
file_put_contents($token, $up, LOCK_EX);
}
if (file_exists($token)) {
$px = json_decode(file_get_contents($token), 1);
$ipx = $px['ip'];
$strx = $px['str'];
$posx = $px['pos'];
$saltx = $px['salt'];
// 字典
$seria = array(':', '.', 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
$position = array(20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
foreach ($ipx as $x => $y) {
$salt[$x] = str_split($saltx[$x]);
$strm[$x] = str_split($strx[$x]);
$posm[$x] = str_split($posx[$x]);
$mix[$x] = str_replace($salt[$x], '', $ipx[$x]);
$mix1[$x] = str_split($mix[$x], 2);
$mix6 = array();
foreach ($mix1[$x] as $mix2[$x]) {
$mix3[$x] = str_split($mix2[$x]);
foreach ($strm[$x] as $mixk => $mixv) {
if ($mix3[$x][0] == $strm[$x][$mixk]) {
$mix4[$x] = $seria[$mixk];
}
}
foreach ($posm[$x] as $mixx => $mivv) {
if ($mix3[$x][1] == $posm[$x][$mixx]) {
$mix5[$x] = $position[$mixx];
}
}
$mix6[$x][$mix5[$x]] = $mix4[$x];
}
ksort($mix6[$x]);
$proxy[$x] = implode('', $mix6[$x]);
}
}
else {
$proxy = array(
'',
);
}
}
// 可在下面数组里添加或删除友链
$fl = array(
array('http://www.apple.com/cn/', '苹果'),
array('https://www.tmall.com/', '天猫'),
);
if ($s != null) {
// 反垃圾
$pp = array(0=>'翻墙',1=>'vpn',2=>'在线代理',3=>'fqrouter',4=>'goagent',5=>'淫',6=>'套服务',7=>'大鸟',8=>'色',9=>'荒岛女儿国',10=>'av资源',11=>'推拿',12=>'wujie',13=>'漏鸟',14=>'仓井空',15=>'三肖',16=>'shadowsock',17=>'骚',18=>'露鸟',19=>'成人',20=>'包夜',21=>'蜜桃仙子',22=>'全裸',23=>'草榴',24=>'丝袜',25=>'投注',26=>'身透视',27=>'幼女',28=>'姦',29=>'百家乐',30=>'幼交',31=>'idbd下载',32=>'扑克',33=>'分析仪',34=>'网页代理',35=>'军妓',36=>'kayden',37=>'太阳城',38=>'av下载',39=>'蒙汗药',40=>'换妻',41=>'迷晕药',42=>'xingjiao',43=>'老虎机',44=>'日在',45=>'超级学生',46=>'六合',47=>'黄se',48=>'博彩',49=>'刘春玲',50=>'三宝局',51=>'性交',52=>'内射',53=>'人体',54=>'一条龙',55=>'小姐',56=>'深喉',57=>'娱乐城',58=>'g片免费下',59=>'ed2k',60=>'性爱',61=>'肉棒',62=>'乳',63=>'狠狠',64=>'狼人干',65=>'泷泽萝拉',66=>'桑拿',67=>'偷拍自拍',68=>'oldmanxinhen',69=>'丝足',70=>'彩坛',71=>'楼凤',72=>'撸',73=>'新农夫',74=>'r级',75=>'莞',76=>'跟踪定位',77=>'爽片',78=>'sex',79=>'av天堂',80=>'妹',81=>'咪咪',82=>'h版',83=>'性欲',84=>'露阴',85=>'特码',86=>'bt搜索',87=>'乱欲',88=>'轮盘',89=>'五月婷',90=>'ons',91=>'肉蒲',92=>'潮吹',93=>'一夜情',94=>'露奶',95=>'仁科百华',96=>'中特',97=>'一肖',98=>'胴',99=>'被插',100=>'六和',101=>'晨勃',102=>'口交',103=>'阴茎',104=>'阴毛',105=>'射精',106=>'鸡巴',107=>'肛交',108=>'保健',109=>'黄网',110=>'赌',111=>'爽图',112=>'露b',113=>'露B',114=>'自慰',115=>'奶子',116=>'苍蝇水',117=>'葡京',118=>'破解',119=>'裸体',120=>'裸聊',121=>'大奶',122=>'奸',123=>'裸照',124=>'援交',125=>'特服',126=>'动态图',127=>'三级',128=>'勃起',129=>'luoliao',130=>'越狱',131=>'手机定位',132=>'蜘蛛磁力',133=>'波霸',134=>'屄',135=>'少妇白洁',136=>'九九热',137=>'fuck',138=>'技师',139=>'a片',140=>'gv',141=>'上门',142=>'猥琐',143=>'做爱',144=>'报码',145=>'灯草和尚',146=>'野结衣',147=>'阴蒂',148=>'无套',149=>'吸奶',150=>'颜射',151=>'口爆',152=>'全集完结',153=>'特马',154=>'磁力链接',155=>'尻',156=>'祼体',157=>'肛',158=>'大尺度',159=>'吃精',160=>'阴道',161=>'liuhecai',162=>'大屌',163=>'舔',164=>'东方心经',165=>'ssh',166=>'无界',167=>'影梭',168=>'干姐',169=>'侦探',170=>'情药',171=>'春药',172=>'魂药',173=>'下药',174=>'hunk',175=>'bt森林',176=>'按摩',177=>'千金点特',178=>'毛主席',179=>'少妇熟女',180=>'6合',181=>'港马会',182=>'freegate',183=>'摸奶门',184=>'untitled',185=>'官人我要',186=>'京香julia',187=>'无码',188=>'激情视频',189=>'spycall',190=>'义母',191=>'手拉鸡',192=>'钢珠',193=>'气枪',194=>'zm52',195=>'newhalfclub',196=>'蜜桃成熟时3d电影',197=>'收养',198=>'徐明',199=>'绳刑',200=>'tktx麻药',201=>'黑社会',202=>'后台很硬',203=>'政变',204=>'毒品',205=>'av电影bt',206=>'博娱乐',207=>'socks代理',208=>'露鲍',209=>'av天堂',210=>'av种子',211=>'少妇乱伦',212=>'举报',213=>'一起happy下载',214=>'招聘公主',215=>'彩票',216=>'母鸡',217=>'sm女王',218=>'娱乐场',219=>'yaligaq',220=>'即时盘',221=>'工口动漫',222=>'白姐图库',223=>'大麻',224=>'香烟',225=>'罗清泉',226=>'av大帝',227=>'乐博',228=>'滚出',229=>'e世博',230=>'esball',231=>'张定发',232=>'跳楼',233=>'出轨',234=>'socks5',235=>'注册机',236=>'google%20chrome',237=>'squid+log',238=>'卵蛋',239=>'谁日过',240=>'紫阳',241=>'玷污',242=>'官网',243=>'下载',244=>'txt',245=>'百度云',246=>'观看',247=>'排名',248=>'密钥',249=>'母狗',250=>'d.elong.cn/api/apppartnerdownload',251=>'微信13951857607',252=>'发票',253=>'不和',254=>'情夫',255=>'流氓',256=>'激活码');
// 下面每个单引号中可以替换上面对应编号的敏感词
$rp = array(0=>'围墙',1=>'vps',2=>'在线游戏',3=>'eqrout',4=>'bob',5=>'圣',6=>'为人民牺牲',7=>'屌丝',8=>'涩',9=>'山海经',10=>'正版电影',11=>'健身',12=>'youjie',13=>'隐匿',14=>'罗玉凤',15=>'三小',16=>'brightsock',17=>'纯',18=>'隐匿',19=>'大众',20=>'日常',21=>'鸭梨仙子',22=>'铠甲',23=>'绿网',24=>'袜子',25=>'投资',26=>'无法直视',27=>'老太婆',28=>'兄贵',29=>'万家哭',30=>'老交',31=>'id上传',32=>'卡牌',33=>'文言文',34=>'网页游戏',35=>'军人',36=>'katherine',37=>'月亮城',38=>'图片上传',39=>'矿泉水',40=>'换老公',41=>'牛肉粉丝汤',42=>'jiehe',43=>'猫咪机',44=>'学在',45=>'超级老师',46=>'八卦',47=>'绿',48=>'慈善',49=>'刘玲',50=>'七宝',51=>'进出',52=>'太监',53=>'野生',54=>'一只狗',55=>'女神',56=>'喉咙',57=>'避风塘',58=>'正版电影',59=>'ed1k',60=>'拉勾',61=>'骨棒',62=>'泌',63=>'静静',64=>'出家化缘',65=>'黑泽明',66=>'蒸房',67=>'不拍',68=>'oldman',69=>'长腿',70=>'公益论坛',71=>'潘金莲',72=>'抽',73=>'老工人',74=>'一级',75=>'完',76=>'海市蜃楼',77=>'纪录片',78=>'x',79=>'地狱',80=>'姊',81=>'蓬头',82=>'笑版',83=>'无欲',84=>'抽',85=>'凡号',86=>'淘宝搜索',87=>'无欲',88=>'轮转',89=>'六月雪',90=>'sno',91=>'骨床',92=>'吹牛',93=>'搞基',94=>'隐身',95=>'仁义道德',96=>'企鹅',97=>'公益',98=>'铜',99=>'被拉',100=>'八卦新闻',101=>'不举',102=>'口吃',103=>'萝卜',104=>'森林',105=>'和谐',106=>'茄子',107=>'股',108=>'保护',109=>'输',110=>'阉割',111=>'名画',112=>'藏匿',113=>'藏匿',114=>'治愈',115=>'奶瓶',116=>'蚊子水',117=>'西京',118=>'加密',119=>'艺术照',120=>'约会',121=>'大奶瓶',122=>'幻',123=>'裹照',124=>'读书',125=>'普服',126=>'静止画',127=>'一级',128=>'不举',129=>'约会',130=>'加密',131=>'盲人导航',132=>'蚂蚁电感应',133=>'球霸',134=>'牝',135=>'贵妇白荷',136=>'长长冷',137=>'拉扯',138=>'司机',139=>'纪录片',140=>'宦官',141=>'旅游',142=>'萎靡',143=>'打坐',144=>'慈善捐款',145=>'和尚',146=>'东尼大木',147=>'眼睛',148=>'装甲',149=>'吃奶',150=>'美颜',151=>'口吃',152=>'从良',153=>'赤兔马',154=>'电感应文本',155=>'股',156=>'盛装',157=>'股',158=>'纯洁',159=>'吃惊',160=>'牝道',161=>'八卦新闻',162=>'屌丝',163=>'擦',164=>'西方哲学',165=>'游戏',166=>'有界',167=>'亮剑',168=>'兄贵',169=>'学者',170=>'可乐',171=>'果汁',172=>'神饭',173=>'上菜',174=>'oldman',175=>'沙漠',176=>'敲打',177=>'千两黄金',178=>'最高领导',179=>'老妇',180=>'八卦',181=>'猫捉老鼠',182=>'freedom',183=>'健身',184=>'defined',185=>'不要不要',186=>'小泽征尔',187=>'马赛克',188=>'无欲无求',189=>'skype',190=>'老干妈',191=>'黄焖鸡',192=>'咸蛋',193=>'手机',194=>'1688',195=>'originall',196=>'请支持正版电影',197=>'又在非法拐卖',198=>'魏忠贤',199=>'跳绳',200=>'腾讯游戏',201=>'小学',202=>'清廉为民',203=>'上班',204=>'食品',205=>'动画片',206=>'道观',207=>'端口',208=>'夹腿',209=>'佛祖圣地',210=>'动物世界',211=>'校园青春',212=>'表扬',213=>'一起娱乐',214=>'包时多少钱',215=>'慈善',216=>'鸭子',217=>'天使',218=>'避难所',219=>'udun',220=>'延时游戏',221=>'动画',222=>'佛经',223=>'煎饼',224=>'香水',225=>'珞珈山',226=>'大流士',227=>'输',228=>'热爱',229=>'世博会',230=>'football',231=>'张文远',232=>'信仰之跃',233=>'虔诚',234=>'usb',235=>'付费版',236=>'google',237=>'squid',238=>'鸡蛋',239=>'谁迷恋过',240=>'红光',241=>'礼遇',242=>'爱好者',243=>'拒绝访问',244=>'纸质书',245=>'白云',246=>'闭眼',247=>'混乱',248=>'购买正版',249=>'母猫',250=>'oOoOoOo',251=>'12377',252=>'网络垃圾揭发电话',253=>'友爱',254=>'穷亲戚',255=>'圣人',256=>'付费购买');
$p = array('/(\s+)/', '/(http:\/\/)/', '/(&)/','/#/', '/(https:\/\/)/');
$r = array('%20', '', '%26', '%23', '');
$z = substr(str_replace($pp, $rp, strtolower(preg_replace($p[1], $r[1], $s))), 0, 128);
$x = substr(str_replace($pp, $rp, strtolower(htmlspecialchars(preg_replace($p, $r, $s)))), 0, 128);
$y = array('+', '', '%26', '%23', '');
$q = substr(htmlspecialchars(str_replace($pp, $rp, strtolower(preg_replace($p, $y, $s)))), 0, 128);
if (!file_exists($tongji)) {
mkdir($tongji, 0755);
}
}
file_put_contents($tongji.date('Ymd', time()).'.log', date('H:i:s', time())."\t".$_SERVER['REMOTE_ADDR']."\t".$_SERVER['HTTP_USER_AGENT']."\t".$q."\n", FILE_APPEND | LOCK_EX);
if (basename(__FILE__) == 'index.php') {
$uri = $dir;
}
else {
$uri = $_SERVER["PHP_SELF"];
}
if ($adr == 1) {
$u = '//'.$_SERVER['HTTP_HOST'].$uri;
}
else {
$u = $uri;
}
if (isset($px[0])) {
shuffle($px);
}
echo '<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-Hans" xml:lang="zh-Hans">
<head><meta charset="UTF-8">';
$nof = ' itemprop="url" target="_blank" rel="external nofollow noreferrer">';
$ft = '
</div>
</div>
</div>
<script>(function(){var A=window.baidu||{version:"1-1-0"};A.object=A.object||{};A.object.extend=function(B,D){for(var C in D){if(D.hasOwnProperty(C)){B[C]=D[C]}}};A.extend=A.object.extend;A.dom=A.dom||{};A.dom.g=function(B){if("string"==typeof B||B instanceof String){return document.getElementById(B)}else{if(B&&(B.nodeName&&(B.nodeType==1||B.nodeType==9))){return B}}return null};A.g=A.G=A.dom.g;A.dom.getDocument=function(B){B=A.dom.g(B);return B.nodeType==9?B:B.ownerDocument||B.document};A.dom._styleFixer=A.dom._styleFixer||{};A.dom._styleFilter=A.dom._styleFilter||[];A.dom._styleFilter.filter=function(C,G,E){for(var B=0,D=A.dom._styleFilter,F;F=D[B];B++){if(F=F[E]){G=F(C,G)}}return G};A.string=A.string||{};A.string.toCamelCase=function(B){return String(B).replace(/[-_]\D/g,function(C){return C.charAt(1).toUpperCase()})};A.dom.getStyle=function(F,G){var D=A.dom;F=D.g(F);G=A.string.toCamelCase(G);var B=F.style[G];if(B){return B}var C=D._styleFixer[G],E=F.currentStyle||(A.browser.ie?F.style:getComputedStyle(F,null));B="object"==typeof C&&C.get?C.get(F,E):E[C||G];if(C=D._styleFilter){B=C.filter(G,B,"get")}return B};A.getStyle=A.dom.getStyle;A.browser=A.browser||{};if(/msie (\d+\.\d)/i.test(navigator.userAgent)){A.ie=A.browser.ie=parseFloat(RegExp.$1)}if(/opera\/(\d+\.\d)/i.test(navigator.userAgent)){A.browser.opera=parseFloat(RegExp.$1)}A.browser.isWebkit=/webkit/i.test(navigator.userAgent);A.browser.isGecko=/gecko/i.test(navigator.userAgent)&&!/like gecko/i.test(navigator.userAgent);A.browser.isStrict=document.compatMode=="CSS1Compat";A.dom.getPosition=function(D){var B=A.dom.getDocument(D),E=A.browser;D=A.dom.g(D);var I=E.isGecko>0&&(B.getBoxObjectFor&&(A.dom.getStyle(D,"position")=="absolute"&&(D.style.top===""||D.style.left===""))),J={left:0,top:0},H=E.ie&&!E.isStrict?B.body:B.documentElement;if(D==H){return J}var C=null,F;if(D.getBoundingClientRect){F=D.getBoundingClientRect();J.left=Math.floor(F.left)+Math.max(B.documentElement.scrollLeft,B.body.scrollLeft);J.top=Math.floor(F.top)+Math.max(B.documentElement.scrollTop,B.body.scrollTop);J.left-=B.documentElement.clientLeft;J.top-=B.documentElement.clientTop;if(E.ie&&!E.isStrict){J.left-=2;J.top-=2}}else{if(B.getBoxObjectFor&&!I){F=B.getBoxObjectFor(D);var G=B.getBoxObjectFor(H);J.left=F.screenX-G.screenX;J.top=F.screenY-G.screenY}else{C=D;do{J.left+=C.offsetLeft;J.top+=C.offsetTop;if(E.isWebkit>0&&A.dom.getStyle(C,"position")=="fixed"){J.left+=B.body.scrollLeft;J.top+=B.body.scrollTop;break}C=C.offsetParent}while(C&&C!=D);if(E.opera>0||E.isWebkit>0&&A.dom.getStyle(D,"position")=="absolute"){J.top-=B.body.offsetTop}C=D.offsetParent;while(C&&C!=B.body){J.left-=C.scrollLeft;if(!b.opera||C.tagName!="TR"){J.top-=C.scrollTop}C=C.offsetParent}}}return J};A.event=A.event||{};A.event._unload=function(){var C=A.event._listeners,B=C.length,D=!(!window.removeEventListener),E,F;while(B--){E=C[B];F=E[0];if(F.removeEventListener){F.removeEventListener(E[1],E[3],false)}else{if(F.detachEvent){F.detachEvent("on"+E[1],E[3])}}}if(D){window.removeEventListener("unload",A.event._unload,false)}else{window.detachEvent("onunload",A.event._unload)}};if(window.attachEvent){window.attachEvent("onunload",A.event._unload)}else{window.addEventListener("unload",A.event._unload,false)}A.event._listeners=A.event._listeners||[];A.event.on=function(F,B,E){B=B.replace(/^on/i,"");if("string"==typeof F){F=A.dom.g(F)}var C=function(G){E.call(F,G)},D=A.event._listeners;D[D.length]=[F,B,E,C];if(F.attachEvent){F.attachEvent("on"+B,C)}else{if(F.addEventListener){F.addEventListener(B,C,false)}}return F};A.on=A.event.on;A.event.preventDefault=function(B){if(B.preventDefault){B.preventDefault()}else{B.returnValue=false}};A.ui=A.ui||{};A.suggestion=A.ui.suggestion=A.ui.suggestion||{};(function(){var B={},C=function(E){var D={};E.listen=function(F,H){D[F]=D[F]||[];var G=0;while(G<D[F].length&&D[F][G]!=H){G++}if(G==D[F].length){D[F].push(H)}return E};E.call=function(G){if(D[G]){for(var F=0;F<D[G].length;F++){D[G][F].apply(this,Array.prototype.slice.call(arguments,1))}}return E}};B.extend=function(D){new C(D);return D};B.extend(B);A.suggestion._Central=B})();A.ui.suggestion._Div=function(V,o,Z,a,X){var d=this,h,T,Y,l,f=X.class_prefix,U,S=document.createElement("DIV");S.id=f+(new Date()).getTime();S.className=f+"wpr";S.style.display="none";var c=document.createElement("IFRAME");c.className=f+"sd";c.style.display="none";c.style.position="absolute";c.style.borderWidth="0px";if(X.apd_body){document.body.appendChild(S)}else{o.parentNode.appendChild(S)}S.parentNode.insertBefore(c,S);V.listen("start",function(){A.on(document,"mousedown",function(B){B=B||window.event;var C=B.target||B.srcElement;if(C==o){return }while(C=C.parentNode){if(C==S){return }}W()});A.on(window,"blur",W)});V.listen("key_enter",function(){var B=i(),C=B[0]==-1?l:B[1];X.onconfirm(Z.getValue(),B[0],C,B[2],true);W()});function m(F,D){if(S.style.display=="none"){V.call("need_data",Z.getValue());return }var B=i()[0];j();if(F){if(B==0){g(D);B--;return }if(B==-1){B=T.length}B--}else{if(B==T.length-1){g(D);B=-1;return }B++}n(B);k();var E=Z.getValue();g(B);var C=i();X.onpick(E,C[0],C[1],C[2])}V.listen("key_up",function(B){m(1,B)});V.listen("key_down",function(B){m(0,B)});V.listen("key_tab",W);V.listen("key_esc",W);V.listen("all_clear",W);V.listen("data_ready",function(E,C){l=C;T=[];Y=[];for(var B=0,D=C.length;B<D;B++){if(typeof C[B].input!="undefined"){T[B]=C[B].input;Y[B]=C[B].selection}else{Y[B]=T[B]=C[B]}}if(T.length!=0){U=a(S,Y,d);for(var B=0,D=U.length;B<D;B++){A.on(U[B],"mouseover",function(){j();this.className=f+"mo";k()});A.on(U[B],"mouseout",j);A.on(U[B],"mousedown",function(F){V.call("mousedown_item");if(!A.ie){F.stopPropagation();F.preventDefault();return false}});A.on(U[B],"click",e(B))}}else{W()}});function j(){for(var B=0;B<U.length;B++){U[B].className=f+"ml"}}function i(){if(U&&S.style.display!="none"){for(var B=0;B<U.length;B++){if(U[B].className==f+"mo"){return[B,T[B],Y[B]]}}}return[-1,""]}function k(){var B=i();X.onhighlight(Z.getValue(),B[0],B[1],B[2])}function n(B){j();U[B].className=f+"mo"}function g(C){var B=T&&(typeof C=="number"&&typeof T[C]!="undefined")?T[C]:C;V.call("pick_word",B)}function W(){if(S.style.display=="none"){return null}c.style.display=S.style.display="none";X.onhide()}function e(B){var C=B;return function(){V.call("confirm_item",Z.getValue(),T[C],C,Y[C]);var D=Z.getValue();g(T[C]);X.onpick(D,C,T[C],Y[C]);X.onconfirm(Z.getValue(),C,T[C],Y[C]);W()}}return{element:S,shade:c,pick:g,highlight:n,hide:W,dispose:function(){S.parentNode.removeChild(S)}}};A.ui.suggestion._Data=function(D,B){var C=this,E={};D.listen("response_data",function(G,F){E[G]=F;D.call("data_ready",G,F)});D.listen("need_data",function(F){if(typeof E[F]=="undefined"){B(F)}else{D.call("data_ready",F,E[F])}});return{}};A.ui.suggestion._InputWatcher=function(H,G,E){var F=this,K,D=0,L="",C="",J="",M,I=false,N=false,B=false;G.setAttribute("autocomplete","off");A.on(G,"keydown",function(O){if(!B){H.call("start");B=true}O=O||window.event;var P;switch(O.keyCode){case 9:P="tab";break;case 27:P="esc";break;case 13:P="enter";break;case 38:P="up";A.event.preventDefault(O);break;case 40:P="down"}if(P){H.call("key_"+P,C)}});A.on(G,"mousedown",function(){if(!B){H.call("start");B=true}});A.on(G,"beforedeactivate",function(){if(I){window.event.cancelBubble=true;window.event.returnValue=false}});H.listen("start",function(){J=G.value;D=setInterval(function(){if(N){return }if(A.G(G)==null){suggestion.dispose()}var O=G.value;if(O==L&&(O!=""&&(O!=J&&O!=M))){if(K==0){K=setTimeout(function(){H.call("need_data",O)},100)}}else{clearTimeout(K);K=0;if(O==""&&L!=""){M="";H.call("all_clear")}L=O;if(O!=M){C=O}if(J!=G.value){J=""}}},10)});H.listen("pick_word",function(O){if(I){G.blur()}G.value=M=O;if(I){G.focus()}});H.listen("mousedown_item",function(O){I=true;N=true;setTimeout(function(){N=false;I=false},500)});H.listen("confirm_item",function(R,P,Q,O){N=false;C=L=Q});return{getValue:function(){return G.value},dispose:function(){clearInterval(D)}}};A.ui.suggestion._Suggestion=function(F,B){var E=this,C=A.ui.suggestion._MessageDispatcher;E.options={onpick:function(){},onconfirm:function(){},onhighlight:function(){},onhide:function(){},view:null,getData:false,prepend_html:"",append_html:"",class_prefix:"tangram_sug_",apd_body:false};A.extend(E.options,B);if(!(F=A.G(F))){return null}E.inputElement=F;if(F.id){E.options._inputId=F.id}else{F.id=E.options._inputId=E.options.class_prefix+"ipt"+(new Date()).getTime()}E._adjustPos=function(S){var J=G.element,M=G.shade,P=document,N=P.compatMode=="BackCompat"?P.body:P.documentElement,O=N.clientHeight,K=N.clientWidth;if(J.style.display=="none"&&S){return }var Q=A.dom.getPosition(F),L=[Q.top+F.offsetHeight-1,Q.left,F.offsetWidth];L=typeof E.options.view=="function"?E.options.view(L):L;J.style.display=M.style.display="block";M.style.top=L[0]+"px";M.style.left=L[1]+"px";M.style.width=L[2]+"px";var V=parseFloat(A.getStyle(J,"marginTop"))||0,R=parseFloat(A.getStyle(J,"marginLeft"))||0;J.style.top=L[0]-V+"px";J.style.left=L[1]-R+"px";if(A.ie&&document.compatMode=="BackCompat"){J.style.width=L[2]+"px"}else{var U=parseFloat(A.getStyle(J,"borderLeftWidth"))||0,W=parseFloat(A.getStyle(J,"borderRightWidth"))||0,T=parseFloat(A.getStyle(J,"marginRight"))||0;J.style.width=L[2]-U-W-R-T+"px"}M.style.height=J.offsetHeight+"px";if(O!=N.clientHeight||K!=N.clientWidth){E._adjustPos()}};E._draw=function(M,T){var Q=[],L=document.createElement("TABLE");L.cellPadding=2;L.cellSpacing=0;var R=document.createElement("TBODY");L.appendChild(R);for(var O=0,J=T.length;O<J;O++){var S=R.insertRow(-1);Q.push(S);var K=S.insertCell(-1);K.innerHTML=T[O]}var P=document.createElement("DIV");P.className=E.options.class_prefix+"pre";P.innerHTML=E.options.prepend_html;var N=document.createElement("DIV");N.className=E.options.class_prefix+"app";N.innerHTML=E.options.append_html;M.innerHTML="";M.appendChild(P);M.appendChild(L);M.appendChild(N);E._adjustPos();return Q};var H=A.suggestion._Central.extend(E),D=new A.ui.suggestion._Data(H,E.options.getData),I=new A.ui.suggestion._InputWatcher(H,F,G),G=new A.ui.suggestion._Div(H,F,I,E._draw,E.options);H.listen("start",function(){setInterval(function(){var J=G.element;if(J.offsetWidth!=0&&F.offsetWidth!=J.offsetWidth){E._adjustPos()}},100);A.on(window,"resize",function(){E._adjustPos(true)})});return{pick:G.pick,hide:G.hide,highlight:G.highlight,getElement:function(){return G.element},getData:E.options.getData,giveData:function(K,J){H.call("response_data",K,J)},dispose:function(){G.dispose();I.dispose()}}};A.ui.suggestion.create=function(B,C){return new A.ui.suggestion._Suggestion(B,C)};window.baidu=A})();var BaiduSuggestion=(function(){var D={};var E={};function O(P){return document.createElement(P)}var J={createSugOptions:function(S,R,Q,P){return{class_prefix:"bdSug_",onconfirm:function(Y,W,U,V,X){if(Q&&W>-1){try{Q.apply(window,[U])}catch(T){}}if(P&&!X){P.submit()}},view:function(T){if(R&&R.width){T[2]=parseInt(R.width)}if(R&&R.XOffset&&R.YOffset){return[T[0]-R.YOffset,T[1]-R.XOffset,T[2]]}return[T[0],T[1],T[2]]},getData:function(U){var V=(new Date()).getTime();var W=baidu.G("bdSug_script");if(W){document.body.removeChild(W)}var T=O("script");T.setAttribute("charset","gbk");T.src="https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd="+encodeURIComponent(U)+"&p=3&cb=BaiduSuggestion.callbacks.give"+S+"&t="+V;T.id="bdSug_script";document.body.appendChild(T)},append_html:"",apd_body:true}},createSugCallback:function(P){return function(R){if(!R){return }var S=[];for(var T=0;T<R.s.length;T++){var Q={};Q.input=R.s[T];Q.selection=R.s[T];S.push(Q)}E["sug"+P].giveData(R.q,S)}}};function I(T,Z,S,X){if(!T){return }if(typeof (T)=="string"||T instanceof String){T=baidu.G(T)}if(!T.sugId){T.sugId=(new Date).getTime()}if(E["sug"+T.sugId]){return false}if(Z==null){var Z=[]}else{X=Z.sugSubmit;var Q=Z.fontColor?Z.fontColor:"#000";var W=Z.fontSize?Z.fontSize:"14px";var P=Z.fontFamily?Z.fontFamily:"verdana";var U=Z.bgcolorHI?Z.bgcolorHI:"#36c";var R=Z.fontColorHI?Z.fontColorHI:"#FFF";var Y=Z.borderColor?Z.borderColor:"#817f82";L(".bdSug_wpr","border:1px solid "+Y+";position:absolute;z-index:9;top:28px;left:0;color:"+Q);L(".bdSug_wpr td","font-size:"+W+";font-family:"+P);L(".bdSug_mo","background-color:"+U+";color:"+R)}if(G(document.body,"position")=="relative"||G(document.body,"position")=="absolute"){var V=B(document.body);Z.XOffset=(Z.XOffset?parseInt(Z.XOffset):0)+V.x;Z.YOffset=(Z.YOffset?parseInt(Z.YOffset):0)+V.y}E["sug"+T.sugId]=baidu.suggestion.create(T,J.createSugOptions(T.sugId,Z,S,X?N(T):null));D["give"+T.sugId]=J.createSugCallback(T.sugId)}function N(Q){var P=Q;while(P!=document.body&&P.tagName!="FORM"){P=P.parentNode}return(P.tagName=="FORM")?P:null}function B(R){var P=document;var Q=0;var S=0;if(R.getBoundingClientRect){var T=R.getBoundingClientRect();Q=T.left+Math.max(P.documentElement.scrollLeft,P.body.scrollLeft);S=T.top+Math.max(P.documentElement.scrollTop,P.body.scrollTop);Q-=P.documentElement.clientLeft;S-=P.documentElement.clientTop}else{while(R=R.offsetParent){Q+=R.offsetLeft;S+=R.offsetTop}}return{x:Q,y:S}}function L(R,Q){var S=document.styleSheets;if(!S||S.length<=0){var P=document.createElement("STYLE");P.type="text/css";var T=document.getElementsByTagName("HEAD")[0];T.appendChild(P)}S=document.styleSheets;S=S[S.length-1];if(baidu.ie){S.addRule(R,Q)}else{S.insertRule(R+" { "+Q+" }",S.cssRules.length)}}function G(R,P,Q){if(!R){return }if(Q!=undefined){R.style[P]=Q}else{if(R.style[P]){return R.style[P]}else{if(R.currentStyle){return R.currentStyle[P]}else{if(document.defaultView&&document.defaultView.getComputedStyle){P=P.replace(/([A-Z])/g,"-\u00241").toLowerCase();var S=document.defaultView.getComputedStyle(R,"");return S&&S.getPropertyValue(P)||""}}}}}function A(){L(".bdSug_wpr","line-height:normal;background:#FFF;padding:0;margin:0;border:1px solid #817F82;position:absolute;z-index:9999;");L(".bdSug_wpr table","position:absolute;bottom:2.5em;left:.25px;padding:0;width:100%;background:#fff;cursor:default;");L(".bdSug_wpr tr","padding:0;margin:0");L(".bdSug_wpr td","padding:.25em;margin:0;text-align:left;vertical-align:middle;font:14px verdana;font-weight:normal;text-decoration:none;text-indent:0");L(".bdSug_mo","background:#36c;color:#fff");L(".bdSug_app","padding:0;margin:0;background:#fff");L(".bdSug_pre","padding:0;margin:0");L()}A();var H=document.body.getElementsByTagName("INPUT");for(var K=0,F=H.length;K<F;K++){var M=H[K];if(M&&M.type=="text"&&(M.getAttribute("su")==1||M.getAttribute("su")==2)){M.sugId=K;var C=(M.getAttribute("su")==1);I(M,null,null,C)}}return{bind:I,callbacks:D}})();function show(str){txtObj.innerHTML=str}var params={fontColorHI:"#000000",fontSize:"1em",fontFamily:"Helvetica Neue",borderColor:"#DDDDDD",bgcolorHI:"#DDDDDD",sugSubmit:true};BaiduSuggestion.bind("sug",params,show);function clearInput(){document.getElementById("js-in").value="";}</script>
</body></html>';
// 自动清理缓存
if (!file_exists($stk)) {
mkdir($stk, 0755);
}
if (!file_exists($stk.'cache')) {
file_put_contents($stk.'cache', '');
}
if ((time() - filemtime($stk.'cache')) > ($ct - 1)) {
$od = opendir($stk);
while (($ch = readdir($od)) != false) {
if($ch == '.' || $ch == '..') {
continue;
}
if ((time() - filemtime($stk.$ch)) > $ct) {
unlink($stk.$ch);
}
}
closedir($od);
}
if (!file_exists($ist.'cache')) {
file_put_contents($ist.'cache', '');
}
if ((time() - filemtime($ist.'cache')) > ($ct - 1)) {
$odp = opendir($ist);
while (($chp = readdir($odp)) != false) {
if($chp == '.' || $chp == '..') {
continue;
}
if ((time() - filemtime($ist.$chp)) > $ct) {
unlink($ist.$chp);
}
}
closedir($odp);
}
if (strlen($s) > 0 && !isset($rn)) {
if (file_exists($stk.md5(urlencode($q).$pn)) && file_exists($stk.md5(urlencode($q).$pn)).'0') {
echo file_get_contents($stk.md5(urlencode($q).$pn).'0');
// 在黑客或黑帽劫持前先行一步主动劫持 user-agent 投放没被劫持的广告
if (isset($previous_time) && isset($next_time)) {
if(date('H', time()) < $previous_time || date('H', time()) > $next_time) {
if (stripos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || stripos($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
echo ' <div class="header dis"></div>'; // div 容器中是移动端顶部广告位
echo ' <div class="dis"></div>'; // div 容器中是移动端侧边广告位
}
// 正常展现广告
else {
echo ' <div class="header center non"></div>'; // div 容器中是 pc 端顶部广告位
echo ' <div class="dis"></div>'; // div 容器中是移动端侧边广告位
}
}
}
echo file_get_contents($stk.md5(urlencode($q).$pn)).$ft;
exit;
}
ob_start();
}
$url_arr=array('xss'=>"\\=\\+\\/v(?:8|9|\\+|\\/)|\\%0acontent\\-(?:id|location|type|transfer\\-encoding)");$args_arr=array('xss'=>"[\\'\\\"\\;\\*\\<\\>].*\\bon[a-zA-Z]{3,15}[\\s\\r\\n\\v\\f]*\\=|\\b(?:expression)\\(|\\<script[\\s\\\\\\/]|\\<\\!\\[cdata\\[|\\b(?:eval|alert|prompt|msgbox)\\s*\\(|url\\((?:\\#|data|javascript)",'sql'=>"[^\\{\\s]{1}(\\s|\\b)+(?:select\\b|update\\b|insert(?:(\\/\\*.*?\\*\\/)|(\\s)|(\\+))+into\\b).+?(?:from\\b|set\\b)|[^\\{\\s]{1}(\\s|\\b)+(?:create|delete|drop|truncate|rename|desc)(?:(\\/\\*.*?\\*\\/)|(\\s)|(\\+))+(?:table\\b|from\\b|database\\b)|into(?:(\\/\\*.*?\\*\\/)|\\s|\\+)+(?:dump|out)file\\b|\\bsleep\\([\\s]*[\\d]+[\\s]*\\)|benchmark\\(([^\\,]*)\\,([^\\,]*)\\)|(?:declare|set|select)\\b.*@|union\\b.*(?:select|all)\\b|(?:select|update|insert|create|delete|drop|grant|truncate|rename|exec|desc|from|table|database|set|where)\\b.*(charset|ascii|bin|char|uncompress|concat|concat_ws|conv|export_set|hex|instr|left|load_file|locate|mid|sub|substring|oct|reverse|right|unhex)\\(|(?:master\\.\\.sysdatabases|msysaccessobjects|msysqueries|sysmodules|mysql\\.db|sys\\.database_name|information_schema\\.|sysobjects|sp_makewebtask|xp_cmdshell|sp_oamethod|sp_addextendedproc|sp_oacreate|xp_regread|sys\\.dbms_export_extension)",'other'=>"\\.\\.[\\\\\\/].*\\%00([^0-9a-fA-F]|$)|%00[\\'\\\"\\.]");$referer=empty($_SERVER['HTTP_REFERER'])?array():array($_SERVER['HTTP_REFERER']);$query_string=empty($_SERVER["QUERY_STRING"])?array():array($_SERVER["QUERY_STRING"]);check_data($query_string,$url_arr);check_data($_GET,$args_arr);check_data($_POST,$args_arr);check_data($_COOKIE,$args_arr);check_data($referer,$args_arr);function W_log($log){$logpath=$_SERVER["DOCUMENT_ROOT"]."/log.txt";$log_f=fopen($logpath,"a+");fputs($log_f,$log."\r\n");fclose($log_f);}function check_data($arr,$v){foreach($arr as $key=>$value){if(!is_array($key)){check($key,$v);}else{check_data($key,$v);}if(!is_array($value)){check($value,$v);}else{check_data($value,$v);}}}function check($str,$v){foreach($v as $key=>$value){if(preg_match("/".$value."/is", $str)==1||preg_match("/".$value."/is", urlencode($str))==1){echo'<title>已过滤跨站脚本攻击漏洞, 到别处看看罢</title>';exit();}}}
echo '<title>';
if (strlen($s) > 0) {
$sugip = array('115.239.211.11', '115.239.211.12', '180.97.33.72', '180.97.33.73');
shuffle ($sugip);
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($c, CURLOPT_TIMEOUT, 2);
curl_setopt($c, CURLOPT_URL, 'http://'.$sugip[0].'/su?action=opensearch&ie=UTF-8&wd='.$q);
$su = json_decode(curl_exec($c));
curl_close($c);
function wc($str, $enc = 'UTF-8') {
if(strtolower($enc) == 'gbk') {
$enc = 'gb18030';
}
if(!is_string($str) || $str === '')
return false;
$sl = 0;
for ($i = 0; $i < iconv_strlen($str, $enc); $i++) {
strlen(iconv_substr($str, $i, 1, $enc)) == 1 ? $sl += 1 : $sl += 2;
}
return $sl;
}
$wpt = wc($pt);
$wz = wc(htmlspecialchars($z, ENT_QUOTES));
if (isset($su[1][0])) {
$wsug = wc($su[1][0]);
}
else {
$wsug = 0;
}
if ($pn > 0) {
if (isset($su[1][1]) && strlen($su[1][1]) > 0) {
if (($wsug + $wz) < $len) {
echo str_replace($pp, $rp, $su[1][1]).'_';
}
}
echo htmlspecialchars($z, ENT_QUOTES).'_第'.floor($pn / 10 + 1).'页';
}
else {
if (isset($su[1][0]) && strlen($su[1][0]) > 0) {
if (($wsug + $wz) < $len) {
echo str_replace($pp, $rp, $su[1][0]).'_';
}
}
echo htmlspecialchars($z, ENT_QUOTES);
if ((($wz + $wpt) < ($len - 1) && ($wsug + $wz) > $len) || ($wsug + $wz + $wpt) < ($len - 1)) {
echo '_'.$pt;
}
}
}
else {
echo $pt;
}
echo '</title>
<meta content="';
if (strlen($s) > 0) {
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($c, CURLOPT_TIMEOUT, 3);
if (isset($q)) {
curl_setopt($c, CURLOPT_URL, 'http://baike.baidu.com/api/openapi/BaikeLemmaCardApi?format=json&appid=379020&bk_key='.$q);
}
$bk = json_decode(curl_exec($c), 1);
curl_close($c);
if (isset($bk) && strlen($bk['abstract']) > 0 && $pn == null && $rn == null) {
echo str_replace('...', '', str_replace($pp, $rp, $bk['abstract']));
}
else {
echo $des;
}
}
else {
echo $des;
}
echo '" name="description">
';
echo '<meta content="';
if (strlen($s) > 0) {
if (isset($su[1][0]) && strlen($su[1][0]) > 0 && $su[1][0] != $pt) {
echo str_replace($pp, $rp, $su[1][0]).',';
}
if (isset($su[1][1]) && strlen($su[1][1]) > 0 && $su[1][1] != $pt) {
echo str_replace($pp, $rp, $su[1][1]).',';
}
if (isset($su[1][2]) && strlen($su[1][2]) > 0 && $su[1][2] != $pt) {
echo str_replace($pp, $rp, $su[1][2]).',';
}
if (isset($su[1][3]) && strlen($su[1][3]) > 0 && $su[1][3] != $pt) {
echo str_replace($pp, $rp, $su[1][3]).',';
}
if (isset($su[1][4]) && strlen($su[1][4]) > 0 && $su[1][4] != $pt) {
echo str_replace($pp, $rp, $su[1][4]).',';
}
echo htmlspecialchars($z, ENT_QUOTES).',';
}
echo $pt.'" name="keywords">
<meta content="';
if (strlen($s) > 0) {
if (isset($su[1][0]) && strlen($su[1][0]) > 0) {
if (($wsug + $wz) < $len) {
echo str_replace($pp, $rp, $su[1][0]).'_';
}
}
echo htmlspecialchars($z, ENT_QUOTES);
}
else {
echo $pt;
}
$http = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
echo '" name="apple-mobile-web-app-title">
<link href="'.$http.$_SERVER['HTTP_HOST'].$u;
if (isset($x) && strlen($x) > 0) {
echo $l;
}
if (isset($x)) {
echo $x.'" rel="canonical">
';
}
else {
echo '" rel="canonical">
';
}
?>
<meta content="webkit" name="renderer">
<meta content="telephone=no" name="format-detection">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0,minimal-ui" name="viewport">
<style>body,div,h1{margin:0}body{color:#222222;background-color:#F8F7F5;font-family:"Helvetica Neue",Helvetica,"Hiragino Sans GB","Microsoft YaHei",Arial,sans-serif;height:100%}h1{font-size:1.5em;line-height:2.25em}img{height:auto!important;max-width:88.6%!important;border-radius:.618em}table{width:46.25em;border-collapse:collapse;width:100%!important}thead{color:#0080FF;background-color:#F2F2F2}th,td{padding:.618em .5em .618em .5em}blockquote{margin:1.25em;padding:0 1em;border-left-width:.3125em;border-left-style:solid;border-left-color:rgb(234,238,241);color:rgb(85,85,85);line-height:1.57421875em;white-space:normal}a{color:#607FA6;font-size:1em;text-decoration:none;line-height:1.25em}.noa{color:#FFD700;font-size:1em;font-weight:bold;text-decoration:none}.soft{color:#FFDDAA}.pink{color:#FFC0CB;font-size:1em;font-weight:bold;text-decoration:none}.pinks{color:#FFC0CB;text-decoration:none}input{font:normal 100% "STHeiti STXihei","Lucida Grande","Microsoft JhengHei","Microsoft Yahei",Helvetica,Tohoma,Arial,Verdana,sans-serif}.other{padding:.125em .3125em .25em .3125em;height:2.5em;width:5em;outline:0}.submit{height:3.125em;width:5.9375em;border:0}.center{text-align:center}.bold{font-size:1.5em;font-weight:bold;word-break:normal;word-wrap:break-word}.break{word-break:break-all}.tiny{font-size:.8em;line-height:1em}@media screen and (min-width:1024px){.detail{width:46.25em;margin:0 auto;padding:1.25em;padding-top:0;border:0}}.detail{background-color:#373737}.header{padding:.5em 0 .625em 0;border-bottom:.0625em}.red{color:#F5DEB3}.white{color:#FFFAF0}.back-white{background-color:#FFFFFF;opacity:.85}.back-egg{background-color:#FFFFBB;opacity:.85}.back-pink{background-color:#FFB7DD;opacity:.85}.back-yellow{background-color:#FFDDAA;opacity:.85}.back-orange{background-color:#FFDDAA;opacity:.85}.back-gold{background-color:#FFEE99;opacity:.85}.back-green{background-color:#EEFFBB;opacity:.85}.back-blue{background-color:#CCDDFF;opacity:.85}.back-sky{background-color:#CCEEFF;opacity:.85}.back-baidu{background-color:#77BBEF;opacity:.85}.back-wheat{background-color:#F5DEB3;opacity:.85}.back-azure{background-color:#F0FFFF;opacity:.85}.honeydew{background-color:#F0FFF0;opacity:.85}.gold{background-color:#FFD700;opacity:.85}.orange{background-color:#FFA500;opacity:.85}.violet{background-color:#EE82EE;opacity:.85}.tomato{background-color:#FF6347;opacity:.85}.lavender{background-color:#E6E6FA;opacity:.85}.silver{background-color:#C0C0C0;opacity:.85}.darkseagreen{background-color:#8FBC8F;opacity:.85}.mediumpurple{background-color:#9370DB;opacity:.85}.burlywood{background-color:#DEB887;opacity:.85}.aquamarine{background-color:#7FFFD4;opacity:.85}.springgreen{background-color:#00FF7F;opacity:.85}.darkturquoise{background-color:#00CED1;opacity:.85}.mediumseagreen{background-color:#3CB371;opacity:.85}.deepskyblue{background-color:#00BFFF;opacity:.85}.lightskyblue{background-color:#87CEFA;opacity:.85}.rr{border-radius:0 .382em .382em 0}.topr{border-radius:.382em .382em 0 0}.btnr{border-radius:0 0 .382em .382em}.right_outer,.non{display:none!important}@media screen and (min-width:1024px){.draglist:hover{border-color:#FFFFBB;background-color:#FFDDAA}.non{display:block!important}.text{padding:.125em .3125em .25em .3125em;height:2.5em;width:22.5em;outline:0}.right_outer{display:block!important;position:fixed;left:0;right:0;top:-2.5em;color:#717375;text-align:center}.right_inner{position:relative;width:46.25em;margin-left:auto;margin-right:auto}.right p{line-height:1.75em}.right{position:absolute;right:-150px;top:42px;padding:8px;border:.0625em solid #D9DADC;background-color:#FFFFFF;width:7em}}.dis{display:none!important}.space{letter-spacing:.875em}@media screen and (max-width:1023px){.dis{display:block!important}.text{padding:.125em .3125em .25em .3125em;height:2.5em;width:12em;outline:0}}@media screen and (max-width:1023px){.mb{font-size:.875em;line-height:1.9em}}</style>
<script>
<!--
if (top.location != self.location)top.location=self.location;
//
-->
</script></head>
<body itemscope itemtype="http://schema.org/WebPage">
<div class="detail" style="box-shadow:0 0 3.5em #00C3FF inset,0 0 0 0">
<?php
if (strlen($s) > 0 && !isset($rn)) {
$tp0 = ob_get_contents();
ob_end_clean();
echo $tp0;
file_put_contents($stk.md5(urlencode($q).$pn).'0', $tp0);
}
date_default_timezone_set('PRC');
if (isset($previous_time) && isset($next_time)) {
if(date('H', time()) < $previous_time || date('H', time()) > $next_time) {
// 在黑客或黑帽劫持前先行一步主动劫持 user-agent 投放没被劫持的广告
if (stripos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || stripos($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
echo ' <div class="header dis"></div>'; // div 容器中是移动端顶部广告位
echo ' <div class="dis"></div>'; // div 容器中是移动短侧边广告位
}
// 正常展现广告
else {
echo ' <div class="header center non"></div>'; // div 容器中是 pc 端顶部广告位
echo ' <div class="header dis"></div>'; // div 容器中是移动端顶部广告位
echo ' <div class="dis"></div>'; // div 容器中是移动端侧边广告位
}
}
}
if (strlen($s) > 0 && !isset($rn)) {
ob_start();
}
if ($s == null) {
echo ' <div class="back-yellow mb" style="padding:1em;border-radius:0 0 .382em .382em">';
// 网友们实时搜索
$c2 = 'cac';
$ct2 = 14400;
$shlbaidu = 'yizhiwangnanfangkai'; // 百度搜索实时热点
$shl163 = 'ruguohaiyoumingtian'; // 网易音乐
$shlsogou = 'haikuotiankong'; // 搜狗热搜榜
$shldouban = 'the+mass'; // 豆瓣最新电影
if ((time() - filemtime($st1.$c2) + 1) > $ct2) {
unlink($st1.$c2);
// 5118事件热点词
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 4);
curl_setopt($c, CURLOPT_TIMEOUT, 4);
curl_setopt($c, CURLOPT_URL, 'http://www.5118.com/');
$ikbaidu = curl_exec($c);
curl_close($c);
if (isset($ikbaidu) && strlen($ikbaidu) > 0) {
$ikbaidu1 = explode('<div class="link"><span class="s-span">', $ikbaidu);
array_pop($ikbaidu1);
array_shift($ikbaidu1);
ob_start();
foreach ($ikbaidu1 as $ikbaidu2) {
$ikbaidu3 = explode('</span>', $ikbaidu2, 2);
echo $ikbaidu3[0]."\n";
}
$ikbaidu0 = ob_get_contents();
ob_end_clean();
file_put_contents($shlbaidu, $ikbaidu0, LOCK_EX);
}
else {
touch($shlbaidu);
}
// 百度音乐新歌榜
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 4);
curl_setopt($c, CURLOPT_TIMEOUT, 4);
curl_setopt($c, CURLOPT_URL, 'http://tingapi.ting.baidu.com/v1/restserver/ting?method=baidu.ting.billboard.billList&type=1');
$ik163 = json_decode(curl_exec($c), 1);
curl_close($c);
if ($ik163['song_list'][0]['song_id'] > 0) {
ob_start();
foreach ($ik163['song_list'] as $ik1631) {
echo $ik1631['title']."\n";
}
$ik1630 = ob_get_contents();
ob_end_clean();
file_put_contents($shl163, $ik1630, LOCK_EX);
}
else {
touch($shl163);
}
// 搜狗热搜榜
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 4);
curl_setopt($c, CURLOPT_TIMEOUT, 4);
curl_setopt($c, CURLOPT_URL, 'http://changyan.sohu.com/api/3/topic/sogou_hotword');
$iksogou = json_decode(curl_exec($c), 1);
curl_close($c);
if (isset($iksogou['sogou_hot_words'][0])) {
ob_start();
foreach ($iksogou['sogou_hot_words'] as $iksogou1) {
echo strtolower($iksogou1)."\n";
}
$iksogou0 = ob_get_contents();
ob_end_clean();
file_put_contents($shlsogou, $iksogou0, LOCK_EX);
}
else {
touch($shlsogou);
}
// 豆瓣最新电影
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 8);
curl_setopt($c, CURLOPT_TIMEOUT, 8);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($c, CURLOPT_URL, 'https://movie.douban.com/j/search_subjects?type=movie&tag=%E6%9C%80%E6%96%B0&page_limit=500');
$ikdouban = json_decode(curl_exec($c), 1);
curl_close($c);
if (isset($ikdouban['subjects'][0]['rate'])) {
ob_start();
foreach ($ikdouban['subjects'] as $ikdouban1) {
echo strtolower(rtrim($ikdouban1['title']))."\n";
}
$ikdouban0 = ob_get_contents();
ob_end_clean();
file_put_contents($shldouban, $ikdouban0, LOCK_EX);
}
else {
touch($shldouban);
}
}
if (!file_exists($st1.$c2) && (file_exists($shlbaidu) || file_exists($shl163) || file_exists($shlsogou) || file_exists($shldouban))) {
file_put_contents($st1.$c2, '', LOCK_EX);
}
$slsbaidu = file_get_contents($shlbaidu);
$sls163 = file_get_contents($shl163);
$slssogou = file_get_contents($shlsogou);
$slsdouban = file_get_contents($shldouban);
$sls0 = $slsbaidu.$sls163.$slssogou.$slsdouban;
$sls = explode("\n", $sls0);
array_pop($sls);
if (strlen($sls[0]) > 0) {
echo ' <table>
<tbody class="back-yellow">';
shuffle($sls);
foreach ($sls as $i => $v) {
if ($i % 3 == 0) {
echo '<tr>';
}
echo '
<td><a itemprop="url" href="'.$u.$l.preg_replace('/(\s+)/', '%20', $sls[$i]).'" target="_blank">'.$sls[$i].'</a></td>';
$i++;
if ($i % 3 == 0) {
echo '
</tr>';
}
if ($i > 38) {
break;
}
}
if ($i % 3 == 1) {
echo '
<td></td>
<td></td>
</tr>';
}
elseif ($i % 3 == 2) {
echo '
<td></td>
</tr>';
}
echo '</tbody>
</table>';
}
echo '
<hr>
<p>';
foreach ($fl as $i => $v) {
echo '<a href="'.$fl[$i][0].'" target="_blank" itemprop="url">'.$fl[$i][1].'</a> ';
}
echo '</p>';
echo '
</div>
';
}
if (strlen($s) > 0) {
if (isset($_GET['oas'])) {
$oas = $_GET['oas'];
}
else {
$oas = null;
}
if (isset($_GET['osp'])) {
$osp = $_GET['osp'];
}
else {
$osp = null;
}
if (isset($_GET['oec'])) {
$oec = $_GET['oec'];
}
else {
$oec = null;
}
if (isset($_GET['osr'])) {
$osr = $_GET['osr'];
}
else {
$osr = null;
}
if (isset($_GET['oab'])) {
$oab = $_GET['oab'];
}
else {
$oab = null;
}
if (isset($_GET['of'])) {
$of = $_GET['of'];
}
else {
$of = null;
}
if (isset($_GET['os'])) {
$os = $_GET['os'];
}
else {
$os = null;
}
if (isset($_GET['pr'])) {
$pr = $_GET['pr'];
}
else {
$pr = null;
}
if (isset($_GET['oal'])) {
$oal = $_GET['oal'];
}
else {
$oal = null;
}
if ($pr == 'on') {
$baidu = 'http://www.baidu.com/s?sort=pagerank&wd=';
}
else {
$baidu = 'http://www.baidu.com/s?wd=';
}
$cpn = '&pn=';
$crn = '&rn=';
if (strlen($pn) > 0) {
if (strlen($rn) > 0) {
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($c, CURLOPT_TIMEOUT, 4);
if (isset($px[0])) {
curl_setopt($c, CURLOPT_PROXY, $px[0]);
}
curl_setopt($c, CURLOPT_URL, $baidu.$q.$cpn.$pn.$crn.$rn);
$se = curl_exec($c);
curl_close($c);
}
else {
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($c, CURLOPT_TIMEOUT, 4);
if (isset($px[0])) {
curl_setopt($c, CURLOPT_PROXY, $px[0]);
}
curl_setopt($c, CURLOPT_URL, $baidu.$q.$cpn.$pn);
$se = curl_exec($c);
curl_close($c);
}
}
elseif (strlen($rn) > 0) {
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($c, CURLOPT_TIMEOUT, 4);
if (isset($px[0])) {
curl_setopt($c, CURLOPT_PROXY, $px[0]);
}
curl_setopt($c, CURLOPT_URL, $baidu.$q.$crn.$rn);
$se = curl_exec($c);
curl_close($c);
}
else {
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($c, CURLOPT_TIMEOUT, 4);
if (isset($px[0])) {
curl_setopt($c, CURLOPT_PROXY, $px[0]);
}
curl_setopt($c, CURLOPT_URL, $baidu.$q);
$se = curl_exec($c);
curl_close($c);
}
if (strlen($ws) > 0 && !isset($bk['card']) && $pn == null && $rn == null) {
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($c, CURLOPT_TIMEOUT, 2);
curl_setopt($c, CURLOPT_URL, 'http://www.baidu.com/s?wd='.$q.$si);
$wse = json_decode(curl_exec($c), 1);
curl_close($c);
}
if (isset($se)) {
if (preg_match('/(?<=百度为您找到相关结果约)([0-9,]{1,11})(?=个<\/div>)/', $se, $mn));
}
if ($pn == null && $rn == null) {
echo ' <div class="white break center">
<h1 itemprop="name">'.htmlspecialchars($z, ENT_QUOTES).'</h1>
<span title="2字节<标题长度<64字节">'.date('Y-m-d H:i', time()).'</span>
</div>';
}
else {
echo ' <div class="white break center">
<h1 itemprop="name"><a class="noa" href="'.$u.$l.$q.'">'.htmlspecialchars($z, ENT_QUOTES).'</a></h1>
'.date('Y-m-d H:i', time()).'
</div>';
}
if ($cp == 1 && !file_exists('/'.$ist.md5($q).'.jpg')) {
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($c, CURLOPT_TIMEOUT, 1);
if (isset($px[1])) {
curl_setopt($c, CURLOPT_PROXY, $px[1]);
}
curl_setopt($c, CURLOPT_URL, 'http://image.baidu.com/search/acjson?tn=resultjson&ipn&rn=3&wd='.$q);
$cpc = json_decode(curl_exec($c), 1);
curl_close($c);
if (isset($cpc['data'][0]['objURL'])) {
$pic = $cpc['data'][0]['objURL'];
}
else {
$pic = null;
}
if (isset($cpc['data'][1]['objURL'])) {
$pic2 = $cpc['data'][1]['objURL'];
}
else {
$pic2 = null;
}
if (isset($cpc['data'][2]['objURL'])) {
$pic3 = $cpc['data'][2]['objURL'];
}
else {
$pic3 = null;
}
}
if (isset($bk['card']) && $pn == null && $rn == null) {
echo '
<blockquote class="soft mb break">';
foreach ($bk['card'] as $i => $v) {
echo strip_tags($bk['card'][$i]['name']).' '.strip_tags($bk['card'][$i]['value'][0]).'<br>';
}
if (isset($bk['abstract']) && strlen($bk['abstract']) > 0) {
echo $bk['abstract'].' <a class="noa" href="'.$bk['url'].'"'.$nof.'更多</a>';
}
echo '</blockquote>';
}
$scp = array('/(\s+)/', '/(&)/');
$scr = array('+', '%26');
if ($cp == 1) {
if ((isset($cpc['displayNum']) && $cpc['displayNum'] > 0) || file_exists('/'.$ist.md5($q).'.jpg')) {
if (!file_exists($ist)) {
mkdir($ist, 0755);
if (!file_exists($ist)) {
echo '请先修改 '.$dir.' 目录权限为 777,否则无法自动创建子目录';
exit(0);
}
}
if (preg_match('/(\.png)/is', $pic) == true) {
$g = $ist.md5($q).'.png';
}
elseif (preg_match('/(\.gif)/is', $pic) == true) {
$g = $ist.md5($q).'.gif';
}
else {
$g = $ist.md5($q).'.jpg';
}
if (!file_exists($g)) {
$c=curl_init();
$dir1 = pathinfo($pic);
$host = $dir1['dirname'];
$refer = $host.'/';
curl_setopt($c, CURLOPT_REFERER, $refer);
curl_setopt($c, CURLOPT_URL, $pic);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($c, CURLOPT_TIMEOUT, 6);
if (isset($px[2])) {
curl_setopt($c, CURLOPT_PROXY, $px[2]);
}
$o = curl_exec($c);
curl_close($c);
if (strlen($o) > 4771 || strlen($o) > 1048576) {
file_put_contents($g, $o, LOCK_EX);
}
}
else {
echo '
<div class="center">
<a href="//'.$_SERVER['HTTP_HOST'].$dir.$g.'" rel="nofollow" target="_blank"><img src="//'.$_SERVER['HTTP_HOST'].$dir.$g.'" alt="'.$q.'"></a>
</div>';
}
}
}
if (isset($mn[0]) && strlen($mn[0]) > 0 && $pn == null && $rn == null) {
// 抓取今日头条
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($c, CURLOPT_TIMEOUT, 3);
curl_setopt($c, CURLOPT_URL, 'http://cn.bing.com/search?q=%22'.urlencode($q).'%22+site%3Awww.toutiao.com');
$tta = curl_exec($c);
curl_close($c);
if (isset($tta) && strlen($tta) > 0) {
preg_match('/(?<=class="b_attribution" u="\d\|\d{4}\|)(\d{15,17})\|(.{32})"><cite><strong>www.toutiao.com<\/strong>\/(?=a|i)/', $tta, $ttm);
$c = curl_init();
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($c, CURLOPT_TIMEOUT, 3);
curl_setopt($c, CURLOPT_URL, 'http://cncc.bingj.com/cache.aspx?d='.@$ttm[1].'&w='.@$ttm[2]);
$tto = curl_exec($c);
curl_close($c);
preg_match_all('/(?<= opr-recommends-merge-item " data-click="{\'rsv_re_ename\':\')(.{1,99})(?=\',\'rsv_re_uri\':\')/', $se, $mzx);
if (is_array($mzx)) {
@$mpk = array_unique(array_merge(@$mzx[0], @$su[1], array('maas')));
}
if (strlen(@$tto) > 0) {
$ttp = array('/(\s+)/', '/<p><\/p>/');
$ttr = array('', '');
preg_match('/(?<=201\d-\d{2}-\d{2}\d{2}:\d{2})(.+)(?=(<pclass="footnote">)|(<pclass="pgc-description">)|(相关标签:)|(投诉分享到:))/', preg_replace($ttp, $ttr, strip_tags($tto, '<p>')), $tte);
@$ttf = explode('</p><p>', $tte[0], -1);
if (strlen(@$tte[0]) > 0 && strpos($tte[0], '视频加载中...') === false) {
echo '<a id="back_article_header" rel="nofollow"></a>
<h2 class="center bold soft mb" itemprop="name"><a class="noa" href="#article_end" rel="nofollow">'.$q.' 相关文章</a></h2>
<div class="soft break mb" style="padding:0 1em 0 1em;" itemprop="articleBody">
';
foreach ($ttf as $k => $v) {
foreach ($mpk as $ke => $v) {
$ccc = strpos($ttf[$k], $mpk[$ke]);
if ($ccc !== false) {
echo substr_replace($ttf[$k], '<a class="noa" href="'.$u.$l.$mpk[$ke].'" target="_blank">'.$mpk[$ke].'</a>', $ccc, strlen($mpk[$ke])).'</p>
<p>';
unset($mpk[$ke]);
break;
}
elseif ($mpk[$ke] == 'maas') {
echo $ttf[$k].'</p>
<p>';
}
}
}
echo '</p>
<p style="text-align:right">小编 风具</p>
</div>';
}
}
}
}
$mp = array('/(\s+)/', '/(&)/');
$mr = array('+', '%26');
if (isset($mn[0]) && strlen($mn[0]) > 0 && $oal != 'on') {
if (preg_match('/(?<=<p>很抱歉,没有找到与<span style="font-family:宋体">“<\/span><em>)(.+)(?=<\/em><span style="font-family:宋体">”<\/span>相关的网页。<\/p>)/', @$se, $mno)) {
echo '
<p><a class="noa" href="//'.$mno[1].'" title="直接访问 '.@$mno[2].'"'.$nof.'很抱歉,没有找到与“<span class="red">'.$mno[1].'</span>”相关的网页。</a></p>
<p class="white">如网页存在,请<a class="noa" href="//zhanzhang.baidu.com/linksubmit/url?sitename=http%3A%2F%2F'.$mno[1].'" title="您可以提交想被百度收录的url"'.$nof.'提交网址</a>给我们</p>';
}
if (preg_match('/(?<=<font class="c-gray">没有找到该URL。您可以直接访问 <\/font><a href=")(.+)(?=" target="_blank" onmousedown)/', @$se, $mno2)) {
echo '
<p class="white break">没有找到该URL。您可以直接访问 <span class="red"><a class="noa" href="'.$mno2[1].'"'.$nof.$mno2[1].'</a></span>,还可<a class="noa" href="//zhanzhang.baidu.com/sitesubmit/index?sitename='.$mno2[1].'" title="您可以提交想被百度收录的url"'.$nof.'提交网址</a>给我们。</p>';
}
}
if (@$mn[0] != 0) {
if ($cp == 1) {
if ((isset($cpc['displayNum']) && $cpc['displayNum'] > 0) || file_exists('/'.$ist.md5($q).'2.jpg')) {
if (!file_exists($ist)) {
mkdir($ist, 0755);
if (!file_exists($ist)) {
echo '请先修改 '.$dir.' 目录权限为 777,否则无法自动创建子目录';
exit(0);
}
}
if (preg_match('/(\.png)/is', $pic2) == true) {
$g2 = $ist.md5($q).'2.png';
}
elseif (preg_match('/(\.gif)/is', $pic2) == true) {
$g2 = $ist.md5($q).'2.gif';
}
else {
$g2 = $ist.md5($q).'2.jpg';
}
if (!file_exists($g2)) {
$c=curl_init();
$dir2 = pathinfo($pic2);
$host2 = $dir2['dirname'];
$refer2 = $host2.'/';
curl_setopt($c, CURLOPT_REFERER, $refer2);
curl_setopt($c, CURLOPT_URL, $pic2);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($c, CURLOPT_TIMEOUT, 4);
if (isset($px[5])) {
curl_setopt($c, CURLOPT_PROXY, $px[5]);
}
$o2 = curl_exec($c);
curl_close($c);
if (strlen($o2) > 4771 || strlen($o2) > 1048576) {
file_put_contents($g2, $o2, LOCK_EX);
}
}
else {
echo '
<div class="center mb soft">
<a href="//'.$_SERVER['HTTP_HOST'].$dir.$g2.'" rel="nofollow" target="_blank"><img src="//'.$_SERVER['HTTP_HOST'].$dir.$g2.'" alt="'.$q.'"></a>
</div>';
}
}
}
if ($oas == 'on' || ($oas != 'on' && $osp != 'on' && $oec != 'on')) {
if (preg_match_all("/(?<=\" data\-tools=\'{\"title\":\")([^\"]+)(\",\"url\":\"http:)(\/\/www.baidu.com\/link\?url=[a-zA-Z0-9_\-]{43,640})(?=\"}'><a class=\"c-tip-icon\"><i class=\"c-icon c-icon-triangle-down-g\"><\/i><\/a><\/div>)/", @$se, $mse)) {
if ($oab != 'on' && $pn == null && $rn == null) {
if (preg_match_all('/(?<=<div class="c-abstract)( c-abstract-en)*(">)(.*)(?=<\/div><div class="f13">)/', $se, $mabs));
}
if (preg_match_all('/(?<=<div class="result c-container)( ?" id=")(\d{1,3})(" srcid=")(15\d{2})(" tpl=")(\w{2,28})(?=" ( ?)data-click="{)/', $se, $msr)) {
foreach ($msr[2] as $i => $v) {
$nsr[$i] = array($msr[4][$i], @$mse[1][$i], $msr[2][$i], $mse[3][$i], $msr[6][$i]);
}
}
}
}
if ($osp == 'on' || ($oas != 'on' && $osp != 'on' && $oec != 'on')) {
if (preg_match_all('/(?<=" srcid=")(\d{1,5})(" fk=")([\d_]{0,6}?)([^_]{1,64})(" id=")(\d{1,2})(" tpl=")(\w{2,28})(" mu=")(.+)(?=" data-op="{\'y\':\'[a-zA-Z0-9]{8}\'}")/', @$se, $fk)) {
foreach ($fk[6] as $i => $v) {
$nfk[$i] = array($fk[1][$i], $fk[4][$i], $fk[6][$i], $fk[10][$i], $fk[8][$i]);
}
}
}
if (preg_match_all('/(?<=" srcid=")(\d{1,5})(" id=")(\d{1,2})(" tpl=")(\w{2,28})(" mu=")(.+)(?=" data-op="{\'y\':\'[a-zA-Z0-9]{8}\'}")/', @$se, $msp)) {
foreach ($msp[3] as $i => $v) {
$nsp[$i] = array($msp[1][$i], '', $msp[3][$i], $msp[7][$i], $msp[5][$i]);
}
}
if (strlen(@$nsr[0][0]) > 0) {
if (strlen(@$nfk[0][0]) > 0) {
if (strlen(@$nsp[0][0]) > 0) {
$n = array_merge($nsr, $nfk, $nsp);
}
else {
$n = array_merge($nsr, $nfk);
}
}
elseif (strlen(@$nsp[0][0]) > 0) {
$n = array_merge($nsr, $nsp);
}
else {
$n = array_merge($nsr);
}
}
elseif (strlen(@$nfk[0][0]) > 0) {
if (strlen(@$nsp[0][0]) > 0) {
$n = array_merge($nfk, $nsp);
}
else {
$n = array_merge($nfk);
}
}