[PHP] Finding out DST with PHP

2009-10-02 Thread Rohit Sodhia
I was hoping someone might be able to help me with something. In a recent effort to learn PHP/mySQL, I decided to design a mock forum. Many forums (such as phpBB) allow a user to pick their timezone and to select if DST should be applied. I'm trying to figure out how its done. Currently, I'm sa

RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Joost
"Daevid Vincent" wrote: > > >> -Original Message- >> From: Ben Dunlap [mailto:bdun...@agentintellect.com] >> Sent: Friday, October 02, 2009 2:58 PM >> To: php-general@lists.php.net; Daevid Vincent >> Subject: Re: [PHP] Whacky increment/assignment logic with >> $foo++ vs ++$foo >> >> >

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Ben Dunlap
>        int a = 2; >        b = a++; >        printf("b = [%d]\n", b); > > "b" would be 2 when printed.  However, after the second line (b = a++;) > finished executing, "a" would then be 3. Sure, but that code is perfectly clear. It's the odd special case where you assign the variable to itself,

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Mari Masuda
On Oct 2, 2009, at 15:22, Daevid Vincent wrote: -Original Message- From: Ben Dunlap [mailto:bdun...@agentintellect.com] Sent: Friday, October 02, 2009 2:58 PM To: php-general@lists.php.net; Daevid Vincent Subject: Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo mi

RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Daevid Vincent
> -Original Message- > From: Ben Dunlap [mailto:bdun...@agentintellect.com] > Sent: Friday, October 02, 2009 2:58 PM > To: php-general@lists.php.net; Daevid Vincent > Subject: Re: [PHP] Whacky increment/assignment logic with > $foo++ vs ++$foo > > > mind-blowing. What the heck /is/ su

Re: [PHP] Self-Process php forms or not?

2009-10-02 Thread Manuel Lemos
Hello, on 10/02/2009 07:11 AM kranthi said the following: >>> You say you don't use hidden fields because they can be modified too >>> easily, yet you say you check for the submit button? Which out of the >>> two do you do, as last time I checked, modifying one form field is as >>> easy as changin

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Ben Dunlap
>> Seems like any way you slice it the output should be 3. I guess what's > > ... and, in fact, that /is/ how C behaves. The following code: Whereas Perl (v5.10.0) handles the construct the same way that PHP does. Curiouser and curiouser. Ben -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Ben Dunlap
> mind-blowing. What the heck /is/ supposed to happen when you do this: > >    $a = 2; >    $a = $a++; >    echo $a; > > Seems like any way you slice it the output should be 3. I guess what's ... and, in fact, that /is/ how C behaves. The following code: int a = 2; a = a++;

Re: [PHP] Self-Process php forms or not?

2009-10-02 Thread Manuel Lemos
Hello, on 10/02/2009 05:25 AM kranthi said the following: > and yes i forgot to mention... i avoid hidden form elements because > they can be modified very easily and hence pose a security threat. How can hidden field be changed in a way that submit buttons can't? I do not see any security threa

Re: [PHP] Self-Process php forms or not?

2009-10-02 Thread Manuel Lemos
Hello, on 10/02/2009 05:23 AM kranthi said the following: >>> That only works if the user clicks on that submit button. If the user >>> hits the enter key in a text input, the form is submitted but the submit >>> input variable is not set. That is why an hidden input is a safer solution. > > i do

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Ben Dunlap
On Fri, Oct 2, 2009 at 2:37 PM, Ben Dunlap wrote: >> My issue is that I see no reason to do the ASSIGNMENT FIRST and THEN >> INCREMENT. >> >> That's just counter intuitive. In the case of $foo = $num++, everything to >> the right of the = should be computed FIRST and THEN handed off to the left >>

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Daniel Brown
On Fri, Oct 2, 2009 at 17:42, Daniel Brown wrote: > >     but rather by something just slightly more advanced: > > $num = file_get_contents('visitcount.txt'); > if(isset($_GET['countme'])) { >    echo "You are visitor #".++$num."\n"; >    file_put_contents($num); > } > ?> Converse exampl

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Daniel Brown
On Fri, Oct 2, 2009 at 17:28, Daevid Vincent wrote: > > Personally I've never (in almost 20 years) done an assignment like "$foo = > $foo++" as I always use just "$foo++" or "$foo += 1" or something, hence the > reason today is the day a co-worker stumbled upon this and was as confused > as I was

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Ben Dunlap
> My issue is that I see no reason to do the ASSIGNMENT FIRST and THEN > INCREMENT. > > That's just counter intuitive. In the case of $foo = $num++, everything to > the right of the = should be computed FIRST and THEN handed off to the left > side. This particular expression (and I'm unaware of any

RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Daevid Vincent
> -Original Message- > From: Robert Cummings [mailto:rob...@interjinn.com] > Sent: Friday, October 02, 2009 2:12 PM > To: Daevid Vincent > Cc: php-general@lists.php.net > Subject: Re: [PHP] Whacky increment/assignment logic with > $foo++ vs ++$foo > > Daevid Vincent wrote: > > > $num

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Tommy Pham
- Original Message > From: Ben Dunlap > To: Daevid Vincent > Cc: php-general@lists.php.net > Sent: Fri, October 2, 2009 2:06:47 PM > Subject: Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo > > > Can someone PLEASE explain why the developers of PHP chose this seemingly

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Robert Cummings
Daevid Vincent wrote: So then I read the manual because I think I'm loosing my mind and perhaps it's backwards day and nobody told me: http://us3.php.net/manual/en/language.operators.increment.php I'm baffled as to the reasoning behind: "$a++ :: Post-increment :: Returns $a, then increments $

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Ben Dunlap
> Can someone PLEASE explain why the developers of PHP chose this seemingly > whacky logic? It mimicks C. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Daevid Vincent
So then I read the manual because I think I'm loosing my mind and perhaps it's backwards day and nobody told me: http://us3.php.net/manual/en/language.operators.increment.php I'm baffled as to the reasoning behind: "$a++ :: Post-increment :: Returns $a, then increments $a by one." Why would yo

Re: [PHP] Self-Process php forms or not?

2009-10-02 Thread Ben Dunlap
> Yes. But since I don't want to display a success information + form fields, > but only the success information, > I believe the only way we have to do this is by either use javascript and > update a div or similar, or using only php, by redirecting to another page. > > Is this correct? Whether o

RE: [PHP] Self-Process php forms or not?

2009-10-02 Thread tedd
At 3:35 PM +0100 10/2/09, MEM wrote: > You can set it up any number of ways. There is no absolute need for a redirect. Everything can be done in one form, or not -- your choice. Cheers, tedd Yes. But since I don't want to display a success information + form fields, but only the success

RE: [PHP] Self-Process php forms or not?

2009-10-02 Thread MEM
> You can set it up any number of ways. There is no > absolute need for a redirect. Everything can be > done in one form, or not -- your choice. > > Cheers, > > tedd Yes. But since I don't want to display a success information + form fields, but only the success information, I believe the only w

Re: [PHP] PHP/MySQL Superstars

2009-10-02 Thread tedd
At 4:29 PM -0400 10/1/09, Robert Cummings wrote: I'm a superstar... send me a check for $500,000 and I'll fly on over. Or did you completely misuse the word "superstar"? Cheers, Rob. Rob: Well, in my book you are a superstar. Cheers, tedd -- --- http://sperling.com http://ancientston

RE: [PHP] Self-Process php forms or not?

2009-10-02 Thread tedd
At 3:06 PM +0100 10/2/09, MEM wrote: I want to apologize to you all. I have mentioned two things on the same basket, but it was not appropriate. Since a confirmation page is not the same thing as a success page. Let's forget about the confirmation page, since it's not required. I'm now understa

Re: [PHP] Self-Process php forms or not?

2009-10-02 Thread tedd
At 1:55 PM +0530 10/2/09, kranthi wrote: and yes i forgot to mention... i avoid hidden form elements because they can be modified very easily and hence pose a security threat. That depends upon how sloppy you are in coding. NONE of my hidden variables pose any security problems whatsoever. Ch

Re: [PHP] Curl output

2009-10-02 Thread Ashley Sheridan
On Fri, 2009-10-02 at 18:07 +0530, kranthi wrote: > >> I've read that the upcoming Firefox 4 may have some features built in > >> for this sort of thing, and there are plugins out there for most > >> browsers that can do this as an added layer of security. > Sorry but I could not understand what yo

RE: [PHP] Self-Process php forms or not?

2009-10-02 Thread MEM
I want to apologize to you all. I have mentioned two things on the same basket, but it was not appropriate. Since a confirmation page is not the same thing as a success page. Let's forget about the confirmation page, since it's not required. I'm now understanding that even if the form is submit

Re: [PHP] Parse Question Using list()

2009-10-02 Thread Gerardo Benitez
> > Use the tool that PHP provides for such problems. > > http://php.net/fgetcsv fgetcsv is very useful, here a example: $num fields in line $row: \n"; $row++; for ($c=0; $c < $num; $c++) { echo $data[$c] . "\n"; } } fclose($handle); ?> -- Gerardo Benitez

