<script language="javascript">
VK.init({
apiId: ******
});
function authInfo(response) {
if (!response.session) {
alert('not auth');
} else {
alert(response.session.mid)
}
}
VK.Auth.getLoginStatus(authInfo);
VK.UI.button('login_button');
</script>
$.post('/index.php',{session_mid:response.session.mid});
$session_mid = $_POST['session_mid'];