我正在使用可以选择对链接进行编码的 Flash 播放器。我可以使用下面的代码成功地对它们进行编码,但我找不到解码回来的方法,而且它们不提供该选项。
链接正在与播放器一起使用,当我需要编辑它们时,我的问题就开始了。我看到的不是普通链接,而是编码版本。
<?php
function uppod_enc_replace($str){
$uppod_tmp_a=Array('G','d','R','0','M','Y','4','v','6','u','t','i','f','c','s','l','B','5','n','2','V','Z','J','m','L','=');
$uppod_tmp_b=Array('1','w','Q','o','9','U','a','N','x','D','X','7','z','H','y','3','e','g','T','W','b','8','k','I','p','r');
$uppod_tmp=$str;
$uppod_tmp_from=$uppod_tmp_a;
$uppod_tmp_to=$uppod_tmp_b;
for($i=0;$i<sizeof($uppod_tmp_from);$i++){
$uppod_tmp=uppod_enc_replace_ab($uppod_tmp_from[$i],$uppod_tmp_to[$i],$uppod_tmp);
}
return $uppod_tmp;
}
function uppod_enc_replace_ab($a,$b,$tmp){
$tmp=preg_replace('/'.$a.'/','___',$tmp);
$tmp=preg_replace('/'.$b.'/',$a,$tmp);
$tmp=preg_replace('/___/',$b,$tmp);
return $tmp;
}
function uppod_encode($str,$lkey=''){
$tmp=uppod_enc_replace(base64_encode($str));
if($lkey!=''){
$tmpn=rand(0,strlen($tmp));
$tmp=substr($tmp,0,$tmpn).uppod_enc_replace(base64_encode($lkey)).substr($tmp,$tmpn);
}
return $tmp;
}
?>
到目前为止我已经尝试过:
switching places
$uppod_tmp_from=$uppod_tmp_a;
$uppod_tmp_to=$uppod_tmp_b;
changing base64_encode to base64_decode
测试:
stackoverflow.com
encodes to:
HlQhUWXNwIbs8I6NwsgjVWor
changing base64_encode to base64_decode and switching places with $uppod_tmp_from=$uppod_tmp_a; $uppod_tmp_to=$uppod_tmp_b;
decodes to:
n!RB▒▒▒▒▒▒#Yj+[