forked from opencaching/opencaching-pl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogbook.php
30 lines (20 loc) · 770 Bytes
/
logbook.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
<?php
use src\Models\ApplicationContainer;
// logbook generator...
require_once (__DIR__.'/lib/common.inc.php');
//user logged in?
if (!ApplicationContainer::GetAuthorizedUser()) {
$target = urlencode(tpl_get_current_page());
tpl_redirect('login.php?target=' . $target);
} else {
$tplname = 'logbook';
}
$secret = "dupa231"; //kojoty: this is not my idea - I copied
tpl_set_var('encrypted_message', encrypt($_GET['logbook_type'] . " This is a secret message", $secret));
tpl_BuildTemplate();
function encrypt($text, $key)
{
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv));
}