hlmod.hu
https://hlmod.hu/

PHP
https://hlmod.hu/viewtopic.php?f=18&t=3835
Oldal: 1 / 2

Szerző:  BeepBeep [2012.03.24. 15:41 ]
Hozzászólás témája:  PHP

adott egy szerveren lévő "x" nevű mappa, és "a" és "b" nevű fájl
ezt akarom megnyitni weboldalról, úgy, hogy a php kód kilistázza az x mappában lévő fájlokat, és választhatunk, hogy az "a" vagy a "b" fájlt nyissuk meg!
Az oldal szerverén van ez a mappa is és a fájlok is.

Szerző:  BeepBeep [2012.03.24. 22:25 ]
Hozzászólás témája:  Re: PHP

valaki? ;)

Szerző:  Silent [2012.03.25. 07:04 ]
Hozzászólás témája:  Re: PHP

BeepBeep írta:
valaki? ;)

De már kérdeztem chaten is, hogy ez vmi txt fájl? Tehát ki kell belôle olvasni, vagy vmi exe h elkell inditani?(utóbbi ritkán engedett xD)

Szerző:  Silent [2012.03.25. 07:21 ]
Hozzászólás témája:  Re: PHP

Egyébként a kilistázós része egy kis htmlel együtt:
Kód:

<?php
function get_directory_file($path)
{
$path_id opendir($path);
while(
$file_name readdir($path_id))
{
if(
$file_name != "." and$file_name != "..")
{
$file["type"] = filetype($path "/"$file_name);
if(
$file["type"] == "dir")
{
$file_array get_directory_file($path "/"
$file_name);
if(isset(
$found))
{
$found array_merge($found,$file_array);
}
else
{
$found $file_array;
}
}
else
{
$file["accessed"] = fileatime($path"/" $file_name);
$file["changed"] = filectime($path"/" $file_name);
$file["group"] = filegroup($path ."/" $file_name);
$file["inode"] = fileinode($path ."/" $file_name);
$file["modified"] = filemtime($path "/" .$file_name);
$file["owner"] = fileowner($path ."/" $file_name);
$file["permissions"] = fileperms($path "/" .$file_name);
$file["size"] = filesize($path "/" .$file_name);
$found[$path][$file_name] = $file;
}
}
}
closedir($path_id);
if(!isset(
$found))
{
$found = array();
}
return(
$found);
}
?>
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</head>
<body>
<?php
$found 
get_directory_file($path);
reset($found);
print(
"<table border=\\\\\\\"3\\\\\\\\"><tr>< td><em>Mappa</em></td>"
"<td><em>Név</em></td>< td><em>Típus</em></td></tr>");
while(list(
$d$dv) = each($found))
{
if(
is_array($dv))
{
while(list(
$f$fv) = each($dv))
{
print(
"<tr><td>" $d "</td><td>" $f "</td>"
"<td>" $fv "</td></tr>");
}
}
else
{
print(
"<tr><td>" $d "</td><td>" $dv "</td>"
"<td>&nbsp;</td></tr>");
}
}
print(
"</table>");
?>
</body>
</html>


Persze ebbôl egy rakat oszlop neked nemkell, mint pl h utcsóra módosított stb...
Segítség: $path a mappaneve.(ne írd át h $asd, hanem deklaráld: $path = asd)

Szerző:  BeepBeep [2012.03.25. 18:14 ]
Hozzászólás témája:  Re: PHP

megskubizom
webmodra kell, szóval úgy kéne összeoperálni :)

Szerző:  BeepBeep [2012.03.25. 20:17 ]
Hozzászólás témája:  Re: PHP

[spoiler]
Silent írta:
Egyébként a kilistázós része egy kis htmlel együtt:
Kód:

<?php
function get_directory_file
($path)
{
$path_id = opendir($path);
while(
$file_name = readdir($path_id))
{
if(
$file_name != "." and$file_name != "..")
{
$file["type"] = filetype($path . "/". $file_name);
if(
$file["type"] == "dir")
{
$file_array = get_directory_file($path . "/"
. $file_name);
if(isset(
$found))
{
$found = array_merge($found,$file_array);
}
else
{
$found = $file_array;
}
}
else
{
$file["accessed"] = fileatime($path. "/" . $file_name);
$file["changed"] = filectime($path. "/" . $file_name);
$file["group"] = filegroup($path ."/" . $file_name);
$file["inode"] = fileinode($path ."/" . $file_name);
$file["modified"] = filemtime($path . "/" .$file_name);
$file["owner"] = fileowner($path ."/" . $file_name);
$file["permissions"] = fileperms($path . "/" .$file_name);
$file["size"] = filesize($path . "/" .$file_name);
$found[$path][$file_name] = $file;
}
}
}
closedir($path_id);
if(!isset(
$found))
{
$found = array();
}
return(
$found);
}
?>
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</head>
<body>
<?php
$found 
= get_directory_file($path);
reset($found);
print(
"<table border=\\\\\\\"3\\\\\\\\"><tr>< td><em>Mappa</em></td>"
. "<td><em>Név</em></td>< td><em>Típus</em></td></tr>");
while(list(
$d, $dv) = each($found))
{
if(
is_array($dv))
{
while(list(
$f, $fv) = each($dv))
{
print(
"<tr><td>" . $d . "</td><td>" . $f . "</td>"
. "<td>" . $fv . "</td></tr>");
}
}
else
{
print(
"<tr><td>" . $d . "</td><td>" . $dv . "</td>"
. "<td>&nbsp;</td></tr>");
}
}
print(
"</table>");
?>
</body>
</html>


