Jump to content

Recommended Posts

Hi,

 

I have this code

<?php
 // Must include this
include("geoiploc.php");

function getYJLINKS($default_font_family,$yj_copyrightear,$yj_templatename,$show_tools,$show_fres,$show_rtlc,$validators_off,$totop_off){
	
	$allLinks = array();

	if((function_exists('toolbox_urls') && $show_tools == 1) || $validators_off == 1 || $totop_off == 1){
		echo '<div class="validators">';
		if($validators_off == 1){
			$allLinks[] ='<a href="http://jigsaw.w3.org/css-validator/check/referer?profile=css3" target="_blank" title="CSS Validity">CSS Valid</a>';
			$allLinks[] ='<a href="http://validator.w3.org/check/referer" target="_blank" title="XHTML Validity">XHTML Valid</a>';
		}
		if($totop_off == 1){
			$allLinks[] ='<a class="yjscroll" href="#stylef'.$default_font_family.'">Top</a>';
		}
		if (function_exists('toolbox_urls') && $show_tools == 1):
		global $font_size;
		global $font_direction;
			if ($show_fres == 1):
				$allLinks[] = '<a id="fontSizePlus" class="fs" href="javascript:;" rel="nofollow">+</a>';
				$allLinks[] = '<a id="fontSizeMinus"  class="fs" href="javascript:;" rel="nofollow">-</a>';
				$allLinks[] = '<a id="fontSizeReset"  class="fs" href="javascript:;" rel="nofollow">reset</a>';
			endif;
			if ($show_rtlc == 1):
				$allLinks[] = '<a class="tdir" href="'.$font_direction[1].'" rel="nofollow">RTL</a>';
				$allLinks[] = '<a class="tdir" href="'.$font_direction[2].'" rel="nofollow">LTR</a>';
			endif;
		endif;
		echo implode(' | ',$allLinks);
		echo '</div>';
   }
// loading this from a database
    $ip = $_SERVER["REMOTE_ADDR"];

// listing Country Flags Images
    $dir = 'images/flags';
    $file_display = array('png');
         if (file_exists ($dir) == false) {
    echo 'Directory \'', $dir, '\' not found!';
    }
    else{
         $dir_contents = scandir($dir);
         foreach($dir_contents as $file) {
         $file_type = strtolower(end(explode('.', $file)));
    If($file !== '.' && $file !== '..' && in_array($file_type, $file_display) == true)
    if($file == '..' || $file == '.') {
    continue;
    }
         $code = strtolower(getCountryFromIP($ip, "code"));
    echo '<div class="yjsgcp">Palana.it ® 1994 - '.$yj_copyrightear.' :: Tutti i diritti riservati :: Realizzazione Palana.it &boxv;&boxv; Utente rilevato: IP: '. $ip . ', '.getCountryFromIP($ip, " NamE ").' ('.getCountryFromIP($ip, "code").'-'.getCountryFromIP($ip, "AbBr").') ';
    echo '<img src="', $dir, '/', $code, '.png" /> </div>';
        }
    }
}
?>

The problem, as we see (http://www.palana.it), is that code printed the Italian flag but many times there are images in the directory, that is over 204. See bottom of the page. How can I fix the code to get ONE display?

Link to comment
https://forums.phpfreaks.com/topic/293779-visualize-a-file-from-a-directory/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.