How Can I Base64_encode And Base64_decode String With Html Tags?
I have a problem with base64 decode For example, I have this code: else if($_POST['submit']==2){ $send = base64_encode($text_success); wp_redirect( home_url('/sales
Solution 1:
The problem is related to the fact that the base64 alphabet is not URL-safe. In this particular case, your base64-encoded string contains a +
, which is interpreted as a space.
To solve this, you can either:
- Use a URL-safe version of the base64 alphabet, i.e. replacing
+
with-
,/
with_
, and trimming the trailing=
paddding, as described in RFC4648. This answer includes a code sample for this approach. - URL-encode your content after base64 encoding, turning
+
into%2B
,/
into%2F
, and=
into%3D
.
This should solve your problem, but it goes without saying that in an untrusted environment, giving users the ability to inject raw HTML into your site constitutes a serious security risk.
Post a Comment for "How Can I Base64_encode And Base64_decode String With Html Tags?"