Erro em PHP e MySQL
Pessoal, boa noite.
Sou novo por aqui e gostaria de um help de voces.
Estou tentando montar um sistema para salao e consegui um fonte de um para testes, porem ao chamar a aplicação estao me gerando os erros abaixo. Poderiam me dar um norte para solução?
Desde ja obrigado
Gustavo
Warning: mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Este host n�o � conhecido. in C:\\Apache24\\htdocs\\sistema_salao\\sistema\\application\\config\\config.php on line 12
Warning: mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Este host n�o � conhecido. in C:\\Apache24\\htdocs\\sistema_salao\\sistema\\application\\config\\config.php on line 12
Warning: mysqli::set_charset(): Couldn't fetch mysqli in C:\\Apache24\\htdocs\\sistema_salao\\sistema\\application\\config\\config.php on line 13
Warning: mysqli_query(): Couldn't fetch mysqli in C:\\Apache24\\htdocs\\sistema_salao\\sistema\\application\\config\\config.php on line 19
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\\Apache24\\htdocs\\sistema_salao\\sistema\\application\\config\\config.php on line 20
Codigo referente aos erros exibidos acima:
<?php
define('DB_TYPE', 'mysql');
define('DB_HOST', 'localhost');
define('DB_NAME', 'salao');
define('DB_USER', 'root');
define('DB_PASS', '');
define('DB_PREFIX', NULL);
// get data for dynamic settings
function array_table($table, $where, $fetch) {
$mysqli = new mysqli("DB_HOST", "DB_NAME", "DB_USER", "DB_PASS");
$mysqli->set_charset('utf8');
if ($where !== false) {
$query = "SELECT $fetch FROM `$table` WHERE $where[0] = '$where[1]' LIMIT 1";
} else {
$query = "SELECT $fetch FROM `$table` LIMIT 1";
}
$q = mysqli_query($mysqli, $query);
while ($data = mysqli_fetch_array($q)) {
return $data[$fetch];
}
}
$_SYSTEM_DEBUG = array_table('Configure', false, 'DEBUG') == 0 ? false : true;
# -----------------------------------------
# Set Locale for date function
# -----------------------------------------
setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');
# -----------------------------------------
# Bug fix erros de caracteres na header
# -----------------------------------------
ini_set('default_charset', 'UTF-8');
# -----------------------------------------
# Timezone
# -----------------------------------------
date_default_timezone_set('America/Sao_Paulo');
# -----------------------------------------
# Configuration for: Error reporting
# Useful to show every little problem during development, but only show hard errors in production
# -----------------------------------------
error_reporting(E_ALL);
ini_set("display_errors", 1);
/**
* Configuration for: Base URL
* This is the base url of our app. if you go live with your app, put your full domain name here.
* if you are using a (different) port, then put this in here, like http://mydomain:8888/subfolder/
* Note: The trailing slash is important!
*/
define('URL', array_table('Configure', false, 'url'));
# -----------------------------------------
# account type that is not accessible to other users when you add a sales service.
# is used to checked the combobox in Mov/service
# -----------------------------------------
define('ACCOUNT_TYPE_FOR_SALLER', array_table('Configure', false, 'ACCOUNT_TYPE_FOR_SALLER'));
# -----------------------------------------
# status comission close day
# value boolean
# -----------------------------------------
define('STATUS_DAY_CLOSE', array_table('Configure', false, 'STATUS_DAY_CLOSE'));
# -----------------------------------------
# day that will close the monthly commission.
# used to organize committees
# -----------------------------------------
define('DAY_CLOSE_COMISSION', array_table('Configure', FALSE, 'DAY_CLOSE_COMISSION'));
/**
* demonstration mode, if true no one can change and add users also can not change
* user profile, settings menu, global, access and receipts.
*/
define('DEMOSTRATION', FALSE);
/**
* Versão mínima do PHP para rodar a aplicação
* veja a lista dos recursos adicionados, editado e alterados do PHP http://pt.wikipedia.org/wiki/PHP
*
*/
define('MIN_PHP_VERSION', '5.4.3');
/**
* Configuration for: Folders
* Here you define where your folders are. Unless you have renamed them, there's no need to change this.
*/
define('LIBS_PATH', 'application/libs/');
define('LIBS_DEV_PATH', 'application/libs/Developer/');
define('LIBS_DEV_PATH_DASHBOARD', 'application/libs/Dashboard/');
define('CONTROLLER_PATH', 'application/controllers/');
define('MODELS_PATH', 'application/models/');
define('VIEWS_PATH', 'application/views/');
define('DS', DIRECTORY_SEPARATOR);
// don't forget to make this folder writable via chmod 775 or 777 (?)
// the slash at the end is VERY important!
define('AVATAR_PATH', 'public/avatars/');
/**
* Configuration for: Additional login providers: Facebook
* Self-explaining. The FACEBOOK_LOGIN_PATH is the controller-action where the user is redirected to after getting
* authenticated via Facebook. Leave it like that unless you know exactly what you do.
*/
define('FACEBOOK_LOGIN', false);
define('FACEBOOK_LOGIN_APP_ID', '');
define('FACEBOOK_LOGIN_APP_SECRET', '');
define('FACEBOOK_LOGIN_PATH', 'login/loginWithFacebook');
define('FACEBOOK_REGISTER_PATH', 'login/registerWithFacebook');
/**
* Configuration for: Avatars/Gravatar support
* Set to true if you want to use "Gravatar(s)", a service that automatically gets avatar pictures via using email
* addresses of users by requesting images from the gravatar.com API. Set to false to use own locally saved avatars.
* AVATAR_SIZE set the pixel size of avatars/gravatars (will be 44x44 by default). Avatars are always squares.
* AVATAR_DEFAULT_IMAGE is the default image in public/avatars/
*/
define('USE_GRAVATAR', true);
define('AVATAR_SIZE', 44);
define('AVATAR_JPEG_QUALITY', 85);
define('AVATAR_DEFAULT_IMAGE', 'default.jpg');
/**
* Configuration for: Cookies
* Please note: The COOKIE_DOMAIN needs the domain where your app is,
* in a format like this: .mydomain.com
* Note the . in front of the domain. No www, no http, no slash here!
* For local development .127.0.0.1 is fine, but when deploying you should
* change this to your real domain, like '.mydomain.com' ! The leading dot makes the cookie available for
* sub-domains too.
* @see http://stackoverflow.com/q/9618217/1114320
* @see php.net/manual/en/function.setcookie.php
*/
// 1209600 seconds = 2 weeks
define('COOKIE_RUNTIME', array_table('Configure', false, 'COOKIE_RUNTIME'));
// the domain where the cookie is valid for, for local development ".127.0.0.1" and ".localhost" will work
// IMPORTANT: always put a dot in front of the domain, like ".mydomain.com" !
define('COOKIE_DOMAIN', array_table('Configure', false, 'COOKIE_DOMAIN'));
/**
* Interface used for tool live brandswich
*/
define('INTERFACE_NETWORK', array_table('Configure', false, 'INTERFACE'));
/**
* Configuration for: Hashing strength
* This is the place where you define the strength of your password hashing/salting
*
* To make password encryption very safe and future-proof, the PHP 5.5 hashing/salting functions
* come with a clever so called COST FACTOR. This number defines the base-2 logarithm of the rounds of hashing,
* something like 2^12 if your cost factor is 12. By the way, 2^12 would be 4096 rounds of hashing, doubling the
* round with each increase of the cost factor and therefore doubling the CPU power it needs.
* Currently, in 2013, the developers of this functions have chosen a cost factor of 10, which fits most standard
* server setups. When time goes by and server power becomes much more powerful, it might be useful to increase
* the cost factor, to make the password hashing one step more secure. Have a look here
* (@see https://github.com/panique/php-login/wiki/Which-hashing-&-salting-algorithm-should-be-used-%3F)
* in the BLOWFISH benchmark t
Sou novo por aqui e gostaria de um help de voces.
Estou tentando montar um sistema para salao e consegui um fonte de um para testes, porem ao chamar a aplicação estao me gerando os erros abaixo. Poderiam me dar um norte para solução?
Desde ja obrigado
Gustavo
Warning: mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Este host n�o � conhecido. in C:\\Apache24\\htdocs\\sistema_salao\\sistema\\application\\config\\config.php on line 12
Warning: mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Este host n�o � conhecido. in C:\\Apache24\\htdocs\\sistema_salao\\sistema\\application\\config\\config.php on line 12
Warning: mysqli::set_charset(): Couldn't fetch mysqli in C:\\Apache24\\htdocs\\sistema_salao\\sistema\\application\\config\\config.php on line 13
Warning: mysqli_query(): Couldn't fetch mysqli in C:\\Apache24\\htdocs\\sistema_salao\\sistema\\application\\config\\config.php on line 19
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\\Apache24\\htdocs\\sistema_salao\\sistema\\application\\config\\config.php on line 20
Codigo referente aos erros exibidos acima:
<?php
define('DB_TYPE', 'mysql');
define('DB_HOST', 'localhost');
define('DB_NAME', 'salao');
define('DB_USER', 'root');
define('DB_PASS', '');
define('DB_PREFIX', NULL);
// get data for dynamic settings
function array_table($table, $where, $fetch) {
$mysqli = new mysqli("DB_HOST", "DB_NAME", "DB_USER", "DB_PASS");
$mysqli->set_charset('utf8');
if ($where !== false) {
$query = "SELECT $fetch FROM `$table` WHERE $where[0] = '$where[1]' LIMIT 1";
} else {
$query = "SELECT $fetch FROM `$table` LIMIT 1";
}
$q = mysqli_query($mysqli, $query);
while ($data = mysqli_fetch_array($q)) {
return $data[$fetch];
}
}
$_SYSTEM_DEBUG = array_table('Configure', false, 'DEBUG') == 0 ? false : true;
# -----------------------------------------
# Set Locale for date function
# -----------------------------------------
setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');
# -----------------------------------------
# Bug fix erros de caracteres na header
# -----------------------------------------
ini_set('default_charset', 'UTF-8');
# -----------------------------------------
# Timezone
# -----------------------------------------
date_default_timezone_set('America/Sao_Paulo');
# -----------------------------------------
# Configuration for: Error reporting
# Useful to show every little problem during development, but only show hard errors in production
# -----------------------------------------
error_reporting(E_ALL);
ini_set("display_errors", 1);
/**
* Configuration for: Base URL
* This is the base url of our app. if you go live with your app, put your full domain name here.
* if you are using a (different) port, then put this in here, like http://mydomain:8888/subfolder/
* Note: The trailing slash is important!
*/
define('URL', array_table('Configure', false, 'url'));
# -----------------------------------------
# account type that is not accessible to other users when you add a sales service.
# is used to checked the combobox in Mov/service
# -----------------------------------------
define('ACCOUNT_TYPE_FOR_SALLER', array_table('Configure', false, 'ACCOUNT_TYPE_FOR_SALLER'));
# -----------------------------------------
# status comission close day
# value boolean
# -----------------------------------------
define('STATUS_DAY_CLOSE', array_table('Configure', false, 'STATUS_DAY_CLOSE'));
# -----------------------------------------
# day that will close the monthly commission.
# used to organize committees
# -----------------------------------------
define('DAY_CLOSE_COMISSION', array_table('Configure', FALSE, 'DAY_CLOSE_COMISSION'));
/**
* demonstration mode, if true no one can change and add users also can not change
* user profile, settings menu, global, access and receipts.
*/
define('DEMOSTRATION', FALSE);
/**
* Versão mínima do PHP para rodar a aplicação
* veja a lista dos recursos adicionados, editado e alterados do PHP http://pt.wikipedia.org/wiki/PHP
*
*/
define('MIN_PHP_VERSION', '5.4.3');
/**
* Configuration for: Folders
* Here you define where your folders are. Unless you have renamed them, there's no need to change this.
*/
define('LIBS_PATH', 'application/libs/');
define('LIBS_DEV_PATH', 'application/libs/Developer/');
define('LIBS_DEV_PATH_DASHBOARD', 'application/libs/Dashboard/');
define('CONTROLLER_PATH', 'application/controllers/');
define('MODELS_PATH', 'application/models/');
define('VIEWS_PATH', 'application/views/');
define('DS', DIRECTORY_SEPARATOR);
// don't forget to make this folder writable via chmod 775 or 777 (?)
// the slash at the end is VERY important!
define('AVATAR_PATH', 'public/avatars/');
/**
* Configuration for: Additional login providers: Facebook
* Self-explaining. The FACEBOOK_LOGIN_PATH is the controller-action where the user is redirected to after getting
* authenticated via Facebook. Leave it like that unless you know exactly what you do.
*/
define('FACEBOOK_LOGIN', false);
define('FACEBOOK_LOGIN_APP_ID', '');
define('FACEBOOK_LOGIN_APP_SECRET', '');
define('FACEBOOK_LOGIN_PATH', 'login/loginWithFacebook');
define('FACEBOOK_REGISTER_PATH', 'login/registerWithFacebook');
/**
* Configuration for: Avatars/Gravatar support
* Set to true if you want to use "Gravatar(s)", a service that automatically gets avatar pictures via using email
* addresses of users by requesting images from the gravatar.com API. Set to false to use own locally saved avatars.
* AVATAR_SIZE set the pixel size of avatars/gravatars (will be 44x44 by default). Avatars are always squares.
* AVATAR_DEFAULT_IMAGE is the default image in public/avatars/
*/
define('USE_GRAVATAR', true);
define('AVATAR_SIZE', 44);
define('AVATAR_JPEG_QUALITY', 85);
define('AVATAR_DEFAULT_IMAGE', 'default.jpg');
/**
* Configuration for: Cookies
* Please note: The COOKIE_DOMAIN needs the domain where your app is,
* in a format like this: .mydomain.com
* Note the . in front of the domain. No www, no http, no slash here!
* For local development .127.0.0.1 is fine, but when deploying you should
* change this to your real domain, like '.mydomain.com' ! The leading dot makes the cookie available for
* sub-domains too.
* @see http://stackoverflow.com/q/9618217/1114320
* @see php.net/manual/en/function.setcookie.php
*/
// 1209600 seconds = 2 weeks
define('COOKIE_RUNTIME', array_table('Configure', false, 'COOKIE_RUNTIME'));
// the domain where the cookie is valid for, for local development ".127.0.0.1" and ".localhost" will work
// IMPORTANT: always put a dot in front of the domain, like ".mydomain.com" !
define('COOKIE_DOMAIN', array_table('Configure', false, 'COOKIE_DOMAIN'));
/**
* Interface used for tool live brandswich
*/
define('INTERFACE_NETWORK', array_table('Configure', false, 'INTERFACE'));
/**
* Configuration for: Hashing strength
* This is the place where you define the strength of your password hashing/salting
*
* To make password encryption very safe and future-proof, the PHP 5.5 hashing/salting functions
* come with a clever so called COST FACTOR. This number defines the base-2 logarithm of the rounds of hashing,
* something like 2^12 if your cost factor is 12. By the way, 2^12 would be 4096 rounds of hashing, doubling the
* round with each increase of the cost factor and therefore doubling the CPU power it needs.
* Currently, in 2013, the developers of this functions have chosen a cost factor of 10, which fits most standard
* server setups. When time goes by and server power becomes much more powerful, it might be useful to increase
* the cost factor, to make the password hashing one step more secure. Have a look here
* (@see https://github.com/panique/php-login/wiki/Which-hashing-&-salting-algorithm-should-be-used-%3F)
* in the BLOWFISH benchmark t
Gustavo Henrique
Curtidas 0