style(uoj/1/app/models): a little modify of db connection

Prevent too many information printed out, leak.
Modify it to make it looks simple and can output error correctly.
This commit is contained in:
Masco Skray 2018-09-20 19:49:26 +08:00
parent 4d2b0735dc
commit ce61130caf

View File

@ -3,14 +3,9 @@
class DB {
public static function init() {
global $uojMySQL;
$uojMySQL = new mysqli(UOJConfig::$data['database']['host'] . ':3306', UOJConfig::$data['database']['username'], UOJConfig::$data['database']['password'], UOJConfig::$data['database']['database']);
if($uojMySQL == null){
echo '-----------------------\n';
echo $uojMySQL->connect_errno;
echo '========================\n';
}
@$uojMySQL = mysqli_connect(UOJConfig::$data['database']['host'] . ':3306', UOJConfig::$data['database']['username'], UOJConfig::$data['database']['password'], UOJConfig::$data['database']['database']);
if (!$uojMySQL) {
echo 'There is something wrong with database >_<.... ' . mysqli_error($uojMySQL);
echo 'There is something wrong with database >_<.... ' . mysqli_connect_error();
die();
}
}