private static function connect() { if (self::$cnt == false) { if (!isset($GLOBALS['database_host'])) { self::$conn = new MongoClient('localhost'); } else { self::$conn = new MongoClient("mongodb://" . $GLOBALS['database_user'] . ":" . $GLOBALS['database_password'] . "@" . $GLOBALS['database_host']); } self::$cnt = true; } else { return false; } }