Professional Web Applications Themes

Restricting hotmail users from signing up - Coldfusion - Advanced Techniques

I would like to know how I could accomplish putting a restriction on certain email address's from signing up. Lets say when a user signs up with the email address com a warning would come up saying something like "no free email accounts". Also, is there a way to only allow certain things like, ".net" or ".edu". Lets say I have an educational portion of my site that only people with a ".edu" email address can access....How do I go about validating the form....I am not sure how to figure this out. I would assume the email variable would be ...

  1. #1

    Default Restricting hotmail users from signing up

    I would like to know how I could accomplish putting a restriction on certain
    email address's from signing up. Lets say when a user signs up with the email
    address com a warning would come up saying something like "no free
    email accounts". Also, is there a way to only allow certain things like,
    ".net" or ".edu". Lets say I have an educational portion of my site that only
    people with a ".edu" email address can access....How do I go about validating
    the form....I am not sure how to figure this out. I would assume the email
    variable would be broken down to find the symbol and everything after would
    be compared to what is allowed and not allowed. But how exactly?


    I am only look for validation upon signup. So when they first sign up I want
    to make sure they have a certain certain email address ".edu" if signing up for
    education portion of the site and the other site I want to make sure it is not
    a free account aka com


    Thanks a bunch to anyone who knows how to do this.

    davellaman Guest

  2. #2

    Default Re: Restricting hotmail users from signing up

    You can use the right() function in Coldfusion to return a certain number of
    characters and test. The right() function passes a string and number of
    characters on the right/end of the string to get. For example:

    <cfif #right(email_variable, 11)# IS "hotmail.com">
    <cfoutput>Sorry Charlie, no hotmail accounts allowed.</cfoutput>
    </cfif>

    <cfif #right(email_variable, 4)# IS ".edu">
    <cfoutput>OK. You are a winner</cfoutput>
    </cfif>

    I would consider using the trim() function to eliminate any spaces after, too.
    So it would be:
    <cfif #trim(right(email_variable, 4))# IS ".edu">

    Stealth Guest

  3. #3

    Default Re: Restricting hotmail users from signing up

    davellaman,

    In addition to Stealth 7's suggestions you may also want to perform some email
    address validation. There is a good example in this thread:


    http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=7&thread
    id=935927

    mxstu Guest

  4. #4

    Default Re: Restricting hotmail users from signing up

    You actually want to do the trim before you do the right.

    <cfif #right(trim(email_variable)4)# IS ".edu">

    The best thing to do, if you're doing alot of processing on email_variable, is
    just to trim it up front:
    <cfset email_variable = trim(email_variable)>

    then you no longer have to worry about leading or trailing spaces.

    Kronin555 Guest

  5. #5

    Default Re: Restricting hotmail users from signing up

    Something like this will work. You can condense it for efficiency, but I will
    be methodical for clarity.

    BadDomains="hotmail,yahoo,macromedia,etc";
    P1=lower(ListLast(form.email, ""));
    P2=ListFirst(P1, ".");

    if listfind(BadDomains, p2)
    code for bad domain
    else
    code for good domain

    Do all that trim stuff the other guys mentioned as well. We use javascript to
    do this as an onchange event handler.


    Originally posted by: davellaman
    I would like to know how I could accomplish putting a restriction on certain
    email address's from signing up. Lets say when a user signs up with the email
    address com a warning would come up saying something like "no free
    email accounts". Also, is there a way to only allow certain things like,
    ".net" or ".edu". Lets say I have an educational portion of my site that only
    people with a ".edu" email address can access....How do I go about validating
    the form....I am not sure how to figure this out. I would assume the email
    variable would be broken down to find the symbol and everything after would
    be compared to what is allowed and not allowed. But how exactly?


    I am only look for validation upon signup. So when they first sign up I want
    to make sure they have a certain certain email address ".edu" if signing up for
    education portion of the site and the other site I want to make sure it is not
    a free account aka com


    Thanks a bunch to anyone who knows how to do this.



    Dan Guest

Similar Threads

  1. restricting users from interacting.
    By Rodrigo Guerra in forum Macromedia Flash Flashcom
    Replies: 0
    Last Post: October 13th, 07:10 PM
  2. signing out all users
    By KaaN in forum ASP.NET Security
    Replies: 1
    Last Post: February 1st, 06:58 AM
  3. Restricting number of users for my Network CD
    By upbeatsw webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 4
    Last Post: September 28th, 12:48 AM
  4. restricting users using time help!!
    By AArdvark in forum Macromedia Dreamweaver
    Replies: 3
    Last Post: July 10th, 09:15 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139