Track login dates of users

Hello,
I have an index page with two fields (username and password). The form uses the login server behavior of Dreamweaver CS4.
I use php and mysql.
I would like to add a record called "lastlogin" to my "members" table that will be updated with the current date every time someone logs on using the login form on my index page.
How can I achieve this?
Thank you.

On my index.php page I guess I need something like this:
mysql_query("UPDATE members SET lastlogin='" . time() . "' WHERE username='{$username}' LIMIT 1");
Not sure where I should place it though? Can someone assist?  Here is my index.php code:
<?php require_once(connect.php); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  return $theValue;
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
if (isset($_POST['username'])) {
  $loginUsername=$_POST['username'];
  $password=$_POST['password'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "account.php";
  $MM_redirectLoginFailed = "index.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_connectDB, $connectDB);
  $LoginRS__query=sprintf("SELECT username, password FROM members WHERE username=%s AND password=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  $LoginRS = mysql_query($LoginRS__query, $connectDB) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;         
    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];     
    header("Location: " . $MM_redirectLoginSuccess );
  else {
    header("Location: ". $MM_redirectLoginFailed );
?>

Similar Messages

  • Last Login date of user

    Hi,
    Can anybody please tell the data dictionary table to get the Last Login date of users.

    No such data dictionary available for login date and timestamp.
    You can go for logon triggers. Search in Oracle Documentations/in this forums/google, for samples/examples.
    Regards,
    Sabdar Syed.

  • Portal Acitivty report to track Last login date of user

    Hi,
    We need a report which shows the last logins of Users in Portal.  We checked the Portal Activity Report but it is showing only First login.  But we need the Last login how can I configure the Portal Activity report.
    Thanks
    Naveen.

    Hi All,
    Just in case Activity Collector or Portal Activity Report is not sufficient for you and your portal management to gather important usage data, you may be interested in our SAP certified solution, Click Stream.
    May make your life a lot easier when finding the usage stats you need (Easy installation u2013 Free download u2013 Fully functional test version available).
    More information here:
    Website: [www.sweetlets.com/clickstream|http://www.sweetlets.com/clickstream]
    EcoHub reviews: [http://ecohub.sdn.sap.com/irj/ecohub/solutions/clickstream|http://ecohub.sdn.sap.com/irj/ecohub/solutions/clickstream]
    Good luck and hope that helped.

  • Hi all, can someone help me in getting last login date of a user in CQ5 please?

    Hi all, can someone help me in getting last login date of a user in CQ5 please?

    CQ is REST based and does not have the concept of session. So there is no feature to track login or logout details.  Most of our customers use some kind of central authentication Ex- SSO hence no need arises to have such functionality built in.  However if needed you have the ability to implement such at a project level solution. Ex:- custom login modules or auth-handler by taking project specific constraints and requirements into account

  • Is there a way to audit user accounts by last login date/time?

    Hello all,
    Is there a way to see or report on a user's last login.  I don't see a last login date parameter in the UM record.  I see that all security events are logged in the security log including logon and logoff, but what I need is to be able to produce a report that provides all user accounts which have not been logged on to since a specified date or # of days, i.e. since 01/01/2008 or >180 days.
    Any clues or guidance is appreciated.
    Regards,
    Paul

    Is there a SAP / Portal standard way of accessing this information?
    Our authorisations team have asked me to get them such a report, and I can't find anything on the portal (NW2004) that would give this information. I don't think the basis guys would be terribly chuffed to provide access directly to the database. If this (database access) is the only way, then I suppose a custom developed app could be created and deployed to the portal, but I would have thought this is a reasonalby sensible report so would be standard content somewhere.
    Cheers,
    Andrew

  • Can you export the date and user to Excel that appears into a Comments field in a tracking list?

    Hi everyone,
    Can you export the date and user to Excel that appears into a Comments field in a tracking list?
    When i export a tracking list with a Comment field in the Content type, the screen where you enter the data for an item, the Comments field just export the text of the comment into the Excel file.
    In the Comments field appears also, besides the comment text,  the user and date from who and when the comment is added.
    Is there a way to export also the user and the date?
    Thanks
    Wim

    create another comment field that doesn't use 'appending', and through SP Designer change workflow keep
    updating that field with the new comments  (prepend the field with date/username/new comment). Hide the field on all forms, but put it in the view you need to export to Excel.
    Please refer few more links: Hope they will help
    http://www.nothingbutsharepoint.com/2009/04/16/versioning-append-changes-to-existing-text-view-entries-aspx/
    http://sympmarc.com/2011/02/07/showing-all-versions-of-append-changes-to-existing-text-in-a-data-view-web-part-dvwp/comment-page-3/
    https://mossipqueen.wordpress.com/2013/03/06/display-all-appending-field-entries-in-a-single-list-view/
    http://community.office365.com/en-us/f/154/t/278560.aspx
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • Exception Message: The form cannot connect to the data source. Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

    When opening a form in SharePoint 12013 that was created from Infopath 2013, I get the following error.
    You do not have permissions to access a database that contains data required for this form to function correctly.
    An entry has been added to the Windows event log of the server.
    Log ID:5566
    When I go to the log files on the SharePoint server. I see the following error.
    Exception Message: The form cannot connect to the data source. Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
    I am guessing this has something to do with the UDCX connection and the database.
    Can anyone help me get this fixed?

    Hi Jim,
    Please check the following kb article when it occurs 5566errro with the UDCX conection file, try the method of using the Secure Store Service to store alternate credentials for the data connection method, or the method of stating the credentials
    in the UDC file explicitly.
    Also check if it could help with setting sql server as "SQL Server and Windows Authentication mode".
    http://support.microsoft.com/kb/981684
    Thanks
    Daniel Yang
    TechNet Community Support

  • Last user login date

    Hi
    We use our DS as an authentication service. We have a business requirement whereby if a given user does not authenticate through LDAP after period of inactivity to suspend the
    User�s account and subject user to password reset.
    H
    ow do you retrieve a user's last login date?
    The two viable solutions are not pretty: 1) requiring all client applications to update a user attribute "last_logon_date" or 2) using a scheduled script to mine the audit logs.
    Any additional solution?
    Regards
    Bob

    Correct.
    For Directory Server 5.x, it can implemented as a custom plug-in.
    I am not aware of any implementation of such plug-in though.
    Ludovic.

  • Login Date/time & Logout Date/time of User in apex

    Hi,
    Is there any apex internal table/view where I can get the Login Date/time & Logout Date/time per user ?
    Regards,
    Benz

    Benz wrote:
    Is there any apex internal table/view where I can get the Login Date/time & Logout Date/time per user ?No APEX version = no definitive answer...
    APEX 4.1 offers:
    <li><tt>APEX_WORKSPACE_ACTIVITY_LOG</tt>
    <li><tt>APEX_WORKSPACE_ACCESS_LOG</tt>
    Access these through Home > Application Builder > Application > Utilities > Application Express Views
    See: Creating Custom Activity Reports Using APEX_ACTIVITY_LOG
    Note that the underlying logs are purged on a regular basis, so for the long term you need to copy the data to your own tables.
    Home > Administration > Monitor Activity provides reports based on this data.
    APEX 3.0 has Home> Application Builder > Application > Application Reports > Activity > Page Views by Session which is probably closest to what you're looking for. Can't find this so far in APEX 4.x: presumably superseded by the Home > Administration > Monitor Activity > Page Views > By Interactive Report option?
    Note however that the concensus among the wise is that accurate "logout" statistics with APEX (or any browser-based system) is impossible. How many users actually logout using using a method that triggers a capturable event at the actual time they stop using the system? How many are going to close the current browser tab? Or the entire browser window? Or press Cmd-Q? Or click a bookmark for a different location? Or type "p0rn" into the Search box? Or switch to another window and spend the rest of the morning reading Twitter? Or shutdown the machine? Or run out of battery power? Or lose their wifi connection? Or get timed-out during the fire drill? Or go home for the night after locking their PC with everything still running? Or...

  • System.Data.SqlClient.SqlException: Cannot open database "MSCRM_CONFIG" requested by the login. The login failed. Login failed for user 'NT AUTHORITY\SYSTEM

    Dear ALL 
    After successfully shifting the CRM from 2011 to 2013 i found a problem in Reporting section none of the report is working after some finding i conclude that MSCRM_FetchDataSource is not able to connect successfully 
    Through my report manager i tried to test the connection of MSCRM_FetchDataSource but i got the following error 
    System.Data.SqlClient.SqlException: Cannot open database "MSCRM_CONFIG" requested by the login. The login failed. Login failed for
    user 'NT AUTHORITY\SYSTEM'. 
    I already add the NT Authority \ System as a db_owner under my database user of MSCRM_CONFIG
    But still no success any one have any idea why it's happaning 
    Regards 
    RB

    I found a solution I hope my post will help other
    I gave the  db_owner to 'NT AUTHORITY\SYSTEM' and 'NT AUTHORITY\NETWORK' and assigned with both CRM and Config database
    It resolved my issue
    RB

  • Last login date of a deleted user

    Hi there,
    Could you please let me know how to find the last login date of a deleted user in the SAP.
    Thanks
    Amit.

    Hi Bernhard,
    Thanks a ton for the reply.
    you are correct that they you cannot get the details of a deleted user from USR02 but they are ways in which you can still find the last login date of a deleted user.
    One of the ways is using of transaction SUIM but i have no idea why this is not working in my system.
    Anyways if you can find any relevant detail please let me know.
    Regards
    Amit

  • How to find login Date of a user

    Hi,
    Can someone please tell me how to find the date when a user logged into the messaging server.
    What i am actually trying to do is as follows : I wan't to disable the account of a user if he does not access his mailbox for some time period.
    The login date & time of a user can be seen from the logs but is there some other place/file where this is available?
    Regards,
    Shveta.

    The logs are the only place where this information is available, currently. We are going to address this in a future release of the mail server. I can't provide detailed specifics, but know that things will get better in future versions.
    Regards,
    Chad

  • How to get last login date of the user

    Hi,
    I have an application where i need the last login date of the user and if the differance between the last login date and the system date is greater than a certain range the user account should be locked automatically.Please suggest me how resolve the problem as early as possible.
    Thanks and Regards
    Aniruddha

    Hi,
    We have faced the same issue earlier. Some attributes are available in SAP API, but they are depricated by sap due to some performance issue.
    Below solution will be helpful:
    So we have implmented custom code in our application. We have developed one webdynpro application which will retrieve update & retrieve logon time from portal database(custom table). And we have integrated this application in desktop inner page. So this application will be invisible to the user and will executed first time when user logs into the portal.
    Regards,
    Charan

  • Hyperion Planning Last Login Date

    Hello Everyone,
    I have a requirement where in I need to track the usage of the Hyperion Planning application. I need to build a list of inactive or dormant users and clean them up from the application.
    In order for me to achieve this, I need the Last Login date into the Hyperion Planning application.
    I read about something called Usage Tracking that needed to be turned on. A records gets added into the hsp_audit_records table.
    Can someone throw some more light on this ? My requirement is to track the planning apps usage and clean up inactive users.
    Thanks
    RS

    Hi,
    we have the same issue: some new users every week and a lot of users not using planning anymore- depending on their always changing role in the company.
    only helpful logfile we use to identify inactive/old users is: hbrlaunch.log - it logs the username and the businessrules, they execute.
    maybe you regard this approach as a helpful workaround (provided your users run businessrules at all)
    users, who run only financial reporting or who open only planning forms to passively review budgets (we have that a lot) , we would delete accidentially by this approach, because if you never save data, you never execute a businessrule attached to a webform.
    but what about following approach:
    you create a very small webform called "Confirm my user access", add a very small businessrule named "Confirm user access", which calculates almost nothing and you attach the rule to the form, give access to all users AND use option: "run on load"
    by this, the rule get's executed on opening the webform already - you could even show a member in the webform with name "Thanks for confirming your user account - it will remain active"
    Only disadvantage: you need to write a mail to all users and explicitly ask them to open that webform and confirm the user access. (Maybe you like that approach)
    Alternative might me that you attach the businessrule to the/those webform(s) - especially read-only webforms, where people don't save data or execute businessrules and which are opened most often by all users and don't tell them about that method at all.
    You then should get a pretty complete overview of your active users (userid's only I am afraid ) in hbrlaunch.log
    in addition, financial reporting has a logfile as well, so you could combine the usage of financial reporting and planning (provided you use it)
    pls. note, that the early 9.3.1 financial reporting versions have a bug and the logfile is empty= useless
    Assuming you use shared services, you probably have to attach your users into several groups- it maybe helpful to first remove the user from one central group, which blocks their access to planning application or takes the right to open planning forms- you then start your forecast, wait for their complaints and delete them 3 months later completely from all security groups - could save you some work on re-creating their access.
    We use the apache http-webserver - you can modify it, so that it's logging all datatransfer - you get there the IP-Adress and the requested application (Hyperion Planning) and the requested webforms logged - but no username.
    In the eas console, we see the last logindate, which seems to show the last date, a user requested a financial report against essbase.
    We use that information in combination with hbrlaunch.log form businessrules.
    we have the hsp_audit_trail switched on for all options-
    data: it stores all member, user and time information for every single saved value in the database - so we have between 500.000 and 1 Mio entries - it's especially useful, when your essbase crashes and your backup is a few hours old- you then can use that information to upload the remaining data-entries via smartview/exceladdin - provided you have some hours time to prepare the values in excel.
    hspaudittrail useful as well when it comes to discussion, who entered which numbers when.
    tracking of businessrule execution: should deliver same results as hbrlaunch.log
    other changes being tracked should be meaningless for your requirement, as it tracks the work of the admin-person (Dimensions, Members, Usergroups, Webforms)
    regards
    Rodian
    Edited by: Rodian Abel on 01-Apr-2010 12:20
    Edited by: Rodian Abel on 01-Apr-2010 12:33

  • Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection

    "[DBNETLIB] Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection"
    After patches applied on patch Tuesday the database reports the above error. 
    All accounts are domain accounts and SQLServer uses Windows auth.
    DCDIAG show no errors
    All servers and DC have been restarted,
    Message in db log confirms the connection is being denied due to trust.
    Event log shows same rejection
    Protocols enabled: named pipes, tcpip, memory
    TESTS:
    PortQry: "
    TCP port 1433 (ms-sql-s service): LISTENING"
    Connect with domain admin accounts works from multiple clients systems to DB.
    Cannot connect with newly created domain admin account
    Can connect if new admin account connect to server in terminal server session and uses UDL wizard or any other tool including isql.
    New standard user also fails to connect.
    NOTES:
    I removed the SSL patch and the IE security update to see if that was an issue.
    ¯\_(ツ)_/¯

    Has someone left the company or has an account of some nature been dropped/replaced?
    Please click "Mark As Answer" if my post helped. Tony C.
    Hi Tony,
    Srry but No.  We just installed the monthly updates.
    I went back and found I had missed removing a patch.  I missed the rollup for Windows Server 2003:
    Event Type: Information
    Event Source: NtServicePack
    Event Category: None
    Event ID: 4382
    Date:  3/12/2015
    Time:  12:26:04 PM
    User:  NETTEST\admin
    Computer: DATA1
    Description:
    Windows Server 2003 KB954920 was removed from your computer, and the previous Windows Server 2003 configuration was restored.
    After I removed that is still didn't work but after about five minutes it started working.
    I guess I ned to report that to MS after I research what might be changed to make the patch work.
    Every time I get stuck and ask for help it seems to be just before I stumble on the solution.
    Thanks for replying.
    Well - maybe this will help someone else.
    Thanks again for replying Tony
    ¯\_(ツ)_/¯

Maybe you are looking for

  • How can I unintstall Firefox 7 and go back to 6?

    I have downloaded Firefox 7 because it said to upgrade. Well and good, but now my Norton Security Safe (Norton Toolbar) which has all my passwords no longer works. How can I get this back? It doesn't show up at all and I am having to check in to all

  • OAS 10.1.3 preview - Unable to launch em

    After installing OAS 10.1.3 preview, I am unable to launch em. I am getting the following error 404 Not Found Resource /em not found on this server Surprising thing is when I try to launch the em console using 7200 port, I am able to get the console

  • Updating Oracle Certification, which exam I should pass?

    Hello, everyone, please can anybody advice me, regarding question in topic. My Solaris Administrator Certificate will expire in June, and Solaris Network Specialist in July, earlier in Sun there was one exam, for updating current certification. But n

  • Editing XML Database then saving

    I made a program which takes data from XML and stores it into columns on a datagrid. However the XML document is a static document which is premade. I have been trying to look everywhere for a way to save the document AFTER someone has edited it, thi

  • Will there be a security fix for my Mac ?

    Will there be a security fix for my iMac ?