diff --git a/ag/include/mumble.inc.php b/ag/include/mumble.inc.php index b1adaa2..6997f93 100644 --- a/ag/include/mumble.inc.php +++ b/ag/include/mumble.inc.php @@ -8,6 +8,7 @@ function insertUser($user_name, $password){ + /* $sql = 'SELECT * FROM user WHERE nickname like \''.$user_name.'\''; $user = mysqli_fetch_assoc(db_query($sql)); @@ -15,6 +16,7 @@ function insertUser($user_name, $password){ $sql = 'Insert into '.$GLOBALS['mumble_db_name'].'.players(server_id, player_id, name, pw) values(1, '.$user['id'].', \''.$user['nickname'].'\', sha(\''.$password.'\'))'; // Should do the trick! db_query($sql); + */ } ?> \ No newline at end of file diff --git a/ag/include/user.inc.php b/ag/include/user.inc.php index 69c3155..7c46bb5 100644 --- a/ag/include/user.inc.php +++ b/ag/include/user.inc.php @@ -130,15 +130,9 @@ function encryptPassword($password){ function getUserMetaData($userid) { $sql = 'SELECT * FROM user_meta_data WHERE user_id = ' . $userid; - $qry = silent_query($sql); + $qry = db_query($sql); $result = array(); - if(!$qry) - { - echo $sql .'
'; - return $result; - } - while ($row = mysqli_fetch_assoc($qry)) { $result[$row['key']] = $row['value']; } @@ -153,9 +147,14 @@ function setUserMetaDataEntry($userid, $key, $value) { if(db_affected_rows() > 0) return; + - $sql = 'INSERT INTO user_meta_data(user_id, `key`, `value`) values (\''.$userid.'\',\''.$key.'\',\''.$value.'\')'; - $qry = db_query($sql); + $sql = 'SELECT `value` FROM user_meta_data WHERE user_id = \''.$userid.'\' and `key` = \''.$key.'\''; + if ( mysqli_num_rows(db_query($sql)) == 0) + { + $sql = 'INSERT INTO user_meta_data(user_id, `key`, `value`) values (\''.$userid.'\',\''.$key.'\',\''.$value.'\')'; + $qry = db_query($sql); + } }