Error in Ip search (moderators)
| Author |
Message |
Aforo


Joined: Dec 27, 2007 Posts: 146
|
Post subject: Error in Ip search (moderators) Posted: Tue Oct 27, 2009 4:40 pm |
|
I get sometimes a error with looking for Ip of user. Only sometimes Ip is not saved OK.
The error is the next:
Quote:
On /index.php?name=Forums&file=modcp&mode=ip&p=133081&t=9922
While executing query "SELECT u.user_id, u.username, COUNT(*) as postings
FROM nuke_users u, nuke_bbposts p
WHERE p.poster_id = u.user_id
AND p.poster_ip = 'S'C '
GROUP BY u.user_id, u.username
ORDER BY postings DESC LIMIT 50"
the following error occured: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'C '
GROUP BY u.user_id, u.username
ORDER BY postings DESC LIMIT 50' at line 4
In: /var/www/vhosts/my_domain/httpdocs/modules/Forums/modcp.php on line: 909
I was thinking if is posible that error can be in post table, because i was playing with indexes... but I'm not sure.
Table structure is:
Quote:
CREATE TABLE `nuke_bbposts` (
`post_id` int(10) unsigned NOT NULL auto_increment,
`topic_id` mediumint(9) NOT NULL default '0',
`forum_id` smallint(6) NOT NULL default '0',
`poster_id` mediumint(9) NOT NULL default '0',
`post_time` int(11) NOT NULL default '0',
`poster_ip` varbinary(17) NOT NULL default '',
`post_username` varchar(25) default '',
`enable_bbcode` tinyint(1) NOT NULL default '1',
`enable_html` tinyint(1) NOT NULL default '0',
`enable_smilies` tinyint(1) NOT NULL default '1',
`enable_sig` tinyint(1) NOT NULL default '1',
`post_edit_time` int(11) default '0',
`post_edit_count` smallint(6) NOT NULL default '0',
`post_attachment` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`post_id`),
KEY `forum_id` (`forum_id`),
KEY `topic_id` (`topic_id`),
KEY `poster_id` (`poster_id`),
KEY `post_time` (`post_time`)
) ENGINE=MyISAM AUTO_INCREMENT=135695 DEFAULT CHARSET=utf8 AUTO_INCREMENT=135695 ;
I think that data in the table is not OK, but I'm not sure if is a question of database or function Ip code...
Somebody has a similar mistake with some IP????
_________________ Aforo - Google Earth - WebNaranja - DFcms.es
Aforo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Centos 5/Apache 2.2.3/MySQL:5.0.45/PHP:5.2.10 /9.2
Last edited by Aforo on Wed Oct 28, 2009 8:33 pm; edited 2 times in total |
|
| Back to top |
|
 |
NanoCaiordo


Joined: Jun 29, 2004 Posts: 3677 Location: Melbourne, AU
|
Post subject: Re: Errro in Ip search (moderators) Posted: Wed Oct 28, 2009 11:30 am |
|
bookmarked ill be looking into this soon
_________________ .:: I met php the 03 December 2003 :: Unforgettable day! ::.
NanoCaiordo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) MySQL 5.1 / PHP 5.3 / NextGen() |
|
| Back to top |
|
 |
Aforo


Joined: Dec 27, 2007 Posts: 146
|
Post subject: Re: Error in Ip search (moderators) Posted: Thu Oct 29, 2009 1:12 pm |
|
I think that I found something, looking the Ip that fails:
Quote:
"SELECT u.user_id, u.username, COUNT(*) as postings
FROM nuke_users u, nuke_bbposts p
WHERE p.poster_id = u.user_id
AND p.poster_ip = 'S'C '
GROUP BY u.user_id, u.username
ORDER BY postings DESC LIMIT 50"
Other example:
Quote:
While executing query "SELECT u.user_id, u.username, COUNT(*) as postings
FROM nuke_users u, nuke_bbposts p
WHERE p.poster_id = u.user_id
AND p.poster_ip = 'X 'U'
GROUP BY u.user_id, u.username
ORDER BY postings DESC LIMIT 50"
The character (') is included inside the string... (p.poster_ip = 'X 'U') and, of course, this SQL query fails.
_________________ Aforo - Google Earth - WebNaranja - DFcms.es
Aforo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Centos 5/Apache 2.2.3/MySQL:5.0.45/PHP:5.2.10 /9.2 |
|
| Back to top |
|
 |
Aforo


Joined: Dec 27, 2007 Posts: 146
|
Post subject: Re: Error in Ip search (moderators) Posted: Thu Oct 29, 2009 2:25 pm |
|
I think that I found a solution:
Adding addslahes to modcp.php aroud line 900:
Quote:
//
// Get other users who've posted under this IP
//
$sql = "SELECT u.user_id, u.username, COUNT(*) as postings
FROM ".USERS_TABLE ." u, ".POSTS_TABLE." p
WHERE p.poster_id = u.user_id
AND p.poster_ip = '".addslashes($post_row['poster_ip'])."'
GROUP BY u.user_id, u.username
At least I haven't the mistake and I can see the IP address of these IPs
_________________ Aforo - Google Earth - WebNaranja - DFcms.es
Aforo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Centos 5/Apache 2.2.3/MySQL:5.0.45/PHP:5.2.10 /9.2 |
|
| Back to top |
|
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|

|
User Info ![Show/hide content [x]](themes/dragonfly/images/minus.png)
 Welcome Anonymous
Last CVS commits ![Show/hide content [x]](themes/dragonfly/images/minus.png)
Languages ![Show/hide content [x]](themes/dragonfly/images/minus.png)
Community ![Show/hide content [x]](themes/dragonfly/images/minus.png)
 Support for DragonflyCMS in a other languages:
• Deutsch
• Español
X-links ![Show/hide content [x]](themes/dragonfly/images/minus.png)
Preview theme ![Show/hide content [x]](themes/dragonfly/images/minus.png)
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.
|