eregi(): REG_EPAREN

phpBB3 and MOD challenges setup by the staff to test and challenge your phpBB3 coding skills.

eregi(): REG_EPAREN

Postby angelside » 26 Feb 2007, 16:20

my code

Code: Select all
// user agent
$agent $_SERVER['HTTP_USER_AGENT'];

// read bots table
$sql 'SELECT bot_name, bot_agent
    FROM ' 
BOTS_TABLE '
    WHERE bot_active = 1
    ORDER BY bot_name ASC'
;
$result $db->sql_query($sql);

while (
$row $db->sql_fetchrow($result))
{
    
// put all bot_agnet in array
    
$bot_array = array($row['bot_agent']);

    while(list(
$id$bot_name) = @each($bot_array) ) 
    {
        if(
eregi($bot_name,$agent))
        {    
            echo 
$row['bot_agent'];
        }
    }
}

output:

Code: Select all
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3745: eregi(): REG_EPAREN
Googlebot


What is my error to if(eregi($bot_name,$agent)) ?? if use @eregi, not write any output.
phpBB3 Portal | simple portal for phpBB3 Olympus
phpBB Türkiye | Turkish phpBB community
User avatar
angelside
MOD Author
MOD Author
 
Posts: 129
Joined: 20 Jun 2006, 03:17




phpBB Academy at StarTrekGuide
Support STG
Using PayPal Donate

Re: eregi(): REG_EPAREN

Postby angelside » 26 Feb 2007, 16:38

h?mm, I fix:

if $bot_name incluede ( or ), eregi is have error

e.g.: "Baiduspider+("


my fix:

Code: Select all
    while(list($id$bot_name) = @each($bot_array) ) 
    {
        
//echo $bot_name . '<br />';
        
        
$bot_name eregi_replace("[\)\(]","",$bot_name);         
        
        
//if(eregi("googlebot",$agent))
        
if(eregi($bot_name,$agent))
        {


Code: Select all
$bot_name = eregi_replace("[\)\(]","",$bot_name);
phpBB3 Portal | simple portal for phpBB3 Olympus
phpBB Türkiye | Turkish phpBB community
User avatar
angelside
MOD Author
MOD Author
 
Posts: 129
Joined: 20 Jun 2006, 03:17


Return to phpBB3 Challenges at phpBB Academy

Who is online

Users browsing this forum: No registered users and 0 guests