1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.


Discussion in 'General XenForo Discussion and Feedback' started by SClark, Jun 12, 2012.

  1. SClark

    SClark New Member

    When passwords, salt, and all that non sense are stored into xf_user_authenticate are they sent as a string or something else. From what I've gather it's binary but a closer look when I use SELECT it's in a table format serialized. I guess my question how do you serialize it.

    If you remotely understand lua take a look at this.
    salt = self:Salt(64)
    pass = string.lower(tostring(pass))
    pass = string.lower(crypto.sha256(pass))
    pass = string.lower(crypto.sha256(pass .. salt))
    hash = 'a:3:{s:4:\"hash\";s:64:\"' .. pass .. '\";s:4:\"salt\";s:64:\"' .. salt .. '\";s:8:\"hashFunc\";s:6:\"sha256\";}'
    local query2 = database:query("INSERT INTO " .. Prefix .. "_user (`username`, `email`, `user_group_id`, `register_date`, `user_state`) VALUES ('" .. escape(user) .. "', '" .. escape(email) .. "', '" .. group .. "', '" .. regdate .. "', '" .. escape('valid') .. "')")
    This is a project I'm heading up for garry's mod communities. My code is available here.
  2. Robbo

    Robbo Well-Known Member

    It is just serialize()'ed from PHP. I'm sure there would be an alternative for Lua or that it would be using some standard.

    Edit: you should actually be using XenForo to handle all this. Or at least PHP.
    SClark likes this.
  3. SClark

    SClark New Member

    Lua does have a serialize'r in a sense. At least for garry's mod. It called glon. What I'm really after is, is it inserted as a string? It says in binary in phpmyadmin.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    SClark likes this.
  5. SClark

    SClark New Member

    Thanks for the help. Looks easy once I went in depth a bit more than before. Actually got a grasp on what it should look like.

Share This Page