Advertisement
skokon

Skokon

Jul 13th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. function dbConnect()
  2. {
  3. global $dbName;
  4. global $secretKey;
  5.  
  6. $link = mysql_connect('..', '..', '..');
  7.  
  8. if(!$link)
  9. {
  10. fail("Couldn´t connect to database server");
  11. }
  12.  
  13. if(!@mysql_select_db($dbName))
  14. {
  15. fail("Couldn´t find database $dbName");
  16. }
  17.  
  18. return $link;
  19. }
  20.  
  21. function safe($variable)
  22. {
  23. $variable = addslashes(trim($variable));
  24. return $variable;
  25. }
  26.  
  27. function fail($errorMsg)
  28. {
  29. print $errorMsg;
  30. exit;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement