how can i make this script readu only files i.e. jpg and png
<?php
session_start();
$login = $HTTP_SESSION_VARS['_amember_user']['login'];
$file_array = array();
function GetDirArray($sPath)
{
global $file_array;
$handle=opendir($sPath);
$i=0;
while (false!==($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
$file_array[]= $file;
$i++;
}
}
closedir($handle);
sort($file_array);
}