• Welcome to Simple Machines Community Forum. Please login or sign up.
September 20, 2021, 11:16:43 PM

News:

Want to get involved in developing SMF, then why not lend a hand on our github!


Database Error "Incorrect string value for function inet_aton" on Subs.php

Started by Short_Teeth, April 11, 2016, 10:12:11 AM

Previous topic - Next topic

Short_Teeth

I ve installed smf on my web server with no errors what so ever. But there is this error "Incorrect string value: '' for function inet_aton" on Line 2653. This DB error sometimes goes away for a few seconds but comes back again. Is there a way to handle such error and it would also be helpful to explain what is causing such an issue.

Illori

why are you using SMF 2.1 on a production server? it is still in beta. if you really want to use SMF 2.1 you should grab it off github where it is more updated and this issue may have been resolved already.

Short_Teeth


margarett

It seems that a certain IP address gets empty? Can you please attach Subs.php?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Illori

Quote from: margarett on April 11, 2016, 07:35:35 PM
It seems that a certain IP address gets empty? Can you please attach Subs.php?

maybe an ipv6 address as SMF 2.0 does not support it?

Short_Teeth

The problem was that the string was empty ... Ive managed to counter the issue by adding this piece of code... Correct me if I'm doing anything wrong....

      $smcFunc['db_query']('', '
UPDATE {db_prefix}log_online
SET log_time = {int:log_time}, ip = IFNULL(INET_ATON({string:ip}), 0), url = {string:url}
WHERE session = {string:session}',
array(
'log_time' => time(),
'ip' =>  $user_info['ip']  = ($user_info['ip']  != '' ? $user_info['ip']  : '0'),
'url' => $serialized,
'session' => $session_id,
)
);

Advertisement: