ERP / application /libraries /Url_encryption_helper.php
cappucaine's picture
Upload 6127 files
971eb1e verified
Raw History Blame Contribute Delete
705 Bytes
<?php
class url_encryption_helper
{
function encode_url($string, $key="", $url_safe=TRUE)
{
if($key==null || $key=="")
{
$key="tyz_mydefaulturlencryption";
}
$CI =& get_instance();
$ret = $CI->encrypt->encode($string, $key);
if ($url_safe)
{
$ret = strtr(
$ret,
array(
'+' => '.',
'=' => '-',
'/' => '~'
)
);
}
return $ret;
}
function decode_url($string, $key="")
{
if($key==null || $key=="")
{
$key="tyz_mydefaulturlencryption";
}
$CI =& get_instance();
$string = strtr(
$string,
array(
'.' => '+',
'-' => '=',
'~' => '/'
)
);
return $CI->encrypt->decode($string, $key);
}
}
?>