Results 1 to 6 of 6

Hybrid View

  1. #1
    cpmac Guest

    Default Re: How to make one category password protected?

    Hiding prices isn't the problem, it's hiding the viewing of products.

    I've had a go at this problem; I've allready got it to work in OsCommerce but with the different file structure in zencart i'ts not working. If any one can see the flaw in my syntax or reasoning.

    I'm using
    Zen Cart 1.3.8a
    Patch: 1::
    Version de la Base de Données: 1.3.8




    In brief, I added a pass word field PW to categories.
    I modifed includes/functions/function_categories.php
    added files entry-form.php and pass-good.php

    the script is failing at the query I'm getting "No row" message.
    although the query works in a separate file with the variables predefined.

    The query works when I put it in a stand alone php script with the variables provided, but not in Zencart.

    I have five categories set up and one has an entry in the PW field.


    the modifictation to function_categories.php

    after return 'cPath=' . $cPath_new;
    }
    line 55

    Code:
    Code:
    /* check for pass word and cookie */
              $query = "select PW   from categories  where categories_id = '" . (int)$current_category_id . "'";
          $result = mysql_query($query) ;
          if (!$result)
            {
            die('No result: ' . mysql_error());
      }
          $row  = mysql_fetch_array($result)  ;  
          if (!$row)
            {
            die('No row: ' . mysql_error());
      }
          
              $mot_pass=$row["PW"];
         
         $go ="YES";
         
         if(isset($_COOKIE["look"]) && $_COOKIE["look"]==$mot_pass)
             {
             $go="YES";
             }
             
             if($mot_pass !=NULL && !isset($_COOKIE["look"]))
             {
             $go="NO";
             }
             
             
             if ($go=="NO")
            {
            include('entry_form.php');
        }
    the file entry_form.php

    Code:

    Code:
    <td>
    enter the password for this section<BR>
    <BR>
    <form method="POST" action="pass_good.php">
    <INPUT TYPE="text" NAME="given_word" VALUE="">
    <INPUT TYPE="hidden" NAME="pass_word" VALUE=<?php echo $mot_pass; ?>>
    <button type="submit" name="submit">Submit</button>
    </td>
    the file pass_good.php

    Code:

    Code:
    <?php 
    $given_word = $_POST['given_word'];
    $mot_pass=$_POST['pass_word'];
    switch ($mot_pass) 
    {
        case "vague":
            if ($given_word == "vague")
    		{
    		setcookie("look", "vague", time()+360000);
    		}else{
    		$mot_pass="wrong";
    	}
            break;
         default:
           $mot_pass="wrong";
    }
    
    ?>
    <html>
    
    <body>
    <?php
    
    echo $given_word . "<BR>";
    echo $mot_pass ."<BR>";
    ?>
    <a href="javascript:history.go(-1)">Continuer</a>
    </body>
    </html>

  2. #2
    cpmac Guest

    Default Re: How to make one category password protected?

    I've finally cracked the problem. I modified a different file.
    http://www.zen-cart.com/forum/showthread.php?t=132978

 

 

Similar Threads

  1. Replies: 1
    Last Post: 8 Oct 2011, 06:05 PM
  2. Password protected store: how to move new customer sign up to different page?
    By AdaLovelace in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 4 Apr 2011, 11:26 AM
  3. How do I create password protected pages?
    By wondernate in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 3 Jun 2010, 02:48 AM
  4. Can I make (free) product video clips password protected?
    By mccawphoto in forum General Questions
    Replies: 0
    Last Post: 8 Jan 2009, 07:24 PM
  5. Make a password protected zencart entrance
    By pensandpencils in forum General Questions
    Replies: 7
    Last Post: 10 Jul 2008, 07:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg