php-general Digest 21 Aug 2009 11:26:19 -0000 Issue 6297
php-general Digest 21 Aug 2009 11:26:19 - Issue 6297 Topics (messages 297042 through 297053): Re: Displaying 2 digit minutes/seconds 297042 by: Ashley Sheridan 297043 by: sono-io.fannullone.us 297044 by: sono-io.fannullone.us 297046 by: Daevid Vincent Submit login form using HTTP AUTH 297045 by: LinuxManMikeC Tidy on a shared host 297047 by: Al Re: PHP/Ajax Framework - Call for Developers Testers 297048 by: Raymond Irving Is there limitation for switch case: argument's value? 297049 by: Keith 297050 by: Adam Randall 297051 by: Lars Torben Wilson Re: SESSION VARIABLES ACROSS DIFFERENT WINDOWS/TABS 297052 by: Leon du Plessis Invoking functions stored in a separate directory? 297053 by: Clancy Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On Thu, 2009-08-20 at 14:27 -0700, sono...@fannullone.us wrote: Hi all, I'm using this code to display the current time for our location on our website: ?php date_default_timezone_set('America/Los_Angeles'); $theTimeIs = getdate(time()); $theHour = $theTimeIs['hours']; $theMinute = $theTimeIs['minutes']; // make minutes under 10 show two digits $theSecond = $theTimeIs['seconds']; if($theHour 12){ $theHour = $theHour - 12; $dn = PM; } else { $dn = AM; } echo $theHour:$theMinute:$theSecond $dn; ? It works great except for one small detail. If the time is 3:04:02, it is displayed as 3:4:2 which, of course, is very odd looking. So I corrected it as follows: ?php date_default_timezone_set('America/Los_Angeles'); $theTimeIs = getdate(time()); $theHour = $theTimeIs['hours']; if (strlen ($theTimeIs['minutes']) 2) { $theMinute = 0 . $theTimeIs['minutes']; } else { $theMinute = $theTimeIs['minutes']; } if (strlen ($theTimeIs['seconds']) 2) { $theSecond = 0 . $theTimeIs['seconds']; } else { $theSecond = $theTimeIs['seconds']; } if($theHour 12){ $theHour = $theHour - 12; $dn = PM; } else { $dn = AM; } echo $theHour:$theMinute:$theSecond $dn; ? It works, but is there a better way to do it? Thanks, Frank What's wrong with using the date() function? You can have it output any sort of format you wish. So, getting a 2 digit time in hours:minutes:seconds you would put: date(H:i:s); Thanks, Ash http://www.ashleysheridan.co.uk ---End Message--- ---BeginMessage--- On Aug 20, 2009, at 2:38 PM, Ashley Sheridan wrote: What's wrong with using the date() function? You can have it output any sort of format you wish. So, getting a 2 digit time in hours:minutes:seconds you would put: date(H:i:s); Thanks, Ash. I had tried that before but I couldn't find a way to make it display in 12 hour time, so I went with the other method. I guess I didn't look hard enough. =;) This works: echo (date(g:i A)); Frank ---End Message--- ---BeginMessage--- On Aug 20, 2009, at 2:34 PM, Jonathan Tapicer wrote: You can use sprintf or str_pad to fill in with zeros, with sprintf you can do this: echo sprintf('%02d', 5); Thanks, Jonathan! I learned two new functions today! Both work great but I think I like sprintf for this application better since it's more succinct. echo sprintf('%02d', $theMinute); echo (str_pad($theMinute,2,0,STR_PAD_LEFT)); Frank ---End Message--- ---BeginMessage--- -Original Message- From: sono...@fannullone.us [mailto:sono...@fannullone.us] Sent: Thursday, August 20, 2009 3:53 PM To: Jonathan Tapicer; PHP General List Subject: Re: [PHP] Displaying 2 digit minutes/seconds On Aug 20, 2009, at 2:34 PM, Jonathan Tapicer wrote: You can use sprintf or str_pad to fill in with zeros, with sprintf you can do this: echo sprintf('%02d', 5); Thanks, Jonathan! I learned two new functions today! Both work great but I think I like sprintf for this application better since it's more succinct. echo sprintf('%02d', $theMinute); Uh. If you MUST do this nonsense, then at least do this instead and not echo sprintf: printf('%02d', $theMinute); ---End Message--- ---BeginMessage--- Anybody know of any tricks to make an HTML login form that sends
php-general Digest 22 Aug 2009 02:34:03 -0000 Issue 6298
php-general Digest 22 Aug 2009 02:34:03 - Issue 6298 Topics (messages 297054 through 297067): Re: PHP/Ajax Framework - Call for Developers Testers 297054 by: Bob McConnell about to run PHP script when POST data. 297055 by: Jacky 297057 by: Arno Kuhl Re: Invoking functions stored in a separate directory? 297056 by: Arno Kuhl Re: Extract column names from a (my)SQL query 297058 by: Nisse Engström 297064 by: Daevid Vincent 297065 by: ×× ××× ×× ×× 297066 by: ×× ××× ×× ×× PHP Shopping Cart Recommendation 297059 by: sono-io.fannullone.us 297060 by: Ashley Sheridan PHP 5.x magic mathods quick question 297061 by: Ralph Deffke 297062 by: Martin Scotta Re: Is there limitation for switch case: argument's value? 297063 by: Daevid Vincent Re: HTML text extraction 297067 by: Manuel Lemos Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- From: Raymond Irving Hi Nathan, I agree with you, and I believe that there are many persons who don't like the idea of hosting all their applications on a third party server. IMO there are some advantages and disadvantages to doing so but that's a discussion in itself. Hosted servers are basically a trade off between doing it yourself and paying someone else to do it. The initial choice is between installing your own servers or spend the money to rent servers from someone else. Most of the time it is actually the network bandwidth issue that decides this. Can you afford a network connection that will handle the peak loads but be unused most of the time? But once you decide to pay someone else, you have another set of trade offs to negotiate. What services do they provide? What systems do they offer? How do they manage version control and updates? Are they PCI compliant? There are a wide range of options available in the market. Not all of them will fit your specific needs. We just moved most of our servers from a physical hosting service to a managed service. Where we used to maintain the OS and all software on the server, the new service now handles that for us. The trade off is that now we have to settle for the server package they offer. That means we get the versions of Apache, PHP and PostgreSQL that were included in the last production release of RHEL. If we want a newer version of PHP, we have to take over maintenance of that component. It becomes our responsibility to install the updates, patches, etc., for that component. Once you get beyond a private web site these types of decisions become part of the management process, just as make or buy decisions are part of the hardware procurement process. There are people out there making a good living just guiding companies through this decision making process. Bob McConnell ---End Message--- ---BeginMessage--- Hi guys, As I know When we POST a big data(e.g. 500M) to a php script, the php script only can run after the big data finished POST. for example: a.php ?php die(''); ? and I post 500m data to a.php, after that a.php cannot be died immediately. only when the data finished post. How can I make the a.php die before the 500m data finish? Thanks in advance. -- Regards, Jacky ---End Message--- ---BeginMessage--- -Original Message- From: Jacky [mailto:newbde...@gmail.com] Sent: 21 August 2009 03:12 PM To: php-gene...@lists.php.net Subject: [PHP] about to run PHP script when POST data. Hi guys, As I know When we POST a big data(e.g. 500M) to a php script, the php script only can run after the big data finished POST. for example: a.php ?php die(''); ? and I post 500m data to a.php, after that a.php cannot be died immediately. only when the data finished post. How can I make the a.php die before the 500m data finish? Thanks in advance. -- Regards, Jacky --- Your script will die ungracefully when it runs out of execution time (defined in php.ini) Cheers Arno ---End Message--- ---BeginMessage--- -Original Message- From: Clancy [mailto:clanc...@cybec.com.au] Sent: 21 August 2009 01:26 PM To: php-gene...@lists.php.net Subject: [PHP] Invoking functions stored in a separate directory? I am developing an idea for a website engine which can be shared between several different websites. Each website would have its own directory under a common root directory, and the engine would be in a separate directory Engine: Root Website_1.com, Website_2.com, Engine The website directories would each contain the design data for that website, consisting basically of a mixture of text files and images. The various pages would be loaded by loading