Re: [PHP] Curl output

2009-10-02 Thread kranthi
>> I've read that the upcoming Firefox 4 may have some features built in >> for this sort of thing, and there are plugins out there for most >> browsers that can do this as an added layer of security. Sorry but I could not understand what you meant by "this" coming back to original problem... you

Re: [PHP] Curl output

2009-10-02 Thread Ashley Sheridan
On Fri, 2009-10-02 at 15:59 +0530, kranthi wrote: > not many users use those kind of browsers, because if they do most of > the websites which use CDNs will not work. I've read that the upcoming Firefox 4 may have some features built in for this sort of thing, and there are plugins out there for m

Re: [PHP] Curl output

2009-10-02 Thread kranthi
>> Some browser security settings may not allow you to run Javascript code >> that exists on another server though not many users use those kind of browsers, because if they do most of the websites which use CDNs will not work. Firstly, it is not a good idea to fetch an entire web page and snow it

Re: [PHP] Self-Process php forms or not?

2009-10-02 Thread kranthi
>> You say you don't use hidden fields because they can be modified too >> easily, yet you say you check for the submit button? Which out of the >> two do you do, as last time I checked, modifying one form field is as >> easy as changing any other! I completely agree with you. changing submit text

Re: [PHP] Self-Process php forms or not?

2009-10-02 Thread Ashley Sheridan
On Fri, 2009-10-02 at 13:55 +0530, kranthi wrote: > and yes i forgot to mention... i avoid hidden form elements because > they can be modified very easily and hence pose a security threat. > You say you don't use hidden fields because they can be modified too easily, yet you say you check for the

Re: [PHP] Curl output

2009-10-02 Thread Ashley Sheridan
On Fri, 2009-10-02 at 12:51 +0530, kranthi wrote: > using the http://www.w3schools.com/TAGS/tag_base.asp > but I am not sure if base tag works outside > > try... before curl_init() > where URL is parsed using PHP's parse_url() function on http://example.com > > in either case if there are

Re: [PHP] Self-Process php forms or not?

2009-10-02 Thread kranthi
and yes i forgot to mention... i avoid hidden form elements because they can be modified very easily and hence pose a security threat. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Self-Process php forms or not?

2009-10-02 Thread kranthi
>> That only works if the user clicks on that submit button. If the user >> hits the enter key in a text input, the form is submitted but the submit >> input variable is not set. That is why an hidden input is a safer solution. i doubt that, because i use the above mentioned method in nearly all o

Re: [PHP] RE: WYSIWYG editor to change textarea

2009-10-02 Thread kranthi
I would recommend using an open framework like yui/dojo/jquery for ALL your javascript needs..(i personally prefer jquery) each of the above mentioned frameworks have wysiwyg editors of their own. try using http://code.google.com/p/jwysiwyg/ i doubt it will conflict with your javascript with compa

Re: [PHP] Self-Process php forms or not?

2009-10-02 Thread Manuel Lemos
Hello, on 10/02/2009 04:41 AM kranthi said the following: > I try to avoid the use of hidden form elements as much as possible, > especially for tracking whether a user has submitted a form or not... > > I use name="submit" for the submit button instead, that will pass the > value of the submit b

[PHP] RE: PHP/MySQL Superstars

2009-10-02 Thread Jerome Botbol
Thanks Manuel your input is greatly appreciated. Jerome -Original Message- From: Manuel Lemos [mailto:mle...@acm.org] Sent: 01 October 2009 20:46 To: Jerome Botbol Cc: php-general@lists.php.net Subject: Re: PHP/MySQL Superstars Hello, on 10/01/2009 10:09 AM Jerome Botbol said the foll

Re: [PHP] Incorrect _SERVER['SERVER_PORT'] returned??

2009-10-02 Thread kranthi
i dont have any idea about your problem, but just an idea have you used https://localhost in the browser while trying to check _SERVER['SERVER_PORT'] ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Self-Process php forms or not?

2009-10-02 Thread kranthi
I try to avoid the use of hidden form elements as much as possible, especially for tracking whether a user has submitted a form or not... I use name="submit" for the submit button instead, that will pass the value of the submit button to the action script. above all i use a template engine, smart

Re: [PHP] Curl output

2009-10-02 Thread kranthi
using the http://www.w3schools.com/TAGS/tag_base.asp but I am not sure if base tag works outside try... before curl_init() where URL is parsed using PHP's parse_url() function on http://example.com in either case if there are any external js/css files cURL wont fetch external files(and if t