php-general Digest 16 Nov 2008 13:51:04 -0000 Issue 5793

2008-11-16 Thread php-general-digest-help

php-general Digest 16 Nov 2008 13:51:04 - Issue 5793

Topics (messages 283325 through 283331):

Days until Easter and Christmas
283325 by: Ron Piggott
283328 by: David Robley

Re: ability to find include files...
283326 by: Andrew Ballard
283330 by: Richard Heyes
283331 by: tedd

Re: user access/roles/privs functionality
283327 by: Eric Butera

Re: mySQL query question
283329 by: Jim Lucas

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]


--
---BeginMessage---
Is there a way to modify this code so it will always be the *next*
Christmas and Easter?

?php

$todays_date_seasonal_format = DATE(Y-m-d);
$next_Christmas = DATE(Y) . -12-25;
$next_Easter = date(D d M Y, strtotime(2009-03-21
+.easter_days(2009). days));
$days_until_Christmas = ( strtotime($next_Christmas) -
strtotime($todays_date_seasonal_format) ) / 86400;
$days_until_Easter = round(( strtotime($next_Easter) -
strtotime($todays_date_seasonal_format) ) / 86400);

echo $days_until_Christmas . br;
echo $days_until_Easter . br;

---End Message---
---BeginMessage---
Ron Piggott wrote:

 Is there a way to modify this code so it will always be the *next*
 Christmas and Easter?
 
 ?php
 
 $todays_date_seasonal_format = DATE(Y-m-d);
 $next_Christmas = DATE(Y) . -12-25;
 $next_Easter = date(D d M Y, strtotime(2009-03-21
 +.easter_days(2009). days));
 $days_until_Christmas = ( strtotime($next_Christmas) -
 strtotime($todays_date_seasonal_format) ) / 86400;
 $days_until_Easter = round(( strtotime($next_Easter) -
 strtotime($todays_date_seasonal_format) ) / 86400);
 
 echo $days_until_Christmas . br;
 echo $days_until_Easter . br;

Have you tried incrementing the year value by one when you define
$next_[holiday]


Cheers
-- 
David Robley

He who always plows a straight furrow is in a rut.
Today is Setting Orange, the 28th day of The Aftermath in the YOLD 3174. 

---End Message---
---BeginMessage---
On Sat, Nov 15, 2008 at 6:07 PM, bruce [EMAIL PROTECTED] wrote:

 Hi list...

 starting to go through a debug/understanding session of a couple of php web
 apps. i'm wondering if there's any kind of tool/method that i can use to see
 which files are accessed/included/required when a given page is displayed..

 this would allow me to quickly understand the flow of the apps. searching
 via google hasn't really turned up anything...

 thoughts/comments/pointers welcome.

 thanks!


Yes. How about get_included_files().

http://www.php.net/get_included_files

Andrew
---End Message---
---BeginMessage---
 starting to go through a debug/understanding session of a couple of php web
 apps. i'm wondering if there's any kind of tool/method that i can use to see
 which files are accessed/included/required when a given page is displayed..

 this would allow me to quickly understand the flow of the apps. searching
 via google hasn't really turned up anything...

If the app has a support list, you could try asking for pointers on
that. Or you could try the authors.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 15th)
---End Message---
---BeginMessage---

At 3:07 PM -0800 11/15/08, bruce wrote:

Hi list...

starting to go through a debug/understanding session of a couple of php web
apps. i'm wondering if there's any kind of tool/method that i can use to see
which files are accessed/included/required when a given page is displayed..

this would allow me to quickly understand the flow of the apps. searching
via google hasn't really turned up anything...

thoughts/comments/pointers welcome.


One of the techniques I use is to place an echo('include name'); 
at the top of all includes. Then when parent scripts are run, you see 
which includes are loaded.


I also do this to see if an include has any problems -- for if it 
does, then you won't see it report.


HTH's

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com
---End Message---
---BeginMessage---
On Sat, Nov 15, 2008 at 11:21 AM, bruce [EMAIL PROTECTED] wrote:
 Hi list...

 I need a way of managing users/teams/etc.. implementing roles/access
 rights/privs,etc...

 I'd like a way of being able to have users report to the resource above
 them, ie, the ability to have a hierarchical kind of tree approach would be
 good as wel, as this would allow different user/mgr/teams to be moved
 up/down in the tree as required.

 If I can find the right process, I'll implement it in my targeted app. I'd
 prefer something that's fairly well compartmentalized.. but if need be, I'm
 willing to rip the right system out of it's parent app if I can find one
 that's good!!!

 I've reviewed the systems in the vtiger/knowledgetree apps.

 thoughts/comments/pointers would be 

php-general Digest 17 Nov 2008 06:44:18 -0000 Issue 5794

2008-11-16 Thread php-general-digest-help

php-general Digest 17 Nov 2008 06:44:18 - Issue 5794

Topics (messages 283332 through 283338):

Re: Another question about Google maps
283332 by: Michael Kubler
283334 by: tedd

Re: Days until Easter and Christmas
28 by: tedd
283335 by: tedd
283336 by: Yeti

Re: mySQL query question
283337 by: Chris
283338 by: Jim Lucas

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]


--
---BeginMessage---

Well, it shows up for FFox v2 and v3 on Windows XP as well.
I managed to replicate it by shift+refreshing the page.

I also managed to stop it mid load by setting Firefox to 'Work Offline' 
just as it displayed the flash of both boxes.


Using the Web Developer plugin for FFox I can tell you that the top box 
has a class of '.gsmsc-mapDiv' while the bottom div one is 
'.gsmsc-idleMapDiv', and both are wrapped in the '.gsmsc-appContainer' 
div, and also the '#mapsearch' div.


I've not played with google maps enough, but doubt the above helps, I 
just but know that it's not a PHP issue. It's almost like a flash of 
unstyled content http://www.bluerobot.com/web/css/fouc.asp/, but is 
being generated because of the javascript.


I hid the '.gsmsc-mapDiv' which stopped the flash of both box boxes 
appearing, and I could view the map, but caused the map to disappear 
after I tried searching for a different Google Maps location.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



tedd wrote:

Hi gang:

I posted this question on the Google Map Discussion group/list 
thingie, but got zip in replies. Maybe someone here might have an idea.


Here's the url:

http://masoncollision.com/contact.php

In both Safari and FireFox for the Mac (I have not tested it with 
other browsers) as the page loads the map border is momentary drawn 
twice. The map border is shown stacked one above the other making the 
page much longer than it actually is. But immediately thereafter, the 
map is drawn correctly and the page returns to the size it's supposed 
to be.


I just want to get rid of the momentary flash.

Anyone have any ideas?

Cheers and thanks,

tedd
---End Message---
---BeginMessage---

At 1:29 AM +1030 11/17/08, Michael Kubler wrote:

Well, it shows up for FFox v2 and v3 on Windows XP as well.
I managed to replicate it by shift+refreshing the page.

I also managed to stop it mid load by setting Firefox to 'Work 
Offline' just as it displayed the flash of both boxes.


Using the Web Developer plugin for FFox I can tell you that the top 
box has a class of '.gsmsc-mapDiv' while the bottom div one is 
'.gsmsc-idleMapDiv', and both are wrapped in the 
'.gsmsc-appContainer' div, and also the '#mapsearch' div.


I've not played with google maps enough, but doubt the above helps, 
I just but know that it's not a PHP issue. It's almost like a flash 
of unstyled content http://www.bluerobot.com/web/css/fouc.asp/, 
but is being generated because of the javascript.


I hid the '.gsmsc-mapDiv' which stopped the flash of both box boxes 
appearing, and I could view the map, but caused the map to disappear 
after I tried searching for a different Google Maps location.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz


Michael

Thanks very much for your time looking into this.

It IS very similar of FOUC and I looked into that as a possible 
problem/solution.


I think you can see why I didn't get a reply from my Google post -- 
it's one of those problems that Google has, but doesn't yet 
understand it well enough to fix it. Too busy with new stuff *.


I may have to hide the map via css and then change display after load 
-- I just didn't want to go that route IF there was a better way.


Thanks again,

tedd


PS: * I really like Google's Analytics, but hate all the javascript 
errors it generates in FF firebug.


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com
---End Message---
---BeginMessage---

At 6:51 PM -0500 11/15/08, Ron Piggott wrote:

Is there a way to modify this code so it will always be the *next*
Christmas and Easter?

?php

$todays_date_seasonal_format = DATE(Y-m-d);
$next_Christmas = DATE(Y) . -12-25;
$next_Easter = date(D d M Y, strtotime(2009-03-21
+.easter_days(2009). days));
$days_until_Christmas = ( strtotime($next_Christmas) -
strtotime($todays_date_seasonal_format) ) / 86400;
$days_until_Easter = round(( strtotime($next_Easter) -
strtotime($todays_date_seasonal_format) ) / 86400);

echo $days_until_Christmas . br;
echo $days_until_Easter . br;



Try this:

http://www.webbytedd.com/b2/easter/

It's just an organizational issue.

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com
---End Message---
---BeginMessage---


Re: [PHP] ability to find include files...

2008-11-16 Thread Richard Heyes
 starting to go through a debug/understanding session of a couple of php web
 apps. i'm wondering if there's any kind of tool/method that i can use to see
 which files are accessed/included/required when a given page is displayed..

 this would allow me to quickly understand the flow of the apps. searching
 via google hasn't really turned up anything...

If the app has a support list, you could try asking for pointers on
that. Or you could try the authors.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 15th)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ability to find include files...

2008-11-16 Thread tedd

At 3:07 PM -0800 11/15/08, bruce wrote:

Hi list...

starting to go through a debug/understanding session of a couple of php web
apps. i'm wondering if there's any kind of tool/method that i can use to see
which files are accessed/included/required when a given page is displayed..

this would allow me to quickly understand the flow of the apps. searching
via google hasn't really turned up anything...

thoughts/comments/pointers welcome.


One of the techniques I use is to place an echo('include name'); 
at the top of all includes. Then when parent scripts are run, you see 
which includes are loaded.


I also do this to see if an include has any problems -- for if it 
does, then you won't see it report.


HTH's

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Another question about Google maps

2008-11-16 Thread Michael Kubler

Well, it shows up for FFox v2 and v3 on Windows XP as well.
I managed to replicate it by shift+refreshing the page.

I also managed to stop it mid load by setting Firefox to 'Work Offline' 
just as it displayed the flash of both boxes.


Using the Web Developer plugin for FFox I can tell you that the top box 
has a class of '.gsmsc-mapDiv' while the bottom div one is 
'.gsmsc-idleMapDiv', and both are wrapped in the '.gsmsc-appContainer' 
div, and also the '#mapsearch' div.


I've not played with google maps enough, but doubt the above helps, I 
just but know that it's not a PHP issue. It's almost like a flash of 
unstyled content http://www.bluerobot.com/web/css/fouc.asp/, but is 
being generated because of the javascript.


I hid the '.gsmsc-mapDiv' which stopped the flash of both box boxes 
appearing, and I could view the map, but caused the map to disappear 
after I tried searching for a different Google Maps location.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



tedd wrote:

Hi gang:

I posted this question on the Google Map Discussion group/list 
thingie, but got zip in replies. Maybe someone here might have an idea.


Here's the url:

http://masoncollision.com/contact.php

In both Safari and FireFox for the Mac (I have not tested it with 
other browsers) as the page loads the map border is momentary drawn 
twice. The map border is shown stacked one above the other making the 
page much longer than it actually is. But immediately thereafter, the 
map is drawn correctly and the page returns to the size it's supposed 
to be.


I just want to get rid of the momentary flash.

Anyone have any ideas?

Cheers and thanks,

tedd


Re: [PHP] Days until Easter and Christmas

2008-11-16 Thread tedd

At 6:51 PM -0500 11/15/08, Ron Piggott wrote:

Is there a way to modify this code so it will always be the *next*
Christmas and Easter?

?php

$todays_date_seasonal_format = DATE(Y-m-d);
$next_Christmas = DATE(Y) . -12-25;
$next_Easter = date(D d M Y, strtotime(2009-03-21
+.easter_days(2009). days));
$days_until_Christmas = ( strtotime($next_Christmas) -
strtotime($todays_date_seasonal_format) ) / 86400;
$days_until_Easter = round(( strtotime($next_Easter) -
strtotime($todays_date_seasonal_format) ) / 86400);

echo $days_until_Christmas . br;
echo $days_until_Easter . br;



Try this:

http://www.webbytedd.com/b2/easter/

It's just an organizational issue.

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Another question about Google maps

2008-11-16 Thread tedd

At 1:29 AM +1030 11/17/08, Michael Kubler wrote:

Well, it shows up for FFox v2 and v3 on Windows XP as well.
I managed to replicate it by shift+refreshing the page.

I also managed to stop it mid load by setting Firefox to 'Work 
Offline' just as it displayed the flash of both boxes.


Using the Web Developer plugin for FFox I can tell you that the top 
box has a class of '.gsmsc-mapDiv' while the bottom div one is 
'.gsmsc-idleMapDiv', and both are wrapped in the 
'.gsmsc-appContainer' div, and also the '#mapsearch' div.


I've not played with google maps enough, but doubt the above helps, 
I just but know that it's not a PHP issue. It's almost like a flash 
of unstyled content http://www.bluerobot.com/web/css/fouc.asp/, 
but is being generated because of the javascript.


I hid the '.gsmsc-mapDiv' which stopped the flash of both box boxes 
appearing, and I could view the map, but caused the map to disappear 
after I tried searching for a different Google Maps location.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz


Michael

Thanks very much for your time looking into this.

It IS very similar of FOUC and I looked into that as a possible 
problem/solution.


I think you can see why I didn't get a reply from my Google post -- 
it's one of those problems that Google has, but doesn't yet 
understand it well enough to fix it. Too busy with new stuff *.


I may have to hide the map via css and then change display after load 
-- I just didn't want to go that route IF there was a better way.


Thanks again,

tedd


PS: * I really like Google's Analytics, but hate all the javascript 
errors it generates in FF firebug.


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Days until Easter and Christmas

2008-11-16 Thread tedd

At 6:51 PM -0500 11/15/08, Ron Piggott wrote:

Is there a way to modify this code so it will always be the *next*
Christmas and Easter?


Also, I forgot to add.

Easter lands on different dates depending upon several different 
factors. For example in Canada it's the day after it is in the USA -- 
I guess Canadians are slower, eh?  :-)


Also, in some religions the date is the full-moon after the Equinox 
and not a specific date. Furthermore, the Equinox does not always 
land on March 21, but sometimes it's March 20 (leap year).


As an example, next year Easter will be on April 9, 12, 13, and 19th 
-- the ten days of Easter.  :-)


You can read more about it here:

http://en.wikipedia.org/wiki/Easter

So, my example here:

http://www.webbytedd.com/b2/easter/

would be more correct if it took into account leap year, location, 
and what religion it's for.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Days until Easter and Christmas

2008-11-16 Thread Yeti
 I guess Canadians are slower, eh?  :-)
LOL

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mySQL query question

2008-11-16 Thread Chris

Jim Lucas wrote:

[EMAIL PROTECTED] wrote:
Ok, so just that I am clear, you are SELECTing and pulling all the data 
that you are submitting in the above INSERT statement from the DB 
initially,

then you are only modifying the confirm_number value and then re-
submitting all the values, as they originally were,
Well, actually when all is said and done, a new record will be created with 
new information (Name, phone, email, etc) and the confirm_number is the 
previous+1


Seems like a perfect candidate for an auto-inc field, though mysql 
doesn't let you have multiple in the same table (afaik).



# Now prepare your statement
$SQL = 
SET @confirm_number=(SELECT (MAX(confirm_number)+1) FROM `contacts`);
INSERT INTO `contacts` (
  `first_name`,
  `last_name`,
  `email`,
  `phn_number`,
  `address`,
  `city`,
  `state`,
  `zip`,
  `dates`,
  `comments`,
  `confirm_number`
  ) VALUES (
  '{$FirstName}',
  '{$LastName}',
  '{$Email}',
  '{$Phone}',
  '{$Address}',
  '{$City}',
  '{$selected_state}',
  '{$Zip}',
  '{$newdate}',
  '{$Comments}',
  @confirm_number
  )
SELECT @confirm_number AS confirm_number;
;


You do have a race condition, you can end up with 2 of the same 
confirm_numbers (you'd have to be unlucky, but it can happen).


2 hits at the same time = 2 selects getting the same 
max(confirm_number), which results in 2 inserts with the same number.


--
Postgresql  php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mySQL query question

2008-11-16 Thread Jim Lucas

Chris wrote:

Jim Lucas wrote:

[EMAIL PROTECTED] wrote:
Ok, so just that I am clear, you are SELECTing and pulling all the 
data that you are submitting in the above INSERT statement from the 
DB initially,

then you are only modifying the confirm_number value and then re-
submitting all the values, as they originally were,
Well, actually when all is said and done, a new record will be 
created with new information (Name, phone, email, etc) and the 
confirm_number is the previous+1


Seems like a perfect candidate for an auto-inc field, though mysql 
doesn't let you have multiple in the same table (afaik).




I would agree, but I'm not the OP.  He/She wanted it this way...



You do have a race condition, you can end up with 2 of the same 
confirm_numbers (you'd have to be unlucky, but it can happen).


2 hits at the same time = 2 selects getting the same 
max(confirm_number), which results in 2 inserts with the same number.




Granted that their is a possibility that it could happen.  But the chance of it happening with the 
three statements running back-to-back in the same call is much lower then having three separate 
calls and doing the math in PHP.


--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] user access/roles/privs functionality

2008-11-16 Thread Thodoris



On Sat, Nov 15, 2008 at 11:21 AM, bruce [EMAIL PROTECTED] wrote:
  

Hi list...

I need a way of managing users/teams/etc.. implementing roles/access
rights/privs,etc...

I'd like a way of being able to have users report to the resource above
them, ie, the ability to have a hierarchical kind of tree approach would be
good as wel, as this would allow different user/mgr/teams to be moved
up/down in the tree as required.

If I can find the right process, I'll implement it in my targeted app. I'd
prefer something that's fairly well compartmentalized.. but if need be, I'm
willing to rip the right system out of it's parent app if I can find one
that's good!!!

I've reviewed the systems in the vtiger/knowledgetree apps.

thoughts/comments/pointers would be useful!

thanks!





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





Take a look at Zend_Acl

  



If your needs are bigger than a simple user/group access schema as you 
describe, then I would suggest considering LDAP.


PHP has support for it although I haven't wrote something using this 
API.  I have been using it to authenticate my users some years ago an it 
is quite fast and rich.


You certainly have a tree since LDAP is a directory although AFAIK it is 
slower when writing if you compare it with a database but much faster 
when reading data. So in case your users' info are changing very often 
then this is probably not the best solution for you but in any other 
case try to see if it fits your needs.


http://gr2.php.net/manual/en/intro.ldap.php

--
Thodoris



Re: [PHP] ability to find include files...

2008-11-16 Thread Thodoris



On Sat, Nov 15, 2008 at 6:07 PM, bruce [EMAIL PROTECTED] wrote:
  

Hi list...

starting to go through a debug/understanding session of a couple of php web
apps. i'm wondering if there's any kind of tool/method that i can use to see
which files are accessed/included/required when a given page is displayed..

this would allow me to quickly understand the flow of the apps. searching
via google hasn't really turned up anything...

thoughts/comments/pointers welcome.

thanks!




Yes. How about get_included_files().

http://www.php.net/get_included_files

Andrew

  


This of course shows the included files but if you *really* need to go 
much deeper (although this is probably an overkill) you could try 
tracing when the process opens a file using strace along with grep if 
you are in unix.


--
Thodoris