What I need is to create user sessions at my website validating the user/password with the Moodle users table.
I found at the forum some topics explaining that you can send a http_post to the login file, but it will create the session at the moodle domain. What I want is to check that the user and password given at http://domain1.com math to the user and password of an user account at http://mymoodle.com
I thought that I can connect directly to the db server of moodle and check this.
But now I've other problem. At users table, you have the password hash. What I want is to set a php function at my own domain that would generate the password hash of the password I set at the login-form, and then check if this hash matches the hash of moodle user password.
I know I need a salt, but y can get the salt by cutting the 22 characters from moodle password https://moodle.org/mod/forum/discuss.php?d=235504#p1023177
Well I think I have all the tools I need, but I don't know how to use it. So, my question is:
How have I to use the password_hash in order to generate the same hash that moodle generates?
stringpassword_hash ( string $password
, integer $algo
[, array $options
] )
Sorry my English!