php-general Digest 15 Feb 2011 16:52:10 -0000 Issue 7183

Topics (messages 311301 through 311306):

Correct file permissions for a website
        311301 by: Ashim Kapoor
        311302 by: Camilo Sperberg

Re: 2 submit buttons.
        311303 by: Floyd Resler
        311304 by: Steve Staples

Re: Howdy (new in here)
        311305 by: Daniel Brown
        311306 by: tedd

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Dear All,

The book PHP and MySQL bible says that the php directory should be world
executable  ? I remember posting a different question earlier to this list
and one person suggesting this and another person replying that that was
incorrect.

Could someone clear the smoke on this one ?

Many thanks,
Ashim.

--- End Message ---
--- Begin Message ---
On Tue, Feb 15, 2011 at 08:35, Ashim Kapoor <[email protected]> wrote:

> Dear All,
>
> The book PHP and MySQL bible says that the php directory should be world
> executable  ? I remember posting a different question earlier to this list
> and one person suggesting this and another person replying that that was
> incorrect.
>
> Could someone clear the smoke on this one ?
>
> Many thanks,
> Ashim.
>

I would say that depends on your server configuration. If you have suPHP,
the user executing PHP will be yourself, so 744 isn't needed and you can
just leave 700. (Or less, configuration files are usually 400, just read
access).

If the user is Apache (and Apache is in the same group you are), he will
need to read your files, so you should at least have 740 and also he will
need execution rights on the directory which will result in 750. If apache
isn't in the same group you are (most probably scenario) you will need 755.
Strictly speaking, it should be 705.

Greetings.

-- 
Mailed by:
UnReAl4U - unreal4u
ICQ #: 54472056
www1: http://www.chw.net/
www2: http://unreal4u.com/

--- End Message ---
--- Begin Message ---
On Feb 14, 2011, at 5:24 PM, Paul M Foster wrote:

> On Mon, Feb 14, 2011 at 05:15:11PM -0500, Floyd Resler wrote:
> 
>> 
>> On Feb 14, 2011, at 4:18 PM, Paul M Foster wrote:
>> 
>>> On Mon, Feb 14, 2011 at 03:35:02PM -0400, Paul Halliday wrote:
>>> 
>>>> I have 2 buttons on a page:
>>>> 
>>>> if (isset($_POST['botton1'])) {dothing1();} if
>>>> (isset($_POST['button2'])) {dothing2();}
>>>> 
>>>> They both work as intended when I click on them. If however I click
>>>> within a text box and hit enter, they both fire.
>>>> 
>>>> Is there a way to stop this?
>>> 
>>> Check your code. My experience has been that forms with multiple
>>> submits will fire the *first* submit in the form when you hit Enter
>>> in a text field or whatever. I just tested this and found it to be
>>> true.
>>> 
>>> Now, I'm doing this in Firefox on Linux. I suppose there could be
>>> differences among browsers, but I suspect that the specs for HTML
>>> mandate the behavior I describe.
>>> 
>>> Paul
>>> 
>> 
>> If you don't mind using a little JavaScript you can test for which
>> button should fire when enter is pressed.  How I would do it is to
>> first add a hidden field and call it "buttonClicked".  Now, in the
>> text field where you would like a button to fire if enter is pressed,
>> at this to the tag: onkeyup="checkKey(this,event)".  For the
>> JavaScript portion of it, do this:
> 
> Yeah, but you don't even have to go that far. Just put a print_r($_POST)
> at the beginning of the file, and you'll see which button gets pressed.
> It will show up in the POST array.
> 
> Paul
> 
> -- 

Yeah, except that the original question was about controlling which button 
fires when the enter key is pressed. :)

Thanks!
Floyd


