Reply to Re: [PHP] decrypting query string back into $_GET['var']

Your name:

Reply:


Posted by Jochem Maas on 09/29/05 19:33

Graham Anderson wrote:
>
> What is the best way to decrypt a query string back into variables ?
>
>
> $root = "http://www.myserver.com/script.php";
> $queryString = "?test=mytest&color=red";
> myEncrypt($queryString); //add mCrypt encryption
> $finalURL = $root.$encryptedQueryString;
>
> what is the proper what to decrypt the GET variables on the other side ?
>
>

> Do you need to decrypt the query string first ?

yes - if you have a query string like

4509134534068953534875104584437043134081743

or whatever then php won't turn it into a $_GET var.
although your query string could contain &'s and/or ?'s and/or ='s
in which case you might have cruft in the $_GET array which you would
want to clean out before extracting your decrypted string into
$_GET ..

> decrypt($_SERVER['QUERY_STRING']);
>
> Once you have decrypted it, can you pass it along to a $_GET as you
> would with an unencrypted query string ?
> $test = $_GET['test'];
>
> Or, do you need to parse the string to extract variables?

yes you do, but this being php - there is a function that will do it for you :-)

http://php.net/parse_str

>
> many thanks
>
> g
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация