SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Email validate

  1. #1
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Email validate

    Hello, I am working on a script and cannot figure out the exact coding to use for email validation. I am looking for something that will fit with my current validation system in my site as follows:

    PHP Code:
    if (!$name || !$street || !$city || !$state || !$zip || !$coun ||!$email || !$phone || !$domain || !$user || !$pass || !$tos || (strlen($user)< OR strlen($user) > 8) || (strlen($pass)< OR strlen($pass) > 8)) { 
    Thanks for all of your help.
    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers

  2. #2
    SitePoint Enthusiast tunnel7's Avatar
    Join Date
    Oct 2002
    Location
    Easthampton, MA
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    to validate an email address you will need to use a regular expression to compare against. i also remember seeing an article about email validation with php here at sitepoint:

    http://www.sitepoint.com/article/1051

    I hope this points you in the right direction
    Tunnel 7 | Standards Based Website Design
    http://www.tunnel7.com

    Follow me: http://www.twitter.com/derekallard

  3. #3
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think that will work for me. If anybody else has any suggestions please post them. Thanks!
    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers

  4. #4
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    as I would do it:
    Use a regular expression to find if the email makes 'sense', then create some complicated md5 hash and save it in your database, then send the user email on the email address he gave up and give him a link to eg http://www.example.com/validate.php?key=54da4687
    and then in validate.php you would compare the key in the url against the one saved in your database, if they match then active the account.

    Example regexp code
    PHP Code:
    if (preg_match('#^[a-zA-Z0-9_.]+?@[a-zA-Z0-9_.]+?$#i'$email))
      
    //email is valid
    else 
      
    //email is invalid 
    hope that helps!
    - website

  5. #5
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for all of your help I finally got it to work. You can check it out at www.wlhosting.com/temp/
    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers

  6. #6
    Put your best practices away. The New Guy's Avatar
    Join Date
    Sep 2002
    Location
    Canada
    Posts
    2,087
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    you should use in on your "leave a message" thing too.
    "A nerd who gets contacts
    and a trendy hair cut is still a nerd"

    - Stephen Colbert on Apple Users


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
  •