]> git.mxchange.org Git - friendica.git/commitdiff
don't let somebody install with a bogus db hostname as this seems to lead to spectacu...
authorFriendika <info@friendika.com>
Sun, 13 Mar 2011 23:47:41 +0000 (16:47 -0700)
committerFriendika <info@friendika.com>
Sun, 13 Mar 2011 23:47:41 +0000 (16:47 -0700)
boot.php
include/dba.php

index bbaa8324d6743af3334cfaefb73c59df1c11273b..806ad53774c9628c7f14192db1dbcc087ca049c5 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -2,7 +2,7 @@
 
 set_time_limit(0);
 
-define ( 'FRIENDIKA_VERSION',      '2.1.915' );
+define ( 'FRIENDIKA_VERSION',      '2.1.917' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.1'  );
 define ( 'DB_UPDATE_VERSION',      1040   );
 
index d75ed560ab7eb30f7f1d98fc44fa6a073b403205..1fdddb8a2ce37c41c384add95d11e84bc60dda14 100644 (file)
@@ -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;