Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Login in header.


KJ666

Recommended Posts

Posted

I have been looking all around for a login box to go in the header on the top right of my website.

What i want is

 

E-mail Password loginbutton

 

Then when you logged in it will say somthing like

First name last name, Welcome to websitename

 

Anyhelp on this please.

Posted

Thanks for your help, Need abit more tho.

I would like the e-mail and password writing already in the form areas that you click like where you write your e-mail address instead of next to it.

	<td valign="top" align="right"><?php echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL')); ?>
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="3">
		<tr>
		  <td class="smallText"><?php echo ENTRY_LOGIN_EMAIL_ADDRESS; ?></td>
		  <td><?php echo tep_draw_input_field('email_address'); ?></td>
		  <td></td>
		  <td class="smallText"><?php echo ENTRY_LOGIN_PASSWORD; ?></td>
		  <td><?php echo tep_draw_password_field('password'); ?></td>
		  <td><?php echo tep_image_submit('button_go.gif', IMAGE_BUTTON_GO); ?></td>
		</tr>
	  </table></td>
  </tr>
 </table></form></td>

Posted

Maybe:

	<td valign="top" align="right"><?php echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL')); ?>
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="3">
		<tr>
		  <td><?php echo tep_draw_input_field('email_address', ENTRY_LOGIN_EMAIL_ADDRESS); ?></td>
		  <td><?php echo tep_draw_password_field('password', ENTRY_LOGIN_PASSWORD); ?></td>
		  <td><?php echo tep_image_submit('button_go.gif', IMAGE_BUTTON_GO); ?></td>
		</tr>
	  </table></td>
  </tr>
 </table></form></td>

For anything more elaborate, you'd probably need to use javascript.

Always back up before making changes.

Posted

Ummm that is kinda what i wanted but when you click the box it disappers as other wise you have to delte the e-mail address bit your self, which takes more time.

Posted

I have a really big problem now, I used the login, and now it has gone i wanted it so it still there saying somthing like welcome back with a logoff button :( anyideas ??

Posted

Can some one help me with this, so when they log in it will display there name and a log off button as well ??

Also sort the username and password writing ?

  • 2 weeks later...
Posted

I used the login from this post and Matt's bit of mod - the only time mine vanishes is when the full login page appears, I changed or removed a lot of the headings which I didn't think was necessary (they can be accessed from my admin) after login as I only have a narrow header at that point.

 

My header is not standard though and I have a seperate header_login.php file:

<?php
// added for loginbox
 if ( (basename($PHP_SELF) != FILENAME_LOGIN) && (basename($PHP_SELF) !=  FILENAME_CREATE_ACCOUNT) && !tep_session_is_registered('customer_id')) { 
 if (!tep_session_is_registered('customer_id')) {


// loginbox
 echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL'));
             echo tep_draw_input_field('email_address', ENTRY_LOGIN_EMAIL_ADDRESS);
             echo tep_draw_password_field('password', ENTRY_LOGIN_PASSWORD);
             echo tep_image_submit('button_go.gif', IMAGE_BUTTON_GO . '    ');
		  echo '<a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '" class="loginboxarea">' . TEXT_LOGIN_PASSWORD_FORGOTTEN . '</a>';
 echo '</form>';
?>
<?php
  } // close !tep_session_is_registered
 } else { 
 if (!tep_session_is_registered('customer_id')) {
// If you want something to show in place of the loginbox when logge in or on login or create account page,
// place that code between the <td align="left"></td> below
?>
   <td align="right"></td>
<?php
 } //close !tep_session_is_registered
} // close if
// end loginbox
?>
<?php
// added for my account nav bar links for loginbox
   if (tep_session_is_registered('customer_id')) {

// my_account_info //-->
             echo '<strong>' . HEADER_LOGIN_TITLE_GREETING . ' '  . $customer_first_name . '</strong>' . '  |  ';
		  echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') .'" class="loginboxarea">' . HEADER_LOGIN_TITLE_MY_ACCOUNT . '</a> | ';
		  echo '<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') .'" class="loginboxarea">' . HEADER_LOGIN_TITLE_LOGOFF . '</a>';

   } // close if
// end my account nav bar links for loginbox
?>     

 

Note line after my_account_info This will put the login title greeting (from languages) and the customer's first name

My store is currently running Phoenix 1.0.3.0

I'm currently working on 1.0.7.2 and hope to get it live before 1.0.8.0 arrives (maybe 🙄 )

I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary

  • 3 weeks later...
Posted

Bit of help with that code works great though, how can i get it to display on the create account page and the login page ?

 

Somthing to do with this part of the code ?

// added for loginbox

if ( (basename($PHP_SELF) != FILENAME_LOGIN) && (basename($PHP_SELF) != FILENAME_CREATE_ACCOUNT) && !tep_session_is_registered('customer_id')) {

if (!tep_session_is_registered('customer_id')) {

Posted

It doesn't show on the create account page or the login page as it's not needed on those pages - if you think about it!!!

My store is currently running Phoenix 1.0.3.0

I'm currently working on 1.0.7.2 and hope to get it live before 1.0.8.0 arrives (maybe 🙄 )

I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary

Posted

Yer i know but if you look at my website you what it does to my header ??

Any idea how to sort this ?

I thought the easyist way would be to make it show on them two pages ?

Posted

Yes it is?

Sorry but i dont understand what that has to do with adding the login bit to the header of them two pages ? (sorry not meant to sound rude just asking)

Posted

I had a look at your site last night - I can see your problem but not the solution because you are putting the code in the header it should look the same for every page... can you post up your header.php file?

My store is currently running Phoenix 1.0.3.0

I'm currently working on 1.0.7.2 and hope to get it live before 1.0.8.0 arrives (maybe 🙄 )

I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary

Posted

Header.php

 

<?php
/*
 $Id: header.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// 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 width="1000" align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="header">
<td align="left" class="languageboxarea"><?php require(DIR_WS_BOXES .
'header_languages.php'); ?></td>
<tr>
<td align="right">
<?php require(DIR_WS_BOXES . 'login.php'); ?>		
</td>
</tr> 
<tr>
<td><a href="index.php"><img src="images/logo.gif" alt="KJExotics logo" width="500" height="125" align="left" border="none"></a></td>
</tr>
<tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="top-menu">
<tr><td><table border="0" cellspacing="0" cellpadding="0"><tr>
<td><a href="index.php"><img src="images/layout/home.gif" alt="Home" border="none"></a></td>
<td><img src="images/layout/nav_div.gif"></td>
<td><a href="about_us.php"><img src="images/layout/aboutus.gif" alt="About us" border="none"></a></td>
<td><img src="images/layout/nav_div.gif"></td>
<td><a href="livestock-c-21.html"><img src="images/layout/livestock.gif" alt="Livestock" border="none"></a></td>
<td><img src="images/layout/nav_div.gif"></td>
<td><a href="account.php"><img src="images/layout/myaccount.gif" alt="My account" border="none"></a></td>
<td><img src="images/layout/nav_div.gif"></td>
<td><a href="shopping_cart.php"><img src="images/layout/shoppingcart.gif" alt="Shopping cart" border="none"></a></td>
</tr>
</table></td>
<td align="right">
<?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH+10) . 'px"') . ' ' . tep_hide_session_id() .tep_image_submit('mini_search.gif', BOX_HEADING_ADVSEARCH, 'align=""')  . '</form>'; ?>		
</td>
</tr>
</table></td>
</tr>
<tr><td>
<table class="breadcrumb">
<tr>
<td><?php echo $breadcrumb->trail(' - '); ?></td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
<tr>
<td>
<table width="100%" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<div class="top"><div class="middle">

 

Login.php

 

<?php
// added for loginbox
 if ( (basename($PHP_SELF) != FILENAME_LOGIN) && (basename($PHP_SELF) !=  FILENAME_CREATE_ACCOUNT) && !tep_session_is_registered('customer_id')) { 
 if (!tep_session_is_registered('customer_id')) {


// loginbox
 echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL'));
             echo tep_draw_input_field('email_address', ENTRY_LOGIN_EMAIL_ADDRESS);
             echo tep_draw_password_field('password', ENTRY_LOGIN_PASSWORD);
             echo tep_image_submit('button_go.gif', IMAGE_BUTTON_GO . '');
             echo '<a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '" class="loginboxarea">' . TEXT_LOGIN_PASSWORD_FORGOTTEN . '</a>';
 echo '</form>';
?>
<?php
  } // close !tep_session_is_registered
 } else { 
 if (!tep_session_is_registered('customer_id')) {
// If you want something to show in place of the loginbox when logge in or on login or create account page,
// place that code between the <td align="left"></td> below
?>
   <td align="right"></td>
<?php
 } //close !tep_session_is_registered
} // close if
// end loginbox
?>
<?php
// added for my account nav bar links for loginbox
   if (tep_session_is_registered('customer_id')) {

// my_account_info //-->
             echo '<strong>' . HEADER_LOGIN_TITLE_GREETING . ' '  . $customer_first_name . '</strong>' . '  |  ';
                         echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') .'" class="loginboxarea">' . HEADER_LOGIN_TITLE_MY_ACCOUNT . '</a> | ';
                         echo '<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') .'" class="loginboxarea">' . HEADER_LOGIN_TITLE_LOGOFF . '</a>';

   } // close if
// end my account nav bar links for loginbox
?>     

Posted

Try this for the header.php (table part):

 


<table width="1000" align="center" border="0" cellspacing="0" cellpadding="0">
 <tr>
   <td>
     <table width="100%" border="0" cellspacing="0" cellpadding="0" class="header">
       <tr>
         <td align="left" class="languageboxarea">
           <?php require(DIR_WS_BOXES . 'header_languages.php'); ?>
         </td>
         <td align="right">
           <?php require(DIR_WS_BOXES . 'login.php'); ?>
         </td>
       </tr> 
       <tr>
         <td  colspan="2">
           <a href="index.php"><img src="images/logo.gif" alt="KJExotics logo" width="500" height="125" align="left" border="none"></a></td>
         </tr>
        <tr>
           <td colspan="2">
             <table width="100%" border="0" cellspacing="0" cellpadding="0" class="top-menu">
               <td>
                 <a href="index.php"><img src="images/layout/home.gif" alt="Home" border="none"></a>
               </td>
               <td>
                 <img src="images/layout/nav_div.gif">
               </td>
               <td>
                 <a href="about_us.php"><img src="images/layout/aboutus.gif" alt="About us" border="none"></a>
               </td>
               <td>
                 <img src="images/layout/nav_div.gif">
               </td>
               <td>
                 <a href="livestock-c-21.html"><img src="images/layout/livestock.gif" alt="Livestock" border="none"></a>
               </td>
               <td>
                 <img src="images/layout/nav_div.gif">
               </td>
               <td>
                 <a href="account.php"><img src="images/layout/myaccount.gif" alt="My account" border="none"></a>
               </td>
               <td>
                 <img src="images/layout/nav_div.gif">
               </td>
               <td>
                 <a href="shopping_cart.php"><img src="images/layout/shoppingcart.gif" alt="Shopping cart" border="none"></a>
               </td>
               <td align="right">
                 <?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH+10) . 'px"') . ' ' . tep_hide_session_id() .tep_image_submit('mini_search.gif', BOX_HEADING_ADVSEARCH, 'align=""')  . '</form>'; ?>search
               </td>
             </tr>
           </table>
         </td>
       </tr>
       <tr>
         <td>
           <table class="breadcrumb">
             <tr>
               <td>
                 <?php echo $breadcrumb->trail(' - '); ?>
               </td>
             </tr>
           </table>
         </td>
       </tr>
     </table>
   </td>
 </tr>
 <tr>
   <td>
     <table width="100%" cellspacing="0" cellpadding="0" align="center">
       <tr>
         <td>
           <div class="top"><div class="middle">
         </td>
       </tr>
     </table>
   </td>
  <tr>
</table>

 

The last 6 lines closes off the opening table, this may be done elsewhere e.g. in your footer.php so you may not need them

My store is currently running Phoenix 1.0.3.0

I'm currently working on 1.0.7.2 and hope to get it live before 1.0.8.0 arrives (maybe 🙄 )

I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary

Posted

That kinda works better, but if you look at the home page, you can see that the gap from the nav titles and the nav_div is huge.

If you go to the contact us page and the create account page, has moved the search bar to the left too much.

 

Also there is the word search next to the search image.

 

http://www DOT kjexotics.co.uk/euro

Posted

ok so let's try:

<table width="1000" align="center" border="0" cellspacing="0" cellpadding="0">
 <tr>
   <td>
     <table width="100%" border="0" cellspacing="0" cellpadding="0" class="header">
       <tr>
         <td align="left" class="languageboxarea">
           <?php require(DIR_WS_BOXES . 'header_languages.php'); ?>
         </td>
         <td align="right">
           <?php require(DIR_WS_BOXES . 'login.php'); ?>
         </td>
       </tr>
     </table>
       <tr>
         <td>
           <a href="index.php"><img src="images/logo.gif" alt="KJExotics logo" width="500" height="125" align="left" border="none"></a></td>
         </tr>
         <tr>
           <td>
             <table width="100%" border="0" cellspacing="0" cellpadding="0" class="top-menu">
              <td align="left">
                <table width="70%" border="0" cellspacing="0" cellpadding="0">
                   <td>
                     <a href="index.php"><img src="images/layout/home.gif" alt="Home" border="none"></a>
                   </td>
                   <td>
                     <img src="images/layout/nav_div.gif">
                   </td>
                   <td>
                     <a href="about_us.php"><img src="images/layout/aboutus.gif" alt="About us" border="none"></a>
                   </td>
                   <td>
                     <img src="images/layout/nav_div.gif">
                   </td>
                   <td>
                     <a href="livestock-c-21.html"><img src="images/layout/livestock.gif" alt="Livestock" border="none"></a>
                   </td>
                   <td>
                     <img src="images/layout/nav_div.gif">
                   </td>
                   <td>
                     <a href="account.php"><img src="images/layout/myaccount.gif" alt="My account" border="none"></a>
                   </td>
                   <td>
                     <img src="images/layout/nav_div.gif">
                   </td>
                   <td>
                     <a href="shopping_cart.php"><img src="images/layout/shoppingcart.gif" alt="Shopping cart" border="none"></a>
                   </td>
                 </table>
              </td>
                   <td align="right">
                     <?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH+10) . 'px"') . ' ' . tep_hide_session_id() .tep_image_submit('mini_search.gif', BOX_HEADING_ADVSEARCH, 'align=""')  . '</form>'; ?>
                   </td>
             </table>
           </td>
         </tr>
         <tr>
           <td>
             <table class="breadcrumb">
               <tr>
                 <td>
                   <?php echo $breadcrumb->trail(' - '); ?>
                 </td>
               </tr>
             </table>
           </td>
         </tr>
     </td>
   </tr>
   <tr>
     <td>
       <table width="100%" cellspacing="0" cellpadding="0" align="center">
         <tr>
           <td>
             <div class="top"><div class="middle">
           </td>
         </tr>
       </table>
     </td>
   <tr>
 </table>

 

The width of the nav table I've set to 70% you can make it bigger or smaller if you need to

 

 

<EDIT> I left the borders in - taken them out now :rolleyes: </EDIT>

My store is currently running Phoenix 1.0.3.0

I'm currently working on 1.0.7.2 and hope to get it live before 1.0.8.0 arrives (maybe 🙄 )

I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary

Archived

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

×
×
  • Create New...