Advertisement
Guest User

Untitled

a guest
Oct 17th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. talan ez function encryptSerial(str)
  2. local hash = md5(str)
  3. local rhash = "VGRP" .. string.sub(hash, 17, 20) .. string.sub(hash, 1, 2) .. string.sub(hash, 25, 26) .. string.sub(hash, 21, 2)
  4. return rhash
  5. end
  6.  
  7.  
  8.  
  9. talan ez
  10. function calculateAutoLoginHash(username)
  11. local hash = md5(salt .. username .. math.random(1,1000000) .. salt .. "b" .. math.random(10,99) .."ring-fuckyoudaniels")
  12. local hash2 = md5( math.random(1,1000000).. math.random(1,1000000).. math.random(1,1000000).. math.random(1,1000000).. math.random(1,1000000).. "vG")
  13. local finalhash = hash .. hash2
  14. mysql:query_free("UPDATE `accounts` SET `loginhash`='".. finalhash .."' WHERE `username`='".. mysql:escape_string(username) .."'")
  15. return finalhash
  16. end
  17.  
  18. function loginPlayer(username, password, operatingsystem, hashPlease)
  19. local autologin = false
  20. local loginErrorCode = 1
  21. if (string.len(password)~=64) then
  22. password = md5(salt .. password)
  23. else
  24. autologin = true
  25. loginErrorCode = 6
  26. end
  27.  
  28.  
  29. local safeusername = mysql:escape_string(username)
  30. local safepassword = mysql:escape_string(password)
  31.  
  32. local query
  33. if (autologin) then
  34. query = "SELECT * FROM `accounts` WHERE `username`='" .. safeusername .. "' AND `loginhash`='" .. safepassword .. "'"
  35. else
  36. query = "SELECT * FROM `accounts` WHERE `username`='" .. safeusername .. "' AND `password`='" .. safepassword .. "'"
  37. end
  38.  
  39. local result = mysql:query(query)
  40. source = client
  41. if (mysql:num_rows(result)>0) then
  42. local data = mysql:fetch_assoc(result)
  43. triggerEvent("onPlayerLogin", source, username, password)
  44. for key, value in ipairs(getElementsByType("player")) do
  45. if ( getElementData(value, "loggedin") == 1 and value ~= source and hasBeta[value] ) then
  46. triggerClientEvent(value, "onPlayerAccountLogin", source, username)
  47. end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement