Jump to content



Photo
- - - - -

LoginBox AddOn: Click on Submit button leads to login page not to account page


  • Please log in to reply
5 replies to this topic

#1   kajoka

kajoka
  • Members
  • 16 posts
  • Real Name:Kai Jaensch

Posted 12 December 2010 - 07:59

Hello,

I tried to convert the Contrib Login box 5.4 (http://addons.oscommerce.com/info/2058) for version 2.3.1.

The box is shown as expected (okay, layout needs to be adapted, this is a next step). But after typing in the credentials and clicking the submit button, I am not logged in and led to the account page, but to the login page, where I then have to login then.
What am I doing wrong? What needs to be done codewise to get logged in with that login box and to be directed to the account page?
Down below you find the code of the login box I have done by now.

Thanks in advance for your support

Kajoka


<?php
/*
  $Id$

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

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License
*/

  class bm_login {
    var $code = 'bm_login';
    var $group = 'boxes';
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;

    function bm_login() {
      $this->title = MODULE_BOXES_LOGIN_TITLE;
      $this->description = MODULE_BOXES_LOGIN_DESCRIPTION;

      if ( defined('MODULE_BOXES_LOGIN_STATUS') ) {
        $this->sort_order = MODULE_BOXES_LOGIN_SORT_ORDER;
        $this->enabled = (MODULE_BOXES_LOGIN_STATUS == 'True');

        $this->group = ((MODULE_BOXES_LOGIN_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
      }
    }

    function execute() {
      global $oscTemplate;

		if ((!strstr($_SERVER['PHP_SELF'],'login.php'))
		and
			(!strstr($_SERVER['PHP_SELF'],'create_account.php'))
		and
			(!strstr($_SERVER['PHP_SELF'],'order_info.php'))
		and
			(!strstr($_SERVER['PHP_SELF'],'order_info_process.php'))
		and
			(!tep_session_is_registered('customer_id')))
		{
			// loginbox
			if (!tep_session_is_registered('customer_id')) {
	  
				$data = '<div class="ui-widget infoBoxContainer">'.
						'  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_LOGIN_BOX_TITLE . '</div>' .
						'  <div class="ui-widget-content infoBoxContents">'
						. tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL')) 
						. MODULE_BOXES_LOGIN_EMAIL
						 		 . tep_draw_input_field('email_address', '', 'size="10" maxlength="100" style="width: ' . (BOX_WIDTH-30) . 'px"')
								 .'<br><br>'
								 . MODULE_BOXES_LOGIN_PASSWORD
								 . tep_draw_password_field('password', '', 'size="10" maxlength="40" style="width: ' . (BOX_WIDTH-30) . 'px"')
								 .'<a href="'
								 . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL')
								 . '">'
								 . MODULE_BOXES_LOGIN_FORGOT_PASSWORD 
								 . '</a>'
								 . tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN, 'SSL')
								 . '</form><br><br>'
								 .  MODULE_BOXES_LOGIN_TEXT_NEW
								 . '<a href="'
								 . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL')
								 . '">'
								 . MODULE_BOXES_LOGIN_NEW
								 . '</a>'.
						'  </div>' .
						'</div>';
			} else {
				// Hier kann irgendwas rein, was beim Login angezeigt werden soll
			}
		} else {
			if (tep_session_is_registered('customer_id')) {
		
				$data = '<div class="ui-widget infoBoxContainer">'.
						'  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_LOGIN_YOUR_ACCOUNT . '</div>' .
						'  <div class="ui-widget-content infoBoxContents">' .

                                          '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_PRODUCTS_NEW . '</a><br>' .
										  '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_MY_ACCOUNT . '</a><br>' .
                                          '<a href="' . tep_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_ACCOUNT_EDIT . '</a><br>' .
                                          '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_ACCOUNT_HISTORY . '</a><br>' .
                                          '<a href="' . tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_ADDRESS_BOOK . '</a><br>' .
                                          '<a href="' . tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'NONSSL') . '">' . MODULE_BOXES_LOGIN_PRODUCT_NOTIFICATIONS . '</a><br>' .
                                          '<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'NONSSL') . '">' . MODULE_BOXES_LOGIN_LOGOFF . '</a>'.
						'	</div>' .
						'</div>';
			}
		}

      $oscTemplate->addBlock($data, $this->group);
    }

    function isEnabled() {
      return $this->enabled;
    }

    function check() {
      return defined('MODULE_BOXES_LOGIN_STATUS');
    }

    function install() {
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable LoginBox Module', 'MODULE_BOXES_LOGIN_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_LOGIN_CONTENT_PLACEMENT', 'Left Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_LOGIN_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
    }

    function remove() {
      tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }

    function keys() {
      return array('MODULE_BOXES_LOGIN_STATUS', 'MODULE_BOXES_LOGIN_CONTENT_PLACEMENT', 'MODULE_BOXES_LOGIN_SORT_ORDER');
    }
  }
?>





#2   web-project

web-project
  • Members
  • 4,320 posts
  • Real Name:Alex
  • Gender:Male
  • Location:Hertfordshire, UK

Posted 12 December 2010 - 08:44

try the following:

find:
. tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL')) 

replace:
. tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL'), 'post', '', true)

Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!
8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.
Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.
Any issues with oscommerce, I am here to help you.

#3   kajoka

kajoka
  • Members
  • 16 posts
  • Real Name:Kai Jaensch

Posted 12 December 2010 - 09:40

Thanks, that worked!

#4   06voip

06voip
  • Members
  • 11 posts
  • Real Name:06voip

Posted 24 January 2011 - 15:46

Hi, I have the same problem doing this update v2.2 to v2.3.0:
http://www.oscommerc... Token to Forms

This is my loginbox.php:
<?php
/*
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2002 osCommerce

  Released under the GNU General Public License

  IMPORTANT NOTE:

  This script is not part of the official osC distribution
  but an add-on contributed to the osC community. Please
  read the README and  INSTALL documents that are provided
  with this file for further information and installation notes.

  loginbox.php -   Version 1.0
  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
*/

// WebMakers.com Added: Do not show if on login or create account
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')) {
?>
          <tr>
            <td>
<?php
    $info_box_contents = array();
    $info_box_contents[] = array('align' => 'left',
                                 'text'  => BOX_LOGINBOX_HEADING
                                );
    new infoBoxHeading($info_box_contents, true, true);
    $loginboxcontent = "
            <table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
            <form name=\"login\" method=\"post\" action=\"" . tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL') . "\">
              <tr>
                <td align=\"center\" class=\"infoBoxContents\">
              	  " . tep_loginbox_greeting_top() . "
                </td>
              </tr>
              <tr>
                <td align=\"center\" class=\"infoBoxContents\">
                  " . BOX_LOGINBOX_EMAIL . "
                </td>
              </tr>
              <tr>
                <td align=\"center\" class=\"infoBoxContents\">
                  <input type=\"text\" style=\"font-size: 11px\" name=\"email_address\" maxlength=\"96\" size=\"18\" value=\"\">
                </td>
              </tr>
              <tr>
                <td align=\"center\" class=\"infoBoxContents\">
                  " . BOX_LOGINBOX_PASSWORD . "
                </td>
              </tr>
              <tr>
                <td align=\"center\" class=\"infoBoxContents\">
                  <input type=\"password\" name=\"password\" maxlength=\"40\" size=\"18\" value=\"\"
                </td>
              </tr>
              <tr>
                <td class=\"infoBoxContents\" align=\"center\"><br>
                  " . tep_image_submit('small_login.gif', IMAGE_BUTTON_LOGIN, 'SSL') . "
                </td>
              </tr>
              <tr>
                <td align=\"center\" class=\"infoBoxContents\">
              	" . tep_loginbox_greeting_bottom() . "
                </td>
              </tr>
            </form>
            </table>
              ";
    $info_box_contents = array();
    $info_box_contents[] = array('align' => 'center',
                                 'text'  => $loginboxcontent
                                );
    new infoBox($info_box_contents);
?>
            </td>
          </tr>
<?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 //-->
 
<!-- my_account_info_eof //-->

<?php
  }
}
?>

What can I do to sort out it?

Thanks in advance

06voip

#5   06voip

06voip
  • Members
  • 11 posts
  • Real Name:06voip

Posted 28 January 2011 - 08:25

Ok, I solved it by replacing:
<form name=\"login\" method=\"post\" action=\"" . tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL') . "\"> 
with:
".  tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL'), 'post', '', true) . "

Thanks to web-project! :rolleyes:

#6   sammedit

sammedit
  • Members
  • 85 posts
  • Real Name:B
  • Gender:Male

Posted 03 June 2012 - 06:55

I have this same problem with the 1.1 version on Osc 2.3.1. Clicking the "Sign In" button takes you to the login page but doesn't log you in. The fixes posted above were already included in the 1.1 file. Anyone see any other problems?