PDA

View Full Version : Add user with SQL


Tyluur
07-27-2013, 09:11 PM
I am operating a forum for a game and I am removing the vBulletin registration form and making it automated when you first log in.

I am adding the user to user table and generating the password with a small algorithm. The login process is flawless with my registration system.

The only issue is that even though the usergroupid is 2 and the membergroupid is 2 (registered users), they show up as guests! Why is this?

This is my query:

.execute("INSERT INTO `vbulletin_user` (`userid`, `usergroupid`, `membergroupids`, `displaygroupid`, `username`, `password`, `passworddate`, `email`, `styleid`, `parentemail`, `homepage`, `icq`, `aim`, `yahoo`, `msn`, `skype`, `showvbcode`, `showbirthday`, `usertitle`, `customtitle`, `joindate`, `daysprune`, `lastvisit`, `lastactivity`, `lastpost`, `lastpostid`, `posts`, `reputation`, `reputationlevelid`, `timezoneoffset`, `pmpopup`, `avatarid`, `avatarrevision`, `profilepicrevision`, `sigpicrevision`, `options`, `birthday`, `birthday_search`, `maxposts`, `startofweek`, `ipaddress`, `referrerid`, `languageid`, `emailstamp`, `threadedmode`, `autosubscribe`, `pmtotal`, `pmunread`, `salt`, `ipoints`, `infractions`, `warnings`, `infractiongroupids`, `infractiongroupid`, `adminoptions`, `profilevisits`, `friendcount`, `friendreqcount`, `vmunreadcount`, `vmmoderatedcount`, `socgroupinvitecount`, `socgroupreqcount`, `pcunreadcount`, `pcmoderatedcount`, `gmmoderatedcount`, `assetposthash`, `fbuserid`, `fbjoindate`, `fbname`, `logintype`, `fbaccesstoken`, `newrepcount`, `bloggroupreqcount`, `showblogcss`) VALUES (NULL, 2, '', 0, '" + name + "', '" + ForumIntegration.passwordToHash(password, getSalt()) + "', '2013-07-26', 'blank@gmail.com', 0, '', '', '', '', '', '', '', 1, 1, 'Junior Member', 0, 1374895770, 0, 1374933245, 1374946433, 0, 0, 0, 10, 5, '-6', 0, 0, 0, 0, 0, 45108423, '08-29-1996', '1996-08-29', -1, -1, '75.170.115.180', 0, 1, 0, 0, -1, 0, 0, '', 0, 0, 0, '', 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, '', 'vb', '', 0, 0, 1);");

Zachery
07-27-2013, 09:38 PM
Well, you shouldn't set a membergroup as the primary usergroup, that is just super silly.


You should look at the user DM and pass your data to a script that will use it, instead of running manual sql, because you're not updating the 5 other tables that are required for a user to be a user.

Tyluur
07-27-2013, 09:41 PM
Well, you shouldn't set a membergroup as the primary usergroup, that is just super silly.


You should look at the user DM and pass your data to a script that will use it, instead of running manual sql, because you're not updating the 5 other tables that are required for a user to be a user.

Thank you for your reply! I am not familiar with php, so where do I look, or can you tell me the other 5 tables required to be user?