Re: [PHP] Directory permissions question

2010-04-19 Thread Peter Lind
On 19 April 2010 17:18, Al  wrote:
>
>
> On 4/19/2010 11:11 AM, Adam Richardson wrote:
>>
>> On Mon, Apr 19, 2010 at 10:59 AM, Al  wrote:
>>
>>> I'm working on a hosted website that was hacked and found something I
>>> don't
>>> fully understand. Thought someone here may know the answer.
>>>
>>> The site has 4 php malicious files in directories owned by "system" [php
>>> created dirs on the site are named "nobody"] and permissions 755.
>>>
>>> Is there any way the files could have been written other than by ftp
>>> access
>>> or at the host root level? Clearly a php script couldn't.
>>>
>>> Thanks, Al..
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>> Are there any other programming options enabled on the account (Perl, JSP,
>> Ruby, etc?)  Even if the files are PHP, any of those programming options
>> can
>> be configured to create the files.
>>
>> Additionally, a vulnerability in one of the libraries leveraged to provide
>> the hosting environment could also have provided the entry (PHP makes for
>> a
>> capable deliverable, but it doesn't have to provide the key for a hacking
>> situation.)
>>
>> Adam
>>
>
> Are Perl, JSP, Ruby, etc. able to ignore the dir ownership and write
> permissions on a Linux/Apache system?
>

I've seen an install of Trac hacked by a file-upload - it managed to
write a cron job, which then wrote to other files. It's not just a
question of whether your Apache server has the correct
rights/permissions, it's equally a question of: is any other part of
the system getting used against me.

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory permissions question

2010-04-19 Thread Al Rider

Apache 2.0.63
php 5.2.8

I know both are obsolete and need updating. I told my client to request 
same from their ISP.


Al

On 4/19/2010 12:01 PM, Jim Lucas wrote:

Al wrote:
   

I'm working on a hosted website that was hacked and found something I
don't fully understand. Thought someone here may know the answer.

The site has 4 php malicious files in directories owned by "system" [php
created dirs on the site are named "nobody"] and permissions 755.

Is there any way the files could have been written other than by ftp
access or at the host root level? Clearly a php script couldn't.

Thanks, Al..

 

What version of Apache/PHP is it running?

   


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory permissions question

2010-04-19 Thread Jim Lucas
Al wrote:
> I'm working on a hosted website that was hacked and found something I
> don't fully understand. Thought someone here may know the answer.
> 
> The site has 4 php malicious files in directories owned by "system" [php
> created dirs on the site are named "nobody"] and permissions 755.
> 
> Is there any way the files could have been written other than by ftp
> access or at the host root level? Clearly a php script couldn't.
> 
> Thanks, Al..
> 

What version of Apache/PHP is it running?

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory permissions question

2010-04-19 Thread Al



On 4/19/2010 11:11 AM, Adam Richardson wrote:

On Mon, Apr 19, 2010 at 10:59 AM, Al  wrote:


I'm working on a hosted website that was hacked and found something I don't
fully understand. Thought someone here may know the answer.

The site has 4 php malicious files in directories owned by "system" [php
created dirs on the site are named "nobody"] and permissions 755.

Is there any way the files could have been written other than by ftp access
or at the host root level? Clearly a php script couldn't.

Thanks, Al..

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Are there any other programming options enabled on the account (Perl, JSP,
Ruby, etc?)  Even if the files are PHP, any of those programming options can
be configured to create the files.

Additionally, a vulnerability in one of the libraries leveraged to provide
the hosting environment could also have provided the entry (PHP makes for a
capable deliverable, but it doesn't have to provide the key for a hacking
situation.)

Adam



Are Perl, JSP, Ruby, etc. able to ignore the dir ownership and write permissions 
on a Linux/Apache system?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory permissions question

2010-04-19 Thread Adam Richardson
On Mon, Apr 19, 2010 at 10:59 AM, Al  wrote:

> I'm working on a hosted website that was hacked and found something I don't
> fully understand. Thought someone here may know the answer.
>
> The site has 4 php malicious files in directories owned by "system" [php
> created dirs on the site are named "nobody"] and permissions 755.
>
> Is there any way the files could have been written other than by ftp access
> or at the host root level? Clearly a php script couldn't.
>
> Thanks, Al..
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Are there any other programming options enabled on the account (Perl, JSP,
Ruby, etc?)  Even if the files are PHP, any of those programming options can
be configured to create the files.

Additionally, a vulnerability in one of the libraries leveraged to provide
the hosting environment could also have provided the entry (PHP makes for a
capable deliverable, but it doesn't have to provide the key for a hacking
situation.)

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] Directory

2008-02-08 Thread Richard Lynch


On Thu, February 7, 2008 12:30 pm, Steve Marquez wrote:
> Greetings,
>
> Could someone please point me in the right direction? I am trying to
> have
> PHP find out if a directory has files in it and then if it does,
> display and
> include, if it does not, then not display the include.
>
> I have looked at the Manual and did not really know where to look.

http://php.net/opendir
http://php.net/readdir
";
include $f;
  }
?>
-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory

2008-02-07 Thread Jim Lucas

Steve Marquez wrote:

Greetings,

Could someone please point me in the right direction?


Turn left at the next light...


I am trying to have
PHP find out if a directory has files in it and then if it does, display 


Display what?  The directory name, or the list of files?

and include, 


What do you mean by include?  the include command from PHP?

if it does not, then not display the include.

Again, what do you mean exactly?


I have looked at the Manual and did not really know where to look.


Which part of the manual did you look at?

Here are a few parts of the manual that I would start with.

This will get you a complete list of files, directories, etc... in a given 
directory
http://us2.php.net/manual/en/function.glob.php

This class allows you retrieve and iterate through a directory listing.
http://us2.php.net/manual/en/class.dir.php

Between the above two options, I recommend glob()

Now loop through the results with foreach or while .

http://us3.php.net/manual/en/control-structures.foreach.php
http://us3.php.net/manual/en/control-structures.while.php

run the following two commands on each value of the given array to determine 
whether the given entry is a file, directory, or something else


This will allow you to determine if something is a file
http://us2.php.net/manual/en/function.is-file.php

This will allow you to determine if something is a directory
http://us2.php.net/manual/en/function.is-dir.php

if you found a directory, use this to change to that directory and start the 
process all over again.


This will allow you to change your current working directory to a new directory
http://us2.php.net/manual/en/function.chdir.php

Hope these help


Thanks,

--
Steve M.




--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory

2008-02-07 Thread Paul Scott

On Thu, 2008-02-07 at 12:30 -0600, Steve Marquez wrote:
> Could someone please point me in the right direction? I am trying to have
> PHP find out if a directory has files in it and then if it does, display and
> include, if it does not, then not display the include.

oooh, goodie! You get to play with my new favourite toys - SPL!

Try this:

public function lsDir($dir, $type='files')
{
$iterator = new RecursiveDirectoryIterator($dir);
foreach (new RecursiveIteratorIterator($iterator, 
RecursiveIteratorIterator::CHILD_FIRST) as $file)
{
if ($file->isDir()) {
$dirs[] = $file->getPathname();
} else {
$files[] = $file->getPathname();
}
}
if($type = 'files')
{
return $files;
}
else {
return $dirs;
}
}

(untested - written from mind dump - so please test 1st)

Then, AFAIK SPL also has an __autoload that you can use.

> I have looked at the Manual and did not really know where to look.
> 

http://www.php.net/spl

--Paul

-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] directory modification dates

