开发者

PHP Basic encryption/decryption for URL parameters [closed]

开发者 https://www.devze.com 2023-03-05 10:21 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

I'm creating a standard 'framework' in PHP for my own projects. On this point I want to开发者_StackOverflow社区 have certain URL parameters encrypted. Those variables will not contain any data I need to hide from anyone. There are some restrictions.

  • No security involved at all
  • Decryption
  • Basic characters only (A-Z,a-z,0-9)
  • Optionally salt
  • Optionally limit length

I've searched the internet, but all contained characters I did not prefer due to my htaccess standards. People that asked the same question often get point at security leaving no suitable answer in my case. Has anybody encountered this, and has a solution for this which I think must be basic? Many thanks in advance.


I think not everybody understands what you want ( including me ). You just want to make a "strange cool Url" ?

Replace a string with anything you want.

$string ="ace";

$letters    =array( "a"=>'1',"b"=>'2',"c"=>'3',"d"=>'4',"e"=>'5');#etc.

$numbers       = strtr($string, $letters);
## outputs : 135

EDIT : I think I figured out what you want.

Making a tiny url like youtube does.

Take a look here : http://kevin.vanzonneveld.net/techblog/article/create_short_ids_with_php_like_youtube_or_tinyurl/

0

精彩评论

暂无评论...
验证码 换一张
取 消