-
Notifications
You must be signed in to change notification settings - Fork 3
/
user_info.php
44 lines (41 loc) · 938 Bytes
/
user_info.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
44
<?php
include 'config.php';
session_start();
function getUser($access_token){
global $config;
$url = $config['sso_service'].'user';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization:Bearer {$access_token}"]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response);
}
if(isset($_SESSION['access_token'])){
$result = getUser($_SESSION['access_token']);
include "layouts/header.php";
?>
<h1>اطلاعات کاربر</h1>
<ul>
<li>
نام کابری:<?=$result->preferred_username?>
</li>
<li>
ایمیل:<?=$result->email?>
</li>
<li>
همراه:<?=$result->phone_number?>
</li>
<li>
<a href="<?=$config['home']?>index.php">بازگشت</a>
</li>
</ul>
</body>
</html>
<?php
}
else {
echo "else";
}
include "layouts/footer.php";
?>