/** * Validates if a hashed password is the correct hashed password for a given raw password, username and salt * @param string $Username * @param string $RawPassword the textual password (entered by user at login) * @param string $HashedPassword the hashed password (retrived from database) * @param string $Salt the dynamic salt (from database) * @param integer $Protocol optional for backward compatibility * @return boolean */ static function Validate($Username, $RawPassword, $HashedPassword, $Salt, $Protocol = null) { $temp = new Password($Username, $RawPassword, $Protocol); $temp->Make($Username, $RawPassword, $Salt, $Protocol); return $temp->Password() == $HashedPassword; }
/** Creates a new user in the system @param Username of the new user @param Password of the new user @return integer UserID on success null on User Already Exists */ function CreateUser($Username, $Password) { $Result = $this->UserExists($Username); if ($Result) { return null; } $HashedPass = new Password($Username, $Password); $Result = jf::SQL("INSERT INTO {$this->TablePrefix()}users (Username,Password,Salt,Protocol)\n\t\t\tVALUES (?,?,?,?)", $Username, $HashedPass->Password(), $HashedPass->Salt(), $HashedPass->Protocol()); return $Result; }