|
Posted by Shelly on 08/03/05 01:33
"JDS" <jeffrey@example.invalid> wrote in message
news:pan.2005.08.02.16.42.35.361003@example.invalid...
> On Mon, 01 Aug 2005 15:34:30 +0000, Shelly wrote:
>
>> "JDS" <jeffrey@example.invalid> wrote in message
>> news:pan.2005.08.01.14.57.02.72426@example.invalid...
>>> There are several things that I am not crazy about in your code. And
>>> your
>>> usenet post
>>>
>>> 0) looks like you have MULTI-posted, not CROSS-posted. There is an
>>> important distinction.
>>
>> Please explain. I merely wanted to be polite and say that I had also
>> posted
>> it in another forum.
>
> Cross-posting means including a list of newsgroups in the post-to list at
> post time. Multi-posting means sending out the same message to different
> newsgroups, one at a time.
Ah, I multi-posted. However, it seems like six of one and a half dozen of
the other.
>>
>>>
>>> 1) you may want to consider using "and" instead of "&&". See:
>>> http://www.php.net/manual/en/language.operators.php#language.operators.precedence
>>> (minor issue)
>>
>> I'll look at it. I am so used to C and Java coding (new to the web
>> coding
>> and PHP) that I used the ones I knew.
>
> Its no big deal, really, just that operator precedence may bite you. Be
> sure to use parentheses and you should be fine.
I'm a bit of a fanatic about parentheses. I always use them if there is the
slightest chance of not being read correctly.
>>> 2) Why use strcmp() when == will do? In any case, according to your
>>> step
>>
>> Force of habit (and it would be !=, not ==).. I use strcmp because of
>> past
>> programming experience. To compare strings you use strcmp (or an
>> equivalent). An "==" compares the addresses of the two items and not the
>> values of the two items, since strings are arrays in these other
>> languages.
>
> I guess not such a bad habit, but I find "$string == 'string'" much easier
> to read than "srtcmp($string, 'string')". Also, note that PHP has a "==="
> operator which tests for typing as well as value.
Is that 3 equals signs? It is hard to read the above as they run together
here. Interesting, though.
>>> number (2) what you do will not trigger true in "if (strcmp($A, "any")
>>> {"
>>> so it will just skip all that stuff and drop out to the final Location
>>> header -- anotherSite.php
>>
>> The strcmp is correct. If $A is NOT equal to "any", then strcmp returns
>> other than zero and the code IS perfermed. That is what I want to
>> happen.
>
> Allrighty.
>
> <snip stuff about typos and servers>
>
>>> 6) You are supposed to use absolute URLs when doing a
>>> "header('Location:...')" redirection. Most browsers and servers and PHP
>>> itself are flexible in this regard, but the "official" requirement is
>>> the full URI including "http://".
>>
>> Mine works with relative URLs.
>
> Well, I don't know the specs all that well,
> admitedly. More info: http://www.php.net/header
I changed them all, everywhere in my code, to absolute URLs.
> <snip other stuff>
>
>> Thank you for your time and suggestions.
>>
>> Shelly
>
> You're welcome. I dated a Shelly once. Spelled "Shelley" though. I
> think.
You wouldn't like my type :-). It is a gender thing. Besides, my wife of
42 years might object :-). The name on my birth certificate is Sheldon.
Shelly
[Back to original message]
|