Results 1 to 12 of 12

Thread: How to create a login form (Oracle9i)

  1. #1
    Join Date
    Apr 2007
    Posts
    21

    How to create a login form (Oracle9i)

    Hello,

    I have a table called users, and it has two fields "username" & "password".

    I have created a form called "UserLogin.frm", and it has as the following:

    1- txtUsername
    2- txtPassword
    3- btnEnter

    the idea is that the user must enter his/her username & password in the mentioned textboxes respectively. Then s/he will press the Enter Button.

    The system will varify the input by matching the data in the users table. If it wrong, the error message will appear. If it correct, the required form will be displayed.

    So, this process is very new to me ... and I would like to learn it and I would be more appreciated by having your kindly assistance.

  2. #2
    Join Date
    Apr 2007
    Posts
    21
    can anyone help me!!???

  3. #3
    Join Date
    Apr 2007
    Posts
    21
    Anyone!!!!!

  4. #4
    Join Date
    May 2007
    Posts
    5

    Thumbs up login code

    <?php
    if($_SERVER['REQUEST_METHOD'] == "POST"){
    $txt_user_name = $_POST['txtUsername'];
    $txt_password = $_POST['txtPassword'];

    $connection = oci_connect("dbUsername", "dbPassword");

    $Sql ="SELECT username,
    password
    FROM tblName
    WHERE username = $txt_user_name";

    $statement = oci_parse ($connection, $Sql);
    oci_execute ($statement);

    while ($row = oci_fetch_array ($statement, OCI_BOTH)) {
    if( ($row['USERNAME'] == $txt_user_name) && ($row['PASSWORD'] == $txt_password) )
    echo "Login successful";
    else
    echo "Error login!";
    }
    ?>

    juss write the above mentioned code in top of your form,
    i assume that u have the correct username and password to your db.

    Enjoy Coding!
    Cheers!

  5. #5
    Join Date
    Apr 2007
    Posts
    21

    Hello Spoons

    Hello Spoons,

    Thanks for the coding ... I will try to excute the code that you have provided me ... if there is something that I don't understand .. then I will send my questions here ...

    So, please be with me because it is my first time that I am going to use the login process in the Oracle.

    Again thanks for the coding

  6. #6
    Join Date
    Oct 2005
    Posts
    2,557
    What are you using to create the form? Why is your form using frm as a file extension instead of fmb?

  7. #7
    Join Date
    May 2007
    Posts
    5

    Rt. way!

    hellow meLady,

    i guess the code i sent is working.
    for timebeing it's okie, but it's not the rt. practice to code.

    Instead if i were to make a login frm i would use some kind of hierarchy among folders and file such as.

    configure(folder)
    -->dbConnect.php(// this file includes connection string)

    class(folder)
    -->tblName.php(// all the DML activity related to particular table)

    project/module_name(folder. eg admin for admin panel)
    -->login_form.php (// Your frontend file. All you have to do is include the dbConnect.php and tblName.php file in here and juss call the function that's in class/tblName.php
    Last edited by spoons; 05-07-2007 at 12:07 AM.

  8. #8
    Join Date
    May 2007
    Posts
    5

    Rt. way!

    Hello meLady,

    i guess the code i sent is working.
    for timebeing it's okie, but it's not the rt. practice to code.

    Instead if i were to make a login frm i would use some kind of hierarchy among folders and file such as.

    configure(folder)
    -->dbConnect.php(// this file includes connection string)

    class(folder)
    -->tblName.php(// all the DML activity related to particular table)

    project/module_name(folder. eg admin for admin panel)
    -->login_form.php (// Your frontend file. All you have to do is include the dbConnect.php and tblName.php file in here and juss call the function that's in class/tblName.php

    Cheers!

  9. #9
    Join Date
    Apr 2007
    Posts
    21

    (^_^)

    Hello Spoons,

    How are you? Thanks for the coding it is pleasure to have a nice help from you (^_^).

    Actually, I will try to use what you gave me ... Because I am a new learner ... I have just learnt the Oracle form developer basic for 6 months ... but I have a good understanding in SQL language ... but to use it in form developer I guess I need some time to learn it (^_^)

    Thanks for the help

    Note: But I haven't used a PHP in oracle9i form developer before ... why we have to use it ... can we avoid it (^_^) because I am not sure yet that I am able to learn some tough coding

    I am waiting for your kindly reply
    Last edited by meLady; 05-16-2007 at 01:22 PM.

  10. #10
    Join Date
    May 2007
    Posts
    1
    Hi,

    Step1:
    Craete testitem ITEM1 for username.
    Craete testitem ITEM2 for password.
    create button item BTN_ENTER for "enter" button.


    Step 2:
    Write "when button pressed" trigger for the "enter" button..
    IF :<BLOCK NAME>.ITEM1 ="USER" THEN
    IF :<BLOCK NAME>.ITEM2 ="PASSWORD" THEN
    NEW_FORM("FORM_NAME");
    ELSE
    MESSAGE('PASSWORD WRONG');
    END IF;
    ELSE
    MESSAGE('USERNAME WRONG');
    END IF;

  11. #11
    Join Date
    May 2007
    Posts
    5

    create login form in oracle form developer.

    Hello meLady,

    1. verify for null username (username cannot be null)
    2. verify for null password (password cannot be null)
    3. If we get a username and password, authenticate it wih PLSQL like SELECT password into vresult
    from users where username=txtUsername;
    IF(txtPassword = vresult) THEN
    /*You are in*/
    ELSE
    /*You are not in*/
    END IF;
    4. This is all meLady. Yes, you can have ecrypted password stored in table
    and encrypt the password given by user while verifying the password that
    user enters. For this, the function used while encrypting the password
    given for new user should be same as the decrypting function while
    verifying at Login.

    Sorry, for late respose as i was out of town, but bfr leaving i sent this solution which somehow couldn't submitted.

    Enjoy coding.

  12. #12
    Join Date
    May 2007
    Posts
    1
    Hi Melady,

    The responce by Anu1 gives the appropriate solution as you said you are using Oracle Developer suite 9i(D2K). You need to use the decrypt/encrypt function in caase if you are storing the password in encrypted form.

    Thanks,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •