Results 1 to 7 of 7

Thread: ignore $sign

  1. #1
    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?

  2. #2
    Join Date
    Mar 2008
    Location
    Sheffield, UK
    Posts
    447
    Use the escape character:

    \$hy\$ll

  3. #3
    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

  4. #4
    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
    circlical - hosting software development
    forums * blog

  5. #5
    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

  6. #6
    Join Date
    Aug 2002
    Location
    Canada
    Posts
    667
    I had assumed that you were using single quotes, and had experienced difficulty with character encoding/storage; I think Amy's response threw me off course (rereading it now in light of your response)

    Glad you got it!
    circlical - hosting software development
    forums * blog

  7. #7
    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"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •