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'];
} }
@ -154,8 +148,13 @@ function setUserMetaDataEntry($userid, $key, $value) {
if(db_affected_rows() > 0) if(db_affected_rows() > 0)
return; return;
$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.'\')'; $sql = 'INSERT INTO user_meta_data(user_id, `key`, `value`) values (\''.$userid.'\',\''.$key.'\',\''.$value.'\')';
$qry = db_query($sql); $qry = db_query($sql);
}
} }

Loading…
Cancel
Save