added DEBUG_MODE in config

This commit is contained in:
printempw 2016-03-12 18:47:42 +08:00
parent 752757e1fe
commit 30ac85295c
4 changed files with 8 additions and 5 deletions

View File

@ -17,6 +17,9 @@ define('DB_HOST', 'localhost');
/* 盐,用于 token 加密,修改为任意随机字符串 */
define('SALT', '9tvsh55d*s');
/* 调试模式,开启后将会显示所有用于错误提示 */
define('DEBUG_MODE', false);
/* 同一 IP 最大可注册账户数 */
define('REGS_PER_IP', 2);

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-02-02 21:59:06
* @Last Modified by: printempw
* @Last Modified time: 2016-03-12 18:15:55
* @Last Modified time: 2016-03-12 18:42:21
*/
class Database
@ -15,7 +15,7 @@ class Database
}
public static function checkConfig() {
error_reporting(0);
if (!DEBUG_MODE) error_reporting(0);
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, DB_PORT);
if ($conn->connect_error) {
Utils::showErrorPage(-1, "Can not connect to mysql, check if database info correct in config.php. ".

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-01-16 23:01:33
* @Last Modified by: printempw
* @Last Modified time: 2016-03-12 18:33:34
* @Last Modified time: 2016-03-12 18:46:22
*/
class User
@ -107,7 +107,6 @@ class User
if ($this->getTexture($type) != "") {
$filename = "./textures/".$this->getTexture($type);
if (file_exists($filename)) {
header('Content-Type: image/png');
// Cache friendly
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $this->getLastModified()).' GMT');
header('Content-Length: '.filesize($filename));

View File

@ -3,7 +3,7 @@
* @Author: prpr
* @Date: 2016-02-02 21:17:59
* @Last Modified by: printempw
* @Last Modified time: 2016-03-12 18:04:46
* @Last Modified time: 2016-03-12 18:44:26
*/
function __autoload($classname) {
@ -14,3 +14,4 @@ function __autoload($classname) {
if (!file_exists($dir.'/config.php'))
Utils::showErrorPage(-1, '未找到 `config.php`,请确认配置文件是否存在。');
require "$dir/config.php";
if (!DEBUG_MODE) error_reporting(0);