<?php
require('Auth_Vk.php');
$obj = new Auth_Vk();
if (empty($_GET['code'])) {
$query = "client_id=" . APP_ID . "&scope=offline&redirect_uri=" . REDIRECT_URI . "&response+type=code";
Auth_Vk::redirect(URL_AUTH."?".$query);
}
if (!empty($_GET['code'])) {
//echo $_GET['code'];
$obj->set_code($_GET['code']);
$result = $obj->get_token();
if ($result) {
$obj->get_user();
} else {
exit($_SESSION['error']);
}
}
if (!empty($_GET['error'])) {
exit($_GET['error_description']);
}