string - PHP encoding to 64 char length -


to generate pretty urls take 2 strings

-unix timestamp

-string (length 16 chars)

is there way use both , encode them string fixed length of 64 chars?

you can use str_pad() function along base64_encode string:

http://php.net/manual/en/function.str-pad.php

this functions returns input string padded on left, right, or both sides specified padding length. if optional argument pad_string not supplied, input padded spaces, otherwise padded characters pad_string limit.

example:

$string = urlencode(base64_encode($string)); $padded = str_pad($tstamp."_".$string."_", 64, "0"); 

your url like:

/order/timestamp_base64string_00000..../

each _ separator gets part of url need, have urldecode() base64_decode() string.

i suggest rather use sessions (cookies) maintain such information page another, or use intermediary storage system ids used in urls.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -