Advanced Search

Results 1 to 3 of 3

Thread: help with validating a user. if exist "allow" else "error"

  1. #1
    Join Date
    Dec 2009
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help with validating a user. if exist "allow" else "error"

    hi everyone
    please can anyone help me with how to validate a user-name's existence in a database. i.e. allow the user to access the requested page if the user-name exist in the database else display an error message
    i'm using Microsoft access database platform and the server technology is cold-fusion
    i hope i'm in the right section?
    any assistance will be highly appreciated.
    thanks

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    260
    Thanked 690 Times in 678 Posts

    Default

    I don't know access (are you using ASP also?), but here's the simple answer:
    Using your framework (in ASP? PHP? CGI?) for users, you will need to determine the user name. Then do a query to see if it exists in the database. If it does, do nothing. If not, redirect or display a blank page.

    But in order to help specifically, you'd need to explain a lot more about how your site works and probably post some code.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Dec 2009
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default here is an example

    ok
    i have a login page that look like this
    <cfform action="results.cfm" name="login">
    <cfinput type="text" name="username"><br/>
    <cfinput type="text" name="regnumber"><br/>
    <cfinput type="sumbit" name="submit">
    </cffrom>

    and the results page looks like this:

    <cfquery name="GetResults" datasource="mydatabase">
    SELECT* FROM RESULTS
    WHERE UserName = <cfqueryparam value="#Form.UserName#" CFSQLType="CF_SQL_VARCHAR">
    AND regnumber = <cfqueryparam value="#Form.regnumber#" CFSQLType="CF_SQL_VARCHAR">
    </cfquery>

    Note:mydabatase is the Microsoft access database while results is the name of the table to display the data from.

    the problem now is when the input fields in the login page is field with correct data from the table the results page will display as wanted but when the input fields are filled with wrong data the results page will be blank with nothing on it so i want an error message to display when the login page is field with wrong data.
    i hope i'm making sense here because i tried to explain it the best way i could.


    and please can you offer suggestions on how to do away with Microsoft access because i'm even tired of it, it is too complex for me.

    thanks for the help

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
  •