Zen Cart Logo
Forums / General Questions / Password protected pages?

Password protected pages?

Views: 3,792

Results 1 to 13 of 13
13 Jun 2011, 2:48 PM
#1
darrenabidris avatar

darrenabidris

New Zenner

Join Date:
May 2010
Posts:
6
Plugin Contributions:
0

Password protected pages?

Hi,

I have a customer who's selling books. He wants to print a unique code/password (I'm assuming a mix of letters and numbers) in each book that will allow the purchaser to enter the code on a password-protected webpage, allowing them to access that particular page.

Does anyone know if there's a way to do this with Zen Cart?

Many thanks,

Darren

13 Jun 2011, 2:50 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Password protected pages?

What is at that page?

13 Jun 2011, 3:02 PM
#3
darrenabidris avatar

darrenabidris

New Zenner

Join Date:
May 2010
Posts:
6
Plugin Contributions:
0

Re: Password protected pages?

The idea is to allow the customer to download an audio version of the book they bought.

I should add that there will be a number of passwords that the page will 'understand' - one for each book sold. This will allow the number of times the audio file as been downloaded to be tracked, and for my client to track which of his customers have downloaded the file and which ones haven't.

If there's an easier way of doing this then please suggest them :-)

13 Jun 2011, 5:30 PM
#4
vger avatar

vger

Past Contributor

Join Date:
Nov 2004
Location:
Norfolk, United Kingdom
Posts:
3,189
Plugin Contributions:
0

Re: Password protected pages?

The idea is to allow the customer to download an audio version of the book they bought......If there's an easier way of doing this then please suggest them

Use the downloadable products facility that's built into Zen Cart? The book can be set up with two formats - one the actual book, and the other the virtual (downloadable) audio book. They can then choose which to buy.

By the way - you can only password protect folders, not individual pages.

Vger

16 Jun 2011, 8:03 AM
#5
organicplanet avatar

organicplanet

New Zenner

Join Date:
Dec 2005
Posts:
58
Plugin Contributions:
0

Re: Password protected pages?

Hi,

I am wondering if there is a way to create a password protected portion of the store with categories, products etc.

I would like to create a portion of my store only for exclusive customers.

Any help or direction would be greatfully appreciated.

Jane

16 Jun 2011, 8:23 AM
#6
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Password protected pages?

Zen Cart has a feature that allows prices to be hidden from customers who are not logged in, but that's about the closest it gets to what your asking about.

However, if you are ready to roll your sleeves up and get progamming, you'll find that much of the functionality you need to create customer groups already exists. It's only how it's applied in the front end of your site that you would need to change.

16 Jun 2011, 4:20 PM
#8
organicplanet avatar

organicplanet

New Zenner

Join Date:
Dec 2005
Posts:
58
Plugin Contributions:
0

Re: Password protected pages?

not exactly...

I was hoping not to have to create a whole new store...

I only want people I invite able to access, view and/or shop in it with a password.

Thanks again for your input.

Jane

17 Jun 2011, 9:47 AM
#9
dutchy avatar

dutchy

Zen Follower

Join Date:
May 2010
Location:
London
Posts:
324
Plugin Contributions:
0

Re: Password protected pages?

organicplanet:

not exactly...

I was hoping not to have to create a whole new store...

I only want people I invite able to access, view and/or shop in it with a password.

Thanks again for your input.

Jane

May I ask why?

My store is what I call a 'closed' shop. You can view my products, but no prices are shown until the viewer logs in. Also, a customer that registers has to be approved before they can see prices or place orders. My ZC store is a B2B wholesale, so my customer's customers cannot see the prices. Yet my products are still nicely indexed by SEs.

If it is just certain categories that you want to be password protected, would this Categories Hide add-on not be suitable enough? By using the ZC settings and this mod. It could prove a good enough workaround. Why not just hide the categories to non registered and authorised customers.

17 Jun 2011, 5:18 PM
#10
morrie14 avatar

morrie14

New Zenner

Join Date:
Jun 2011
Posts:
3
Plugin Contributions:
0

Re: Password protected pages?

You can protect folders? How? Can you protect the main shopping cart folder ('/zencart/') with a password making it so that anyone who uses the store has to have a password? I have a" privileged-pricing" store (not a section of the store, but the whole thing).

17 Jun 2011, 5:23 PM
#11
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,809
Plugin Contributions:
15

Re: Password protected pages?

@Morrie
You wouldn't want to password protect the cart. Just set the cart so that users have to log in and be certified to shop.

17 Jun 2011, 5:41 PM
#12
morrie14 avatar

morrie14

New Zenner

Join Date:
Jun 2011
Posts:
3
Plugin Contributions:
0

Re: Password protected pages?

Yeah, I have the same situation..

My thought was just to add my accesscontrol.php include that I use for my 'members only' portal (which requires login for access) to the index.php of my zencart shop, which appears to work, but doesn't, for some reason. Maybe there is a proper place to stick such a script-include in the zen cart code?

My approach used php sessions to check for login, if not, access denied, please apply for credentials. If anyone knows how to get that to work, thenwe have a solution. (my assumption is that they are already logged in as a member in order to view the zen shop, no direct URL access is allowed).

Here is my (it's not mine, it came from Sitepoint's Kevin Yank) login code (it would be so nice to somehow marry this with the (superior) zencart user login module.

<?php // accesscontrol.php
session_start();
include_once 'error-handler.php';
include_once 'db_connect.php';

$uid = isset($_POST['uid']) ? $_POST['uid'] : $_SESSION['uid'];
$pwd = isset($_POST['pwd']) ? $_POST['pwd'] : $_SESSION['pwd'];
$usertype = isset($_POST['usertype']) ? $_POST['usertype'] : $_SESSION['usertype'];
if(!isset($uid)) {
  ?>
  <!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title> Please Log In for Access </title>
    <meta http-equiv="Content-Type"
      content="text/html; charset=iso-8859-1" />
  </head>
  <body>
  <h1> Login Required </h1>
  <p>You must log in to access this area of the site. If you are
     not a registered user, <a href="signup.php">click here</a>
     to sign up for instant access!</p>
  <p><form method="post" action="<?=$_SERVER['PHP_SELF']?>">
    User ID: <input type="text" name="uid" size="8" /><br />
    Password: <input type="password" name="pwd" SIZE="8" /><br />
    <input type="submit" value="Log in" />
  </form></p>
  </body>
  </html>
  <?php
  exit;
}
$_SESSION['uid'] = $uid;
$_SESSION['pwd'] = $pwd;
dbConnect("members");
$sql = "SELECT usertype,userid,password,fullname FROM user WHERE userid = '$uid' AND password = '$pwd'";
$result = mysql_query($sql);
if (!$result) {
	error('A database error occurred while checking your '.
        'login details.\\nIf this error persists, please '.
        'contact webmaster.');
}
if (mysql_num_rows($result) == 0) {
  unset($_SESSION['uid']);
  unset($_SESSION['pwd']);
  ?>
  <!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title> Access Denied </title>
    <meta http-equiv="Content-Type"
      content="text/html; charset=iso-8859-1" />
  </head>
  <body>
  <h1> Access Denied </h1>
  <p>Your user ID or password is incorrect, or you are not a
     registered user on this site. To try logging in again, click
     <a href="<?=$_SERVER['PHP_SELF']?>">here</a>. To register for instant
     access, click <a href="signup.php">here</a>.</p>
  </body>
  </html>
<?php
exit;
}
$username = mysql_result($result,0,'fullname');
$usertype = mysql_result($result,0,'usertype');
?>

If you make this into a .php file and include it in your index.php file of your zencart, you can see that it almost works.
For what it 's worth...Maybe someone knows why it doesn't? I think it's at least a solution (might not be the best one).

17 Jun 2011, 5:47 PM
#13
vger avatar

vger

Past Contributor

Join Date:
Nov 2004
Location:
Norfolk, United Kingdom
Posts:
3,189
Plugin Contributions:
0

Re: Password protected pages?

Just set the cart so that users have to log in and be certified to shop.

Which is one of the standard features of Zen Cart (already built in).

If you password protected the whole shop folder then:

  1. No search engine listings - at all.
  2. If any payment processor tries to post back data to your website it won't get through.

Vger