Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding loginbox by change header.php/english.php


Guest

Recommended Posts

I'm adding "LoginboxV5.4_in_header" at header by update some code from header.php/english.php/sts_user_code.php, but the login box doesn't show to the header.

How to add additional code to header.php if I'm using Simple Template System?

Do I made correct update for sts_user_code.php?

Please help!! ;)

 

sts_user_code.php Code

-------------------------------------------------------------------

$sts_block_name = 'header';

require(STS_START_CAPTURE);

require(DIR_WS_INCLUDES . 'header.php');

require(STS_STOP_CAPTURE);

$template['header'] = strip_unwanted_tags($sts_block['header'], 'header');

-------------------------------------------------------------------

 

 

HEADER.PHP CODE

-------------------------------------------------------------------

<?php

/*

$Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

// STS: ADD

$sts_block_name = 'applicationtop2header';

require(STS_RESTART_CAPTURE);

// STS: EOADD

 

// check if the 'install' directory exists, and warn of its existence

if (WARN_INSTALL_EXISTENCE == 'true') {

if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) {

$messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');

}

}

 

// check if the configure.php file is writeable

if (WARN_CONFIG_WRITEABLE == 'true') {

if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) {

$messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');

}

}

 

// check if the session folder is writeable

if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {

if (STORE_SESSIONS == '') {

if (!is_dir(tep_session_save_path())) {

$messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');

} elseif (!is_writeable(tep_session_save_path())) {

$messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');

}

}

}

 

// check session.auto_start is disabled

if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {

if (ini_get('session.auto_start') == '1') {

$messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');

}

}

 

if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {

if (!is_dir(DIR_FS_DOWNLOAD)) {

$messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');

}

}

 

if ($messageStack->size('header') > 0) {

echo $messageStack->output('header');

}

?>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr class="header">

<td valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce') . '</a>'; ?></td>

// BEGIN LOGIN BOX

<td align="right"><?php

/*

IMPORTANT NOTE:

This is not part of the official osC distribution

but an add-on contributed to the osC community. Please

read the README document that are provided

with this file for further information and installation notes.

 

This puts a login request in a box with a login button.

If already logged in, will not show anything.

 

Modified to utilize SSL to bypass Security Alert

 

LoginboxV5.4_header http://avzwebdesign.nl/oscommerce/

*/

 

if ( (!strstr($_SERVER['PHP_SELF'],'login.php'))

and

(!strstr($_SERVER['PHP_SELF'],'create_account.php'))

and

!tep_session_is_registered('customer_id')

) {

?>

<!-- loginbox //-->

<?php

if (!tep_session_is_registered('customer_id')) {

?>

<table width="310"><tr> <td>

<?php

 

$loginboxcontent = tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL'))

. '<table width="310" border="0" cellspacing="0" cellpadding="0"><tr><td colspan="3" class="smallText">'

.'<tr><td class="smallText">'

. tep_draw_separator('pixel_trans.gif', '2', '1')

. BOX_LOGINBOXH_EMAIL

. '</td><td class="smallText" colspan="3">'

. tep_draw_input_field('email_address', '', 'size="10" maxlength="100" style="width: ' . (BOX_WIDTH-30) . 'px"')

.'</td></tr><tr><td class="smallText">'

. tep_draw_separator('pixel_trans.gif', '2', '1')

. BOX_LOGINBOXH_PASSWORD

. '</td><td class="smallText">'

. tep_draw_password_field('password', '', 'size="10" maxlength="40" style="width: ' . (BOX_WIDTH-30) . 'px"')

. '</td><td class="smallText">'

. '<a href="'

. tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL')

. '">'

. BOX_LOGINBOXH_FORGOT_PASSWORD

. '</a></td></tr><tr><td class="smallText" colspan="3">'

. tep_draw_separator('pixel_trans.gif', '5', '25')

. tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN)

. '</form>'

. tep_draw_separator('pixel_trans.gif', '5', '1')

. BOX_LOGINBOXH_TEXT_NEW

. '<a href="'

. tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL')

. '">'

. BOX_LOGINBOXH_NEW

. '</a></td></tr></table>'

;

 

$info_box_contents = array();

$info_box_contents[] = array('align' => '',

'text' => $loginboxcontent);

new infoBox($info_box_contents);

?>

</td>

</tr></table>

<?php

} else {

// If you want to display anything when the user IS logged in, put it

// in here... Possibly a "You are logged in as :" box or something.

}

