29 lines
897 B
PHP
Executable File
29 lines
897 B
PHP
Executable File
<?php
|
|
|
|
use Config\Services;
|
|
|
|
if (!function_exists('generate_signed_url')) {
|
|
function generate_signed_url($route, $params = [], $expiresIn = 259200)
|
|
{
|
|
$secretKey = 'your-secret-key'; // Change this to your secret key
|
|
$expiresAt = time() + $expiresIn;
|
|
$params['expires'] = $expiresAt;
|
|
$signature = hash_hmac('sha256', $route . '?' . http_build_query($params), $secretKey);
|
|
$params['signature'] = $signature;
|
|
return base_url($route . '?' . http_build_query($params));
|
|
}
|
|
}
|
|
|
|
|
|
if (!function_exists('urlButton')) {
|
|
function urlButton($planId, $userId , $delegationUserId = null )
|
|
{
|
|
|
|
$url = generate_signed_url('review', ['plan_id'=> md5($planId),'user_id'=> $userId,'delegation_user_id'=> $delegationUserId], 259200);
|
|
|
|
return '<a href="' . $url . '" target="_blank">Click here to review the trip</a>';
|
|
}
|
|
}
|
|
|
|
|