Persze ebbôl egy rakat oszlop neked nemkell, mint pl h utcsóra módosított stb...
Segítség: $path a mappaneve.(ne írd át h $asd, hanem deklaráld: $path = asd)
[/spoiler]

Parse error: syntax error, unexpected T_LNUMBER in /index.php on line 53
ha megadok egy $patch = Teszt mappát, akkor az 5. sor a hibás..

Szerző:  Silent [2012.03.26. 21:10 ]
Hozzászólás témája:  Re: PHP

$path = "./mappa";

Szerző:  BeepBeep [2012.03.26. 21:17 ]
Hozzászólás témája:  Re: PHP

Parse error: syntax error, unexpected T_LNUMBER in /index.php on line 54

[spoiler]
Kód:
<?php
function get_directory_file($path)
{
$patch = "./Teszt";
$path_id = opendir($path);
while($file_name = readdir($path_id))
{
if($file_name != "." and$file_name != "..")
{
$file["type"] = filetype($path . "/". $file_name);
if($file["type"] == "dir")
{
$file_array = get_directory_file($path . "/"
. $file_name);
if(isset($found))
{
$found = array_merge($found,$file_array);
}
else
{
$found = $file_array;
}
}
else
{
$file["accessed"] = fileatime($path. "/" . $file_name);
$file["changed"] = filectime($path. "/" . $file_name);
$file["group"] = filegroup($path ."/" . $file_name);
$file["inode"] = fileinode($path ."/" . $file_name);
$file["modified"] = filemtime($path . "/" .$file_name);
$file["owner"] = fileowner($path ."/" . $file_name);
$file["permissions"] = fileperms($path . "/" .$file_name);
$file["size"] = filesize($path . "/" .$file_name);
$found[$path][$file_name] = $file;
}
}
}
closedir($path_id);
if(!isset($found))
{
$found = array();
}
return($found);
}
?>
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</head>
<body>
<?php
$found = get_directory_file($path);
reset($found);
print("<table border=\\\\\\\\"3\\\\\\\\"><tr><td><em>Mappa</em></td>"
. "<td><em>Név</em></td>< td><em>Típus</em></td></tr>");
while(list($d, $dv) = each($found))
{
if(is_array($dv))
{
while(list($f, $fv) = each($dv))
{
print("<tr><td>" . $d . "</td><td>" . $f . "</td>"
. "<td>" . $fv . "</td></tr>");
}
}
else
{
print("<tr><td>" . $d . "</td><td>" . $dv . "</td>"
. "<td>&nbsp;</td></tr>");
}
}
print("</table>");
?>
</body>
</html>
[/spoiler]
szolgáltató okozhatja?

Szerző:  Metal [2012.03.27. 08:31 ]
Hozzászólás témája:  Re: PHP

Parse error: syntax error

BeepBeep írta:
Parse error: syntax error, unexpected T_LNUMBER in /index.php on line 54

[spoiler]
Kód:
<?php
function get_directory_file($path)
{
$patch = "./Teszt";
$path_id = opendir($path);
while($file_name = readdir($path_id))
{
if($file_name != "." and$file_name != "..")
{
$file["type"] = filetype($path . "/". $file_name);
if($file["type"] == "dir")
{
$file_array = get_directory_file($path . "/"
. $file_name);
if(isset($found))
{
$found = array_merge($found,$file_array);
}
else
{
$found = $file_array;
}
}
else
{
$file["accessed"] = fileatime($path. "/" . $file_name);
$file["changed"] = filectime($path. "/" . $file_name);
$file["group"] = filegroup($path ."/" . $file_name);
$file["inode"] = fileinode($path ."/" . $file_name);
$file["modified"] = filemtime($path . "/" .$file_name);
$file["owner"] = fileowner($path ."/" . $file_name);
$file["permissions"] = fileperms($path . "/" .$file_name);
$file["size"] = filesize($path . "/" .$file_name);
$found[$path][$file_name] = $file;
}
}
}
closedir($path_id);
if(!isset($found))
{
$found = array();
}
return($found);
}
?>
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</head>
<body>
<?php
$found = get_directory_file($path);
reset($found);
print("<table border=\\\\\\\\"3\\\\\\\\"><tr><td><em>Mappa</em></td>"
. "<td><em>Név</em></td>< td><em>Típus</em></td></tr>");
while(list($d, $dv) = each($found))
{
if(is_array($dv))
{
while(list($f, $fv) = each($dv))
{
print("<tr><td>" . $d . "</td><td>" . $f . "</td>"
. "<td>" . $fv . "</td></tr>");
}
}
else
{
print("<tr><td>" . $d . "</td><td>" . $dv . "</td>"
. "<td>&nbsp;</td></tr>");
}
}
print("</table>");
?>
</body>
</html>
[/spoiler]
szolgáltató okozhatja?

Szerző:  BeepBeep [2012.03.27. 14:21 ]
Hozzászólás témája:  Re: PHP

Nem értem, mi a probléma
googlen rákerestem mi ez a hiba, túl sok <> ilyesmi lehet, de én hülye vagyok ehhez ma..

Oldal: 1 / 2 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/