bad_lemming Posted February 9, 2005 Share Posted February 9, 2005 (edited) I recently installed the Login box to my store that I have been working on (seems like forever now) and I got to looking at the code and noticed something strange: <?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 5.4 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 or PWA screen 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 //--> <?php if (!tep_session_is_registered('customer_id')) { ?> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_LOGIN_BOX); new SideLoginBoxHeading($info_box_contents, false, false); $loginboxcontent = tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL')) . BOX_LOGINBOX_EMAIL . tep_draw_input_field('email_address', '', 'size="10" maxlength="100" style="width: ' . (BOX_WIDTH-30) . 'px"') .'<br><br>' . BOX_LOGINBOX_PASSWORD . tep_draw_password_field('password', '', 'size="10" maxlength="40" style="width: ' . (BOX_WIDTH-30) . 'px"') . '<br><br>' . tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN) . '</form>' .'<a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '">' . BOX_LOGINBOX_FORGOT_PASSWORD . '</a>' . '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . BOX_LOGINBOX_TEXT_NEW . '</a>' ; $info_box_contents = array(); $info_box_contents[] = array('align' => 'center', 'text' => $loginboxcontent); new SideLoginBox($info_box_contents); ?> </td> </tr> <?php } //---------BOF Part in question-------------------- 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 (but not for PWA clients } //-----------EOF Part in question------------------------ else { if ((tep_session_is_registered('customer_id')) && (!tep_session_is_registered('noaccount'))) { ?> <!-- my_account_info //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => BOX_HEADING_LOGIN_BOX_MY_ACCOUNT); new SideLoginBoxHeading($info_box_contents, false, false); $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, '', 'SSL') . '">' . LOGIN_BOX_PRODUCTS_NEW . '</a><br>' . '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . LOGIN_BOX_MY_ACCOUNT . '</a><br>' . '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL') . '">' . LOGIN_BOX_ACCOUNT_HISTORY . '</a><br>' . '<a href="' . tep_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL') . '">' . LOGIN_BOX_ACCOUNT_EDIT . '</a><br>' . '<a href="' . tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL') . '">' . LOGIN_BOX_ADDRESS_BOOK . '</a><br>' . '<a href="' . tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'NONSSL') . '">' . LOGIN_BOX_PRODUCT_NOTIFICATIONS . '</a><br>' . '<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'NONSSL') . '">' . LOGIN_BOX_LOGOFF . '</a>'); new SideLoginBox($info_box_contents); ?> </td> </tr> <!-- my_account_info_eof //--> <?php } } ?> Shouldn't the part, near the middle that I have spaced out and commented with part in question, be deleted? I am GREEN when it comes to PHP but it seems to me that the account info part really belongs in the Elese statement attached to : if (!tep_session_is_registered('customer_id')) I was planning on modding this so that I could control the styles from logged on to not logged on seperatly. but before I did anything I decided to ask about this as it seems odd to me. Thanks in advance for any responses. Edited February 9, 2005 by bad_lemming Quote Link to comment Share on other sites More sharing options...
bad_lemming Posted February 9, 2005 Author Share Posted February 9, 2005 /bump I hope this question makes sens, would be nice to get some feedback. Quote Link to comment Share on other sites More sharing options...
bad_lemming Posted February 10, 2005 Author Share Posted February 10, 2005 Figured I would give it one more bump before I went to bed tonight :) Sorry if it is such a lame question, i am just not confident with php and was wondering if I made the changes will it have any results other than what seems obvious to me. I guess keeping it in it's current format really doesn' t HURT if it works, but I'd like to get things as unklugey as possible (that is, assuming it is kluged at all in the first place) before going live. :) 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.
Note: Your post will require moderator approval before it will be visible.