Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to add a password protected area for customers


Guest

Recommended Posts

I would like to make a section on my site that is restricted to customers only.

 

It would be about 10-15 pages of information which I don't want accessible by anyone that doesn't have an account.

 

Can anyone help with instructions on how to do this?

 

EDIT : Just to clarify. I would like them to use their existing password not a generic one.

 

Thanks in advance :)

Link to comment
Share on other sites

Hi, I am new to OSC too.

 

When a customer signs up membership, his info (includes password) is recorded in MySQL's table "Customer"

 

I use Dreamweaver to create another login page, which is referring the login (customer_email_address) and password (customers_password)

 

However, it seems that the password is not caught properly.

 

I create another table in the same database, make 3 columns (name, password, ID) Then create another sign up page by Dreamweaver. It catches the password properly.

 

Is it any encry of OSC password?? How come I couldn't use a login page created by Dreamweaver to access to the password column??

 

The reason I do another login is I like to create some pages for special customers (as Dreamweaver allows to define user's Level -- and I just simple add one more column into MySQL's table "customer", named "level" -- type "1" for general customers, and "2" for special customer)

 

Thanks.

 

Kay

Link to comment
Share on other sites

I am sure that people have done mods. that make people login before they can do lots of things so what you want is possible. Have you done a search or looked at contributions yet?

 

(Kay, I found it hard to follow what you were saying)

Link to comment
Share on other sites

Hi, thanks for reply.

 

I go through the Contribution page but really couldn't find a mod do my job. There are couples mod for admin account access restriction, but none for customer (and using the info from the "Customer" table)

 

Thanks.

 

Kay

Link to comment
Share on other sites

I have a partial success.

 

I figures out that some pages such as account.php required you to log in to view them. I copied the piece of code which checks if you're logged in and put it into the page which I wanted to be for customers only

 

if (!tep_session_is_registered('customer_id')) {

    $navigation->set_snapshot();

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

  }

 

Then I added a link to my customer only page into one of my boxes and it worked perfectly.

 

The problem is that if I try to link to my customer only page from another page (ie. not from within a box) I have to log in every time which is a bit annoying.

 

I've noticed that when I hover the mouse over the link from the box I get the URL followed by ?osCsid=df74866c29eaa22ba967007621409c82 but when I hover the mouse over the link within a normal page I don't get that bit.

 

Any ideas what I'm doing wrong?

Link to comment
Share on other sites

You must use the tep_href function so that it attaches a osCsid to the end of the url which carries your user information. Hard coded links will cause problems.

Kenneth S

--------------

Customer "Are you a real programmer?"

Me "No, but I did stay at a Holiday Inn Express last night"

Link to comment
Share on other sites

That makes sense.

 

Could you give me an example please?

 

eg if my link code was <a href="link1.php">link1</a>

 

What would that need changing to?

Link to comment
Share on other sites

Seperate Pricing Per Customer has different customer levels. Although that contribution uses it to show different pricing, you could also use the admin part to separate your customers into groups.

 

At the top of the page you would want to hide for certain groups you have to make the code look for the customers_group_id (see the code in that mod) and if the customers_group_id should not see this page do a redirect (Header 'Location:index.php' from the top of my head). You can hide links in the same way:

if ($customers_group_id != 'certain_number' ) {
echo tep_href_link(etc, etc);
}

Link to comment
Share on other sites

  • 1 month later...
You must use the tep_href function so that it attaches a osCsid to the end of the url which carries your user information. Hard coded links will cause problems.

 

Could anyone give me an example of what the code would look like please?

 

eg if my link code was <a href="link1.php">link1</a>

 

What would that need changing to?

Link to comment
Share on other sites

I'm slowly sorting this out. So far I've managed to create links like the following which works fine.

 

<p><?php echo '<a href="' . tep_href_link(FILENAME_Link_1, '', 'SSL') . '"><font color="#FF0000">' . Link. '</font></a>'; ?></p>

 

however if I try to create a link on more than one word it won't work, any ideas why?

 

eg

 

<p><?php echo '<a href="' . tep_href_link(FILENAME_Link_1, '', 'SSL') . '"><font color="#FF0000">' . This Link Doesnt Work As Its More Than One Word. '</font></a>'; ?></p>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...