vBulletin 3.6 / vNews Bad Function

Electronic Punk

willalwaysbewithyou
Staff member
Political Access
Joined
2 Dec 2001
Messages
18,694
Here is the function that I think is causing all the problems:

PHP:
function validateuser($userid,$userpassword) {

  global $inadmin,$vb_prefix,$vb_license,$HTTP_POST_VARS;

  if ($userid > 0) {

    $userinfo = query_first("SELECT
      ".$vb_prefix."user.usergroupid,
      ".$vb_prefix."user.username,
      ".$vb_prefix."user.salt,
      ".$vb_prefix."user.userid,
      ".$vb_prefix."user.password,
      ".$vb_prefix."user.email,
      ".$vb_prefix."user.options,
      ".$vb_prefix."user.pmunread,
      ".$vb_prefix."usergroup.genericoptions,
      news_staff.*
      FROM ".$vb_prefix."user
      INNER JOIN ".$vb_prefix."usergroup ON ".$vb_prefix."user.usergroupid = ".$vb_prefix."usergroup.usergroupid
      LEFT JOIN news_staff ON ".$vb_prefix."user.userid = news_staff.userid
      WHERE ".$vb_prefix."user.userid = $userid");

    if ($userinfo) {

      if ($inadmin & !empty($HTTP_POST_VARS[username])) {
        $userpassword = md5(md5($userpassword.$userinfo[salt]).$vb_license);
      }

      if ((md5($userinfo[password] . $vb_license)) == $userpassword) {
        if (($userinfo[usergroupid] != 3) & ($userinfo[usergroupid] != 4)) {
          if ($userinfo[genericoptions] & 32) {
            unset($userinfo);
            if ($inadmin) {
              return false;
            } else {
              standarderror("user_banned");
            }
          }

          if ($GLOBALS[getpmmsg] & !$inadmin) {
            $GLOBALS[num_private_msgs] = $userinfo[pmunread];
          }

          $userinfo[viewsigs] = iif($userinfo[options] & 1,1,0);
          $userinfo[activated] = 1;
          $userinfo[moderated] = 1;
          $userinfo[showemail] = iif($userinfo[options] & 256,1,0);
          $userinfo[emailnotification] = iif($userinfo[options] & 16384,1,0);
          $userinfo[commentdefault] = $GLOBALS[commentreplydefault];

          return $userinfo;
        } else { // Account not activated
          unset($userinfo);
          return false;
        }
      } else { // Password wrong
        unset($userinfo);
        return false;
      }
    } else { // Userid wrong
      unset($userinfo);
      return false;
    }
  } else { // No userid
    unset($userinfo);
    return false;
  }
}

Late last night I had to remove both

Code:
      } elseif ($userinfo[bandate] & (($userinfo[liftdate] == 0) | (time() < $userinfo[liftdate]))) {
        $error = "user_banned";

and

Code:
            } else {
              standarderror("user_banned");

To trick the frontpage into working correctly.
Really needed Tingle's help with this but he is offline at the moment.

the issue comes from vBulletin switching the flag on whether a user is banned. ie what once was 0 is now 1, so Virtuanews thinks the user is banned. Quite annoying. I am pretty sure all the other Virtuanews functions are working fine.

Anyone that can make head or tail of this?
 
Last edited:
Looks like just the second bit of code needed to be removed.
Might just even be this line here:

if ($userinfo[genericoptions] & 32) {

Before if that field contained a 32 the user was banned, now if it doesn't they are banned. Not sure how to reverse it !& did not work
 
Dunno what it is....

Code:
          if ($userinfo[genericoptions] & 32) {
            unset($userinfo);
            if ($inadmin) {
              return false;
            } else {
              standarderror("user_banned");
            }

Snipped all that out anyway and the frontpage is temp. working.
Which is ****ing great news.

Dunno what the implications of what I have done might be tho, will have to test that now.
 
If I can figure out why vBulletin doesn't like its own damn Javascript I will be laughing :)
 
Because invision is the way of the future :p

Might be a good idea to find a replacement for vNews.
 
Nah no need now, is sorted. Will ask Tingle to fix the function if I see him.
 
Oooor we could just code our own front page news portal?
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,623
Latest member
AndersonLo
Back