SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Handling Special Chars

    I've got a small log in box at my site. It's working fine, and I can log in with most usernames, but the one I use has a big fat DOT in it, and I think it's screwing up my whole log in form (when php interprets it).

    So say I've got a username like this: PeRsOn.ME

    How would I make sure that that period is not screwing anything up one the $username is being interpreted?
    Last edited by dragonfly_7456; Nov 24, 2004 at 13:27.
    Content Writing Service - Get custom SEO articles for 10$

  2. #2
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Lithuania
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just prompt that the username with a special characters could not be created when the user registers.
    Or You can replace theese characters with ones your script can accept...

  3. #3
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first solution is not an option. I've made my log in system quite global, and its supposed to accept these kinds of characters.

    I'm thinking more along the lines of replacing this *period* with a character that would be acceptable... How would I go about doing this?
    Content Writing Service - Get custom SEO articles for 10$

  4. #4
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    $login_name = str_replace('.', '', $login_name);
    The above code replaces a period with a null value, but you can change that to whatever you want.

    Hope this helps.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web

  5. #5
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And then I would have to convert it back before running the username through the username/password check, right?
    Content Writing Service - Get custom SEO articles for 10$

  6. #6
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Umm... Still, I'm wondering...

    In the database I've got my username already saved with a DOT... If I strip all the dots away, I'm going to get a mismatch when comparing the form with the database... Any ideas?
    Content Writing Service - Get custom SEO articles for 10$

  7. #7
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wait. It's not only the periods! (DOTS) .... Umm. ^ this character is giving me the same headache. I have a bad feeling about this... Seems that any *special* character is not going to be parsed. Worst of all, i keep getting a "name is invalid" message ... and I can't find it anywhere in the scripting! ... Where in the world could such a message come from, if its nowhere to be found in the scripting? .... Ouch... Please help!
    Content Writing Service - Get custom SEO articles for 10$

  8. #8
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I'm not sure exactly what you want, but it sounds like you should only massage the data after retrieving it from the database, not before.

    If I'm wrong about that, perhaps you could give a specific example of what you want to do.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web

  9. #9
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Content Writing Service - Get custom SEO articles for 10$


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
  •