k ,I will explain
I have a web server (with apache,php ,mysql ) more simple xampp, on windows 7
I have a code and with it I can see,modify,copy,download files from local directory(from server),from another pc
I ask if there is a way so I can download ,and see files from ps3 when access my web server???
this is the code
<?php
$allowed_dir = "lang"; //Set the allowed path (Chmod them first)
//Allowed extensions
$valid_ext[1] = "php";
$valid_ext[2] = "PHP";
$valid_ext[3] = "html";
$valid_ext[4] = "HTML";
function directory($directory, $recursive) {
$me = basename($_SERVER['PHP_SELF']);
$array_items = array();
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != $me && substr($file,0,1) != '.') {
if (is_dir($directory. "/" . $file)) {
if($recursive) {
$array_items = array_merge($array_items, directory($directory. "/" . $file, $recursive));
}
} else {
$file = $directory . "/" . $file;
$array_items[] = preg_replace("/\/\//si", "/", $file);
}
}
}
closedir($handle);
asort($array_items);
}
return $array_items;
}
$HTMLOUT ='';
$HTMLOUT .= "<form action='editor.php' method='post'>";
$HTMLOUT .= "<select name='target_file'><option value='0'>Please choose a file to open</option>";
$filelist = directory($allowed_dir, true);
foreach ($filelist as $file)
{
$ext = substr(strrchr($file, '.'), 1);
if (in_array($ext,$valid_ext) && is_writable($file)) {
$HTMLOUT .= "<option value=\"$file\">$file</option>";
}
}
$HTMLOUT .= "</select><input type='submit' class='btn' value='Select!' /></form>";
if (isset($_POST['file_to_edit'])){
$nombre_fichero = stripslashes($_POST['file_to_edit']);
$DescriptorFichero = fopen($nombre_fichero,"w");
$string = stripslashes($_POST['edit_file']);
fwrite($DescriptorFichero,$string);
@fclose($DescriptorFichero);
}
if (isset($_POST['target_file'])){
$target_file = stripslashes($_POST['target_file']);
$fichero_texto = fopen ($target_file, "r");
$contenido_fichero =
@
Fre
ad ($fichero_texto, filesize($target_file));
$HTMLOUT .= "<div style='text-align:center;width:80%;border:none;'>
<div style='background:lightgrey;height:20px;'>
<span style='font-weight:bold;font-size:10pt;'>Editing File: {$target_file}</span></div></div><br/>";
$HTMLOUT .= "<form enctype='multipart/form-data' method='post' action='editor.php'>";
$HTMLOUT .= "<input type='hidden' name='file_to_edit' value='{$target_file}' />";
$HTMLOUT .= "<table class='main' width='80%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td class='embedded'>
<table width='100%' border='1' cellspacing='0' cellpadding='2'>
<tr><td align='center' class='colhead'><h2>File Editor</h2></td></tr>
<tr>
<td><textarea name='edit_file' rows='30' cols='117'>" . htmlspecialchars($contenido_fichero) . "
</textarea></td></tr>
<tr><td align='center'><input type='submit' class='btn' value='Edit!' /></td></tr></table>
</td></tr></table></form>";
}
print $HTMLOUT ;