[ Index ] |
|
Code source de GeekLog 1.4.1 |
1 <?php 2 3 /** 4 * File: Header.Examine.class.php 5 * This is the HTTP Header Examine class for the Geeklog Spam-X plugin 6 * 7 * Copyright (C) 2005-2006 by the following authors: 8 * Author Dirk Haun <dirk AT haun-online DOT de> 9 * 10 * based on the works of Tom Willett <tomw AT pigstye DOT net> 11 * 12 * Licensed under the GNU General Public License 13 * 14 * $Id: Header.Examine.class.php,v 1.5 2006/12/10 08:57:49 dhaun Exp $ 15 */ 16 17 if (strpos ($_SERVER['PHP_SELF'], 'Header.Examine.class.php') !== false) { 18 die ('This file can not be used on its own!'); 19 } 20 21 /** 22 * Include Abstract Examine Class 23 */ 24 require_once($_CONF['path'] . 'plugins/spamx/' . 'BaseCommand.class.php'); 25 26 /** 27 * Examines Post according to HTTP Headers 28 * 29 * @author Dirk Haun <dirk AT haun-online DOT de> 30 */ 31 32 class Header extends BaseCommand { 33 /** 34 * No Constructor Use BaseCommand constructor 35 */ 36 /** 37 * Here we do the work 38 */ 39 function execute($comment) 40 { 41 global $_CONF, $_TABLES, $_USER, $LANG_SX00, $result; 42 43 if (isset ($_USER['uid']) && ($_USER['uid'] > 1)) { 44 $uid = $_USER['uid']; 45 } else { 46 $uid = 1; 47 } 48 49 // get HTTP headers of the current request 50 if (function_exists ('getallheaders')) { 51 $headers = getallheaders (); 52 } else { 53 // if getallheaders() is not available, we have to fake it using 54 // the $_SERVER['HTTP_...'] values 55 $headers = array (); 56 foreach ($_SERVER as $key => $content) { 57 if (substr ($key, 0, 4) == 'HTTP') { 58 $name = str_replace ('_', '-', substr ($key, 5)); 59 $headers[$name] = $content; 60 } 61 } 62 } 63 64 $result = DB_query ("SELECT value FROM {$_TABLES['spamx']} WHERE name='HTTPHeader'", 1); 65 $nrows = DB_numRows ($result); 66 67 $ans = 0; 68 for ($i = 0; $i < $nrows; $i++) { 69 list ($entry) = DB_fetchArray ($result); 70 71 $v = explode (':', $entry); 72 $name = trim ($v[0]); 73 $value = trim ($v[1]); 74 $value = str_replace ('#', '\\#', $value); 75 76 foreach ($headers as $key => $content) { 77 if (strcasecmp ($name, $key) == 0) { 78 if (preg_match ("#$value#i", $content)) { 79 $ans = 1; // quit on first positive match 80 SPAMX_log ($LANG_SX00['foundspam'] . $entry . 81 $LANG_SX00['foundspam2'] . $uid . 82 $LANG_SX00['foundspam3'] . 83 $_SERVER['REMOTE_ADDR']); 84 break; 85 } 86 } 87 } 88 } 89 90 return $ans; 91 } 92 } 93 94 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 12:27:40 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |