UBBCentral
Posted By: Basil Fatal Error when checking user - 01/16/2017 7:28 PM
When clicking the check user button in the new member queue, I get this following error:

Fatal error: Call to undefined function iconv() in /home/myforum/public_html/libs/user.inc.php on line 639

This just started happening. I did recently move to a new server with new IP but URLs are all the same. Any ideas?
Posted By: isaac Re: Fatal Error when checking user - 01/16/2017 7:36 PM
1) Are you allowing special characters in user names?
2) Did you just recently switch your database tables from ISO-8859-1 to UTF-8?


iconv has to do with multibyte characters. Does your new server have the iconv() library installed
https://www.hackersgarage.com/iconv-php-extension-installation-without-recompiling-php.html

Attached picture 20170116_11-35-17.PNG
Posted By: Basil Re: Fatal Error when checking user - 01/16/2017 11:39 PM
Originally Posted by id242
1) Are you allowing special characters in user names?
2) Did you just recently switch your database tables from ISO-8859-1 to UTF-8?


iconv has to do with multibyte characters. Does your new server have the iconv() library installed
https://www.hackersgarage.com/iconv-php-extension-installation-without-recompiling-php.html


I'll bet that's it. Thanks!
Posted By: Basil Re: Fatal Error when checking user - 01/27/2017 4:02 AM
UPDATE - Yes, indeed installing iconv got rid of the error, but now I have a related question.

When I click on Check This User, the spam checker never shows anything for Email Status or Reg. IP status. Seems I got some indications before I changed servers. Any idea what else might be needed to make this function properly?
Posted By: Gizmo Re: Fatal Error when checking user - 02/02/2017 11:23 PM
Basil, I would check your error logs and see if you're getting and 403 requests, it's possible that the suhosin module on your server is killing the connection; it is also possible that your host has configured fsockopen to not allow connections to outside servers (generally done as a form of security, but really breaks things that rely on 3rd party databases).

As for the aforementioned error, these are generally covered in the UBB.threads System Requirements Test, you might give it a run to see if there are any detectable issues that it can find with your server configuration.
Posted By: Basil Re: Fatal Error when checking user - 02/06/2017 5:35 PM
Gizmo, I don't see any 403 errors. I ran the System Requirements test and it shows no issues. Here's a dumb question. I can see in the test_stopforumspam.php that the script makes a connection to www.stopforumspam.com My question(s):

1. Is it possible my new server's IP is blocked by them and
2. When I look on that web site, it appears I may need an "API Key?" Thing is, this script was working before I moved to the new server.
Posted By: Gizmo Re: Fatal Error when checking user - 02/06/2017 5:42 PM
Originally Posted by Basil
1. Is it possible my new server's IP is blocked by them
Doubtful, but their developer is a pretty cool guy, feel free to just outright ask him if your server is blacklisted (I can't see why they'd have you blacklisted; a large chance is that your host is blocking outside connections to file_get_contents).

Originally Posted by Basil
2. When I look on that web site, it appears I may need an "API Key?" Thing is, this script was working before I moved to the new server.
Stop Forum Spam requires an API Key to send data to their database; a key is not required to send a remote query with file_get_contents, but file_get_contents needs to be able to contact to "the outside world" (some webhosts restrict remote content).
Posted By: Basil Re: Fatal Error when checking user - 02/06/2017 5:48 PM
Ok, thanks. I am submitting a ticket to my server management to see of they can see why it might not be working.
Posted By: Basil Re: Fatal Error when checking user - 02/06/2017 7:43 PM
They don't see any issues that would block the stopforumspam web site. However, in poking around in the stop forum spam script I notice something interesting / strange. If you look at this code where the stopforumspam API is contacted:

PHP Code
// Check API Status in a popup

if ($op == 'test') {
$xmlResult = @file_get_contents("http://www.stopforumspam.com/api?ip=". $_SERVER["SERVER_ADDR"]);
if(
$xmlResult != false) {
$xml = new SimpleXMLElement($xmlResult);
if(
$xml->appears == 'no') {
$SFS_Status_Class = 'sfsgood';
$SFS_Status = $ubbt_lang['SFS_STAT_GOOD'];
} else {
$SFS_Status_Class = 'sfsbad';
$SFS_Status = $ubbt_lang['SFS_STAT_BAD'];


When I go into the Stop Forum Spam control panel and click "test connectivity" I get a popup that I think SHOULD say either "Can Connect" or if it is not connecting, it should say "Can't Connect" But instead I get blank for IP Status. Any other ideas or thoughts?
Posted By: Gizmo Re: Fatal Error when checking user - 02/06/2017 7:52 PM
Remove that @ before file_get_contents and tell me if it throws an error.

As for your report about the status page, are you at the right page for the data you want? There are two of them, one, which has the api status test is pretty bare:
CP -> Master Settings -> Primary Settings -> Stop Forum Spam -> Test Connectivity

The other is when you're looking at a member and click "More Info" which has, more information.

The strings on the Test connectivity page are just:
$ubbt_lang['SF_SPAM'] = "Stop Forum Spam";
$ubbt_lang['SFS_STAT_DESC'] = "API Status: ";
$ubbt_lang['SFS_STAT_GOOD'] = "Can Connect";
$ubbt_lang['SFS_STAT_BAD'] = "Can Not Connect";
$ubbt_lang['SFS_TEST_IT'] = "Test Connectivity";

If the language strings do NOT load on these pages, you may not have the languages/english/admin/stop_forum_spam.php language file in place.

I wrote yet another test script for file_get_contents (there really isn't anything we can do at this point, it's a simple request from your server to their server, if something is found it just sorts the file):
PHP Code

<?php

$payload
= "91.200.13.3";

if(
function_exists("file_get_contents")) {
$fetch = file_get_contents("https://api.stopforumspam.org/api?ip=". $payload);
if(
$fetch != false) {
if(
$fetch != "Error") {
$xml = new SimpleXMLElement($fetch);

if(
$xml->appears == "yes") {
echo(
"We could connect to the Stop Forum Spam Database and have checked the dataset specified, the user \"". $payload ."\" is a spammer.");
} else {
echo(
"We could connect to the Stop Forum Spam Database and have checked the dataset specified, the user \"". $payload ."\" is <b>not</b> a spammer.");
}
} else {
echo(
"There was an error with the response from the Stop Forum Spam Database.");
}
} else {
echo(
"We could not establish a connection to the Stop Forum Spam Database, please ensure that your webhost does not restrict outside connections via the \"file_get_contents\" PHP Function.");
}
} else {
echo(
"The PHP function \"file_get_contents\" does not exist on this server.");
}
?>



You could also try my check new version code:
PHP Code

<?php

$build
= "20170101";
if(
function_exists("file_get_contents")) {
$source = file_get_contents("https://www.ubbwiki.com/latest/check/system-requirement-test");

if(
version_compare($source, $build, ">")) {
echo(
"<div style=\"text-align: center;\">\n\t<h2 class=\"heading notice\">Outdated Test Script Version</h2><br>\n</div>\n\nAn upgrade to the UBB.threads System Requirement Test is available, please see <a href=\"https://www.ubbwiki.com/\" target=\"_blank\">UBB.Wiki</a>: <a href=\"https://www.ubbwiki.com/latest/system-requirement-test\" target=\"_blank\">Latest System Requirement Test</a>. <b>Your Build</b>: ". $build ." <b>Latest Build</b>: ". $source ."<br><br>\n\n");
}
}
?>



Description: Stop Forum Spam - Test Connection Page
Attached picture aaa.png

Description: Stop Forum Spam, More Info
Attached picture bbb.png
Posted By: Basil Re: Fatal Error when checking user - 02/06/2017 8:34 PM
Problem Solved! While I did go to SSH and edit php.ini so that allow_url_fopen=on and restarted Apache, apparently I needed to use the "Multi ini tool" in WHM to set it to ON. Once I did that viola! All is working now! Thanks for all the help.
© 2019 UBB.threads PHP Forum Software Community