8
« on: May 16, 2013, 06:55:07 am »
Why is it that by default it only shows the text input bar with the directory, and the table header that says File, Size, Permissions, etc? Here's what my view files function looks like now:
function view_files($dir)
{?>
<table>
<tr>
<form method='POST' action='?act=file&dir=<?php echo base64_encode($dir);?>'>
<td><input type='text' name='dir' size='50' value='<?php echo getcwd(); ?>'>
<input type='submit' value='Go'></form></td>
</tr>
<table border='1'><tr>
<td width='175'><b>Name</b></td>
<td><b>Size</b></td>
<td><b>Permissions</b></td>
<td><b>Edit</b></td>
<td><b>Delete</b></td>
<td><b>Chmod</b></td>
</tr>
<?php
if($handle = opendir($dir))
{
while(($file = readdir($handle)) !== false)
{
if($file != '.' && $file != '..')
{
$path_and_file = $dir .'/'. $file;
$encoded_path_and_file = base64_encode($path_and_file);
?>
<tr>
<td><?php echo $file; ?></td>
<td><?php echo filesize($path_and_file);?></td>
<td>perms</td>
<td width='165'><a href='?act=edit&file=<?php echo $encoded_path_and_file; ?>'><b id='me'><u>Edit</u></b></a></td>
<td width='225'><a href='?act=del'><b id='me'><u>Delete</u></b></a></td>
<td width='190'><a href='?act=chmod'><b id='me'><u>Chmod</u></b></a></td>
</tr
<?php
}
}
}
}
It's only slightly different from yours. What I want it to do is display all files in the current directory and the edit, delete and chmod buttons by default, without having to click on the Go button next to the input box. That's how it used to work and even if I switch back to the exact same function that I had before it still only shows the input box with the current working directory..