PDA

View Full Version : URL Encoding - Hiding post Var's ?


boer
09-05-2002, 02:23 PM
I use URL encoding to pass variables from one script to the next. I am pretty happy with this method, because I don't have to worry about client side COOKIES being enabled and it's pretty much browser independent.

The downside is that
1. The URL's are very long and looks bad
2. My site security goes for a ball of, because anybody can see what variables are passed and could edit this to manipulate the results.

Does anyone know of a way that I could hide this string not to show in the browser address bar?

Please help if you can.

Thanx

:thumbsup:

firepages
09-05-2002, 04:42 PM
session support in PHP4 will work with or without cookies, of course users without cookies will get the session ID passed from page to page but your variables are stored in the session and therfore not visible.

http://www.php.net/session_register

boer
09-06-2002, 06:46 AM
I'll give it a bash...

Thanx

boer
09-06-2002, 07:00 AM
I'll give it a bash...

Thanx

AryaputrA
06-23-2003, 06:10 AM
Is encoding the url a recommended method in PHP, and how you go about doing it in PHP?

i remember in ASP you do like :

myVar1 = objRS.Fields("Album")

<%=Server.URLEncode( myVar1 )%>

How to do it in PHP ?

firepages
06-23-2003, 06:30 AM
GET stings are usually urlencoded automatically... though whether thats PHP or the browser I can't rightly say.

<?php
echo urlencode($string);
echo urldecode($string);
?>

you can also base64_encode() & base64_decode for real awkward strings.

AryaputrA
06-23-2003, 06:54 AM
Thanks a lot firepages, it works like a charm now... i like the base64_encode and base64_decode :D :thumbsup: