String trouble

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am using a function that does a very basic encryption (rotation based) of
Data is a string which may contain a..z,A..Z,0..9,[],(),|,{}"', length
limited to 255 chars.

The problem I have is the following:

Let's say my $string is 'This is a string'
At a given moment  encrypt ($string) yields '6noq4oq4"q6{o]3' as a result.
When I decrypt that I get my original string back. But if I send the
encrypted string in a POST var, this is what I get:
'6noq4oq4\"q6{o]3';  So the " gets escaped and decrypt produces undesired
I don't want that. I want whatever I am putting in to come out verbatim in
the receiving script.

Which function(s) will help me do this ?


PS I am aware of exisiting PHP hash and encrypt functions. This is for
demonstration purposes only.

Re: String trouble

Quoted text here. Click to load it

What Ken said (stripslashes()), but you should also be aware that the slash
got there in the first place because you probably have magic_quotes enabled
for your PHP installation. It is escaping the quotes for you.

 - Virgil

Site Timeline