e107inc / sfs

Spam blocker for e107 - based on the database at stopforumspam.com
7 stars 3 forks source link

PHP Fatal error #1

Closed Floryn closed 11 years ago

Floryn commented 11 years ago

Installed the plugin and of course I decided to try the signup myself, got the following error after I finished the registration process:

[16-Mar-2013 04:44:58] PHP Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/xxx/public_html/e107_root/extras/sfs/e_module.php:61 Stack trace: *#0 /home/xxx/public_html/e107_root/extras/sfs/e_module.php(61): SimpleXMLElement->__construct('')

1 /home/xxx/public_html/e107_root/handlers/event_class.php(121): sfsCheck(Array)

2 /home/xxx/public_html/e107_root/signup.php(368): e107_event->trigger('usersup_veri', Array)

3 {main} thrown in /home/xxx/public_html/e107_root/extras/sfs/e_module.php on line 61*

Note: xxx and e107_root are replacing the real path to the files. PhP: 5.2.17 Apache: 2.2.23 OS: CentOS release 6.4 (Final) Curl: 7.12.1 MySQL: 5.5.23

Floryn/MysterF,

CaMer0n commented 11 years ago

Please update e_module.php with the one here, and let me know if it fixes it. thanks

Floryn commented 11 years ago

works perfectly now, thank you -)

Hellfig commented 11 years ago

