mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-21 21:08:42 +00:00
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:
parent
4d2b0735dc
commit
ce61130caf
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user