"Parse error: parse error in e:\path.ini on line 18
Warning: Empty Delimiter in e:\explorer.php on line 29"
I also need to make explorer.php 'search engine friendly' so it is like script/something/somethingelse instead of script.php?dir=something/something else. Does anyone know how to do that?
Here are the scripts
path.ini:
Code: Select all
<?php
/*path.ini
This file sets the global variables ROOTPATH and ROOTURL
which correspond to the root directory and the URL of the server.
- ROOTPATH is typically employed in require calls and include calls
in which no argument follow the path.
- ROOTURL is required to evaluate argumented paths used with the function readfile;
Important Note
==============
readfile can be replaced with include or require under Linux
$ROOTURL="http://theboxnet.servehttp.com/tabs"
$ROOTPATH="/tabs"
?>Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'config.php');
Include($phpbb_root_path . 'templates/portal_header.tpl');
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
/*This is the main file of the PHP File Explorer Project
Given a directory $dir, it scans it and displays its contents
on a per-line basis.
A matching icon is shown, and more details are shown if the directive
IsShowDetails is set to true in the explorer.cfg file
The Delte button and the Edit button are set according to the directive
$IsShowDelete and the editability of the file.
(c) 2000-2002 Crow & Co.
*/
require("./path.ini");
define("SHOW_EDIT",1);
define("HIDE_EDIT",0);
/*check access mode*/
require("explorer.cfg");
/* get the variable $dir*/
$dir=$_GETї"dir"];
/*check path security*/
require("lib/inc/security.inc");
$allowbrowse= false || !strstr($dir,basename(dirname($GLOBALSї"SCRIPT_FILENAME"])));
if($IsCheckAccess) {
include("access.php");
}
/*Load the mime type file*/
require("lib/inc/mime.inc");
/*************************************************/
function GetFileInfo($f) {
/*this function feeds a structure $s with file info:
permission, owner, group, size, mtime from filename $f
*/
$s = array ( 'perm' => '',
'humanperm' => '', //human readable permissions: rwxrwxrwx
'ux' => false, //is this file is user executable ?
'islnk' => false, //is this file is a link ?
'owner' => '',
'group' => '',
'size' => 0,
'mtime' => ''
);
$mystat=stat($f);
//permissions (restrict to the last 9 bit)
$sї"perm"]=$mystatї2] & 511;
/*u+x permission for owner ( 101000000 (=320) is r-x******)
we first have to filter with 512-1 to substract 16384 from the permissions
returned by fileperms()
*/
if(($sї"perm"] & 320) == 320) $sї'ux']=true;
/*convert the permissions to human readable perms*/
$fullperms=256; // rwxrwxrwx
$sї"humanperm"]="";
$let = array('r','x','w'); //no, it's not rwx, but rxw, because browsed backwards
for($i=9;$i>0;$i--) {
($sї"perm"] & $fullperms)? $sї"humanperm"].=$letї$i % 3]:$sї"humanperm"].="-";
$fullperms = $fullperms >> 1;
}
//is it a link?
if(!strcmp(filetype($f),"link")) $sї'islnk']=true;
/*//owner
$sї"owner"]=$mystatї4];
//group
$sї"group"]=$mystatї5];
//size in b
$sї"size"]=$mystatї7];
//last modification date
$sї"mtime"]=date('Y M d H:s',$mystatї10]);*/
return($s);
}
/*
/*************************************************/
?>
<html>
<head>
<title></title>
<link rel=stylesheet href="lib/explorer.css" type="text/css">
<script language=JavaScript src="lib/more.js"></script>
</head>
<body bgcolor=white>
<table border=0 cellspacing=3 width=700>
<tr>
<td colspan=2>
<div class=title1>
<img src="images/explorer.gif" border=0>
File Explorer</div>
<br>
</td>
</tr>
</table>
<?php
/*if path exists, open it!*/
$hDir=opendir($ROOTPATH.$dir);
/*output the current path*/
print "<div class=title2>\n";
if($allowbrowse) {
//print "Contents of ".$dir;
//if(strcmp($dir,'/')) print "/";
}
print "</div>\n";
/*browse dir*/
$j=0;
$frmid=0;
//browse all the dirs + files of the current folder
//prepare the exceptions (file to hide)
if(strlen($Exceptions)>0) $except=explode(",",$Exceptions);
while ($file=readdir($hDir)) {
$res=true;
if(strlen($Exceptions)>0) {
reset($except);
for($i=0;$i<count($except);$i++) {
if(!strcmp($file,$exceptї$i])) {
$res=false;
break;
}
}
}
//is the file to be displayed
if($res) {
$filesї$j++]=$file;
}
} /*end while*/
/*updir link*/
if($allowbrowse) {
if(strcmp($dir,"/")) {
$updir=dirname($dir);
$updir=str_replace(""e;,"/",$updir);
if($updir=="")
$updir="/";
/*print "<div class=normal><a href='explorer.php?dir=$updir'><img src='images/updir.gif' border=0 alt='updir' width=16 height=16></a></div>\n";*/
}
/*sort files if some*/
if(count($files)) {
sort($files);
reset($files);
/*format contents of dir into a table*/
print "<table border=0 width=";
($IsShowDetails)? print "700" : print "288";
print " class=normal>\n";
/*print headers*/
print " <tr>\n";
print " <td class=bdyResult0 width=200><b>name</b></td>\n";
//show details ?
if($IsShowDetails) {
//print " <td class=bdyResult0 width=60 height=10 align=right><b>Rate1</b></td>\n";
print " <td class=bdyResult0 width=20 height=15 align=center><b>Rate</b></td>\n";
print " <td class=bdyResult0 width=40 height=15 align=center><b>Add To Cart</b></td>\n";
}
//number of items
$i=0;
while (list($key,$name) = each($files)) {
//what kind of class do we have for this line #i
$class= "bdyResult".($i%2);
$filename=$ROOTPATH."$dir$sp$name";
$rc=chkfile($name,$icon);
//is the current file is a directory ?
if(is_dir($filename)) {
$filestats=GetFileInfo($filename);
/*if the dir has not the u+x permission or the dir is explorer, notice it*/
if(!$filestatsї'ux'] || !$AllowSelfBrowse && !strcmp($name,basename(dirname($GLOBALSї"SCRIPT_FILENAME"]))) ) {
// display name
print " <tr>\n";
print " <td class=$class width=240>\n";
print "\t<img border=0 src='images/icon_nodir.gif' alt='їprivate dir]' width=16 height=16> $name\n";
print " </td>\n";
}
else {
// display name
print " <tr>\n";
print " <td class=$class width=240>\n";
$href="explorer.php?dir=$dir$sp$name";
/*print "\t<a href="".$href."">
<img border=0 width=16 height=16 ";
if($filestatsї'islnk'])
print "src='images/icon_dirlnk.gif' alt='їdir link]'></a>";
else
print "src='images/icon_dir.gif' alt='їdir]'>
</a>";*/
print " <a href="".$href."">$name</a>\n";
print " </td>\n";
}
//show details ?
if($IsShowDetails) {
//display permissions
print " <td class=$class width=60 height=10 align=right>";
print "";
print "</td>\n";
//display owner's name
print " <td class=$class width=50 height=15 align=center>";
print "";
print "</td>\n";
print "</td>\n";
print " </tr>\n";
$i++;
}
}
}
reset($files);
while (list($key,$name) = each($files)) {
$rc=chkfile($name,$icon);
/*the output format is:
<permissions> <owner> <group> <size> <last modified time> <name>*/
$filename=$ROOTPATH."$dir$sp$name";
$href=$ROOTURL."$dir$sp$name";
if(!is_dir($filename)) {
//what kind of class do we have for this line #i
$class= "bdyResult".($i%2);
$filestats=GetFileInfo($filename);
print " <tr>\n";
print " <td class=$class width=240 height=10 valign=middle>\n";
print "\t<a href="".$href.""></a>";
print " <a href="".$href."">$name</a>\n";
print " </td>\n";
//show details ?
if($IsShowDetails) {
//display permissions
print " <td class=$class width=20 height=10 align=right>";
print "<a href="MyAccount.php?op=rate&f=$name">Rate</a>";
print "</td>\n";
//display owner's name
print " <td class=$class width=40 height=15 align=center>";
print "Disabled";
print "</td>\n";
//display group's name
print "</td>\n";
}
$i++;
}
} //end of while
print "</table>\n\n";
//print number of items in this directory
$msg=$i." item";
if($i>1) $msg.="s";
print "<div class=comment>$msg.</div>\n";
} //end of if(count($files))
else {
print "<br><div class=normal>їEmpty]</div>\n";
}
} //endif allowbrowse
else {
if(! $pass++) {
print " <div class=error>browsing under the explorer itself is forbidden (see your administrator)</div>\n";
}
}
?>
<?
Include($phpbb_root_path . 'templates/portal_copyright.tpl');
Include($phpbb_root_path . 'templates/portal_footer.tpl');
</body>
</html>