mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-27 06:29:19 +08:00
use defined DIR to prevent relative path problem
This commit is contained in:
parent
297c634b53
commit
acd28577ae
15
config.php
15
config.php
@ -1,18 +1,21 @@
|
||||
<?php
|
||||
/* Blessing Skin Server 数据库的名称 */
|
||||
/* Blessing Skin Server Database Name */
|
||||
define('DB_NAME', 'skin');
|
||||
|
||||
/* MySQL 数据库用户名 */
|
||||
/* MySQL Username */
|
||||
define('DB_USER', 'root');
|
||||
|
||||
/* MySQL 数据库密码 */
|
||||
/* MySQL Password */
|
||||
define('DB_PASSWD', 'root');
|
||||
|
||||
/* MySQL 主机 */
|
||||
/* MySQL Host */
|
||||
define('DB_HOST', 'localhost');
|
||||
|
||||
/* 盐,用于 token 验证,自行修改 */
|
||||
/* Salt for encrypting token, Change it to any random string */
|
||||
define('SALT', '9tvsh55d*s');
|
||||
|
||||
/* 同一 IP 可注册的账户数 */
|
||||
/* Max amount of accounts per IP */
|
||||
define('REGS_PER_IP', 2);
|
||||
|
||||
/* Do not change this */
|
||||
define('DIR', dirname(__FILE__));
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-01-16 23:01:33
|
||||
* @Last Modified by: prpr
|
||||
* @Last Modified time: 2016-02-03 15:52:39
|
||||
* @Last Modified time: 2016-02-04 16:20:19
|
||||
*/
|
||||
|
||||
class utils
|
||||
@ -29,9 +29,9 @@ class utils
|
||||
* @return string $hash, sha256 hash of file
|
||||
*/
|
||||
public static function upload($file) {
|
||||
move_uploaded_file($file["tmp_name"], "./textures/tmp.png");
|
||||
$hash = hash_file('sha256', "./textures/tmp.png");
|
||||
rename("./textures/tmp.png", "./textures/".$hash);
|
||||
move_uploaded_file($file["tmp_name"], DIR."/textures/tmp.png");
|
||||
$hash = hash_file('sha256', DIR."/textures/tmp.png");
|
||||
rename(DIR."/textures/tmp.png", DIR."/textures/".$hash);
|
||||
return $hash;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user