Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    78
    Plugin Contributions
    0

    Default login to view page

    Hello,

    I have created a separate page that lists prices of my products in a table. I would like to make it so that the page can not be viewed unless the user is logged in. Is there certain code I can insert on the page to require them to log in or register before viewing the page? In other words, if they are not logged in and they click on the "price list" link in a side box, a page will display that tells them they must be logged in to view the price list and gives them a link to the log in/register page.

    the url to the test page is here: http://www.blackoliveeastnursery.net...goryChoice=All

    My code is below:

    <body>

    <div id="mainContainer_displayPage" class="clearfix">


    <?php

    include "---.php";

    ?>
    <br /><br /><br /><br />

    <div id="search_results">


    <div class= "searchHeading">Search By Category:</div>


    <form id="searchForm"action="display_prices_6_testDropDown.php" method="GET">

    <select id="categoryName" name="categoryChoice" style="text-align:center;">
    <option value="All" selected="selected" >All</option>
    <option value="25">Begonias</option>
    <option value="31">Butterfly Plants</option>
    <option value="7">Cactus/Succulents</option>
    <option value="29">Ferns</option>
    <option value="27">Florida Natives</option>
    <option value="3">Flowering Shrubs</option>
    <option value="17">Flowering Trees</option>
    <option value="28">Foliage Shrubs</option>
    <option value="11">Fragrant Plants</option>
    <option value="16">Fruit Trees</option>
    <option value="10">Fruiting Plants</option>
    <option value="5">Ground Cover</option>
    <option value="13">Hanging Baskets</option>
    <option value="2">Hedges</option>
    <option value="30">Interior Plants</option>
    <option value="13">New Releases</option>
    <option value="9">Orn. Grasses</option>
    <option value="22">Orn. Trees</option>
    <option value="23">Palms</option>
    <option value="19">Patio Trees</option>
    <option value="6">Perennials</option>
    <option value="32">Roses</option>
    <option value="26">Seasonal</option>
    <option value="8">Shade Plants</option>
    <option value="21">Shade Trees</option>
    <option value="20">Street Trees</option>
    <option value="12">Tropicals/Exotics</option>
    <option value="4">Vines</option>

    </select>



    <input class="submit_cat" type="submit" value="Show Plants">
    </form>




    <br>


    </div><!--end search results-->

    <table id="contactDisplayList">

    <tr>
    <th id="products_name" class="tableHeader">Plant Name</th>
    <th id="products_common_name" class="tableHeader">Common Name</th>
    <th id="products_common_name" class="tableHeader">Category:</th>
    <th id="4_inch" class="tableHeader_cont">4 Inch</th>
    <th id="4.5_inch" class="tableHeader_cont">4.5 Inch</th>
    <th id="1_gal" class="tableHeader_cont">1 gal</th>
    <th id="3_gal" class="tableHeader_cont">3 gal</th>
    <th id="5_gal" class="tableHeader_cont">5 gal</th>
    <th id="7_gal" class="tableHeader_cont">7 gal</th>
    <th id="10_gal" class="tableHeader_cont">10 gal</th>
    <th id="15_gal" class="tableHeader_cont">15 gal</th>
    <th id="20_gal" class="tableHeader_cont">20 gal</th>
    <th id="25_gal" class="tableHeader_cont">25 gal</th>
    <th id="45_gal" class="tableHeader_cont">45 gal</th>
    <th id="65_gal" class="tableHeader_cont">65 gal</th>
    <th id="hb_8" class="tableHeader_cont">Hanging Basket, <br />8 inch</th>
    <th id="hb_10" class="tableHeader_cont">Hanging Basket, <br />10 inch</th>
    <th id="hb_12" class="tableHeader_cont">Hanging Basket, <br />12 inch</th>
    </tr>




    <?php


    $query = "SELECT * FROM

    zen_products p,
    zen_products_description pd,
    zen_products_price pr,
    zen_categories_description cd

    WHERE p.products_id = pd.products_id AND
    p.master_categories_id = cd.categories_id AND
    p.products_id = pr.products_id";


    if (isset($_GET['categoryChoice']) && $_GET['categoryChoice'] != "All")
    $query .= " AND p.master_categories_id = '".mysql_real_escape_string($_GET['categoryChoice'])."'";

    $query .= " order by products_name";

    $result = mysql_query($query)
    or die ("Couldn't execute query.");

    while ($row = mysql_fetch_array($result))
    {
    extract($row);

    ?>

    <?php

    print
    '<tr class="rowHeight">

    <td class ="leftAlign">'. $row['products_name'] . '</td>
    <td class ="leftAlign">' . $row['products_common_name'] . '</td>

    <td class ="leftAlign">' . $row['categories_name'] . '</td>

    <td class ="centerAlign">' . formatPrice($price_4_inch) . '</td>

    <td class ="centerAlign">' . formatPrice($price_4_5_inch) . '</td>

    <td class ="centerAlign">' . formatPrice($price_1_gal) . '</td>
    <td class ="centerAlign">' . formatPrice($price_3_gal) . '</td>
    <td class ="centerAlign">' . formatPrice($price_5_gal) . '</td>
    <td class ="centerAlign">' . formatPrice($price_7_gal) . '</td>
    <td class ="centerAlign">' . formatPrice($price_10_gal) . '</td>
    <td class ="centerAlign">' . formatPrice($price_15_gal) . '</td>
    <td class ="centerAlign">' . formatPrice($price_20_gal) . '</td>
    <td class ="centerAlign">' . formatPrice($price_25_gal) . '</td>
    <td class ="centerAlign">' . formatPrice($price_45_gal) . '</td>
    <td class ="centerAlign">' . formatPrice($price_65_gal) .'</td>
    <td class ="centerAlign">' . formatPrice($price_hb_8) . '</td>
    <td class ="centerAlign">' . formatPrice($price_hb_10) . '</td>
    <td class ="centerAlign">' . formatPrice($price_hb_12) . '</td>

    </tr>';
    }


    function formatPrice($price) {
    $fnl = ($price>0)?'$' . sprintf("%.2f",$price):'*';
    return $fnl;
    }
    ?>
    </table>
    </div>
    <!--end main container-->

    </body>

  2. #2
    Join Date
    Apr 2004
    Location
    UK
    Posts
    5,821
    Plugin Contributions
    2

    Default Re: login to view page

    Add your code to ezpage...then view
    http://www.zen-cart.com/forum/showthread.php?t=63890

  3. #3
    Join Date
    Mar 2009
    Posts
    78
    Plugin Contributions
    0

    Default Re: login to view page

    Thanks Misty for the link.

    I've been hacking away at this for hours now and I don't seem to be getting anywhere. (Have you ever had one of those dreams where a bear is chasing you and you can only run in slow motion? Kind of like that!)

    I've posted a more detailed (and less psychotic) explanation of my difficulties at the link below if you'd like to help a poor soul out.

    http://www.zen-cart.com/forum/showth...t=37252&page=5

    Thanks

  4. #4
    Join Date
    Apr 2004
    Location
    UK
    Posts
    5,821
    Plugin Contributions
    2

    Default Re: login to view page

    See my latest post at thread you have quoted i.e.
    http://www.zen-cart.com/forum/showth...d=1#post785308

 

 

Similar Threads

  1. Replies: 2
    Last Post: 5 Jul 2013, 10:58 PM
  2. Requires login to view product page
    By czetsuya in forum General Questions
    Replies: 12
    Last Post: 4 Oct 2012, 01:29 AM
  3. NOT require login to view EZ Page from Banner Link
    By dimsumgurl in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 29 Apr 2011, 04:00 PM
  4. need to login to view to ezpages
    By stressstress in forum General Questions
    Replies: 1
    Last Post: 18 Jul 2010, 12:26 PM
  5. Login to view..
    By devinej1 in forum Customization from the Admin
    Replies: 2
    Last Post: 5 Oct 2009, 10:29 AM

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