الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Need some help in the login form

مغلق
بدأه qewani في 13 ديسمبر 2005 · 4 رد · 755 مشاهدة · في قواعد بيانات Oracle
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

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.

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>>>

#2

وين الجماعة ....ارجوووووكم ساعدوني يا خبراء الاوراكل...........!!!

#3

salam mr.qewani ,

bout your code, i didn't try it cauze i have some problems with the (oracle) stored in my computer, need to reinstall it, so try this way and inform me what happens with u,

in the module, use triger WHEN_NEW_FORM_INSTANCE

:global.cnt := 0; //to declare a value for counting the #of tries

now you have to create a table for users and there passwards, let us name it users.

create table users ( with user_name, password) then insert some records.

on login button, use a trigger WHEN_BUTTON_PRESSED

declare

cursor c is

select * from users

where user_name = :login.user_name; //or as u named that text field

and password = :login.password;

rec c%rowtype;

y number;

begin

open c;

fetch c into rec;

y := gobal.cnt;

if c%found then

//do the next step, meaning show the screen you want,

else

y := y +1;

:global.cnt := y;

if y =3 then

exit form;

else message('invalid password or username......');

message('invalid password or username......');

end if;

end if;

close c;

end;

good luck,

#4

salam, i'll type the code again to be more clear, bout the trigger on login button:

declare
cursor c is
select * from users
where user_name = :login.user_name;    //or as you have named that text field
and password = :login.password;
rec c%rowtype;
y number;
begin
open c;
fetch c into rec;
y := global.cnt;
if c%found then
//do the next step, meaning go the next screen
else
y := y +1;
:global.cnt := y;
if y = 3 then
exit form;
else
message('invalid password or username.....');
message('invalid password or username.....');
end if;
end if;
close c;
end;
#5

thankx alot huda84

the code which u gave me is working

thnx for ur help

اللهم أجعله في ميزان حسناتج...

تسلمين وما قصرتي

في رعاية الرحمن

هذا الموضوع مغلق.

مواضيع مشابهة