News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

how to create a user without using APIS

Started by Sunchaser, December 31, 2015, 02:55:47 PM

Previous topic - Next topic

Sunchaser

Hello, I need to fix quickly a script that is creating user in SMF and is not using API. I need to create user automatically from another application. I know is not the best way but i never been able to make the APIs work.

Currently the script is doing this:

$salt = substr(md5(mt_rand()), 0, 4);
$temp_pwd = strtolower(substr(md5(date("Y-m-d H:i:s")),0,12));
$password = sha1($temp_pwd);

...

$query = "REPLACE INTO smf_members(member_name, real_name, email_address, is_activated, id_post_group, passwd, date_registered, password_salt, ID_GROUP) VALUES( $memberName, $realName, '$emailAddress', '$is_activated', '$ID_POST_GROUP', '$password', '$dateRegistered', '$salt', '$id_group')";


What's the error? Should I do

$password = sha1($temp_pwd . $salt)?

thanks




   


Advertisement: