SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2011
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Are there any valid email addresses that would change after being escaped?

    I am using mysqli_real_escape_string in php to escape content before putting it into the db. But I am worried that I might escape some valid email, and therefore a person would not be able to log in because their email is not represented properly in the db. Has anyone encountered a problem like this? Will any valid emails suffer from escaping problem?

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It doesnt modify the value per se.

    Essentially it converts it so that it can be put safely into a query. But that conversion makes the database see the varible as you would if you echo it, for example. The escaping just modifies a variable so that it cannot run a command.

    You can see what I mean by creating a variable with quotes in, echoing it. Escape it, echo it. You'll see its changed such that the quote s have backslashes preceding them. then run a select query selecting just that string. The return will be your inital variable.

    So to answer your question - I dont believe there is any string that, after escaping with mysql real escape string and inserting into the database, has a different value from your starting string.
    Last edited by Jake Arkinstall; Jan 30, 2012 at 22:31. Reason: Sitepoint requires a mobile-friendly version of the forum. this is ridiculous.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Zealot
    Join Date
    Nov 2011
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, that explanation helped a great deal.


Bookmarks

Posting Permissions

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