?>

<!-- loginbox_eof //-->

<?php

// WebMakers.com Added: My Account Info Box

} else {

if (tep_session_is_registered('customer_id')) {

?>

 

<!-- my_account_info //-->

<table width="310"><tr>

<td>

<?php

 

 

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left',

'text' => '<table width="310" border="0" cellspacing="0" cellpadding="0"><tr><td class="smallText" colspan="2">'

. tep_draw_separator('pixel_trans.gif', '2', '1')

. '<b><center>'

. tep_customer_greeting()

.'</b></center></td></tr><tr><td class="smallText">'

. '<tr><td class="smallText" colspan="2">'

. tep_draw_separator('pixel_trans.gif', '2', '20')

. '<b>'

. BOX_HEADING_LOGIN_BOX_MY_ACCOUNT

.'</b></td></tr><tr><td class="smallText">'

. tep_draw_separator('pixel_trans.gif', '2', '15') .

'<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') .'">' . LOGIN_BOX_MY_ACCOUNT . '</a><td class="smallText">' .

'<a href="' . tep_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL') .'">' . LOGIN_BOX_ACCOUNT_EDIT . '</a></td></tr><tr><td class="smallText">' . tep_draw_separator('pixel_trans.gif', '2', '1') .

'<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL') .'">' . LOGIN_BOX_ACCOUNT_HISTORY . '</a><td class="smallText">' .

'<a href="' . tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL') .'">' . LOGIN_BOX_ADDRESS_BOOK . '</a></td></tr><tr><td class="smallText">' . tep_draw_separator('pixel_trans.gif', '', '1') .

'<a href="' . tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'NONSSL') .'">' . LOGIN_BOX_PRODUCT_NOTIFICATIONS . '</a><td class="smallText">' .

'<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'NONSSL') .'">' . LOGIN_BOX_LOGOFF . '</a></td></tr></table>');

new infoBox($info_box_contents);

?>

</td>

</tr></table>

<!-- my_account_info_eof //-->

 

<?php

} // END-IF SESSION REGISTERED

 

} // END-IF

 

?></td>

//END LOGIN BOX

<td align="right" valign="bottom"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>  <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>  <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?>  </td>

</tr>

</table>

<table border="0" width="100%" cellspacing="0" cellpadding="1">

<tr class="headerNavigation">

<td class="headerNavigation">  <?php echo $breadcrumb->trail(' » '); ?></td>

//BELOW CHANGE For Header LOGIN BOX

<td align="right" class="headerNavigation"><a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   </td>

//Existing Before Header LOGIN BOX

//<td align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>  |  <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   </td> </tr>

</table>

<?php

if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) {

?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="headerError">

<td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td>

</tr>

</table>

<?php

}

 

if (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) {

?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="headerInfo">

<td class="headerInfo"><?php echo htmlspecialchars($HTTP_GET_VARS['info_message']); ?></td>

</tr>

</table>

<?php

}

 

// STS: ADD

$sts_block_name = 'header';

require(STS_RESTART_CAPTURE);

// STS: EOADD

 

?>

-------------------------------------------------------------------

Adding below to English.php

-------------------------------------------------------------------

// Login Box & My Account in header.php

define('BOX_LOGINBOXH_EMAIL', 'E-mail address:');

define('BOX_LOGINBOXH_PASSWORD', 'Password:');

define('BOX_LOGINBOXH_TEXT_NEW', 'new client? ');

define('BOX_LOGINBOXH_NEW', '<b><u>create an account</u></b>');

define('BOX_LOGINBOXH_FORGOT_PASSWORD', '<u>(forgotten)</u>');

 

define('BOX_HEADING_LOGIN_BOX_MY_ACCOUNT','My account info');

define('LOGIN_BOX_ACCOUNT_EDIT','Edit account info.');

define('LOGIN_BOX_ACCOUNT_HISTORY','Account history');

define('LOGIN_BOX_ADDRESS_BOOK','My address book');

define('LOGIN_BOX_PRODUCT_NOTIFICATIONS','Product notifications');

define('LOGIN_BOX_MY_ACCOUNT','General information');

define('LOGIN_BOX_LOGOFF','<b><u>Log off</b></u>');

-------------------------------------------------------------------

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...