Reputation: 3061
Are there any other encoding functions other than base64_encode for encoding text in PHP?
Edit: The purpose of the encoding functions:
To generate a string that can be used in a URL that can be used as an identifier.
For example, instead of http://www.something.com/?id=4&category=books&type=20
I would like to have:
http://www.something.com/?q=a3444aAbt3daj492klsj
So to get the variables one has to decode the only query string which is a hash.
Upvotes: 3
Views: 6478
Reputation: 872
if you want the user not to see meaningful things written in address bar, i am just now on it.
create an .htaccess file in www root folder and put these on there. 1st 3 lines are for real dirs and files.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.+)$ index.php?$1 [L]
create i.e. index.php and put something like these in it. you can use any kind of 2 way encryption you want. I am using clean url too.
echo "<a href='".base64_encode("birinci/b/c")."'>link</a>
echo "<a href='".base64_encode("ikinci/b/c")."'>link</a>
echo "<a href='".base64_encode("ucuncu/b/c")."'>link</a>
$var1 = $_SERVER['QUERY_STRING'];
$var2 = base64_decode($var1);
$arr = explode("/",$var2);
$_GET["object"] = $arr[0];
$_GET["action"] = $arr[1];
$_GET["id"] = $arr[2];
if ($_GET["object"] == "birinci") {
echo "a geldi!";
} else if ($_GET["object"] == "ikinci") {
echo "b geldi!";
}
Upvotes: -1
Reputation: 35927
Yes, convert_uuencode for instance, but it might be a good idea to explain what you are trying to do!
Upvotes: 3