2007-10-19 Thread Robert Cummings
On Sat, 2007-10-20 at 01:36 +0300, Marek wrote:
> I have a simple directory listing script - you can move up and down
> directories and it shows the files/dirs inside. Now I have to figure out
> a way to display the latest modification time for each directory.
> 
> The problem is that filemtime() works only if the modifications are done
> on the first level. For example, if I add files in dir1/dir2/dir3/, then
>  the modification time for dir1 doesn't update.
> 
> My first instinct was to find the correct time recursively on each load
> but there are so many files and so many visitors that it clogs the
> server. I have a few other ideas but they seem rather ugly (like hidden
> files with stored info in each directory).
> 
> Can you suggest any better ways to approach this problem?

When a file is uploaded/changed ascend the directory tree and touch()
each of the directories.

http://ca.php.net/manual/en/function.touch.php

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Directory List Script Files over 2 GB

2007-04-12 Thread Robert M

I made a few changes to the script using system calls and changed the
datatype to be a string on the sprintf portion of the script

I doubt it is the most intelligent method of resolving the issue, but
it got the job done.
I do not run this on an Internet site, just a local intranet website
that I use to monitor backups with so the overhead is minimal.
Added the following at the top of the script
// SYSTEM CALLS to get information from filesystem/file
   function GlobSize( $f )
   {
   $fsize = `ls -ltr $f |awk '{print $5}'`;
   return $fsize;
   }

   function GlobDate( $f )
   {
   $fdate = `stat --printf %Y $f`;
   return $fdate;
   }

Modified code to call the two functions above.
stat --printf %y was used to correct the date which was reporting
incorrectly as Dec 31 69 on all files larger then 2 GB
the ls command to return bytes was used to allow the Javascript to do
the correct conversion later in the script.

   
else$files[]=array('name'=>$f,'size'=>GlobSize($path.$f),'date'=>GlobDate($path.$f),'url'=>trim("$root/$dir/".rawurlencode($f),'/'));

then modified the the sprintf to be a string for the instead of a d



Thank you all for helping

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Directory List Script Files over 2 GB

2007-04-11 Thread Richard Lynch
On Wed, April 11, 2007 3:36 pm, Robert M wrote:
> Does anyone else have any other ideas how to resolve this, I have
> tried
> multiple different methods all failed.
>
> Does the 2 GB limitation using filesize have an alternate method of
> producing the output. ?
>
> Thank you Logan for trying.

The first thing I'd recommend is writing a one-line test script that did:


As it stands now, I just deleted your emails as they were MUCH too
long...

That said, PHP will handle INT only up to ~2 billion, so I don't quite
know how it could come back as what you want, unless the function
returns 'text' datatype, which I doubt...

I do recall discussion of this and some kind of solutions from way
back when...

If nothing else, you could use http://php.net/exec to ask the OS how
big the file is, and bypass filesize altogether.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP Directory List Script Files over 2 GB

2007-04-11 Thread Robert M

Well it looks like I am forced to use a different approach do to the
limitations of PHP
http://bugs.php.net/bug.php?id=27792


This Bug has been around now for HOW long now.

Seems to me that it would have been addressed in the past few years,
Gigabyte files have been around a long time. Maybe not for the average
WEB server but for intranets wanting to display files and sizes


well I cant complain too much , this has taught me quite a bit on how
to do things using php.

The sprintf("%u", filesize($file))  does not appear to resolve this
issue either.
Thanks to all

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Directory List Script Files over 2 GB

2007-04-11 Thread Seak, Teng-Fong

Robert M wrote:

Does anyone else have any other ideas how to resolve this, I have tried
multiple different methods all failed.

Does the 2 GB limitation using filesize have an alternate method of
producing the output. ?

Thank you Logan for trying.

   I think you'd better file a bug report to PHP.  A lot of old/legacy 
applications were written in the period when Gigabytes is an 
astronomical number.  They're not supposed to support such a big number 
and need a rewrite.  PHP might be in this situation.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP Directory List Script Files over 2 GB

2007-04-11 Thread Robert M

Does anyone else have any other ideas how to resolve this, I have tried
multiple different methods all failed.

Does the 2 GB limitation using filesize have an alternate method of
producing the output. ?

Thank you Logan for trying.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory name

2006-11-01 Thread Ed Lazor
I don't think web browsers are going to send you the name of the  
directory the file comes from.



On Nov 1, 2006, at 10:50 AM, Sugrue, Sean wrote:

I'm trying retrieve a directory name and a filename with a form. I  
want
to use input type file so the user can browse for the file but keep  
the

whole directory name.
Any help
Sean

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory name

2006-11-01 Thread Richard Lynch
On Wed, November 1, 2006 12:50 pm, Sugrue, Sean wrote:
> I'm trying retrieve a directory name and a filename with a form. I
> want
> to use input type file so the user can browse for the file but keep
> the
> whole directory name.

I don't think you *can* get a directory name out of standard HTML inputs.

This is a big-time security/privacy issue -- It's none of your damn
business where I keep my files in my hard drive, thank you very much.
:-)

There may be some kind of badly-broken insecure ActiveX thingie to let
you do that...

The browser/OS already is configurable by the user to re-use their
last directory, or always start in "My Documents" (ugh!) or whatever
directory any other app. happened to use or whatever is suitable for
that OS.  Don't try to dink with that.  It's not within your pervue.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory Structure

2006-09-08 Thread Frank Arensmeier
I think that these kind of questions are very annoying - it is almost  
rude to post this to a list.


Why don't you

a) show that you have done some thinking
b) have at least scanned the manual
c) have asked Google.

/frank

8 sep 2006 kl. 07.12 skrev Manoj Singh:


Hello all,

I am developing a site in which i have to show the directory  
structure of
any server i.e the admin will enter any site name and i have to  
show the dir

structure of that site name.

Please help me to fix this.

Thanks & Regards
Manoj


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory Structure

2006-09-07 Thread Robert Cummings
On Fri, 2006-09-08 at 10:42 +0530, Manoj Singh wrote:
> Hello all,
> 
> I am developing a site in which i have to show the directory structure of
> any server i.e the admin will enter any site name and i have to show the dir
> structure of that site name.

Crawl baby, crawl! You need to load a page, grab the link references,
and then crawl each of those links. You will want to make sure you stay
on the same server (don't jump to URLs not matching the initial domain).
So that you don't bog down in recursion hell, I'd maintain a queue of
URLs still to be processed. And as you finish a page, grab the next
page. You are going to run into the problem of loops, in which case you
need a game plan for handling looped links. My suggestion is if the
target link already exists in your queue or processed list, then skip
it. So once you have all the links, just go ahead and split up the paths
into their respective parts and build the directory tree.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory Structure

2006-09-07 Thread Larry Garfield
On Friday 08 September 2006 00:12, Manoj Singh wrote:
> Hello all,
>
> I am developing a site in which i have to show the directory structure of
> any server i.e the admin will enter any site name and i have to show the
> dir structure of that site name.
>
> Please help me to fix this.

The following may prove useful:
http://us2.php.net/scandir
http://us2.php.net/manual/en/function.readdir.php
http://us2.php.net/manual/en/class.dir.php
http://us2.php.net/manual/en/spl (for very new PHP 5)

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] directory listing from text file

2005-05-18 Thread Richard Lynch
What I know about Windows mapped drives could fit in a matchbook with room
for every Playmate's phone number...

But the answer I always hear when people are trying to do what you are
trying to do is "Samba"

HTH

On Wed, May 18, 2005 7:37 am, dreiph said:
> Thank you Chris,
>
> but this is not I needed.
>
> Let me explain my situation.
>
> I have a big server with a lot of audio files, working within LAN, with
> Windows 2000 Pro on it. Let's call it as "FileServer". Also I have another
> server with Apache2 and PHP installed, windows 2000 PRO too, let's say it
> is
> "WebServer". Web Server is standalone with two NIC cards, firewall, etc. I
> don't want to make Fileserver be accessible form Internet.
>
> The problem is that PHP and/or Apache on WebServer does not understand
> mapped drives from a FileServer, so readdir() or opendir() is not working
> correctly, by the way, it looks like Windows "dir" command works a little
> bit faster than readdir();
>
> It take me some time to play with simple Windows command line utility, to
> get directory listing on FileServer and deliver plain text file to a
> WebServer. Command line was the following:
>
> exec('cmd /c dir /b /s /d /a:d \\\FileServer\\audiofiles >
> audiofiles.txt');
>
> $hi = fopen("audiofiles.txt", "r");
> $line = fread($hi,filesize("audiofiles.txt"));
> fclose($hi);
> $line=explode("\n", $line);
>
>
> At this point I've got FileServer directories [only directories, not
> files!]
> scanned into file audiofiles.txt and this file was written to a WebServer.
> So, I have plain text file with correct directory structure, including
> subdirectories.
>
> The problem is, that "dir" command in Windows command prompt scans
> directories in weird format - each directory in new line, eg:
>
> \first
> \second
> \second\first
> \second\second
> \third
>
> I immagine, to show directory tree, I need to make some like array in PHP,
> and I think, this should be a recursive function [could not find out how
> to
> write it]. So final variable should be array like this:
>
> $directories = Array('\\first', '\\second" => Array('\\first',
> '\\second'),
> '\\third');
>
> How??
>
> Thanks,
>
> Bye, Dreiph
>
>
> "Chris Ramsay" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> Dreiph,
>
> If you're familiar with PEAR, take a look at this:
>
> http://pear.php.net/package/HTML_TreeMenu
>
> regards
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] directory listing from text file

2005-05-18 Thread dreiph
Thank you Chris,

but this is not I needed.

Let me explain my situation.

I have a big server with a lot of audio files, working within LAN, with
Windows 2000 Pro on it. Let's call it as "FileServer". Also I have another
server with Apache2 and PHP installed, windows 2000 PRO too, let's say it is
"WebServer". Web Server is standalone with two NIC cards, firewall, etc. I
don't want to make Fileserver be accessible form Internet.

The problem is that PHP and/or Apache on WebServer does not understand
mapped drives from a FileServer, so readdir() or opendir() is not working
correctly, by the way, it looks like Windows "dir" command works a little
bit faster than readdir();

It take me some time to play with simple Windows command line utility, to
get directory listing on FileServer and deliver plain text file to a
WebServer. Command line was the following:

exec('cmd /c dir /b /s /d /a:d \\\FileServer\\audiofiles > audiofiles.txt');

$hi = fopen("audiofiles.txt", "r");
$line = fread($hi,filesize("audiofiles.txt"));
fclose($hi);
$line=explode("\n", $line);


At this point I've got FileServer directories [only directories, not files!]
scanned into file audiofiles.txt and this file was written to a WebServer.
So, I have plain text file with correct directory structure, including
subdirectories.

The problem is, that "dir" command in Windows command prompt scans
directories in weird format - each directory in new line, eg:

\first
\second
\second\first
\second\second
\third

I immagine, to show directory tree, I need to make some like array in PHP,
and I think, this should be a recursive function [could not find out how to
write it]. So final variable should be array like this:

$directories = Array('\\first', '\\second" => Array('\\first', '\\second'),
'\\third');

How??

Thanks,

Bye, Dreiph


"Chris Ramsay" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Dreiph,

If you're familiar with PEAR, take a look at this:

http://pear.php.net/package/HTML_TreeMenu

regards

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] directory listing from text file

2005-05-18 Thread Chris Ramsay
Dreiph,

If you're familiar with PEAR, take a look at this:

http://pear.php.net/package/HTML_TreeMenu

regards

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory perms

2005-04-14 Thread Jason Wong
On Thursday 14 April 2005 22:25, Reynier Perez Mira wrote:
> How I can obtain directory perms and how I know if they are RW on Win32
> plattforms? I find into PHP Manual but I only obtain function fileperms
> wich have only for files and not for directories

fileperms() works on files AND directories (and in fact the examples shows 
that). is_readable() and is_writeable() also works on files/dirs.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory and file permissions on a virtual host

2005-03-14 Thread Richard Lynch
> Would some please provide me some simple rules for dealing with php
> scripts to
> fopen(), copy() and move_uploaded_file().
>
> Environment is Linux, Apache on a virtual host
>
> I've spent a lot of time goggling, etc. and can find lot's of explanations
> for
> owner, group and world.  They sound great; but don't work for me.
>
> This stuff worked on our previous host, it simply assigned  "customer" to
> everything

Your current host has given you TWO different usernames, sort of.

One is the one you use to login to the shell.  This is probably something
like 'al' or 'ridersite' or some variant on your name/site.

The other is the one running Apache/PHP.  This is probably 'nobody' or
'apache' or 'www' or something like that.

If you want PHP from the web to be able to do something to a file, you
need to make that file owned by the Apache user.

> Here is my directory structure and permissions:
>
> /foo [user accessed php scripts] permissions= 755
> /foo/data [simple text files] permissions = 777
> files in /data permissions= 644
>
> Have tried lots of other dir and file permissions
>
> owerships are our site handle.

Here's what you do to get a whole directory OWNED by the PHP user:

Step 1: TEMPORARILY make a directory world-writable with "chmod 777 xxx"
Step 2: Write a PHP script to create a directory (http://php.net/mkdir)
*inside* that directory: 
Step 3: Change xxx back to sensible permissions: "chmod 755 xxx"

Ideally, you would make this directory owned by PHP *not* in your web
tree, but in some other directory.

You would then write PHP scripts to provide access to that directory.

Those scripts would then contain code to make *SURE* the content you were
sending out "looked right"

The reason for this is that the php_owned directory can be altered by
*ANYBODY* who can write a PHP script on your server.

So if you have some cross-checks in your scripts before you serve up the
content, you can "catch" that kind of thing.

You can cross-reference the files in that directory with records in a
database of what you expect to be there.

You can make sure that images "look" like image files with
http://php.net/imagegetsize

In your case, you could store the last known size of the file in your
database, and check that right before you append to make sure somebody
else hasn't snuck some data in there.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory Entries

2004-11-09 Thread Jason Wong
On Tuesday 09 November 2004 17:09, Dave Lampron wrote:
> Hello I'm having problems with the following code:
>
> if (! ($dp =  opendir($imagesdir))) die ("cannot open $imagesdir.");
> while($file = readdir($dp))
> {
>  if ($file != '.' && $file != '..')
>  {
>
>  ///Second test doesn't seem to catch sub-directories under $imagesdir
>   if(is_dir($file)) / This is not evaluating properly!!!

Use an absolute path, or if you know your current working directory prepend 
the relative path.

>echo filesize($file); / This is not evaluating properly either!!!

Ditto.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Anger kills as surely as the other vices.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] directory listing

2003-08-19 Thread Marek Kilimajer
Wrong place, look at directory functions ;)

Matthias Wulkow wrote:

Hi php-general,

I'm reading through the filesystem function of php and I can't find
any function which will list me all the files which are in a certain
directory. Am I blind or do I have to "create" myself one?
Thanks for help

M. W.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Directory Size

2003-08-15 Thread Chris Blake
On Fri, 2003-08-15 at 12:36, Marek Kilimajer wrote:
> Are you sure it hangs? It might take a long time to get occupied size. 
> This also depends on the filesystem used, I heard reserfs is best at this.
> 
Well, I thought it was hanging cuz 15 mins went past without any
return...then I figured it had something to do with the fact that its
reading 20Gb of directories and files...

I`m busy investigating some other options :
`du $file -c` seems to workI`ll try playing around a bit and will
report back later...

I`m not sure what you mean re the filsystem type, I`m using MDK, which I
understand uses ext3 (newbie)

Thanks for trying to assist...
-- 
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379

If we men married the women we deserved, we should have a very bad time
of it.
-- Oscar Wilde


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory Size

2003-08-15 Thread Marek Kilimajer
Are you sure it hangs? It might take a long time to get occupied size. 
This also depends on the filesystem used, I heard reserfs is best at this.

Chris Blake wrote:
Greetings learned PHP(eople);

Is there a way to calculate the size of directory in PHP ?

I searched php.net and only found ways of opening directories and
reading file sizes
One suggestion on there was to do the following :

$mstrng = shell_exec('du -sc /backup/');
echo '' . $mstrng . '';
When I do that my browser hangs endlesslymind you, it also hangs
when I run du -sc from the command line...
Any pointers muchly appreciated...



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] directory size?

2003-04-03 Thread Ernest E Vogelsinger
At 00:40 04.04.2003, Mantas Kriauciunas said:
[snip]
>Hey
>I looked up in the manual but found only 
>Disk_total_space
>Disk_free_space
>
>Is there anything like total_space for directory?
>Or I will have to think of something else?
>Like counting every file size and adding it to total.
>But if there is like 1000 files with directories in the main directory.
>It will take time to count files from all the directories and output
>total size of the main directory.
[snip] 

In case you're on Linux, and may run externals, you could
du -s . (prints kilobytes)
du -s -b (prints bytes)

list($dusage, $dir) = explode(' ', `du -s -b .`);
echo sprintf('The current directory has %d kB (%d bytes)', $dusage / 1024,
$dusage);


-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory Permissions?

2003-02-26 Thread Chris Shiflett
--- Jay Paulson <[EMAIL PROTECTED]> wrote:
> I was running fileperms() function to find out what a directory is
> chmod'ed to.

Just so you know, chmod is "change mode". I understand what you mean, though;
you are wanting to know the permissions of a directory.

> However, this doesn't return anything because it has to check a file.

Are you sure that is why? Be sure before you start telling us what is wrong. I
disagree with your assumption here.

> My question is there a function that will return what a directory is
> chmod'ed to?

The one you tried works just fine:

http://www.php.net/manual/en/function.fileperms.php

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Directory size

2003-02-11 Thread Jeff Pauls
You can try something like this. 

$dir = "dir";

function dirsize($checkdir) {
$dh = opendir($checkdir);
$size = 0;
while (($file = readdir($dh)) !== false)
if ($file != "." and $file != "..") {
$path = $checkdir."/".$file;
if (is_dir($path))
$size += dirsize($path);
elseif (is_file($path))
$size += filesize($path);
}
closedir($dh);
 $formated_size = $size /1000;
return $formated_size;
}

$getFolderSize = dirsize("/files/personal");


Jeff



- Original Message - 
From: "Marek Kilimajer" <[EMAIL PROTECTED]>
To: "Antti" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, February 03, 2003 4:37 AM
Subject: Re: [PHP] Directory size


> there is no php function for this, you can use unix command du or do it 
> in a loop
> 
> Antti wrote:
> 
> > How do I get the directory size? Suppose there is a function for this.
> >
> > antti
> >
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Directory size

2003-02-03 Thread Marek Kilimajer
there is no php function for this, you can use unix command du or do it 
in a loop

Antti wrote:

How do I get the directory size? Suppose there is a function for this.

antti





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] directory listing

2003-01-09 Thread Jason Wong
On Thursday 09 January 2003 16:29, Aleš Lončar wrote:
> Hi!
>
> I have one question.
> How can I get sorted listing of a direcorty with readdir function? Is this
> possible 

No, not with readdir() on its own.

> or I have to write custom function using array function sort?

Yes, that is what you would have to do. Check out the user notes on the online 
manual. I think someone has posted some code that you can use or adapt.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
One has to look out for engineers -- they begin with sewing machines
and end up with the atomic bomb.
-- Marcel Pagnol
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Directory Listing with php on unix boxes

2003-01-08 Thread Krzysztof Dziekiewicz
> Here is where I'm running into some problems.  I need the file listing to be
> sorted as if I were performing an 'ls -lt' listing on the server itself.

I do not think opendir() or readdir() quarantees any sort. You where
lucky rather you got dirs in the time order. You should use
filemtime() or something like this to sort dirs.

-- 
Krzysztof Dziekiewicz


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] directory list function?

2002-12-27 Thread Maciek Ruckgaber Bielecki

o of course !!
mine won't work in !UNIX ;-)

On Fri, 27 Dec 2002, Johannes Schlueter wrote:

> On Friday 27 December 2002 21:46, Maciek Ruckgaber Bielecki wrote:
> > depending on what you need, sometimes this does the trick for me :-)
> >
> >exec("ls path/",$files);
> >
> > foreach($files as $value)
> > {
> >   $elem .= $value."\n";
> > }
> >
> >echo $elem;
>
> This should
>
>$i=0;
>   if ($dir = opendir('/insert/directory/name/here')) {
> while (($file = readdir($dir)) !== false) {
>   $i++;
> }
> closedir($dir);
>   }
> ?>
> (ok, this one counts even . and ..)
> johannes
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] directory list function?

2002-12-27 Thread Maciek Ruckgaber Bielecki

depending on what you need, sometimes this does the trick for me :-)

   exec("ls path/",$files);

foreach($files as $value)
{
  $elem .= $value."\n";
}

   echo $elem;



--
"Few are those who see with their own eyes and feel with their own
hearts."
Albert Einstein
-
Maciek Ruckaber Bielecki



On Fri, 27 Dec 2002, Dade Register wrote:

> A question for you all. Is there a php function that
> could count the number of files in a dir? Using
> FreeBSD and php4.2.2 and Apache. Thanx.
> -Dade
>
> __
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] directory list function?

2002-12-27 Thread Kevin Stone
There is no builtin function to do this  in one step but it's not in anyway
difficult..
http://www.php.net/manual/en/function.opendir.php
-Kevin

- Original Message -
From: "Dade Register" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 27, 2002 1:34 PM
Subject: [PHP] directory list function?


> A question for you all. Is there a php function that
> could count the number of files in a dir? Using
> FreeBSD and php4.2.2 and Apache. Thanx.
> -Dade
>
> __
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] directory help

2002-08-21 Thread Jason Wong

On Thursday 22 August 2002 10:12, Randy Johnson wrote:
> I need some help,
>
> I need to go through a number of directories and rename each of the files
> like this
>
> img001
> img002
> img003
>
> do dir 1 would have
>
> img001
> img002
> img003
>
> directory 2 might have
> img004
> img005
>
> and directory 3 would have
> img006
> img007
> img008

Where is your question?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
According to the obituary notices, a mean and unimportant person never dies.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Directory System Splitter

2002-04-27 Thread Paul Roberts

search zend.com for breadcrumbs

- Original Message - 
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 27, 2002 2:01 PM
Subject: Re: [PHP] Directory System Splitter


> On Saturday 27 April 2002 20:34, Randum Ian wrote:
> 
> [snip]
> 
> > For example:
> >
> > http://www.danceportal.co.uk/diary/2002/may/
> >
> > has this in the panel:
> >
> > Home / Diary / 2002 / May /   <-- These are links back down the system of
> > directories.
> >
> > http://www.danceportal.co.uk/charts/randumian/mon-22-apr-2002.php
> >
> > has this:
> >
> > Home / Charts / Randum Ian / Monday, April 22, 2002
> >
> > Is it possible to automate this in a template so that it can work out where
> > it is and create the correct links?
> 
> Yes.
> 
> 
>http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html
> 
> 
> Presumably you want to know *how* to do it?
> 
> Use phpinfo() to see what predefined vars you can use to get your document 
> path. Then probably use explode() to get the individual components of the 
> path.
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> 
> /*
> Are we not men?
> */
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Directory System Splitter

2002-04-27 Thread Jason Wong

On Saturday 27 April 2002 20:34, Randum Ian wrote:

[snip]

> For example:
>
> http://www.danceportal.co.uk/diary/2002/may/
>
> has this in the panel:
>
> Home / Diary / 2002 / May /   <-- These are links back down the system of
> directories.
>
> http://www.danceportal.co.uk/charts/randumian/mon-22-apr-2002.php
>
> has this:
>
> Home / Charts / Randum Ian / Monday, April 22, 2002
>
> Is it possible to automate this in a template so that it can work out where
> it is and create the correct links?

Yes.

http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html


Presumably you want to know *how* to do it?

Use phpinfo() to see what predefined vars you can use to get your document 
path. Then probably use explode() to get the individual components of the 
path.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Are we not men?
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Directory

2002-04-18 Thread Demitrious S. Kelly

Use the dir class

-Original Message-
From: Jeroen Timmers [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 16, 2002 4:57 AM
To: [General]
Subject: [PHP] Directory

Hello,

can i read a directory for files and other directory's with a php
function

for exameple

d:\localhost\

had the follow dirs and files

test.php
test2.php
\test\
\test2\

now i want that in my browser with a php function

Jeroen


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Directory check

2002-04-08 Thread Jason Wong

On Monday 08 April 2002 22:15, Hiroshi Ayukawa wrote:
> Does anyone know how to check a directory exiasts?
>
> Thanks in advance,
> Hiroshi Ayukawa
> http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top

Manual > Filesystem functions


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
When the revolution comes, count your change.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Directory check

2002-04-08 Thread Rénald CASAGRAUDE

Le lundi 8 avril 2002, à 04:15 PM, Hiroshi Ayukawa a écrit :

> Does anyone know how to check a directory exiasts?

RTFM !!

try this :

if (file_exists($dir) && is_dir($dir)) {
echo $dir.' is a directory !';
}


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Directory to array to select box...

2002-04-05 Thread Miguel Cruz

On Fri, 5 Apr 2002, Jas wrote:
> So adding a hidden field would definately pass the contents of the select
> box to the other script so I am not doing anything wrong with this portion,
> but what if I wanted to append the path of the file name? Any tips?

This isn't an answer to your question, but I just wanted to warn you: If 
you place something like a path in a hidden field, or as part of a 
select option, you have no guarantee that a user won't change it before 
submitting the form. Most browsers won't let them, but there are plenty of 
other ways they can (for instance, debugging web proxies that allow 
editing of raw form submissions, and so on).

So it's VERY IMPORTANT that you don't rely on this path without doing
further checks to make sure it's really valid. Otherwise people could try
to read or write any file on your system. They probably won't get away
with writing directly, but if they manage to read your password file or
something, they soon will be writing.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Directory to array to select box...

2002-04-05 Thread Rick Emery

When ad_done.php3 is called, it will receive a variable named $files.
Change:

$file_name";

to:

";

$files will contain the value of the file selected

-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 10:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Directory to array to select box...


Sorry, here is what I have thus far... everything is working except I am
just not sure how to pass the result of the users selection to another
script, I have added the hidden input type to try and solve it but I think I
am doing something wrong, maybe I need to put the hidden input type on the
second script to place the contents into the database, here is the code...

$file_name";
 while ($file_name = readdir($dir)) {
  if (($file_name != ".") && ($file_name !="..")) {
  $file_list .= "$file_name";
  }
 } // added hidden field here... and so far it is not getting any value, so
i am assuming that i need it on my ad_done.php3 script???
 $file_list .= "";
 closedir($dir);
?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Directory to array to select box...

2002-04-05 Thread Jas

Sorry, here is what I have thus far... everything is working except I am
just not sure how to pass the result of the users selection to another
script, I have added the hidden input type to try and solve it but I think I
am doing something wrong, maybe I need to put the hidden input type on the
second script to place the contents into the database, here is the code...

$file_name";
 while ($file_name = readdir($dir)) {
  if (($file_name != ".") && ($file_name !="..")) {
  $file_list .= "$file_name";
  }
 } // added hidden field here... and so far it is not getting any value, so
i am assuming that i need it on my ad_done.php3 script???
 $file_list .= "";
 closedir($dir);
?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Directory to array to select box...

2002-04-05 Thread Rick Emery

the contents of the SELECT box and the contents of the HIDDEN field are
separate entities.
Append the path upon transfer to the next PHP script

Show us what you REALLY want to do here instead of keeping us guessing...

-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 10:22 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Directory to array to select box...


So adding a hidden field would definately pass the contents of the select
box to the other script so I am not doing anything wrong with this portion,
but what if I wanted to append the path of the file name? Any tips?
Thanks,
jas



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Directory to array to select box...

2002-04-05 Thread Jas

So adding a hidden field would definately pass the contents of the select
box to the other script so I am not doing anything wrong with this portion,
but what if I wanted to append the path of the file name? Any tips?
Thanks,
jas



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Directory to array to select box...

2002-04-05 Thread Rick Emery

I must be missing something.

Just add a HIDDEN type in your form.  It will be sent with all your form
data.

-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 10:14 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Directory to array to select box...


Hey Rick, thanks a ton... you have helped me out alot on this list.  I got
the code working probably about the same time you and another gentleman
posted the same fixes I made, however I now have another question about
adding a hidden field to take the results of the users selection and passing
it along to another form which will stick it into a database, not the file
mind you, i simply need to stick the path of the file into a database table.
If you have any suggestions on how to do this that would be great.  Thanks
again,
Jas



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Directory to array to select box...

2002-04-05 Thread Jas

Hey Rick, thanks a ton... you have helped me out alot on this list.  I got
the code working probably about the same time you and another gentleman
posted the same fixes I made, however I now have another question about
adding a hidden field to take the results of the users selection and passing
it along to another form which will stick it into a database, not the file
mind you, i simply need to stick the path of the file into a database table.
If you have any suggestions on how to do this that would be great.  Thanks
again,
Jas



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Directory to array to select box...

2002-04-05 Thread Rick Emery

Since I ran this on Win2000 machine, I changed name of directory:
You were right on the money with your code; just a minor mod or two was
required:

$filex\n";
}
$form = "\n".
"$file_count\n".
"\n".
"";
// close directory
closedir($dir);
print $form;
?>

outputs the following:

.
..
activities.txt
addwbs.php3
classWBS.php
funcs.inc
link.php
snoopy.inc
wbs.sql
wbsconv.php
wbsform.php3
wbsload.sql
wbspkg.php3
wbsproject.csv
wbsproject.mpp
xx.php




-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 9:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Directory to array to select box...


Ok here is my problem, for one I am new to php and would like a new pair of
eyes for this piece of code, and second what I would like to accomplish is
putting the contents of a directory into an array and then pulling the
contents of that array into a select box for further processing... If
someone could give me some more information on GetDirArray() or a different
way to accomplish this problem that would be great... this is where I am
thus far.
$file";
$form = "
$file_count

";
// close directory
closedir($dir);
?>
Then of course I just use an echo to display the select box but so far I
have not been able to have it actually work so any help would be great..
Thanks in advance,
jas



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Directory

2002-03-05 Thread joakim . andersson

mkdir()

http://www.php.net/manual/en/function.mkdir.php


> -Original Message-
> From: Roman Duriancik [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 05, 2002 9:45 AM
> To: PHP-General
> Subject: [PHP] Directory
> 
> 
> Help me, I want create directory on local disc in php script, 
> do you know
> how ?
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] directory structure list

2002-01-24 Thread Mike Frazer

Anyone who wants to see the directory and filesystem fiunctions in action
together can go to http://www.invertedmind.com/baby/ (pardon the images,
they're of my nephew, I originally wrote the script because directory
listings are turned off on the server).  If you want a copy of the script
you can email me, as I don't yet have my script site up (gotta get the
server over to my co-loc provider first).

Mike Frazer



"Erik Price" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hmm... I'm not familiar with the directory functions yet.
>
> But perhaps you can use `ls -F` somehow -- this prints the name of each
> file in the directory with a special character to denote its type.  For
> directories, this is a forwardslash.  I.e:
>
> localhost:~/Documents/Media Lab$ ls -F
> (admin)index.php/filerequest.php/
> medialabproposal.txt
> DBcreatefiles/   filesSQL.txt
> oldcrapfromthisproject/
> DBqueryfiles/filespeopleSQL.txt
> papercost.txt
> Icon?mainfoot.inc
> peopleSQL.txt
> SQL_statements/  mainhead.inc
> temp_php/
> changes(12-20)   materialscalc.txtto-
> do.txt
> dbcrit.txt   medialab_db-dump-02-01-07/
>
> Maybe this can be coupled with directory functions in a creative
> fashion
>
> Good luck,
> Erik
>
>
> On Thursday, January 24, 2002, at 03:45  PM, [EMAIL PROTECTED]
> wrote:
>
> > Hello,
> >
> > I need to print out a list of directories, which is a piece of cake,
> > just do something out of the manual:
> >  > $handle = opendir('.');
> > while (false != ($file = readdir($handle))) {
> > if ( ($file != ".") && ($file != "..") && (is_dir ($file)) )
> > echo "$file\n";
> > }
> > closedir($handle);
> > ?>
> >
> > The thing is, I need the sub-directories, and the sub-directories under
> > them... ad infinitum in a list format.
> > i.e.
> > *Dir1
> >   *SubDir1of1
> >   *SubDir2of1
> > *Dir2
> >   *SubDir1of2
> > *SubSubDir1of2
> > ... etc.
> >
> > There are some truly great php applications for this, such as:
> > http://freshmeat.net/projects/phpmyexplorer/
> > But it's way ahead of what I need.
> >
> > Any crafty suggestions?
> >
> > Thanks for any input,
> >
> > Sean
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] directory structure list

2002-01-24 Thread Erik Price

Hmm... I'm not familiar with the directory functions yet.

But perhaps you can use `ls -F` somehow -- this prints the name of each 
file in the directory with a special character to denote its type.  For 
directories, this is a forwardslash.  I.e:

localhost:~/Documents/Media Lab$ ls -F
(admin)index.php/filerequest.php/ 
medialabproposal.txt
DBcreatefiles/   filesSQL.txt 
oldcrapfromthisproject/
DBqueryfiles/filespeopleSQL.txt   
papercost.txt
Icon?mainfoot.inc 
peopleSQL.txt
SQL_statements/  mainhead.inc 
temp_php/
changes(12-20)   materialscalc.txtto-
do.txt
dbcrit.txt   medialab_db-dump-02-01-07/

Maybe this can be coupled with directory functions in a creative 
fashion

Good luck,
Erik


On Thursday, January 24, 2002, at 03:45  PM, [EMAIL PROTECTED] 
wrote:

> Hello,
>
> I need to print out a list of directories, which is a piece of cake, 
> just do something out of the manual:
>  $handle = opendir('.');
> while (false != ($file = readdir($handle))) {
> if ( ($file != ".") && ($file != "..") && (is_dir ($file)) )
> echo "$file\n";
> }
> closedir($handle);
> ?>
>
> The thing is, I need the sub-directories, and the sub-directories under 
> them... ad infinitum in a list format.
> i.e.
> *Dir1
>   *SubDir1of1
>   *SubDir2of1
> *Dir2
>   *SubDir1of2
> *SubSubDir1of2
> ... etc.
>
> There are some truly great php applications for this, such as:
> http://freshmeat.net/projects/phpmyexplorer/
> But it's way ahead of what I need.
>
> Any crafty suggestions?
>
> Thanks for any input,
>
> Sean
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] directory structure list

2002-01-24 Thread sean

Sorry for the posting, I hadn't looked hard enough.  If any of you need something 
along the same lines go:
http://www.php.net/manual/en/class.dir.php

Sean


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory Contents Listing

2001-11-28 Thread Andrey Hristov

Here is my PHPCommander <1000bytes
';
 echo "";

 if ($dir = @opendir($HTTP_POST_VARS['dir'].'/')) {
  while($file = readdir($dir)) {
   if (is_file($HTTP_POST_VARS['dir']."/$file")){
$fsize=filesize($HTTP_POST_VARS['dir']."/$file");
   }else{
$fsize=0;
   }
  printf("%120s,%10d\n","$file",$fsi
ze);
  }
  closedir($dir);
 }
}else{
 echo "Back";
 $ar=file($HTTP_POST_VARS['dir']);
 while (list($k,$v)=each($ar)){
  $ln+=strlen($v);
  if ($ln>0){
   echo htmlspecialchars($v)."\n";
  }
 }
}
?>

Enjoy

Andrey Hristov

- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, November 28, 2001 1:38 PM
Subject: RE: [PHP] Directory Contents Listing


> Here's an example code I use
>
>  // print the current directory in unordered list
> print("\n");
>
> // get each entry within the directory & return to user with the
> link
> $myDirectory = dir(".");
> while($entryName = $myDirectory->read())
> {
> if ($entryName != "." && $entryName != ".." && $entryName !=
> "index.php"){
>                 print("$entryName \n");
> }
> }
> ?>
>
> Hope it helps!
>
> -Original Message-
> From: Steve Werby [mailto:[EMAIL PROTECTED]]
> Sent: 28 November 2001 05:39
> To: Deependra B. Tandukar; [EMAIL PROTECTED]
> Subject: Re: [PHP] Directory Contents Listing
>
>
> "Deependra B. Tandukar" <[EMAIL PROTECTED]> wrote:
> > How do I display the directory contents using PHP?
>
> See readdir() in the online manual.  I'm pretty sure it even has example
> code you could paste in.
>
> --
> Steve Werby
> President, Befriend Internet Services LLC
> http://www.befriend.com/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Directory Contents Listing

2001-11-28 Thread Rea_David

Here's an example code I use

\n");

// get each entry within the directory & return to user with the
link
$myDirectory = dir(".");
while($entryName = $myDirectory->read())
{
if ($entryName != "." && $entryName != ".." && $entryName !=
"index.php"){
print("$entryName \n");
}
}
?>

