Welcome to Fogfighters Hungary!
 
  Login or Register
.week  
Time
 
 
 
Languages
Select Interface Language:

 
Google Translation
Translation
 
Traffic Report
 
Where are you from?
 
Map Random
Objective
am_hydro_dam
View am_hydro_dam
Axis and Allied forces have set up operations on either side of a dam, each must collect and return an objective to their bases. Access to the objective is by means of a successful dynamite charge at enemy door. Control of ba
Hits: 3
Total Maps: 85
 
Modules
· Home
· About Easter
· Büntetés kalkulátor
· Bible
· Biorythm
· Birds
· Black Gallery
· Cats
· Coppermine
· Dogs
· eCards
· ET Game manual
· ET Handbuch
· ET játékleírás
· ET Maps
· Fórumok
· FIFA World Cup 2006
· Fish
· Google Guide
· Googlemaps
· Hírküldés
· Help Desk
· Internet_TV
· Keresés
· Letöltések
· Members List
· Member_Map
· News
· Online Radios
· PHP-Nuke_HOWTO
· PHP-Nuke_Tools
· Private Messages
· Punkbuster
· Saját beállításaid
· Shout Box
· Statisztikák
· Szavazások
· Szerencsejáték
· Tagfelvétel
· Viccek
· Videó kollekció
· Web címek
· Web Development
 
MS-Analysis
Top-Ten Countries visiting Fogfighters Hungary

1 United States United States
2 China China
3 Viet nam Viet nam
4 Russian Federation Russian Federation
5 France France
6 Hungary Hungary
7 Canada Canada
8 Ukraine Ukraine
9 United Kingdom United Kingdom
10 Netherlands Netherlands
11 Germany Germany
12 Poland Poland
13 Italy Italy
14 Taiwan, Province of China Taiwan, Province of China
15 Seychelles Seychelles
16 Romania Romania
17 Indonesia Indonesia
18 Australia Australia
19 Thailand Thailand
20 Sweden Sweden
21 Brazil Brazil
22 India India
23 Japan Japan
24 South Africa South Africa
25 Lithuania Lithuania
26 Argentina Argentina
27 Spain Spain
28 Chile Chile
29 Luxembourg Luxembourg
30 Turkey Turkey
31 Moldova, Republic of Moldova, Republic of
32 Korea, Republic of Korea, Republic of
33 Venezuela Venezuela
34 Malaysia Malaysia
35 unknown unknown
36 Switzerland Switzerland
37 Singapore Singapore
38 Colombia Colombia
39 Hong Kong Hong Kong
40 Mexico Mexico
41 Belize Belize
42 Greece Greece
43 Honduras Honduras
44 Estonia Estonia
45 Mongolia Mongolia
46 Czech Republic Czech Republic
47 Latvia Latvia
48 Bangladesh Bangladesh
49 Bulgaria Bulgaria
50 Pakistan Pakistan

View MS-Analysis
 
Scrolling Links
Mods:































Community:




































Clans:






























































League:










Anticheat:












Other:

































 
Special days




International Music Day





International Day of Older Persons


 
Képes Naptár
There is a problem right now with this block.
 
CPG Random Picture

Ez pedig a másik

 
Latest Videos


Last added videos

Orvosnál

Orvosnál

Last added videos

Funny

Funny Mortar

Last added videos

Shy

Shy Rose - I Cry For You
 
How to display random images in PHP-Nuke blocks

20.8.1. How to display random images in PHP-Nuke blocks

We now move to a more advanced example of a PHP-Nuke block: a block that displays random images. Suppose you have a collection of images in a directory of your webserver and would like to display a random image each time in a PHP-Nuke block. Using PHP-Nuke's own positioning capabilities for blocks (in the administration panel, from the "Blocks" link, see Section 7.1), you can achieve an almost arbitrary positioning of random images in your page - a functionality that could be used to display whatever visual content you like, ranging from a "daily babe" to a random skyscraper banner.

To create a random image block for PHP-Nuke, proceed as follows (see Random Picture Block):

Make a script called block-RandomPics.php and put it in the blocks folder. The code for block-RandomPics.php is:

<?php
$content="";
if (eregi("block-RandomPics.php",$PHP_SELF)) {
  Header("Location: index.php");
  die();
}
// $whereimgs has to be in the Domain (like localhost area) 
// or put ../ in front of folder name
$whereimgs = "../pictures";
mt_srand((double)microtime()*1000000);
$imgs = dir($whereimgs);
while ($file = $imgs->read()) {
  if (eregi("gif", $file) || eregi("jpg", $file)) {
    $imglist .= "$file ";
  }
}
closedir($imgs->handle);
$imglist = explode(" ", $imglist);
$a = sizeof($imglist)-2;
$random = mt_rand(0, $a);
$image = $imglist[$random];
$asin = explode(".", $image);
$content = "";
$content .= "<center><a href=\"PicShow.php?show=".$whereimgs."/$image\">";
$content .= "<img src=\"".$whereimgs."/$image\" border=\"0\" 
              width=\"120\" alt=\"\"><br><br>";
$content .= "Click for full picture.</a><BR></center>";
?>

The block-RandomPics.php block reads all .gif's and .jpg's from the $whereimgs directory into an array ($imglist), computes a random index between 0 and the maximum array index ($a) and uses the random index to select an image name from the array. It then writes some HTML code to display a thumbnail of 120 pixels width with a ling to the original picture. The link itself passes the show parameters on the URL as the concatenation of the $whereimgs directory and the random image name ($image) to a script we still have to write, PicShow.php.

Tip The right images path
 

Taking into account that block-RandomPics.php has to be located in the blocks folder, then, if your images folder is the folder "pictures" under the "PHP-Nuke root" directory (i.e. under the same directory where mainfile.php, index.php, config.php etc. are located), then you have to prepend a "../" to "pictures", as we did in the code, assuming that you don't want to give an absolute, fully qualified URL there.

For PicShow.php, which is the script that will show the full image, we have to write code that behaves just like a standard PHP-Nuke module (but without any administration functions), so you can see it as an example of a minimal module:

<?php
if (!isset($mainfile)) { include("mainfile.php"); }
$index = 0; 
include("header.php");
OpenTable(); 
$sl = $show;
echo " 
<center><h3><a href=\"javascript:history.back()\">Go back!<br><br>
<img src=$sl border=\"2\"></a></h3> 
</center>"; 
closetable();
include("footer.php");
?> 
Send all questions and comments to:
Webmaster
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest Fogfighters Hungary © 2007 - 2022

You can syndicate our news using the file backend.php or ultramode.txt

PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.27 Seconds

:: subBlack phpbb2 style by spectre :: PHP-Nuke theme by www.nukemods.com ::