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 Display How Long User Should be Allowed Login in the Messages When Failed Login Exceeds the Maximum Limit Specified in PHPMaker 8.0.3
How to Display “This user is currently being deactivated now” Message Instead of “Invalid User Id or Password” in PHPMaker 8.0.3
How to Add “Auto Logout After Idle for the Certain Time” in Websites Created With PHPMaker 8.0.3

September 3, 2011

How to Display How Long User Should be Allowed Login in the Messages When Failed Login Exceeds the Maximum Limit Specified in PHPMaker 8.0.3

PHPMaker has already provided the ability to prevent the user if the login attempt exceeds the maximum login retry count for the websites that created by it. If this condition occurs, then the user will get the message that inform her/him about it. Assuming system also have defined the next duration time user will be allowed again with value of 5 minutes, then the message will be look like this:

Exceed maximum login retry count. Account is locked. Please try again in 5 minutes

Unfortunately, if the user is still trying to login after he/she got that warning message, then the system will keep inform him/her about the "5 minutes" again and again. I think this message is not so smart, because that "5 minutes" message should be updated automatically in accordance with the real time at that time. So, instead of saying "5 minutes", we will make it auto-adjust to the real time. The result will be like this:

  1. The first time user got the message at 08:00:00, it will show:

    Exceed maximum login retry count. Account is locked. Please try again in 0 hour(s), 5 minute(s), and 0 second(s).

  2. When that user is trying to login at 08:00:15, the time will be automatically updated become:

    Exceed maximum login retry count. Account is locked. Please try again in 0 hour(s), 4 minute(s), and 45 second(s).

  3. When that user is trying to login at 08:00:33, the time will be automatically updated become:

    Exceed maximum login retry count. Account is locked. Please try again in 0 hour(s), 4 minute(s), and 27 second(s).

  4. And so on. Well, does it sound smarter than before, right?

All we have to do is customizing the PHPMaker template files and add some code into the Server Events section of PHPMaker. In other words, we will not customize the generated script files.

Please click on the following image to watch the demo:

Displaying Real-Time Message for the Blocked Account
Displaying Real-Time Message for the Blocked Account

[hidepost]
Let's get started. Follow these steps below:

  1. Open your C:\Program Files\PHPMaker 8\languages\english.xml file, and find this code:

    <phrase id="ExceedMaxRetry" value="Exceed maximum login retry count. Account is locked. Please try again in %t minutes"/>
    

    then replace it with this following code:

    <phrase id="ExceedMaxRetry" value="Exceed maximum login retry count. Account is locked. Please try again in %t."/>
    

    Do the same way with your another .xml language file. For example, I am also using Indonesian language, so I add those phrases to my indonesian.xml file:

    <phrase id="ExceedMaxRetry" value="Melebihi jumlah usaha maksimum login. Akun terkunci. Silahkan coba lagi dalam %t."/>
    
  2. Open your /Script/login.php file, and find this code:

    						$this->setFailureMessage(str_replace("%t", EW_USER_PROFILE_RETRY_LOCKOUT, $Language->Phrase("ExceedMaxRetry")));
    

    then replace it with this following code:

    						$this->setFailureMessage(str_replace("%t", Duration( date("Y-m-d H:i:s"), CurrentDateTime_Add_Minutes( $UserProfile->getValue( EW_USER_PROFILE_LAST_BAD_LOGIN_DATE_TIME), EW_USER_PROFILE_RETRY_LOCKOUT)), $Language->Phrase("ExceedMaxRetry")));
    
    
  3. Open your /Script/phpfn.php file, and find this code:

    if (ew_DateDiff($dt, ew_StdCurrentDateTime(), "n") < $this->RetryLockoutTime) {
    

    then replace it with this following code:

    if (ew_DateDiff($dt, ew_StdCurrentDateTime(), "n") < EW_USER_PROFILE_RETRY_LOCKOUT) {
    &#91;/code&#93;
    this step is important in order to check and validate whether the user is allowed login or not.
    </li>
    
    <li>
    Next step, still on your <strong>PHPMaker</strong> application, click on one of your tables from the left panel, and see in the right panel of your PHPMaker application, there are two tabs appear. They are: <strong>Fields</strong> and <strong>Server Events/Client Scripts</strong>. Click on the <strong>Server Events/Client Scripts</strong> tab, and then click on <strong>Server Events</strong> -> <strong>Global</strong> -> <strong>All Pages</strong> -> <strong>Global Code</strong>.
    Find this code:
    [code lang="php"]
    function CurrentDateTime_Add_Minutes($currentdate, $minute) {
      $timestamp = strtotime("$currentdate");
      $addtime = strtotime("+$minute minutes", $timestamp);
      $next_time = date('Y/m/d H:i:s', $addtime);
      return $next_time;
    }
    
  4. Re-generate your script files using PHPMaker.

[/hidepost]

Article by Masino Sinaga / Customize Template / auto adjust, global code, locked, login retry count, maximum login retry count, PHPMaker 8.0.3 Leave a Comment

How to Display “This user is currently being deactivated now” Message Instead of “Invalid User Id or Password” in PHPMaker 8.0.3
How to Add “Auto Logout After Idle for the Certain Time” in Websites Created With PHPMaker 8.0.3

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