Results 1 to 7 of 7
Thread: ignore $sign
-
03-04-2008, 02:14 PM #1Aspiring Evangelist
- Join Date
- Dec 2007
- Location
- Lebanon
- Posts
- 413
ignore $sign
how can I make php ignore a $ sign??? for example if I have such password
$hy$ll
I want to read as is. how?
-
03-04-2008, 03:12 PM #2Aspiring Evangelist
- Join Date
- Mar 2008
- Location
- Sheffield, UK
- Posts
- 447
Use the escape character:
\$hy\$ll
-
03-04-2008, 03:19 PM #3Aspiring Evangelist
- Join Date
- Dec 2007
- Location
- Lebanon
- Posts
- 413
thanks a lot, It was actually too easy but I didn't see it!!! I have put the string in single quotes
'' cause when I used addcslashes($pass, "$") there were slashes but not in the $ sign was parsed before
-
03-06-2008, 12:18 PM #4Web Hosting Master
- Join Date
- Aug 2002
- Location
- Canada
- Posts
- 667
Sorry for the unsolicited interjection, but is it that you're inserting this into a MySQL database? If so, do consider mysql_real_escape_string instead of addslashes or any of its variants. This is a well-beaten topic, should find many articles online
Cheers.
Alex
-
03-06-2008, 12:26 PM #5Aspiring Evangelist
- Join Date
- Dec 2007
- Location
- Lebanon
- Posts
- 413
no I wasn't inserting it into mysql database, It is a server password to create a whm reseller. Now it is solved but the idea was that no matter what function I used the $ sign was still parsed before the function was ran.
for example mysql_real_escape_string("$hl$xx");
was becoming mysql_real_escape_string("");
the solution was to put it between single quotes ''
Thanks for you trying to help me, the problem was solved Cheers
-
03-06-2008, 01:24 PM #6Web Hosting Master
- Join Date
- Aug 2002
- Location
- Canada
- Posts
- 667
-
03-07-2008, 10:01 PM #7Junior Guru Wannabe
- Join Date
- Mar 2008
- Posts
- 45
Following may be solutions of your problem:
1) if you are submitting password using forms, you need not worry.
2) If you are using single quotes '' , nothing to do extra. PHP will interpret $ as a character.
3) if you are using $ sign inside a double quoted string, use escaping character. \. In this particular case, your password (or string) becomes like "Hello\$mylove"