[FX.php List] Visual index of records via referenced images ?

DC dan.cynosure at dbmscan.com
Tue Jul 24 14:17:17 MDT 2007


g'day glenn,

this sample code you posted should work properly in a few tightly 
prescribed instances for reading a directory full of images, but there 
are holes and some extra crap in that code:

$dir = $HTTP_GET_VARS['.'];  Why is this here? it is not used later, and 
if you do use it later it is a SECURITY hole if you let GET vars target 
directories directly (without filtering).
$dir var? not needed.
$line incrementor? why?
deprecated HTML: bgcolor table tag attributes, center tag
BORDERCOLOR is not an HTML table attribute, it is a DOM property as well 
as an ASP HTMLTableCell control.

also, you'll end up with a broken table (lack of final closing TR) if 
$maxperline value is not a factor of the number of files found in the 
directory.

finally, the main flaw is why are you reading a directory if you have 
file references in FMP fields?

presumably you will replace the directory iterator shown here with an FX 
result data array... why don't you post that code after you've spent 
some time refining it?

cheers,
dan

Glenn Singleton had written:
> Hi
> 
> I have a folder called images (original I know) which in Filemaker I 
> reference into fields.
> 
> I want to create an index page where the user can go to the record by 
> clicking on the picture.
> 
> I was planning on modifying the following code (simple folder gallery 
> code), but is there a better way (using existing cache) ?
> 
> ----- Code ------------------------------------
> $dir = $HTTP_GET_VARS['.'];
> $handle=opendir('.');
> readdir($handle);
> echo "<TABLE BORDER=1 BORDERCOLOR=BLUE>";
> echo "<TR bgcolor=dddddd>";
> $maxperline = 3;
> $count = 1;
> $line=1;
> while (($file = readdir($handle))!==false){
>     if (!($file=='..')){
>    if (!($file=="gallery.php")){
>     echo "   
>         <TD>
>                 <center>
>                 <a href='$file'><img src='$file'></a>
>                 <br>$file</center>
>         </TD>";
>     $count = $count + 1;
>     if ($count > $maxperline){
>         $count = 1;
>         $line = $line + 1;
>         echo "</TR><TR bgcolor=dddddd>";};
>     };
>     };
> };
> ----- END CODE ---------------------------------
> 
> Regards
> Glenn Singleton
> glenn at fmutils.com a.h.[ glenn at cornerstoneict.com.au b.h.]
> www.fmutils.com - totally free computer software and utilites for 
> filemaker plus more
> focusing on the needs of special children ( contributions wanted !)
> [Mac G4 OS X 10.4.9, Mail V2.1]
> 
> 
> 
> 
> On 25/07/2007, at 3:54 AM, Chris Hansen wrote:
> 
>> List,
>>
>> Very sorry, but I said this thread needed to end, and I meant it.  
>> I've started setting the moderation flag on those who choose to ignore 
>> this.  I apologize for the high noise to signal ratio today.  Sincerely,
>>
>> --Chris Hansen
>>   FileMaker 8 Certified Developer
>>   FileMaker 7 Certified Developer
>>   Creator of FX.php
>>   "The best way from FileMaker to the Web."
>>   www.iViking.org
>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
> 


More information about the FX.php_List mailing list