| Need some help in the login form [message #151192] |
Tue, 13 December 2005 11:36  |
qewani
Messages: 51 Registered: December 2005 Location: uaq
|
Member |
|
|
can any one help me with correcting the code or can any one give me another code for using it in the login form.
this is my problem:-
i had make a login form using in oracle 9i form builder >>>in this form i have three text boxes one for intering user name and the second one for entering the password and the third text box is not visible and it is used for counting the tries.
In addition i have a three buttons , one is for login and the two others are not visible and they are a show main menu button and a exit button. For login button i had put a WHEN-BUTTON-PRESSED trigger in the login button and it must check if the user name and the password match what it is on the login table so it allow the user to see the show main menu button otherwise if the user name or the password are wrong and has been putted wrong for 3 times of trying then it will show the exit button.
and this is a picture of the login form in the design view.

and this is the code for theWHEN-BUTTON-PRESSED trigger on the login button.
_________
declare
alertNum number;
dummy1 tbl_login.USER_NAME%type;
dummy2 tbl_login.PASSWORD%type;
begin
select tbl_login.USER_NAME into dummy1 from tbl_login where tbl_login.USER_NAME = :LOGIN.USER_NAME ;
select tbl_login.PASSWORD into dummy2 from tbl_login where tbl_login.PASSWORD = :LOGIN.PASSWORD ;
if :LOGIN.TRIES<3 then
if sql% found
then
set_item_property('LOGIN.SHOW_MENU', visible, property_true);
set_item_property('LOGIN.SHOW_MENU', enabled, property_true);
else
message ('Invalid password....try again');
:LOGIN.TRIES := :LOGIN.TRIES+1;
:LOGIN.USER_NAME := null;
:LOGIN.PASSWORD := null;
end if;
else
message ('Exceeded Number of tries..press exit button');
set_item_property('LOGIN.EXIT', visible, property_true);
set_item_property('LOGIN.EXIT', enabled, property_true);
end if;
end;
___________
can any one help me correcting the code of the WHEN-BUTTON-PRESSED trigger on the login form or can any one give me another code for using it in the login form.
i hope to get some help from the experts>>>
|
|
|
|
|
|
| Re: Need some help in the login form [message #151427 is a reply to message #151192] |
Wed, 14 December 2005 17:20   |
qewani
Messages: 51 Registered: December 2005 Location: uaq
|
Member |
|
|
david
the code does not do these steps
___________________
else
message ('Invalid password....try again');
:LOGIN.TRIES := :LOGIN.TRIES+1;
:LOGIN.USER_NAME := null;
:LOGIN.PASSWORD := null;
end if;
else
message ('Exceeded Number of tries..press exit button');
set_item_property('LOGIN.EXIT', visible, property_true);
set_item_property('LOGIN.EXIT', enabled, property_true);
end if;
end;
_____________
can u tell me ur is the problem with my code
please!!!
|
|
|
|
| Re: Need some help in the login form [message #151441 is a reply to message #151192] |
Wed, 14 December 2005 20:34   |
Scarlet.Zhu
Messages: 22 Registered: December 2005 Location: Shanghai
|
Junior Member |
|
|
Declare
Alertnum Number;
Dummy1 Tbl_Login.User_Name%Type := Null;
Dummy2 Tbl_Login.Password%Type := Null;
Cursor Login Is
Select Tbl_Login.User_Name, Tbl_Login.Password
From Tbl_Login
Where Tbl_Login.User_Name = :Login.User_Name And Tbl_Login.Password = :Login.Password;
Begin
Loop
Fetch Login
Into Dummy1, Dummy2;
Exit When Login%Notfound;
End Loop;
If Dummy1 = Null And Dummy2 = Null And :Login.Tries < 3 Then
Message('Invalid password....try again');
:Login.Tries := :Login.Tries + 1;
:Login.User_Name := Null;
:Login.Password := Null;
Elsif Dummy1 <> Null And Dummy2 <> Null And :Login.Tries <= 3 Then
Set_Item_Property('LOGIN.SHOW_MENU', Visible, Property_True);
Set_Item_Property('LOGIN.SHOW_MENU', Enabled, Property_True);
Elsif Dummy1 = Null And Dummy2 = Null And :Login.Tries = 3 Then
Message('Exceeded Number of tries..press exit button');
Set_Item_Property('LOGIN.EXIT', Visible, Property_True);
Set_Item_Property('LOGIN.EXIT', Enabled, Property_True);
End If;
End; Upd-mod: add code tags
[Updated on: Wed, 14 December 2005 22:54] by Moderator Report message to a moderator
|
|
|
|
| Re: Need some help in the login form [message #151718 is a reply to message #151192] |
Sun, 18 December 2005 10:49   |
qewani
Messages: 51 Registered: December 2005 Location: uaq
|
Member |
|
|
the code whish u gave me is ok while compiling it>>no errors when i compile it .....but when i run the form this masseage appears for me ....so where is the problem...
this is the pic for the form and the error on it

please
please
help me fixing it?!?!?!?
-
Attachment: 11.GIF
(Size: 52.23KB, Downloaded 2503 times)
[Updated on: Mon, 19 December 2005 05:58] Report message to a moderator
|
|
|
|
| Re: Need some help in the login form [message #151738 is a reply to message #151192] |
Sun, 18 December 2005 21:02   |
Scarlet.Zhu
Messages: 22 Registered: December 2005 Location: Shanghai
|
Junior Member |
|
|
ORA-01001 invalid cursor
Cause Either a host language program call specified an invalid cursor or the values of the AREASIZE and MAXOPENCURSORS options in the precompiler command were too small. All cursors must be opened using the OOPEN call before being referenced in any of the following calls: SQL, DESCRIBE, NAME, DEFINE, BIND, EXEC, FETCH, and CLOSE. The Logon Data Area (LDA) must be defined by using OLON or OLOGON. If the LDA is not defined, this message is issued for the following calls: OPEN, COM, CON, ROL, and LOGOFF.
Action Check the erroneous call statement. Specify a correct LDA area or open the cursor as required. If there is no problem with the cursor, it may be necessary to increase the AREASIZE and MAXOPENCURSORS options before precompiling.
fact:
PL/SQL 9 ,PL/SQL 8 ,PL/SQL 7
ORA-01001 results
symptom:
Preparing a cursor in a function, but executing it in another
1>. Prepare cursor in a function
2>. A function is called that opens the cursor and does a fetch.
3>. The function in step 2 is called again to do another fetch
and ORA-01001 results
cause:
What happened is that between calls to the function that does
the fetch the cursor cache is overwritten and the prepared
statement is being lost.
Workaround:
put the prepare, open, and fetch statements in one function.
Hi Qewani,
look at the code as below:(Whats wrong?)
Loop
Fetch Login
Into Dummy1, Dummy2;
Exit When Login%Notfound;
End Loop;
Have you ever found we lost it:
open Login
。。。
close login;
[Updated on: Sun, 18 December 2005 21:14] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Need some help in the login form [message #244846 is a reply to message #244219] |
Thu, 14 June 2007 05:43   |
zafarkarachi
Messages: 29 Registered: November 2006 Location: Karachi Pakistan
|
Junior Member |
|
|
Hi Lakshmi and all others
You need to create a text item in your form with
the initial value to 1 for counting.
then use the following code at login button.
I have used parameterlist to call another report
in this file.
Zafar Iqbal
Remember me
0321-2876518
declare
check_user date;
begin
select lock_date
into check_user
from mail_users
where username = :usr
and password = :pwd;
if check_user is not null then
message('Sorry User is Locked...');
exit_form;
else
message('Password is Ok...');
end if;
exception
when others then
message('..');
end;
declare
cursor logon_cursor is
select username
from mail_users
where username = :usr
and password = :pwd;
logon_row logon_cursor%rowtype;
begin
open logon_cursor;
fetch logon_cursor into logon_row;
if logon_cursor%found then
message('Password is Ok...');
declare
PLID PARAMLIST;
BEGIN
PLID :=CREATE_PARAMETER_LIST('mylist');
add_parameter(PLID,'username',text_parameter,:usr);
add_parameter(PLID,'PARAMFORM',text_parameter,'NO');
run_product(reports,'c:\EMAIL\user_mails.rep',synchronous,runtime,filesystem,PLID);
destroy_parameter_list(PLID);
END;
else
message('User not found...');
:usr :=' ';
:pwd :=' ';
go_item('usr');
:loop_count := :loop_count + 1;
if :loop_count>=4 then
exit_form(no_validate);
end if;
end if;
end;
|
|
|
|
|
|
|
|