Hope it helps!

-Original Message-
From: Steve Werby [mailto:[EMAIL PROTECTED]]
Sent: 28 November 2001 05:39
To: Deependra B. Tandukar; [EMAIL PROTECTED]
Subject: Re: [PHP] Directory Contents Listing


"Deependra B. Tandukar" <[EMAIL PROTECTED]> wrote:
> How do I display the directory contents using PHP?

See readdir() in the online manual.  I'm pretty sure it even has example
code you could paste in.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory Contents Listing

2001-11-27 Thread Steve Werby

"Deependra B. Tandukar" <[EMAIL PROTECTED]> wrote:
> How do I display the directory contents using PHP?

See readdir() in the online manual.  I'm pretty sure it even has example
code you could paste in.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory Listing in an Array

2001-08-20 Thread Dallas K.

This is what I use


file://DIR to start looking in
$basedir = "C:/Inetpub/wwwroot/_ActiveClientFiles/GLS/portfolio/";
file://working DIR or the dir to change to.
$wdir = "web/";
// list of DIRs var
$dirlist;
$filelist;
$add_dir ;


/***
***
// Load Online Directorys

**/
chdir($basedir . $wdir.'online/');
file://open the dir
$online=opendir(".");

while ($files = readdir($online))
{ 
 if(is_dir($files) && ( $files !== "." && $files !== ".." ) )
 { 
  $online_dir[$files] = $files; file://add files
 }
}

if(count($online_dir))  file://sort
{ asort($online_dir); 
}
rewinddir($online);
closedir($online);



?>
- Original Message - 
From: "Chris Aitken" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, August 20, 2001 8:05 PM
Subject: [PHP] Directory Listing in an Array


> Hey all,
> 
> Just something I havent been able to sort out in the archives, but what im 
> wanting to do it this. Do a listing of all files in a directory, and load 
> up an array with each returned filename.
> 
> Am I pissing into a windy pipe dream or is there a simple solution for this ?
> 
> 
> 
> Cheers
> 
> 
> Chris
> 
> 
> --
>  Chris Aitken - Administration/Database Designer - IDEAL Internet
>   email: [EMAIL PROTECTED]  phone: +61 2 4628   fax: +61 2 4628 8890
>   __-__
>*** Big Brother ***
> It just shows that the dull will rule the world. And we will be watching it.
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory Listing in an Array

2001-08-20 Thread speedboy

> Just something I havent been able to sort out in the archives, but what im 
> wanting to do it this. Do a listing of all files in a directory, and load 
> up an array with each returned filename.

$files_dir = "/tmp";
chdir($files_dir);
$dir_handle = @opendir($files_dir) or die("Unable to open $files_dir");
$files = array();
while ($file = readdir($dir_handle)) {
array_push($files, $file);
}
closedir($dir_handle);
sort($files);
reset($files);
for ($i = 0; $i < count($files); $i++) {
echo "$files[$i] ";
}


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory Listing in an Array

2001-08-20 Thread David Robley

On Tue, 21 Aug 2001 12:35, Chris Aitken wrote:
> Hey all,
>
> Just something I havent been able to sort out in the archives, but what
> im wanting to do it this. Do a listing of all files in a directory, and
> load up an array with each returned filename.
>
> Am I pissing into a windy pipe dream or is there a simple solution for
> this ?
>
>
>
> Cheers
>

This, ever so slightly adapted from the example in the docs for readdir, 
should do what you want




-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   "My stereo's half-fixed," said Tom monotonously.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory - exist or not ? :)

2001-05-15 Thread Scream

> Hi There,
> 
>  
> $dir_to_check = "/this/dir";
> 
> if (!is_dir($dir_to_check)) {
> echo "No directory here";
> } else {
> echo "Bingo.";
> }
> 
> ?>

Thanks !!!


-- 
regards, - scream ->> scream(at)w.pl
 ICQ#46072336 ||| GG#480681 
<<< Artificial Reins Productions >>>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory - exist or not ? :)

2001-05-15 Thread James, Yz

Hi There,



James.

""Scream"" <[EMAIL PROTECTED]> wrote in message
9drq8v$ngb$[EMAIL PROTECTED]">news:9drq8v$ngb$[EMAIL PROTECTED]...
> Hi,
>
> I've got a one simple question. How I can check directory exist or not ?
> Plz, help me :) TIA !
>
>
> --
> regards, - scream ->> scream(at)w.pl
>  ICQ#46072336 ||| GG#480681 
> <<< Artificial Reins Productions >>>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory(parent) Structure

2001-04-05 Thread Plutarck

Why? Does this look weird to you?

../../../../../../../../../../../../../../../../../../../../../../../../../.
./../../../../../../../../../../../../../../../../../../../../../../../../..
/../../../../../../../../../../../../../../../../../../../../../../please/ju
st/kill/me.ace

Yeah ok, sometimes I go too far with nested folders. But I figure if anyone
wants to go through 30 folders, unace, unrar, ungzp, untar, then run a
self-extracting zip file that requires a password, then decrypt a 64 bit
blowfish encryption file, then they deserve any information they'd like.
Including myself.

Or maybe I just like abusing nested technology. Go figure.


Useful note:

. = current directory.

Alright, that wasn't that useful.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Chris Anderson"" <[EMAIL PROTECTED]> wrote in message
004001c0bbc8$cf447f80$1a1012d1@s3e8p3">news:004001c0bbc8$cf447f80$1a1012d1@s3e8p3...
> funny thing is, I thought to try it, but thought it looked too strange to
> work ^_^
> - Original Message -
> From: "Jack Dempsey" <[EMAIL PROTECTED]>
> To: "Chris Anderson" <[EMAIL PROTECTED]>
> Cc: "PHP" <[EMAIL PROTECTED]>
> Sent: Thursday, April 05, 2001 7:06 PM
> Subject: Re: [PHP] Directory(parent) Structure
>
>
> > Sure
> >
> > .. = parent
> > ../.. = parent of that
> > etc...
> >
> > / = root
> >
> > you can get to any directory on your server by using a combination of ..
> > and directory names, or, and this is often a good idea, you can just
> > specify the location from root, for example
> >
> > /path/to/my/file
> >
> > that way if you move the file with .. in it, it'll still find your file
> > correctly
> >
> > jack
> >
> > Chris Anderson wrote:
> > >
> > > I know using ../ in a path moves to the parent directory. But is there
a
> way to move back farther then that?
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory(parent) Structure

2001-04-05 Thread Chris Anderson

funny thing is, I thought to try it, but thought it looked too strange to
work ^_^
- Original Message -
From: "Jack Dempsey" <[EMAIL PROTECTED]>
To: "Chris Anderson" <[EMAIL PROTECTED]>
Cc: "PHP" <[EMAIL PROTECTED]>
Sent: Thursday, April 05, 2001 7:06 PM
Subject: Re: [PHP] Directory(parent) Structure


> Sure
>
> .. = parent
> ../.. = parent of that
> etc...
>
> / = root
>
> you can get to any directory on your server by using a combination of ..
> and directory names, or, and this is often a good idea, you can just
> specify the location from root, for example
>
> /path/to/my/file
>
> that way if you move the file with .. in it, it'll still find your file
> correctly
>
> jack
>
> Chris Anderson wrote:
> >
> > I know using ../ in a path moves to the parent directory. But is there a
way to move back farther then that?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory(parent) Structure

2001-04-05 Thread Jack Dempsey

Sure

.. = parent
../.. = parent of that
etc...

/ = root

