Advertisement
Guest User

Untitled

a guest
May 2nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. function onResourceStartMysqlConnection()
  2. local xml = xmlLoadFile("./xml/config.xml")
  3. if not xml then
  4. outputServerLog("Konnte config.xml nicht finden. Laden abgebrochen!")
  5. cancelEvent()
  6. stopResource(getThisResource())
  7. return false
  8. end
  9.  
  10. --MySQL Daten
  11. local mysqlchild = xmlFindChild(xml, "mysqldata", 0)
  12. if not mysqlchild then
  13. outputServerLog("Keine MySQL Verbindungsdaten gefunden.")
  14. end
  15.  
  16. local mysqlhost = xmlGetVal(mysqlchild, "ms1574.nitrado.net")
  17. if mysqlhost then mysql_host = mysqlhost end
  18.  
  19. local mysqluser = xmlGetVal(mysqlchild, "ni105757_1_DB")
  20. if mysqluser then mysql_user = mysqluser end
  21.  
  22. local mysqlpsw = xmlGetVal(mysqlchild, "8e70D9gh")
  23. if mysqlpsw then mysql_password = mysqlpsw end
  24.  
  25. local mysqltable = xmlGetVal(mysqlchild, "ni105757_1_DB")
  26. if mysqltable then mysql_table = mysqltable end
  27.  
  28. g_mysql["connection"] = mysql_connect(mysql_host, mysql_user, mysql_password, mysql_table, 3306, nil, "")
  29.  
  30. if not g_mysql["connection"] then
  31. outputServerLog("Kann die MySQL-Verbindung nicht aufbauen!")
  32. print("Kann die MySQL-Verbindung nicht aufbauen!")
  33. stopResource(getThisResource())
  34. eventcancled = 1
  35. cancelEvent()
  36. return false
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement