I Love PHPMaker

... because it gets even more powerful and flexible!!

  • About
  • Terms and Conditions
  • Membership Options
  • Sitemap
  • Downloads
    • PHPMaker Extensions Download
    • PHPMaker Projects Download
    • PHP Report Maker Extensions Download
I Love PHPMaker » Customize Template » How to Save the Registered Date, Last Login, and Last Logout Date Time in User Profile of Website That Created by PHPMaker 8.0.3
How to Display Breadcrumb in Websites That Created With PHPMaker 8.0.3
How to Add the Ability of User Reactivation after Email is Changed in Website that Created with PHPMaker 8.0.3

November 6, 2011

How to Save the Registered Date, Last Login, and Last Logout Date Time in User Profile of Website That Created by PHPMaker 8.0.3

PHPMaker handles very good the important user profile information, such as: the last accessed date time, the login retry count, the last bad login date time, and the last password changed date, by saving them only in one field that generally called with UserProfile. For your information, you can use this UserProfile if you have activated the related field from the "Profile field (memo)" directive in your PHPMaker application -> Security -> Advanced Security -> User Login Options. By using this UserProfile field, you are able to retrieve those information above easily and quickly only from one field.

Unfortunately, PHPMaker has not included the other three important user profile information, yet; such as the last login date time, the last logout date time, and the registered date. I am sure you will also need this information so you will know when your users are registered, when your users the last time are logged in, and when your users are logged out in your website. This following modification will add this additional information by optimizing the existing UserProfile field. Imagine now, you are able to save any important user profile information into this UserProfile field only!

[hidepost]

  1. Open your /Script/ewcfg.php file, and find this code:

    // Email
    define("EW_EMAIL_COMPONENT", strtoupper("<!--##=PROJ.EmailComponent##-->"), TRUE);
    

    before the first line of that code, please insert this following code:

    // Begin of modification by Masino Sinaga, for saving the registered, last login, and last logout date time, November 6, 2011
    define("EW_USER_PROFILE_REGISTERED_DATE_TIME", "RegisteredDateTime", TRUE);
    define("EW_USER_PROFILE_LAST_LOGIN_DATE_TIME", "LastLoginDateTime", TRUE);
    define("EW_USER_PROFILE_LAST_LOGOUT_DATE_TIME", "LastLogoutDateTime", TRUE);
    // End of modification by Masino Sinaga, for saving the registered, last login, and last logout date time, November 6, 2011
    
  2. Open your /Script/phpfn.php file, and find this code:

    <!--## If bCheckLoginRetry Then ##-->
    		// Max login retry
    		$this->Profile[EW_USER_PROFILE_LOGIN_RETRY_COUNT] = 0;
    		$this->Profile[EW_USER_PROFILE_LAST_BAD_LOGIN_DATE_TIME] = "";
    <!--## End If ##-->
    

    after the last line of that code, please insert this following code:

    		// Begin of modification by Masino Sinaga, for saving the registered, last login, and last logout date time, November 6, 2011
    		$this->Profile[EW_USER_PROFILE_REGISTERED_DATE_TIME] = "";
    		$this->Profile[EW_USER_PROFILE_LAST_LOGIN_DATE_TIME] = "";
    		$this->Profile[EW_USER_PROFILE_LAST_LOGOUT_DATE_TIME] = "";
    		// End of modification by Masino Sinaga, for saving the registered, last login, and last logout date time, November 6, 2011
    
  3. Open your /Script/login.php file, and find this code:

    		<!--## If bCheckConcurrentUser Then ##-->
    			setcookie(EW_PROJECT_NAME . '[' . EW_USER_PROFILE_SESSION_ID . ']', session_id(), EW_COOKIE_EXPIRY_TIME); // Save current Session ID
    		<!--## End If ##-->
    
    

    after the last line of that code, please insert this following code:

    			// Begin of modification by Masino Sinaga, for saving the last login date time, November 6, 2011
    			$UserProfile->Profile[EW_USER_PROFILE_LAST_LOGIN_DATE_TIME] = ew_StdCurrentDateTime();
    			$UserProfile->SaveProfileToDatabase($this->Username);
    			// End of modification by Masino Sinaga, for saving the last login date time, November 6, 2011
    
  4. Open your /Script/logout.php file, and find this code:

    		$sUsername = $Security->CurrentUserName();
    

    after that line, please insert this following code:

    		// Begin of modification by Masino Sinaga, for saving the last logout date time, November 6, 2011
    		$UserProfile->Profile[EW_USER_PROFILE_LAST_LOGOUT_DATE_TIME] = ew_StdCurrentDateTime();
    		$UserProfile->SaveProfileToDatabase($sUsername);
    		// End of modification by Masino Sinaga, for saving the last logout date time, November 6, 2011
    
  5. Open your /Script/register.php file, and find this code:

            global $conn, $Security, $Language, $gsFormError, $objForm, $<!--##=gsTblVar##-->;
    

    then replace it with this following code:

            global $conn, $Security, $Language, $gsFormError, $objForm, $<!--##=gsTblVar##-->, $UserProfile;  // $UserProfile added by Masino Sinaga, November 6, 2011
    
  6. Still in the /Script/register.php file, find again this code:

            <!--## If PROJ.SecRegisterActivate Then ##-->
                            $this->setSuccessMessage($Language->Phrase("RegisterSuccessActivate")); // Activate success
    

    before the first line of that code, please insert this following code:

    						// Begin of modification by Masino Sinaga, for saving the registered date time, November 6, 2011
    						$UserProfile->Profile[EW_USER_PROFILE_REGISTERED_DATE_TIME] = ew_StdCurrentDateTime();
    						$UserProfile->SaveProfileToDatabase($<!--##=gsTblVar##-->->Username->CurrentValue);
    						// End of modification by Masino Sinaga, for saving the registered date time, November 6, 2011
    

[/hidepost]

Article by Masino Sinaga / Customize Template / last accessed date time, last bad login date time, last login date time, last logout date time, last password changed date, login retry count, PHPMaker 8.0.3, registered date, user profile, UserProfile 4 Comments

How to Display Breadcrumb in Websites That Created With PHPMaker 8.0.3
How to Add the Ability of User Reactivation after Email is Changed in Website that Created with PHPMaker 8.0.3

Comments

  1. Salem says

    March 4, 2012 at 10:25 pm

    I am getting this error:

    Undefined property: clogout::$Username in /Applications/MAMP/htdocs/gms.drc.dk/app/logout.php on line 205

    changing $UserProfile->SaveProfileToDatabase($this->Username);

    to

    $UserProfile->SaveProfileToDatabase($sUsername);

    seems to fix the problem. Can you please check?

    Log in to Reply
    • Salem says

      March 4, 2012 at 11:01 pm

      I get also this error on registration:

      Undefined property: cuser::$Username in /Applications/MAMP/htdocs/gms.drc.dk/app/register.php on line 792

      $UserProfile->SaveProfileToDatabase($employees->Username->CurrentValue);
      this seems problematic, also the name of my table is “user” not employees …

      Log in to Reply
      • Masino Sinaga says

        March 5, 2012 at 9:50 am

        Thanks. Already fixed it with the following code:

        $UserProfile->SaveProfileToDatabase($<!--##=gsTblVar##-->->Username->CurrentValue);
        
        Log in to Reply
    • Masino Sinaga says

      March 5, 2012 at 9:46 am

      Thanks for bringing this issue up. Already fixed it with the following code:

      $UserProfile->SaveProfileToDatabase($sUsername);
      
      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • A New PHPMaker 2025 Project File Is Released
  • PHPMaker 2025 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2025 Is Released!
  • A New PHPMaker 2024 Project File Is Released
  • PHPMaker 2024 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2024 Is Released!
  • PHPMakerProjects.com, For Those Who Need PHPMaker Project Sample
  • A New PHPMaker 2023 Project File Is Released
  • PHPMaker 2023 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2023 Is Released!

Search

Recent Comments

  • Masino Sinaga on Masino Extensions for PHPMaker 2024 Is Released!
  • Masino Sinaga on A New PHPMaker 2024 Project File Is Released
  • Masino Sinaga on PHPMaker 2023 Demo Project File Is Released
  • Edward Babatunde on PHPMaker 2023 Demo Project File Is Released
  • Edward Babatunde on Masino Extensions for PHPMaker 2024 Is Released!

Demo Website

  • Demo of I Love PHPMaker 2025 (MasinoExtensions).
  • Stock Inventory Management for PHPMaker 2025.

Another Demo

The following template are not available in this site (must be purchased separately)

  • PHPMaker v2018 Horizontal Vertical Template.
  • PHPMaker v2017 Horizontal Vertical Template.

Demo Explanation

Stock Inventory Management is the good project for your reference, since it uses the real example in the real world. Many useful features you can use from this project, such as how to add the Thousand and Decimal separator character, and also how to calculate multiple row in Grid-Add when End-Users are entering data into the Grid-Add mode.

Categories

  • Customize Template (103)
  • General (4)
  • PHP Report Maker (17)
  • PHP Report Maker Extensions (2)
  • PHPMaker Extensions (84)
  • PHPMaker Projects (7)
  • Tips and Trick (72)

Articles based on version

  • PHPMaker 2025
  • PHPMaker 2024
  • PHPMaker 2023
  • PHPMaker 2022
  • PHPMaker 2021
  • PHPMaker 2020
  • PHPMaker 2019
  • PHPMaker 2018
  • PHPMaker 2017.0.7
  • PHPMaker 12.0.7
  • PHPMaker 11.0.6
  • PHPMaker 10.0.5
  • PHPMaker 9.2.0
  • PHPMaker 8.0.3
  • PHP Report Maker 12

(c) I Love PHPMaker 2010 - 2025 by Masino Sinaga | WordPress | Log in | Back to top