osCmax v2.5 User Manual
Results 1 to 5 of 5

How to make a private page for only specific member

This is a discussion on How to make a private page for only specific member within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; I already make a new page named "service.php" to my oscommerce website. I wanna only one member, who called "technician", ...

      
  1. #1
    SNU
    SNU is offline
    Lurker
    Join Date
    Aug 2010
    Posts
    2
    Rep Power
    0


    Smile How to make a private page for only specific member

    I already make a new page named "service.php" to my oscommerce website.

    I wanna only one member, who called "technician", can access that page (service.php).

    Now, the "service.php" page can be accessed by all members in my website.

    Where codes I must edit?

    PHP Code:
    <?php 
      
    require('includes/application_top.php');
      require(
    'includes/metaqueries.php');

      if (!
    tep_session_is_registered('customer_id')) {
        
    $navigation->set_snapshot();
        
    tep_redirect(tep_href_link(FILENAME_LOGIN'''SSL'));
      }

      require(
    DIR_WS_LANGUAGES $language '/' FILENAME_SERVICE);
      
    $breadcrumb->add(NAVBAR_TITLEtep_href_link(FILENAME_SERVICE));
    ?>
    In my database, table customers, the "technician" member has customer_id = 1
    should I change 'customer_id' in the code above with 1 or ??

    Any help would be greatly appreciated!
    Thanks!

  2. #2
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,014
    Rep Power
    36


    Default Re: How to make a private page for only specific member

    Code:
     if (!tep_session_is_registered('customer_id') && customer_id == '1') {

    Last edited by ridexbuilder; 11-16-2010 at 01:07 AM.
    Hosting plans with installation, configuration, contributions, support and maintenance.

  3. #3
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Default Re: How to make a private page for only specific member

    Why not simply use .htaccess to protect the file - you could even lock it down to only allow access from their IP address (assuming it is static).

    Regards,
    pgmarshall
    _______________________________

  4. #4
    SNU
    SNU is offline
    Lurker
    Join Date
    Aug 2010
    Posts
    2
    Rep Power
    0


    Default Re: How to make a private page for only specific member

    @pgmarshall, thank you for your idea, but I don't understand how to do it

    @ridexbuilder, thank you so much. I already use &&, but it doesn't work and when I try to use "||" it works!

    PHP Code:
    if ( (!tep_session_is_registered('customer_id')) || ($customer_id != '1') ) {
        
    tep_redirecttep_href_link(FILENAME_DEFAULT) );
      } 

  5. #5
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Default Re: How to make a private page for only specific member

    You will need to amend slightly to use the && otherwise non-logged in users will be able to access.

    It should be:

    if ( (tep_session_is_registered('customer_id')) && ($customer_id != '1') ) {
    tep_redirect( tep_href_link(FILENAME_DEFAULT) );
    }
    Note the removal of the ! which is short for NOT.

    Regards,
    pgmarshall
    _______________________________

Similar Threads

  1. Tailor colum_right for a specific page
    By letmelearn in forum osCmax v2 Customization/Mods
    Replies: 0
    Last Post: 04-01-2008, 07:54 AM
  2. how to make the image on product page
    By johnkwok in forum osCMax v2 Features Discussion
    Replies: 0
    Last Post: 05-20-2006, 01:55 PM
  3. How to make a index.php page with a another name in OSMAX?
    By doumawis in forum osCommerce 2.2 Modification Help
    Replies: 2
    Last Post: 03-01-2005, 12:16 AM
  4. Login for public and Private on same page?
    By anntaj in forum osCommerce 2.2 Modification Help
    Replies: 0
    Last Post: 10-18-2004, 05:55 PM
  5. How to make categories appear in the center of page
    By hisapostle in forum osCommerce 2.2 Modification Help
    Replies: 1
    Last Post: 01-29-2004, 05:14 AM

Bookmarks

Posting Permissions

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