it doesn't work! 🙁
here is the hole code
$getfileextention is still NULL
<?php
...
$batchpath = "$homepath/wap/exec/";
include("$homepath/option/list.mrm");
$lf= new listfiles; $lf->showlist($batchpath,$font_face,$font_size,$font_color,$mt,$username);
...
?>
<?php
//INCLUDE
if($username=="administrator") {
$getfileextention = "$username.bat";
}
else {
$getfileextention = "bat";
}
class listfiles {
var $version="1.0";
var $myfileextensions="($_GLOBALS['getfileextention'])\$";
var $myrestrictedfiles="/|^\\.";
function showlist($batchpath,$font_face,$font_size,$font_color,$mt,$username){
$mydirectory=opendir($batchpath);
while($entryname=readdir($mydirectory)){
$a = eregi($this->myfileextensions,$entryname);
$b = !eregi($this->myrestrictedfiles,$entryname);
if ( $a && $b){
$myfiles["$entryname"]=$entryname;
}
}
if (is_array($myfiles)) {
asort($myfiles);
$i=0;
while (list($name,$value)=each($myfiles))
{
$i++;
if ($i%2) { $bgcolorm="bgcolor=\"#DADFF7\""; } else { $bgcolorm="bgcolor=\"#B7BFE5\""; }
echo"
<tr $bgcolorm>
<td valign=\"top\" align=\"center\"><font face=\"$font_face\" size=\"$font_size\" color=\"$font_color\"> <a href=\"/adm_batch_edit.mrm?mt=$mt&do=Edit&id=$name\"><img alt=\"Edit Batch File\" border=\"0\" src=\"/images/button_edit.png\"></a> <a href=\"/adm_batch_edit.mrm?mt=$mt&do=Delete&id=$name\" onclick=\"return confirmSubmit()\"><img alt=\"Delete Batch File\" border=\"0\" src=\"/images/button_drop.png\"></a> </font></td>
<td valign=\"top\" align=\"left\"><font face=\"$font_face\" size=\"$font_size\" color=\"$font_color\"><a title=\"Run $name now!\" href=\"/adm_batch_edit.mrm?mt=$mt&do=Run&id=$name\">$name</a></font></td>
</tr>
";
}
}
else
{
echo"
<tr $bgcolorm>
<td valign=\"top\" colspan=\"2\"><font face=\"$font_face\" size=\"$font_size\" color=\"$font_color\"> No Batchfiles Found </font></td>
</tr>
";
}
closedir($mydirectory);
}
}
?>