Hi guys been looking at this forum and it looks like it could be what i need, im new to php and have just taken on a website with some pages using it!
I think it was installed on a PHP 4 server as when we have just moved the site to a php5 server the code stopped working
I looked throught the pages and the code started with <? as soon as i changed it to <?php it all started looking better, is this normal?
Next i have this page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<?php session_register("GlimpseDir");
if(!$GlimpseDir) $GlimpseDir="/";
$basedir="images/pics/";
function reloadnow() {
global $PHP_SELF;
global $addons;
header("Status: 302 Moved");
header("Location: $PHP_SELF".$addons);
exit(); }
if($cancel) $action="";
if($action=="root") $GlimpseDir="/";
if($action=="chdr") $GlimpseDir=$file."/";
if($action=="dele" && $confirm==1) { unlink($basedir.$file); $action="";}
if($action=="move" && $confirm && $newfile) {
rename($basedir.$file,$basedir.$newfile); $action=""; }
if($action=="rmdr") rmdir($basedir.$file);
if($action=="edit" && $confirm && $file) {
$fp=fopen($basedir.$file,"w");
fputs($fp,stripslashes($code));
fclose($fp);
$addons="?action=edit&file=".rawurlencode($file);
reloadnow(); }
if($upload) { copy($userfile,$basedir.$GlimpseDir.$userfile_name);
reloadnow(); }
if($touch) { touch($basedir.$GlimpseDir.$touchfile); reloadnow(); }
if($mkdir) { mkdir($basedir.$GlimpseDir.$mkdirfile,0700); reloadnow(); }
?>
<HTML>
<HEAD>
<TITLE>Image Upload to "<?php echo $GlimpseDir;?>"</TITLE>
<link rel="stylesheet" type="text/css"
href="./css/stylesheet.css" />
</HEAD>
<BODY>
<table width="80%" border="0" align="center" valign="top" bgcolor=#FFFFCC>
<tr align="left" bgcolor="#009900">
<th><a class="header" href="./BackOfficeHomepage.asp">Articles Manager</a></th>
<th><a class="header" href="./BackOfficeAdverts.asp">Adverts Manager</a></th>
<th><a class="header" href="./BackOfficeSections.asp">Sections Manager</a></th>
<th><a class="header" href="./FrontPage.asp" target="_blank">View Website</a></th>
<th><a class="header" href="./BackOfficeLogin.asp">Log Out</a></th>
</tr>
<?php
if ($action=="dele") {
echo "<tr><td colspan=5>Are you sure you want to delete $file ?<BR>";
echo "<A HREF=\"$PHP_SELF?action=dele&file=" . rawurlencode($file) . "&confirm=1\">YES</A><BR>";
echo "<A HREF=\"$PHP_SELF\">NO</A><BR>";
echo "</td></tr></table></BODY></HTML>";
exit(); }
?>
<tr><td colspan=5> </td></tr>
<tr><td colspan=5><font color="#008000" size="3"><b>Upload to the <font color="#FF0000">Article</font> Image Folder</b></font></td></tr>
<tr><td colspan=5>Please ensure that the images uploaded are in .jpg or .gif format only and are of a suitable size</td></tr>
<tr><td colspan=5> </td></tr>
<tr><td colspan=5>
<TABLE BORDER="1" align="center" bordercolor="#008000" width="80%">
<TR align="left"><Th width="50%">Filename</TD><Th width="10%">Type</TD><Th width="10%">Size</TD><Th width="30%" colspan="2">Action</TD></TR>
<?php $handle=opendir($basedir . $GlimpseDir);
while($file = readdir($handle)) {
if ($file != "." && $file != "..") {
$filename=$basedir.$GlimpseDir.$file;
$fileurl=rawurlencode($GlimpseDir.$file);
echo "<TR>";
echo "<TD>" . htmlspecialchars($file) . "</TD>\n";
echo "<TD>" . filetype($filename) . "</TD>\n";
echo "<TD>" . filesize($filename) . "</TD>\n";
//echo "<TD>";
if(filetype($filename)=="file") {
echo "<TD><A HREF=\"$basedir$file\" target='_blank'>View File</A></TD>";
echo "<TD><A HREF=\"$PHP_SELF?action=dele&file=$fileurl\">Del File</A></TD>";
} if(filetype($filename)=="dir") {
echo "<TD><font color='#000080'><A HREF=\"$PHP_SELF?action=chdr&file=$fileurl\">Change Dir</A></font></TD>";
echo "<TD><font color='#000080'><A HREF=\"$PHP_SELF?action=rmdr&file=$fileurl\">Remove Dir</A></font></TD>";
}
//echo "</TD>";
echo "</TR>\n";
}
}
closedir($handle);
?>
</TABLE>
</td></tr>
<BR>
<tr><td colspan="5" align="center">
<FORM ENCTYPE="multipart/form-data" METHOD="POST" ACTION="<?php echo $PHP_SELF;?>">
<INPUT NAME="userfile" TYPE="file">
<INPUT TYPE="SUBMIT" NAME="upload" VALUE="Upload File"><BR>
<INPUT TYPE="TEXT" NAME="mkdirfile">
<INPUT TYPE="SUBMIT" NAME="mkdir" VALUE="Make New Directory"><BR>
</FORM>
</td></tr>
</table>
</BODY>
</HTML>
I have had to make a few more changes to get it to work but it still does not and wondered is there anything obvious anyone can see which would stop it?
The problem im having with it is it does not actually do anything it should apart fromlist the directory, it wont upload or create and new folder..
If you go to the URL http://www.mauritiusnews.co.uk/UploadPicsImg.php
you can see it working, i have noticed if you click a command like DEL picture this then becomes the SELF.
Very strange stuff.
Thanks