/    Sign up×
Community /Pin to ProfileBookmark

Directory lister, Identify Folder diff than File

Good day to you all,

I need to make the folder from my dir lister point to a link different of my files ?

I’m working with windows NT server… and php 4.3.2

Thanks !

Here is my code :

[code=php]<?php
$file = $_GET[‘file’];
if(isset($_POST[‘text’]))
{
if(get_magic_quotes_gpc())
{
$_POST[‘text’] = stripslashes($_POST[‘text’]);
}
$handle = fopen($file, ‘w’) or die(“Unable to open file for writing”);
fwrite($handle, $_POST[‘text’]);
fclose($handle);
}

$text = “”;

if(is_readable($file))
{
$text = file_get_contents($file);
}
?> [/code]

And later on the page in the html part :

[code=php]<textarea class=”zz” name=”text” id=”text” cols=170 rows=10 wrap=”off”><?php echo $text; ?></textarea></td></tr>[/code]

and to add anothe challenge I need it to open in another frame wich is the verticaly siding this one.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@bokehMay 05.2006 — just check with is_file() or is_dir() to be certain which of the two it is.
Copy linkTweet thisAlerts:
@PeuplarchieauthorMay 05.2006 — All right,

I'm bretty new learnner and I wondering if I'm better with a "for" or impliment it in my "if...else" or should I put "else if" ?

Here the rest of...

[code=php]
<?
function directory($result) {

$handle=opendir(".");
while ($file = readdir($handle)) {
if ($file == "." || $file == ".." || $file == "dirlist.php") { } else { print "<tr><td width=100% bgcolor='#cccc99'><a href=indexedit.php?file=$file target='affiche' class='black'><img src='file.jpg' border=0>$file</a></td></tr>n"; }

}
closedir($handle);

return $result;
}
?>
[/code]
Copy linkTweet thisAlerts:
@bokehMay 05.2006 — All right,

I'm bretty new learnner and I wondering if I'm better with a "for" or impliment it in my "if...else" or should I put "else if" ?

Here the rest of...

[code=php]
<?
function directory($result) {

$handle=opendir(".");
while ($file = readdir($handle)) {
if ($file == "." || $file == ".." || $file == "dirlist.php") { } else { print "<tr><td width=100% bgcolor='#cccc99'><a href=indexedit.php?file=$file target='affiche' class='black'><img src='file.jpg' border=0>$file</a></td></tr>n"; }

}
closedir($handle);

return $result;
}
?>
[/code]
[/QUOTE]

Why does your function have a result variable if you don't do anything with it? Also a directory should be read thus:[code=php]while (false !== ($file = readdir($handle))) { [/code]
×

Success!

Help @Peuplarchie spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...