-
Notifications
You must be signed in to change notification settings - Fork 0
/
discord.php
44 lines (33 loc) · 1.26 KB
/
discord.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
36
37
38
39
40
41
42
43
<?php
/**
* Created by PhpStorm.
* User: Admin
* Date: 04.07.2016
* Time: 16:19
*/
session_start();
include_once __DIR__ ."./php/discord/discordAuth.php";
include_once __DIR__ ."./php/discord/discordBotAuth.php";
include_once __DIR__ ."./php/sql.php";
$access_token = getTokensFromCode($_GET ["code"],"authorization_code")->access_token;
$user = curl_get("https://discordapp.com/api/users/@me",$access_token);
$user->username = addslashes($user->username);
$sql = "UPDATE auth SET DiscordID='{$user->id}',discriminator='{$user->discriminator}',username='{$user->username}' WHERE token='{$_SESSION["token"]}'";
sql_write($sql);
$join = joinServer($GLOBALS["DISCORD_INVITE"],$access_token);
print_r($join);
print_r($access_token);
print_r($_SESSION);
setNickname($_SESSION["eve"]["char"]["characterName"],$user->id);
$sql = "SELECT * FROM `groupRoles` WHERE {$_SESSION["eve"]["char"]["characterID"]} = groupID or {$_SESSION["eve"]["char"]["corporationID"]} = groupID or {$_SESSION["eve"]["char"]["allianceID"]} = groupID";
$res = sql_read($sql);
var_dump($res);
$roles = [];
foreach ($res as $role)
{
$roles[] = $role["roleID"];
}
var_dump($roles);
patchUser($roles,$user->id);
header("Location: https://discordapp.com/channels/{$join->guild->id}");
session_write_close();