kajoka Posted December 12, 2010 Share Posted December 12, 2010 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'); } } ?> Quote Link to comment Share on other sites More sharing options...
web-project Posted December 12, 2010 Share Posted December 12, 2010 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) Quote 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. Link to comment Share on other sites More sharing options...
kajoka Posted December 12, 2010 Author Share Posted December 12, 2010 Thanks, that worked! Quote Link to comment Share on other sites More sharing options...
06voip Posted January 24, 2011 Share Posted January 24, 2011 Hi, I have the same problem doing this update v2.2 to v2.3.0: http://www.oscommerce.info/confluence/display/OSCOM23/%28C%29+%28SEC%29+Add+Customer+Session+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 Quote Link to comment Share on other sites More sharing options...
06voip Posted January 28, 2011 Share Posted January 28, 2011 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: Quote Link to comment Share on other sites More sharing options...
sammedit Posted June 3, 2012 Share Posted June 3, 2012 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.