Encrypting a string in PHP?

To avoid passing variables around in the URL you could use session variables using the $_SESSION array You can check out the PHP docs for some basic usage as well as other examples.

To avoid passing variables around in the URL you could use session variables using the $_SESSION array. You can check out the PHP docs for some basic usage, as well as other examples.

Don't really want to go too advanced though... – DLA Sep 28 at 19:00 This is not advanced PHP. Your current solution is arguably the simplest, anything else would be more complex. Even then, not more complex by much.

– Alex Sep 28 at 19:02.

The easiest way is to base64_encode($name), then base64_decode on the other end.

That's exactly what I was looking for. Thanks! – DLA Sep 28 at 19:01 I would say that many people will still recognise base64 encoding, it has a characteristic look about it and is easily decoded.

If your aim is to hide data from the end user, this a bad way to go about doing it. If your aim is just to make a URL look more "technical"... then that's awful! – Alex Sep 28 at 19:05 Alex, I agree, this is less than ideal.

But if his only reason is that it looks tacky to have the text in the url, then this is the easiest way to have the fewest changes possible to the rest of the code and accomplish the goal. Someone who could decode it probably wouldn't care about the 'tackiness' of having the un-encoded variable in the url, so it doesn't matter. – Bob Baddeley Sep 28 at 19:21.

First, you can store the name in cookie or session, read it on the next page, and remove it from session/cookie. In this way, it won't be included in the URL anyway If you just do not want to pass it as a plain text, you can use base64_encode() and base64_decode(). But this won't stop any experienced user to read the actual value.

Use mcrypt() to crypt the message, base64_encode() to make the crypted version ASCII, include it in the URL, and on the next page decode and then decrypt. Be carefull, a lot of chippers use seed value, which also have to be saved and send to the next page, in order to be able to decrypt. All scenarios assume the next page is part of the same application (or both applications are yours).

If you want to encrypt the string for any URL, you can't, as the page you are redirecting to won't be able to read it.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions