Hey I've roughly written a php ftp browser (file displayer) and I cant seen to get around the problem how I would navigate through the folders, im fairly new to php and haven't had much experience just wondering that some methods could be for keeping track of what directory I am in and how to navigate up and down through the files and folders, I'm looking for ideas not necessarily solutions. I use a $_GET to tell the script what folder to look through but I want to be able to navigate solely through the hyperlinks Here is my code so far:
<?php
ini_set('upload_max_filesize', '10M');
ini_set('post_max_size', '10M');
ini_set('max_input_time', 300);
ini_set('max_execution_time', 300);
$host = "";
$user = "";
$password = "";
$ftp_connection = ftp_connect($host);
ftp_login($ftp_connection, $user, $password);
if (isset($_GET['page']))
{
$path = "/" . $_GET['page'];
}
else
{
$path = "/";
}
$file_list = ftp_nlist($ftp_connection, $path);
echo "<table border=1><tr><td>File Name</td><td>File Size</td><tr>";
for($index = 0; $index < sizeof($file_list); $index++)
{
echo "<tr>";
$file_size = ftp_size($ftp_connection, $file_list[$index]);
$file_name = $file_list[$index];
if ($file_size == -1)
{
echo "<td><a href=browse.php?page=" . $path . $file_name . ">" . $file_name . "</a></td><td><b>Folder</b></td></tr>";
}
else
{
echo "<td>" . $file_name . "</td><td>" . $file_size . "</td></tr>";
}
}
ftp_close($ftp_connection);
I'm fairly tired so I will sleep on the problem and check back in the morning (it may just be because I'm tired I cant think of a solution) I think ive explained it the best I can this is my first post so any help would be appreciated