Have your user ever encountered the problem when receiving the warning message from your web application that created by PHPMaker 9.0.1 as following: “User NX already logged in!” (even this user NX has closed the browser) and then he/she report it to you as Administrator of your web application? Well, this warning message shows up usually when the user closes the browser without logout explicitly from the web application, afterwards user clears the cookies/cache of his/her browser, and then he/she is trying to login again to the web application. When this is happened, each time your user is trying to login to your web application, then he/she will get the same messsage as I mentioned above. In other words, your user is not able to login to the web application anymore.
The causes of this problem is that since the user closes the browser and does not do logout explicitly from the web application, then the SessionID value is still being kept in the User Profile field in the users table, and in the same time, the cookies that hold that SessionID has been removed from the browser. The only solution to overcome this problem is by clearing the SessionID value that stored in the User Profile field of your users table. Unfortunately, when you as Administrator go to that users table and check that User Profile field, then you will see that the value of this field contains some User Profile values, such as: SessionID, LoginRetryCount, LastPasswordChangedDate, and LastBadLoginDateTime. All of those values are stored as an array in that User Profile field. So you have to be careful to remove the value of that user’s SessionID, otherwise your web application will display the message to your user that the User Profile value is corrupted.
In order to avoid it happened, and also to avoid the mistyped or misedited while clearing that SessionID value, then there should be a web page provided to you as an Administrator in order to manage that SessionID. Well, the good news is: I have successfully created that page that can be used to clear or remove or free-up your users’ SessionID. This page can only be accessed by the users which have Administrator level (of course, you can add another user levels in addition to Administrator according to your needs by yourself later). There is only one ComboBox and one CommandButton in this page. The ComboBox will only display the User ID which have the SessionID value. By using this page, then you (as an Administrator) will not to be worried anymore to clear your users’ SessionID.
In the future, when your users report the same problem as the message shown above, then simply choose the User ID from that ComboBox, and click on the CommandButton, and voila... the value of that user’s SessionID will be removed/cleared, then tell your user back to try to login again, and this time he/she will be happy. The User IDs which have the SessionID that had been cleared (including those which have logged out explicitly) will not be listed in that ComboBox again. So you will only see the User IDs which have the SessionID value are listed there.
All we have to do is customizing the PHPMaker template files. In other words, we do not modify any generated script files.
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 22, 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 5, 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 29, 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.
[hidepost]
-
Open your C:\Program Files\PHPMaker 9\languages\english.xml file, and find this code:
</global>
before that line, please insert this following code:
<phrase id="ClearUserSessionID" value="Clear User Session ID"/> <phrase id="ChooseUserIDForSessionID" value="Choose User ID which to be cleared the SessionID!"/> <phrase id="UserIDNotFound" value="Sorry, the User ID is not found!"/> <phrase id="SessionIDCurrentlyFree" value="SessionID that belongs to '%u' is currently free!"/> <phrase id="SessionIDSuccessfullyCleared" value="SessionID that belongs to '%u' has been successfully cleared!"/>
Do the same step for another .xml language you have (if your web application supports for multi language), as usual. For example, I am only using Indonesian language, so I will add the following code just like above to the C:\Program Files\PHPMaker 9\languages\indonesian.xml file:
<phrase id="ClearUserSessionID" value="Bersihkan SessionID Pengguna"/> <phrase id="ChooseUserIDForSessionID" value="Pilih ID Pengguna yang akan dibebaskan SessionID-nya!"/> <phrase id="UserIDNotFound" value="Maaf, ID Pengguna tersebut tidak ditemukan!"/> <phrase id="SessionIDCurrentlyFree" value="SessionID milik pengguna '%u' sedang dalam keadaan bebas!"/> <phrase id="SessionIDSuccessfullyCleared" value="SessionID milik pengguna '%u' sudah berhasil dibebaskan!"/>
-
Open your \Script\ewcfg.php file, and find this code:
define("EW_USER_NAME_FILTER", "<!--##=ew_Quote(sFilter)##-->", TRUE);
before that line, please insert the following code:
// Begin of modification Clear User Session ID, by Masino Sinaga, May 5, 2012 define("MS_USER_TABLE_NAME", "".str_replace(EW_DB_QUOTE_START, '', str_replace(EW_DB_QUOTE_END, '', '<!--##=ew_Quote(sUserTable)##-->'))."", TRUE); define("MS_USER_NAME_FIELD", "<!--##=ew_Quote(sFld)##-->", TRUE); define("MS_USER_NAME_PARAMETER", "<!--##=ew_Quote(sFldParam)##-->", TRUE); define("MS_FIRST_NAME", "Nama_Lengkap", TRUE); // change 'Nama_Lengkap' with your first name field in your users table define("MS_LAST_NAME", "Nippos", TRUE); // change 'Nippos' with your last name field in your users table // End of modification Clear User Session ID, by Masino Sinaga, May 5, 2012
-
Still in that \Script\ewcfg.php file, find again this code:
// User table filters <!--## if (bUserTable) { if (SECTABLE.TblType == "CUSTOMVIEW") sUserTable = ew_SQLPart(SECTABLE.TblCustomSQL, "FROM"); else sUserTable = ew_QuotedName(SECTABLE.TblName); if (ew_IsNotEmpty(PROJ.SecLoginIDFld)) { FIELD = SECTABLE.Fields(PROJ.SecLoginIDFld); sFld = ew_FieldSqlName(FIELD); sFldQuoteS = FIELD.FldQuoteS; sFldQuoteE = FIELD.FldQuoteE; sFilter = "(" + sFld + " = " + sFldQuoteS + "%u" + sFldQuoteE + ")"; } else { sFilter = ""; } ##-->
then replace it with the following code:
// User table filters <!--## if (bUserTable) { if (SECTABLE.TblType == "CUSTOMVIEW") sUserTable = ew_SQLPart(SECTABLE.TblCustomSQL, "FROM"); else sUserTable = ew_QuotedName(SECTABLE.TblName); if (ew_IsNotEmpty(PROJ.SecLoginIDFld)) { FIELD = SECTABLE.Fields(PROJ.SecLoginIDFld); sFld = ew_FieldSqlName(FIELD); sFldParam = FIELD.FldName; sFldQuoteS = FIELD.FldQuoteS; sFldQuoteE = FIELD.FldQuoteE; sFilter = "(" + sFld + " = " + sFldQuoteS + "%u" + sFldQuoteE + ")"; } else { sFilter = ""; } ##-->
-
Open your \Script\control.xml file, and find this code:
<!-- Text files -->
before the first line of that code, please insert the following code:
<control id="clearusersession.php" type="copy" remark="Copy clearusersession.php" ifiles="clearusersession.php" />
-
Open your \Script\phpcommon-scripts.php file, and find this code:
$UserProfile->LoadProfile(@$_SESSION[EW_SESSION_USER_PROFILE]);
after that line, please insert the following code:
// Begin of modification by Masino Sinaga, May 25, 2012 in order to not autologout after clear another user's session ID whenever back to another page. $UserProfile->LoadProfileFromDatabase(CurrentUserName()); // End of modification by Masino Sinaga, May 25, 2012 in order to not autologout after clear another user's session ID whenever back to another page.
If you have already had that code, then just skip this step. But make sure you have already had!
Please note that this step is really important in order to avoid autologout when you switch from the custom page (that we will create based on the blank page) to another pages in your web application. So make sure you do not skip this step and do it carefully!
- Go to your PHPMaker project application, then generate a blank page. This blank page we will use as the basic template for generating the custom page that we will use to manage the SessionID we discussed in the article above. Click this link if you do not know how to generate it.
-
After you generate a blank page above, then make sure you rename the blankpage.php file to another name, for example, I rename it to become: clearusersession.php, afterwards open the clearusersession.php file, and find this code:
custompage
then replace it with the following code:
ClearUserSessionID
-
Still in that clearusersession.php file, find again this code:
<?php include_once "userfn9.php" ?>
before that line, modify the user *info.php file become the following:
<?php include_once "".MS_USER_TABLE_NAME."info.php" ?>
-
Still in that clearusersession.php file, find again this code:
<?php include_once "footer.php" ?>
before that line, please insert the following code:
<?php global $Language, $conn, $UP, $UserID_Parameter; $UserID_Parameter = MS_USER_NAME_PARAMETER; ?> <body onload="document.frmreset.<?php echo $UserID_Parameter; ?>.focus()"> <div id="ewContainer"> <span class="phpmaker ewTitle"><?php echo $Language->Phrase('ClearUserSessionID'); ?> <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> </span> </div> <br /><br /><br /><br /> <form name="frmreset" action="clearusersession.php" method="get" class="ewForm" > <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="option"> <strong><?php echo $Language->Phrase('ClearUserSessionID'); ?></strong></font> </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> <td> </td> <tr/> <tr> <td> </td> <td> </td> <td> </td> <tr/> <tr> <td> </td> <td> </td> <td> </td> <tr/> <tr> <td width="35%"> <?php echo $Language->Phrase('UserID'); ?></td> <td width="65%"> <select name="<?php echo $UserID_Parameter; ?>"> <option value="0" selected ><?php echo $Language->Phrase('PleaseSelect'); ?></option> <?php $sSqlWrk = "SELECT ".MS_USER_NAME_FIELD." FROM ".EW_USER_TABLE." WHERE ".EW_USER_PROFILE_FIELD_NAME." NOT LIKE '%\"SessionID\";s:0:%' ORDER BY ".MS_USER_NAME_FIELD; $rswrk = $conn->Execute($sSqlWrk); while (!$rswrk->EOF) { $selected = ($rswrk->fields($UserID_Parameter)==@$_GET[$UserID_Parameter])?'selected':''; ?> <option value="<?php echo $rswrk->fields($UserID_Parameter);?>"<?php echo $selected; ?>><?php echo $rswrk->fields($UserID_Parameter);?></option> <?php $rswrk->MoveNext(); } $rswrk->Close(); ?> </select> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td class="ewTableHeader"> </td> <td><span class="phpmaker"><input type="submit" class="msButton" name="submit" id="submit" value="<?php echo $Language->Phrase('ClearUserSessionID'); ?>"></span></td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <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"> <a href="<!--##=sFnLogin##-->"><!--##@BackToLogin##--></a></td> <td width="8" height="29" align="left" valign="top"><img src="phpimages/storybox-bottom-right.gif"></td> </tr> </table> </form> </body> <br />
-
Still in that clearusersession.php file, replace the whole code in the function Page_Init(), so it will completely become like the following:
function Page_Init() { global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm; // User profile $UserProfile = new cUserProfile(); $UserProfile->LoadProfile(@$_SESSION[EW_SESSION_USER_PROFILE]); // Security $Security = new cAdvancedSecurity(); // Uncomment codes below for security if (!$Security->IsLoggedIn()) $Security->AutoLogin(); if (!$Security->IsLoggedIn()) $this->Page_Terminate("login.php"); if (!$Security->IsAdmin()) { header("Location: logout.php"); } // Begin of modification Auto Logout After Idle for the Certain Time, by Masino Sinaga, May 5, 2012 $LastAccessDateTime = strval(@$UserProfile->Profile[EW_USER_PROFILE_LAST_ACCESSED_DATE_TIME]); if (ew_DateDiff($LastAccessDateTime, ew_StdCurrentDateTime(), "n") > MS_AUTO_LOGOUT_AFTER_IDLE_IN_MINUTES) { header("Location: logout.php"); } // End of modification Auto Logout After Idle for the Certain Time, by Masino Sinaga, May 5, 2012 // Global Page Loading event (in userfn*.php) Page_Loading(); // Page Load event $this->Page_Load(); }
-
Still in the clearusersession.php file, replace the whole code in the function Page_Main(), so it will completely become like the following:
function Page_Main() { global $Language, $conn, $UP, $UserID_Parameter; $UserID_Parameter = MS_USER_NAME_PARAMETER; if (isset($_GET[$UserID_Parameter]) && $_GET[$UserID_Parameter]=="0") { $this->setFailureMessage($Language->Phrase('ChooseUserIDForSessionID')); } elseif (isset($_GET[$UserID_Parameter])) { $sSqlWrk = "SELECT ".MS_USER_NAME_FIELD." FROM ".EW_USER_TABLE." WHERE ".MS_USER_NAME_FIELD." LIKE '".$_GET[$UserID_Parameter]."' ORDER BY ".MS_USER_NAME_FIELD.""; $rswrk = $conn->Execute($sSqlWrk); if ($rswrk->RecordCount() > 0) { $UP = new cUserProfile(); if ($UP->LoadProfileFromDatabase($_GET[$UserID_Parameter])) { $us = $UP->GetValue(EW_USER_PROFILE_SESSION_ID); if ($us == "") { $this->setSuccessMessage(str_replace("%u", $_GET[$UserID_Parameter], $Language->Phrase('SessionIDCurrentlyFree'))); $UP->SaveProfileToDatabase($_GET[$UserID_Parameter]); } else { $UP->SetValue(EW_USER_PROFILE_SESSION_ID, ""); $UP->SaveProfileToDatabase($_GET[$UserID_Parameter]); $this->setSuccessMessage(str_replace("%u", $_GET[$UserID_Parameter], $Language->Phrase('SessionIDSuccessfullyCleared'))); } } $rswrk->Close(); } else { if (strlen($_GET[$UserID_Parameter])>0) { $this->setFailureMessage($Language->Phrase('UserIDNotFound')); } } } }
-
If you don't want to do step by step for creating clearusersession.php file, then here is the complete file (just copy and paste the following code, and then save it in under \Script sub folder, and save it as clearusersession.php:
<?php if (session_id() == "") session_start(); // Initialize Session data ob_start(); // Turn on output buffering ?> <?php include_once "ewcfg9.php" ?> <?php // include_once "adodb5/adodb.inc.php" // <-- If you are using SQL Server database ?> <?php include_once "ewmysql9.php" // <-- If you are using MySQL database ?> <?php include_once "phpfn9.php" ?> <?php include_once "".MS_USER_TABLE_NAME."info.php" ?> <?php include_once "userfn9.php" ?> <?php // // Page class // $ClearUserSession = NULL; // Initialize page object first class cClearUserSession { // Page ID var $PageID = 'ClearUserSession'; var $sEmail = ''; // Added by Masino Sinaga, in order to prevent error undefined variable $sEmail, January 16, 2012 var $sSrchWhere = ''; // Added by Masino Sinaga, in order to prevent error undefined variable $sSrchWhere, January 16, 2012 var $sDisabled = ''; // Added by Masino Sinaga, in order to prevent error undefined variable $sDisabled, January 16, 2012 // Project ID var $ProjectID = "<!--##=PROJ.ProjID##-->"; // Page object name var $PageObjName = 'ClearUserSession'; // Page name function PageName() { return ew_CurrentPage(); } // Page URL function PageUrl() { $PageUrl = ew_CurrentPage() . "?"; return $PageUrl; } // Message function getMessage() { return @$_SESSION[EW_SESSION_MESSAGE]; } function setMessage($v) { ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v); } function getFailureMessage() { return @$_SESSION[EW_SESSION_FAILURE_MESSAGE]; } function setFailureMessage($v) { ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v); } function getSuccessMessage() { return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE]; } function setSuccessMessage($v) { ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v); } function getWarningMessage() { return @$_SESSION[EW_SESSION_WARNING_MESSAGE]; } function setWarningMessage($v) { ew_AddMessage($_SESSION[EW_SESSION_WARNING_MESSAGE], $v); } // Show message function ShowMessage() { $hidden = TRUE; $html = ""; // Message $sMessage = $this->getMessage(); $this->Message_Showing($sMessage, ""); if ($sMessage <> "") { // Message in Session, display $html .= "<p class=\"ewMessage\">" . $sMessage . "</p>"; $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session } // Warning message $sWarningMessage = $this->getWarningMessage(); $this->Message_Showing($sWarningMessage, "warning"); if ($sWarningMessage <> "") { // Message in Session, display $html .= "<table class=\"ewMessageTable\"><tr><td class=\"ewWarningIcon\"></td><td class=\"ewWarningMessage\">" . $sWarningMessage . "</td></tr></table>"; $_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session } // Success message $sSuccessMessage = $this->getSuccessMessage(); $this->Message_Showing($sSuccessMessage, "success"); if ($sSuccessMessage <> "") { // Message in Session, display $html .= "<table class=\"ewMessageTable\"><tr><td class=\"ewSuccessIcon\"></td><td class=\"ewSuccessMessage\">" . $sSuccessMessage . "</td></tr></table>"; $_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session } // Failure message $sErrorMessage = $this->getFailureMessage(); $this->Message_Showing($sErrorMessage, "failure"); if ($sErrorMessage <> "") { // Message in Session, display $html .= "<table class=\"ewMessageTable\"><tr><td class=\"ewErrorIcon\"></td><td class=\"ewErrorMessage\">" . $sErrorMessage . "</td></tr></table>"; $_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session } echo "<div class=\"ewMessageDialog\"" . (($hidden) ? " style=\"display: none;\"" : "") . ">" . $html . "</div>"; } // // Page class constructor // function __construct() { global $conn, $Language; $GLOBALS["Page"] = &$this; // Language object if (!isset($Language)) $Language = new cLanguage(); // User table object (EW_USER_TABLE) // if (!isset($GLOBALS["".MS_USER_TABLE_NAME.""])) $GLOBALS["".MS_USER_TABLE_NAME.""] = new cpengguna; // Page ID if (!defined("EW_PAGE_ID")) define("EW_PAGE_ID", 'ClearUserSession', TRUE); // Start timer if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer(); // Open connection if (!isset($conn)) $conn = ew_Connect(); } // // Page_Init // function Page_Init() { global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm; // User profile $UserProfile = new cUserProfile(); $UserProfile->LoadProfile(@$_SESSION[EW_SESSION_USER_PROFILE]); // Security $Security = new cAdvancedSecurity(); // Uncomment codes below for security if (!$Security->IsLoggedIn()) $Security->AutoLogin(); if (!$Security->IsLoggedIn()) $this->Page_Terminate("login.php"); if (!$Security->IsAdmin()) { header("Location: logout.php"); } // Begin of modification Auto Logout After Idle for the Certain Time, by Masino Sinaga, May 5, 2012 $LastAccessDateTime = strval(@$UserProfile->Profile[EW_USER_PROFILE_LAST_ACCESSED_DATE_TIME]); if (ew_DateDiff($LastAccessDateTime, ew_StdCurrentDateTime(), "n") > MS_AUTO_LOGOUT_AFTER_IDLE_IN_MINUTES) { header("Location: logout.php"); } // End of modification Auto Logout After Idle for the Certain Time, by Masino Sinaga, May 5, 2012 // Global Page Loading event (in userfn*.php) Page_Loading(); // Page Load event $this->Page_Load(); } // // Page_Terminate // function Page_Terminate($url = "") { global $conn; // Page Unload event $this->Page_Unload(); // Global Page Unloaded event (in userfn*.php) Page_Unloaded(); $this->Page_Redirecting($url); // Close connection $conn->Close(); // Go to URL if specified if ($url <> "") { if (!EW_DEBUG_ENABLED && ob_get_length()) ob_end_clean(); header("Location: " . $url); } exit(); } // // Page main // function Page_Main() { global $Language, $conn, $UP, $UserID_Parameter; $UserID_Parameter = MS_USER_NAME_PARAMETER; if (isset($_GET[$UserID_Parameter]) && $_GET[$UserID_Parameter]=="0") { $this->setFailureMessage($Language->Phrase('ChooseUserIDForSessionID')); } elseif (isset($_GET[$UserID_Parameter])) { $sSqlWrk = "SELECT ".MS_USER_NAME_FIELD." FROM ".EW_USER_TABLE." WHERE ".MS_USER_NAME_FIELD." LIKE '".$_GET[$UserID_Parameter]."' ORDER BY ".MS_USER_NAME_FIELD.""; $rswrk = $conn->Execute($sSqlWrk); if ($rswrk->RecordCount() > 0) { $UP = new cUserProfile(); if ($UP->LoadProfileFromDatabase($_GET[$UserID_Parameter])) { $us = $UP->GetValue(EW_USER_PROFILE_SESSION_ID); if ($us == "") { $this->setSuccessMessage(str_replace("%u", $_GET[$UserID_Parameter], $Language->Phrase('SessionIDCurrentlyFree'))); $UP->SaveProfileToDatabase($_GET[$UserID_Parameter]); } else { $UP->SetValue(EW_USER_PROFILE_SESSION_ID, ""); $UP->SaveProfileToDatabase($_GET[$UserID_Parameter]); $this->setSuccessMessage(str_replace("%u", $_GET[$UserID_Parameter], $Language->Phrase('SessionIDSuccessfullyCleared'))); } } $rswrk->Close(); } else { if (strlen($_GET[$UserID_Parameter])>0) { $this->setFailureMessage($Language->Phrase('UserIDNotFound')); } } } } // Page Load event function Page_Load() { //echo "Page Load"; } // Page Unload event function Page_Unload() { //echo "Page Unload"; } // Page Redirecting event function Page_Redirecting(&$url) { // Example: //$url = "your URL"; } // Message Showing event // $type = ''|'success'|'failure' function Message_Showing(&$msg, $type) { // Example: //if ($type == 'success') $msg = "your success message"; } } ?> <?php ew_Header(FALSE) ?> <?php // Create page object if (!isset($ClearUserSession)) $ClearUserSession = new cClearUserSession(); // Page init $ClearUserSession->Page_Init(); // Page main $ClearUserSession->Page_Main(); // Begin of modification Displaying Breadcrumbs in All Pages, by Masino Sinaga, May 4, 2012 getCurrentPageTitle(ew_CurrentPage()); // End of modification Displaying Breadcrumbs in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php include_once "header.php" ?> <?php $ClearUserSession->ShowMessage(); ?> <!-- Put your custom html here --> <?php // Begin of modification Displaying Breadcrumbs in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php if (MS_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="ewContainer"> <ul id="breadcrumb"> <?php $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".ew_CurrentPage()."') ORDER BY C.Lft"; $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rs->fields("Page_URL")."' title='".$Language->BreadcrumbPhrase("Home")."'><img src='./phpimages/home.png' alt='".$Language->BreadcrumbPhrase("Home")."' class='home' /></a></li>"; } else { echo "<li><a href='". $rs->fields("Page_URL")."'>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</li>"; } $i++; $rs->MoveNext(); } $rs->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumbs in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php global $Language, $conn, $UP, $UserID_Parameter; $UserID_Parameter = MS_USER_NAME_PARAMETER; ?> <body onload="document.frmreset.<?php echo $UserID_Parameter; ?>.focus()"> <div id="ewContainer"> <span class="phpmaker ewTitle"><?php echo $Language->Phrase('ClearUserSessionID'); ?> <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> </span> </div> <br /><br /><br /><br /> <form name="frmreset" action="clearusersession.php" method="get" class="ewForm" > <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="option"> <strong><?php echo $Language->Phrase('ClearUserSessionID'); ?></strong></font> </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> <td> </td> <tr/> <tr> <td> </td> <td> </td> <td> </td> <tr/> <tr> <td> </td> <td> </td> <td> </td> <tr/> <tr> <td width="35%"> <?php echo $Language->Phrase('UserID'); ?></td> <td width="65%"> <select name="<?php echo $UserID_Parameter; ?>"> <option value="0" selected ><?php echo $Language->Phrase('PleaseSelect'); ?></option> <?php $sSqlWrk = "SELECT ".MS_USER_NAME_FIELD." FROM ".EW_USER_TABLE." WHERE ".EW_USER_PROFILE_FIELD_NAME." NOT LIKE '%\"SessionID\";s:0:%' ORDER BY ".MS_USER_NAME_FIELD; $rswrk = $conn->Execute($sSqlWrk); while (!$rswrk->EOF) { $selected = ($rswrk->fields($UserID_Parameter)==@$_GET[$UserID_Parameter])?'selected':''; ?> <option value="<?php echo $rswrk->fields($UserID_Parameter);?>"<?php echo $selected; ?>><?php echo $rswrk->fields($UserID_Parameter);?></option> <?php $rswrk->MoveNext(); } $rswrk->Close(); ?> </select> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td class="ewTableHeader"> </td> <td><span class="phpmaker"><input type="submit" class="msButton" name="submit" id="submit" value="<?php echo $Language->Phrase('ClearUserSessionID'); ?>"></span></td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <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"> <a href="<!--##=sFnLogin##-->"><!--##@BackToLogin##--></a></td> <td width="8" height="29" align="left" valign="top"><img src="phpimages/storybox-bottom-right.gif"></td> </tr> </table> </form> </body> <br /> <?php include_once "footer.php" ?> <?php $ClearUserSession->Page_Terminate(); ?>
- Important: Please also implement the customization in my another article: How to Improve LoadProfileFromDatabase() and SaveProfileToDatabase() Functions in PHPMaker Template in order to avoid error message when you are calling those both functions.
- Generate the whole of your php script code to apply the changes in the phpcommon-scripts.php file to most of your generated .php code using PHPMaker as always.
[/hidepost]
[…] Please note that this customization below depends on the customization in my previous article: How to Clear User Session ID in Websites that Created with PHPMaker 9.0.1 […]