Home Support Desk 1Faze Shop Hosting SEO Blogs Groups Forums Articles Conference




13 June, 200913 June, 2009 0 comments Code Tweaks and samples Code Tweaks and samples

Open:

 

/templates/tmp_xxx/login_form_ajax.html

Find:

<input type="text" name="ID" class="login_form_input"  />

Replace with:

<input type="text" name="ID" class="login_form_input" value="__name_saver__" />

 

 

 

TagsTags: remember login usability 
12 June, 200912 June, 2009 0 comments Code Tweaks and samples Code Tweaks and samples

Open /templates/tmpl_xxx/login_form.html

Find :

<input type="text" name="ID" class="login_form_input" />

Replace with:

<input type="text" name="ID" class="login_form_input" value="__name_saver__" />

Open /join.php

Find:

function LoginForm( $text, $action, $table, $login_page, $forgot_page, $template = '' )
{
global $site;
global $tmpl;

$aFormReplace = array();



$aFormReplace['header_text'] = $site['title'] . ' ' . $mem . ' Login';
if( $action == "login" )
{
$aFormReplace['warning_text'] = $text;
$aFormReplace['submit_label'] = _t("_Log In");
$aFormReplace['form_onsubmit'] = 'return true;';
}
elseif( $action == 'boonex' )
{
$aFormReplace['warning_text'] = $text .
'<div class="id">' .
'<a href="javascript:void(0);"
onclick="window.open(\'http://www.boonex.com/unity/express/XML.php?module=form&amp;action=joinForm&amp;community=3\', \'Boonex_Sign_Up\', \'width=400,height=593,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=0\');">' .
_t( '_Get BoonEx ID' ) .
'</a>'.
'</div>';

$aFormReplace['submit_label'] = _t("_Import");

$aFormReplace['form_onsubmit'] = 'getBoonexId( this, document.forms.join_form ); return false;';
}
$aFormReplace['action_url'] = $login_page;
$aFormReplace['relocate_url'] = $_SERVER['PHP_SELF'];
$aFormReplace['name_label'] = $name_label;

$aFormReplace['password_label'] = _t("_Password");

if( $forgot_page )
{
$aFormReplace['forgot_page_url'] = $forgot_page;
$aFormReplace['forgot_label'] = _t("_forgot_your_password") . '?';
}
else
{
$aFormReplace['forgot_page_url'] = '';
$aFormReplace['forgot_label'] = '';
}

if( !strlen( $template ) )
$template = BX_DIRECTORY_PATH_ROOT . "templates/tmpl_{$tmpl}/join_login_form.html";

$ret = file_get_contents( $template );

foreach( $aFormReplace as $key => $val )
$ret = str_replace( "__{$key}__", $val, $ret );

return $ret;
}

Replace with:

function LoginForm( $text, $action, $table, $login_page, $forgot_page, $template = '' )
{
global $site;
global $tmpl;

$aFormReplace = array();

$name_label = _t("_Nickname");

if (isset($_COOKIE['whoIsMe'])) { $name_saver = $_COOKIE['whoIsMe']; }


$aFormReplace['header_text'] = $site['title'] . ' ' . $mem . ' Login';
if( $action == "login" )
{
$aFormReplace['warning_text'] = $text;
$aFormReplace['submit_label'] = _t("_Log In");
$aFormReplace['form_onsubmit'] = 'return true;';
}
elseif( $action == 'boonex' )
{
$aFormReplace['warning_text'] = $text .
'<div class="id">' .
'<a href="javascript:void(0);"
onclick="window.open(\'http://www.boonex.com/unity/express/XML.php?module=form&amp;action=joinForm&amp;community=3\', \'Boonex_Sign_Up\', \'width=400,height=593,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=0\');">' .
_t( '_Get BoonEx ID' ) .
'</a>'.
'</div>';

$aFormReplace['submit_label'] = _t("_Import");

$aFormReplace['form_onsubmit'] = 'getBoonexId( this, document.forms.join_form ); return false;';
}
$aFormReplace['action_url'] = $login_page;
$aFormReplace['relocate_url'] = $_SERVER['PHP_SELF'];
$aFormReplace['name_label'] = $name_label;
$aFormReplace['name_saver'] = $name_saver;

$aFormReplace['password_label'] = _t("_Password");

if( $forgot_page )
{
$aFormReplace['forgot_page_url'] = $forgot_page;
$aFormReplace['forgot_label'] = _t("_forgot_your_password") . '?';
}
else
{
$aFormReplace['forgot_page_url'] = '';
$aFormReplace['forgot_label'] = '';
}

if( !strlen( $template ) )
$template = BX_DIRECTORY_PATH_ROOT . "templates/tmpl_{$tmpl}/join_login_form.html";

$ret = file_get_contents( $template );

foreach( $aFormReplace as $key => $val )
$ret = str_replace( "__{$key}__", $val, $ret );

return $ret;
}

Part 3 to follow...

TagsTags: remember login usability 
12 June, 200912 June, 2009 0 comments Code Tweaks and samples Code Tweaks and samples

 

 

 

Every blog has to some starting point. Might as well be me.

Recently we had a client request the 'Remember Me' function be changed to allow the user
to close the browser and when they return their user name would be already filled into the
login form

 

 

 

Well here is how we did it in Dolphin 6.16

 

 

 

Open member.php

Find :

// Check if ID and Password are correct (addslashes already inside)
if ( check_login( $member['ID'], $member['Password'] ) )
{
$iCookieTime = 0;

if (isset($_POST['rememberMe']) && $_POST['rememberMe'])
$iCookieTime = time() + 24*60*60*30;

setcookie( "memberID", $_COOKIE['memberID'], time() - 24*60*60, '/' );
setcookie( "memberPassword", $_COOKIE['memberPassword'], time() - 24*60*60, '/' );
setcookie( "memberID", $member['ID'], $iCookieTime, '/' );
setcookie( "memberPassword", $member['Password'], $iCookieTime, '/' );
//setcookie( 'userArray', 'aUser' . $member['ID'] );
$update_res = db_res( "UPDATE `Profiles` SET `DateLastLogin` = NOW() WHERE `ID` = {$member['ID']}" );
createUserDataFile( $member['ID'] );

Change to:

// Check if ID and Password are correct (addslashes already inside)
if ( check_login( $member['ID'], $member['Password'] ) )
{
$iCookieTime = 0;

if (isset($_POST['rememberMe']) && $_POST['rememberMe']){

$the_user = db_value("SELECT NickName FROM Profiles WHERE ID = '".$member['ID']."'");

$iCookieTime = mktime (0, 0, 0, 12, 31, 2015); // time() + 24*60*60*30;
setcookie( "whoIsMe", $the_user, $iCookieTime, '/' );
}

setcookie( "memberID", $_COOKIE['memberID'], time() - 24*60*60, '/' );
setcookie( "memberPassword", $_COOKIE['memberPassword'], time() - 24*60*60, '/' );
setcookie( "memberID", $member['ID'], $iCookieTime, '/' );
setcookie( "memberPassword", $member['Password'], $iCookieTime, '/' );
//setcookie( 'userArray', 'aUser' . $member['ID'] );
$update_res = db_res( "UPDATE `Profiles` SET `DateLastLogin` = NOW() WHERE `ID` = {$member['ID']}" );
createUserDataFile( $member['ID'] );

 

 

 

 

TagsTags: remember login usability 
Description
danielsolution
Posts: 3
Comments: 0
Developing for Boonex Dolphin Community software
Categories
Tags
3 usability (3)
3 login (3)
3 remember (3)