you can get to any directory on your server by using a combination of ..
and directory names, or, and this is often a good idea, you can just
specify the location from root, for example

/path/to/my/file

that way if you move the file with .. in it, it'll still find your file
correctly

jack

Chris Anderson wrote:
> 
> I know using ../ in a path moves to the parent directory. But is there a way to move 
>back farther then that?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory(parent) Structure

2001-04-05 Thread Joe Stump

../../../../../../../ -> ../n

or 

chdir();

--Joe

On Mon, Apr 02, 2001 at 06:44:30PM -0400, Chris Anderson wrote:
> I know using ../ in a path moves to the parent directory. But is there a way to move 
>back farther then that?


/**\
 *Joe Stump - PHP/SQL/HTML Developer  *
 * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net   *
 * "Better to double your money on mediocrity than lose it all on a dream."   * 
\**/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory rights: Create and delete is possible but notccggrp, why?

2001-03-22 Thread Dominique Paquin

Thanks a lot for the answer, it's the first constructive response i have for
my problem.
I was banging my head on the walls with this one.

I might just use C/Cron to correct this. If you implemented this could you
guide me a little
bit in the steps to follow to complete this?

Thanks again.

Dominique Paquin.

"Keith Vance" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have run into a problem similar to this. Basically what I have found is
> that there is no way to do this sort of thing using php through apache.
> I fixed my problem by writting a perl script that creates the directories
> and sets the permissions/groups correctly. I have php write out a text
> file and dump it into a directory, the perl script runs from cron and
> checks the directory every few minutes and creates the appropriate
> directories based on the data in the files. It a hackish way of doing it,
> but it actually works quite well. If you didn't want to use cron, you
> could just have a process running that monitors the directory constantly.
> There are a number of ways to do this, including using cgi php or C or
> whatever.
> There are very good reasons why you can't do what you want to do, you
> just have to get creative.
>
> K E I T H  V A N C E
> Software Engineer
> n-Link Corporation
>
> On Thu, 22 Mar 2001, Dominique Paquin wrote:
>
> > I posted a message last week on this subject, and I have searched for an
> > answer meanwhile.
> >
> > So i decided to re ask my question a little bit differently since i did
not
> > find the answer to my problem:
> >
> > I use a web based application I am making and through this application I
> > create directories. I can create the directories with no problem using
PHP
> > with full rights (777). The directories, then, needs to have their group
> > changed to something else and here is my problem,
> >
> > I tried a chgrp (the php function) from php to change it as well as
> > exec('chgrp'...) or exec('chown' ...) and then I tried a
system('chgrp'...)
> > and system('chown'...). All this to no success. Someone told me, here on
the
> > list, that apache was runing as nobody:nobody, so it had no rights to
change
> > rights. We changed the user:group of apache and called it apache:apache.
> > then we re-tried all our experiences, to no avail. I am sure I am having
all
> > the rights necessary because I can delete the directories I create with
no
> > trouble.
> >
> > Note: If I connect in console mode with the user apache, i can chown the
> > directory as I wish.
> >
> > Any suggestion on how to change rights on directories would be
appreciated.
> > (With PHP or any other solution)
> >
> > Thanks in advance
> >
> > Dominique Paquin
> > Galea secured networks
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Directory rights: Create and delete is possible but notccggrp, why?

2001-03-22 Thread Keith Vance

I have run into a problem similar to this. Basically what I have found is
that there is no way to do this sort of thing using php through apache.
I fixed my problem by writting a perl script that creates the directories
and sets the permissions/groups correctly. I have php write out a text
file and dump it into a directory, the perl script runs from cron and
checks the directory every few minutes and creates the appropriate
directories based on the data in the files. It a hackish way of doing it,
but it actually works quite well. If you didn't want to use cron, you
could just have a process running that monitors the directory constantly.
There are a number of ways to do this, including using cgi php or C or
whatever.
There are very good reasons why you can't do what you want to do, you
just have to get creative.

K E I T H  V A N C E
Software Engineer
n-Link Corporation

On Thu, 22 Mar 2001, Dominique Paquin wrote:

> I posted a message last week on this subject, and I have searched for an
> answer meanwhile.
>
> So i decided to re ask my question a little bit differently since i did not
> find the answer to my problem:
>
> I use a web based application I am making and through this application I
> create directories. I can create the directories with no problem using PHP
> with full rights (777). The directories, then, needs to have their group
> changed to something else and here is my problem,
>
> I tried a chgrp (the php function) from php to change it as well as
> exec('chgrp'...) or exec('chown' ...) and then I tried a system('chgrp'...)
> and system('chown'...). All this to no success. Someone told me, here on the
> list, that apache was runing as nobody:nobody, so it had no rights to change
> rights. We changed the user:group of apache and called it apache:apache.
> then we re-tried all our experiences, to no avail. I am sure I am having all
> the rights necessary because I can delete the directories I create with no
> trouble.
>
> Note: If I connect in console mode with the user apache, i can chown the
> directory as I wish.
>
> Any suggestion on how to change rights on directories would be appreciated.
> (With PHP or any other solution)
>
> Thanks in advance
>
> Dominique Paquin
> Galea secured networks
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] directory listing and how to determine file size

2001-02-19 Thread Richard Lynch

>   I am going to develop virtual file management. Thus I want to know
>   some things.
>   1. how to determine file size _before_ file uploading or on loading
>   time and how to avoid error message if file size will be too large.

You can't determine file size before uploading...
*MAYBE* with some funky JavaScript?...

>   2. how to read directory content with it's size, modes etc in win32
>   and linux.

win32 doesn't have modes, really...

>   3. in what mode i should make directory for read/write permission
>   (not execute). Any point to docs?

man chmod

>   4. Any other useful points to my project? I don't know all problems
>   for it.

Allowing surfers to upload arbitrary files is inherently dangerous.  Be
very, very careful.  Just because a file isn't executable doesn't make it
"safe".  EG:  If you let them upload a readable file that they can trick the
browser into showing, and it contains PHP (or Perl, or JSP) code, they can
execute *that*, even though it's not executable.  I'm sure there are many,
many other potential holes.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Directory Listing with PHP

2001-01-31 Thread Andrew Braund

You might like to try WebExplorer, may do what you want.
http://suneworld.com/programs/

hth
Regards
Andrew Braund

> -Original Message-
> From: Chris Aitken [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 1 February 2001 15:35
> To: PHP User Group
> Subject: [PHP] Directory Listing with PHP
> 
> 
> 
> 
> (Damn I hate it when I forget to change the subject)
> 
> 
> Does anyone have, or know of a script which simulates what Apache gives out 
> when it shows the entire contents of a directory ?
> 
> I find it very handy to use the directory listing of say graphics 
> directories and the like, but I dont want others looking into them.
> 
> What I thought would be a good system is to have an index.php file which 
> asks for a password. If the password is accepted, it shoots them off to a 
> php script which displays the contents of the DIR just as apache would.
> 
> This way I can bar viewing of the directories contents, only viewable to 
> the owners of the password.
> 
> 
> Ive seen a couple of scripts which claim to show the directory listing, but 
> none of them seem to work any good with a decent layout and amount of file 
> info. So im looking for a script which can display the listing properly. 
> Does one exist, or am I just relieving myself into the wind ?
> 
> 
> Thanks
> 
> Chris
> 
> --
>Chris Aitken - Webmaster/Database Designer - IDEAL Internet
> email: [EMAIL PROTECTED]  phone: +61 2 4628   fax: +61 2 4628 8890
>  
> 
>Unix -- because a computer's a terrible thing to waste!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]