<?
require_once('config.php');
if(empty($_SESSION['token'])){
echo " <a href='https://oauth.vk.com/authorize?client_id=".$appid." &display=page&redirect_uri=".$redirect_url."&scope=".$scope."&response_type=code&v=5.62
' >Вход по вк </a> " ;
}
else{
echo"
Авторизовались
<br>
Токен : ".$_SESSION['token']." <br>
Айди : ".$_SESSION['user_id']." <br>
Емейл : ".$_SESSION['email']." <br>
<a href = 'logout.php'> Выход</a>";
}
?>
<?php
require_once("config.php");
if(empty($_GET['code'])){header("location:/");}
else {
@$token =
file_get_contents("https://oauth.vk.com/access_token?client_id=".$appid."&client_secret=".$appkey."&redirect_uri=".$redirect_url."&code=".$_GET['code']);
$token = json_decode($token,true);
$_SESSION['token']= $token['access_token'];
$token['access_token'];
$_SESSION['user_id'] = $token['user_id'];
$_SESSION['email'] = $token['email'];
header('location: /');
}
?>
<?
session_start();
unset($_SESSION['token']);
unset($_SESSION['user_id']);
unset($_SESSION['email']);
header('location:/');
?>
<?
$appid ="7275642";
$appkey ="...";
$redirect_url="http://ezfast/loo.php";
$scope ="friends,photos,groups,email,offline,audio,stats,offline";
session_start();
?>