more minor fixes

main
hecht 8 years ago
parent c0b77ca795
commit 955fdb46fb

@ -8,6 +8,7 @@
function insertUser($user_name, $password){ function insertUser($user_name, $password){
/*
$sql = 'SELECT * FROM user WHERE nickname like \''.$user_name.'\''; $sql = 'SELECT * FROM user WHERE nickname like \''.$user_name.'\'';
$user = mysqli_fetch_assoc(db_query($sql)); $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.'\'))'; $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! // Should do the trick!
db_query($sql); db_query($sql);
*/
} }
?> ?>

@ -130,15 +130,9 @@ function encryptPassword($password){
function getUserMetaData($userid) { function getUserMetaData($userid) {
$sql = 'SELECT * FROM user_meta_data WHERE user_id = ' . $userid; $sql = 'SELECT * FROM user_meta_data WHERE user_id = ' . $userid;
$qry = silent_query($sql); $qry = db_query($sql);
$result = array(); $result = array();
if(!$qry)
{
echo $sql .'<br>';
return $result;
}
while ($row = mysqli_fetch_assoc($qry)) { while ($row = mysqli_fetch_assoc($qry)) {
$result[$row['key']] = $row['value']; $result[$row['key']] = $row['value'];
} }
@ -153,9 +147,14 @@ function setUserMetaDataEntry($userid, $key, $value) {
if(db_affected_rows() > 0) if(db_affected_rows() > 0)
return; return;
$sql = 'INSERT INTO user_meta_data(user_id, `key`, `value`) values (\''.$userid.'\',\''.$key.'\',\''.$value.'\')'; $sql = 'SELECT `value` FROM user_meta_data WHERE user_id = \''.$userid.'\' and `key` = \''.$key.'\'';
$qry = db_query($sql); 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);
}
} }

Loading…
Cancel
Save