| 
<?
session_start();
 
 require('class.box-net.php');
 
 if ( $_GET['folder_id']!="" ){
 $folder_id = intval($_GET['folder_id']);
 }else{
 $folder_id = 0;
 }
 
 $upper_id = intval($_GET['upper']); // Get information about upper level ID
 
 $boxnet = new Box_net;
 $boxnet->USE_SESSIONS = true; // Requires session_start() !
 $boxnet->DEBUG = false;    // Some debug info
 
 // Change username & password
 if ($boxnet->Login('username', 'password') == false){
 echo "<b>Box.net Login Failed - Invalid Username or password</b>";
 exit;
 }
 $filelist = $boxnet->FileList($folder_id);
 
 $upper_level = $filelist['up_level'];
 $folders = $filelist['folders'];
 $files = $filelist['files'];
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
 <html>
 <head>
 <title>PHP box.net Class - Test Page</title>
 <style>
 DIV.upper{}
 DIV.folder{padding-left: 1em;}
 DIV.file{padding-left: 2em;}
 </style>
 </head>
 
 <body>
 
 <?
 if ($folder_id != 0){
 echo "<div class='upper'><a href='" .  $_SERVER["PHP_SELF"] . "?folder_id=$upper_id'>«« ...</a></div>\n";
 }
 for($i=0; $i<count($folders); $i++){
 $link = $_SERVER["PHP_SELF"] . '?folder_id=' . $folders[$i][id];
 $link .= '&upper=' . $folder_id; // Add this folder ID to track upper level
 $folder_name = $folders[$i]['name'];
 echo "<div class='folder'><a href='$link'>$folder_name</a></a></div>\n";
 }
 
 for($i=0; $i<count($files); $i++){
 $download = $files[$i]['download'];
 $file_name = $files[$i]['file_name'];
 $file_size = round($files[$i]['size']/1024, 2);
 echo "<div class='file'><a href='$download'>$file_name</a> $file_size (KB)</div>\n";
 }
 
 ?>
 
 <div style="margin-top: 2em; font-family: arial; font-size: 0.8em; border-top:1px solid gray; padding: 4px;">Sponsored by: <a href="http://www.fivestores.com">FiveStores</a> - get your free online store; <i style="color: gray;">integrated with your <a href="http://www.box.net">www.box.net</a> account</i></div>
 
 </body>
 </html>
 
 |