Guest User

Untitled

a guest
Dec 11th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. def register(user, filename, file, password, confirm)
  2. if(password != confirm) then return false end
  3. if(not_found(user) == user)
  4. user = html_clean(user)
  5. password = html_clean(password)
  6. upload_file(filename, file)
  7. n = SecureRandom.hex
  8. p = password + n
  9. hashed = Digest::SHA256.hexdigest p
  10. @db.prepare("INSERT INTO Users VALUES(?,?,#{filename},
  11. {n}")").execute([user,hashed])
  12. end
  13. true
  14. end
Add Comment
Please, Sign In to add comment