NYCPHP Meetup

NYPHP.org

[nycphp-talk] Sorry, really stupid question...

Phil Powell soazine at erols.com
Sun Dec 29 02:07:58 EST 2002


I can't do that, it's a remote server, sorry.

Phil
----- Original Message -----
From: <bit5hift at ethernet.tk>
To: "NYPHP Talk" <talk at nyphp.org>
Sent: Saturday, December 28, 2002 3:57 PM
Subject: Re: [nycphp-talk] Sorry, really stupid question...


> On Sat, 2002-12-28, Phil Powell wrote:
> > "Have the file chmoded"...
> >
> > You completely lost me.  How can I chmod a file I have not yet opened?
>
> chmod the file in your *nix shell.
> not in the php script.
>
> >
> > Phil
> > ----- Original Message -----
> > From: "Analysis & Solutions" <danielc at analysisandsolutions.com>
> > To: "NYPHP Talk" <talk at nyphp.org>
> > Sent: Saturday, December 28, 2002 2:56 PM
> > Subject: Re: [nycphp-talk] Sorry, really stupid question...
> >
> >
> > > On Sat, Dec 28, 2002 at 02:26:29PM -0500, Phil Powell wrote:
> > >
> > > > $fileID = fopen("nicknames.txt", "a") or die("Could not open " .
$path .
> > "/nicknames.txt");
> > > >    chmod("nicknames.txt", 0755);
> > > >    fputs($fileID, $nickname . "\
"); fflush($fileID);
fclose($fileID);
> > >
> > > Let's rewrite this in more efficient, readable code...
> > >    $File = '/path/to/nicknames.txt';
> > >    $fileID = fopen($File, 'a') or die("Could not open $File");
> > >    fputs($fileID, "$nickname\
");
> > >
> > > Key changes...
> > >    * Have the file chmoded in the first place, not every time you open
it
> > >      up, nor while you have it open already.
> > >    * Changed double quotes to single quotes in fopen statement.
Double
> > >      quotes only needed when strings are evaluated (have variables in
> > >      them).
> > >    * fflush() isn't needed at all.
> > >    * fclose() happens automatically when the script ends, so is
> > >      only helpful when you have a long script.
> > >
> > > --Dan
> > >
> > > --
> > >                PHP classes that make web design easier
> > >     SqlSolution.info  | LayoutSolution.info |  FormSolution.info
> > >  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
> > >  4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
>
>
> ------------------------------------------------------------------------
> F u cn rd ths u cnt spl wrth a dm!
>
> Web site (with key):  http://ethernet.tk/bit5hift/
> GPG key fingerprint:  562E 9C20 1122 907C A7AB  AA6A 601C 6920 9909 58B3
> ------------------------------------------------------------------------
>
>
>
> --- Unsubscribe at http://nyphp.org/list/ ---
>
>




More information about the talk mailing list