-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
64 lines (50 loc) · 1.48 KB
/
index.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
session_start();
//the api key from your forum settings
$public_key = "apikey";
// the secret key from your forum settings
$private_key = "testapisecretkey";
//saving the user object from the session into
//a new “auth” object
$auth_object = array( "user" => $_SESSION['user'] );
//Taking the auth object, converting to json then
//base64 encoding the json data
$message = base64_encode(json_encode($auth_object));
//save the current server timestamp
$timestamp = time();
//we’re creating a signature using the message, timestamp,
//and secret key
$signature = sha1($private_key . ' ' . $message . ' ' . $timestamp);
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="viewport" content="width=device-width">
</head>
<body>
<?php if ($_SESSION['user']) { ?>
<a href="./logout.php"> logout </a>
<?php } else { ?>
<a href="./login.php"> login </a>
<?php } ?>
| <a href="./contact.php">Messaging</a>
<br/><br/>
<hr>
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<link rel="stylesheet" href="//cdn.muut.com/1/moot.css">
<script src="//cdn.muut.com/1/moot.min.js"></script>
<a id="my-community" href="https://muut.com/i/playground">Community</a>
<script>
$('#my-community').muut({
login_url: "./login.php",
api: {
key: '<?php echo $public_key ?>',
message: '<?php echo $message ?>',
signature: '<?php echo $signature ?>',
timestamp: <?php echo $timestamp ?>
}
})
</script>
</body>
</html>