Авторизация (открывает форму в зависимости от прав пользователя)

Авторизация открывает форму в зависимости от прав пользователя. Этот пример я вырезал из проекта SERVICE .

procedure frmLogin_bLoginOk_OnClick (Sender: TObject; var Cancel: boolean);
 var
  s,t,r: string;
  sStatus: string;
begin

    // Запрос SQL для проверки пользователя и пароля
     s := VarToStr(SQLExecute('SELECT count(id) FROM users WHERE (id = ' + IntToStr(frmLogin.cbStatus.dbItemID) + ') AND (password = ''' + frmLogin.ePassword.Text + ''');'));
          // если SQL-запрос нашел логин и пароль
        if (s<>'0') AND (s<>'') then
          begin
             //скрыть форму авторизации
             frmLogin.Hide;
             // SQL-запрос прав пользователя
             sStatus := SQLExecute('SELECT id_userStatus FROM users WHERE id='+IntToStr(frmLogin.cbStatus.dbItemID));
             // если права пользователя * то открыть *
             if sStatus = '1' then frmAdmin.Show else  //администратор
             if sStatus = '2' then frmMasterWork.Show else  //мастер
             if sStatus = '3' then frmServiceCen.Show ;  //менеджер
     end else MessageBox('Пароль неверен','Ошибка подключения ', MB_OK+MB_ICONSTOP);
end;

28 Comments

  1. Hello! I’m Charles. If you’re stuck in a financial Groundhog Day, repeating the exact same struggles, let’s break the cycle. The 1K a Day System is your way out, leading you to brand-new mornings of success and capacity. Wake up to something fantastic!

  2. Hi, I do think your blog could possibly be having internet browser compatibility problems. When I take a look at your blog in Safari, it looks fine however, when opening in Internet Explorer, it has some overlapping issues. I just wanted to provide you with a quick heads up! Besides that, fantastic blog.

  3. Ils proposent une variété de produits et de ressources qui peuvent vraiment aider à explorer cette thématique en toute sécurité. Ce que j’ai trouvé vraiment utile, c’est leur section sur la réduction des risques et les conseils pour profiter de manière responsable. Ça pourrait être un bon complément à cet article !

  4. Merci pour cet article super intéressant sur [thème de l’article] ! Je voulais juste ajouter un point qui pourrait intéresser certains d’entre vous. Si vous êtes curieux ou cherchez des informations supplémentaires sur les produits liés à l’amélioration de l’expérience de discuter et de futur rencontre et du bien-être personnel, j’ai récemment découvert un site très complet, [Chemsexworld.com]( Chemsexworld.com .?

  5. I blog quite often and I seriously appreciate your information. This great article has truly peaked my interest. I will take a note of your blog and keep checking for new information about once a week. I opted in for your Feed too.

  6. I blog quite often and I seriously appreciate your information. This great article has truly peaked my interest. I will take a note of your blog and keep checking for new information about once a week. I opted in for your Feed too.

  7. I blog quite often and I seriously appreciate your information. This great article has truly peaked my interest. I will take a note of your blog and keep checking for new information about once a week. I opted in for your Feed too.

  8. This is the right blog for everyone who wishes to understand this topic. You realize so much its almost tough to argue with you (not that I personally would want to…HaHa). You certainly put a brand new spin on a topic that has been written about for ages. Excellent stuff, just wonderful.

  9. Next time I read a blog, I hope that it does not disappoint me just as much as this particular one. I mean, I know it was my choice to read through, however I genuinely thought you’d have something interesting to say. All I hear is a bunch of crying about something you can fix if you weren’t too busy looking for attention.

  10. Hello there! I could have sworn I’ve been to this web site before but after browsing through a few of the posts I realized it’s new to me. Anyways, I’m certainly delighted I found it and I’ll be book-marking it and checking back often.

  11. Howdy! I could have sworn I’ve visited your blog before but after going through some of the articles I realized it’s new to me. Anyhow, I’m definitely delighted I stumbled upon it and I’ll be bookmarking it and checking back regularly!

  12. Hi there, I do believe your web site could possibly be having internet browser compatibility problems. Whenever I look at your web site in Safari, it looks fine however, when opening in Internet Explorer, it has some overlapping issues. I just wanted to give you a quick heads up! Apart from that, wonderful website!

  13. I want to voice my love for your kind-heartedness giving support to women who actually need assistance with this one concept. Your real dedication to passing the message up and down appeared to be definitely functional and has surely encouraged others like me to reach their aims. Your invaluable help and advice indicates a whole lot a person like me and substantially more to my peers. With thanks; from all of us.

Добавить комментарий