Below is my current encryption function.
define('ENCRYPT_KEY', 'ldkKKmeJddeFffKdjeddd');
function market_dock_api_encrypt($string) {
$key = ENCRYPT_KEY; //preset key to use on all encrypt and decrypts.
$result = '';
for($i=0; $i<strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)+ord($keychar));
$result.=$char;
}
return urlencode(base64_encode($result));
}
I just realised that this sometimes results in keys with characters such as "%" in it, and I need a key that I can use in URLs. How can I change this to allow for that? I was under the impression that that's what the base64_encode part does. Obviously, I'm wrong.