Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sessions


spiderserve

Recommended Posts

I apologise if this has been asked before, but I am definitely not getting the answer with the search terms I am using!

 

We currently have a password protected area on our website which contains our webshop.

 

As we are changing to osCommerce primarily for the ability for seperate pricing per product and per customer (fantastic contrib!!!), we felt it would make sense for osC to be the login gateway.

 

On the index page, we want to have a link to a few pages which should still be protected.

 

I need a bit of help in finding the variable which contains the session details so I can write a bit of code to redirect a user who is not logged in.

 

I hope this makes sense and that someone out there can help!!

 

Thanks :D

Link to comment
Share on other sites

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

 

The session is automatically added in that function. Also for your links

 

tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL')

 

 

Hope this is what your looking for.

Link to comment
Share on other sites

OK, we have some pages which will not be part of the osC store, but we only want people who have registered with us to be able to access them.

 

So what I was planning on doing was having a normal text link on the index page which uses an external php file to execute a simple if statement to say if the session variable is empty, send the user to pagez else send the user to pagea.

 

Although I was trying to do it using an external file, it has dawned on me that I may have to write the code into the index page.

 

Hope that explains a little better...

Link to comment
Share on other sites

Problem solved!!

 

I set up an new infobox and used an if statement to only show that info box if the user is logged in, and just use a standard href link in the text.

 

As I thought the link might get lost in the menu, I set up a new variable in english.php called TEXT_LICENCE and put my text in there.

Then in the main index.php page I copied my if statement (now using variable TEXT_LICENCE!) to just above the TEXT_MAIN variable, and hey presto, my link is at the top of the page, just where I wanted it!

 

It's amazing what a night's sleep will do for you!!! :thumbsup:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...