473,803 Members | 3,416 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

String trouble

I am using a function that does a very basic encryption (rotation based) of
data.
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
results.
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 ?

THANKS!
Pjotr

PS I am aware of exisiting PHP hash and encrypt functions. This is for
demonstration purposes only.
Jul 17 '05 #1
2 1391
"Pjotr Wedersteers" <x3****@westert erp.com> wrote in message
news:41******** *************** @news.xs4all.nl ...
I am using a function that does a very basic encryption (rotation based) of data.
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
results.
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 ?


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
Jul 17 '05 #2
.oO(Ken Robinson)
Use the function "stripslash es", encrypt(stripsl ashes($_POST['var']))


Use get_magic_quote s_gpc() first to check if magic quotes are enabled
(they are by default, but you shouldn't rely on that).

Micha
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

108
6473
by: Bryan Olson | last post by:
The Python slice type has one method 'indices', and reportedly: This method takes a single integer argument /length/ and computes information about the extended slice that the slice object would describe if applied to a sequence of length items. It returns a tuple of three integers; respectively these are the /start/ and /stop/ indices and the /step/ or stride length of the slice. Missing or out-of-bounds indices are handled in a manner...
6
3542
by: Mark | last post by:
Hi, My page has a table with many columns such that the right-side of the table gets chopped off when printed. I specify a table width of 100%, but otherwise no cell dimensions are specified. The culprits are 2 wide columns which contain e-mail addresses. I can get the page to fit entirely on the printer output if the browser would break the e-mail address string at the '@' symbol. What I've done for now is replaced the '@' in all...
1
1419
by: Hai Ly Hoang | last post by:
Hi, I have string which contains linefeed and carry-return characters (eg. "Banana \r\n Apple \r\n..."); To print this string, i make use of PrintPage event of PrintDocument with DrawString methods. It causes a trouble, when the string is covered more than one-page when being printed, some of the string will disapper. How to solve this trouble ?
9
3792
by: Fei Liu | last post by:
In Accellerated C++, the author recommends that in a header file one should not declare using std::string, using std::vector etc instead one should directly specify the namespace specifier in code. for example, this is bad practice: header.h #include <string> using std::string;
3
1276
by: Wyz | last post by:
Hello. I have troubles giving me a big headache, I hope somebody may help me. I'm using Indy.Sockets to have FTP support for my VB.NET application (I also tried with another dll made in C# but the trouble is the same). The idea is that I added a dll as a reference to my project. There is a FTP object which have the method put (path as string, name as string, append as boolean). Here is the trouble now and I saw a lot of articles on it but...
14
1804
by: Josh Baltzell | last post by:
I am having a lot more trouble with this than I thought I would. Here is what I want to do in pseudocode. Open c:\some.pdf Replace "Replace this" with "Replaced!" Save c:\some_edited.pdf I can do this in notepad and it works fine, but when I start getting in to reading the files I think it has some encoding problem. I tried saving the file with every encoding option. When I open a PDF in the
19
3616
by: VK | last post by:
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/ b495b4898808fde0> is more than one month old - this may pose problem for posting over some news servers. This is why I'm starting a new one] I'd still like to finish this rounding mess. As a startup lemma we can take that VK is the worst programmer of all times and places: let's move from here forward please. The usability of any program depends on exact behavior...
2
2317
by: jenniamia | last post by:
I need to make the string "myFile" into a byte and then put it in the database as a file/image, where later it needs to be pulled out and back into a string from the byte. I'm really having trouble gettting it back into a string afterwards, but I don't even know if the data is being put in the database with correct values. Any suggestions or pointers would be much appreciated. Thanks! (I posted the main section I'm having trouble with, but I...
3
1325
blackstormdragon
by: blackstormdragon | last post by:
My trouble causing lines are maked within the code. #include<iostream> #include<string> using namespace std; void main() { string* head; string* tail;
21
3971
by: yogicoder | last post by:
following is the code to accept a string from user, but i get segmentation fault as soon i have finished entering the string i.e. as soon as i press the 'enter' key. #include <stdio.h> #include <string.h> #include <stdlib.h> int main (void)
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9565
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10550
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2972
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.