PHP passes string according to url encoding data
I am using a PHP file to send data from my website to JS. And I am posting data by php to url. For example. www.web.com/send.php?data=Change All. And my problem is that if someone sends a special character or emoticon, the PHP script won't work. Is there any function to encode a string for a string with letters and numbers only, and on the PHP side to decode it? Thanks for answers;).
+3
source to share
3 answers
I am using these functions for decoding / encoding
public function encode($string)
{
$string=$string*1498158+825920496;
return urlencode(base64_encode($string));
}
///////////////////////////////////////////////////////////////////////////////
public function decode($string)
{
$string=base64_decode(urldecode($string));
$string=($string-825920496)/1498158;
return $string;
}
0
source to share