4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: martrix on July 06, 2005, 02:42:20 PM

Title: [MOD] Treat bots as users with less rights
Post by: martrix on July 06, 2005, 02:42:20 PM
90% of the mod: V@no/Jan

A part of this mod was already published in this forum, but unfortunately it got lost after the hack.

Step 1: Create new users called for example "searchbot" and "googlebot" (or any other aditional you want...)  with password "12345"
(you may use any username or password you want, but then you will need to change the code)
The password 12345 is just for "demonstration" - please use another one for your bots and replace 12345 in the code with your new password...
If you decide not to do that, everybody can visit your page as a "bot"

Step 2: Create a new usergroup "searchbots" and set all bot-users as members of this group.

Step 3: in includes/sessions.php find:

Code: [Select]
$site_sess = new Session();
and replace it with:

Code: [Select]
// mod GoogleBot
$site_sess = new Session();
$robots = array(
"FAST-WebCrawler" => "searchbot",
"Gulliver" => "searchbot",
"AltaVista" => "searchbot",
"Alexibot" => "searchbot",
"asterias" => "searchbot",
"BackDoorBot" => "searchbot",
"Black.Hole" => "searchbot",
"BlowFish" => "searchbot",
"BotALot" => "searchbot",
"NPBot" => "searchbot",
"Pompos" => "searchbot",
"Scooter" => "searchbot",
"SiteSnagger" => "searchbot",
"Slurp" => "searchbot",
"WebmasterWorldForumBot" => "searchbot",
"zyborg" => "searchbot",
"Google" => "googlebot",
"msnbot" => "searchbot",
"ZACATEK_CZ_BOT" => "searchbot",
"EARTHCOM.info" => "searchbot",
"sherlock" => "searchbot",
"Holmes" => "searchbot",
"ia_archiver" => "searchbot",
"lwp-trivial" => "searchbot",
"appie" => "searchbot",
"Scooter" => "searchbot",
"Gigabot" => "searchbot",
"Wget" => "searchbot",
"jyxobot" => "searchbot",
"Xenu Link Sleuth" => "searchbot",
"SeznamBot" => "searchbot",
);
foreach($robots as $key => $val) {
  if(!$_SERVER['HTTP_USER_AGENT'] || preg_match("/".$key."/i", $_SERVER['HTTP_USER_AGENT'])) {
    $site_sess->login($val, "12345");
    $user_bot = 1;
    break;
  }
}

You may add or remove other bots's useragent names as you like or try to put MSIE there for a while, so you may see, how the bot will see the pages... don't forget to delete MSIE from the array aftewards, otherwise ALL your visitors will be logged in as bots ;) (well, or you could just login as a searchbot :) but if you do that and you do hide the userbox for searchbots, you have to delete the cookies, to login back again under your "real" account.)

Step 4.1: If you did not install Conditional User Group template tags (http://www.4homepages.de/forum/index.php?topic=6566.msg29808#msg29808) yet, follow the next steps
Open includes/page_header.php and search for each
Code: [Select]
if ($user_info['user_level'] >= USER) {add the following code above
Code: [Select]
$usergroups = array();AND add the following code below
Code: [Select]
  $current_time = time();
  $sql = "SELECT group_id 
          FROM ".GROUP_MATCH_TABLE."
          WHERE user_id = ".$user_info['user_id']."
          AND groupmatch_startdate <= $current_time
          AND (groupmatch_enddate > $current_time OR groupmatch_enddate = 0)";
  $result = $site_db->query($sql);

  while ($row = $site_db->fetch_array($result)) {
    $usergroups[$row['group_id']] = true;
  }
Step 4.2 search for
Code: [Select]
//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------
and add the following code above
Code: [Select]
$site_template->register_vars(array(
"is_bot" => (isset($usergroups[XXX])) ? 1 : 0
));
Where XXX has to be replaced with the number of the usergroup. (If you don't know, how to find out the number of the usergroup, look here (http://www.4homepages.de/forum/index.php?topic=6566.msg29808#msg29808))
and from now on you may use this tag:

{if is_bot}
 This will appear only for the searchbots...
{endif is_bot}

if you want to hide some parts or disable some functions for the searchbots, install [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1  (http://www.4homepages.de/forum/index.php?topic=6036.msg26229#msg26229)
and you will be able to disable :) thes parts by
Code: [Select]
{ifnot is_bot}
This code will not be shown to searchbots
{endifnot is_bot}

On my site bots may browse the pages, but they can't see links to: download, favorities, user-profile, private messages, logout etc.

That should be everything...
Tell me if it works for you - I did not try it out "again" on a fresh install, so I could forget something...
Title: Re: [MOD] Treat bots as users with less rights
Post by: mawenzi on July 06, 2005, 03:49:14 PM
hi martrix,

you are the man ... thanks ... !
that's what I'm searching for some time ...   8O
nice that you re-publish the MOD with your own statements ...  :D
thanks again ... !

mawenzi
Title: Re: [MOD] Treat bots as users with less rights
Post by: JensF on August 04, 2005, 10:30:11 AM
Quote
On my site bots may browse the pages, but they can't see links to: download, favorities, user-profile, private messages, logout etc

Can anyone say me what i must "save" to have this?? Where must i put the tags in??
Title: Re: [MOD] Treat bots as users with less rights
Post by: martrix on August 04, 2005, 11:20:45 AM
If you finish all the changes, then you may use the tags {if is_bot} blabla {endif is_bot} or {ifnot is_bot} blabla {endifnot is_bot}

For example: you would like to show the text "Dear bot, welcome to my page" to the bots, then just insert

Code: [Select]
{if is_bot} "Dear bot, welcome to my page" {endif is_bot}
anywhere you wish in the templates...

or if you want to hide favourites button from bots, so they won't use it, then just replace

Code: [Select]
{lightbox_button}
in details.html with

Code: [Select]
{ifnot is_bot}{lightbox_button}{endifnot is_bot}
or if you don't want the bot to see the control-panel of the userbot-account, just replace

Code: [Select]
<a href="{url_control_panel}">{lang_control_panel}</a>
in user_logininfo.html with

Code: [Select]
{ifnot is_bot}<a href="{url_control_panel}">{lang_control_panel}</a>{endifnot is_bot}
The rest is up to you, your imagination and your needs...

But beware: if you don't want to give anybody the possibility of seing the image-details, don't install this - anybody may change the name of his useragent and browse through your pages without registering (that's the reason, why I made up a lot of restrictions for bots)

Have fun
Title: Re: [MOD] Treat bots as users with less rights
Post by: leedzinh on August 06, 2005, 05:28:30 AM
do you know yahoo bot?
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on August 06, 2005, 05:59:32 AM
I know two yahoo bots (dont know if they have more).
Its identify itself as:
Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)
and
ia_archiver

In the code I used this to identify them:
Code: [Select]
      "ia_archiver" => "bot-yahoo",
      "Yahoo! Slurp" => "bot-yahoo",
      "help\.yahoo\.com" => "bot-yahoo",
Title: Re: [MOD] Treat bots as users with less rights
Post by: leedzinh on August 06, 2005, 06:42:31 AM
anyone know more bot please post all of them

thanks!
Title: Re: [MOD] Treat bots as users with less rights
Post by: bibabobu on August 06, 2005, 08:57:11 AM
Sorry.
Perhaps i am too stupid to understand. :roll:
What does this MOD do? What are the advantages?
 Do searchbots of search engines find better keywords on my site for a better ranking or what?

Please could someone explain me? :oops:
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on August 06, 2005, 09:49:43 AM
its usefull if u have categories not acceptible for guests, but u still want them (categories) to be indexed on search engines.
Title: Re: [MOD] Treat bots as users with less rights
Post by: ~Ally~ on August 07, 2005, 04:37:49 AM
Thank you SO much. I am hoping that this mod will help with the HUGE amount of RAM used up by my galley. .htaccess bans do not work anymore for bots so I'm hoping this will. thank you!
Title: Re: [MOD] Treat bots as users with less rights
Post by: bibabobu on November 04, 2005, 02:35:53 PM
Please could someone help me because i am little bit confused.

If i want all of my images and pages to be indexed by search engines when my categories are only accessible for members
i will have to install this MOD.

Is this right???

So is there a problem to also install the MOD Registration with security code validation v1.0 :?:

Do the search engines also indexing my pages if i install the security MOD?

I hope i explained clear enough with my broken english :oops:
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on November 04, 2005, 03:00:02 PM
The bots will not be registering by themselfs, you as admin will register them, meaning you will need create account(s) for bots, and update names in the mod, so when a bot visit your site 4images will automaticaly log them in as a member you specifyed.
Title: Re: [MOD] Treat bots as users with less rights
Post by: impss on December 14, 2005, 05:30:52 PM
The bots will not be registering by themselfs, you as admin will register them, meaning you will need create account(s) for bots, and update names in the mod, so when a bot visit your site 4images will automaticaly log them in as a member you specifyed.

So you will need to register each bot that you want, in the list above?
Title: Re: [MOD] Treat bots as users with less rights
Post by: mawenzi on December 14, 2005, 06:21:36 PM
So you will need to register each bot that you want, in the list above?

... NO ...
For the list above you only need to register one new member ... "searchbot" !
... but ...
If you want a searchbot as a single member e.g. Google ... than register a new member "googlebot" ... and set in in list
Code: [Select]
"Google" => "googlebot",

... for other single searchbots is to proceed similar ...

mawenzi
Title: Re: [MOD] Treat bots as users with less rights
Post by: impss on December 14, 2005, 06:53:53 PM
Thanks mawenzi  8)
Title: Re: [MOD] Treat bots as users with less rights
Post by: impss on December 16, 2005, 02:35:50 AM
Thats crazy..

I uploaded the changed files.. and Google was on my website in under a minute  8O
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on December 16, 2005, 02:42:49 AM
Thats crazy..

I uploaded the changed files.. and Google was on my website in under a minute  8O
they were there all the time in an embush ;) :D
Title: Re: [MOD] Treat bots as users with less rights
Post by: mawenzi on December 22, 2005, 03:45:48 PM
anyone know more bot please post all of them

I  found that :

List of search engine robots that visit your web site (http://www.jafsoft.com/searchengines/webbots.html#search_engine_robots_and_others)

with : Home page/search engine , Robot identifier , IP address(es)

Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on December 23, 2005, 01:51:54 AM
And here (http://www.psychedelix.com/agents/index.shtml) is another list
Title: Re: [MOD] Treat bots as users with less rights
Post by: Zyga on January 15, 2006, 03:03:48 PM
Cool mod thx  :)

On site i dont need to show more options for bots but....
how can i display
"Currently active X  bot(s)"
 :?:

is it posiible without registering manualy all bots when i dont need display name of bot ?
Title: Re: [MOD] Treat bots as users with less rights
Post by: lemccoy on January 27, 2006, 01:40:56 AM
would there be anyway to determine exactly how many times the searchbot is on your site? Sessions, not page views?

works great, after i installed the endifno mod.  thanks!  my top images were going up unproportionally, now that should be fixed :-)

is there anyway to give the searchbots semi-admin access, so basically their hits don't get counted?
Title: Re: [MOD] Treat bots as users with less rights
Post by: djith on February 01, 2006, 10:14:56 PM
i erased the possibilty to sign in at my website...don't need members, they're only annoying...

but i would like to use this MOD, does it mean that i have to re-install the sign in stuff?
Title: Re: [MOD] Treat bots as users with less rights
Post by: impss on February 01, 2006, 11:11:48 PM
i erased the possibilty to sign in at my website...don't need members, they're only annoying...

but i would like to use this MOD, does it mean that i have to re-install the sign in stuff?

Should work for you.

just to let u know, Looks like u have something wrong with your sitemap page
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on February 02, 2006, 12:33:24 AM
but i would like to use this MOD, does it mean that i have to re-install the sign in stuff?
No, you dont. All you will need to do is create users for the search engines bots, that's all.
Title: Re: [MOD] Treat bots as users with less rights
Post by: djith on February 02, 2006, 11:31:06 PM
hmm .... the sitemap looks a little bit nordic white.... :) but it is okay.... just have to edit layout a bit :)

thanks vano,  will make an account for the bot .....
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on February 13, 2006, 01:25:01 AM
1) dont have answer for now

2) googlebot is the account name you need to create in your gallery

3) What you did only will privent bots from visiting download.php in the future, yet, they have previously cached pages with download link avalable. Nothing you can do about it, exept redirect bots to other pages if they try to access download.php
in download.php find:
Code: [Select]
require(ROOT_PATH.'includes/sessions.php');insert below:
Code: [Select]
if ($user_bot)
{
  header("Location: ".$site_sess->url($url, "&"));
  exit;
}

4) in step 3 at the end of the new code insert this:
Code: [Select]
$site_template->register_vars("is_bot", $user_bot);
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on February 13, 2006, 10:26:48 AM
-Which reflect this has where this gets tag (whos_online.html???)
{if is_bot} "Dear bot, welcome to my page" {endif is_bot}
sorry, didnt understand this... the 4) answer should add ability using {if is_bot}{endif is_bot} tags in whos_online.html template...


If I these code in download.php are diverted robots, have I properly understood this??
that is correct.
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on February 13, 2006, 11:00:42 AM
this morning I had these IP address (66.249.66.37) its this the googlerobot
"Google" => "googlebot",????
or "Googlebot" => "googlebot",????
what is correct?
I've never seen Googlerobot but only Googlebot
All google bots that visiting my site have this identification:
Quote
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
So, since there is no web browser created by Google (yet), its safe to use "Google" => "googlebot"
Title: Re: [MOD] Treat bots as users with less rights
Post by: JensF on March 04, 2006, 04:31:46 PM
Hello,

since 2 weeks i have a problem with this mod. The bots are writing spam comments. And when i delte the comments they are writen from an other user...

what can i do that bots are not write a comment



Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on March 04, 2006, 04:46:47 PM
dont allow "not trusted" bots...and remove your general "searchbot" acount. create for each "known" bot an independent account, like google, msn, yahoo, etc. this way you can track them down.

And finaly the real fix:
in details.php find:
Code: [Select]
if ($row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {Replace with:
Code: [Select]
if ($user_bot || $row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {
That should be enough, yet, if you also dont want to show comment form for the bots, then find:
Code: [Select]
$allow_posting = check_permission("auth_postcomment", $cat_id);Replace with:
Code: [Select]
$allow_posting = (!$user_bot && check_permission("auth_postcomment", $cat_id))  ? 1 : 0;
Title: Re: [MOD] Treat bots as users with less rights
Post by: martrix on March 06, 2006, 10:51:28 PM
what can i do that bots are not write a comment

That's quite easy, Jens.

I had that problem with "bots" but then realised, that there were ppl visiting my site "spamming" the comments and guestbook, not bots...
You don't have to track the bot down - anyboy can go to your page using  FF with a changed "User_Agent" to see the content.
You don't even have to install anything more, than you already have, if you followed the steps from the first post...

Just hide the comment forms from the bots with the {ifno is_bot} and bots won't be able to add any unwanted text...

Hide also all functions from the bots, which are not useful for them, like: Lightbox, PM, E-Cards, Download-buttons etc.

Title: Re: [MOD] Treat bots as users with less rights
Post by: JensF on March 06, 2006, 11:08:48 PM
Thanks for this....
Title: Re: [MOD] Treat bots as users with less rights
Post by: Loda on April 14, 2006, 08:48:19 PM
hello,
i have insert in my memberlist the pm links.
http://www.4homepages.de/forum/index.php?topic=1954.msg54648#msg54648

 how can i delete the pm link for the member "searchbot" ?
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on April 15, 2006, 12:59:31 AM
you can use {ifno is_bot}...{endifno is_bot} as it explained in step 4.2
Title: Re: [MOD] Treat bots as users with less rights
Post by: Loda on April 15, 2006, 08:58:36 AM
hello,
yes, you are right, v@no.. but i can't insert this in a php file, the memberlist is "only" a php file...
i don't know how i insert the tags in the memberlist.php..
Title: Re: [MOD] Treat bots as users with less rights
Post by: mawenzi on April 19, 2006, 03:48:16 PM
Hallo Loda,

ich habe die Ausblendung der PM-Links für die Bots in der Memberlist wie folgt gelöst ...
Code: [Select]
$url_pm_user = $site_sess->url(ROOT_PATH."pm.php?action=new&user_id=".$user_row['user_id']."");
    if ($user_id == XXX || $user_id == XXX || $user_id == XXX) { // XXX :  user_id für Bots ohne PM-Link
       $user_pm_button = "<font color=\"#888888\"><small>-Bot-</small></span> ";
    } else {
       $user_pm_button = "<a href=\"".$url_pm_user."\"><img src=\"".get_gallery_image("pm.gif")."\" border=\"0\" alt=\"".$lang['pm_to_user']."\"></a>";
    }

mawenzi
Title: Re: [MOD] Treat bots as users with less rights
Post by: Loda on April 19, 2006, 06:21:39 PM
ahhh...
danke! leider funktionieren einige sachen mit {if is_bot} bla bla {endif...
nicht so..

-------------

thank you!
but anything ist wrong on my site with the {if is_bot} tag... i don't know...
Title: Re: [MOD] Treat bots as users with less rights
Post by: mawenzi on April 19, 2006, 06:31:54 PM
@ Loda,

mein Lösungsvorschlag arbeitet unabhängig von der Funktion des {if is_bot} tag ... !
Die Änderung ist in der memberlist.php vorzunehmen und an Stelle von ...
Code: [Select]
$url_pm_user = ...
$user_pm_button = ...
... zu verwenden. Das sollte auch bei dir funktionieren !

mawenzi
Title: Re: [MOD] Treat bots as users with less rights
Post by: Loda on April 19, 2006, 07:51:45 PM
ja, danke..
das funktioniert! keine frage!
aber alles andere, was ich ausblenden wollte, macht ärger..  :(
sorry.. kam etwas komisch rüber von mir..
Title: Re: [MOD] Treat bots as users with less rights
Post by: martrix on April 20, 2006, 04:42:15 PM
Was bedeutet "macht ärger"?
Kannst du das etwas genauer definieren?
Bei mir funktioniert alles ohne alle probleme - schau mal bitte nach,
ob du alles schritt für schritt richtig implementiert hast...
Title: Re: [MOD] Treat bots as users with less rights
Post by: Loda on April 20, 2006, 04:51:53 PM
Was bedeutet "macht ärger"?
Kannst du das etwas genauer definieren?
Bei mir funktioniert alles ohne alle probleme - schau mal bitte nach,
ob du alles schritt für schritt richtig implementiert hast...

ärger machen bei mir nur die {ifno is_bot} tags.. ich weiss nicht warum, bin auf der suche...
(vielleicht habe ich etwas nicht richtig gelesen, verstanden oder falsch eingebaut...)
Title: Re: [MOD] Treat bots as users with less rights
Post by: martrix on April 20, 2006, 05:05:41 PM
Falls ich das also richtig vestehe, funktionieren die "ifno" tags gar nicht???
(also nicht nur isbot, sondern alle ifno varianten)
Title: Re: [MOD] Treat bots as users with less rights
Post by: lemccoy on June 01, 2006, 01:40:32 PM
Hi

I added google ads to my template, and now it seems like people are being automatically logged in as googlebot and able to send messages as googlebot?  It seems when I log out from being googlebot it still logs me in after a few page clicks? 

What is going on? 

Thanks
Title: Re: [MOD] Treat bots as users with less rights
Post by: martrix on June 01, 2006, 02:21:04 PM
That depends on what you did change in the code to include google-ads...
You describe it as if you'd forget to delete MS explorer from the array after testing or smt similar...
Title: Re: [MOD] Treat bots as users with less rights
Post by: lemccoy on June 01, 2006, 02:53:28 PM
but I never changed my sessions.php file for adding the adsense code?  just the templates?
Title: Re: [MOD] Treat bots as users with less rights
Post by: exefire on June 01, 2006, 06:44:44 PM
I know two yahoo bots (dont know if they have more).
Its identify itself as:
Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)
and
ia_archiver

In the code I used this to identify them:
Code: [Select]
      "ia_archiver" => "bot-yahoo",
      "Yahoo! Slurp" => "bot-yahoo",
      "help\.yahoo\.com" => "bot-yahoo",

i done this change, but when yahoo conects to my site, it's show "searchbot"... i know that is yahoo because when i ask for de I.P. in http://www.senderbase.org/search?searchString=68.142.249.44 and show me

Code: [Select]
Network Owner  INKTOMI CORPORATION
Domain inktomisearch.com
Date of first message seen from this address 2006-02-27
CIDR range 68.142.192.0/18
# of domains controlled by this network owner 6
Geography data
Country US
State CA
City San Mateo
Postal code 94404

so... if you click in http://inktomisearch.com it go to yahoo...

anyone have an idea for identificate yahoo bot?....

(sorry for my bad english :oops:)
Title: Re: [MOD] Treat bots as users with less rights
Post by: martrix on June 01, 2006, 07:15:51 PM
So you did not change any .php file and since then all users are automatically logged in as a searchbot?
Hm, and if you upload your backups before the change, everything is fine?
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on June 02, 2006, 12:04:05 AM
show the whole $robots array that you have.
Title: Re: [MOD] Treat bots as users with less rights
Post by: lemccoy on June 02, 2006, 05:05:00 PM
from sessions.php:

Code: [Select]
// mod GoogleBot
$site_sess = new Session();
$robots = array(
"FAST-WebCrawler" => "searchbot",
"Gulliver" => "searchbot",
"AltaVista" => "searchbot",
"Alexibot" => "searchbot",
"asterias" => "searchbot",
"BackDoorBot" => "searchbot",
"Black.Hole" => "searchbot",
"BlowFish" => "searchbot",
"BotALot" => "searchbot",
"NPBot" => "searchbot",
"Pompos" => "searchbot",
"Scooter" => "searchbot",
"SiteSnagger" => "searchbot",
"Slurp" => "searchbot",
"WebmasterWorldForumBot" => "searchbot",
"zyborg" => "searchbot",
"Google" => "googlebot",
"msnbot" => "searchbot",
"ZACATEK_CZ_BOT" => "searchbot",
"EARTHCOM.info" => "searchbot",
"sherlock" => "searchbot",
"Holmes" => "searchbot",
"ia_archiver" => "searchbot",
"lwp-trivial" => "searchbot",
"appie" => "searchbot",
"Scooter" => "searchbot",
"Gigabot" => "searchbot",
"Wget" => "searchbot",
"jyxobot" => "searchbot",
"Xenu Link Sleuth" => "searchbot",
"SeznamBot" => "searchbot",
);
foreach($robots as $key => $val) {
  if(!$_SERVER['HTTP_USER_AGENT'] || preg_match("/".$key."/i", $_SERVER['HTTP_USER_AGENT'])) {
    $site_sess->login($val, "12345");
    $user_bot = 1;
    break;
  }
}

and I only put the coding in the tempates:
example, details.html
Code: [Select]
{if user_loggedout}
               
<script type="text/javascript"><!--
google_ad_client = "pub-4867234679565045";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "F0F8FF";
google_color_link = "0000FF";
google_color_bg = "F0F8FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
{endif user_loggedout}
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on June 03, 2006, 01:28:46 AM
Ok, since you are affected too (right?) try to debug it with this:
below     $user_bot = 1; insert this:
Code: [Select]
echo $key;It should display the string that matched (dont worry about possible warning messages)
Then find that word in the array and remove the whole line with it, see if it helps.

P.S. needless to say that when you done debuging, remove the line above ;)
Title: Re: [MOD] Treat bots as users with less rights
Post by: lemccoy on June 05, 2006, 06:12:00 PM
ok it only seems to do it when googlebot is online, and then it only switches you to the googlebot user when you load the details.php page.  I looked through the code and have no reference to the google ads at all.  this is so weird!
Title: Re: [MOD] Treat bots as users with less rights
Post by: mawenzi on June 08, 2006, 09:59:35 PM
I think the following is interesting in connection with this MOD ...

...
So, there is a way to detect a bot and dont attach sessionid for it, but doing so will create new session on each request bot made, that is more server resources, because more files will be created in the server's sessions storage.
...

more here -> http://www.4homepages.de/forum/index.php?topic=6729.msg59251#msg59251
Title: Re: [MOD] Treat bots as users with less rights
Post by: lemccoy on June 09, 2006, 04:08:41 PM
I removed the google ads and don't have a problem.  Doesn't really matter - i only made 12 cents (USD) in a week! but Damn, googlebot sure spiders the site a lot...
Title: Re: [MOD] Treat bots as users with less rights
Post by: mawenzi on June 09, 2006, 04:19:31 PM
... but Damn, googlebot sure spiders the site a lot ...
... googlebot is probably the most active user ...  :mrgreen:
Title: Re: [MOD] Treat bots as users with less rights
Post by: martrix on June 09, 2006, 08:15:43 PM
... googlebot is probably the most active user ...  :mrgreen:
Yep - especially googlebot... if just 1/3 of my users would be THAT active, I'd have bandwidth problems :D
Title: Re: [MOD] Treat bots as users with less rights
Post by: sajwal on August 03, 2006, 06:19:13 AM
Hi,
   I can not find step 4.2 in ver 1.7.3
//-----------------------------------------------------
//--- Parse Header & Footer ---------------------------
//-----------------------------------------------------

can anybody keep me pushing?

Pls. i need this mod
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on August 03, 2006, 08:03:53 AM
add it above
Code: [Select]
//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------
Title: Re: [MOD] Treat bots as users with less rights
Post by: sajwal on August 03, 2006, 08:15:36 PM
thankyou V@no for the help but

somebody asked a question in this thread as How is it possible to see this ?

currently active user : x members y guests and z bots online

no body answered him

pls. help this too i will be completed with this mod then
Title: Re: [MOD] Treat bots as users with less rights
Post by: sajwal on August 05, 2006, 12:05:01 AM
thankyou V@no for the help but

somebody asked a question in this thread as How is it possible to see this ?

currently active user : x members y guests and z bots online

no body answered him

pls. help this too i will be completed with this mod then
please answer to this query of mine
Title: Re: [MOD] Treat bots as users with less rights
Post by: CCVBE on January 30, 2008, 10:16:44 AM
Hello,

I have 2 questions to this:

1. Are the searchbots able to read PM and display in web?  8O

2. In my list "Last active users" are searchbot & co. most active. ;-) How can I get them out from this list?
Title: Re: [MOD] Treat bots as users with less rights
Post by: CCVBE on January 30, 2008, 09:53:09 PM
Hallo Loda,

ich habe die Ausblendung der PM-Links für die Bots in der Memberlist wie folgt gelöst ...
Code: [Select]
$url_pm_user = $site_sess->url(ROOT_PATH."pm.php?action=new&user_id=".$user_row['user_id']."");
    if ($user_id == XXX || $user_id == XXX || $user_id == XXX) { // XXX :  user_id für Bots ohne PM-Link
       $user_pm_button = "<font color=\"#888888\"><small>-Bot-</small></span> ";
    } else {
       $user_pm_button = "<a href=\"".$url_pm_user."\"><img src=\"".get_gallery_image("pm.gif")."\" border=\"0\" alt=\"".$lang['pm_to_user']."\"></a>";
    }

mawenzi

That works! Thank you. ;-)

In member_profile.htlm is another link "Send PM to this user". How to get out this for Bots?


Title: Re: [MOD] Treat bots as users with less rights
Post by: mawenzi on January 30, 2008, 10:43:55 PM
@CCVBE

... in templates you can use for bots ...
Code: [Select]
{if is_bot} ... here the code or the text for bots ... {endif is_bot}

... or for users (not bots) ...
Code: [Select]
{ifno is_bot} ... here the code or the text for users (not bots) ... {endifno is_bot}
Title: Re: [MOD] Treat bots as users with less rights
Post by: CCVBE on January 31, 2008, 02:11:40 PM
Thank's mawenzi, I have installed Step 4.1 and 4.2 of course.

Is this MOD required?: [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1
(http://www.4homepages.de/forum/index.php?topic=6036.msg26229#msg26229)
If I install that into version 1.7.4 , I get white screen.

Or should this code:
Quote
{ifno is_bot}{lang_pm}{endifno is_bot}
works without [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1},
because of this:
Quote
$site_template->register_vars(array(
   "is_bot" => (isset($usergroups[14])) ? 1 : 0
in page_header.php?

I think nobody will try to send a PM to "googlebot", but it's possible. ;-)
The link "Send PM to this user" should only be displayed for user (no for bots) in member_profil.html.
Is not a big thing if there is link in profile for bots too, but it must not be...





Title: Re: [MOD] Treat bots as users with less rights
Post by: mawenzi on January 31, 2008, 03:02:36 PM
Is this MOD required?: [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1
(http://www.4homepages.de/forum/index.php?topic=6036.msg26229#msg26229)
If I install that into version 1.7.4 , I get white screen.
...
Or should this code:
Quote
{ifno is_bot}{lang_pm}{endifno is_bot}
works without [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1},

... for 4images version 1.7.4 you dont use this MOD (is needed only for version < 1.7.2) ...
Quote
{ifno is_bot}{lang_pm}{endifno is_bot}
... is absolutly correct to show the PM-link not to bots ...
... you can test it on your site ...
... logg in with bot-name and bot-password ( you know where is it to find ) ...
... and you will see / or not see what a bot on your site is able to see ... ;)
Title: Re: [MOD] Treat bots as users with less rights
Post by: CCVBE on January 31, 2008, 06:15:28 PM
ok, but I mean if user click on profile of bot, there is a link to send him PM.
This I want to remove only for bots. See attachment please.
Title: Re: [MOD] Treat bots as users with less rights
Post by: mawenzi on January 31, 2008, 06:44:37 PM
@CCVBE

... OK ... my solution for this ...

1. add to your member.php the following codelines ...
Code: [Select]
//--- Private-Message-Link im Profil , 26.01.2006 ----------------------
    $user_pm_link = $site_sess->url(ROOT_PATH."pm.php?action=new&user_id=".$user_row['user_id']."");
    $bot_id = $user_row['user_id'];
    if ($bot_id == XX || $bot_id == XX || $bot_id == XX || $bot_id == XX) { // replace all XX with the user_id of the bots
       $user_pm_url = REPLACE_EMPTY;
    } else {
       $user_pm_url = $user_pm_link;
    }
    $site_template->register_vars("user_pm_url", $user_pm_url);
//--- Private-Message-Link im Profil , 26.01.2006 ----------------------

2. now you can use in your member_profile.html ...
Code: [Select]
<td class="row1"><b>Private Nachricht:</b></td>
<td class="row1">{if user_pm_url}<a href="{user_pm_url}">PN an {user_name} schreiben</a>{endif user_pm_url} </td>
... the PM-Link is now not to see in all bots-member-profiles ...
Title: Re: [MOD] Treat bots as users with less rights
Post by: Jan-Lukas on July 06, 2008, 01:37:51 PM
folgendes Problem, ein Admin war heute nach dem einloggen, als googlebot unterwegs, konnte auch unter diesem Namen Bilder hochladen  :?:

Hin und wieder kommt es auch vor das ein Admin als User unterwegs ist, ein Admin war sogar unter meinem Nick mal in der Galerie.
Das ein User als Admin unterwegs war, ist mir nicht bekannt, aber wer würde das auch sagen  :?:

Gibt es da schon Erkenntnisse ?
Title: Re: [MOD] Treat bots as users with less rights
Post by: sanko86 on January 08, 2009, 03:03:51 PM
thanks man.
Title: Re: [MOD] Treat bots as users with less rights
Post by: AntiNSA2 on May 19, 2009, 06:40:51 AM
I think I was replying to the wrong thread about this issue... so Ill move my questions to here
Quote
Im a little confused; it seems that  this mod you mentions only controls the sections of the site which the robots are allowed to view... I know I can keep them from sepere *.php files through no follow...

But  I am understand correctly, session ID's cause errors when indexed by google. they will create links with session ID embedded, which create a 404 not found error.

Your telling me, that bots with this mod will not have a session ID, because they are members...????

But dont members even have session ID's?

If so, why is it the members session ids wont be indexed?

Or are you saying that members have no session ID's , so every url followed will be clean/ without a session ID?

If so, why go through the trouble of adding to every single link of your website is a bot/ not a bot, and just block the unwanted with robots.txt, and simply require the robot be a member?

However the internal member management works, let it allow the bot to do everything. As I understand the robots.txt is a seperate form of robot management, which will overide the allow all of the internal member management, and restrict the robot to your no follow commands.

In the end the benefit of the mod is no user session id indexed.

All assuming members dont use user session id's.

Thats the big question.. how can users not use session ids, but guests do? Im guessing the session id controlls like when the user should log in and what they can see... which is stored in a cookie I guess? So that means no cookie members would be allowed to be logged in forever, somehow tracked by current user ip; or the oppisite they would be asked to log in with every single click because the system can not determin who they are because there is no cookie to register the user info in?

If it is recorded by user ip, why use cookies at all? Because of the chance to different users might use the same IP? Well, if they had no cookie to tell the difference and went by ip address...  There would be nothing keeping one user safe from the other unless he specifically logged out, and then it would rewcord the ip as logged out?

Why not simply slip the cookie process and make mandatory 30 minute log outs for each user?



I know this is confusing... if you could respond to each section inline it would be easier to follow.

I just dont understand the logic of that mod , going through every single link saying what robots can and cant do, instead of foing it much more simply through robots.txt.

IF allowing the robot to be listed as a user,  wouldnt the robots.txt act as a way for the robot to govern itself by following the robots.txt map, rather than by the ennifficient way of adding mark up to each and every link?

I could understanf using the if robot tage to SHOW information to the robots no one else can see... however why use it vs. the robots.txt to hide it?


All I want to do is kill the session id from the index...

Is there away to kill it and allow the robot to view everything but govern itself through robots txt, allowing a golden map of session free indexing?

THanks.. sorry this is so confusing.
Title: Re: [MOD] Treat bots as users with less rights
Post by: AntiNSA2 on June 07, 2009, 07:04:24 AM
Separate question... is anyone using this successfully with the vbulletin
 bridge?
Title: Re: [MOD] Treat bots as users with less rights
Post by: AntiNSA2 on June 07, 2009, 07:28:58 AM
Cool mod thx  :)

On site i dont need to show more options for bots but....
how can i display
"Currently active X  bot(s)"
 :?:

is it posiible without registering manualy all bots when i dont need display name of bot ?

Id like this information if you find out how...
Title: Re: [MOD] Treat bots as users with less rights
Post by: AntiNSA2 on June 07, 2009, 07:36:52 AM
I think the following is interesting in connection with this MOD ...

...
So, there is a way to detect a bot and dont attach sessionid for it, but doing so will create new session on each request bot made, that is more server resources, because more files will be created in the server's sessions storage.
...
more here -> http://www.4homepages.de/forum/index.php?topic=6729.msg59251#msg59251

Are you saying tat with this mod there will still be session id's indexed in to
 search engines, and we should follow v@nos advice to avoid search engines indexing the session ids, because once indexed they will link back to urls including session id's which will create not found errors?


Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on June 07, 2009, 03:08:56 PM
I think the following is interesting in connection with this MOD ...

...
So, there is a way to detect a bot and dont attach sessionid for it, but doing so will create new session on each request bot made, that is more server resources, because more files will be created in the server's sessions storage.
...
more here -> http://www.4homepages.de/forum/index.php?topic=6729.msg59251#msg59251

Are you saying tat with this mod there will still be session id's indexed in to
 search engines, and we should follow v@nos advice to avoid search engines indexing the session ids, because once indexed they will link back to urls including session id's which will create not found errors?

Yes, this mod doesn't remove session ids, but that little addon that you mentioned does. Combine both and you are good to go. Also, this mod can be used only to detect bots, not necessarily treat them as members.


Just in case you didn't know how to test this yourself. You'll need the following ingredients:
- Firefox
- Cookie Button (https://addons.mozilla.org/en-US/firefox/addon/1247) (CB)
- User Agent Switcher (https://addons.mozilla.org/en-US/firefox/addon/59) (UAS)

The recipe is quiet simple, open Firefox, open UAS options (via tools menu) and add new agent "googlebot" (without quotes). Select the "googlebot" in UAS. Visit your 4images. Then clear all cookies (or if you know how, delete only for your site), then via CB select a cookie with a red X (deny cookies) and refresh the page. Now you should be able see your site as googlebot sees it.
Title: Re: [MOD] Emergency ! Redirect Loop! Please help V@no
Post by: AntiNSA2 on June 07, 2009, 05:28:37 PM
I downloaded the old version of firefox you recommended, and followed the steps provided to check what my site should look like to a robot. I followed your steps in this thread and the thread to not issue a session id. When I set the user agent as one that matched the ones in the bot list I get a redirect error in firefox!!!!


This must be why google can not index my site!

If I disable cookies and change user agent to something not listed in the bot list It will work without cookies....

here is my sessions.php
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: sessions.php                                         *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    * 
 *              Web: http://www.4homepages.de                             * 
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) f&#252;r weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die(
"Security violation");
}
/*
  MOD VISITORS COUNTRY FLAGS
  START INSERT
*/
    
if (!class_exists("GeoIP"))
    {
      include(
ROOT_PATH."includes/geoip.inc");
    }
    
    
$gi geoip_open(ROOT_PATH."includes/GeoIP.dat",GEOIP_STANDARD);
    
$countries = array();
/*
  MOD VISITORS COUNTRY FLAGS
  END INSERT
*/
//-----------------------------------------------------
//--- Start Configuration -----------------------------
//-----------------------------------------------------

define('SESSION_NAME''sessionid');

$user_table_fields = array(
  
"user_id" => "user_id",
  
"user_level" => "user_level",
  
"user_name" => "user_name",
  
"user_password" => "user_password",
  
"user_email" => "user_email",
  
"user_showemail" => "user_showemail",
  
"user_allowemails" => "user_allowemails",
  
"user_invisible" => "user_invisible",
  
"user_joindate" => "user_joindate",
  
"user_activationkey" => "user_activationkey",
  
"user_lastaction" => "user_lastaction",
  
"user_location" => "user_location",
  
"user_lastvisit" => "user_lastvisit",
  
"user_comments" => "user_comments",
  
"user_homepage" => "user_homepage",
  
"user_icq" => "user_icq"
);

//-----------------------------------------------------
//--- End Configuration -------------------------------
//-----------------------------------------------------

function get_user_table_field($add$user_field) {
  global 
$user_table_fields;
  return (!empty(
$user_table_fields[$user_field])) ? $add.$user_table_fields[$user_field] : "";
}

class 
Session {

  var 
$session_id;
  var 
$session_key;
  var 
$user_ip;
  var 
$user_location;
  var 
$current_time;
  var 
$session_timeout;
  var 
$mode "get";
  var 
$session_info = array();
  var 
$user_info = array();

  function 
Session() {
    global 
$config;
    
$this->session_timeout $config['session_timeout'] * 60;
    
$this->user_ip $this->get_user_ip();
    
$this->user_location $this->get_user_location();
    
$this->current_time time();

    if (
defined('SESSION_KEY') && SESSION_KEY != '') {
        
$this->session_key SESSION_KEY;
    } else {
        
$this->session_key md5('4images' realpath(ROOT_PATH));
    }

    
// Stop adding SID to URLs
    
@ini_set('session.use_trans_sid'0);

    
//@ini_set('session.cookie_lifetime', $this->session_timeout);

    
session_name(urlencode(SESSION_NAME));
    @
session_start();

    
$this->demand_session();
  }

  function 
set_cookie_data($name$value$permanent 1) {
    
$cookie_expire = ($permanent) ? $this->current_time 60 60 24 365 0;
    
$cookie_name COOKIE_NAME.$name;
    
setcookie($cookie_name$value$cookie_expireCOOKIE_PATHCOOKIE_DOMAINCOOKIE_SECURE);
    
$HTTP_COOKIE_VARS[$cookie_name] = $value;
  }

  function 
read_cookie_data($name) {
    global 
$HTTP_COOKIE_VARS;
    
$cookie_name COOKIE_NAME.$name;
    return (isset(
$HTTP_COOKIE_VARS[$cookie_name])) ? $HTTP_COOKIE_VARS[$cookie_name] : false;
  }

  function 
get_session_id() {
    if (
SID == '') {
      
$this->mode "cookie";
    }

    if (
preg_match('/[^a-z0-9]+/i'session_id())) {
      @
session_regenerate_id();
    }

    
$this->session_id session_id();
  }

  function 
demand_session() {
    
$this->get_session_id();
    if (!
$this->load_session_info()) {
      
$this->delete_old_sessions();
      
$user_id = ($this->read_cookie_data("userid")) ? intval($this->read_cookie_data("userid")) : GUEST;
      
$this->start_session($user_id);
    }
    else {
      
$this->user_info $this->load_user_info($this->session_info['session_user_id']);
      
$update_cutoff = ($this->user_info['user_id'] != GUEST) ? $this->current_time $this->user_info['user_lastaction'] : $this->current_time $this->session_info['session_lastaction'];
      if (
$update_cutoff 60) {
        
$this->update_session();
        
$this->delete_old_sessions();
      }
    }
  }

  function 
start_session($user_id GUEST$login_process 0) {
    global 
$site_db;

    
$this->user_info $this->load_user_info($user_id);
    if (
$this->user_info['user_id'] != GUEST && !$login_process) {
      if (
$this->read_cookie_data("userpass") == $this->user_info['user_password'] && $this->user_info['user_level'] > USER_AWAITING) {
        
$this->set_cookie_data("userpass"$this->user_info['user_password']);
      }
      else {
        
$this->set_cookie_data("userpass"""0);
        
$this->user_info $this->load_user_info(GUEST);
      }
    }

    
//if (!$login_process) {
      
$sql "REPLACE INTO ".SESSIONS_TABLE."
              (session_id, session_user_id, session_lastaction, session_location, session_ip)
              VALUES
              ('"
.addslashes($this->session_id)."', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
      
$site_db->query($sql);
    
//}

    
$this->session_info['session_user_id'] = $this->user_info['user_id'];
    
$this->session_info['session_lastaction'] = $this->current_time;
    
$this->session_info['session_location'] = $this->user_location;
    
$this->session_info['session_ip'] = $this->user_ip;

    if (
$this->user_info['user_id'] != GUEST) {
      
$this->user_info['user_lastvisit'] = (!empty($this->user_info['user_lastaction'])) ? $this->user_info['user_lastaction'] : $this->current_time;
      
$sql "UPDATE ".USERS_TABLE."
              SET "
.get_user_table_field("""user_lastaction")." = $this->current_time, ".get_user_table_field("""user_location")." = '$this->user_location', ".get_user_table_field("""user_lastvisit")." = ".$this->user_info['user_lastvisit']."
              WHERE "
.get_user_table_field("""user_id")." = ".$this->user_info['user_id'];
      
$site_db->query($sql);
    }
    
$this->set_cookie_data("lastvisit"$this->user_info['user_lastvisit']);
    
$this->set_cookie_data("userid"$this->user_info['user_id']);
    return 
true;
  }

  function 
login($user_name ""$user_password ""$auto_login 0$set_auto_login 1$do_md5 true) {
    global 
$site_db$user_table_fields;

    if (empty(
$user_name) || empty($user_password)) {
      return 
false;
    }
    
$sql "SELECT ".get_user_table_field("""user_id").get_user_table_field(", ""user_password")."
            FROM "
.USERS_TABLE."
            WHERE "
.get_user_table_field("""user_name")." = '$user_name' AND ".get_user_table_field("""user_level")." <> ".USER_AWAITING;
    
$row $site_db->query_firstrow($sql);

    
$user_id = (isset($row[$user_table_fields['user_id']])) ? $row[$user_table_fields['user_id']] : GUEST;
    


if(
$do_md5 == true$user_password md5($user_password);
    if (
$user_id != GUEST) {
      if (
$row[$user_table_fields['user_password']] == $user_password) {
        
$sql "UPDATE ".SESSIONS_TABLE."
                SET session_user_id = 
$user_id
                WHERE session_id = '"
.addslashes($this->session_id)."'";
        
$site_db->query($sql);
        if (
$set_auto_login) {
          
$this->set_cookie_data("userpass", ($auto_login) ? $user_password "");
        }
        
$this->start_session($user_id1);
        return 
true;
      }
    }
    return 
false;
  }

  function 
logout($user_id) {
    global 
$site_db;
    
$sql "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_id = '"
.addslashes($this->session_id)."' OR session_user_id = $user_id";
    
$site_db->query($sql);
    
$this->set_cookie_data("userpass"""0);
    
$this->set_cookie_data("userid"GUEST);

    
$this->session_info = array();

    return 
true;
  }

  function 
delete_old_sessions() {
    global 
$site_db;
    
$expiry_time $this->current_time $this->session_timeout;
    
$sql "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_lastaction < 
$expiry_time";
    
$site_db->query($sql);

    return 
true;
  }

  function 
update_session() {
    global 
$site_db;

    
$sql "REPLACE INTO ".SESSIONS_TABLE."
           (session_id, session_user_id, session_lastaction, session_location, session_ip)
           VALUES
           ('"
.addslashes($this->session_id)."', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
    
$site_db->query($sql);

    
$this->session_info['session_lastaction'] = $this->current_time;
    
$this->session_info['session_location'] = $this->user_location;
    
$this->session_info['session_ip'] = $this->user_ip;

    if (
$this->user_info['user_id'] != GUEST) {
      
$sql "UPDATE ".USERS_TABLE."
              SET "
.get_user_table_field("""user_lastaction")." = $this->current_time, ".get_user_table_field("""user_location")." = '$this->user_location'
              WHERE "
.get_user_table_field("""user_id")." = ".$this->user_info['user_id'];
      
$site_db->query($sql);
    }
    return;
  }

  function 
return_session_info() {
    return 
$this->session_info;
  }

  function 
return_user_info() {
    return 
$this->user_info;
  }

  function 
freeze() {
    return;
  }

  function 
load_session_info() {
    if (@
ini_get('register_globals')) {
      
session_register($this->session_key);

      if (!isset(
$GLOBALS[$this->session_key])) {
        
$GLOBALS[$this->session_key] = array();
      }

      
$this->session_info = &$GLOBALS[$this->session_key];

    } else {
      if (isset(
$_SESSION)) {
        if (!isset(
$_SESSION[$this->session_key])) {
          
$_SESSION[$this->session_key] = array();
        }

        
$this->session_info = &$_SESSION[$this->session_key];

      } else {
        if (!isset(
$GLOBALS['HTTP_SESSION_VARS'][$this->session_key])) {
          
$GLOBALS['HTTP_SESSION_VARS'][$this->session_key] = array();
        }

        
$this->session_info = &$GLOBALS['HTTP_SESSION_VARS'][$this->session_key];
      }
    }

    if (!isset(
$this->session_info['session_ip'])) {
      
$this->session_info = array();
      return 
false;
    }

    if (
$this->mode == "get" && $this->session_info['session_ip'] != $this->user_ip) {
      if (
function_exists('session_regenerate_id')) {
        @
session_regenerate_id();
      }
      
$this->get_session_id();
      
$this->session_info = array();
      return 
false;
    }

    return 
$this->session_info;
  }

  function 
load_user_info($user_id GUEST) {
    global 
$site_db$user_table_fields;

    if (
$user_id != GUEST) {
      
$sql "SELECT u.*, l.*
              FROM "
.USERS_TABLE." u, ".LIGHTBOXES_TABLE." l
              WHERE "
.get_user_table_field("u.""user_id")." = $user_id AND l.user_id = ".get_user_table_field("u.""user_id");
      
$user_info $site_db->query_firstrow($sql);
      if (!
$user_info) {
        
$sql "SELECT *
                FROM "
.USERS_TABLE."
                WHERE "
.get_user_table_field("""user_id")." = $user_id";
        
$user_info $site_db->query_firstrow($sql);
        if (
$user_info) {
          
$lightbox_id get_random_key(LIGHTBOXES_TABLE"lightbox_id");
          
$sql "INSERT INTO ".LIGHTBOXES_TABLE."
                  (lightbox_id, user_id, lightbox_lastaction, lightbox_image_ids)
                  VALUES
                  ('
$lightbox_id', ".$user_info[$user_table_fields['user_id']].", $this->current_time, '')";
          
$site_db->query($sql);
          
$user_info['lightbox_lastaction'] = $this->current_time;
          
$user_info['lightbox_image_ids'] = "";
        }
      }
    }
    if (empty(
$user_info[$user_table_fields['user_id']])) {
      
$user_info = array();
      
$user_info['user_id'] = GUEST;
      
$user_info['user_level'] = GUEST;
      
$user_info['user_lastaction'] = $this->current_time;
      
$user_info['user_lastvisit'] = ($this->read_cookie_data("lastvisit")) ? $this->read_cookie_data("lastvisit") : $this->current_time;
    }
    foreach (
$user_table_fields as $key => $val) {
      if (isset(
$user_info[$val])) {
        
$user_info[$key] = $user_info[$val];
      }
      elseif (!isset(
$user_info[$key])) {
        
$user_info[$key] = "";
      }
    }
    return 
$user_info;
  }

  function 
set_session_var($var_name$value) {
    
$this->session_info[$var_name] = $value;
    return 
true;
  }

  function 
get_session_var($var_name) {
    if (isset(
$this->session_info[$var_name])) {
      return 
$this->session_info[$var_name];
    }

    return 
'';
  }

  function 
drop_session_var($var_name) {
    unset(
$this->session_info[$var_name]);
  }

  function 
get_user_ip() {
    global 
$HTTP_SERVER_VARS$HTTP_ENV_VARS;
    
$ip = (!empty($HTTP_SERVER_VARS['REMOTE_ADDR'])) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ((!empty($HTTP_ENV_VARS['REMOTE_ADDR'])) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv("REMOTE_ADDR"));
    
$ip preg_replace("/[^\.0-9]+/"""$ip);
    return 
substr($ip050);
  }

  function 
get_user_location() {
    global 
$self_url;
    return (
defined("IN_CP")) ? "Control Panel" preg_replace(array("/([?|&])action=[^?|&]*/""/([?|&])mode=[^?|&]*/""/([?|&])phpinfo=[^?|&]*/""/([?|&])printstats=[^?|&]*/""/[?|&]".URL_ID."=[^?|&]*/""/[?|&]l=[^?|&]*/""/[&?]+$/"), array(""""""""""""""), addslashes($self_url));
  }

/* ORIGINAL CODE
   function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
*/
  
function url($url$amp "&amp;") {
    global 
$l$user_info;
    
$dummy_array explode("#"$url);
    
$url $dummy_array[0];
    
$url str_replace('&amp;''&'$url);
    if (!
defined('IN_CP')) {
      if (
strstr($url'index.php')) {
        
$url str_replace('index.php'''$url);
      }
      elseif (
strstr($url'search.php')) {
        if (
strstr($url'page=')) {
          
preg_match('#page=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('search.php''search.'.$matches[1].'.htm'$url);
            
$query str_replace('page='.$matches[1].'&'''$query);
            
$query str_replace('&page='.$matches[1], ''$query);
            
$query str_replace('page='.$matches[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        else {
          
$url str_replace('search.php''search.htm'$url);
        }
      }
      elseif (
strstr($url'lightbox.php')) {
        if (
strstr($url'page=')) {
          
preg_match('#page=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('lightbox.php''lightbox.'.$matches[1].'.htm'$url);
            
$query str_replace('page='.$matches[1].'&'''$query);
            
$query str_replace('&page='.$matches[1], ''$query);
            
$query str_replace('page='.$matches[1], ''$query);
            if (!empty(
$query)) {
                
$url .= '?' $query;
            }
          }
        }
        else {
          
$url str_replace('lightbox.php''lightbox.htm'$url);
        }
      }
      elseif (
strstr($url'categories.php')) {
        if (
strstr($url'cat_id=') && strstr($url'page=')) {
          
preg_match('#cat_id=([0-9]+)&?#'$url$matches1);
          
preg_match('#page=([0-9]+)&?#'$url$matches2);
          if (isset(
$matches1[1]) && isset($matches2[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('categories.php''cat'.$matches1[1].'.'.$matches2[1].'.htm'$url);
            
$query str_replace('cat_id='.$matches1[1].'&'''$query);
            
$query str_replace('&cat_id='.$matches1[1], ''$query);
            
$query str_replace('cat_id='.$matches1[1], ''$query);
            
$query str_replace('page='.$matches2[1].'&'''$query);
            
$query str_replace('&page='.$matches2[1], ''$query);
            
$query str_replace('page='.$matches2[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        elseif (
strstr($url'cat_id=')) {
          
preg_match('#cat_id=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$cat_url get_category_url($matches[1]);
            
$url   str_replace('categories.php''cat'.$cat_url.'.htm'$url);
            
$query str_replace('cat_id='.$matches[1].'&'''$query);
            
$query str_replace('&cat_id='.$matches[1], ''$query);
            
$query str_replace('cat_id='.$matches[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        else {
          
$url str_replace('categories.php''cat.htm'$url);
        }
      }
      elseif (
strstr($url'details.php?image_id=')) {
        if (
strstr($url'image_id=') && strstr($url'mode=')) {
          
preg_match('#image_id=([0-9]+)&?#'$url$matches1);
          
preg_match('#mode=([a-zA-Z0-9]+)&?#'$url$matches2);
          if (isset(
$matches1[1]) && isset($matches2[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('details.php''img'.$matches1[1].'.'.$matches2[1].'.htm'$url);
            
$query str_replace('image_id='.$matches1[1].'&'''$query);
            
$query str_replace('&image_id='.$matches1[1], ''$query);
            
$query str_replace('image_id='.$matches1[1], ''$query);
            
$query str_replace('mode='.$matches2[1].'&'''$query);
            
$query str_replace('&mode='.$matches2[1], ''$query);
            
$query str_replace('mode='.$matches2[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        else {
          
preg_match('#image_id=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('details.php''img'.get_image_url($matches[1]).'.htm'$url);
            
$query str_replace('image_id='.$matches[1].'&'''$query);
            
$query str_replace('&image_id='.$matches[1], ''$query);
            
$query str_replace('image_id='.$matches[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
      }
      elseif (
strstr($url'postcards.php?image_id=')) {
        
preg_match('#image_id=([0-9]+)&?#'$url$matches);
        if (isset(
$matches[1])) {
          
$split explode('?'$url);
          
$url $split[0];
          
$query = @$split[1];
          
$url   str_replace('postcards.php''postcard.img'.$matches[1].'.htm'$url);
          
$query str_replace('image_id='.$matches[1].'&'''$query);
          
$query str_replace('&image_id='.$matches[1], ''$query);
          
$query str_replace('image_id='.$matches[1], ''$query);
          if (!empty(
$query)) {
            
$url .= '?' $query;
          }
        }
      }
    }
    global 
$user_bot;
    if (!
$user_bot && $this->mode == "get" && strstr($url$this->session_id)) {
      
$url .= strpos($url'?') !== false '&' '?';
      
$url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty(
$l)) {
      
$url .= strpos($url'?') ? '&' '?';
      
$url .= "l=".$l;
    }
    
$url str_replace('&'$amp$url);
    
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
    return 
$url;
  }

//end of class

//-----------------------------------------------------
//--- Start Session -----------------------------------
//-----------------------------------------------------
define('COOKIE_NAME''4images_');
define('COOKIE_PATH''');
define('COOKIE_DOMAIN''');
define('COOKIE_SECURE''0');

// mod GoogleBot
$site_sess = new Session();
$robots = array(
"FAST-WebCrawler" => "searchbot",
"Gulliver" => "searchbot",
"AltaVista" => "searchbot",
"Alexibot" => "searchbot",
"asterias" => "searchbot",
"BackDoorBot" => "searchbot",
"Black.Hole" => "searchbot",
"BlowFish" => "searchbot",
"BotALot" => "searchbot",
"NPBot" => "searchbot",
"Pompos" => "searchbot",
"Scooter" => "searchbot",
"SiteSnagger" => "searchbot",
"Slurp" => "searchbot",
"WebmasterWorldForumBot" => "searchbot",
"zyborg" => "searchbot",
"Google" => "googlebot",
"msnbot" => "searchbot",
"ZACATEK_CZ_BOT" => "searchbot",
"EARTHCOM.info" => "searchbot",
"sherlock" => "searchbot",
"Holmes" => "searchbot",
"ia_archiver" => "searchbot",
"lwp-trivial" => "searchbot",
"appie" => "searchbot",
"Scooter" => "searchbot",
"Gigabot" => "searchbot",
"Wget" => "searchbot",
"jyxobot" => "searchbot",
"Xenu Link Sleuth" => "searchbot",
"SeznamBot" => "searchbot",
);
foreach(
$robots as $key => $val) {
  if(!
$_SERVER['HTTP_USER_AGENT'] || preg_match("/".$key."/i"$_SERVER['HTTP_USER_AGENT'])) {
    
$site_sess->login($val"54321");
    
$user_bot 1
    break; 
  } 
}

// Get Userinfo
$session_info $site_sess->return_session_info();
$user_info $site_sess->return_user_info();
include_once(
realpath(dirname(__FILE__)).'/vb.php');
//-----------------------------------------------------
//--- Get User Caches ---------------------------------
//-----------------------------------------------------
$num_total_online 0;
$num_visible_online 0;
$num_invisible_online 0;
$num_registered_online 0;
$num_guests_online 0;
$user_online_list "";
$prev_user_ids = array();
$prev_session_ips = array();

if (
defined("GET_USER_ONLINE") && ($config['display_whosonline'] == || $user_info['user_level'] == ADMIN)) {
  
$time_out time() - 300;
  
$sql "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.""user_id").get_user_table_field(", u.""user_level").get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_invisible")."
      FROM "
.SESSIONS_TABLE." s
      LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = s.session_user_id)
      WHERE s.session_lastaction >= 
$time_out
      ORDER BY "
.get_user_table_field("u.""user_id")." ASC, s.session_ip ASC";
  
$result $site_db->query($sql);
  while (
$row $site_db->fetch_array($result)) {
    if (
$row['session_user_id'] != GUEST && (isset($row[$user_table_fields['user_id']]) && $row[$user_table_fields['user_id']] != GUEST)) {
      if (!isset(
$prev_user_ids[$row['session_user_id']])) {
        
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 0;
        
$invisibleuser = ($is_invisible) ? "*" "";
        
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>"$row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];
        if (!
$is_invisible || $user_info['user_level'] == ADMIN) {
          
$user_online_list .= ($user_online_list != "") ? ", " "";
          
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/"$row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$row['session_user_id'];
          
/*
  MOD VISITORS COUNTRY FLAGS
  START INSERT
*/
        
$cid geoip_country_code_by_addr($gi$row['session_ip']);
        if (empty(
$cid)) $cid "lan";
        
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1;
        
$username "<img src=\"".ROOT_PATH."flags/".strtolower($cid).".gif"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0> ".$username;
/*
  MOD VISITORS COUNTRY FLAGS
  END INSERT
*/   
          
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
        }
        (!
$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
        
$num_registered_online++;
      }
      
$prev_user_ids[$row['session_user_id']] = 1;
    }
    else {
      if (!isset(
$prev_session_ips[$row['session_ip']])) {
        
$num_guests_online++;
        
/*
  MOD VISITORS COUNTRY FLAGS
  START INSERT
*/
        
$cid geoip_country_code_by_addr($gi$row['session_ip']);
        if (empty(
$cid)) $cid "lan";
        
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1;
        
/*
  MOD VISITORS COUNTRY FLAGS
  END INSERT
*/

      
}
    }
    
$prev_session_ips[$row['session_ip']] = 1;
  }
  
/*
  MOD VISITORS COUNTRY FLAGS
  START INSERT
*/
  
$invitado_online_list = array();
  if (!empty(
$countries))
  {
    
asort($countries);
    foreach (
$countries as $key => $val)
    {
      
$invitado_online_list[] = "<font color=\"#00FFFF\">".$val."</font><img src=\"".ROOT_PATH."/flags/".strtolower($key).".gif\" align=\"middle\" alt=\"".(($key != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$key]] : "Unknown or LAN")."\" border=0>";
    }
  }
  
$invitado_online_list implode(" , "$invitado_online_list);
/*
  MOD VISITORS COUNTRY FLAGS
  END INSERT
*/
  
$num_total_online $num_registered_online $num_guests_online;
  
//$num_invisible_online = $num_registered_online - $num_visible_online;

  
$site_template->register_vars(array(
    
"num_total_online" => $num_total_online,
    
"num_invisible_online" => $num_invisible_online,
    
"num_registered_online" => $num_registered_online,
    
"num_guests_online" => $num_guests_online,
    
"invitado_online_list" => $invitado_online_list,
    
"user_online_list" => $user_online_list,
    
"lang_user_online" => str_replace('{num_total_online}'$num_total_online$lang['user_online']),
    
"lang_user_online_detail" => str_replace(array('{num_registered_online}','{num_invisible_online}','{num_guests_online}'), array($num_registered_online,$num_invisible_online,$num_guests_online), $lang['user_online_detail']),
  ));
  
//----------------------------- 
//---Most ever users online---- 
//----------------------------- 
  
$most explode("|"$config['most_users']); 
  
$most_total explode(","$most[0]); 
  
$most_registered explode(","$most[1]); 
  
$most_guests explode(","$most[2]); 
  
$update 0
  if (
$num_total_online $most_total[0]) 
  { 
    
$most_total[0] = $num_total_online
    
$most_total[1] = time(); 
    
$most[0] = $most_total[0].",".$most_total[1]; 
    
$update 1
  } 
  if (
$num_registered_online $most_registered[0]) 
  { 
    
$most_registered[0] = $num_registered_online
    
$most_registered[1] = time(); 
    
$most[1] = $most_registered[0].",".$most_registered[1]; 
    
$update 1
  } 
  if (
$num_guests_online $most_guests[0]) 
  { 
    
$most_guests[0] = $num_guests_online
    
$most_guests[1] = time(); 
    
$most[2] = $most_guests[0].",".$most_guests[1]; 
    
$update 1
  } 
  if (
$update) { 
    
$config['most_users'] = implode("|"$most); 
    
$sql "UPDATE ".SETTINGS_TABLE.
            SET setting_value = '"
.$config['most_users']."' 
            WHERE setting_name = 'most_users'"

    
$site_db->query($sql); 
  } 
  
$site_template->register_vars(array( 
    
"mueo" => $most_total[0], 
    
"mueo_date" => format_date($config['date_format'].", ".$config['time_format'], $most_total[1]), 
    
"mueo_registered" => $most_registered[0], 
    
"mueo_registered_date" => format_date($config['date_format'].", ".$config['time_format'], $most_registered[1]), 
    
"mueo_guests" => $most_guests[0], 
    
"mueo_guests_date" => format_date($config['date_format'].", ".$config['time_format'], $most_guests[1]), 
    
"lang_mueo" => $lang['mueo'], 
    
"lang_mueo_total" => $lang['mueo_total'], 
    
"lang_mueo_date" => $lang['mueo_date'], 
    
"lang_mueo_registered" => $lang['mueo_registered'], 
    
"lang_mueo_guests" => $lang['mueo_guests'], 
  )); 
//End Most Ever Online 
  
$whos_online $site_template->parse_template("whos_online");
  
$site_template->register_vars("whos_online"$whos_online);
  unset(
$whos_online);
  unset(
$prev_user_ids);
  unset(
$prev_session_ips);
}
//Mod_bmollet
/**
 * Get the category url
 * @param int $cat_id The id of the category
 * @param string $cat_url The current status of the URL
 */
function get_category_url($cat_id,$cat_url '')
{
global $site_db;
$sql "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result $site_db->query($sql);
$row $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "., &#233;&#232;&#234;&#224;&#235;&#226;&#250;&#243;&#237;&#236;&#225;&#224;ABCDEFGHIJKLMNOPQRSTUVWXYZ","---eeeaeauoiiaaabcdefghijklmnopqrstuvwxyz");
$cat_url  '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
 * Get the image url
 * @param int $image_id The id of the image
 */
function get_image_url($image_id)
{
global $site_db;
$sql "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result $site_db->query($sql);
$row $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "., &#233;&#232;&#234;&#224;&#235;&#226;&#250;&#243;&#237;&#236;&#225;&#224;ABCDEFGHIJKLMNOPQRSTUVWXYZ","---eeeaeauoiiaaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
?>

and my pageheader

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: page_header.php                                      *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) f&#252;r weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die(
"Security violation");
}

// Cache Templates
/*$template_list = 'header,footer,category_dropdown_form,user_logininfo,user_loginform';
if (isset($templates_used) && $templates_used != "") {
  $template_list = $template_list.",".$templates_used;
}
$site_template->cache_templates($template_list);*/

//-----------------------------------------------------
//--- Register Global Vars ----------------------------
//-----------------------------------------------------
$total_images 0;
$total_categories 0;
$auth_cat_sql['auth_viewcat']['IN'] = 0;
$auth_cat_sql['auth_viewcat']['NOTIN'] = 0;

$cache_id create_cache_id(
  
'data.auth_and_info',
  array(
$user_info[$user_table_fields['user_id']])
);

if (!
$data get_cache_file($cache_idnull)) {
  if (!empty(
$cat_cache)) {
    foreach (
$cat_cache as $key => $val) {
      if (
check_permission("auth_viewcat"$key)) {
        
$total_categories++;
        if (isset(
$val['num_images'])) {
          
$total_images += $val['num_images'];
        }
        else {
          
$cat_cache[$key]['num_images'] = 0;
        }
        
$auth_cat_sql['auth_viewcat']['IN'] .= ", ".$key;
      }
      else {
        
$auth_cat_sql['auth_viewcat']['NOTIN'] .= ", ".$key;
      }
    }
  }

  
$data = array();

  
$data['total_images'] = $total_images;
  
$data['total_categories'] = $total_categories;
  
$data['auth_viewcat']['IN'] = $auth_cat_sql['auth_viewcat']['IN'];
  
$data['auth_viewcat']['NOTIN'] = $auth_cat_sql['auth_viewcat']['NOTIN'];

  
save_cache_file($cache_idserialize($data));

} else {
  
$data unserialize($data);

  
$total_images $data['total_images'];
  
$total_categories $data['total_categories'];
  
$auth_cat_sql['auth_viewcat']['IN'] = $data['auth_viewcat']['IN'];
  
$auth_cat_sql['auth_viewcat']['NOTIN'] = $data['auth_viewcat']['NOTIN'];
}

// --- Start Mod: Ajax Starrating by KW ----------------------------------------

$rating_details $config['starrating_details'];
$rating_images $config['starrating_details_images'];
$rating_images_file $config['starrating_details_images_file'];
$rating_image_width $config['starrating_details_width'];
$rating_image_height $config['starrating_details_height'];
$rating_thumbs $config['starrating_thumbs'];
$thumbnails_rating_images $config['starrating_thumbs_images'];
$thumbnails_rating_images_file $config['starrating_thumbs_images_file'];
$thumbnails_rating_image_width $config['starrating_thumbs_width'];
$thumbnails_rating_image_height $config['starrating_thumbs_height'];
$imagepath TEMPLATE_PATH."/images";
$pixel "px";

$width_2 = @number_format($rating_image_width*2);
$width_3 = @number_format($rating_image_width*3);
$width_4 = @number_format($rating_image_width*4);
$width_5 = @number_format($rating_image_width*5);
$width_6 = @number_format($rating_image_width*6);
$width_7 = @number_format($rating_image_width*7);
$width_8 = @number_format($rating_image_width*8);
$width_9 = @number_format($rating_image_width*9);
$width_10 = @number_format($rating_image_width*10);

$thumbnails_width_2 = @number_format($thumbnails_rating_image_width*2);
$thumbnails_width_3 = @number_format($thumbnails_rating_image_width*3);
$thumbnails_width_4 = @number_format($thumbnails_rating_image_width*4);
$thumbnails_width_5 = @number_format($thumbnails_rating_image_width*5);
$thumbnails_width_6 = @number_format($thumbnails_rating_image_width*6);
$thumbnails_width_7 = @number_format($thumbnails_rating_image_width*7);
$thumbnails_width_8 = @number_format($thumbnails_rating_image_width*8);
$thumbnails_width_9 = @number_format($thumbnails_rating_image_width*9);
$thumbnails_width_10 = @number_format($thumbnails_rating_image_width*10);
// --- css starrating in details/ ecard ---
// --- active for members, static for guests ---
if ($rating_details == '4' && $user_info['user_level'] == GUEST) {
$css_starratings  "\n<style type=\"text/css\">\n.ratingblock { display:block; border-bottom:0px solid #999; padding-bottom:0px; margin-bottom:0px; }\n.container { background-color: #fff; width: 100%; border: 0px solid #ccc; padding: 5px; }\n.loading { height: $rating_image_height$pixel;}\n";
$css_starratings .= ".unit-rating {list-style:none; margin: 0px; padding:0px; height: $rating_image_height$pixel; position: relative; background: url('$imagepath/$rating_images_file') top left repeat-x; }\n.unit-rating li{ text-indent: -90000px; padding:0px; margin:0px; float: left;}\n.unit-rating li a:hover{ background: url('$imagepath/$rating_images_file') left center; z-index: 2; left: 0px;}\n.unit-rating li a { outline: none; display:block; width: $rating_image_width$pixel; height: $rating_image_height$pixel; text-decoration: none; text-indent: -9000px; z-index: 20; position: absolute; padding: 0px; }\n.unit-rating li.current-rating { background: url('$imagepath/$rating_images_file') left bottom; position: absolute; height: $rating_image_height$pixel; display: block; text-indent: -9000px; z-index: 1;}\n";
$css_starratings .= ".unit-rating a.r1-unit{left: 0px;}\n.unit-rating a.r1-unit:hover{width: $rating_image_width$pixel;}\n.unit-rating a.r2-unit{left: $rating_image_width$pixel;}\n.unit-rating a.r2-unit:hover{width: $width_2$pixel;}\n.unit-rating a.r3-unit{left: $width_2$pixel;}\n.unit-rating a.r3-unit:hover{width: $width_3$pixel;}\n.unit-rating a.r4-unit{left: $width_3$pixel;}\n.unit-rating a.r4-unit:hover{width: $width_4$pixel;}\n.unit-rating a.r5-unit{left: $width_4$pixel;}\n.unit-rating a.r5-unit:hover{width: $width_5$pixel;}\n.unit-rating a.r6-unit{left: $width_5$pixel;}\n.unit-rating a.r6-unit:hover{width: $width_6$pixel;}\n.unit-rating a.r7-unit{left: $width_6$pixel;}\n.unit-rating a.r7-unit:hover{width: $width_7$pixel;}\n.unit-rating a.r8-unit{left: $width_7$pixel;}\n.unit-rating a.r8-unit:hover{width: $width_8$pixel;}\n.unit-rating a.r9-unit{left: $width_8$pixel;}\n.unit-rating a.r9-unit:hover{width: $width_9$pixel;}\n.unit-rating a.r10-unit{left: $width_9$pixel;}\n.unit-rating a.r10-unit:hover{width: $width_10$pixel;}\n";
} elseif (
$rating_details == '4' && $user_info['user_level'] >= USER)  {
$css_starratings  "\n<style type=\"text/css\">\n.ratingblock { display:block; border-bottom:0px solid #999; padding-bottom:0px; margin-bottom:0px; }\n.container { background-color: #fff; width: 100%; border: 0px solid #ccc; padding: 5px; }\n.loading { height: $rating_image_height$pixel;}\n";
$css_starratings .= ".unit-rating {list-style:none; margin: 0px; padding:0px; height: $rating_image_height$pixel; position: relative; background: url('$imagepath/$rating_images_file') top left repeat-x; }\n.unit-rating li{ text-indent: -90000px; padding:0px; margin:0px; float: left;}\n.unit-rating li a:hover{ background: url('$imagepath/$rating_images_file') left center; z-index: 2; left: 0px;}\n.unit-rating li a { outline: none; display:block; width: $rating_image_width$pixel; height: $rating_image_height$pixel; text-decoration: none; text-indent: -9000px; z-index: 20; position: absolute; padding: 0px; }\n.unit-rating li.current-rating { background: url('$imagepath/$rating_images_file') left bottom; position: absolute; height: $rating_image_width$pixel; display: block; text-indent: -9000px; z-index: 1;}\n";
$css_starratings .= ".unit-rating a.r1-unit{left: 0px;}\n.unit-rating a.r1-unit:hover{width: $rating_image_width$pixel;}\n.unit-rating a.r2-unit{left: $rating_image_width$pixel;}\n.unit-rating a.r2-unit:hover{width: $width_2$pixel;}\n.unit-rating a.r3-unit{left: $width_2$pixel;}\n.unit-rating a.r3-unit:hover{width: $width_3$pixel;}\n.unit-rating a.r4-unit{left: $width_3$pixel;}\n.unit-rating a.r4-unit:hover{width: $width_4$pixel;}\n.unit-rating a.r5-unit{left: $width_4$pixel;}\n.unit-rating a.r5-unit:hover{width: $width_5$pixel;}\n.unit-rating a.r6-unit{left: $width_5$pixel;}\n.unit-rating a.r6-unit:hover{width: $width_6$pixel;}\n.unit-rating a.r7-unit{left: $width_6$pixel;}\n.unit-rating a.r7-unit:hover{width: $width_7$pixel;}\n.unit-rating a.r8-unit{left: $width_7$pixel;}\n.unit-rating a.r8-unit:hover{width: $width_8$pixel;}\n.unit-rating a.r9-unit{left: $width_8$pixel;}\n.unit-rating a.r9-unit:hover{width: $width_9$pixel;}\n.unit-rating a.r10-unit{left: $width_9$pixel;}\n.unit-rating a.r10-unit:hover{width: $width_10$pixel;}\n";
}
// --- active for members and guests ---
elseif ($rating_details == '5') {
$css_starratings  "\n<style type=\"text/css\">\n.ratingblock { display:block; border-bottom:0px solid #999; padding-bottom:0px; margin-bottom:0px; }\n.container { background-color: #fff; width: 100%; border: 0px solid #ccc; padding: 5px; }\n.loading { height: $rating_image_height$pixel;}\n";
$css_starratings .= ".unit-rating {list-style:none; margin: 0px; padding:0px; height: $rating_image_height$pixel; position: relative; background: url('$imagepath/$rating_images_file') top left repeat-x; }\n.unit-rating li{ text-indent: -90000px; padding:0px; margin:0px; float: left;}\n.unit-rating li a:hover{ background: url('$imagepath/$rating_images_file') left center; z-index: 2; left: 0px;}\n.unit-rating li a { outline: none; display:block; width: $rating_image_width$pixel; height: $rating_image_height$pixel; text-decoration: none; text-indent: -9000px; z-index: 20; position: absolute; padding: 0px; }\n.unit-rating li.current-rating { background: url('$imagepath/$rating_images_file') left bottom; position: absolute; height: $rating_image_height$pixel; display: block; text-indent: -9000px; z-index: 1;}\n";
$css_starratings .= ".unit-rating a.r1-unit{left: 0px;}\n.unit-rating a.r1-unit:hover{width: $rating_image_width$pixel;}\n.unit-rating a.r2-unit{left: $rating_image_width$pixel;}\n.unit-rating a.r2-unit:hover{width: $width_2$pixel;}\n.unit-rating a.r3-unit{left: $width_2$pixel;}\n.unit-rating a.r3-unit:hover{width: $width_3$pixel;}\n.unit-rating a.r4-unit{left: $width_3$pixel;}\n.unit-rating a.r4-unit:hover{width: $width_4$pixel;}\n.unit-rating a.r5-unit{left: $width_4$pixel;}\n.unit-rating a.r5-unit:hover{width: $width_5$pixel;}\n.unit-rating a.r6-unit{left: $width_5$pixel;}\n.unit-rating a.r6-unit:hover{width: $width_6$pixel;}\n.unit-rating a.r7-unit{left: $width_6$pixel;}\n.unit-rating a.r7-unit:hover{width: $width_7$pixel;}\n.unit-rating a.r8-unit{left: $width_7$pixel;}\n.unit-rating a.r8-unit:hover{width: $width_8$pixel;}\n.unit-rating a.r9-unit{left: $width_8$pixel;}\n.unit-rating a.r9-unit:hover{width: $width_9$pixel;}\n.unit-rating a.r10-unit{left: $width_9$pixel;}\n.unit-rating a.r10-unit:hover{width: $width_10$pixel;}\n";
} else {
$css_starratings "\n";
}
if (
$rating_details == '6' && $rating_thumbs >= '0')  {
$css_starratings  "\n<style type=\"text/css\">\n.ratingblock { display:block; border-bottom:0px solid #999; padding-bottom:0px; margin-bottom:0px; }\n.container { background-color: #fff; width: 100%; border: 0px solid #ccc; padding: 5px; }\n.loading { height: $thumbnails_rating_image_height$pixel;}\n";
}
// --- css starrating in all thumbnails ---
// --- static for all ---
$thumb_starrating_view 1;
if (
$rating_thumbs == '1') {
$css_starratings .= ".unit-rating-thumbnails {list-style:none; margin: 0px; padding:0px; height: $thumbnails_rating_image_height$pixel; position: relative; background: url('$imagepath/$thumbnails_rating_images_file') top left repeat-x; }\n.unit-rating-thumbnails li{ text-indent: -90000px; padding:0px; margin:0px; float: left;}\n.unit-rating-thumbnails li a:hover{ background: url('$imagepath/$thumbnails_rating_images_file') left center; z-index: 2; left: 0px;}\n.unit-rating-thumbnails li a { outline: none; display:block; width: $thumbnails_rating_image_width$pixel; height: $thumbnails_rating_image_height$pixel; text-decoration: none; text-indent: -9000px; z-index: 20; position: absolute; padding: 0px; }\n.unit-rating-thumbnails li.current-rating-thumbnails { background: url('$imagepath/$thumbnails_rating_images_file') left bottom; position: absolute; height: $thumbnails_rating_image_height$pixel; display: block; text-indent: -9000px; z-index: 1;}\n";
$css_starratings .= ".unit-rating-thumbnails a.r1-unit-thumbnails{left: 0px;}\n.unit-rating-thumbnails a.r1-unit-thumbnails:hover{width: $thumbnails_rating_image_width$pixel;}\n.unit-rating-thumbnails a.r2-unit-thumbnails{left: $thumbnails_rating_image_width$pixel;}\n.unit-rating-thumbnails a.r2-unit-thumbnails:hover{width: $thumbnails_width_2$pixel;}\n.unit-rating-thumbnails a.r3-unit-thumbnails{left: $thumbnails_width_2$pixel;}\n.unit-rating-thumbnails a.r3-unit-thumbnails:hover{width: $thumbnails_width_3$pixel;}\n.unit-rating-thumbnails a.r4-unit-thumbnails{left: $thumbnails_width_3$pixel;}\n.unit-rating-thumbnails a.r4-unit-thumbnails:hover{width: $thumbnails_width_4$pixel;}\n.unit-rating-thumbnails a.r5-unit-thumbnails{left: $thumbnails_width_4$pixel;}\n.unit-rating-thumbnails a.r5-unit-thumbnails:hover{width: $thumbnails_width_5$pixel;}\n.unit-rating-thumbnails a.r6-unit-thumbnails{left: $thumbnails_width_5$pixel;}\n.unit-rating-thumbnails a.r6-unit-thumbnails:hover{width: $thumbnails_width_6$pixel;}\n.unit-rating-thumbnails a.r7-unit-thumbnails{left: $thumbnails_width_6$pixel;}\n.unit-rating-thumbnails a.r7-unit-thumbnails:hover{width: $thumbnails_width_7$pixel;}\n.unit-rating-thumbnails a.r8-unit-thumbnails{left: $thumbnails_width_7$pixel;}\n.unit-rating-thumbnails a.r8-unit-thumbnails:hover{width: $thumbnails_width_8$pixel;}\n.unit-rating-thumbnails a.r9-unit-thumbnails{left: $thumbnails_width_8$pixel;}\n.unit-rating-thumbnails a.r9-unit-thumbnails:hover{width: $thumbnails_width_9$pixel;}\n.unit-rating-thumbnails a.r10-unit-thumbnails{left: $thumbnails_width_9$pixel;}\n.unit-rating-thumbnails a.r10-unit-thumbnails:hover{width: $thumbnails_width_10$pixel;}\n";
}
// --- active for members, static for guests ---
elseif ($rating_thumbs == '2' && $user_info['user_level'] == GUEST)  {
$css_starratings .= ".unit-rating-thumbnails {list-style:none; margin: 0px; padding:0px; height: $thumbnails_rating_image_height$pixel; position: relative; background: url('$imagepath/$thumbnails_rating_images_file') top left repeat-x; }\n.unit-rating-thumbnails li{ text-indent: -90000px; padding:0px; margin:0px; float: left;}\n.unit-rating-thumbnails li a:hover{ background: url('$imagepath/$thumbnails_rating_images_file') left center; z-index: 2; left: 0px;}\n.unit-rating-thumbnails li a { outline: none; display:block; width: $thumbnails_rating_image_width$pixel; height: $thumbnails_rating_image_height$pixel; text-decoration: none; text-indent: -9000px; z-index: 20; position: absolute; padding: 0px; }\n.unit-rating-thumbnails li.current-rating-thumbnails { background: url('$imagepath/$thumbnails_rating_images_file') left bottom; position: absolute; height: $thumbnails_rating_image_height$pixel; display: block; text-indent: -9000px; z-index: 1;}\n";
$css_starratings .= ".unit-rating-thumbnails a.r1-unit-thumbnails{left: 0px;}\n.unit-rating-thumbnails a.r1-unit-thumbnails:hover{width: $thumbnails_rating_image_width$pixel;}\n.unit-rating-thumbnails a.r2-unit-thumbnails{left: $thumbnails_rating_image_width$pixel;}\n.unit-rating-thumbnails a.r2-unit-thumbnails:hover{width: $thumbnails_width_2$pixel;}\n.unit-rating-thumbnails a.r3-unit-thumbnails{left: $thumbnails_width_2$pixel;}\n.unit-rating-thumbnails a.r3-unit-thumbnails:hover{width: $thumbnails_width_3$pixel;}\n.unit-rating-thumbnails a.r4-unit-thumbnails{left: $thumbnails_width_3$pixel;}\n.unit-rating-thumbnails a.r4-unit-thumbnails:hover{width: $thumbnails_width_4$pixel;}\n.unit-rating-thumbnails a.r5-unit-thumbnails{left: $thumbnails_width_4$pixel;}\n.unit-rating-thumbnails a.r5-unit-thumbnails:hover{width: $thumbnails_width_5$pixel;}\n.unit-rating-thumbnails a.r6-unit-thumbnails{left: $thumbnails_width_5$pixel;}\n.unit-rating-thumbnails a.r6-unit-thumbnails:hover{width: $thumbnails_width_6$pixel;}\n.unit-rating-thumbnails a.r7-unit-thumbnails{left: $thumbnails_width_6$pixel;}\n.unit-rating-thumbnails a.r7-unit-thumbnails:hover{width: $thumbnails_width_7$pixel;}\n.unit-rating-thumbnails a.r8-unit-thumbnails{left: $thumbnails_width_7$pixel;}\n.unit-rating-thumbnails a.r8-unit-thumbnails:hover{width: $thumbnails_width_8$pixel;}\n.unit-rating-thumbnails a.r9-unit-thumbnails{left: $thumbnails_width_8$pixel;}\n.unit-rating-thumbnails a.r9-unit-thumbnails:hover{width: $thumbnails_width_9$pixel;}\n.unit-rating-thumbnails a.r10-unit-thumbnails{left: $thumbnails_width_9$pixel;}\n.unit-rating-thumbnails a.r10-unit-thumbnails:hover{width: $thumbnails_width_10$pixel;}\n";
} elseif (
$rating_thumbs == '2' && $user_info['user_level'] >= USER)  {
$css_starratings .= ".unit-rating-thumbnails {list-style:none; margin: 0px; padding:0px; height: $thumbnails_rating_image_height$pixel; position: relative; background: url('$imagepath/$thumbnails_rating_images_file') top left repeat-x; }\n.unit-rating-thumbnails li{ text-indent: -90000px; padding:0px; margin:0px; float: left;}\n.unit-rating-thumbnails li a:hover{ background: url('$imagepath/$thumbnails_rating_images_file') left center; z-index: 2; left: 0px;}\n.unit-rating-thumbnails li a { outline: none; display:block; width: $thumbnails_rating_image_width$pixel; height: $thumbnails_rating_image_height$pixel; text-decoration: none; text-indent: -9000px; z-index: 20; position: absolute; padding: 0px; }\n.unit-rating-thumbnails li.current-rating-thumbnails { background: url('$imagepath/$thumbnails_rating_images_file') left bottom; position: absolute; height: $thumbnails_rating_image_height$pixel; display: block; text-indent: -9000px; z-index: 1;}\n";
$css_starratings .= ".unit-rating-thumbnails a.r1-unit-thumbnails{left: 0px;}\n.unit-rating-thumbnails a.r1-unit-thumbnails:hover{width: $thumbnails_rating_image_width$pixel;}\n.unit-rating-thumbnails a.r2-unit-thumbnails{left: $thumbnails_rating_image_width$pixel;}\n.unit-rating-thumbnails a.r2-unit-thumbnails:hover{width: $thumbnails_width_2$pixel;}\n.unit-rating-thumbnails a.r3-unit-thumbnails{left: $thumbnails_width_2$pixel;}\n.unit-rating-thumbnails a.r3-unit-thumbnails:hover{width: $thumbnails_width_3$pixel;}\n.unit-rating-thumbnails a.r4-unit-thumbnails{left: $thumbnails_width_3$pixel;}\n.unit-rating-thumbnails a.r4-unit-thumbnails:hover{width: $thumbnails_width_4$pixel;}\n.unit-rating-thumbnails a.r5-unit-thumbnails{left: $thumbnails_width_4$pixel;}\n.unit-rating-thumbnails a.r5-unit-thumbnails:hover{width: $thumbnails_width_5$pixel;}\n.unit-rating-thumbnails a.r6-unit-thumbnails{left: $thumbnails_width_5$pixel;}\n.unit-rating-thumbnails a.r6-unit-thumbnails:hover{width: $thumbnails_width_6$pixel;}\n.unit-rating-thumbnails a.r7-unit-thumbnails{left: $thumbnails_width_6$pixel;}\n.unit-rating-thumbnails a.r7-unit-thumbnails:hover{width: $thumbnails_width_7$pixel;}\n.unit-rating-thumbnails a.r8-unit-thumbnails{left: $thumbnails_width_7$pixel;}\n.unit-rating-thumbnails a.r8-unit-thumbnails:hover{width: $thumbnails_width_8$pixel;}\n.unit-rating-thumbnails a.r9-unit-thumbnails{left: $thumbnails_width_8$pixel;}\n.unit-rating-thumbnails a.r9-unit-thumbnails:hover{width: $thumbnails_width_9$pixel;}\n.unit-rating-thumbnails a.r10-unit-thumbnails{left: $thumbnails_width_9$pixel;}\n.unit-rating-thumbnails a.r10-unit-thumbnails:hover{width: $thumbnails_width_10$pixel;}\n";
}
// --- active for members and guests ---
elseif ($rating_thumbs == '3') {
$css_starratings .= ".unit-rating-thumbnails {list-style:none; margin: 0px; padding:0px; height: $thumbnails_rating_image_height$pixel; position: relative; background: url('$imagepath/$thumbnails_rating_images_file') top left repeat-x; }\n.unit-rating-thumbnails li{ text-indent: -90000px; padding:0px; margin:0px; float: left;}\n.unit-rating-thumbnails li a:hover{ background: url('$imagepath/$thumbnails_rating_images_file') left center; z-index: 2; left: 0px;}\n.unit-rating-thumbnails li a { outline: none; display:block; width: $thumbnails_rating_image_width$pixel; height: $thumbnails_rating_image_height$pixel; text-decoration: none; text-indent: -9000px; z-index: 20; position: absolute; padding: 0px; }\n.unit-rating-thumbnails li.current-rating-thumbnails { background: url('$imagepath/$thumbnails_rating_images_file') left bottom; position: absolute; height: $thumbnails_rating_image_height$pixel; display: block; text-indent: -9000px; z-index: 1;}\n";
$css_starratings .= ".unit-rating-thumbnails a.r1-unit-thumbnails{left: 0px;}\n.unit-rating-thumbnails a.r1-unit-thumbnails:hover{width: $thumbnails_rating_image_width$pixel;}\n.unit-rating-thumbnails a.r2-unit-thumbnails{left: $thumbnails_rating_image_width$pixel;}\n.unit-rating-thumbnails a.r2-unit-thumbnails:hover{width: $thumbnails_width_2$pixel;}\n.unit-rating-thumbnails a.r3-unit-thumbnails{left: $thumbnails_width_2$pixel;}\n.unit-rating-thumbnails a.r3-unit-thumbnails:hover{width: $thumbnails_width_3$pixel;}\n.unit-rating-thumbnails a.r4-unit-thumbnails{left: $thumbnails_width_3$pixel;}\n.unit-rating-thumbnails a.r4-unit-thumbnails:hover{width: $thumbnails_width_4$pixel;}\n.unit-rating-thumbnails a.r5-unit-thumbnails{left: $thumbnails_width_4$pixel;}\n.unit-rating-thumbnails a.r5-unit-thumbnails:hover{width: $thumbnails_width_5$pixel;}\n.unit-rating-thumbnails a.r6-unit-thumbnails{left: $thumbnails_width_5$pixel;}\n.unit-rating-thumbnails a.r6-unit-thumbnails:hover{width: $thumbnails_width_6$pixel;}\n.unit-rating-thumbnails a.r7-unit-thumbnails{left: $thumbnails_width_6$pixel;}\n.unit-rating-thumbnails a.r7-unit-thumbnails:hover{width: $thumbnails_width_7$pixel;}\n.unit-rating-thumbnails a.r8-unit-thumbnails{left: $thumbnails_width_7$pixel;}\n.unit-rating-thumbnails a.r8-unit-thumbnails:hover{width: $thumbnails_width_8$pixel;}\n.unit-rating-thumbnails a.r9-unit-thumbnails{left: $thumbnails_width_8$pixel;}\n.unit-rating-thumbnails a.r9-unit-thumbnails:hover{width: $thumbnails_width_9$pixel;}\n.unit-rating-thumbnails a.r10-unit-thumbnails{left: $thumbnails_width_9$pixel;}\n.unit-rating-thumbnails a.r10-unit-thumbnails:hover{width: $thumbnails_width_10$pixel;}\n";
} else {
$thumb_starrating_view 0;
$css_starratings .= "\n";
}
$css_starratings .= "</style>\n";
// --- End Mod: Ajax Starrating by KW ------------------------------------------
$query_string '';
if (!empty(
$HTTP_GET_VARS)) {
  foreach (
$HTTP_GET_VARS as $key => $val) {
    if (
$key != "l") {
      
$query_string .= ($query_string != '' '&' '?').$key."=".$val;
    }
  }
}
$lang_url $site_sess->url($PHP_SELF.$query_string'&');
$lang_url preg_replace("'&(amp|#38);'i""&"$lang_url);
$lang_url preg_replace("/[?|&]l=[^?|&]*/"""$lang_url);
$lang_url str_replace("&""&amp;"$lang_url);
$handle opendir(ROOT_PATH."lang");
$lang_select "";
while (
$folder = @readdir($handle)) {
  if (@
is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {
    if (
$folder != $config['language_dir']) {
      
$lang_select .= "<a class=\"lang\" href=\"".$lang_url.(preg_match("/\?/"$lang_url) ? "&" "?")."l=".$folder."\" onMouseOver=\"(window.status='$folder'); return true\" onMouseOut=\"window.status=''; return true\"><img src=\"".TEMPLATE_PATH."/images/".$folder.".gif\" border=\"0\" alt=\"".$folder."\"></a>&nbsp;";
    }else{
    
$lang_select .= "<img src=\"".TEMPLATE_PATH."/images/".$folder."2.gif\" border=\"0\" alt=\"".$folder."\">&nbsp;";
    }
  }
}
// Register the dropdown code for the template engine 
$site_template->register_vars("lang_select"$lang_select);
$site_template->register_vars(array(
// --- Start Mod: Ajax Starrating by KW ----------------------------------------
  
"css_starratings" => $css_starratings,
  
"rating_details" => $rating_details,
  
"thumb_starrating_view" => $thumb_starrating_view,
// --- End Mod: Ajax Starrating by KW ------------------------------------------
  
"media_url" => MEDIA_PATH,
  
"url_sitemap" => $site_sess->url(ROOT_PATH."sitemap.php"),
  
"lang_sitemap" => $lang['sitemap'],
  
"thumb_url" => THUMB_PATH,
  
"icon_url" => ICON_PATH,
  
"template_url" => TEMPLATE_PATH,
  
"template_image_url" => TEMPLATE_PATH."/images",
  
"template_lang_image_url" => TEMPLATE_PATH."/images_".$config['language_dir'],
  
"site_name" => $config['site_name'],
  
"current_user_id" => $user_info['user_id'], 
  
"current_user_name" => ($user_info['user_level'] == GUEST) ? $lang['userlevel_guest'] : addslashes($user_info['user_name']),
  
"site_email" => $config['site_email'],
  
"user_loggedin" => ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) ? 1,
  
"user_loggedout" => ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) ? 0,
  
"is_admin" => ($user_info['user_level'] == ADMIN) ? 0,
  
"self" => $site_sess->url($self_url),
  
"self_full" => $site_sess->url($script_url."/".$self_url),
  
"script_version" => SCRIPT_VERSION,
  
"cp_link" => ($user_info['user_level'] != ADMIN) ? "" "\n<p align=\"center\">[<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php")."\">Admin Control Panel</a>]</p>\n",
  
"total_categories" => $total_categories,
  
"total_images" => $total_images,
  
"url_new_images" => $site_sess->url(ROOT_PATH."search.php?search_new_images=1"),
  
"url_top_images" => $site_sess->url(ROOT_PATH."top.php"),
  
"url_top_cat_images" => $site_sess->url(ROOT_PATH."top.php".(($cat_id && preg_match("/categories.php/"$self_url)) ? "?".URL_CAT_ID."=".$cat_id "")),
  
"url_register" => (!empty($url_register)) ? $site_sess->url($url_register) : $site_sess->url(ROOT_PATH."register.php"),
  
"url_search" => $site_sess->url(ROOT_PATH."search.php"),
  
//--- Start Mod: Flash-Tag-Clouds by KW ---------------
  
"flash_keyword_clouds" => get_flash_keyword_clouds(),
//--- End Mod: Flash-Tag-Clouds by KW -----------------
  
"url_lightbox" => $site_sess->url(ROOT_PATH."lightbox.php"),
  
"url_shout" => $site_sess->url(ROOT_PATH.'includes/shout.php'),
  
"url_control_panel" => (!empty($url_control_panel)) ? $site_sess->url($url_control_panel) : $site_sess->url(ROOT_PATH."member.php?action=editprofile"),
  
"url_categories" => $site_sess->url(ROOT_PATH."categories.php"),
  
"url_guestbook" => (!empty($url_guestbook)) ? $site_sess->url($url_guestbook) : $site_sess->url(ROOT_PATH."guestbook.php"),
   
"url_home" => $site_sess->url(ROOT_PATH."index.php"),
  
"url_keyword_cloud" => $site_sess->url(ROOT_PATH."keyword_cloud.php"),
"lang_200_keyword_cloud" => $lang['200_keyword_cloud'],
  
"url_login" => (!empty($url_login)) ? $site_sess->url($url_login) : $site_sess->url(ROOT_PATH."login.php"),
  
"url_logout" => (!empty($url_logout)) ? $site_sess->url($url_logout) : $site_sess->url(ROOT_PATH."logout.php"),
  
"url_member" => (!empty($url_member)) ? $site_sess->url($url_member) : $site_sess->url(ROOT_PATH."member.php"),
  
"url_upload" => (!empty($url_upload)) ? $site_sess->url($url_upload) : $site_sess->url(ROOT_PATH."member.php?action=uploadform"),
  
"url_lost_password" => (!empty($url_lost_password)) ? $site_sess->url($url_lost_password) : $site_sess->url(ROOT_PATH."member.php?action=lostpassword"),
  
"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),
  
"recaptcha" => ($captcha_recaptcha) ? recaptcha_image() : "",
  
"recaptcha_public" => @$captcha_recaptcha[0],
  
"recaptcha_private" => @$captcha_recaptcha[1],
  
//--- Start mod: Ajax Slideshow/Diashow with piclens ---------------------------
  
"slideshow_rss" => "",
  
"ajax_slideshow_piclens_button" => "",
//--- End mod: Ajax Slideshow/Diashow with piclens -----------------------------
  
"thumbnails" => "",
  
"paging" => "",
  
"paging_stats" => "",
  
"has_rss" => false,
  
"rss_title" => "",
  
"rss_url" => "",
  
"copyright" => '
<p id="copyright" align="center">
  Powered by <b>4images</b> '
.SCRIPT_VERSION.'
  <br >
  Copyright &copy; 2002-'
.date('Y').' <a href="http://www.4homepages.de" target="_blank">4homepages.de</a>
</p>
'
,
"login_user_name_form_field" => (!empty($login_user_name_form_field)) ? $login_user_name_form_field 'user_name',
"login_user_password_form_field" => (!empty($login_user_password_form_field)) ? $login_user_password_form_field 'user_password',
"login_auto_form_field" => (!empty($login_auto_form_field)) ? $login_auto_form_field 'auto_login',
"login_additional_form_fields" => (!empty($login_additional_form_fields)) ? $login_additional_form_fields '',
));

if (!empty(
$additional_urls)) {
  
$register_array = array();
  foreach (
$additional_urls as $key => $val) {
    
$register_array[$key] = $site_sess->url($val);
  }
  
$site_template->register_vars($register_array);
}

// Replace Globals in $lang
$lang $site_template->parse_array($lang);
//----------------------------------------------------------
//------ Start Mod: More Random Images with slideshow ------
//----------------------------------------------------------
if ($config['random_images_slide_show'] == "1") {
$language_used null;
if (isset(
$HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
$language_used "&l=".$l."";
}
$random_images_slide_view 1;
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.""user_name")."
       FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
       LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
       WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id IN ("
.get_auth_cat_sql("auth_viewcat").")
       ORDER BY RAND()
       LIMIT "
.$config['random_images_slide_how_many']."";

$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);
$max_length_image_name_thumb_slide 15;               // L&#228;nge des Imagenamen
$allow = array("jpg","jpeg","JPG","JPEG","png","gif"); // Dateitypen, die im Slide gezeigt werden sollen

if (!$num_rows)  {
 
$random_images_slide $lang['no_new_images'];
}
else  {
 
$count 0;
 while (
$image_row $site_db->fetch_array($result)){
 if (
$count == 0) {
 
$random_images_slide  "\n";
 
$random_images_slide .= "<script src=\"".TEMPLATE_PATH."/random_images_slide.js\" type=\"text/javascript\"> \n";
 
$random_images_slide .= "/************************************************************************************\n";
 
$random_images_slide .= "* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full original source code *\n";
 
$random_images_slide .= "* Mod powered by KW - http://4images.malediven-bilder.de                            *\n";
 
$random_images_slide .= "*************************************************************************************/\n";
 
$random_images_slide .= "</script> \n\n";
 
$random_images_slide .= "<script type=\"text/javascript\"> \n";
 
$random_images_slide .= "var previmg='".TEMPLATE_PATH."/images/left.gif'; \n";
 
$random_images_slide .= "var stopimg='".TEMPLATE_PATH."/images/stop.gif'; \n";
 
$random_images_slide .= "var playimg='".TEMPLATE_PATH."/images/play.gif'; \n";
 
$random_images_slide .= "var nextimg='".TEMPLATE_PATH."/images/right.gif';\n\n";
 
$random_images_slide .= "var slides=[]; // SLIDESHOW \n";
 }
 
$ext get_file_extension($image_row['image_media_file']);
 if (
in_array($ext,$allow)) {
 
show_image($image_row);
 
$image_name_short_slide = (isset($image_row['image_name']) && strlen($image_row['image_name']) > $max_length_image_name_thumb_slide) ? substr(format_text(stripslashes($image_row['image_name']), 2), 0$max_length_image_name_thumb_slide)." " format_text(stripslashes($image_row['image_name']), 2);
 
$random_images_slide .= "slides[$count] = [\"".THUMB_DIR."/".$image_row['cat_id']."/".$image_row['image_thumb_file']."\", \"".$image_name_short_slide."<br >(".$image_row['user_name'].")\", \"details.php?image_id=".$image_row['image_id']."".$language_used."\", \"".$config['random_images_slide_target']."\", \"\", \"".$image_name_short_slide."&#38;#xA;".$image_row['user_name']."\"];\n";
 
$count++;
 }
 }
 
$random_images_slide .= "\n\n";
 
$random_images_slide .= "slides.width=".$config['random_images_slide_width']."; \n";
 
$random_images_slide .= "slides.height=".$config['random_images_slide_height']."; \n";
 
$random_images_slide .= "slides.no_controls=".$config['random_images_slide_controls']."; \n";
 
$random_images_slide .= "slides.image_controls=".$config['random_images_slide_imagecontrols']."; \n";
 
$random_images_slide .= "slides.controls_top=".$config['random_images_slide_controlpos']."; \n";
 
$random_images_slide .= "slides.delay=".$config['random_images_slide_duration']."; \n";
 
$random_images_slide .= "slides.pause=".$config['random_images_slide_stop']."; \n";
 
$random_images_slide .= "slides.random=0;\n";
 if (
$config['random_images_slide_name'] != '' && $config['random_images_slide_imagename_view'] == '0') {
 
$random_images_slide .= "slides.desc_prefix='".$config['random_images_slide_name']." '; \n";
 }
 
$random_images_slide .= "slides.no_descriptions=".$config['random_images_slide_imagename_view']."; \n";
 
$random_images_slide .= "slides.use_title=1;\n";
 
$random_images_slide .= "slides.nofade=".$config['random_images_slide_fading']."; \n";
 
$random_images_slide .= "slides.fadecolor='".$config['random_images_slide_fadecolor']."'; \n";
 
$random_images_slide .= "slides.border=0;\n";
 
$random_images_slide .= "slides.border_color='#000000'; \n";
 if (
$config['random_images_slide_target'] == 'thumbnail_openwindow') {
 
$random_images_slide .= "slides.onclick=\"window.open(this.href,this.target,'".$config['random_images_slide_target_popup']."');return false;\" \n";
 }
 
$random_images_slide .= "</script>\n";
 }
 
$random_images_slide .= "\n";
 
$random_images_slide .= "<table border=\"0\" width=\"100%\">\n<tr>\n<td width=\"100%\" align=\"center\">\n";
 
$random_images_slide .= "<script type=\"text/javascript\"> \n";
 
$random_images_slide .= "new inter_slide(slides) \n";
 
$random_images_slide .= "</script> \n";
 
$random_images_slide .= "</td>\n</tr>\n</table>\n";
 
$random_images_slide .= "\n";

$site_template->register_vars("random_images_slide"$random_images_slide);
unset(
$random_images_slide);
}
else {
$random_images_slide "";
$site_template->register_vars("random_images_slide"$random_images_slide);
unset(
$random_images_slide);
}
//----------------------------------------------------------
//------ End Mod: More Random Images with slideshow ------
//----------------------------------------------------------

$site_template->register_vars(array(
  
"lang_site_stats" => $lang['site_stats'],
  
"lang_registered_user" => $lang['registered_user'],
  
"lang_random_image" => $lang['random_image'],
  
"lang_categories" => $lang['categories'],
  
"lang_sub_categories" => $lang['sub_categories'],
  
"lang_new_images" => $lang['new_images'],
  
"lang_top_images" => $lang['top_images'],
  
"lang_search" => $lang['search'],
  
"lang_advanced_search" => $lang['advanced_search'],
  
"lang_lightbox" => $lang['lightbox'],
  
"lang_register" => $lang['register'],
  
"lang_control_panel" => $lang['control_panel'],
  
"lang_login" => $lang['login'],
  
"lang_auto_login" => $lang['lang_auto_login'],
  
"lang_logout" => $lang['logout'],
  
"lang_lost_password" => $lang['lost_password'],
  
"lang_user_name" => $lang['user_name'],
  
"lang_password" => $lang['password'],
  
"lang_go" => $lang['go'],
  
"lang_images_per_page" => $lang['images_per_page'],
  
"charset" => $lang['charset'],
  
"direction" => $lang['direction']
));

//-----------------------------------------------------
//--- Category Dropdown -------------------------------
//-----------------------------------------------------

if (!$cache_enable) {
    
$category_dropdown_selfjump get_category_dropdown($cat_id1);
} else {
  
$cache_id create_cache_id(
    
'data.dropdown_selfjump',
    array(
      
$user_info[$user_table_fields['user_id']],
      
$config['template_dir'],
      
$config['language_dir']
    )
  );

  if (!
$category_dropdown_selfjump get_cache_file($cache_id)) {
    
// Always append session id if cache is enabled
    
$old_session_mode $site_sess->mode;
    
$site_sess->mode 'get';

    
// Set $cat_id to 0 to ensure that no category is selected
    
$category_dropdown_selfjump get_category_dropdown(01);

    
$site_sess->mode $old_session_mode;

    
save_cache_file($cache_id$category_dropdown_selfjump);
  }
}

$site_template->register_vars("category_dropdown_selfjump"$category_dropdown_selfjump);
unset(
$category_dropdown_selfjump);

// -------------------------------------
if (!$cache_enable) {
    
$category_dropdown_form $site_template->parse_template("category_dropdown_form");
} else {
  
$cache_id create_cache_id(
    
'data.dropdown_form',
    array(
      
$user_info[$user_table_fields['user_id']],
      
// $cat_id, // uncomment if the current category should be selected, will increase the number of cache files
      
$config['template_dir'],
      
$config['language_dir']
    )
  );

  if (!
$category_dropdown_form get_cache_file($cache_id)) {
    
// Always append session id if cache is enabled
    
$old_session_mode $site_sess->mode;
    
$site_sess->mode 'get';

    
$category_dropdown_form $site_template->parse_template("category_dropdown_form");

    
$site_sess->mode $old_session_mode;

    
save_cache_file($cache_id$category_dropdown_form);
  }
}

$site_template->register_vars("category_dropdown_form"$category_dropdown_form);
unset(
$category_dropdown_form);

//-----------------------------------------------------
//--- Random Image ------------------------------------
//-----------------------------------------------------
$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" get_random_image();
$site_template->register_vars("random_image"$random_image);
unset(
$random_image);

//-----------------------------------------------------
//--- Set Paging Vars ---------------------------------
//-----------------------------------------------------
if (isset($HTTP_POST_VARS['setperpage'])) {
  
$setperpage intval($HTTP_POST_VARS['setperpage']);
  if (
$setperpage) {
    
$site_sess->set_session_var("perpage"$setperpage);
    
$session_info['perpage'] = $setperpage;
  }
}

if (isset(
$session_info['perpage'])) {
  
$perpage $session_info['perpage'];
}
else {
  
$perpage ceil($config['default_image_rows'] * $config['image_cells']);
}

//-----------------------------------------------------
//--- Set Perpage Dropdown ----------------------------
//-----------------------------------------------------
$setperpage_dropdown "\n<select onchange=\"if (this.options[this.selectedIndex].value != 0 && typeof forms['perpagebox'] != 'undefined'){ forms['perpagebox'].submit() }\" name=\"setperpage\" class=\"setperpageselect\">\n";
for(
$i 1$i <= $config['custom_row_steps']; $i++) {
  
$setvalue $config['image_cells'] * $i;
  
$setperpage_dropdown .= "<option value=\"".$setvalue."\"";
    if (
$setvalue == $perpage) {
    
$setperpage_dropdown .= " selected=\"selected\"";
  }
  
$setperpage_dropdown .= ">";
  
$setperpage_dropdown .= $setvalue;
  
$setperpage_dropdown .= "</option>\n";
}
$setperpage_dropdown .= "</select>\n";
if (
$cat_id != 0) {
  
$setperpage_dropdown .= "<input type=\"hidden\" name=\"cat_id\" value=\"".$cat_id." >\n";
}
if (isset(
$show_result) && $show_result == 1) {
  
$setperpage_dropdown .= "<input type=\"hidden\" name=\"show_result\" value=\"1\" >\n";
}
$site_template->register_vars("setperpage_dropdown"$setperpage_dropdown);
$setperpage_dropdown_form $site_template->parse_template("setperpage_dropdown_form");
$site_template->register_vars("setperpage_dropdown_form"$setperpage_dropdown_form);

$site_template->un_register_vars("setperpage_dropdown");
unset(
$setperpage_dropdown);
unset(
$setperpage_dropdown_form);

//-----------------------------------------------------
//--- Add & Delete from Lists -------------------------
//-----------------------------------------------------
if ($action == "addtolightbox" && $id) {
  
$usergroups = array();
 if (
$user_info['user_level'] >= USER) {
 
  $current_time time();
  
$sql "SELECT group_id  
          FROM "
.GROUP_MATCH_TABLE."
          WHERE user_id = "
.$user_info['user_id'].
          AND groupmatch_startdate <= 
$current_time 
          AND (groupmatch_enddate > 
$current_time OR groupmatch_enddate = 0)";
  
$result $site_db->query($sql);

  while (
$row $site_db->fetch_array($result)) {
    
$usergroups[$row['group_id']] = true;
  }
    
$msg = (add_to_lightbox($id)) ? $lang['lightbox_add_success'] : $lang['lightbox_add_error'];
  }
  else {
    
$msg $lang['lightbox_register'];
  }
}
if (
$action == "removefromlightbox" && $id) {
  
$usergroups = array();
  if (
$user_info['user_level'] >= USER) {
    
$current_time time();
  
$sql "SELECT group_id  
          FROM "
.GROUP_MATCH_TABLE."
          WHERE user_id = "
.$user_info['user_id'].
          AND groupmatch_startdate <= 
$current_time 
          AND (groupmatch_enddate > 
$current_time OR groupmatch_enddate = 0)";
  
$result $site_db->query($sql);

  while (
$row $site_db->fetch_array($result)) {
    
$usergroups[$row['group_id']] = true;
  }

    
$msg = (remove_from_lightbox($id)) ? $lang['lightbox_remove_success'] : $lang['lightbox_remove_error'];
  }
  else {
    
$msg $lang['lightbox_register'];
  }
}
if (
$action == "clearlightbox") {
$usergroups = array();
  if (
$user_info['user_level'] >= USER) {
  
  $current_time time();
  
$sql "SELECT group_id  
          FROM "
.GROUP_MATCH_TABLE."
          WHERE user_id = "
.$user_info['user_id'].
          AND groupmatch_startdate <= 
$current_time 
          AND (groupmatch_enddate > 
$current_time OR groupmatch_enddate = 0)";
  
$result $site_db->query($sql);

  while (
$row $site_db->fetch_array($result)) {
    
$usergroups[$row['group_id']] = true;
  }
    
$msg = (clear_lightbox()) ? $lang['lightbox_delete_success'] : $lang['lightbox_delete_error'];
  }
  else {
    
$msg $lang['lightbox_register'];
  }
}

//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
if ($action == "rateimage" && $id) {
  
$rating intval($HTTP_POST_VARS['rating']);
  if (
$user_info['user_level'] != GUEST) {
    
$sql "SELECT user_id, image_id, vote
            FROM "
.VOTED_TABLE."
            WHERE image_id = "
.$id." AND user_id = ".$user_info['user_id'];
    
$rated $site_db->query_firstrow($sql);
    
$rating = ($rated['vote']) ? $rated['vote'] : $rating;
  }else{
    
$rated FALSE;
  }
  
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME "4images_";
  
$cookie_rated = isset($HTTP_COOKIE_VARS[$cookie_name.'rated']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'])) : array();
  if (
$rating && $rating <= MAX_RATING && $id) {
    if (!isset(
$session_info['rated_imgs'])) {
      
$session_info['rated_imgs'] = $site_sess->get_session_var("rated_imgs");
    }
    
$split_list = array();
    if (!empty(
$session_info['rated_imgs'])) {
      
$split_list explode(" "$session_info['rated_imgs']);
    }
  

if (!
in_array($id$split_list) && !in_array($id$cookie_rated) && !$rated) {
      
$session_info['rated_imgs'] .= " ".$id;
      
$session_info['rated_imgs'] = trim($session_info['rated_imgs']);
      
$site_sess->set_session_var("rated_imgs"$session_info['rated_imgs']);
      
$cookie_rated[] = $id;
      
$cookie_expire time() + 60 60 24 4;
      
setcookie($cookie_name.'rated'serialize($cookie_rated), $cookie_expireCOOKIE_PATHCOOKIE_DOMAINCOOKIE_SECURE);
      
update_image_rating($id$rating);
      
$msg $lang['voting_success'];
    }
    else {
      
$msg $lang['already_voted'];
    }
  }
  else {
    
$msg $lang['voting_error'];
  }
}
//-----------------------------------------------------
//--- Shoutbox ----------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"is_bot" => (isset($usergroups[3])) ? 0
));
//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------
$usergroups = array();
if (
$user_info['user_level'] >= USER) {
  $current_time time();
  
$sql "SELECT group_id  
          FROM "
.GROUP_MATCH_TABLE."
          WHERE user_id = "
.$user_info['user_id'].
          AND groupmatch_startdate <= 
$current_time 
          AND (groupmatch_enddate > 
$current_time OR groupmatch_enddate = 0)";
  
$result $site_db->query($sql);

  while (
$row $site_db->fetch_array($result)) {
    
$usergroups[$row['group_id']] = true;
  }
  
$site_template->register_vars("lang_loggedin_msg"preg_replace("/".$site_template->start."loggedin_user_name".$site_template->end."/siU"format_text($user_info['user_name'], 2), $lang['lang_loggedin_msg']));
  
$user_box $site_template->parse_template("user_logininfo");
  
$site_template->register_vars(array(
    
"user_box" => $user_box,
    
"user_loggedin" => 1,
    
"user_loggedout" => 0,
    
"is_admin" => ($user_info['user_level'] == ADMIN) ? 0
  
));
  
$site_template->un_register_vars("user_logininfo");
  unset(
$user_box);
}
else {
  
$user_box $site_template->parse_template("user_loginform");
  
$site_template->register_vars(array(
    
"user_box" => $user_box,
    
"user_loggedin" => 0,
    
"user_loggedout" => 1,
    
"is_admin" => 0
  
));
  
$site_template->un_register_vars("user_loginform");
  unset(
$user_box);
}
$site_template->register_vars(array(
  
"lang_keyword" => $lang['keywords'], //---[/[MOD] Tag Clouds]
  
"show_tag_clouds" => get_tag_clouds() //---[/[MOD] Tag Clouds]
));
//----------------------------------------------------- 
//--- Last active User -------------------------------- 
//----------------------------------------------------- 
$last_action_user_list "";
$sql "SELECT user_name, user_id, user_lastaction FROM ".USERS_TABLE.
                 WHERE user_level >= '"
.GUEST."' 
                    ORDER BY user_lastaction DESC 
                 LIMIT 5"

    
$result $site_db->query($sql); 

    while (
$row $site_db->fetch_array($result)) { 
    if(
date("dmy"$row['user_lastaction']) == date("dmy")) { 
   
$last_user_date $lang['lang_user_last_today']; 
   }else { 
   
$last_user_date format_date($config['date_format']." ".$config['time_format'], $row['user_lastaction']); 
   }    
   
$last_action_user_list .= "<a href =\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id'])."\" class=\"sslt\">".$row['user_name']."</a><span class=\"smalltext\">".$last_user_date."</span>"
    } 

$site_template->register_vars(array( 
  
"lang_user_last_action" => $lang['lang_user_last_action'],    
  
"user_last_action_list" => $last_action_user_list 
));
$site_template->register_vars("user_last_action_box"$site_template->parse_template("user_last_action_box"));
  unset(
$user_last_action_box); 
  unset(
$last_action_user_list);
 
?>



I have begged google to reconsider my site and recieved confirmation they were going to try to reindex it...

But now I realize that they will only get a redirect loop error!!!!!


ARRRGGGHH?>?> I am so close to being finished that I can actually care about doing the photography and try to make a little money to feed my family and pay for a liscense :)


Can you please help me?"??
to be specific, the error in firefox says
Quote
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

AND [bold] I have disabled all robots in the list except "FAST-WebCrawler" => "searchbot", to keep search bots from being turned around until I can figure this out[/bold]
Title: Re: [MOD] Treat bots as users with less rights
Post by: crs on August 03, 2009, 03:32:15 AM
Hello, im using this mod [MOD] Treat bots as users with less rights.

It works fine, but now i would like to install the following mod too:

    
[MOD] Google Friendly Urls For 4images Best Seo Mod
http://www.4homepages.de/forum/index.php?topic=17598.0


Would that be possible?
Title: Re: [MOD] Treat bots as users with less rights
Post by: Carpfish on August 27, 2009, 07:50:10 PM
Mir ist gerade aufgefallen, das wenn man mit Google Translate auf meine Website geht wo der Mod Instaliert ist,  mann automatisch als googlbot angemeldet ist.
Das sollte aber nicht sein, so kann jeder der die seite übersetzt alles mögliche machen.
Kann mann was dagegen tun, oder habe ich was falsch gemacht.

Gruß Andy

I've just noticed that if you go with Google Translate on my website where the mod is instaled, man is automatically registered as a foot ball.
That should not be, so anyone can translate the page to do everything possible.
Man can do something about it, or what have I done wrong.

Gruß Andy
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on August 28, 2009, 01:55:44 AM
replace
Code: [Select]
"Google" => "googlebot",

with:
Code: [Select]
"Googlebot" => "googlebot",
Title: Re: [MOD] Treat bots as users with less rights
Post by: Carpfish on August 28, 2009, 08:13:25 AM
Thanks V@no ... :lol:
Title: Re: [MOD] Treat bots as users with less rights
Post by: zubair1 on January 21, 2010, 07:37:46 PM
Hi,

can some one please be kind enough to tell me if this mod is compatible with the latest version of 4images 1.7.7?

i have been trying to get this mod to work for hours but no luck.


everything goes well, i see the searchbots on my site appearing, but for some reason the conditions are not being met.

i did the 4.1. and 4.2 steps, but when i see the page as a googlebot it still shows me the Message that i wrote for non-Bot users which it shouldn't.

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: page_header.php                                      *
 *        Copyright: (C) 2002-2009 Jan Sorgalla                           *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.7                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die(
"Security violation");
}

// Cache Templates
/*$template_list = 'header,footer,category_dropdown_form,user_logininfo,user_loginform';
if (isset($templates_used) && $templates_used != "") {
  $template_list = $template_list.",".$templates_used;
}
$site_template->cache_templates($template_list);*/

//-----------------------------------------------------
//--- Register Global Vars ----------------------------
//-----------------------------------------------------
$total_images 0;
$total_categories 0;
$auth_cat_sql['auth_viewcat']['IN'] = 0;
$auth_cat_sql['auth_viewcat']['NOTIN'] = 0;

$cache_id create_cache_id(
  
'data.auth_and_info',
  array(
$user_info[$user_table_fields['user_id']])
);

if (!
$data get_cache_file($cache_idnull)) {
  if (!empty(
$cat_cache)) {
    foreach (
$cat_cache as $key => $val) {
      if (
check_permission("auth_viewcat"$key)) {
        
$total_categories++;
        if (isset(
$val['num_images'])) {
          
$total_images += $val['num_images'];
        }
        else {
          
$cat_cache[$key]['num_images'] = 0;
        }
        
$auth_cat_sql['auth_viewcat']['IN'] .= ", ".$key;
      }
      else {
        
$auth_cat_sql['auth_viewcat']['NOTIN'] .= ", ".$key;
      }
    }
  }

  
$data = array();

  
$data['total_images'] = $total_images;
  
$data['total_categories'] = $total_categories;
  
$data['auth_viewcat']['IN'] = $auth_cat_sql['auth_viewcat']['IN'];
  
$data['auth_viewcat']['NOTIN'] = $auth_cat_sql['auth_viewcat']['NOTIN'];

  
save_cache_file($cache_idserialize($data));

} else {
  
$data unserialize($data);

  
$total_images $data['total_images'];
  
$total_categories $data['total_categories'];
  
$auth_cat_sql['auth_viewcat']['IN'] = $data['auth_viewcat']['IN'];
  
$auth_cat_sql['auth_viewcat']['NOTIN'] = $data['auth_viewcat']['NOTIN'];
}

$file get_included_files();
$file get_file_name(basename($file[0]));
$list = array("categories""details""index""member""postcards""register""search""top");
$array = array();
foreach (
$list as $name)
{
  
$array[$name] = ($name == $file);
}
$site_template->register_vars($array);

$site_template->register_vars(array(
  
"home_url"  => ROOT_PATH,
  
"media_url" => MEDIA_PATH,
  
"thumb_url" => THUMB_PATH,
  
"icon_url" => ICON_PATH,
  
"template_url" => TEMPLATE_PATH,
  
"template_image_url" => TEMPLATE_PATH."/images",
  
"template_lang_image_url" => TEMPLATE_PATH."/images_".$config['language_dir'],
  
"site_name" => $config['site_name'],
  
"site_email" => $config['site_email'],
  
"user_loggedin" => ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) ? 1,
  
"user_loggedout" => ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) ? 0,
  
"is_admin" => ($user_info['user_level'] == ADMIN) ? 0,
  
"self" => $site_sess->url($self_url),
  
"self_full" => $site_sess->url($script_url."/".$self_url),
  
"script_version" => SCRIPT_VERSION,
  
"cp_link" => ($user_info['user_level'] != ADMIN) ? "" "\n<p align=\"center\">[<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php")."\">Admin Control Panel</a>]</p>\n",
  
"total_categories" => $total_categories,
  
"total_images" => $total_images,
  
"url_new_images" => $site_sess->url(ROOT_PATH."search.php?search_new_images=1"),
  
"url_top_images" => $site_sess->url(ROOT_PATH."top.php"),
  
"url_top_cat_images" => $site_sess->url(ROOT_PATH."top.php".(($cat_id && preg_match("/categories.php/"$self_url)) ? "?".URL_CAT_ID."=".$cat_id "")),
  
"url_register" => (!empty($url_register)) ? $site_sess->url($url_register) : $site_sess->url(ROOT_PATH."register.php"),
  
"url_search" => $site_sess->url(ROOT_PATH."search.php"),
  
"url_lightbox" => $site_sess->url(ROOT_PATH."lightbox.php"),
  
"url_control_panel" => (!empty($url_control_panel)) ? $site_sess->url($url_control_panel) : $site_sess->url(ROOT_PATH."member.php?action=editprofile"),
  
"url_categories" => $site_sess->url(ROOT_PATH."categories.php"),
  
"url_home" => $site_sess->url(ROOT_PATH."index.php"),
  
"url_login" => (!empty($url_login)) ? $site_sess->url($url_login) : $site_sess->url(ROOT_PATH."login.php"),
  
"url_logout" => (!empty($url_logout)) ? $site_sess->url($url_logout) : $site_sess->url(ROOT_PATH."logout.php"),
  
"url_member" => (!empty($url_member)) ? $site_sess->url($url_member) : $site_sess->url(ROOT_PATH."member.php"),
  
"url_upload" => (!empty($url_upload)) ? $site_sess->url($url_upload) : $site_sess->url(ROOT_PATH."member.php?action=uploadform"),
  
"url_lost_password" => (!empty($url_lost_password)) ? $site_sess->url($url_lost_password) : $site_sess->url(ROOT_PATH."member.php?action=lostpassword"),
  
"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),
  
"thumbnails" => "",
  
"paging" => "",
  
"paging_stats" => "",
  
"has_rss" => false,
  
"rss_title" => "",
  
"rss_url" => "",
  
"copyright" => '
<p id="copyright" align="center">
  Powered by <b>4images</b> '
.SCRIPT_VERSION.'
  <br />
  Copyright &copy; 2002-'
.date('Y').' <a href="http://www.4homepages.de" target="_blank">4homepages.de</a>
</p>
'
,
));

if (!empty(
$additional_urls)) {
  
$register_array = array();
  foreach (
$additional_urls as $key => $val) {
    
$register_array[$key] = $site_sess->url($val);
  }
  
$site_template->register_vars($register_array);
}

// Replace Globals in $lang
$lang $site_template->parse_array($lang);

$site_template->register_vars(array(
  
"lang_site_stats" => $lang['site_stats'],
  
"lang_registered_user" => $lang['registered_user'],
  
"lang_random_image" => $lang['random_image'],
  
"lang_categories" => $lang['categories'],
  
"lang_sub_categories" => $lang['sub_categories'],
  
"lang_new_images" => $lang['new_images'],
  
"lang_top_images" => $lang['top_images'],
  
"lang_search" => $lang['search'],
  
"lang_advanced_search" => $lang['advanced_search'],
  
"lang_lightbox" => $lang['lightbox'],
  
"lang_register" => $lang['register'],
  
"lang_control_panel" => $lang['control_panel'],
  
"lang_login" => $lang['login'],
  
"lang_auto_login" => $lang['lang_auto_login'],
  
"lang_logout" => $lang['logout'],
  
"lang_lost_password" => $lang['lost_password'],
  
"lang_user_name" => $lang['user_name'],
  
"lang_password" => $lang['password'],
  
"lang_go" => $lang['go'],
  
"lang_images_per_page" => $lang['images_per_page'],
  
"charset" => $lang['charset'],
  
"direction" => $lang['direction']
));

//-----------------------------------------------------
//--- Category Dropdown -------------------------------
//-----------------------------------------------------

if (!$cache_enable) {
    
$category_dropdown_selfjump get_category_dropdown($cat_id1);
} else {
  
$cache_id create_cache_id(
    
'data.dropdown_selfjump',
    array(
      
$user_info[$user_table_fields['user_id']],
      
$config['template_dir'],
      
$config['language_dir']
    )
  );

  if (!
$category_dropdown_selfjump get_cache_file($cache_id)) {
    
// Always append session id if cache is enabled
    
$old_session_mode $site_sess->mode;
    
$site_sess->mode 'get';

    
// Set $cat_id to 0 to ensure that no category is selected
    
$category_dropdown_selfjump get_category_dropdown(01);

    
$site_sess->mode $old_session_mode;

    
save_cache_file($cache_id$category_dropdown_selfjump);
  }
}

$site_template->register_vars("category_dropdown_selfjump"$category_dropdown_selfjump);
unset(
$category_dropdown_selfjump);

// -------------------------------------
if (!$cache_enable) {
    
$category_dropdown_form $site_template->parse_template("category_dropdown_form");
} else {
  
$cache_id create_cache_id(
    
'data.dropdown_form',
    array(
      
$user_info[$user_table_fields['user_id']],
      
// $cat_id, // uncomment if the current category should be selected, will increase the number of cache files
      
$config['template_dir'],
      
$config['language_dir']
    )
  );

  if (!
$category_dropdown_form get_cache_file($cache_id)) {
    
// Always append session id if cache is enabled
    
$old_session_mode $site_sess->mode;
    
$site_sess->mode 'get';

    
$category_dropdown_form $site_template->parse_template("category_dropdown_form");

    
$site_sess->mode $old_session_mode;

    
save_cache_file($cache_id$category_dropdown_form);
  }
}

$site_template->register_vars("category_dropdown_form"$category_dropdown_form);
unset(
$category_dropdown_form);

//-----------------------------------------------------
//--- Random Image ------------------------------------
//-----------------------------------------------------
$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" get_random_image();
$site_template->register_vars("random_image"$random_image);
unset(
$random_image);

//-----------------------------------------------------
//--- Set Paging Vars ---------------------------------
//-----------------------------------------------------
if (isset($HTTP_POST_VARS['setperpage'])) {
  
$setperpage intval($HTTP_POST_VARS['setperpage']);
  if (
$setperpage) {
    
$site_sess->set_session_var("perpage"$setperpage);
    
$session_info['perpage'] = $setperpage;
  }
}

if (isset(
$session_info['perpage'])) {
  
$perpage $session_info['perpage'];
}
else {
  
$perpage ceil($config['default_image_rows'] * $config['image_cells']);
}

//-----------------------------------------------------
//--- Set Perpage Dropdown ----------------------------
//-----------------------------------------------------
$setperpage_dropdown "\n<select onchange=\"if (this.options[this.selectedIndex].value != 0 && typeof forms['perpagebox'] != 'undefined'){ forms['perpagebox'].submit() }\" name=\"setperpage\" class=\"setperpageselect\">\n";
for(
$i 1$i <= $config['custom_row_steps']; $i++) {
  
$setvalue $config['image_cells'] * $i;
  
$setperpage_dropdown .= "<option value=\"".$setvalue."\"";
    if (
$setvalue == $perpage) {
    
$setperpage_dropdown .= " selected=\"selected\"";
  }
  
$setperpage_dropdown .= ">";
  
$setperpage_dropdown .= $setvalue;
  
$setperpage_dropdown .= "</option>\n";
}
$setperpage_dropdown .= "</select>\n";
if (
$cat_id != 0) {
  
$setperpage_dropdown .= "<input type=\"hidden\" name=\"cat_id\" value=\"".$cat_id."\" />\n";
}
if (isset(
$show_result) && $show_result == 1) {
  
$setperpage_dropdown .= "<input type=\"hidden\" name=\"show_result\" value=\"1\" />\n";
}
$site_template->register_vars("setperpage_dropdown"$setperpage_dropdown);
$setperpage_dropdown_form $site_template->parse_template("setperpage_dropdown_form");
$site_template->register_vars("setperpage_dropdown_form"$setperpage_dropdown_form);

$site_template->un_register_vars("setperpage_dropdown");
unset(
$setperpage_dropdown);
unset(
$setperpage_dropdown_form);

//-----------------------------------------------------
//--- Add & Delete from Lists -------------------------
//-----------------------------------------------------
if ($action == "addtolightbox" && $id) {

$usergroups = array(); // [MOD] Treat bots as users with less rights

// [MOD] Treat bots as users with less rights
  
if ($user_info['user_level'] >= USER) {

  
$current_time time();
  
$sql "SELECT group_id  
          FROM "
.GROUP_MATCH_TABLE."
          WHERE user_id = "
.$user_info['user_id'].
          AND groupmatch_startdate <= 
$current_time 
          AND (groupmatch_enddate > 
$current_time OR groupmatch_enddate = 0)";
  
$result $site_db->query($sql);

  while (
$row $site_db->fetch_array($result)) {
    
$usergroups[$row['group_id']] = true;
  }
// END [MOD] Treat bots as users with less rights

    
$msg = (add_to_lightbox($id)) ? $lang['lightbox_add_success'] : $lang['lightbox_add_error'];
  }
  else {
    
$msg $lang['lightbox_register'];
  }
}
if (
$action == "removefromlightbox" && $id) {

$usergroups = array(); // [MOD] Treat bots as users with less rights

  
if ($user_info['user_level'] >= USER) {

// [MOD] Treat bots as users with less rights
  
$current_time time();
  
$sql "SELECT group_id  
          FROM "
.GROUP_MATCH_TABLE."
          WHERE user_id = "
.$user_info['user_id'].
          AND groupmatch_startdate <= 
$current_time 
          AND (groupmatch_enddate > 
$current_time OR groupmatch_enddate = 0)";
  
$result $site_db->query($sql);

  while (
$row $site_db->fetch_array($result)) {
    
$usergroups[$row['group_id']] = true;
  }
// END [MOD] Treat bots as users with less rights

    
$msg = (remove_from_lightbox($id)) ? $lang['lightbox_remove_success'] : $lang['lightbox_remove_error'];
  }
  else {
    
$msg $lang['lightbox_register'];
  }
}
if (
$action == "clearlightbox") {

$usergroups = array(); // [MOD] Treat bots as users with less rights

  
if ($user_info['user_level'] >= USER) {

// [MOD] Treat bots as users with less rights
  
$current_time time();
  
$sql "SELECT group_id  
          FROM "
.GROUP_MATCH_TABLE."
          WHERE user_id = "
.$user_info['user_id'].
          AND groupmatch_startdate <= 
$current_time 
          AND (groupmatch_enddate > 
$current_time OR groupmatch_enddate = 0)";
  
$result $site_db->query($sql);

  while (
$row $site_db->fetch_array($result)) {
    
$usergroups[$row['group_id']] = true;
  }
// END [MOD] Treat bots as users with less rights

    
$msg = (clear_lightbox()) ? $lang['lightbox_delete_success'] : $lang['lightbox_delete_error'];
  }
  else {
    
$msg $lang['lightbox_register'];
  }
}

//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
if ($action == "rateimage" && $id) {
  
$rating intval($HTTP_POST_VARS['rating']);
  
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME "4images_";
  
$cookie_rated = isset($HTTP_COOKIE_VARS[$cookie_name.'rated']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'])) : array();
  if (
$rating && $rating <= MAX_RATING && $id) {
    if (!isset(
$session_info['rated_imgs'])) {
      
$session_info['rated_imgs'] = $site_sess->get_session_var("rated_imgs");
    }
    
$split_list = array();
    if (!empty(
$session_info['rated_imgs'])) {
      
$split_list explode(" "$session_info['rated_imgs']);
    }
    if (!
in_array($id$split_list) && !in_array($id$cookie_rated)) {
      
$session_info['rated_imgs'] .= " ".$id;
      
$session_info['rated_imgs'] = trim($session_info['rated_imgs']);
      
$site_sess->set_session_var("rated_imgs"$session_info['rated_imgs']);
      
$cookie_rated[] = $id;
      
$cookie_expire time() + 60 60 24 4;
      
setcookie($cookie_name.'rated'serialize($cookie_rated), $cookie_expireCOOKIE_PATHCOOKIE_DOMAINCOOKIE_SECURE);
      
update_image_rating($id$rating);
      
$msg $lang['voting_success'];
    }
    else {
      
$msg $lang['already_voted'];
    }
  }
  else {
    
$msg $lang['voting_error'];
  }
}

// [MOD] Treat bots as users with less rights
$site_template->register_vars(array(
"is_bot" => (isset($usergroups[7])) ? 0
));
// END [MOD] Treat bots as users with less rights

//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------

$usergroups = array(); // [MOD] Treat bots as users with less rights

if ($user_info['user_level'] >= USER) {

// [MOD] Treat bots as users with less rights
  
$current_time time();
  
$sql "SELECT group_id  
          FROM "
.GROUP_MATCH_TABLE."
          WHERE user_id = "
.$user_info['user_id'].
          AND groupmatch_startdate <= 
$current_time 
          AND (groupmatch_enddate > 
$current_time OR groupmatch_enddate = 0)";
  
$result $site_db->query($sql);

  while (
$row $site_db->fetch_array($result)) {
    
$usergroups[$row['group_id']] = true;
  }
// END [MOD] Treat bots as users with less rights

  
$site_template->register_vars("lang_loggedin_msg"preg_replace("/".$site_template->start."loggedin_user_name".$site_template->end."/siU"format_text($user_info['user_name'], 2), $lang['lang_loggedin_msg']));
  
$user_box $site_template->parse_template("user_logininfo");
  
$site_template->register_vars(array(
    
"user_box" => $user_box,
    
"user_loggedin" => 1,
    
"user_loggedout" => 0,
    
"is_admin" => ($user_info['user_level'] == ADMIN) ? 0
  
));
  
$site_template->un_register_vars("user_logininfo");
  unset(
$user_box);
}
else {
  
$user_box $site_template->parse_template("user_loginform");
  
$site_template->register_vars(array(
    
"user_box" => $user_box,
    
"user_loggedin" => 0,
    
"user_loggedout" => 1,
    
"is_admin" => 0
  
));
  
$site_template->un_register_vars("user_loginform");
  unset(
$user_box);
}

$site_template->register_vars(array(
  
"lang_keyword" => $lang['keywords'], //---[/[MOD] Tag Clouds]
  
"show_tag_clouds" => get_tag_clouds() //---[/[MOD] Tag Clouds]
));


//---------------------------------------------------------------------------------------------
//---- My-Templates left_sidebar.html 
//---------------------------------------------------------------------------------------------
$left_sidebar $site_template->parse_template("left_sidebar");
  
$site_template->register_vars(array(
    
"left_sidebar" => $left_sidebar
  
));
  unset(
$left_sidebar);
?>

in my templates i tried writting like this:
{ifnot is_bot}
This will not appear for the searchbots...
{endifnot is_bot}

and like this too
{ifno is_bot}
This will not appear for the searchbots...
{endifno is_bot}

I would appreciate if some one could help me out here.

Thank you
Title: Re: [MOD] Treat bots as users with less rights
Post by: mawenzi on January 21, 2010, 07:58:05 PM
... are you logged in as a bot (with bot-name and bot-password), to see what is hidden ... ?
Title: Re: [MOD] Treat bots as users with less rights
Post by: zubair1 on January 21, 2010, 08:01:37 PM
Yes, i tried logging in as a bot but isn't working.

I also tried that User Agent Switcher, it automatically detects the agent and assigns me the user/pass.

I tried it both ways :(

[EDIT]
i don't know if this will help or not, but earlier i tried this.

{ifnot is_admin}
Show This if not an admin
{endifnot is_admin}

and it work, i think its not getting the usergroup id (is_bot doesn't work for it) for some reason, i dont know what can be wrong here, too confused. :(
Title: Re: [MOD] Treat bots as users with less rights
Post by: mawenzi on January 22, 2010, 02:00:59 AM
Yes, i tried logging in as a bot but isn't working.

... the loggin isn't working ... ?
... if so ... do you have created the bot as user incl. password (the same as in sessions.php) via your ACP ... ?
... and if you have ... then the loggin must work ...
Title: Re: [MOD] Treat bots as users with less rights
Post by: zubair1 on January 22, 2010, 03:31:31 AM
I have created the users with the password.

I can login as the bot, but the conditions don't meet.

I still the see the bot message which i am not suppose to see - thats whats happening wrong on my part.

[Edit]

Not Sure if this will help but i have these MODS installed - SEO Mod, Google Sitemap, Annotation, Multi download, searchstats and Tag Clouds.

I just tried to put this in my template.

Quote
{if is_bot}
This will only appear for the searchbots...
{endif is_bot}

and Nothing shows up either if i'm logged in as a admin or a searchbot.

Any Help would be appreicated.
Title: Re: [MOD] Treat bots as users with less rights
Post by: zakaria666 on August 07, 2010, 08:33:33 PM
what does a bot do exactly, is this MOD important???? im very interested to know , but google is not helpful. So what happens if i dont install this MOD who bots hack me>??
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on August 07, 2010, 08:37:37 PM
This is about search engine bots, you know the "crawlers" that index websites. Nothing to do with hacking bots.

By default bots crawl your site as guests, with this mod they will be able crawl as members.
Title: Re: [MOD] Treat bots as users with less rights
Post by: zakaria666 on August 07, 2010, 09:06:43 PM
oooooooooo ok i seee, im sorry this might be a stupid question and please tell me if i am being dum but why would a person want to know if a bot is regarding as a member, dont bots just crawl websites for information?
Title: Re: [MOD] Treat bots as users with less rights
Post by: V@no on August 08, 2010, 12:35:16 AM
dont bots just crawl websites for information?
Yes they do, and that is exactly the reason why some galleries allow them crawl as members - because they will see more information then guests (permissions, permissions, permissions) :D
Title: Re: [MOD] Emergency ! Redirect Loop! Please help V@no
Post by: alekseyn1 on February 21, 2011, 11:30:51 AM
I downloaded the old version of firefox you recommended, and followed the steps provided to check what my site should look like to a robot. I followed your steps in this thread and the thread to not issue a session id. When I set the user agent as one that matched the ones in the bot list I get a redirect error in firefox!!!!

This must be why google can not index my site!

If I disable cookies and change user agent to something not listed in the bot list It will work without cookies....

I have begged google to reconsider my site and recieved confirmation they were going to try to reindex it...

But now I realize that they will only get a redirect loop error!!!!!


ARRRGGGHH?>?> I am so close to being finished that I can actually care about doing the photography and try to make a little money to feed my family and pay for a liscense :)


Can you please help me?"??
to be specific, the error in firefox says
Quote
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

AND [bold] I have disabled all robots in the list except "FAST-WebCrawler" => "searchbot", to keep search bots from being turned around until I can figure this out[/bold]

Well, I finally resolved (kinda) this problem.... Although I am not on this forum bridge, but on the phpBB3 bridge, I had the same problem. The problem was that every search bot that came to site, was properly identified by the forum and a special username was assigned to the bot... and this was confusing 4images.... ohhh man, I spent hour and hours trying to figure out why Google was not able to see my 4images installation.... so finally I have disabled Search Bot identification in my phpBB and it WORKED!! I suggest you dig throgh the settings and disable treating search bots as users within the forum.. I am sure it will fix your issue too...
Title: Re: [MOD] Treat bots as users with less rights
Post by: MrAndrew on June 13, 2011, 12:44:27 AM
For me tags {ifno is_bot} ... {endifno is_bot} - not worked.

My solution:

In my html i`ve added next:

<?php global $user_info; if ($user_info['user_name'] < searchbot) { ?>TEXT, WHICH I WANT TO HIDE<?php } ?>

All bots names is searchbot!

Work fine for me! ;-)
Title: Re: [MOD] Treat bots as users with less rights
Post by: wallward on December 30, 2013, 07:24:35 PM
{ifno is_bot} ... {endifno is_bot}
and
{ifnot is_bot} ... {endifnot is_bot}

not work in 1.7.10 and 1.7.11
please help me to solved this
Title: Re: [MOD] Treat bots as users with less rights
Post by: Rembrandt on December 31, 2013, 06:06:38 AM
Hi!
.....
{ifnot is_bot} ... {endifnot is_bot}
....
That's right...

use the original  V.1.7.10-11 "template.php"
search in the session.php:

    $user_bot = 1;
    break;

and replace:

    $user_bot = 1;
   // break;


mfg Andi
Title: Re: [MOD] Treat bots as users with less rights
Post by: Rembrandt on December 31, 2013, 10:47:02 AM
your code looks good,  but i am not sure what do you want with the functions.php?
next question, have you user "searchbot"  to the correct usergroup added?

this is my list:

$robots = array(
"FAST-WebCrawler" => "searchbot",
"Gulliver" => "searchbot",
"AltaVista" => "searchbot",
"Alexibot" => "searchbot",
"asterias" => "searchbot",
"BackDoorBot" => "searchbot",
"Black.Hole" => "searchbot",
"BlowFish" => "searchbot",
"BotALot" => "searchbot",
"NPBot" => "searchbot",
"Pompos" => "searchbot",
"Scooter" => "searchbot",
"SiteSnagger" => "searchbot",
"Slurp" => "searchbot",
"WebmasterWorldForumBot" => "searchbot",
"zyborg" => "searchbot",
"Google" => "searchbot",
  "Googlebot" => "searchbot",
  "Googlebot-Image" => "searchbot",
"msnbot" => "searchbot",
"ZACATEK_CZ_BOT" => "searchbot",
"EARTHCOM.info" => "searchbot",
"sherlock" => "searchbot",
"Holmes" => "searchbot",
"ia_archiver" => "searchbot",
"lwp-trivial" => "searchbot",
"appie" => "searchbot",
"Scooter" => "searchbot",
"Gigabot" => "searchbot",
"Wget" => "searchbot",
"jyxobot" => "searchbot",
"Xenu Link Sleuth" => "searchbot",
"SeznamBot" => "searchbot",
  "ia_archiver" => "searchbot",
  "Yahoo! Slurp" => "searchbot",
  "Yahoo"  => "searchbot",
  "help\.yahoo\.com" => "searchbot",
);