I got the same error. Did what was mentioned here, namely to update e_module.php (found here: https://github.com/e107inc/sfs/blob/master/e_module.php )

Doesn't work though, still have the same error... Anyone got an idea?

septor commented 11 years ago

Hellfig, I'm reopening this and closing your other issue so everything is in one place.

Moc commented 11 years ago

Did you clear the e107 cache and browser case, just to be sure?

Hellfig commented 11 years ago

I have disabled cach from the beginning. And I used a new browser, who I had to install for work. Never been on our site with that browser before.

So it can't be cache.

CaMer0n commented 11 years ago

What does the log say?

Hellfig commented 11 years ago

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/xxx/public_html/e107_plugins/sfs/e_module.php:66 Stack trace: #0 /home/xxx/public_html/e107_plugins/sfs/e_module.php(66): SimpleXMLElement->__construct('??<...') #1 /home/xxx/public_html/e107_handlers/event_class.php(121): sfsCheck(Array) #2 /home/xxx/public_html/signup.php(361): e107_event->trigger('usersup_veri', Array) #3 {main} thrown in /home/xxx/public_html/e107_plugins/sfs/e_module.php on line 66

also just to be sure. Emptied the cache, from my regular browser and the server. Obviously, it still didn't work. :s

Perhaps this will help: Site Controlled Gaming

Head Admin Controlled-Gaming

e107 Version 1.0.2

Security level [5] Balanced

Site Theme vekna_blue

Admin Theme e107 core v 1.0 by e107 Inc. (12/2011)

Install date Thursday 17 January 2013 - 16:22:35

Current Server Time Wed, 03 Apr 2013 04:54:46 -0400

Server Apache (host: www.controlled-gaming.info)

PHP Version 5.3.13

MySQL 5.1.68-cll Database: xxx

Charset utf-8

CaMer0n commented 11 years ago

I can (and will when I have time) work on suppressing the error, but it won't make the plugin work for you. You need to check that your server has the CURL extension, or at least allows remote file retrieval via file_get_contents(). The error is generated by no data being returned from stopforumspam.com - most likely because it could not be reached. Also check server firewall settings.

Hellfig commented 11 years ago

cURL support enabled cURL Information 7.24.0

And call me dumb, but I don't know how to check if my site allows file retrieval via file_get_contents()

CaMer0n commented 11 years ago

Try adding on line 65: sfsLog($data, $val); and then checking the sfs.log file after attempting to use again. .

Hellfig commented 11 years ago

Still the same? This is what I got:

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/xxx/public_html/e107_plugins/sfs/e_module.php:66 Stack trace: #0 /home/xxx/public_html/e107_plugins/sfs/e_module.php(66): SimpleXMLElement->__construct('??<...') #1 /home/xxx/public_html/e107_handlers/event_class.php(121): sfsCheck(Array) #2 /home/xxx/public_html/signup.php(361): e107_event->trigger('usersup_veri', Array) #3 {main} thrown in /home/xxx/public_html/e107_plugins/sfs/e_module.php on line 66

This is how I modified the code (i starting to doubt myself, so I post it anyway:) // Check IP if ($val['ip'] != "") { $xml->setUrl("http://www.stopforumspam.com/api?ip=" . urlencode($val['ip'] )); if(!$data = $xml->getRemoteXmlFile()) { sfsLog(date('r')." : Couldn't access stopforumspam.com"); return; }

        $xm = new SimpleXMLElement($data);
        sfsLog($data, $val); 
        switch ($xm->appears) 
        {
            case 'yes':
                sfsLog($data, $val);
                return $deniedMessage;  // Is a BOT. 
            break;

            case 'no': 
                sfsLog($data, $val , false);
                return false;  
            break;

            default:
                sfsLog(date('r')." : Couldn't check stopforumspam.com against ". $val['ip'] , $val);
                return false;  
            break;
         } 
CaMer0n commented 11 years ago

Thanks, but what does your e107_plugins/sfs/sfs.log file say?

Hellfig commented 11 years ago

There is no such file in my e107_plugins/sfs/

/public_html/e107_plugins/sfs/images /public_html/e107_plugins/sfs/admin_config.php /public_html/e107_plugins/sfs/e_module.php /public_html/e107_plugins/sfs/index.html /public_html/e107_plugins/sfs/plugin.php /public_html/e107_plugins/sfs/README.md

CaMer0n commented 11 years ago

Okay, check the perms on the sfs folder (should be 0755) . And add this at 65: sfsLog("Test", " "); See if the file appears after that. Also, you're using v1.03 of e107, correct?

Hellfig commented 11 years ago

I'm using 1.0.2. Don't tell me I've just have to upgrade it? I don't like to upgrade e107, always resolves in some problems at some plugins. I always have to manually change things in the code for it to work.

But if you think that's the problem, well then I have no other choice.

Hellfig commented 11 years ago

And sorry for double post: yes the sfs.log appears now with content: Thu, 11 Apr 2013 06:01:49 -0400 USERNAME: EMAIL: IP:
Test

Moc commented 11 years ago

Upgrading is not required here. It should work just fine on 1.0.2. Having said that, in general we do recommend to upgrade to the latest version although I personally would skip 1.0.3 for now. Upgrades should not compromise backwards compatibility. If you could send me a PM on e107.org with some more info with examples of modifications that you've had to make, that would be great.

As for your issue with the SFS plugin, Cameron will get back to you.

Hellfig commented 11 years ago

Sorry to bring this up again: but does anyone know a solution? Today we had 14 registered spam bots. It's getting annoying, since banning doesn't seem to help. They are using Dynamic IP. And blocking on Subnet won't help either, we would ban some regular users by that too.

Moc commented 11 years ago

My best guess is that your hosting provider somehow blocks the (outgoing) request to the stopforumspam database. The plugin then returns the error because it gets no data back to process. My advice would be to contact your webhosting provider, and to show them the code. Possibly they have some clues as to why you wouldn't be able to 'contact' the SFS database.

Hellfig commented 11 years ago

Ok, I'll contact him soon.

Also I've got another question. Can't we fix this bot-signups, by manipulating the image-verification tbox? If we add for example just '+1' to the generator, than I think the bots won't sing-up anymore? Since obviously they just cracked the mt_rand()?

Or am I wrong in this?

Edit: or perhaps even better, put a generator in the value for maximum value of the regular generator. That should fix it, right?