PDA

View Full Version : Bug in VB with user name...


Gutspiller
09-05-2001, 12:16 AM
I have a user named Slice 'N Dice and when you click on his name it gives an error message:

There seems to have been a slight problem with the database. Please try again by pressing the refresh button in your browser.

An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience.


Database error in vBulletin: Invalid SQL: SELECT COUNT(title) AS starts FROM thread WHERE postusername='Slice 'N Dice' AND open!='10'
mysql error: You have an error in your SQL syntax near 'N Dice' AND open!='10'' at line 1
mysql error number: 1064
Date: Tuesday 04th of September 2001 09:14:41 PM
Script: /forumz/member.php?action=getinfo&find=lastposter&threadid=760
Referer: http://www.theforumz.com/forumz/forumdisplay.php?forumid=3

So how do I go about fixing this bug?

Wayne Luke
09-05-2001, 12:41 AM
That is from a hack you installed. It does not properly handle the user name. You will have to contact the Hack Author for support. We cannot provide official support to a hack or other addon.

Gutspiller
09-05-2001, 03:02 AM
So if I registered here with that name it would work?

(How do you know it was a hack that is causing it) :confused:

orca
09-05-2001, 05:40 AM
It's just a guess but vB usually uses the addslashes function to add the ' ' around the entries which fixes the problem.

Admin
09-05-2001, 10:38 AM
Orca is right.
For non-numeric entries (post, title, username, password, etc.) the entry first goes thru the addslashes() function.
But it doesn't add ' (what's the point in that, it'll just cause more problems), it adds \ before ' and " to avoid the problem.

orca
09-05-2001, 01:26 PM
Well, true Firefly. That with '' was silly. I somehow thought about the \ but made a mess. Oh well, the exams crush my brain...

Valkyre
09-05-2001, 02:11 PM
Well I don't have "0" posts so I can't view the forum, but I do have a problem, or did have a problem with a user name of "T & A". Everytime I updated the counters it would show his name as "T ;amp & ;amp A". Weird is it not?

Gutspiller
09-05-2001, 02:18 PM
So, any info for a noobie on how I can fix this problem? I have no idea what hack could of caused this problem. :(

Admin
09-05-2001, 03:10 PM
In your member.php, find this
SELECT COUNT(title) AS starts FROM thread WHERE postusername
and paste here the full line of this.

Gutspiller
09-05-2001, 03:31 PM
// Find out how many threads this user has started

$startcount = $DB_site->query_first("SELECT COUNT(title) AS starts FROM thread WHERE postusername='$userinfo[username]' AND open!='10'");

$starts = $startcount[starts];

// end Find threads



That would be the hack. It's the hack that allows you to see how many threads a person has started. It shows it in the profile.

The hack instructions can be found here.

http://www.vbulletin.com/forum/showthread.php?threadid=12104

(Thanks for the help FireFly)

Admin
09-05-2001, 03:43 PM
// Find out how many threads this user has started
$startcount = $DB_site->query_first("SELECT COUNT(title) AS starts FROM thread WHERE postusername='".addslashes($userinfo[username])."' AND open!='10'");
$starts = $startcount[starts];
// end Find threads
I think that's what you need.

Gutspiller
09-05-2001, 03:56 PM
Works.

Many thanks!

*Starts thinking about sending money and beer to FireFly afterall* ;)

Admin
09-05-2001, 04:04 PM
I thought I made it clear I only like cookies. ;)