<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php
// if form has not yet been submitted,
// display input box
if(!isset($_POST['file'])){
?>
<form action"<?php echo $_SERVER['SCRIPT_NAME'];?>" method="post">
Enter file path
<input type="text" name="file">
</form>
<?php
}
//else process from input
else{
echo 'File name: <b>'.$_POST['file'].'</b><br />';
/* check is file exist */
if(file_exists($_POST['file'])){
// print file size
echo 'file size: '.filesize($_POST['file']).'byets. <br />';
// print file owner
echo 'file owner: '.fileowner($_POST['file']).'<br />';
// print file group
echo 'file group: '.filegroup($_POST['file']).'<br />';
// print file permission
echo 'file permission: '.fileperms($_POST['file']).'<br />';
// print file type
echo 'file type: '.filetype($_POST['file']).'<br />';
// print last access time
echo 'file last accessed on: '
.date('Y-m-d', fileatime($_POST['file'])).'<br />';
// print last modification time
echo 'file last modified on '
.date('Y-m-d', filemtime($_POST['file'])).'<br />';
// is it directory?
if(is_dir($_POST['file'])){
echo 'file is directory <br />';
}
// is it file?
if(is_file($_POST['file'])){
echo 'file is a regular file <br />';
}
// is it a link?
if(is_link($_POST['file'])){
echo 'file is a symbolic link <br />';
}
// is it executable?
if(is_executable($_POST['file'])){
echo 'file is executable <br />';
}
// is it readable?
if(is_readable($_POST['file'])){
echo 'file is readable <br />';
}
// it is writable?
if(is_writable($_POST['file'])){
echo 'file is writable <br />';
}
}
else{
echo 'file does not exist! <br />';
}
}
?>
</body>
</html>
No comments:
Post a Comment