-
Notifications
You must be signed in to change notification settings - Fork 1
/
callback.php
35 lines (32 loc) · 1.09 KB
/
callback.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
session_start();
function redirect() {
if (isset($_GET['state'])) {
header("Location: " . $_GET['state']);
die();
} else {
header("Location: http://localhost:8080/SteemApps");
die();
}
}
//vote%2Ccomment%2Ccomment_delete%2Ccomment_options%2Ccustom_json%2Cclaim_reward_balance%2Coffline
//https://v2.steemconnect.com/oauth2/authorize?client_id=cadawg.app&redirect_uri=http://localhost:8080/SteemApps/callback.php&scope=vote%2Ccomment%2Ccomment_delete%2Ccomment_options%2Ccustom_json%2Cclaim_reward_balance%2Coffline
if (isset($_GET['access_token']) and isset($_GET['expires_in'])) {
$_SESSION['code'] = $_GET['access_token'];
if ((integer) $_GET['expires_in'] == 604800) {
$_SESSION['expires'] = time() + 604800;
} else {
session_unset();
session_regenerate_id(true);
redirect();
}
$usr_name = require 'getLogin.php';
if ($usr_name != false) {
$_SESSION['user'] = $usr_name;
redirect();
} else {
session_unset();
session_regenerate_id(true);
redirect();
}
}