SMF Support > PostgreSQL and SQLite Support
Help with registration
Snakeman:
I'm making a gamemode for sa-mp online game.It works synchronized with my simple machines forum.If you register ingame,you can use your account in smf too.If you register at site,you can use your account in game too.
Because of this,i need a code for registration.
Example:
--- Code: ---INSERT INTO smf_members ("Snakeman"...)
--- End code ---
Thanks..[/b]
emanuele:
Hello Snakeman and welcome to sm.org! :)
You may want to use SMF function registerMember, this is an example taken from ManageRegistrations.php:
--- Code: --- $regOptions = array(
'interface' => 'admin',
'username' => $_POST['user'],
'email' => $_POST['email'],
'password' => $_POST['password'],
'password_check' => $_POST['password'],
'check_reserved_name' => true,
'check_password_strength' => false,
'check_email_ban' => false,
'send_welcome_email' => isset($_POST['emailPassword']) || empty($_POST['password']),
'require' => isset($_POST['emailActivate']) ? 'activation' : 'nothing',
'memberGroup' => empty($_POST['group']) || !allowedTo('manage_membergroups') ? 0 : (int) $_POST['group'],
);
require_once($sourcedir . '/Subs-Members.php');
$memberID = registerMember($regOptions);
--- End code ---
You have to fill the array $regOptions with the few informations required (interface should be guest and not admin in your case I think), and SMF will take care of create the user.
Snakeman:
--- Quote from: emanuele on June 13, 2012, 01:22:36 PM ---Hello Snakeman and welcome to sm.org! :)
You may want to use SMF function registerMember, this is an example taken from ManageRegistrations.php:
--- Code: --- $regOptions = array(
'interface' => 'admin',
'username' => $_POST['user'],
'email' => $_POST['email'],
'password' => $_POST['password'],
'password_check' => $_POST['password'],
'check_reserved_name' => true,
'check_password_strength' => false,
'check_email_ban' => false,
'send_welcome_email' => isset($_POST['emailPassword']) || empty($_POST['password']),
'require' => isset($_POST['emailActivate']) ? 'activation' : 'nothing',
'memberGroup' => empty($_POST['group']) || !allowedTo('manage_membergroups') ? 0 : (int) $_POST['group'],
);
require_once($sourcedir . '/Subs-Members.php');
$memberID = registerMember($regOptions);
--- End code ---
You have to fill the array $regOptions with the few informations required (interface should be guest and not admin in your case I think), and SMF will take care of create the user.
--- End quote ---
My friends tells me that,you must fill all coloumns at smf_members table.I told them that i must only fill required coloumns and smf will take care of the others.They don't believed me :) Thank you very much,that's what i wanted,but i need it as INSERT INTO command.
emanuele:
I'd really suggest you to use the function instead of directly insert things, this is way more reliable and it will be compatible with future versions of SMF.
Additionally the members table is not the only one that is populated when a user registers.
If you really want to go with the insert, I think it would be better if you check the registerMember function and see what is mandatory and what is not and how things must be stored (remember the password is encrypted for example).
Snakeman:
--- Quote from: emanuele on June 13, 2012, 04:21:35 PM ---I'd really suggest you to use the function instead of directly insert things, this is way more reliable and it will be compatible with future versions of SMF.
Additionally the members table is not the only one that is populated when a user registers.
If you really want to go with the insert, I think it would be better if you check the registerMember function and see what is mandatory and what is not and how things must be stored (remember the password is encrypted for example).
--- End quote ---
OK,i will try to make this with registerMember function.Thank you.
Navigation
[0] Message Index
[#] Next page
Go to full version