jtingle Posted March 17, 2003 Share Posted March 17, 2003 First, I love OsCommerce I have been looking at code till my eyes hurt. :D Is there a way to require login on a page that I have created. I know there is and I have been looking for a require statement, am I off base :?: Any help will be greatly appreciated. Link to comment Share on other sites More sharing options...
Ajeh Posted March 17, 2003 Share Posted March 17, 2003 Edit the /includes/application_top.php and change the line: // Shopping cart actions To read: // WebMakers.com Added: Forced Login if (!tep_session_is_registered('customer_id') and (!strstr($PHP_SELF,FILENAME_LOGIN) and !strstr($PHP_SELF,'create'))) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } // Shopping cart actions It is important that the word 'create' be used rather than the filename otherwise you need to define all of the create_ files individually to process new accounts as well as login an existing account. Link to comment Share on other sites More sharing options...
Ajeh Posted March 17, 2003 Share Posted March 17, 2003 Moved to a better forum. Tips and Tricks are for when you have one to share ... not when you need one ... 8) Link to comment Share on other sites More sharing options...
jtingle Posted March 17, 2003 Author Share Posted March 17, 2003 Sorry about that. Thank you for your help. John Link to comment Share on other sites More sharing options...
Druide Posted March 17, 2003 Share Posted March 17, 2003 Thanks Linda nice 'TIP' about 'create' Robert We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;) Link to comment Share on other sites More sharing options...
Ajeh Posted March 17, 2003 Share Posted March 17, 2003 Got to watch for those background file processes that happen when a submit occures and be sure to include them if they are about to pass through a redirect statement that also is dependant on filename. Otherwise ... you wonder what that white page is ... 8) And that is the perpetual loop until the server craps out your php routine ... providing it does terminate it for you eventually. :oha: Link to comment Share on other sites More sharing options...
jtingle Posted March 17, 2003 Author Share Posted March 17, 2003 Thank you for your help. I was looking for a way to just force login when that particular page was clicked. Sorry if I sound kind of slow :oops: , but I am learning. :) Link to comment Share on other sites More sharing options...
dreamscape Posted March 17, 2003 Share Posted March 17, 2003 sure... looking in the top of checkout_shipping.php provides this code: // if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } this is placed at the beginning of all pages in OSC that require login. The only thing necessary for evil to flourish is for good men to do nothing - Edmund Burke Link to comment Share on other sites More sharing options...
Ajeh Posted March 17, 2003 Share Posted March 17, 2003 Let's say you want the customer logged in to go to the privacy.php page. Adding this after the application_top.php and language file is loaded would send the customer to login if not already logged in. // WebMakers.com Added: Forced Login Per Page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } Link to comment Share on other sites More sharing options...
Gisele Posted April 29, 2003 Share Posted April 29, 2003 What about when someone clicks on Forgot password? The page won't go anywhere, but stays on the Login Page... Edit the /includes/application_top.php and change the line: // Shopping cart actions To read: // WebMakers.com Added: Forced Login if (!tep_session_is_registered('customer_id') and (!strstr($PHP_SELF,FILENAME_LOGIN) and !strstr($PHP_SELF,'create'))) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } // Shopping cart actions It is important that the word 'create' be used rather than the filename otherwise you need to define all of the create_ files individually to process new accounts as well as login an existing account. Link to comment Share on other sites More sharing options...
Ajeh Posted April 29, 2003 Share Posted April 29, 2003 Add in the additional pages you want to that IF statement. Link to comment Share on other sites More sharing options...
clongato Posted August 15, 2003 Share Posted August 15, 2003 the tip works great, but I don?t know how to make the Forgot Password link work properly. Can anyone tip me on this? thank?s Claudio Link to comment Share on other sites More sharing options...
tylerwatkins Posted March 5, 2010 Share Posted March 5, 2010 This tip works great, but the forgotten password page does not work. I know you said to just add the pages to the if statement, but can you please be a little more specific? Thanks for your help. Tyler Watkins Myrtle Beach, SC Link to comment Share on other sites More sharing options...
tylerwatkins Posted March 9, 2010 Share Posted March 9, 2010 I'm still wondering if anyone can help with this? Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.