View Full Version : um BIG ISSUE
DarkDraco07
09-03-2002, 12:39 AM
i edited this post so erwins post doesnt make sence...
for some reason wehn someone is not logged in the forums, they cant log in and they get this error :
Invalid SQL: SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=
mysql error: You have an error in your SQL syntax near '' at line 1
mysql error number: 1064
Date: Monday 02nd of September 2002 08:05:34 PM
Script: (Link: http://www.darknemesis.com/forums/forums/index.php?)http://www.darknemesis.com/forums/forums/index.php?
Referer:
Erwin
09-03-2002, 12:43 AM
Reinstall the "Element" hack or whatever it is that uses the column element in your database.
DarkDraco07
09-03-2002, 01:28 AM
ignore the post above by erwin,
also when u click on the members button or look for users in admin page, it only shows 2 people
Erwin
09-03-2002, 01:38 AM
Mmm... something is wrong with the query that checks for total number PMs in your index.php. Go and compare the code between your index.php and an original unhacked index.php.
DarkDraco07
09-03-2002, 01:46 AM
uh...if i do compare... i wont know what to look for
Erwin
09-03-2002, 01:59 AM
The line is in your error email -
SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=
Just look for that line, and then compare that whole piece of code with the original. Chances are there is something missing or added that is causing a query error.
DarkDraco07
09-03-2002, 02:37 AM
ok, looked at clean and hacked. there were 3 lines with that in it. i compared and they were all the same
g-force2k2
09-03-2002, 05:18 PM
it seems that the userid variable that you're using isn't correct... can you show us the line of coding thats on the line erroring out? regards...
g-force2k2
DarkDraco07
09-03-2002, 05:50 PM
what line is that? in index.php?
this is the line erwin was talking about
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
DarkDraco07
09-03-2002, 11:09 PM
did i give the right info?
Erwin
09-03-2002, 11:36 PM
Safest thing is to compare the original unhacked index.php and the hacked one using Beyond Compare or Araxis Merge - one of the variables in those 3 lines of code you posted is not being used properly.
DarkDraco07
09-04-2002, 12:04 AM
uh....
index.php on old forum
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
new forum
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
unhacked
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
Erwin
09-04-2002, 12:06 AM
No, the problem is obviously not in the PM queries, but in another part of your index. I am saying to compare the WHOLE index.php because one of the user variables are not being checked properly.
DarkDraco07
09-04-2002, 12:15 AM
hmmm, is there a way i can contact u on some instant messenger? this is all confusing
Boofo
09-04-2002, 12:32 AM
Try replacing what you have there with this:
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages,
SUM(IF(dateline>$bbuserinfo[lastvisit] AND folderid=0,1,0)) AS newpm,
SUM(IF(messageread=0 AND folderid=0,1,0)) AS unreadpm
FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
$newpm['messages']=$allpm['newpm'];
$unreadpm['messages']=$allpm['unreadpm'];
This code will also cut 2 queries from your forumhome.
Erwin
09-04-2002, 12:33 AM
I'm at work. :) So no. Compare the index.php with an unhacked one, and you will find the missing or erroneous code.
DarkDraco07
09-04-2002, 01:04 AM
damn, i dont know where to start. index.php is a kinda big file to look word for word, plus with the hacksinstalled it will be harder
Boofo
09-04-2002, 01:06 AM
DarkDraco07, replace the code I gave you and see if that does anything.
DarkDraco07
09-04-2002, 01:16 AM
1sec
DarkDraco07
09-04-2002, 01:24 AM
replace the
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
right?
Boofo
09-04-2002, 01:33 AM
Yes.
DarkDraco07
09-04-2002, 01:40 AM
nope, people cant log in and i still cant log out
check it out www.darknemesis.com/forums
look at the members page and look at total members on forum home
DarkDraco07
09-04-2002, 01:45 AM
just to make sure, for the members i need to backup which querys?
Boofo
09-04-2002, 01:57 AM
How many members do you actually have? The code I gave you is for private messages. It shouldn't have anything to do with what seems to be happening. Somewhere in your index.php you have another problem. Either with a hack you installed or something. Like Erwin said, the only way to find out what it is is to compare it or start over with a fresh index.php and see if that fixes it.
Erwin
09-04-2002, 02:04 AM
Yup. It has nothing to do with PM - the PM query is trying to find your bbuserinfo[userid] and other user information which is not being checked by index.php properly, hence your login problems.
DarkDraco07
09-04-2002, 02:10 AM
NOOOO :( i hate vb!!! ahhhhh
is anyone willing to check my index.php file for me cuz...i cant seem to find a wrong variable. i searched line by line by copy/pasting in find and i cant seem to see whats wrong!!
and how come in the members page it has me and a random person on there
DarkDraco07
09-04-2002, 03:45 PM
i guess thats a no...
DarkDraco07
09-04-2002, 05:45 PM
i took a fresh index.php file and reinstalled EVERY hack that needed index.php. still have same problem.
for more info aobut my problem its like this...
if someone is logged out and logs in, it will show them as logged in and a guest at same time but they are not logged in.
if you are logged in (only me) and try to log out it shows u as a guest and as logged in at same time but you are logged in
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.