config.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /*
  3. This FTP addon works with EHCP (www.ehcp.net)
  4. It allows OGP - the open game panel - to manage custom FTP user accounts
  5. You must update these credentials before FTP integrating with EHCP will work!
  6. by own3mall
  7. */
  8. // Database credentials
  9. $server = 'localhost';
  10. $login = 'ehcp';
  11. $dbpass = 'changeme';
  12. $dbName = 'ehcp';
  13. // Log File
  14. $logFile = 'ehcp_ftp_log.txt';
  15. function addToLog($errors) {
  16. global $logFile;
  17. if (!file_exists($logFile)) {
  18. $createLog = fopen($logFile, 'a+');
  19. if (!$createLog) {
  20. trigger_error("Unable to create EHCP FTP Integration log file! Please create a file named \"ehcp_ftp_log.txt\" in the ogp_agent install directory under the EHCP folder with permissions of 777", E_USER_NOTICE);
  21. }
  22. fclose($createLog);
  23. }
  24. if (!is_writable($logFile)) {
  25. $chPerm = chmod($logFile, 777);
  26. if (!$chPerm) {
  27. trigger_error("The $logFile file is not writable. CHMOD failed. Please manually set the chmod to 777!", E_USER_NOTICE);
  28. }
  29. }
  30. $logContents = file_get_contents($logFile);
  31. foreach ($errors as $err) {
  32. $logContents.= $err . "\n";
  33. trigger_error($err, E_USER_NOTICE);
  34. echo $err . "\n";
  35. }
  36. $updateLog = file_put_contents($logFile, $logContents);
  37. if (!$updateLog) {
  38. trigger_error("Unable to write errors to the log file of $logFile", E_USER_NOTICE);
  39. }
  40. }
  41. // Create the database connection
  42. $connection = mysql_connect($server, $login, $dbpass);
  43. if ($connection) {
  44. mysql_select_db($dbName, $connection);
  45. } else {
  46. $errToLog[] = 'Unable to connect to the EHCP MySQL database using provided credentials! Please update your config.php settings!';
  47. addToLog($errToLog);
  48. die('Unable to connect to the EHCP MySQL database using provided credentials! Please update your config.php settings!');
  49. }
  50. ?>