-
Notifications
You must be signed in to change notification settings - Fork 0
/
card.php
62 lines (61 loc) · 1.99 KB
/
card.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
<?php
if (empty($_GET["user"]) && empty($_GET["content"])) {
header("Location: /");
exit;
}
if (@$_GET["preview"] === "true") {
$data = json_decode(base64_decode($_GET["content"]), true);
$delta = time() - $data["ts"];
if ($delta > 600) {
http_response_code(410);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Gitcard</title>
</head>
<body>
<div style="font-weight:bold;text-align:center;margin:4px;border:1px solid #aa4;background:#ffc;padding:0.5em;color:#000">This is preview has expired! <a href="/">Go back</a></div>
</body>
</html>
<?php
exit;
}
}
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Gitcard</title>
<link rel="stylesheet" href="/css/card.min.css">
</head>
<body>
<?php if (@$_GET["preview"] === "true") { ?>
<div style="font-weight:bold;text-align:center;margin:4px;border:1px solid #aa4;background:#ffc;padding:0.5em;color:#000">This is a preview! It will expire after 10 minutes!</div>
<?php } ?>
<div id="card">
<div id="card__name"></div>
<div id="card__pronouns"><a id="card__pronouns__link" target="_blank"></a></div>
<div id="card__bio"></div>
<div id="card__links"></div>
<footer>
Gitcard version 1.0.3 • Made with <i class="emoji">❤️</i> by <a href="/c/jonaskohl">Jonas Kohl</a> • <a href="https://github.com/jonaskohl/gitcard" target="_blank">Source code</a>
</footer>
</div>
<?php if (@$_GET["preview"] === "true") { ?>
<script>
window.card_preview=true;
window.card_content=<?= json_encode($data["content"]); ?>;
</script>
<?php } else { ?>
<script>
window.card_preview=false;
window.card_username=<?= json_encode($_GET["user"]); ?>;
</script>
<?php } ?>
<script src="/js/card.min.js"></script>
</body>
</html>