Reputation: 75
Here is my question, i am trying to hide address value in URL
URL is something like this
example.com/linkdl/preview/index.php?address='http://mysiteexample.com'
I am trying to hide, ?address='http://mysiteexample.com'
part, but i am not sure, what is best way
i have an idea to use base64_encode($adresa)
, but i am not sure will i have problems with (encoding/decoding special) characters in URL
$click = 'OtvoriProzor("'.$file_path.'&pk='.$sesija->pk.'&adresa='.base64_encode($adresa).
'&IDIstorijaElement='.$element->GetId().'", "Prevod", 700, 500);';
This is very insecure, can add some function for encryption, to encrypt and decrypt parametar, or will md5 help me here. Also should i use function url_decode url_decode instead?
Upvotes: 0
Views: 6424
Reputation: 1795
Since md5 is a hash algorithm, you won't be able to get back what you encoded. You can use base64 and urlencode to avoid problems with some characters:
<?php
$url = urlencode(base64_encode($adresa));
?>
And you will decode it with:
<?php
$addr = base64_decode(urldecode($_GET['adresa']));
?>
Upvotes: 5