function decode($encoded, $key)
{
$strofsym = "qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM=";
$x = 0;
while ($x++<= strlen($strofsym))
{
$tmp = md5(md5($key.$strofsym[$x-1]).$key);
$encoded = str_replace($tmp[3].$tmp[6].$tmp[1].$tmp[2],
$strofsym[$x-1], $encoded);
}
return base64_decode($encoded);
}
when switching to PHP 8 I get the following error. on PHP 7.2 works well.
Warning: Undefined array key 63 in line 7 and 8
HElp me, please.
My Answer:
substr($encoded, 0, 63);
$decoded = '';
for ($i = 63; $i < strlen($encoded); $i++) {
$decoded .= $encoded[$i] ^ $key[$i % strlen($key)];
}
return $decoded;
}
Rate this post
4 of 5 based on 3133 votesComments