Error in Ip search (moderators)
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexCPG-BB (forum)
Author Message
Aforo
I18N / L10N Lead Dev


Joined: Dec 27, 2007
Posts: 146

PostPost subject: Error in Ip search (moderators)
Posted: Tue Oct 27, 2009 4:40 pm
Reply with quote

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
View user's profile Visit poster's website
NanoCaiordo
Developer


Joined: Jun 29, 2004
Posts: 3677
Location: Melbourne, AU

PostPost subject: Re: Errro in Ip search (moderators)
Posted: Wed Oct 28, 2009 11:30 am
Reply with quote

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
View user's profile Visit poster's website
Aforo
I18N / L10N Lead Dev


Joined: Dec 27, 2007
Posts: 146

PostPost subject: Re: Error in Ip search (moderators)
Posted: Thu Oct 29, 2009 1:12 pm
Reply with quote

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
View user's profile Visit poster's website
Aforo
I18N / L10N Lead Dev


Joined: Dec 27, 2007
Posts: 146

PostPost subject: Re: Error in Ip search (moderators)
Posted: Thu Oct 29, 2009 2:25 pm
Reply with quote

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
Confused

_________________
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
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexCPG-BB (forum) All times are GMT
Page 1 of 1


Jump to:  
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

stopsoftwarepatents.eu petition banner
User Info [x]

Welcome Anonymous

Nickname
Password
(Register)

Last CVS commits [x]

Languages [x]

Community [x]

Support for DragonflyCMS in a other languages:

Deutsch
Español

X-links [x]
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

Preview theme [x]
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.


You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
This page generated in 0.3734 seconds with 16 DB Queries in 0.0316 seconds
Memory Usage: 2.88 MB
Interactive software released under GNU GPL, Code Credits, Privacy Policy