-
Notifications
You must be signed in to change notification settings - Fork 15
/
devlogin.php
32 lines (29 loc) · 958 Bytes
/
devlogin.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
<?php
session_start();
if (isset($_SESSION['auth_characterid'])) {
echo "Logged in. ".$_SESSION['auth_characterid'];
exit;
} else {
//Throw login redirect.
$authsite='https://login.eveonline.com';
$authurl='/oauth2/authorize';
$client_id='3rdparty_fuzzwork';
$redirect_uri="https%3A%2F%2Fwww.fuzzwork.co.uk%2Fauth%2Fdevauthcallback.php";
$state=uniqid();
$redirecturl=$_SERVER['HTTP_REFERER'];
if (!preg_match("#^https://www.fuzzwork.co.uk/(.*)$#", $redirecturl, $matches)) {
$redirecturl='/';
} else {
$redirecturl=$matches[1];
}
$redirect_to="https://www.fuzzwork.co.uk/".$redirecturl;
$_SESSION['auth_state']=$state;
$_SESSION['auth_redirect']=$redirect_to;
session_write_close();
header(
'Location:'.$authsite.$authurl
.'?response_type=code&redirect_uri='.$redirect_uri
.'&client_id='.$client_id.'&scope=&state='.$state
);
exit;
}