I have this:
$email = 'example@somemail.com';
echo base64_encode($email);
When I echo it like this:
echo base64_decode($email);
It outputs this:
{��W��g�j)\�
not example@somemail.com
I’m trying to pass it in a url link like this:
$email = base64_decode($_GET['email'];)
What I’m I doing wrong? Thank you
chorn
2
you’re decoding the plain email - but you have to use the return value of base64_encode()
for base64_decode()
1 Like
How do I get the return value?
$encoded = base64_encode($email);
echo base64_decode($encoded);
You got it! Thanks. Now I can use? $email = base64_decode($_GET['email']);
That will work, as long as you’re passing the encoded email string in your $_GET
parameter.
You should sanitize all $_GET
variables before using them just in case someone tampered with the value.
$email = filter_var(base64_decode($_GET['email']), FILTER_SANITIZE_EMAIL);
system
Closed
9
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.