1
0

database.inc.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. // -------------------------------------------------------------------------------
  3. // | net2ftp: a web based FTP client |
  4. // | Copyright (c) 2003-2013 by David Gartner |
  5. // | |
  6. // | This program is free software; you can redistribute it and/or |
  7. // | modify it under the terms of the GNU General Public License |
  8. // | as published by the Free Software Foundation; either version 2 |
  9. // | of the License, or (at your option) any later version. |
  10. // | |
  11. // -------------------------------------------------------------------------------
  12. // **************************************************************************************
  13. // **************************************************************************************
  14. // ** **
  15. // ** **
  16. function connect2db() {
  17. // --------------
  18. // This function logs user accesses to the site
  19. // --------------
  20. // -------------------------------------------------------------------------
  21. // Global variables
  22. // -------------------------------------------------------------------------
  23. global $net2ftp_settings;
  24. $mydb = mysql_connect($net2ftp_settings["dbserver"], $net2ftp_settings["dbusername"], $net2ftp_settings["dbpassword"]);
  25. if ($mydb == false) {
  26. setErrorVars(false, __("Unable to connect to the MySQL database. Please check your MySQL database settings in net2ftp's configuration file settings.inc.php."), debug_backtrace(), __FILE__, __LINE__);
  27. return false;
  28. }
  29. $result2 = mysql_select_db($net2ftp_settings["dbname"]);
  30. if ($result2 == false) {
  31. setErrorVars(false, __("Unable to select the MySQL database. Please check your MySQL database settings in net2ftp's configuration file settings.inc.php."), debug_backtrace(), __FILE__, __LINE__);
  32. return false;
  33. }
  34. return $mydb;
  35. } // End connect2db
  36. // ** **
  37. // ** **
  38. // **************************************************************************************
  39. // **************************************************************************************
  40. ?>