--- End Message ---
--- Begin Message ---
On Tue, 2011-02-15 at 08:07 -0500, Floyd Resler wrote:
> On Feb 14, 2011, at 5:24 PM, Paul M Foster wrote:
> 
> > On Mon, Feb 14, 2011 at 05:15:11PM -0500, Floyd Resler wrote:
> > 
> >> 
> >> On Feb 14, 2011, at 4:18 PM, Paul M Foster wrote:
> >> 
> >>> On Mon, Feb 14, 2011 at 03:35:02PM -0400, Paul Halliday wrote:
> >>> 
> >>>> I have 2 buttons on a page:
> >>>> 
> >>>> if (isset($_POST['botton1'])) {dothing1();} if
> >>>> (isset($_POST['button2'])) {dothing2();}
> >>>> 
> >>>> They both work as intended when I click on them. If however I click
> >>>> within a text box and hit enter, they both fire.
> >>>> 
> >>>> Is there a way to stop this?
> >>> 
> >>> Check your code. My experience has been that forms with multiple
> >>> submits will fire the *first* submit in the form when you hit Enter
> >>> in a text field or whatever. I just tested this and found it to be
> >>> true.
> >>> 
> >>> Now, I'm doing this in Firefox on Linux. I suppose there could be
> >>> differences among browsers, but I suspect that the specs for HTML
> >>> mandate the behavior I describe.
> >>> 
> >>> Paul
> >>> 
> >> 
> >> If you don't mind using a little JavaScript you can test for which
> >> button should fire when enter is pressed.  How I would do it is to
> >> first add a hidden field and call it "buttonClicked".  Now, in the
> >> text field where you would like a button to fire if enter is pressed,
> >> at this to the tag: onkeyup="checkKey(this,event)".  For the
> >> JavaScript portion of it, do this:
> > 
> > Yeah, but you don't even have to go that far. Just put a print_r($_POST)
> > at the beginning of the file, and you'll see which button gets pressed.
> > It will show up in the POST array.
> > 
> > Paul
> > 
> > -- 
> 
> Yeah, except that the original question was about controlling which button 
> fires when the enter key is pressed. :)
> 
> Thanks!
> Floyd
> 
> 

I think if you have more than 1 submit button, then you need to disable
the "enter to submit" functionality.  This would force people/users to
click on either of the submit buttons...

Or better yet, if you have a "default" submit button, have a hidden text
value with your default submit value, and then on the submit "onclick"
event of the other submit button, replace the text value of the hidden
field to something else.   Then finally in your postback check, check
the value of the hidden field to determine what you're going to do.

Personally, I do a combination of both.  I disable the ability to submit
on key press, and require you to submit via my submit methods, and
onclick of the submit button sets a value to the hidden text field, and
then do a switch() case:... on that hidden value.   But that is my way
of doing it (which will prolly get ripped apart by someone here, which
is good/constructive criticism for me)

steve


--- End Message ---
--- Begin Message ---
On Mon, Feb 14, 2011 at 20:26, Brian Waters <[email protected]> wrote:
> Hi everyone! I'm just starting out with PHP so I'm looking for a good
> place to ask some questions, have my code critiqued (read: visciously
> ripped apart), and generally BS about PHP and programming in general
> (if that's OK). I know that PHP sometimes has a reputation for having
> (some) lousy developers, and I'd like to avoid becoming one of those
> people. To that end, I've subscribed here because I've always found
> mailing lists to have much higher-quality discourse than the average
> online foum.
>
> Looking forward to participating!

    Welcome aboard, Bri.

> P.S, The rules page on the web
> (http://us2.php.net/reST/php-src/README.MAILINGLIST_RULES) is
> currently broken, but this one works:
> http://us2.php.net/reST/php-src/trunk_README.MAILINGLIST_RULES. Just a
> heads up to whoever is in charge of that.

    Duly-noted.  Thank you, sir.

-- 
</Daniel P. Brown>
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

--- End Message ---
--- Begin Message ---
At 8:26 PM -0500 2/14/11, Brian Waters wrote:
Hi everyone! I'm just starting out with PHP so I'm looking for a good
place to ask some questions, have my code critiqued (read: visciously
ripped apart), and generally BS about PHP and programming in general
(if that's OK). I know that PHP sometimes has a reputation for having
(some) lousy developers, and I'd like to avoid becoming one of those
people. To that end, I've subscribed here because I've always found
mailing lists to have much higher-quality discourse than the average
online foum.

Looking forward to participating!

- BW

-BW:

Welcome to the list.  A few points:

We seldom "viciously rip apart" code.

We won't write code for you -- unless it's interesting to us.

We don't usually critique code -- because usually there's too much code presented when people try to go that route.

We don't agree that PHP has a reputation of having some lousy developers -- because that's simply not true.

We (or at least I do) agree that mailing lists have higher-quality discourse than other mediums (i.e., forums, books, web sites) -- because what is published on this list is immediately reviewed by very smart people using their experience and current technology to backup their position.

So after all is said, what we do is to give you our best guess at what needs to be addressed in the problem you present.

Cheers,

tedd

PS: We seldom point out spelling errors, but it's good to review what you post. Remember, what you post will be public for generations to come.
--
-------
http://sperling.com/

--- End Message ---

Reply via email to