aboutsummaryrefslogtreecommitdiffstats
path: root/include/dba.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-03-13 16:47:41 -0700
committerFriendika <info@friendika.com>2011-03-13 16:47:41 -0700
commit0cf647bf6f199586bad2e13973fe034bf5676eea (patch)
treef350c0427feb26350e81ab3b6039546e7b0c37e1 /include/dba.php
parenta912a0d3cae0ae9c873dcb5c45624a725bd2c2d6 (diff)
downloadvolse-hubzilla-0cf647bf6f199586bad2e13973fe034bf5676eea.tar.gz
volse-hubzilla-0cf647bf6f199586bad2e13973fe034bf5676eea.tar.bz2
volse-hubzilla-0cf647bf6f199586bad2e13973fe034bf5676eea.zip
don't let somebody install with a bogus db hostname as this seems to lead to spectacular failure modes
Diffstat (limited to 'include/dba.php')
-rw-r--r--include/dba.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/dba.php b/include/dba.php
index d75ed560a..1fdddb8a2 100644
--- a/include/dba.php
+++ b/include/dba.php
@@ -19,6 +19,22 @@ class dba {
public $connected = false;
function __construct($server,$user,$pass,$db,$install = false) {
+ $server = trim($server);
+ $user = trim($user);
+ $pass = trim($pass);
+ $db = trim($db);
+
+ if($install) {
+ if(strlen($server) && ($server !== 'localhost') && ($server !== '127.0.0.1')) {
+ if(! dns_get_record($server, DNS_A + DNS_CNAME + DNS_PTR)) {
+ notice( sprintf( t('Cannot locate DNS info for database server \'%s\'',$server)));
+ $this->connected = false;
+ $this->db = null;
+ return;
+ }
+ }
+ }
+
$this->db = @new mysqli($server,$user,$pass,$db);
if(! mysqli_connect_errno()) {
$this->connected = true;