Advertisement
Guest User

Untitled

a guest
Sep 7th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. $dbName = 'dbname';
  4. $host = 'host';
  5. $username = 'username';
  6. $password = 'password';
  7.  
  8. $secretGameKey = "censure";
  9. $secretServerKey = "censure";
  10.  
  11. function dbConnect()
  12. {
  13. global $dbName;
  14. global $host;
  15. global $username;
  16. global $password;
  17.  
  18. $link = mysql_connect($host, $username, $password);
  19.  
  20. if(!$link)
  21. {
  22. fail("Couldn�t connect to database server");
  23. }
  24.  
  25. if(!@mysql_select_db($dbName))
  26. {
  27. fail("Couldn�t find database $dbName");
  28. }
  29.  
  30. return $link;
  31. }
  32.  
  33. function safe($variable)
  34. {
  35. $variable = addslashes(trim($variable));
  36. return $variable;
  37. }
  38.  
  39. function fail($errorMsg)
  40. {
  41. print $errorMsg;
  42. exit;
  43. }
  44.  
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement