Home » Developer & Programmer » Forms » Need some help in the login form
Need some help in the login form [message #151192] Tue, 13 December 2005 11:36 Go to next message
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.
http://www.al7loh.com/uploader/uploads/login.JPG


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 #151225 is a reply to message #151192] Tue, 13 December 2005 17:43 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
What is the problem? What is this code not doing?

Perhaps you need a :
set_item_property('LOGIN.SHOW_MENU', NAVIGABLE, property_true);
after your current two 'set_item' lines.

David
Re: Need some help in the login form [message #151427 is a reply to message #151192] Wed, 14 December 2005 17:20 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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
http://www.orafaq.com/forum/fa/712/0/

please
please
help me fixing it?!?!?!?

  • Attachment: 11.GIF
    (Size: 52.23KB, Downloaded 1602 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 Go to previous messageGo to next message
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

icon14.gif  Re: Need some help in the login form [message #151812 is a reply to message #151192] Mon, 19 December 2005 05:56 Go to previous messageGo to next message
qewani
Messages: 51
Registered: December 2005
Location: uaq
Member

thank u it is working now
thanks very much
(*_*)
Re: Need some help in the login form [message #244042 is a reply to message #151192] Mon, 11 June 2007 07:41 Go to previous messageGo to next message
lakshmi surya ram
Messages: 188
Registered: June 2006
Location: HYDERABAD
Senior Member

Hi,
i am really confused where the error is?
can you please be more clear becoz for the code, i got the same error.

thanks in advance,
Surya
Re: Need some help in the login form [message #244219 is a reply to message #151192] Tue, 12 June 2007 01:24 Go to previous messageGo to next message
lakshmi surya ram
Messages: 188
Registered: June 2006
Location: HYDERABAD
Senior Member

Hi folks,
how can we go for the count(number tries) when a user logins.
Is that a text filed or do we need to put some property on?
thanks,
Surya
Re: Need some help in the login form [message #244807 is a reply to message #244219] Thu, 14 June 2007 02:53 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
You could always count into a global.

David
Re: Need some help in the login form [message #244846 is a reply to message #244219] Thu, 14 June 2007 05:43 Go to previous messageGo to next message
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;

Re: Need some help in the login form [message #245008 is a reply to message #244846] Thu, 14 June 2007 22:47 Go to previous messageGo to next message
lakshmi surya ram
Messages: 188
Registered: June 2006
Location: HYDERABAD
Senior Member

Thanks Zafar. Post my next efforts soon
Re: Need some help in the login form [message #245010 is a reply to message #245008] Thu, 14 June 2007 23:06 Go to previous message
zafarkarachi
Messages: 29
Registered: November 2006
Location: Karachi Pakistan
Junior Member
Hi Surya,

What type of Efforts do you need?

Zafar Iqbal
Remember me in you prays.
Previous Topic: Problem in Iconic button on 10g XE
Next Topic: how to establish oracle connectivity with visual basic???
Goto Forum:
  


Current Time: Sun Dec 04 14:57:59 CST 2016

Total time taken to generate the page: 0.12965 seconds