4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on November 03, 2008, 07:33:39 AM

Title: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on November 03, 2008, 07:33:39 AM

----------------- [ Index ] -----------------


----------------- [ Introduction ] -----------------

With this mod you'll be able hide categories and/or set a password.

Hidden categories will not be visible anywhere on the site and can be accessed only by a direct link to it. By default once such category opened, it will become visible for the visitor, meaning it will not be hidden anymore for that particular visitor. This behavior can be changed.

If a category password protected, only it's name will be visible to the visitors (assuming visitor has "view category" permissions). Once visitor open it or open an image from such category, a prompt to enter the password will be showed instead. When the submitted password accepted, the category become fully accessible to the visitor, based on it's permissions. The submitted passwords are stored in the database for each member or in sessions for guests.

All subcategories inherit "hidden" and "password" settings from it's parent category.

If you have a request or suggestion, make sure you visit Tweaks (#post_tweaks) section, it might be already there ;)


----------------- [ How to use ] -----------------

Once this mod is installed, you should see two new options when edit or create new category.


----------------- [ Demo ] -----------------

You can see how it works here (http://4images.vano.org/catpashid). You can click on "reset cat password" link on left to reset entered password and visited hidden categories.


----------------- [ Changed files ] -----------------

global.php (#post_step3)
details.php (#post_step4)
categories.php (#post_step5)
includes/auth.php (#post_step6)
includes/page_header.php (#post_step7)
includes/sessions.php (#post_step8)
admin/categories.php (#post_step9)
lang/<your language>/main.php (#post_step10)

----------------- [ New files ] -----------------

install_catpashid.php
includes/catpass.php
templates/<your template>/catpass.html


----------------- [ Installation ] -----------------

Step 1 (#post_step1)
Download attached package (#post_attachment). Extract files and upload them to your 4images folder, preserving this tree structure:
install_catpashid.php
includes/catpass.php
templates/<your template>/catpass.html


Step 2 (#post_step2)
Execute install_catpashid.php by typing in your browser's address bar:
http://yourdomain/4images/install_catpashid.php


Step 3 (#post_step3)
Open global.php
Find:  $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment

Replace it with:  $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, cat_password, cat_hide

(or simply add , cat_password, cat_hide at the end of that line)

Step 4 (#post_step4)
Open details.php
Find:$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;

Insert BELOW:
cat_unhide($cat_id);



Step 4.1 (#post_step4-1) 
Find:if (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id) || !$image_row) {
  redirect($url);
}
Insert BELOW:
$txt_clickstream = get_category_path($cat_id,1).$config['category_separator'].format_text($image_row['image_name'], 2).$config['category_separator'];
include(ROOT_PATH."includes/catpass.php");



Step 5 (#post_step5)
Open categories.php
Find:$user_access = get_permission();

Insert BELOW:
cat_unhide($cat_id);



Step 5.1 (#post_step5-1) 
Find:if (!$cat_id || !isset($cat_cache[$cat_id]) || !check_permission("auth_viewcat", $cat_id)) {
  redirect("index.php");
}

Insert BELOW:
include(ROOT_PATH."includes/catpass.php");



Step 6 (#post_step6)
Open includes/auth.php
Find:function check_permission($type, $cat_id = 0) {

Replace it with:function cat_unhide($cat_id, $save = 1)
{
  global $cat_cache, $site_sess, $user_info, $site_db, $cat_parent_cache;
  if (!isset($cat_cache[$cat_id]))
    return;

  if (isset($cat_cache[$cat_id]['auth_viewcat_backup']))
    $cat_cache[$cat_id]['auth_viewcat'] = $cat_cache[$cat_id]['auth_viewcat_backup'];

  $cat_subcat_ids = get_auth_subcat_ids($cat_id, $cat_id, $cat_parent_cache);
  if (isset($cat_subcat_ids[$cat_id]))
  {
    foreach ($cat_subcat_ids[$cat_id] as $key2 => $val2)
    {
      if ($cat_cache[$val2]['auth_viewcat'] < $cat_cache[$cat_id]['auth_viewcat']
            && (!$cat_cache[$val2]['cat_hide']
                  || ($cat_cache[$val2]['cat_hide'] && isset($user_info['cat_hide'][$val2]))))
      {
        $cat_cache[$val2]['auth_viewcat'] = $cat_cache[$cat_id]['auth_viewcat'];
      }
    }
  }
  if ($cat_cache[$cat_id]['cat_hide'])
  {
    if (isset($user_info['cat_hide'][$cat_id]))
      return;

    $user_info['cat_hide'][$cat_id] = "";
    if (!$save)
      return;

    if ($user_info['cat_hide_db'])
    {
      $sql = "UPDATE ".USERS_TABLE." SET cat_hide = '".implode("|", array_keys($user_info['cat_hide']))."' WHERE ".get_user_table_field("", "user_id")." = ".$user_info['user_id'];
      $site_db->query($sql);
    }
    else
    {
      $site_sess->set_session_var("cathide", implode("|", array_keys($user_info['cat_hide'])));
    }
  }
  else
  {
    if ($cat_cache[$cat_id]['cat_parent_id'] != 0)
    {
//uncomment next line if you want unhide parent category when opened child category.
//      cat_unhide($cat_cache[$cat_id]['cat_parent_id'], $save);
    }
  }
 
}

function cat_pass_check($cat_id)
{
  global $user_info, $site_sess, $cat_cache;
  if ($user_info['user_level'] == ADMIN)
    return true;

  if (isset($cat_cache[$cat_id]['cat_password_id']))
    $cat_id = $cat_cache[$cat_id]['cat_password_id'];

  if (!isset($cat_cache[$cat_id]['cat_password']) || !$cat_cache[$cat_id]['cat_password'])
    return true;

  return (isset($user_info['cat_password'][$cat_id]) && $cat_cache[$cat_id]['cat_password'] == $user_info['cat_password'][$cat_id]) ? true : false;
}

function check_permission($type, $cat_id = 0) {
  global $user_info, $cat_cache;
  if (!_check_permission($type, $cat_id) && $cat_cache[$cat_id][$type] != 999)
  {
    return false;
  }
  if ($type != "auth_viewcat")
  {
    return true;
  }
  if ($user_info['user_level'] != ADMIN && $cat_cache[$cat_id][$type] == 999)
  {
    return false;
  }
  return true;
}

function _check_permission($type, $cat_id = 0) {



Step 6.1 (#post_step6-1) 
Find:    if ($val['auth_viewcat'] != AUTH_ALL) {

Replace it with:    if ($val['cat_hide'] && !isset($user_info['cat_hide'][$key]))
    {
      $cat_cache[$key]['auth_viewcat_backup'] = $val['auth_viewcat'];
      $cat_cache[$key]['auth_viewcat'] = $val['auth_viewcat'] = 999;
    }
    if ($val['auth_viewcat'] != AUTH_ALL || $val['cat_password']) {



Step 6.2 (#post_step6-2) 
Find:        foreach ($cat_subcat_ids[$key] as $key2 => $val2) {

Insert BELOW:
          if (!$cat_cache[$val2]['cat_password'] && $cat_cache[$key]['cat_password']) //all subcategories also should obbey cat password from parent
          {
            $cat_cache[$val2]['cat_password'] = $cat_cache[$key]['cat_password'];
            $cat_cache[$val2]['cat_password_id'] = (isset($cat_cache[$key]['cat_password_id'])) ? $cat_cache[$key]['cat_password_id'] : $key;
          }
          if ($val['auth_viewcat'] == 999)
          {
            if ($cat_cache[$val2]['cat_hide'] && isset($user_info['cat_hide'][$val2]) && $cat_cache[$val2]['auth_viewcat'] < $cat_cache[$key]['auth_viewcat'])
            {
              $cat_cache[$val2]['auth_viewcat'] = $cat_cache[$key]['auth_viewcat_backup'];
              continue;
            }
            $cat_cache[$val2]['auth_viewcat_backup'] = $cat_cache[$key]['auth_viewcat_backup'];
          }



Step 6.3 (#post_step6-3) 
Find:    if (!check_permission($type, $key)) {

Replace it with:    if (!check_permission($type, $key) || !cat_pass_check($key)) {



Step 7 (#post_step7)
Open includes/page_header.php
Find:      if (check_permission("auth_viewcat", $key)) {

Replace it with:      if (check_permission("auth_viewcat", $key) && cat_pass_check($key)) {



Step 8 (#post_step8)   
Open includes/sessions.php
Find:$user_info = $site_sess->return_user_info();

Insert BELOW:
$user_info['cat_password_db'] = true; //set to false to use only sessions to store passwords
$user_info['cat_hide_db'] = true; //set to false to use only sessions to store visited hidden categories
if ($user_info['user_level'] == GUEST || !isset($user_info['cat_password']) || ($user_info['user_level'] != GUEST && !$user_info['cat_password_db']))
{
  $cat_pass = trim($site_sess->get_session_var("catpass"));
  $user_info['cat_password_db'] = false;
}
else
{
  $cat_pass = $user_info['cat_password'];
  $user_info['cat_password_db'] = true;
}
$user_info['cat_password'] = array();
$cat_pass = explode("|", $cat_pass);
foreach($cat_pass as $key)
{
  $val = explode(",", $key);
  if (count($val) > 1 && $val[0] = (int)$val[0])
    $user_info['cat_password'][$val[0]] = $val[1];
}

if ($user_info['user_level'] == GUEST || !isset($user_info['cat_hide']) || ($user_info['user_level'] != GUEST && !$user_info['cat_hide_db']))
{
  $cat_hide = trim($site_sess->get_session_var("cathide"));
  $user_info['cat_hide_db'] = false;
}
else
{
  $cat_hide = $user_info['cat_hide'];
  $user_info['cat_hide_db'] = true;
}
$user_info['cat_hide'] = array();
$cat_hide = explode("|", $cat_hide);
foreach($cat_hide as $key)
{
  if ($key = (int)$key)
    $user_info['cat_hide'][$key] = "";
}



Step 9 (#post_step9)
Open admin/categories.php
Find two (2) times:
  $auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];

Insert BELOW each:
  $cat_password = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_password']));
  $cat_hide = intval($HTTP_POST_VARS['cat_hide']);



Step 9.1 (#post_step9-1) 
Find:    $sql = "INSERT INTO ".CATEGORIES_TABLE."
            (cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment)
            VALUES
            ('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment)";

Replace it with:    $sql = "INSERT INTO ".CATEGORIES_TABLE."
            (cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, cat_password, cat_hide)
            VALUES
            ('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment, '$cat_password', $cat_hide)";



Step 9.2 (#post_step9-2) 
Find:  show_table_separator($permission_headline, 2);

Insert ABOVE:
  show_radio_row($lang['cat_hide'], "cat_hide", 0);
  show_input_row($lang['cat_password'], "cat_password", "", $textinput_size);



Step 9.3 (#post_step9-3) 
Find:
Code: [Select]
            SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_order = $cat_order, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment
Replace it with:
Code: [Select]
            SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_order = $cat_order, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment, cat_password = '$cat_password', cat_hide = $cat_hide


Step 9.4 (#post_step9-4) 
Find:  $sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment

Replace it with:  $sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, cat_password, cat_hide



Step 9.5 (#post_step9-5) 
Find:  show_input_row($lang['field_hits'], "cat_hits", $cat_row['cat_hits'], 5);

Insert BELOW:
  show_radio_row($lang['cat_hide'], "cat_hide", $cat_row['cat_hide']);
  show_input_row($lang['cat_password'], "cat_password", $cat_row['cat_password'], $textinput_size);


Step 9.6 (#post_step9-6) 
Find:    show_text_link($lang['add_subcategory'], "categories.php?action=addcat&cat_parent_id=".$cats['cat_id']);
Insert below:
    if ($cats['cat_hide'] || $cats['cat_password'])
    {
      echo "&nbsp;&nbsp;&nbsp;&nbsp;<b>(";
      if ($cats['cat_hide'])
      {
        echo $lang['cat_hidden'];
      }

      if ($cats['cat_password'])
      {
        echo (($cats['cat_hide']) ? ", " : "").$lang['cat_password2'];
      }

      echo ")</b>";
    }


Step 9.7 (#post_step9-7) 
Find two times:$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
Replace both with:
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, cat_hide, cat_password


Step 10 (#post_step10)   
Open lang/<your language>/main.php
At the end, ABOVE closing ?> insert:
$lang['cat_hide'] = "Hidden";
$lang['cat_password'] = "Category password";
$lang['cat_password_msg'] = "This category is password protected.<br />Please enter the password";
$lang['cat_password_error'] = "You have entered incorrect password";
$lang['cat_hidden'] = "hidden";
$lang['cat_password2'] = "password";





Tweaks (#post_tweaks) and version history (#post_history) in the next reply.
Title: Tweaks / Changes log
Post by: V@no on November 03, 2008, 07:36:01 AM
----------------- [ Tweaks ] -----------------

1 (#post_tweak1). If you don't want passwords be saved in the database and only in the session, then in the code from Step 8. (#post_step8) replace:
Code: [Select]
$user_info['cat_password_db'] = true; //set to false to use only sessions to store passwords
With:
Code: [Select]
$user_info['cat_password_db'] = false; //set to false to use only sessions to store passwords


2 (#post_tweak2). If you don't want visited hidden categories be saved in the database and only in the session, then in the code from Step 8. (#post_step8) replace:
Code: [Select]
$user_info['cat_hide_db'] = true; //set to false to use only sessions to store visited hidden categories
With:
Code: [Select]
$user_info['cat_hide_db'] = false; //set to false to use only sessions to store visited hidden categories


3 (#post_tweak3). If you want when visiting a hidden subcategory (only when "hidden" setting inherited from parent) automatically unhide parent category, then in the code from Step 6. (#post_step6) replace:
Code: [Select]
//      cat_unhide($cat_cache[$cat_id]['cat_parent_id'], $save);
With:
Code: [Select]
     cat_unhide($cat_cache[$cat_id]['cat_parent_id'], $save);


4 (#post_tweak4). If you want hide subcategories and it's content in password protected categories and make it inaccessible for the visitors until they unlocked the parent category, find in includes/auth.php:
Code: [Select]
         if (!$cat_cache[$val2]['cat_password'] && $cat_cache[$key]['cat_password']) //all subcategories also should obbey cat password from parent
Insert ABOVE:
Code: [Select]
         if (!cat_pass_check($key))
          {
            $cat_cache[$val2]['auth_viewcat'] = ADMIN;
            continue;
          }


5 (#post_tweak5). If you don't want subcategories inherit passwords from parent categories in includes/auth.php find:
Code: [Select]
           $cat_cache[$val2]['cat_password'] = $cat_cache[$key]['cat_password'];
            $cat_cache[$val2]['cat_password_id'] = (isset($cat_cache[$key]['cat_password_id'])) ? $cat_cache[$key]['cat_password_id'] : $key;
Replace it with:
Code: [Select]
//            $cat_cache[$val2]['cat_password'] = $cat_cache[$key]['cat_password'];
//            $cat_cache[$val2]['cat_password_id'] = (isset($cat_cache[$key]['cat_password_id'])) ? $cat_cache[$key]['cat_password_id'] : $key;


----------------- [ Version history ] -----------------

v1.1 (2009-06-30)
- ADDED: at categories list at ACP shows which category is hidden or password protected (added Step 9.6 (#post_step9-6) and Step 9.7 (#post_step9-7) and updated Step 10 (#post_step10))

v1.0.2 (2008-11-15)
- FIXED:  private subcategories visible under parent category. Re-do Step 6 (#post_step6)

v1.0.1 (2008-11-06)
- FIXED: an issue with redirects on servers with php running in CGI mode. Simply redownload the attached package and replace includes/catpass.php

v1.0 (2008-11-03)
- first release
Title: Re: [MOD] Hidden / Password protected categories v1.0 (2008-11-03)
Post by: Werner1340 on November 03, 2008, 09:28:20 PM
Hello V@no,

BIG Thanks for that great MOD. Works perfect on my site  :thumbup:  :!: :!:

Just 2 suggestions/questions:

1: Is it possible to protect the categories for each time I enter the site?

For example: I'm entering my site, answer the categorie-password-question and I'm in. So far, so good.
Now I'm leaving my site to  go somewhere else and after a while I come back and now I have to
answer the password again for the protected categorie, because i didn't stay on my site all the time.

2: Is it possibel to make the password case-sensitive? Just a little feature  :D, if it's easy to realize.

Thank you very much...................Werner

   

Title: Re: [MOD] Hidden / Password protected categories v1.0 (2008-11-03)
Post by: V@nо on November 03, 2008, 11:16:32 PM
1. at the moment there is no expiration on passwords and the only way make it close to your request is do tweak 1 and set session expiration to  shorter time.

2. its supossed to be case sensetive...is it not?
Title: Re: [MOD] Hidden / Password protected categories v1.0 (2008-11-03)
Post by: Werner1340 on November 03, 2008, 11:30:35 PM
Hello V@no,

1: Ok, no problem.

2: Sorry, my fault  :oops:. It is case-sensitive. Sorry for that :!:

Werner
Title: Re: [MOD] Hidden / Password protected categories v1.0 (2008-11-03)
Post by: V@no on November 04, 2008, 06:45:20 AM
Added a little demo (http://vano.org/4images_mods/catpashid) site.
Title: Re: [MOD] Hidden / Password protected categories v1.0 (2008-11-03)
Post by: kai on November 04, 2008, 08:06:57 AM
That's awesome! Thanks V@no!
Title: Re: [MOD] Hidden / Password protected categories v1.0 (2008-11-03)
Post by: mawenzi on November 04, 2008, 09:20:07 AM
... cool ... a very small "V@no's Gallery" since (I think) two years from vano.org ...  8O
... Images with gps-infos and google-maps ... I hope it will not remain only a demo site ... ;)
... btw ... nice mod ...
Title: Re: [MOD] Hidden / Password protected categories v1.0 (2008-11-03)
Post by: batu544 on November 04, 2008, 04:46:27 PM
After all ... vano.org  is now up..  :D

V@no, I saw the last line of your page  "Page generated in 0.107483 seconds with 11 queries, spending 0.047000 seconds doing MySQL queries and 0.060483 doing PHP things. GZIP compression enabled" 

If you don't mind can you tell me how can I get this on my website ?? :)
Title: Re: [MOD] Hidden / Password protected categories v1.0 (2008-11-03)
Post by: mawenzi on November 04, 2008, 04:56:47 PM
@batu544

... in /includes/constants.php at the end find ...
Code: [Select]
//define("PRINT_STATS", 1);
//define("PRINT_QUERIES", 1);
//define('PRINT_CACHE_MESSAGES', 1);
... and remove all " // " ...
Title: Re: [MOD] Hidden / Password protected categories v1.0 (2008-11-03)
Post by: batu544 on November 06, 2008, 01:07:45 PM
Thanks mawenzi :) 
Title: Re: [MOD] Hidden / Password protected categories v1.0 (2008-11-03)
Post by: Gazzagreen on November 06, 2008, 11:04:13 PM
Hello

I have been trying to get this mod to work but have had no luck. I have even tried to reinstall gallery from fresh incase any other mods were interfering with it, but still not working.

I can get the password page, but when I enter a password I get HTTP 404 - File not found.

The address in the addressbar is : http://gallery.lovemansfield.co.uk/php.cgi?cat_id=2

I don't have a php.cgi file?

Any advice welcome.
Title: Re: [MOD] Hidden / Password protected categories v1.0 (2008-11-03)
Post by: SnaFy on November 07, 2008, 12:34:38 AM
Thanks You are creative in the programming and I hope to continue innovation
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: V@no on November 07, 2008, 02:04:47 AM
I don't have a php.cgi file?

Any advice welcome.
This is interesting...try redownload the package and replace includes/catpass.php with the new version.

I hope it fixed now.
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: Gazzagreen on November 07, 2008, 02:26:35 AM
No its the same. Can get to the password page, but when i enter the correct (or incorrect) password the next page is an error page with this path

http://gallery.lovemansfield.co.uk/php.cgi?cat_id=23

Off tpo bed now, its 1.30am :(
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: V@no on November 07, 2008, 03:15:32 AM
Hmmm...I found a lot of PHP bug reports regarding this issue.
So far I could only found one work around this. Try redownload the package again, catpass.php was updated.

P.S.
Because I don't know how to setup PHP the same way as it's on your host, I can't test it myself. So, please bear with me ;)
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: Gazzagreen on November 07, 2008, 10:34:53 AM
Hi V@no

It's the same fault  :cry:

 One thing I noticed about my server is that sometimes I need to add apostrophes ('') to statements to make them work, such as...

($something =0)

would need to be:

($something =='0')

Think this may be the problem?

Also, When I type the password straight into the database in the users table under the name of the user I'm logged in as, I still come to the password page? I would think I should go straight to the category if I have the password in the database already?

Gazza :?
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: metal_brain on November 07, 2008, 10:56:45 AM
such a great Mod  :D
thanks V@no
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: V@no on November 07, 2008, 03:09:01 PM
It's the same fault  :cry:
Can you PM me with a link to phpinfo() on your site?

Also, When I type the password straight into the database in the users table under the name of the user I'm logged in as, I still come to the password page? I would think I should go straight to the category if I have the password in the database already?
it depends on how you typed it ;) its not just simple password, it's in this format:
catid,pass|catid,pass|catid,pass
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: Gazzagreen on November 07, 2008, 04:47:40 PM
Can you PM me with a link to phpinfo() on your site?

how do I get phpinfo()?

Shows what a newbie I am eh?

Off to work now for 12 hour shift!
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: V@nо on November 07, 2008, 07:39:02 PM
create a php file:
Code: [Select]
<?php
phpinfo
();
?>
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: Gazzagreen on November 08, 2008, 05:22:00 AM
done, i sent you a link

Gazza  :mrgreen:
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: V@no on November 08, 2008, 05:51:50 AM
ok, I've updated the package with new catpass.php file
try now.
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: Gazzagreen on November 08, 2008, 02:41:48 PM
YEEEES!

You've cracked it again V@no! Works beautifully now :)

Many thanks.
Gazza
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: rinaldos on November 09, 2008, 08:57:10 PM
Bug or a feature?

If a categorie is marked as privat, everbody (Also Guest) can see this category.
When I remove Step 5 this one: cat_unhide($cat_id);

then no one can see the category when it is marked as private (only the marked private User) .

Is this code in Step 5 cat_unhide($cat_id); necessary?

Gruß
Ingo
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: V@no on November 09, 2008, 09:36:12 PM
I can't reproduce it.

I've added category "Private (http://vano.org/4images_mods/catpashid/categories.php?cat_id=10)" set "View category" to private, after that nobody but admin could see and access that category.
Even if you logged in as a regular user (user: test pass: test) you still wont be able access that category.
But user "test2" (user: test2 pass: test2) is allowed to see that category.

The conclusion: maybe it's your other modifications interfering with this mod?
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: rinaldos on November 10, 2008, 05:59:58 AM
I do not know if a other MOD concluse with this MOD. Maybe. Everything works fine, only the private Feature of 4images is gone. Did I need the code line for  the password feature?

Gruß
Ingo
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: V@no on November 10, 2008, 06:54:12 AM
?
did you follow exactly the installation instructions?
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: rinaldos on November 10, 2008, 05:57:21 PM
Yes exactly :-) As I saw the error, i control the installation and I saw no errors.....

Ingo
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: Werner1340 on November 15, 2008, 06:41:24 AM
Hello V@no,

one more question from my side  :D:

Is it possible to have following structur in a pass-protected categorie:

Maincategorie (=pass-protected, the Subcategories should not be seen)
- Subcategorie 1 (=pass-protected, seen by everyone)
- Subcategorie 2 (=pass-protected, seen by everyone)
.....
.....

I tried everything to have it this way, but nothings works.

On my Homepage you can see what i tried so far.

http://fotowerner.at (http://fotowerner.at)

Maincategorie = Gästehaus -> pass = test

in there you will find:

subcat1 -> pass = 1 (Settings are: Hidden=no, seen by everyone)
subcat2 -> pass = 2 (Settings are: Hidden=no, set to "private") set to private hides the sucat2 in Mainpage.
That's what i want. But when i click on subcat2, it jumps back to the Mainpage ?

Are the settings wrong, or what can i do?

Big Thanks in advance..................Werner






Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: V@no on November 15, 2008, 10:10:05 AM
If you want hide subcategories, edit each subcategory and set it to be hidden.


To everyone who installed v1.0 / v1.0.1

In includes/auth.php find:
Code: [Select]
      if (!$cat_cache[$val2]['cat_hide'] || ($cat_cache[$val2]['cat_hide'] && isset($user_info['cat_hide'][$val2])))
Replace it with:
Code: [Select]
      if ($cat_cache[$val2]['auth_viewcat'] < $cat_cache[$cat_id]['auth_viewcat']
            && (!$cat_cache[$val2]['cat_hide']
                  || ($cat_cache[$val2]['cat_hide'] && isset($user_info['cat_hide'][$val2]))))
(or re-do Step 6 (http://www.4homepages.de/forum/index.php?topic=23202.0#post_step6) - only one step)

This should fix the problem with private categories visible to everyone inside parent category.
Title: Re: [MOD] Hidden / Password protected categories v1.0.1 (2008-11-06)
Post by: Werner1340 on November 15, 2008, 03:15:18 PM

If you want hide subcategories, edit each subcategory and set it to be hidden.

It's still not working.
When i set the subcategories to be hidden i even can't see them after i passed the "Gästehaus"- entry  :?:

Werner
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: V@no on November 15, 2008, 08:34:55 PM
I don't understand what you are trying to do...you don't want show subcategories, but want to see them?
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: Werner1340 on November 16, 2008, 06:30:32 AM
I don't understand what you are trying to do...you don't want show subcategories, but want to see them?

 nearly  :D
The Categorie "Gästehaus" is protected but I don't want to see the subcategories underneath,
after entering the "Gästehaus" everybody can see all Subcategories which are all extra password protected too.
That's it.

Maincategorie (=pass-protected, the Subcategories are hidden)
- Subcategorie 1 (=pass-protected, seen by everyone, not hidden, but password-protected)
- Subcategorie 2 (=pass-protected, seen by everyone, not hidden, but password-protected)
and so on............
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: V@no on November 16, 2008, 09:43:39 AM
Other words you want show subcategories only after visitors unlocked the parent category...In current version it's not possible, but I'll look into it.


[EDIT]
Try this and see if it works:
in includes/auth.php find:
Code: [Select]
          if (!$cat_cache[$val2]['cat_password'] && $cat_cache[$key]['cat_password']) //all subcategories also should obbey cat password from parent
insert above:
Code: [Select]
          if (!cat_pass_check($key))
          {
            $cat_cache[$val2]['auth_viewcat'] = ADMIN;
            continue;
          }
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: Werner1340 on November 16, 2008, 12:59:24 PM
GREAT!!

Now it works exactly how i wanted it  :D

Sorry, for confusing you at the beginning and a very BIG THANKS for your help and efforts on this !!!!!!!!

Werner
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: V@no on November 16, 2008, 06:36:33 PM
Good. I've added it as a tweak (http://www.4homepages.de/forum/index.php?topic=23202.0#post_tweak4)
Also added one more tweak (http://www.4homepages.de/forum/index.php?topic=23202.0#post_tweak5) which allows have parent category be password protected and subcategories don't inherit the password.
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: sanko86 on January 27, 2009, 11:01:57 AM
ý Thanks @v@no

good mod

perfect work.
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: tennis-ecards on March 07, 2009, 12:21:22 PM
Hallo,

ich habe auf meiner Seite diesen MOD installiert.
Aber irgendwie kann ich nur als Admin die passwortgeschützte Kategorie sehen, jedoch nicht als registrieter User.
Mache ich etwas bei den Settings falsch?
Ich habe die Befugnisse für "Kategorie sehen" schon auf "Alle", "Privat" oder "Registrierte User" gesellt aber nichts ändert sich.
Hat jemand eine Idee woran das liegt?

Danke
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: V@no on March 07, 2009, 04:57:35 PM
Double check Step 9 - 9.x
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: tennis-ecards on March 07, 2009, 10:21:12 PM
Danke für die schnelle Antwort.
Jetzt kann man als registrierter User die Kategorie sehen und öffnen.
Ich möchte aber eigentlich dass JEDER die Kategorie sieht, aber sie nur öffnen kann, wenn er das Passwort kennt.
Eine Passwortabfrage kommt aber bei mir derzeit gar nicht.
Noch eine Idee, woran es liegen kann?
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: V@no on March 08, 2009, 12:49:16 AM
Sorry, but when it comes to human errors, anything could be the cause.
So, what should do is check every single step and make sure you did all the changes correctly.
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: moto1985 on March 24, 2009, 01:13:40 AM
ich habe folgendes Problem

Quote
DB Error: Bad SQL Query: UPDATE 4images_categories SET cat_name = 'Firmware', cat_description = 'Hier findet Ihr sämtliche Firmware Files für euer SE handy', cat_parent_id = 0, cat_order = 5, cat_hits = 31, auth_viewcat = 0, auth_viewimage = 0, auth_download = 2, auth_upload = 3, auth_directupload = 9, auth_vote = 0, auth_sendpostcard = 3, auth_readcomment = 0, auth_postcomment = 2, cat_password = '', cat_hide = 1, cat_image = WHERE cat_id = 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE cat_id = 1' at line 3

Warning: Cannot modify header information - headers already sent by (output started at O:\htdocs\includes\db_mysql.php:190) in O:\htdocs\includes\functions.php on line 114

komischerweise habe ich das jetzt bei allem wenn ich was ändern will.
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: V@no on March 24, 2009, 01:32:33 AM
Check step 3, you might removed modifications from other mods if you simply replaced the whole line, instead of the part you were supposed to replace.
Title: Re: [MOD] Hidden / Password protected categories v1.0.2 (2008-11-15)
Post by: Sun Zaza on July 01, 2009, 01:35:27 AM
Hi V@no,

I like the mod. Already installed and works fine so far.

I have a question (suggestion) for you:

Guess you have more than 50 categories on your gallery. What is the easier way to know which categories are hidden/password protected and which not? To look for 1 by one it will cost a lot time (Time is money :wink:).

I suggest the following:

When you click on category edit on the ACP, you get a list of the categories. After the name of cat you can put something like:

My fotos  (ID: 2)    [Open]  [delete]  [Add subcategory]   (Hidden & password protected)
My videos (ID: 3)    [Open]  [delete]  [Add subcategory]   (Hidden)
My friends (ID: 4)    [Open]  [delete]  [Add subcategory]   (password protected)

What do you think about that?
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on July 01, 2009, 02:51:35 AM
When you click on category edit on the ACP, you get a list of the categories. After the name of cat you can put something like:

My fotos  (ID: 2)    [Open]  [delete]  [Add subcategory]   (Hidden & password protected)
My videos (ID: 3)    [Open]  [delete]  [Add subcategory]   (Hidden)
My friends (ID: 4)    [Open]  [delete]  [Add subcategory]   (password protected)
Done.
Update to v1.1:
Do new Step 9.6 (http://www.4homepages.de/forum/index.php?topic=23202.msg126893#post_step9-6), Step 9.7 (http://www.4homepages.de/forum/index.php?topic=23202.msg126893#post_step9-7) and re-do Step 10 (http://www.4homepages.de/forum/index.php?topic=23202.msg126893#post_step10)
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: Sun Zaza on July 01, 2009, 09:44:13 AM
Tested and worked perfect:)

Thanks V@no
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: ATROXX on July 06, 2009, 06:54:40 PM
DEUTSCH
Dieser Hack/Mod verträgt sich nicht mit den Random Images auf der Startseite.
Die Folge ist, dass dort dann gar nichts angezeigt wird.

...siehe "vorher" und "nacher" Screens im Anhang
Die Ursache muss irgendwo an den Änderungen in der auth.php oder page_header.php liegen.


ENGLISH
This Mod/Hack doesn`t work with the random pics on the mainpage.
Whenn installing it, there won`t be any pic.

Look at the attached screens.
The reason must bee within the changes of auth.php oder page_header.php
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: rinaldos on July 06, 2009, 07:06:05 PM
@ ATROXX
Ich habe den MOD selber installiert und kann dies nicht bestätigen. Du musst irgendwo einen Fehler haben.
English:
I have this MOD already installed and I can not confirm this error ...

Gruß
ingo
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on July 07, 2009, 12:15:55 AM
Unless you've altered the random image code it should not be happening. As you can see on my demo site, no random images showed from hidden/password protected categories until visitor "unhide" hidden or unlock password protected categories.
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: TechnoRocker on July 24, 2009, 09:59:10 PM
Bei Version: 1.7.7 funktioniert es nich oder?

Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: nobby on July 24, 2009, 10:12:58 PM
schau dir mal Antwort #48 an.

rinaldos hat das bei sich installiert und es funktioniert wohl.
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: rinaldos on July 25, 2009, 12:26:34 PM
Ich kann nur bestätigen, das dieser MOD bei mir funktioniert. Müsste mal das 1.1 einspielen, da ich immer noch die Version 1.0 nutze
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: TechnoRocker on July 26, 2009, 04:53:49 PM
Ich habe alles gemacht so wie es beschrieben wird!
Ich bekomme nur einen Leere weiße Seite!

 :cry: :cry: :cry: :cry:



Ich habe euch mal die Dateien gezippt.

Ich hoffe ihr könnt mir helfen bin schon völlig am verzweifeln.
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: Sebas Bonito on July 26, 2009, 06:08:52 PM
Bei mir läuft das auch reibungslos, und ich hab SEHR viele MODs  :wink:
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: TechnoRocker on July 26, 2009, 06:32:27 PM
Bei mir läuft das auch reibungslos, und ich hab SEHR viele MODs  :wink:

Ja das ist schön für dich ;-)

Dann helf mir doch bitte,
Siehe post über dir
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: Sebas Bonito on July 26, 2009, 06:57:13 PM
Wann erscheint denn eine weiße Seite, Du musst schon etwas genauer werden?
Wenn Du einen neue Kategorie erstellen willst, überall, oder nur bei der Ansicht
von Kategorien?
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: TechnoRocker on July 26, 2009, 07:29:11 PM


Also gleich wenn ich die Seite aufrufe
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: Sebas Bonito on July 26, 2009, 08:01:30 PM
Schau Dir mal die auth.php in Zeile 218 an, da steht ein "FBEECC"... das gehört da sicher nicht hin.  :wink: Reicht das aus?
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: TechnoRocker on July 26, 2009, 08:06:03 PM
Oh man wie ich mich darüber ärgere!

Naja egal jetzt ist es raus =)

Vielen Dank !

(Grübel gerade wie der Farbcode darein gekommen ist.....)
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: Sebas Bonito on July 26, 2009, 08:54:42 PM
Oh man wie ich mich darüber ärgere!
Naja egal jetzt ist es raus =)
Vielen Dank !
(Grübel gerade wie der Farbcode darein gekommen ist.....)

Kein Problem.  8)
Das wichtigste ist ja, dass die Seite nun läuft.  :idea:
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: Horvath on September 21, 2009, 11:41:17 AM
Maybe its just me. .  BUt I cant seem to see where you download this MOD. . . ? Could anyone point me in teh corect direction for the Download?

Thanks
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on September 21, 2009, 02:28:07 PM
http://www.4homepages.de/forum/index.php?topic=23202.0#post_attachment
http://www.4homepages.de/forum/index.php?action=dlattach;topic=23202.0;attach=4064
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: Horvath on September 21, 2009, 10:03:34 PM
Thank You !
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: Horvath on September 23, 2009, 12:11:45 AM
I did everything in the Install.   .   .    I didn't do any Tweaks.   .   .   .    But when I tried to make a password for the Category.   .    I get this Error.   .   .   .   .   

Any tips whats wrong? or where to Start?

Thanks

DB Error: Bad SQL Query: UPDATE 4images_categories SET cat_name = 'Videos', cat_description = '', cat_parent_id = 0, cat_order = 55, cat_hits = 81, auth_viewcat = 0, auth_viewimage = 0, auth_download = 0, auth_upload = 9, auth_directupload = 9, auth_vote = 0, auth_sendpostcard = 0, auth_readcomment = 0, auth_postcomment = 2, cat_password = 'meangreen', cat_hide = Array WHERE cat_id = 7
Unknown column 'Array' in 'field list'
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on September 23, 2009, 02:44:46 AM
hmmm I don't see anything in the code that could possibly give this error...start by double checking steps 9.x
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: Horvath on September 24, 2009, 11:17:54 AM
OK I will check all the steps. . .

I get the error if I edit a Catagory all ready made. . .  If I make a new catagory, I dont get the error.

Thanks
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: zakaria666 on August 26, 2010, 03:36:20 PM
@VANO_OooOOOoooOO,

Hello VANO_OooOOOoooOO, i just have few questions that if you can i will be happy please u can answer.

1) Budduke, he make a very very interesting MOD in which user can make there folders and sub folders [http://www.4homepages.de/forum/index.php?topic=24628.0], So can this MOD be tweaked so that user's can set password protection on certain folders that they may not want other people to see but only close friends??

2)What you have done is very fantastic, but correct me if i am wrong but Administrator are the only ones that set the folders to be password protected or hidden or even visible correct??

Thank u VAVANO_OooOOOoooOO, 
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: rekorderek on October 30, 2010, 04:36:09 AM
Congratulations V@no , great work
Can you help in how to password protect the user can upload an image or a category it created.
So you can password-encrypt the uploaded image categories.
thank you
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: maslan on March 05, 2011, 09:08:36 PM
Hi v@no,

Thanks for the great mod. I have two questions:

1- How can I allow registered users to create sub categories (albums) and let them put password for thir own categories?

2- Is it possible to have them select a picture from albume and make it album cover (instead of folder icon) as in facebook?

Best regards,

Mustafa
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: lovewall on June 04, 2012, 03:44:08 PM
I put the same password for all category, now I want it to show the password in the home page? just type the correct password, it will show up all the photos at home ?
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: tutoko on September 14, 2012, 06:36:19 PM
Really like this Mod, but I have problems. I can create the hidden category, set the password etc. but when I try to access the category by typing the password in I get a 404 Error and the category page does not load. Instead I get redirected to the hosting provider's error page. I am using v7.11, wondering if there is something Ive done wrong (even tho I have rechecked the code mods and all seem ok)  - would appreciate some help on over coming the redirect issue PLEASE.....

Thanks in advance.
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on September 15, 2012, 02:26:58 AM
Do you use any SEO mods? (these that replace categories.php?cat_id=123 with cat123.html or similar)
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: tutoko on October 15, 2012, 04:20:30 AM
hi V@no, No I do not use SEO mods. I have been going back through the code and making sure I have everything in place as specified, but still no luck in making the mod work when typing the password into the password form. I can set the password directly into the database field and it all works fine then. Just can not do the front end password via catpass.html.
I am wondering if the code skips the catpass.php integration somehow?

Just looks like the code doesnt write to the data base, tho it seems to read from it ok.  The category password gets written to the cat ID. But no user information gets written to DB.
I am using other MODS but no SEO ones - cat_image, Multi_download, Support Ticket... could one of those prevent the write to the DB of password into the user table ?

Sorry for the delayed response. I have been away on work assignment for a few weeks.  Thanks for your attention to this enquiry.
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on October 16, 2012, 04:25:21 AM
Can you attach these files modified by the mod?

global.php
details.php
categories.php
includes/auth.php
includes/page_header.php
includes/sessions.php
admin/categories.php
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: tutoko on October 16, 2012, 06:32:56 AM
files attached.
Also I just finished doing a complete clean install with default template and then went through the mod one more time with the clean files. Same outcome.
When entering the password I get redirected to the Host 404 page - not the "incorrect password" message as shown on your demo site.

Thanks very much for your assistance V@no.
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on October 17, 2012, 04:20:12 AM
If you do access to server's error logs and php error logs, look if you see anything related to this.
If nothing there, I'd like to try it myself if it's possible (you can PM me if you don't want publish it)
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: tutoko on October 17, 2012, 05:40:57 AM
hi V@no,
I am not sure what you want me to send you.
the site address is http://harmony-radio.com/Harmony-Paints/

If you need access to the server system please let me know by email =>  vline44yahoo.com.au   and I can provide you codes etc for getting into look at the server system.

19.10.2012 - Update, Hi V@no, I found this on the host server FAQ's - does this relate to the issue I have ? :
---------------
PHP register_globals feature is set to OFF on our servers for security reasons. All modern scripts, these days do not use register_globals, and if you get any errors related to register_globals being disabled, you may want to check your coding or contact script developer for more details.

However, it is possible to enable register_globals by entering this line to your .htaccess file:

php_flag register_globals on

We do not recommend enabling this function as it may lead to possible security problems for your website.
--------------------


Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on October 21, 2012, 11:32:39 PM
Sorry for the delay. Can you setup a test password protected category so I can test it out?

Thanks.

P.S.
register globals is not an issue here.
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: tutoko on October 22, 2012, 04:53:25 AM
done: category is password... password is password.
Cheers V@no...

Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on October 22, 2012, 09:20:44 AM
It seems 4images incorrectly identifies the script filename ($PHP_SELF)

I'd need access to phpinfo() to investigate
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: tutoko on October 22, 2012, 04:56:55 PM
PM sent with info, please let me know if you did not receive it..
Notices from inspecting the PhpInfo that php include is set to off, guess thats why the code below does not work too?

  <?php
 include("http://harmony-radio.com/Harmony-Paints/random.php");
?>


thanks once again..
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on October 23, 2012, 03:44:17 AM
No, it's not it. You cannot include remote .php files, simply because when your server requests for a .php file it receives whatever that php script generates, not it's source.
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on October 23, 2012, 03:19:33 PM
Found it.

In includes/catpass.php find:
Code: [Select]
if (!function_exists("get_self"))
{
  function get_self()
  {
    $list = get_included_files();
    return $list[0];
  }
}
if (!function_exists("get_self_full"))
{
  function get_self_full()
  {
    global $HTTP_GET_VARS;
    $q = $HTTP_GET_VARS;
    $query = array();
    foreach($q as $key => $val)
    {
      $query[] = $key . "=" . $val;
    }
    return ROOT_PATH.basename(get_self()).(!empty($query) ? "?".implode("&", $query) : "");
  }
}

Replace it with:
Code: [Select]
if (!function_exists("get_self"))
{
  function get_self()
  {
global $self_url;
return $self_url;
  }
}
if (!function_exists("get_self_full"))
{
  function get_self_full()
  {
    global $script_url;
    return $script_url."/".get_self();
  }
}
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: tutoko on October 23, 2012, 11:24:44 PM
Perfect V@no,

THANK YOU !
I Truely appreciate your time and efforts to get this resolved. Much appreciated.

The phpInfo you looked at - does it prevent the use of the external file loading the random image by use of:

  <?php
 include("http://harmony-radio.com/Harmony-Paints/random2.php");
?>

That just doesnt work for me in an external html page calling to the php file ?

if it is the php configuration is that something I have to get the server host to change?
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: V@no on October 24, 2012, 03:00:49 AM
This is offtopic, but as I tried to explain earlier it's not your server's configuration. include() function uses to execute PHP code from a different file. When you access any .php files via remote address (http://) it executes that .php file on that remote server, so when your server tries include that .php file it gets the generated by that file output, which is usually HTML code, not PHP source code of that file.
Now, if you'd rename random2.php to random2.txt, then it might work, because remote server would simply output text inside that file, not execute it.
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: tutoko on October 24, 2012, 04:02:33 AM
thank you for that explaination V@no, will try your suggestion. Sorry for the off topic query, but again I really appreciate your input. The mods and the extensive assistance you have provided on this forum regarding 4images is invaluable. Many many thanks.
Title: Re: [MOD] Hidden / Password protected categories v1.1 (2009-06-30)
Post by: Vizear on June 09, 2013, 01:16:40 PM
Hey, just a quick question. Is there a way for the search to find a hidden category? Eg: searching a keyword on the hidden image...

Thank you.