<?php if(!isset($_SESSION["admin"]))
{
echo '<font color="red">You are not authorized to view this page </font>';
return;
}
?>
<?php
if(isset($save))
{
$path=$filename;
}else $path=$edit;
if ( isset($save))
{
if($fp=fopen($path,"w"))
{
fwrite($fp,$filecontent,strlen($filecontent));
fclose($fp);
}else $save="false";
}
$fsize = filesize($path) ;
$fmodified = date("d/M/y G:i:s", filemtime($path)) ;
$faccessed = date("d/M/y G:i:s", fileatime($path)) ;
?>
<br>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="f7f7f7">
<tr>
<td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
<tr bgcolor="#FFFFFF">
<td width="20%" bgcolor="fafafa">File </td>
<td colspan="3" bgcolor="fafafa"><?php echo $path; ?></td>
</tr>
<tr bgcolor="#FFFFFF">
<td>File size </td>
<td width="44%"><?php echo $fsize ?> Bytes</td>
<td width="21%">Owner </td>
<td width="15%"><?php echo fileowner($path); ?></td>
</tr>
<tr bgcolor="fafafa">
<td>Last modified </td>
<td><?php echo $fmodified; ?></td>
<td>Group </td>
<td><?php echo filegroup($path); ?></td>
</tr>
<tr bgcolor="#FFFFFF">
<td>Last accessed </td>
<td><?php echo $faccessed; ?></td>
<td>Permission </td>
<td><?php printf( "%o", fileperms($path) ) ; ?></td>
</tr>
</table></td>
</tr>
</table>
<div align="center">
<?php
if ( isset($save))
{
$fp=fopen($path,"w");
{
fwrite($fp,$filecontent,strlen($filecontent));
if(isset($save))
{
if($save==true)echo "<br><br><center>".$path." was saved successfuly </center><br><br>";
else echo "<br><br><center>".$path." Error saveing !!!</center><br><br>";
}
}
fclose($fp);
}
?>
</div>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="f7f7f7">
<tr>
<td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td bgcolor="#FFFFFF" ><form name="form" method="post" action="admin.php?page=fm&fmaction=edit">
<div align="center"><br>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><textarea name="filecontent" style="width:100%" rows="30" class="textboxgray" id="textarea"><?php
$line_num=0;
$fp=fopen($edit,"r");
while ( ! feof ($fp ))
{
//$line_num_print=sprintf(" <font color=\"#666699\"><strong>%04d</strong></font> ",$line_num);
//echo $line_num_print;
$line= fgets($fp,1024);
//$line=str_replace(">",">",$line);
//$line=str_replace("<","<",$line);
//$line=str_replace("\n","<br>",$line);
echo htmlspecialchars($line);
$line_num++;
}
fclose($fp);
?>
</textarea>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td ><strong>Save File as :</strong></td>
<td><input name="filename" type="text" id="filename2" class="textboxgray" value="<?php echo $path; ?>" size="80"></td>
<td ><input type="submit" name="Submit" class="textboxgray" value="Save">
<input name="rel_dir" type="hidden" id="edit" value="<?php echo $rel_dir; ?>">
<input class="textboxgray" type="button" name="Button" value="Back" onClick="window.location='admin.php?page=fm&rel_dir=<?php echo $rel_dir; ?>'">
</td>
</tr>
</table> </td>
</tr>
</table>
<input name="action" type="hidden" id="action" value="edit">
<input name="edit" type="hidden" id="edit" value="<?php echo $path; ?>">
<input name="save" type="hidden" id="save" value="true">
<br>
</div>
</form> </td>
</tr>
</table></td>
</tr>
</table>