Now it's time to customize the Login page that generated with PHPMaker 9.0.1. We are not going to customize the generated Login page for this purpose. We are going to customize PHPMaker template, so this can be re-used with your another project in PHPMaker version 9.
Just like the customization that I created in PHPMaker version 8, this modification will add the ability to set focus on the Username textbox when your user visits or loads this page. We are also still using the same image to beautify the Login form in PHPMaker version 8. In addition, we will modify the Captcha extension template in order to display the Captcha properly in Login page. Actually, not only for Login page, but this Captcha modification also will be implemented for Registration, Forgot Password, and Change Password too.
Important: In order to display the Captcha in the Login page properly, make sure you have done the following:
- Enable the CAPTCHA extension from: Tools -> Extensions -> CAPTCHA.
- Enable the related setting from: Security -> Advanced -> User Login Options -> Login -> CAPTCHA (require extension).
Updated on May 30, 2012: This customization has been implemented in PHPMaker version 9.0.2, it matches to each other, and as a result, it works properly.
Updated on July 21, 2012: This customization has been implemented in PHPMaker version 9.0.3, it matches to each other, and as a result, it works properly.
Updated on September 4, 2012: This customization has been implemented in PHPMaker version 9.0.4, it matches to each other, and as a result, it works properly.
Updated on November 28, 2012: This customization has been implemented in PHPMaker version 9.1.0, it matches to each other, and as a result, it works properly.
Updated on February 9, 2013: This customization has been implemented in PHPMaker version 9.2.0, it matches to each other, and as a result, it works properly.
Updated on June 17, 2013: The customization for CAPTCHA part has been handled by using MasinoCAPTCHA. The customization for the look and view of Login page has been handled by MasinoLogin extension. You don’t need to implement the customization below if you use my extensions above together with the original PHPMaker Template and Extensions.
[hidepost]
- Download images-box.zip. Extract the .zip file that contains of 9 image files in it, to your \Script\images sub-directory. Make sure you do not skip this step, as those images are also being used for the other customization that related to Registration, Forgot Password, and Change Password pages.
- If you have not used CAPTCHA extension, then it's time for you to use it! We need to customize it, since it is related to the customization for Login page and other pages that related to it. To do this, from PHPMaker application, go to Tools -> Extensions and then activate the CAPTCHA extension by giving the chekced mark at the item, click on OK button, afterwards generate your script files in order to extract the captcha.zip file to your template.
-
Open your \extensions\CAPTCHA\captcha-script.php file, and then replace all of the content of that file with the following code below (Warning: Please backup your original file first before doing this step!):
<!--##session phpcaptcha_config##--> <!--## // Check if Use Captcha var bUseCaptcha = false; var bConfirmCaptcha = false; var EXT = EXTS("CAPTCHA"); if (EXT.Enabled) { if (CTRL.CtrlID == "register") { if (PROJ.SecRegisterCaptcha) { bUseCaptcha = true; bConfirmCaptcha = PROJ.SecRegisterConfirm; } } else if (CTRL.CtrlID == "login") { if (PROJ.SecLoginCaptcha) { bUseCaptcha = true; bConfirmCaptcha = false; } } else if (CTRL.CtrlID == "forgotpwd") { if (PROJ.SecForgotPwdCaptcha) { bUseCaptcha = true; bConfirmCaptcha = false; } } else if (CTRL.CtrlID == "changepwd") { if (PROJ.SecChangePwdCaptcha) { bUseCaptcha = true; bConfirmCaptcha = false; } } else if (CTRL.CtrlID == "add") { if (TABLE.TblAddCaptcha) { bUseCaptcha = true; bConfirmCaptcha = TABLE.TblAddConfirm; } } else if (CTRL.CtrlID == "edit") { if (TABLE.TblEditCaptcha) { bUseCaptcha = true; bConfirmCaptcha = TABLE.TblEditConfirm; } } } // Get table variable sTblVar = gsTblVar; ##--> <!--##/session##--> <!--##session phpcaptcha_var##--> <!--## if (bUseCaptcha) { ##--> // CAPTCHA var $captcha; <!--## } ##--> <!--##/session##--> <!--##session phpcaptcha_php##--> <!--## if (bUseCaptcha) { if (CTRL.CtrlID == "add" || CTRL.CtrlID == "register") { ##--> // CAPTCHA checking if ($this->CurrentAction <> "I" && $this->CurrentAction <> "C") { if ( (($this->CurrentAction == "F") || ($this->CurrentAction == "I") || ($this->CurrentAction == "A") || ($this->CurrentAction == "X")) && (MS_SHOW_CAPTCHA_ON_REGISTRATION_PAGE == TRUE) ) { $objForm->Index = -1; $this->captcha = $objForm->GetValue("captcha"); if ($this->captcha <> @$_SESSION["EW_CAPTCHA_CODE"]) { // CAPTCHA unmatched $this->setFailureMessage($Language->Phrase("EnterValidateCode")); $this->CurrentAction = "I"; // Reset action, do not insert $this->EventCancelled = TRUE; // Event cancelled $this->RestoreFormValues(); // Restore form values } else { if ($this->CurrentAction == "A") $_SESSION["EW_CAPTCHA_CODE"] = ew_Random(); } } } <!--## } else if (CTRL.CtrlID == "edit") { ##--> // CAPTCHA checking if ($this->CurrentAction <> "I") { $objForm->Index = -1; $this->captcha = $objForm->GetValue("captcha"); if ($this->captcha <> @$_SESSION["EW_CAPTCHA_CODE"]) { // CAPTCHA unmatched $this->setFailureMessage($Language->Phrase("EnterValidateCode")); // Set message $this->CurrentAction = ""; // Reset action, do not update $this->EventCancelled = TRUE; // Event cancelled $this->RestoreFormValues(); // Restore form values } else { if ($this->CurrentAction == "U") $_SESSION["EW_CAPTCHA_CODE"] = ew_Random(); } } <!--## } else if (CTRL.CtrlID == "login") { ##--> // CAPTCHA checking if (ew_IsHttpPost()) { $this->captcha = @$_POST["captcha"]; if ($this->captcha <> @$_SESSION["EW_CAPTCHA_CODE"]) { // CAPTCHA unmatched $this->setFailureMessage($Language->Phrase("EnterValidateCode")); // Set message $bValidate = FALSE; } } if (!$bValidate) { $_SESSION["EW_CAPTCHA_CODE"] = ew_Random(); } <!--## } else if (CTRL.CtrlID == "forgotpwd") { ##--> // CAPTCHA checking if (ew_IsHttpPost()) { $this->captcha = @$_POST["captcha"]; if ($this->captcha <> @$_SESSION["EW_CAPTCHA_CODE"]) { // CAPTCHA unmatched $this->setFailureMessage($Language->Phrase("EnterValidateCode")); // Set message $bValidEmail = FALSE; } } if (!$bValidEmail) { $_SESSION["EW_CAPTCHA_CODE"] = ew_Random(); } <!--## } else if (CTRL.CtrlID == "changepwd") { ##--> // CAPTCHA checking if (ew_IsHttpPost()) { $this->captcha = @$_POST["captcha"]; if ($this->captcha <> @$_SESSION["EW_CAPTCHA_CODE"]) { // CAPTCHA unmatched $this->setFailureMessage($Language->Phrase("EnterValidateCode")); // Set message $bValidate = FALSE; } } if (!$bValidate) { $_SESSION["EW_CAPTCHA_CODE"] = ew_Random(); } <!--## } } ##--> <!--##/session##--> <!--##session phpcaptcha_htm##--> <!--## if (bUseCaptcha) { ##--> <!--## if (bConfirmCaptcha) { ##--> <?php if ($<!--##=gsTblVar##-->->CurrentAction <> "F") { ?> <!--## } ##--> <!-- captcha html (begin) --> <tr> <td > </td> <td > </td> <tr/> <tr> <td colspan="3" align="center"> <?php if (phpversion() < "4.3.2") { echo "<p class=\"ewmsg\">Warning: CAPTCHA extension is enabled but PHP version on this server is " . phpversion() . " only. The extension requires PHP >= 4.3.2.</p>"; } ?> <div><img src="ewcaptcha.php" alt="Security Image" width="200" height="50" /></div><br> <span class="phpmaker"><!--##@EnterValidateCode##--><!--##@FieldRequiredIndicator##--></span><br> <input type="text" name="captcha" id="captcha" size="30" /> </td> </tr> <!--## if (bConfirmCaptcha) { ##--> <?php } else { ?> <input type="hidden" name="captcha" id="captcha" value="<?php echo $<!--##=sPageObj##-->->captcha ?>" /> <?php } ?> <!--## } ##--> <br> <!-- captcha html (end) --> <!--## } ##--> <!--##/session##--> <!--##session phpcaptcha_js##--> <!--## if (bUseCaptcha) { ##--> if (fobj.captcha && !ew_HasValue(fobj.captcha)) return ew_OnError(this, fobj.captcha, ewLanguage.Phrase("EnterValidateCode")); <!--## } ##--> <!--##/session##--> -
Open your \Script\ewcfg.php file, and find this code:
// General
before that line, please insert the following code:
// Begin of modification Customizing Login Page, by Masino Sinaga, May 2, 2012 define("MS_SHOW_CAPTCHA_ON_LOGIN_PAGE", FALSE, TRUE); // <-- Switch FALSE to TRUE if you want to display Captcha on the Login page <!--## if (PROJ.SecRegisterPage) { ##--> define("MS_USER_REGISTRATION", TRUE, TRUE); <!--## } ##--> // End of modification Customizing Login Page, by Masino Sinaga, May 2, 2012 -
The next step is we are going to replace all of the content in your \Script\login.php file with the following code. Just for your information, the Login page does not change for a long time, so it is save to do the following step. However, Warning: Please Backup your existing login.php page before doing this step!:
<!--##session currenttable##--> <!--## // Set security table current if (ew_IsNotEmpty(PROJ.SecTbl)) { TABLE = DB.Tables(PROJ.SecTbl); goFlds = goTblFlds.Fields; gsTblVar = TABLE.TblVar; } sLoginOption = PROJ.LoginOption; //if (sLoginOption == "") sLoginOption = "AUTO,USER,ASK"; if (sLoginOption == "") sLoginOption = ""; arLoginOption = sLoginOption.split(","); dLoginOption = {}; lLoginOptionCount = 0; for (var i = 0; i < arLoginOption.length; i++) { sOption = arLoginOption[i].trim(); if (sOption == "AUTO" || sOption == "USER" || sOption == "ASK") { if (!(sOption in dLoginOption)) { dLoginOption[sOption] = sOption; lLoginOptionCount += 1; } } } ##--> <!--##/session##--> <?php <!--##session phpmain##--> <!--##include captcha-script.php/phpcaptcha_var##--> var $Username; var $LoginType; // // Page main // function Page_Main() { global $Security, $Language, $UserProfile, $gsFormError; $sPassword = ""; $sLastUrl = $Security->LastUrl(); // Get last URL if ($sLastUrl == "") $sLastUrl = "<!--##=sFnDefault##-->"; if (IsLoggingIn()) { $this->Username = @$_SESSION[EW_SESSION_USER_PROFILE_USER_NAME]; $sPassword = @$_SESSION[EW_SESSION_USER_PROFILE_PASSWORD]; $this->LoginType = @$_SESSION[EW_SESSION_USER_PROFILE_LOGIN_TYPE]; $bValidPwd = $Security->ValidateUser($this->Username, $sPassword, FALSE); if ($bValidPwd) { $_SESSION[EW_SESSION_USER_PROFILE_USER_NAME] = ""; $_SESSION[EW_SESSION_USER_PROFILE_PASSWORD] = ""; $_SESSION[EW_SESSION_USER_PROFILE_LOGIN_TYPE] = ""; } } else { if (!$Security->IsLoggedIn()) $Security->AutoLogin(); <!--## if (bUserLevel) { ##--> $Security->LoadUserLevel(); // Load user level <!--## } ##--> $this->Username = ""; // Initialize if (@$_POST["username"] <> "") { // Setup variables $this->Username = ew_RemoveXSS(ew_StripSlashes(@$_POST["username"])); $sPassword = ew_RemoveXSS(ew_StripSlashes(@$_POST["password"])); $this->LoginType = strtolower(ew_RemoveXSS(@$_POST["type"])); <!--## if (PROJ.GetV("AllowLoginByUrl")) { ##--> } else if (@$_GET["username"] <> "") { // Setup variables $this->Username = ew_RemoveXSS(ew_StripSlashes(@$_GET["username"])); $sPassword = ew_RemoveXSS(ew_StripSlashes(@$_GET["password"])); $this->LoginType = strtolower(ew_RemoveXSS(@$_GET["type"])); <!--## } ##--> } if ($this->Username <> "") { $bValidate = $this->ValidateForm($this->Username, $sPassword); if (!$bValidate) $this->setFailureMessage($gsFormError); $_SESSION[EW_SESSION_USER_PROFILE_USER_NAME] = $this->Username; // Save login user name $_SESSION[EW_SESSION_USER_PROFILE_LOGIN_TYPE] = $this->LoginType; // Save login type <!--## if (bCheckLoginRetry) { ##--> // Max login attempt checking if ($UserProfile->LoadProfileFromDatabase($this->Username)) { if ($UserProfile->ExceedLoginRetry()) { $bValidate = FALSE; $this->setFailureMessage(str_replace("%t", EW_USER_PROFILE_RETRY_LOCKOUT, $Language->Phrase("ExceedMaxRetry"))); } $UserProfile->SaveProfileToDatabase($this->Username); } <!--## } ##--> } else { if ($Security->IsLoggedIn()) { if ($this->getFailureMessage() == "") $this->Page_Terminate($sLastUrl); // Return to last accessed page } $bValidate = FALSE; // Restore settings if (@$_COOKIE[EW_PROJECT_NAME]['Checksum'] == strval(crc32(md5(EW_RANDOM_KEY)))) $this->Username = TEAdecrypt(@$_COOKIE[EW_PROJECT_NAME]['Username'], EW_RANDOM_KEY); if (@$_COOKIE[EW_PROJECT_NAME]['AutoLogin'] == "autologin") { $this->LoginType = "a"; } elseif (@$_COOKIE[EW_PROJECT_NAME]['AutoLogin'] == "rememberusername") { $this->LoginType = "u"; } else { $this->LoginType = ""; } } $bValidPwd = FALSE; if (MS_SHOW_CAPTCHA_ON_LOGIN_PAGE == TRUE) { <!--##include captcha-script.php/phpcaptcha_php##--> } if ($bValidate) { <!--## if (SYSTEMFUNCTIONS.ServerScriptExist("Other","User_LoggingIn")) { ##--> // Call Logging In event $bValidate = $this->User_LoggingIn($this->Username, $sPassword); <!--## } else { ##--> $bValidate = TRUE; <!--## } ##--> if ($bValidate) { $bValidPwd = $Security->ValidateUser($this->Username, $sPassword, FALSE); // Manual login if (!$bValidPwd) { <!--## if (bCheckPasswordExpiry) { ##--> // Password expired, force change password if (IsPasswordExpired()) { $this->setFailureMessage($Language->Phrase("PasswordExpired")); $this->Page_Terminate("<!--##=sFnChangePwd##-->"); } <!--## } ##--> if ($this->getFailureMessage() == "") $this->setFailureMessage($Language->Phrase("InvalidUidPwd")); // Invalid user id/password <!--## if (bCheckPasswordExpiry) { ##--> // Password changed date not initialized, set as today } elseif ($UserProfile->EmptyPasswordChangedDate()) { if ($UserProfile->LoadProfileFromDatabase($this->Username)) { $UserProfile->SetValue(EW_USER_PROFILE_LAST_PASSWORD_CHANGED_DATE, ew_StdCurrentDate()); $UserProfile->SaveProfileToDatabase($this->Username); $_SESSION[EW_SESSION_USER_PROFILE] = $UserProfile->ProfileToString(); // Save to session also } <!--## } ##--> } } else { if ($this->getFailureMessage() == "") $this->setFailureMessage($Language->Phrase("LoginCancelled")); // Login cancelled } } } if ($bValidPwd) { // Write cookies if ($this->LoginType == "a") { // Auto login setcookie(EW_PROJECT_NAME . '[AutoLogin]', "autologin", EW_COOKIE_EXPIRY_TIME); // Set autologin cookie setcookie(EW_PROJECT_NAME . '[Username]', TEAencrypt($this->Username, EW_RANDOM_KEY), EW_COOKIE_EXPIRY_TIME); // Set user name cookie setcookie(EW_PROJECT_NAME . '[Password]', TEAencrypt($sPassword, EW_RANDOM_KEY), EW_COOKIE_EXPIRY_TIME); // Set password cookie setcookie(EW_PROJECT_NAME . '[Checksum]', crc32(md5(EW_RANDOM_KEY)), EW_COOKIE_EXPIRY_TIME); } elseif ($this->LoginType == "u") { // Remember user name setcookie(EW_PROJECT_NAME . '[AutoLogin]', "rememberusername", EW_COOKIE_EXPIRY_TIME); // Set remember user name cookie setcookie(EW_PROJECT_NAME . '[Username]', TEAencrypt($this->Username, EW_RANDOM_KEY), EW_COOKIE_EXPIRY_TIME); // Set user name cookie setcookie(EW_PROJECT_NAME . '[Checksum]', crc32(md5(EW_RANDOM_KEY)), EW_COOKIE_EXPIRY_TIME); } else { setcookie(EW_PROJECT_NAME . '[AutoLogin]', "", EW_COOKIE_EXPIRY_TIME); // Clear auto login cookie } <!--## if (bCheckConcurrentUser) { ##--> setcookie(EW_PROJECT_NAME . '[' . EW_USER_PROFILE_SESSION_ID . ']', session_id(), EW_COOKIE_EXPIRY_TIME); // Save current Session ID <!--## } ##--> <!--## if (SYSTEMFUNCTIONS.ServerScriptExist("Other","User_LoggedIn")) { ##--> // Call loggedin event $this->User_LoggedIn($this->Username); <!--## } ##--> <!--## if (PROJ.SecLogInOutAuditTrail) { ##--> $this->WriteAuditTrailOnLogin($this->Username); <!--## } ##--> $this->Page_Terminate($sLastUrl); // Return to last accessed URL } elseif ($this->Username <> "" && $sPassword <> "") { <!--## if (SYSTEMFUNCTIONS.ServerScriptExist("Other","User_LoginError")) { ##--> // Call user login error event $this->User_LoginError($this->Username, $sPassword); <!--## } ##--> } } <!--##/session##--> ?> <!--##session login_htm##--> <script type="text/javascript"> var <!--##=sFormName##--> = new ew_Form("<!--##=sFormName##-->"); // Validate function <!--##=sFormName##-->.Validate = function() { var fobj = this.Form; if (!this.ValidateRequired) return true; // ignore validation if (!ew_HasValue(fobj.username)) return ew_OnError(this, fobj.username, ewLanguage.Phrase("EnterUid")); if (!ew_HasValue(fobj.password)) return ew_OnError(this, fobj.password, ewLanguage.Phrase("EnterPwd")); <?php if (MS_SHOW_CAPTCHA_ON_LOGIN_PAGE == TRUE) { ?> <!--##include captcha-script.php/phpcaptcha_js##--> <?php } ?> <!--## if (SYSTEMFUNCTIONS.ClientScriptExist("Other","Form_CustomValidate")) { ##--> // Call Form Custom Validate event if (!this.Form_CustomValidate(fobj)) return false; <!--## } ##--> return true; } <!--## if (SYSTEMFUNCTIONS.ClientScriptExist("Other","Form_CustomValidate")) { ##--> // Form_CustomValidate function <!--##=sFormName##-->.Form_CustomValidate = <!--##~SYSTEMFUNCTIONS.GetClientScript("Other","Form_CustomValidate")##--> <!--## } ##--> // Requires js validation <?php if (EW_CLIENT_VALIDATE) { ?> <!--##=sFormName##-->.ValidateRequired = true; <?php } else { ?> <!--##=sFormName##-->.ValidateRequired = false; <?php } ?> </script> <!--##include phpcommon.php/header-message##--> <!--##include phpcommon.php/phpcommon-message##--> <body onload="document.frmLogin.username.focus()"> <form name="frmLogin" name="<!--##=sFormName##-->" id="<!--##=sFormName##-->" class="ewForm" action="<?php echo ew_CurrentPage() ?>" method="post" onsubmit="return ewForms[this.id].Submit();"> <br /><br /><br /><br /> <table border="0" cellpadding="0" cellspacing="0" width="400" align="center"> <tr> <td> <table border="0" cellpadding="0" cellspacing="0" width="420" align="center"> <tr> <td align="left" valign="top" width="4" height="30"><img src="phpimages/sidebox-title-left.gif"></td> <td align="left" valign="middle" background="phpimages/sidebox-title-bg.gif" width="390" height="30"> <font class="phpmaker"> <strong><!--##@LoginPage##--></strong></font> <a href="javascript:popupWindow('help.php?page=<?php echo ew_CurrentPage(); ?>')"><img src="phpimages/question.ico" title="<?php echo ew_HtmlEncode($Language->Phrase("help")) ?>" width="16" height="16" border="0"></a> </td> <td align="left" valign="top" width="4" height="30"><img src="phpimages/sidebox-title-right.gif"></td> </tr> </table> </td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" align="center"> <tr valign="top"> <td width="4" align="left" valign="top" background="phpimages/sidebox-bar-left.gif"><img src="phpimages/sidebox-bar-px.gif"></td> <td bgcolor="#FFFFFF" width="" align="left" valign="top"> <table bgcolor="#F0F1F5" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td> <table width="412" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <tr/> <tr> <td width="125"> <span class="phpmaker"><!--##@Username##--></span></td> <td width="5"></td> <td width="50"><span class="phpmaker"><input type="text" name="username" id="username" size="37" value="<?php echo $<!--##=sPageObj##-->->Username ?>"></span></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td height="22"> <span class="phpmaker"><!--##@Password##--></span></td> <td></td> <td><span class="phpmaker"><input type="password" name="password" id="password" size="37" /></span></td> </tr> <tr> <td> </td> <td> </td> </tr> <!--## if (lLoginOptionCount > 1) { ##--> <tr> <td colspan="3"><span class="phpmaker"> <!--## if (String("AUTO") in dLoginOption) { ##--> <label> <input type="radio" name="type" id="type" value="a"<?php if ($<!--##=sPageObj##-->->LoginType == "a") { ?> checked="checked"<?php } ?> /><!--##@AutoLogin##--></label><br /> <!--## } ##--> <!--## if (String("USER") in dLoginOption) { ##--> <label> <input type="radio" name="type" id="type" value="u"<?php if ($<!--##=sPageObj##-->->LoginType == "u") { ?> checked="checked"<?php } ?> /><!--##@SaveUserName##--></label><br /> <!--## } ##--> <!--## if (String("ASK") in dLoginOption) { ##--> <label> <input type="radio" name="type" id="type" value=""<?php if ($<!--##=sPageObj##-->->LoginType == "") { ?> checked="checked"<?php } ?> /><!--##@AlwaysAsk##--></label> <!--## } ##--> </span></td> </tr> <!--## } ##--> <?php if (MS_SHOW_CAPTCHA_ON_LOGIN_PAGE == TRUE) { ?> <!--##include captcha-script.php/phpcaptcha_htm##--> <?php } ?> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td><span class="phpmaker"><input type="submit" name="btnsubmit" id="btnsubmit" value="<?php echo ew_BtnCaption($Language->Phrase("Login")) ?>" /></span> <input name="reset" type="reset" id="Reset" value="<?php echo ew_BtnCaption($Language->Phrase("CancelBtn")) ?>"> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> </td> </tr> </table> </td> <td width="4" align="left" valign="top" background="phpimages/sidebox-bar-right.gif"><img src="phpimages/sidebox-bar-px.gif"> </td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="420" align="center"> <tr> <td width="2" height="29" align="left" valign="top"><img src="phpimages/storybox-bottom-left.gif"></td> <td width="394" height="29" background="phpimages/storybox-bottom-bg.gif"> <!--## if (bUserTable) { ##--> <span class="phpmaker"> <!--## if (PROJ.SecForgetPwdPage) { ##--> <a href="<!--##=sFnForgotPwd##-->"><!--##@ForgotPwd##--></a> <!--## } ##--> <!--## if (PROJ.SecRegisterPage) { ##--> <?php if (MS_USER_REGISTRATION) { ?> <a href="<!--##=sFnRegister##-->"><!--##@Register##--></a> <?php } ?> <!--## } ##--> </span> <!--## } ##--></td> <td width="8" height="29" align="left" valign="top"><img src="phpimages/storybox-bottom-right.gif"></td> </tr> </table> <!--## if (lLoginOptionCount == 1) { ##--> <!--## if (String("AUTO") in dLoginOption) { ##--> <input type="hidden" name="type" id="type" value="a" /> <!--## } else if (String("USER") in dLoginOption) { ##--> <input type="hidden" name="type" id="type" value="u" /> <!--## } else if (String("ASK") in dLoginOption) { ##--> <input type="hidden" name="type" id="type" value="" /> <!--## } ##--> <!--## } ##--> <p /> </form> </body> <br /> <script type="text/javascript"> <!--##=sFormName##-->.Init(); </script> <!--##include phpcommon.php/footer-message##--> <!--##/session##--> <?php <!--##session phpfunction##--> // // Validate form // function ValidateForm($usr, $pwd) { global $Language, $gsFormError; // Initialize form error message $gsFormError = ""; // Check if validation required if (!EW_SERVER_VALIDATE) return TRUE; if (trim($usr) == "") { ew_AddMessage($gsFormError, $Language->Phrase("EnterUid")); } if (trim($pwd) == "") { ew_AddMessage($gsFormError, $Language->Phrase("EnterPwd")); } // Return validate result $ValidateForm = ($gsFormError == ""); <!--## if (SYSTEMFUNCTIONS.ServerScriptExist("Other","Form_CustomValidate")) { ##--> // Call Form Custom Validate event $sFormCustomError = ""; $ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError); if ($sFormCustomError <> "") { ew_AddMessage($gsFormError, $sFormCustomError); } <!--## } ##--> return $ValidateForm; } <!--## if (PROJ.SecLogInOutAuditTrail) { ##--> // // Write audit trail on login // function WriteAuditTrailOnLogin($usr) { global $Language; ew_WriteAuditTrail("log", ew_StdCurrentDateTime(), ew_ScriptName(), $usr, $Language->Phrase("AuditTrailLogin"), ew_CurrentUserIP(), "", "", "", ""); } <!--## } ##--> <!--##/session##--> ?> <?php <!--##session phpevents##--> <!--##~SYSTEMFUNCTIONS.GetServerScript("Other","User_LoggingIn")##--> <!--##~SYSTEMFUNCTIONS.GetServerScript("Other","User_LoggedIn")##--> <!--##~SYSTEMFUNCTIONS.GetServerScript("Other","User_LoginError")##--> <!--##~SYSTEMFUNCTIONS.GetServerScript("Other","Form_CustomValidate")##--> <!--##/session##--> ?> - Finally, re-generate your script files using PHPMaker as always. 🙂
[/hidepost]
Nice modification – only issue is that on logout, I get an emtpy message box. I’m seeing this with both IE and firefox. Any ideas?
Thanks again!
This modification only customizing the Login page, and there is nothing to do with Logout process.
Hi,
Thanks for all..
Where can I find “Script” folder ? in “3.Open your \Script\ewcfg.php file, and find this code”.
I’m new in PHPMaker and want to try my first customization.
Can you also notice me Posts to read first before begining customization?
Sorry for mistakes. I don’t speak english but french !
Thanks again !
Here is the full-path (assume Windows XP): “C:\Documents and Settings\{YourUserName}\My Documents\PHPMaker\Templates\phpv91.zip\Script”. If you are using Window 7, it is: “Libraries\Documents\My Documents\PHPMaker\Templates\phpv91.zip\Script”. Hope that helps.
I got the Login page working nicely on v9.10 but noticed two things…
1) your MS_SHOW_CAPTCHA_ON_LOGIN_PAGE define doesn’t appear to be required – by removing all references to it, I was able to control display of the Captcha code via the phpMaker security settings (as I would have done under normal circumstances)
2) having the text size setting on the HTML-General tab set to anything larger than “small” breaks the login panel
1) The constant actually is useful if you want to show the Captcha or not by simply change it from the generated configuration (ewcfg9.php) file.
For example, if you want to show the Captcha, then define the constant as follows:
define("MS_SHOW_CAPTCHA_ON_LOGIN_PAGE", TRUE, TRUE);otherwise, change it become:
define("MS_SHOW_CAPTCHA_ON_LOGIN_PAGE", FALSE, TRUE);2) Yes, since it uses the static image file for the login panel. I was thinking to switch it using either YUI Panel or YUI Widget in future.