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

Tracking user logins for a web app

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

    Tracking user logins for a web app

    If you want to track some basic info on who is trying to log in to your web apps, you can use the tracking function that Alpha has already included in the Web Security system. Using this feature allows you to see what IP addresses are trying to login, if a given IP is always failing, then perhaps it is a hacker and you can block that IP. Or maybe a user is having trouble, then you see that pattern and of course, you can do other analysis of the data.

    In the Web Security Settings, under Login Options, check the "Login activity file" box. Then you have the option to save the login file to data folder, project data folder or a user defined function. The first 2 options work, but it saves the info in a text file in the respective data folder, meaning that you have to import the data into something else to do analysis. Consider using the 'User Defined Function'. Then the data is saved in a table, making the analysis much easier.

    Be sure to check the next 2 boxes, 'Login activity include failed' and 'Login activity include logout' so you have more complete trail of login's.

    Oh yeah, don't forget to publish the security files when you are done....

    I implemented this is in our system to do the tracking in a MySQL table.

    Here is the MySQL code to create the table:
    CREATE TABLE `login_log` (
    `ID` int(11) NOT NULL AUTO_INCREMENT,
    `USERID` varchar(20) DEFAULT NULL,
    `ACTION_TIME` datetime DEFAULT NULL,
    `IP` varchar(20) DEFAULT NULL,
    `PASSEXP` datetime DEFAULT NULL,
    `LOGINEXP` datetime DEFAULT NULL,
    `LOGINERROR` varchar(50) DEFAULT NULL,
    `LOGOUT` tinyint(1) DEFAULT NULL,
    `ULINK` varchar(40) DEFAULT NULL,
    PRIMARY KEY (`ID`)
    ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;


    Here is the code to place in the user defined function on the web security settings:

    dim cn as sql::Connection
    dim args as sql::Arguments

    args.set("userid",e.userid)
    args.set("action_time",now())
    args.set("ulink",e.ulink)
    args.set("passexp",e.passexp)
    args.set("loginexp",e.loginexp)
    args.set("loginerror",e.loginerror)
    args.set("ip",e.ip)
    args.set("logout",e.logout)

    sqlinsert = <<%A%
    insert into login_log
    (
    userid,
    action_time,
    ulink,
    passexp,
    loginexp,
    loginerror,
    ip,
    logout

    )
    values
    (
    :userid,
    :action_time,
    :ulink,
    :passexp,
    :loginexp,
    :loginerror,
    :ip,
    :logout
    )
    %A%
    cn_open = cn.open("your connection string")
    cn_exec = cn.execute(sqlinsert, args)

    cn.FreeResult()
    cn.Close()

    Mike
    Mike Reed
    Phoenix, AZ

    #2
    Re: Tracking user logins for a web app

    Thank you. Very useful.
    Cheers,
    Javier

    Comment


      #3
      Re: Tracking user logins for a web app

      Not sure what the deal is but the code won't fire.
      Creating Healthcare Work-Flow Solutions Since 2005

      Comment


        #4
        Re: Tracking user logins for a web app

        Hi,
        I'm sorry you are having trouble. Here are screen prints of the settings I have. I'm not sure what else to tell you.
        Attached Files
        Last edited by Mike Reed; 08-28-2013, 02:02 PM.
        Mike Reed
        Phoenix, AZ

        Comment


          #5
          Re: Tracking user logins for a web app

          Thank you Mike. Works great.

          Omar, I used the code exactly how Mike provided except the connection string. I used this:
          cn_open = cn.open("::Name::MyConString")
          So it may be that. Make sure your using the correct connection string.
          I once worked on an issue for days before I finally realized I was using a connection string for another app.

          -JR
          J.R.
          Epigate Software, LLC.

          [email protected]
          http://www.epigate.com
          sigpic

          Comment


            #6
            Re: Tracking user logins for a web app

            Mike
            I'm trying to duplicate your log tracking and I have done everything and have one question.
            For "Security Table Type" does it matter if it's DBF? Or does it need to be SQL.
            I know the log activity table I created is SQL
            But my users, groups, assignment, passwords are all still DBF tables.
            I have read concerning stories about converting these to SQL and would prefer not to do that unless I have to
            Thanks
            Tony

            Comment


              #7
              Re: Tracking user logins for a web app

              The script is written to save the log tracking to a sql table. I don't believe it makes any difference if the actual tables for the security system are dbf or sql.

              Just an FYI, switching from dbf to sql tables for the security works fine. The tools Alpha provided helped and works quite well. I didn't really have any issues. Just took a little time and patience.

              Mike
              Mike Reed
              Phoenix, AZ

              Comment


                #8
                Re: Tracking user logins for a web app

                I realize that this is an older thread but am hopeful that someone will be able to address my problem.
                I've added the code attached and created the table. All seem to be correct but nothing happens.
                This is exactly what I need to do but cannot get it right. I've no doubt its something I'm doing wrong but clueless as to what.

                One difference is MariaDB with HeidiSQL as the front end. I can't think how this would matter but my knowledge of databases is weak. The table created perfectly and appears to work as it should. My problem might be my connection string, also attached, but I've tried it with every combination I know, which again is weak.

                Also, I'm not using the built-in login on the page. I have a login component. Not sure if or how that matters.

                Thank you for any help!


                Code.jpg
                Attached Files

                Comment


                  #9
                  Re: Tracking user logins for a web app

                  The problem I think is with your cn_open = cn.open() command.

                  The format needs to be like this: cn.open(“::Name::SalesToolsDB”)
                  Mike Reed
                  Phoenix, AZ

                  Comment


                    #10
                    Re: Tracking user logins for a web app

                    First of all, I can't tell you how much I appreciate you responding.
                    I also thought that was where the problem was and do think it was incorrect but unfortunately that didn't fix it so I must have a problem elsewhere.

                    Does it matter that I use a login page component verses the Alpha login option on Tabbedui pages? I wasn't sure if this made a difference or not.

                    Comment


                      #11
                      Re: Tracking user logins for a web app

                      Well, then...

                      A couple more things to check then.

                      First put a debug statement in the function and run it to make no errors are occurring, especially check the the cn_open and cn_exec commands are returning True.
                      If the cn_open is false, then something else is wrong with your connection to the server. If that doesn't open then obviously nothing else will work.

                      If the cn_open returns true, but cn_exec is false, then a couple more things to check are:
                      Is the data you are trying to insert in the table match the field element type? In other words are you trying to put characters into a decimal field or into a timedate field?
                      Is the data a null value but the does the field in your table require a value?

                      Mike
                      Mike Reed
                      Phoenix, AZ

                      Comment


                        #12
                        Re: Tracking user logins for a web app

                        I'm assuming debug(1) needs to be put in the User Function section under login options. But nothing shows up.

                        As for the table field elements not matching, I used the ones in your example and haven't changed those at all.

                        Comment


                          #13
                          Re: Tracking user logins for a web app

                          OK. My apologies. Come to find out its been working and I could not tell. I have no clue why but it only adds external emails addresses. In other words, company users (myself included) will not show up.



                          (later that day). I now know why it would not show some users. User id length. lol

                          Thank you again for help with this.
                          Last edited by Cygnux; 08-15-2017, 05:08 PM.

                          Comment


                            #14
                            Re: Tracking user logins for a web app

                            Glad it is working for you. Have a great day!
                            Mike Reed
                            Phoenix, AZ

                            Comment

                            Working...
                            X