case sensitive

Discussion in 'ASP General' started by Jeff, Aug 1, 2004.

  1. Jeff

    Jeff Guest

    i have this on my signup page
    Set rs = Conn.Execute("SELECT * from rounds")

    DO WHILE NOT rs.EOF

    IF request.form("username") = rs.fields.item("username").value THEN

    response.redirect("register2.asp")

    END IF

    rs.MoveNext
    LOOP

    the problem is.. some who signed up as say Jeff can still sign up as jeff
    or jeFF how can i fix this??
    Jeff
     
    Jeff, Aug 1, 2004
    #1
    1. Advertisements

  2. Are you asking how to require case sensitivity or how to eliminate it?



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
     
    Dave Anderson, Aug 1, 2004
    #2
    1. Advertisements

  3. Jeff

    Jeff Guest

    How to eliminate it... as is.. I could sign up as Jeff.. and it wouldne stop
    me from signing up as jeff or jefF i want Jeff to be blocked in any case
    form
    Jeff
     
    Jeff, Aug 1, 2004
    #3

  4. The best way is to allow your database to do the filtering (assuming your
    database is sql server or jet, which are both case insensitive by default).
    Why in the world are you returning all the rows from your table with all the
    fields simply to determine if a record containing "jeff" exists? OK, so you
    probably don't realize that there is a more efficient way to do it ...

    sql="select count(*) from rounds where [username]='" & _
    replace(request.form("username"),"'","''") & "'"
    set rs=conn.execute(sql,,1)
    if rs(0) > 0 then
    'user exists
    else
    'user does not exist
    end if


    Bob Barrows
     
    Bob Barrows [MVP], Aug 1, 2004
    #4
  5. Oh! I see, you want it to be case sensitive? If "Jeff" exists. you want it
    to reject "jeff"?

    That's a lot harder, especially if your db is Access. It's time to tell us
    what database type and version you are using.

    Bob Barrows
     
    Bob Barrows [MVP], Aug 1, 2004
    #5
  6. Jeff

    Jeff Guest

    well... ummm yes.. it is access :( and yes.. you are correct, i want it to
    reject any form of jeff
    Jeff
     
    Jeff, Aug 1, 2004
    #6
  7. Jeff

    Jeff Guest

    And not sure what you mean by what version. The access is with Office 2002
    if that is what you mean.
     
    Jeff, Aug 1, 2004
    #7
  8. Jeff

    Lord Merlin Guest

    | And not sure what you mean by what version. The access is with Office 2002
    | if that is what you mean.
    |
    |
    | | > Oh! I see, you want it to be case sensitive? If "Jeff" exists. you want
    it
    | > to reject "jeff"?
    | >
    | > That's a lot harder, especially if your db is Access. It's time to tell
    us
    | > what database type and version you are using.
    | >
    | > Bob Barrows
    | >
    | > Jeff wrote:
    | > > How to eliminate it... as is.. I could sign up as Jeff.. and it
    | > > wouldne stop me from signing up as jeff or jefF i want Jeff to be
    | > > blocked in any case form
    | > > Jeff
    | > >
    | > >
    | > > | > >> "Jeff" wrote:
    | > >>>
    | > >>> the problem is.. some who signed up as say Jeff can
    | > >>> still sign up as jeff or jeFF how can i fix this??
    | > >>
    | > >> Are you asking how to require case sensitivity or how to eliminate
    | > >> it?
    | > >>
    | > --
    | > Microsoft MVP - ASP/ASP.NET
    | > Please reply to the newsgroup. This email account is my spam trap so I
    | > don't check it very often. If you must reply off-line, then remove the
    | > "NO SPAM"
    | >
    | >
    |
    |

    Well, you could always instead do this in ASP, thus making it more robust
    and more flexible:



    DO WHILE NOT rs.EOF


    username = UCASE(rs.fields.item("username").value)

    IF UCASE(request.form("username")) = username THEN

    response.redirect("register2.asp")

    END IF

    rs.MoveNext
    LOOP



    --


    Kind Regards
    Rudi Ahlers
    +27 (82) 926 1689

    Greater love has no one than this, that he lay down his life for his friends
    (John 15:13).
     
    Lord Merlin, Aug 1, 2004
    #8
  9. Jeff

    Jeff Guest

    Ok.. so that would set the username to all uppercase... then check against
    it... got ya..
    thanks
     
    Jeff, Aug 1, 2004
    #9
  10. Yes, that is what I meant.

    You should be able to utilize the strconv() function to perform a case
    sensitive query. It will prevent the use of an index on the username field
    so performance will suffer.

    Select count(*) from rounds
    where strcomp([username],
    replace(request.form("username"),"'","''"),0) = 0

    HTH,
    Bob Barrows
     
    Bob Barrows [MVP], Aug 2, 2004
    #10
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.