Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Login App Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Login App Help

    First I need to say, I am not an xBasic programmer. However, I have used A5 since A4 and can create the DB and applications. I am trying to put an application on A5-Online and have the basic db up there and it's working. It will be a simple membership database. Here is what I need help for now, from anyone who is willing to walk me through it...

    I want to be able to have the individual member's record so that ONLY that member and an admin can change the record. Others can view the record and the complete "roster" (browse).

    I assume the following:
    I need a db that has user login and password.
    That a lookup is required and a session variable set

    I have read the "login_app" info in the help material, but it is confusing to me.

    Can anyone point me to something I can "cut and paste" or walk me through the pieces that I need to plug into an existing example? I would be most appreciative. Once I see what needs to be done I can usually get a handle on it.

    Thanks for helping the old guy!
    Gary

    #2
    RE: Login App Help

    Gary, try search within this forum first, there are many example and read it carefully ok, using dialog component u can create login page and please do attention at "validate" and "after validate".

    Comment


      #3
      RE: Login App Help

      I don't think you are going to be able to create one grid where UserA+Admin can update their record, but no one else, and then ditto for UserB, etc.

      --------------
      For a "demo" of what I am about to describe, go to http://support.attorneystrust.com:81. How I construct the DEMO vs a legitimate user is the same as this.
      --------------

      First your menu might look like this:

      ...
      View Members
      Update Your Member Record
      ...

      View Members opens an A5W page that displays all members in a browse-style grid.

      Update Your Member Record opens an A5W page with just one record, the member who logged in (whose ID you captured during login in a session variable). This grid has update properties.

      That second menu item only lets the logged-in member update their record. The first menu item can be constructed so that Members can only view, but Admin can update. Here's how:

      Create two Membership grids, one with view-only, one with update properties. I'll call them MembersView and MembersAdmin.

      Create an A5W page that displays the appropriate Member grid depending on if that person is Admin or a common Member. For that, add this to your A5W page:

      if session.IdAdmin = "yes" then
      tmpl_membership = a5w_load_component("MembersAdmin"
      else
      tmpl_membership = a5w_load_component("MembersView")
      end if

      You'd have set the IsAdmin variable to "yes" via a lookup to the Membership table to see if this person is an Admin (however you want to do that).

      Steve Wood
      See my profile on IADN

      Comment


        #4
        RE: Login App Help

        Steve...
        This looks extremely close to what I am looking for. I will have to study and then figure out the stuff behind the scenes as to what is happening. If I get into trouble, are you available on a fee basis for the coding questions? I have to have this done by 3/31/05. Thanks and I will be back to you. If you like, contact me offline at [email protected]

        Gary

        Comment


          #5
          RE: Login App Help

          Gary;

          Glad to help either way. Discussion here in the forum helps everyone. I might post some "solution" to you and someone else may show us both a better way.
          Steve Wood
          See my profile on IADN

          Comment


            #6
            RE: Login App Help

            heya there Steve Wood,

            i already visit your sample website, its pretty good, i`m interesting about your login page and when user login can display "Logged in: ATS Demonstration (Steve Wood)", i thinking about session variable but i do not understand much about it, how do i create new session variable? base on login name can view thier name at the same table ie: usernames.dbf, i`m confused how to create new session? or just change current session? and every page of a5w must have it?

            i already done with login and passwd page, and its ok, just want to know more about it.

            Because you already have ur sample website with all what i need to know, i think u have the answer :) If u have time to reply me, i really appreciate it.

            Regards.

            Comment


              #7
              RE: Login App Help

              Imran;

              Here is the a5 code where it shows who is logged in:

              IF eval_valid("session.FlagIsLoggedIn") THEN
              ? alltrim(lookup(""ADB_Path"\customers","Customer_id = \""+session.customer_id + chr(34),"Firm"))
              END IF

              Need the eval_valid() so that it does not show anything if the person is not logged in (and because the customer_id session variable does not exist if no one is logged in, which would cause an error).

              Above, my Customers table is the same as your idea on username.dbf, and Firm is the company name.

              On creating sessions - you don't need to worry about that at all, A5 will create/close sessions as needed.
              Steve Wood
              See my profile on IADN

              Comment


                #8
                RE: Login App Help

                Thanks Steve Wood,

                Ooo... now i understand...

                i`m appreciate that :)

                regards.

                Comment


                  #9
                  RE: Login App Help

                  Hi Steve Wood,

                  i`m trying using ur code to display user_name when login, i got this

                  500 Internal Server Error
                  Script Error
                  Error:Script: /it_menu.a5w line:8
                  ? alltrim(lookup(""ADB_Path"\user_names","user_name = \""+session
                  session.user_name subelement not found.

                  my script like this:
                  IF eval_valid("session.FlagIsLoggedIn") THEN
                  ? alltrim(lookup("(""ADB_Path"\user_names","user_name = \""+session.user_name + chr(30),"Namastaff"))
                  END IF

                  what is that mean by sublement not found?

                  Regards

                  Comment


                    #10
                    RE: Login App Help

                    session.user_name subelement not found.
                    is a fancy way of saying session.user_name does not exist at the moment that page is opened.

                    On the same page I have that lookup code, earlier I have

                    '-- set session vars --
                    session.user_name = ""

                    That code declares the variable and so it 'exists' when called by the lookup.
                    Steve Wood
                    See my profile on IADN

                    Comment


                      #11
                      RE: Login App Help

                      done.

                      and its working.

                      thanks Steve Wood

                      Regards

                      Comment


                        #12
                        RE: Login App Help

                        Steve Wood,

                        i got this error when adding that variable:

                        Script Error
                        Error:Script: /felda/menu.a5w line:10
                        ? alltrim(lookup(""ADB_Path"\felda_user","user_name = \""+session
                        error: lookup("ADB_Path"\felda_user,user_name = "(,NAMASTAFF) Expected value

                        sory too many question :|

                        Comment


                          #13
                          RE: Login App Help

                          Difficult to debug parts of code; but it looks like you have an coma just before NAMASTAFF. Expected Value means some parameter is missing, or ill formed, within your function (in this case, the lookup function.)
                          Steve Wood
                          See my profile on IADN

                          Comment


                            #14
                            RE: Login App Help

                            hi Steve Wood,

                            let me explain my web page looks like

                            Page num:
                            1. login page(dialog) ----"
                            2. Main menu(dialog) ---"
                            3. menu1 (grid)
                            4. menu2 (grid)
                            5. menu3 (grid)


                            so i must insert your code within login page or all of them?
                            sry i`m little confused here on login page, let say login.a5w i have 2 validation, "validate" and "after validate"

                            "validate"
                            dim user_name as c
                            if user_name = "" .or. password = "" then
                            currentform.has_error = .t.
                            currentform.error_message = "User name or password cannot be blank."
                            else
                            dim correct_password as c
                            correct_password = lookup(""ADB path"\user_names","user_name="+quote(user_name),"password")
                            if correct_password "" password then
                            currentform.has_error = .t.
                            currentform.error_message = "Invalid user name or password."
                            end if
                            end if

                            "after validate"
                            if eval_valid("session.targetUrl") then
                            if session.targetURL "" "" then
                            Currentform.RedirectTarget = session.targetURL
                            else
                            currentform.redirectTarget = "main.a5w"
                            end if
                            else
                            currentform.redirectTarget = "main.a5w"
                            end if

                            session.FlagIsLoggedIn = .t.

                            i`ve confused to put ur code inside dialog validation properties or just put into .a5w page manually? each page or at login page?

                            I really want to understand this situation, because i want to create web app with user level and capture username at login page, so its possible that we can protect every .a5w page with permission level it can depends on username or userlevel. what u think?

                            can u paste sample code for your login page? so i can reveiew it for future use, i hope u dont mind to share with others :)

                            best regards.

                            Comment


                              #15
                              RE: Login App Help

                              If by 'my code' you mean that line from post 2050, not it would go on one page. I have that statement on my header.a5w page where it first has to use the variable in a lookup.

                              But lets take a look at something else first. From your example and various snippets of code, I see where you refer to a variable as 'session.abc' and later as just 'abc'. You need to be sure you have those correct. You need to look first at your login dialog and note if the controls are set as session or local variables. If session, then make sure everywhere you refer to that variable, it says 'session.abc', otherwise just 'abc'. I found that to be my problem 9/10th of the time. That and naming something my_var, but referring to it as myvar.
                              And don't foget, I'm not an expert, I just plug away at it and am learning along with you.
                              Steve Wood
                              See my profile on IADN

                              Comment

                              Working...
                              X