PDA

View Full Version : database error....for a hack...


Kathy
11-25-2002, 09:56 PM
Okay, not sure how to describe this...nor how to fix it. :banana:


I have several special hacks on my board that were installed by various helpers from here and vb.com.

This particular hack has been no problem for any upgrade. With this upgrade there is apparently something that messing up in the script.

We have special usergroups. While the registered users are "regular members" these special usergroups (we call jewels) are levels of donors.

Crown Jewels
Rubies
Diamonds

Each of these groups get special privileges. Avatars for one.

All of their group specialites seem to be working.

However here is where the glitch comes in:

We have a hack that is a page the displays these crown jewels. It is a hack that KIER wrote for displaying mod groups back before this function was added to the VB)

CLick on this link and it takes you to a page that is based on templates, a crown.php file .....

I have the link to view these JEWELS in every header of the VB and on my content pages.

However since the upgrade last week, whenever anyone clicks on the link, we are getting an error:

Database error in vBulletin 2.2.8:

Invalid SQL:
SELECT DISTINCT
user.*, userfield.*, session.userid AS sessionuserid, session.lastactivity
,avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar
FROM user
LEFT JOIN usergroup ON (usergroup.usergroupid = user.usergroupid)
LEFT JOIN userfield ON (userfield.userid = user.userid)
LEFT JOIN session ON (session.userid = user.userid
AND session.userid <> 0 AND user.invisible = 0 AND session.lastactivity>0)
LEFT JOIN avatar ON avatar.avatarid=user.avatarid LEFT JOIN customavatar ON customavatar.userid=user.userid
WHERE user.usergroupid IN(50,51,34)
GROUP BY user.username
ORDER BY user.userid

mysql error:

mysql error number: 0

Date: Monday 25th of November 2002 05:42:02 PM
Script: http://www.hystersisters.com/vb2/vb2/crown.php
Referer: http://www.hystersisters.com/vb2/forumdisplay.php?s=&forumid=5

The odd thing...is that the link is:

http://www.hystersisters.com/vb2/crown.php in all the headers (I didn't accidently put vb2 in their twice.)

while the error shows /vb2/vb2/

Remembering I'm PHP-challenged, is there someplace I can check to find this error?

I'm attaching the crown.php file for you to see:


<?

// install show admin groups version 2.0
// by Kier Darby: kier@ap3d.com

$supermod_usergroup = 51;
$admin_usergroup = 50;
$mentor_usergroup = 34;

// set the next line to "no" if you don't want to show avatars.
$showavatars = "no";

$templatesused="postbit_online,postbit_offline,showmoderators,show mods_adminbit,postbit_sendpm,showmods_bit,showmods _forumbit,showmods_forumsplit,postbit_avatar";
require ("./global.php");

function douserinfo() {
global $user, $sendpmlink, $onlinestatus, $showonline, $cookietimeout, $showavatars, $avatarenabled;
$datecut = time() - $cookietimeout;

if ($user[field2] == "") $user[location] = "&nbsp;";
else $user[location] = $user[field2];

if ($user[receivepm] == 0) $sendpmlink = "&nbsp;";
else {
$post[userid] = $user[userid];
eval("\$sendpmlink = \"".gettemplate("postbit_sendpm")."\";");
}

if ($showonline)
if ($user[sessionuserid]>0 && $user[lastactivity]>$datecut) eval("\$onlinestatus = \"".gettemplate("postbit_online")."\";");
else eval("\$onlinestatus = \"".gettemplate("postbit_offline")."\";");
else
$onlinestatus = "&nbsp;";

if ($showavatars == "yes") {
if ($user[avatarid]!=0) {
$avatarurl=$user[avatarpath];
} else {
if ($user[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?s=$session[sessionhash]&userid=$user[userid]";
} else {
$avatarurl="";
}
}
if ($avatarurl=="") {
$user[avatar]="";
} else {
eval("\$user[avatar] = \"".gettemplate("postbit_avatar")."\";");
}
}

}

// get administrators & super moderators ************************************************** ********
$users = $DB_site->query("
SELECT DISTINCT
user.*, userfield.*, session.userid AS sessionuserid, session.lastactivity
".iif($avatarenabled,",avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar","")."
FROM user
LEFT JOIN usergroup ON (usergroup.usergroupid = user.usergroupid)
LEFT JOIN userfield ON (userfield.userid = user.userid)
LEFT JOIN session ON (session.userid = user.userid
AND session.userid <> 0 AND user.invisible = 0 AND session.lastactivity>0)
".iif ($avatarenabled,"LEFT JOIN avatar ON avatar.avatarid=user.avatarid LEFT JOIN customavatar ON customavatar.userid=user.userid","")."
WHERE user.usergroupid IN($admin_usergroup,$supermod_usergroup,$mentor_us ergroup)
GROUP BY user.username
ORDER BY user.userid
");

while ($user = $DB_site->fetch_array($users)) {
if ($user[usergroupid] == $admin_usergroup) {
if (($admincount++ % 2) == 0) $backcolor = "#DFDFDF";
else $backcolor = "#F1F1F1";
douserinfo();
eval("\$adminbits .= \"".gettemplate("showmods_adminbit")."\";");
}
elseif ($user[usergroupid] == $supermod_usergroup) {
if (($smodcount++ % 2) == 0) $backcolor = "#DFDFDF";
else $backcolor = "#F1F1F1";
douserinfo();
eval("\$supermodbits .= \"".gettemplate("showmods_adminbit")."\";");
}
else {
if (($mentorcount++ % 2) == 0) $backcolor = "#DFDFDF";
else $backcolor = "#F1F1F1";
douserinfo();
eval("\$mentorbits .= \"".gettemplate("showmods_adminbit")."\";");
}

}

// get moderators ************************************************** ********
$users = $DB_site->query("
SELECT DISTINCT
user.*, userfield.*, forum.forumid, forum.title AS forumtitle, session.userid AS sessionuserid
".iif($avatarenabled,",avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar","")."
FROM moderator
LEFT JOIN user ON (user.userid = moderator.userid)
LEFT JOIN forum ON (forum.forumid = moderator.forumid)
LEFT JOIN userfield ON (userfield.userid = user.userid)
LEFT JOIN session ON (session.userid = user.userid
AND session.userid <> 0 AND user.invisible = 0 AND session.lastactivity>0)
".iif ($avatarenabled,"LEFT JOIN avatar ON avatar.avatarid=user.avatarid LEFT JOIN customavatar ON customavatar.userid=user.userid","")."
ORDER BY user.username ASC, forum.displayorder ASC
");

while ($user = $DB_site->fetch_array($users)) {
$moderator[$user[userid]] = $user;
if ($modforums[$user[userid]] == "")
eval("\$modforums[".$user[userid]."] .= \"".gettemplate("showmods_forumbit")."\";");
else {
eval("\$modforums[".$user[userid]."] .= \"".gettemplate("showmods_forumsplit")."\";");
eval("\$modforums[".$user[userid]."] .= \"".gettemplate("showmods_forumbit")."\";");
}
}
unset($user);

while(list(, $user) = each($moderator)) {
if (($modcount++ % 2) == 0) $backcolor = "#DFDFDF";
else $backcolor = "#F1F1F1";
$forumbits = $modforums[$user[userid]];
douserinfo();
eval("\$moderatorbits .= \"".gettemplate("showmods_bit")."\";");
}

// ************************************************** *****

makeforumjump();
eval("dooutput(\"".gettemplate("showmoderators")."\");");
?>



Thanks for any help you can provide.


:ermm:

Kathy
11-25-2002, 10:09 PM
Another error:


Database error in vBulletin 2.2.8:

Invalid SQL:
SELECT DISTINCT privatemessage.*, user.username AS tousername, user.emailonpm, user.invisible,
user.lastactivity, icon.iconpath, session.userid AS sessionuserid
FROM privatemessage
LEFT JOIN user ON (user.userid = privatemessage.touserid)
LEFT JOIN icon ON (icon.iconid = privatemessage.iconid)
LEFT JOIN session ON (session.userid = user.userid
AND session.userid <> 0 AND user.invisible = 0 AND session.lastactivity>0)
WHERE fromuserid=27814
AND folderid <> -1
AND receipt > 0
AND dateline >= 1038092807
ORDER BY dateline DESC
mysql error:

mysql error number: 0

Date: Monday 25th of November 2002 06:06:47 PM
Script: http://www.hystersisters.com/vb2/vb2/private2.php?daysprune=
Referer: http://www.hystersisters.com/vb2/private.php


Now its other things as well....

Any idea why the path is adding an extra vb2/ to the path?? :eek:

NTLDR
11-25-2002, 10:40 PM
Check in the Admin CP that $bburl (the boards url) is set correctly and that you don't have the directory name twice there.

Kathy
11-25-2002, 10:42 PM
I checked and I don't. All other functions are fine. Replies and threads, forums and so on....

I'm putting in a ticket at VB.com I guess....

Erwin
11-26-2002, 01:34 AM
The repeating forum directory is just a by-product of the SQL error - ignore that.

The problem is the query - I had a similar problem in my admin user.php and mod user.php - it is to with the query looking for non-custom avatars. For the life of me I cannot remember what I did to fix it...

It's to do with newer versions of vB not liking certain older queries. That doesn't explain your private.php error though, unless you didn't update it completely.

When I have time I will look it up for you.

Kathy
11-26-2002, 01:41 AM
Thanks guys. Just an update...I found the culprit. Not VB at all....but a too full server. /usr was so full it couldn't handle even writing correct error logs (thus the error=0 in the error message)

My server holds 16 gig and yet we had it at capacity with the vb of ours. Its not the first time a full server did funky things to the processes of the vb...and each time I forget about this kind of behavior. (Each time its a bit different in its symptoms)

We recently upgraded and had additional backups of the database...somewhere between 1-2 gig in size. :eek:

So...we deleted two backups and *poof* we are in business again and my hacks are all functional again and the other postings.php and private2.php are now working fine.

Thanks sooo much for ya'lls help. (And thanks to Logician who found my server tooooo full as the answer)


Any idea if adding a hard drive to my server would help with storage space on a rapidly growing database? :-) (I even prune inactive members monthly.)