$login = trim($_POST['login']);
$login = preg_replace("/[^a-z0-9_-]/i", "", $login);
if(strlen($login) < 3){ echo "Короткий логин!"; }
$l_check = mysql_fetch_array(mysql_query("SELECT login FROM users WHERE id = '$uid' "));
$check = mysql_num_rows(mysql_query("SELECT login FROM users WHERE login = '$login' "));
if($check !== 0 AND $login !== $l_check['login']){ echo "Логин уже зарегистрирован!!!"; exit;}
mysql_query("UPDATE users SET login = '$login', first_name = '$first_name', last_name = '$last_name', city = '$city', about = '$about', status = '$status', leng = '$leng', b_day = '$b_day', b_month = '$b_month', b_year = '$b_year', sex = '$sex' WHERE id = '$id'");
echo "Настройки сохранены!";
}