Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Undefined function: tep_session_is_registered()


mpiscopo

Recommended Posts

I'm trying to set my catalog so only logged in users can view it. I found where someone had recommended creating a chklogin.php file and requiring it at places such as index.php. The contents of the chklogin.php is:

 

<?php

if (!tep_session_is_registered('customer_id')) {

session_destroy();

tep_redirect(tep_href_link(FILENAME_LOGIN));

}

?>

 

I added the following to my index.php:

require('includes/chklogin.php');

 

And now I get the following error:

Fatal error: Call to undefined function: tep_session_is_registered() in /home/wholesal/public_html/catalog/includes/chklogin.php on line 2

 

I see tep_session_is_registered() still a valid function in the latest version of osC? Is there something else I should be using? Or did I just do something stupid?

 

Recommendations? Thanks in advance.

Link to comment
Share on other sites

Thanks Matti, but I still couldn't get it to work. The top of my index.php file looks like:

require('includes/application_top.php');

require('includes/chklogin.php');

 

Instead I found an alternate method. Below I replaced the tep_session_is_registered line with the one below it; isLoggedOn().. It is working well now.

 

<?php

//if (!tep_session_is_registered('customer_id')) {

if ($osC_Customer->isLoggedOn() == false) {

session_destroy();

tep_redirect(tep_href_link(FILENAME_LOGIN));

}

?>

Link to comment
Share on other sites

For those who are confused, tep_session_is_registered is still part of osCommerce 2.2 MS2. This is the current recommended version. It would not be found in the current CVS nor in future versions. As the current CVS is sort of in the middle of a set of changes, it is not recommended for use--just for testing purposes. Thus the confusion.

 

You can check recent posts by hpdl for more information.

 

Hth,

Matt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...