php-windows Digest 27 Mar 2002 02:40:22 -0000 Issue 1064

Topics (messages 12759 through 12767):

Re: connecting to a database using ODBC
        12759 by: Piotr Pluciennik
        12760 by: Svensson, B.A.T. (HKG)

Lecture de cookie ASP
        12761 by: Kriegers Horst

Re: Read ASP cookie
        12762 by: Svensson, B.A.T. (HKG)
        12763 by: George Pitcher

how to get consistent UTC from gmmktime (w/o dst-offset) ????
        12764 by: Patrick Sibenaler

Cookies on Win2000 and IIS 5.0
        12765 by: Arijit Chaudhuri

Re: [PHP-DB] how to get consistent UTC from gmmktime (w/o dst-offset) ????
        12766 by: DL Neil

PHP as an Apache module
        12767 by: Ali

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 ---
Hi,

******first step: 
create DSN in Windows (Control Panel, ODBC) and bind
it with your Access database

******then in php code:****

     $dbhandle = odbc_connect('YourDSN', '','');

     if($dbhandle == 0)
     {
        die('Error connecting DB'); // or error
handler
     }

*****here do your php stuff****
you can use for example below commands to get your
data from DB
**     $qry = your sql
**     $cursor = odbc_exec($dbhandle, $qry)
**     odbc_fetch_row($cursor)
**     odbc_result($cursor,'field name')

*****then close connection*****

     odbc_close($dbhandle);

this is the idea...

HTH

Piotr

--- Someone Somewhere <[EMAIL PROTECTED]>
wrote:
> Can anyone offer some help
> 
> I need to connect to an acces database, Using php on
> Windows with Apache.
> If anyone has some sample code I would greatly
> appreciate it I am lost about 
> the wholeODBC thing.
> 
> Cirkit
> 
> 
> 
>
_________________________________________________________________
> Chat with friends online, try MSN Messenger:
> http://messenger.msn.com
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/
--- End Message ---
--- Begin Message ---
You need more than "sample code" to access an AccessDB via ODBC. For
example: you need to know weather a proper ODBC data source has been set up,
among other things...


>-----Original Message-----
>From: Someone Somewhere [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, March 26, 2002 3:10 PM
>To: [EMAIL PROTECTED]
>Subject: [PHP-WIN] connecting to a database using ODBC 
>
>
>Can anyone offer some help
>
>I need to connect to an acces database, Using php on Windows with Apache.
>If anyone has some sample code I would greatly appreciate it I am lost
about 
>the wholeODBC thing.
>
>Cirkit
>
>
>
>_________________________________________________________________
>Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
>-- 
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Bonjour la liste,

est-il possible de lire un cookie créé par ASP ?
response.cookies("bidule")("nom") = "Tartempion"
response.cookies("bidule")("prenom") = "Jules"

Horst

--- End Message ---
--- Begin Message ---
I've taken the freedom to CC this message to php-win...

>-----Original Message-----
>From: Kriegers Horst [mailto:[EMAIL PROTECTED]] 
>Sent: Tuesday, March 26, 2002 4:15 PM
>To: Svensson, B.A.T. (HKG)
>Subject: RE: [PHP-WIN] Read ASP cookie
>
>
>Sorry.
>
>Translated question:
>
>It is possible with PHP to read a cookie wich was created with ASP ?
>response.cookies("bidule")("nom") = "Tartempion"
>response.cookies("bidule")("prenom") = "Jules"
>
>
>Horst
>
>
>> -----Message d'origine-----
>> De:  Svensson, B.A.T. (HKG) [SMTP:[EMAIL PROTECTED]]
>> Date:        mardi, 26. mars 2002 16:07
>> À:   'Kriegers Horst'
>> Objet:       RE: [PHP-WIN] Lecture de cookie ASP
>> 
>> Dear Horts,
>> 
>> English is usually "franca lingua" in international e-mail lists.
>> 
>> Sinc,
>> Anders
>> 
>> >-----Original Message-----
>> >From: Kriegers Horst [mailto:[EMAIL PROTECTED]]
>> >Sent: Tuesday, March 26, 2002 4:05 PM
>> >To: 'PHP coup2main'; 'PHP-Windows'
>> >Subject: [PHP-WIN] Lecture de cookie ASP
>> >
>> >
>> >Bonjour la liste,
>> >
>> >est-il possible de lire un cookie créé par ASP ?
>> >response.cookies("bidule")("nom") = "Tartempion"
>> >response.cookies("bidule")("prenom") = "Jules"
>> >
>> >Horst
>> >
>> >
>> >-- 
>> >PHP Windows Mailing List (http://www.php.net/)
>> >To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>
--- End Message ---
--- Begin Message ---
Yes. Cookies don't belong to the application that created them, but to the
server/domain name. I use Lasso and it can create cookies and I have PHP
read them, do some cool stuff and then use cookies to pass data back.

George
----- Original Message -----
From: "Svensson, B.A.T. (HKG)" <[EMAIL PROTECTED]>
To: "'Kriegers Horst'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, March 26, 2002 3:17 PM
Subject: FW: [PHP-WIN] Read ASP cookie


I've taken the freedom to CC this message to php-win...

>-----Original Message-----
>From: Kriegers Horst [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, March 26, 2002 4:15 PM
>To: Svensson, B.A.T. (HKG)
>Subject: RE: [PHP-WIN] Read ASP cookie
>
>
>Sorry.
>
>Translated question:
>
>It is possible with PHP to read a cookie wich was created with ASP ?
>response.cookies("bidule")("nom") = "Tartempion"
>response.cookies("bidule")("prenom") = "Jules"
>
>
>Horst
>
>
>> -----Message d'origine-----
>> De: Svensson, B.A.T. (HKG) [SMTP:[EMAIL PROTECTED]]
>> Date: mardi, 26. mars 2002 16:07
>> À: 'Kriegers Horst'
>> Objet: RE: [PHP-WIN] Lecture de cookie ASP
>>
>> Dear Horts,
>>
>> English is usually "franca lingua" in international e-mail lists.
>>
>> Sinc,
>> Anders
>>
>> >-----Original Message-----
>> >From: Kriegers Horst [mailto:[EMAIL PROTECTED]]
>> >Sent: Tuesday, March 26, 2002 4:05 PM
>> >To: 'PHP coup2main'; 'PHP-Windows'
>> >Subject: [PHP-WIN] Lecture de cookie ASP
>> >
>> >
>> >Bonjour la liste,
>> >
>> >est-il possible de lire un cookie créé par ASP ?
>> >response.cookies("bidule")("nom") = "Tartempion"
>> >response.cookies("bidule")("prenom") = "Jules"
>> >
>> >Horst
>> >
>> >
>> >--
>> >PHP Windows Mailing List (http://www.php.net/)
>> >To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>

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

--- End Message ---
--- Begin Message ---


hi.

i'm storing events in a mysql-db, using epoch timestamps to pinpoint the 
exact date/time for an event.

so far, I have been using localtime, being aware that there are
inconsistencies 
in the number of epoch-seconds, when DST flips on and off. nevertheless, that 
works fine as long as you stick to mktime() and date() for all the date-math 
as in mktime(0,0,0,$month,$day+$offset,$year)

but as soon as you leave php and have to do some calculation in javascript, 
you will encounter functions that behave differently on the pc and mac 
platforms. so you have to revert back to the 'add 86400-seconds' to calculate 
the next day.

so I thought it would be nice to have all the timestamps as linear, 
non-dst-epoch-seconds (UTC) and I went into the gmmktime() and gmdate() 
functions, assuming they would do the math in a linear second-based timespace 
(in GMT, without DST). That seems to be the case for the output of 'gmdate', 
that remains correct, if you count up seconds across the DST boundary (see 
second example).

but it seems that there is no way to calculate the gmt-epoch for a given 
date using gmmktime without having to add/subtract the TZ manually. gmmktime
will always take your local DST-settings into calculation and upon conversion 
back with gmdate, you will be off by the number of hours of your timezone.
I thought gmmktime() would handle this as if the computer would be in
Greenwich 
(TZ=0), which would then leave us with the two functions encoding/decoding 
consistently.

anyone having solved this properly?

-------------------------------------
print "count days:<br>\n";
for($day=0; $day<7; $day++){
        $timgmt = gmmktime(0,0,0,3,28+$day,2002);
        $timloc = mktime(0,0,0,3,28+$day,2002);
        print $timgmt . "= gmmktim epoch - " . gmdate("D d.m.Y H:i I",$timgmt) .
"<br>\n";
        print $timloc . "= mktim epoch - " . date("D d.m.Y H:i  I",$timloc) .
"<br>\n";
        print "<BR>\n";
}

----
count days:
1017270000= gmmktim epoch - Wed 27.03.2002 23:00 0
1017270000= mktim epoch - Thu 28.03.2002 00:00 0

1017356400= gmmktim epoch - Thu 28.03.2002 23:00 0
1017356400= mktim epoch - Fri 29.03.2002 00:00 0

1017442800= gmmktim epoch - Fri 29.03.2002 23:00 0
1017442800= mktim epoch - Sat 30.03.2002 00:00 0

1017529200= gmmktim epoch - Sat 30.03.2002 23:00 0
1017529200= mktim epoch - Sun 31.03.2002 00:00 0
                                                    <<<dst on
1017619200= gmmktim epoch - Mon 01.04.2002 00:00 0  <<< off by one hour due to
DST
1017612000= mktim epoch - Mon 01.04.2002 00:00 1

1017705600= gmmktim epoch - Tue 02.04.2002 00:00 0
1017698400= mktim epoch - Tue 02.04.2002 00:00 1

1017792000= gmmktim epoch - Wed 03.04.2002 00:00 0
1017784800= mktim epoch - Wed 03.04.2002 00:00 1


-------------------------------------
print "count seconds:<br>\n";
$baseepoch = $timloc = mktime(0,0,0,3,28,2002);
for($day=0; $day<7; $day++){
        $epochnow = $baseepoch + (60 * 60 * 24 * $day);
        print $epochnow . "= gmmktim epoch - " . gmdate("D d.m.Y H:i I",$epochnow) .
"<br>\n";
        print $epochnow . "= mktim epoch - " . date("D d.m.Y H:i  I",$epochnow) .
"<br>\n";
        print "<BR>\n";
}
----
count seconds:
1017270000= gmmktim epoch - Wed 27.03.2002 23:00 0  <<< consistent, but off by
-1 (your TZ)
1017270000= mktim epoch - Thu 28.03.2002 00:00 0

1017356400= gmmktim epoch - Thu 28.03.2002 23:00 0
1017356400= mktim epoch - Fri 29.03.2002 00:00 0

1017442800= gmmktim epoch - Fri 29.03.2002 23:00 0
1017442800= mktim epoch - Sat 30.03.2002 00:00 0

1017529200= gmmktim epoch - Sat 30.03.2002 23:00 0
1017529200= mktim epoch - Sun 31.03.2002 00:00 0

1017615600= gmmktim epoch - Sun 31.03.2002 23:00 0
1017615600= mktim epoch - Mon 01.04.2002 01:00 1

1017702000= gmmktim epoch - Mon 01.04.2002 23:00 0
1017702000= mktim epoch - Tue 02.04.2002 01:00 1

1017788400= gmmktim epoch - Tue 02.04.2002 23:00 0
1017788400= mktim epoch - Wed 03.04.2002 01:00 1
--- End Message ---
--- Begin Message ---
Hi,

PHP and MySQL runs perfectly on Win2000 with IIS 5.0. The only problem seems
to be with cookies which are set only only refreshing the browser. Same
codes run perfectly on my Linux partition and on Linux servers. Is any
tweaking required for the php.ini file?

Regards,
Arijit


--- End Message ---
--- Begin Message ---
BTW for all who are following this, Patrick has cleverly illustrated
that most of the northern hemisphere locations where summer time is
observed will 'spring forward' this weekend. Most of the southern
hemisphere locations that were in summer time did their 'fall back' last
weekend!
NB the two uses of the word "most"!


Hi Patrick,

References from the manual:
-----
gmmktime -- Get UNIX timestamp for a GMT date
-----
gmdate -- Format a GMT/CUT date/time

Identical to the date() function except that the time returned is
Greenwich Mean Time (GMT). For example, when run in Finland (GMT +0200),
the first line below prints "Jan 01 1998 00:00:00", while the second
prints "Dec 31 1997 22:00:00".
echo date ("M d Y H:i:s", mktime (0,0,0,1,1,1998));
echo gmdate ("M d Y H:i:s", mktime (0,0,0,1,1,1998));
-----

The definition of the Unix Epoch is itself in GMT (and adjusted from
there to local time using the +/-TZ difference): "the current time
measured in the number of seconds since the Unix Epoch (January 1 1970
00:00:00 GMT)".

When playing around with UNIX epoch seconds it is important to keep them
time-zone separated. So try working your test backwards and putting in a
data/time and then asking for the GMT and the local timestamp values.
They will also be separated by the one hour/two hours.

Question answered, or in my haste to get to my dinner...?
Regards,
=dn



> i'm storing events in a mysql-db, using epoch timestamps to pinpoint
the
> exact date/time for an event.
>
> so far, I have been using localtime, being aware that there are
> inconsistencies
> in the number of epoch-seconds, when DST flips on and off.
nevertheless, that
> works fine as long as you stick to mktime() and date() for all the
date-math
> as in mktime(0,0,0,$month,$day+$offset,$year)
>
> but as soon as you leave php and have to do some calculation in
javascript,
> you will encounter functions that behave differently on the pc and mac
> platforms. so you have to revert back to the 'add 86400-seconds' to
calculate
> the next day.
>
> so I thought it would be nice to have all the timestamps as linear,
> non-dst-epoch-seconds (UTC) and I went into the gmmktime() and
gmdate()
> functions, assuming they would do the math in a linear second-based
timespace
> (in GMT, without DST). That seems to be the case for the output of
'gmdate',
> that remains correct, if you count up seconds across the DST boundary
(see
> second example).
>
> but it seems that there is no way to calculate the gmt-epoch for a
given
> date using gmmktime without having to add/subtract the TZ manually.
gmmktime
> will always take your local DST-settings into calculation and upon
conversion
> back with gmdate, you will be off by the number of hours of your
timezone.
> I thought gmmktime() would handle this as if the computer would be in
> Greenwich
> (TZ=0), which would then leave us with the two functions
encoding/decoding
> consistently.
>
> anyone having solved this properly?
>
> -------------------------------------
> print "count days:<br>\n";
> for($day=0; $day<7; $day++){
> $timgmt = gmmktime(0,0,0,3,28+$day,2002);
> $timloc = mktime(0,0,0,3,28+$day,2002);
> print $timgmt . "= gmmktim epoch - " . gmdate("D d.m.Y H:i I",$timgmt)
.
> "<br>\n";
> print $timloc . "= mktim epoch - " . date("D d.m.Y H:i  I",$timloc) .
> "<br>\n";
> print "<BR>\n";
> }
>
> ----
> count days:
> 1017270000= gmmktim epoch - Wed 27.03.2002 23:00 0
> 1017270000= mktim epoch - Thu 28.03.2002 00:00 0
>
> 1017356400= gmmktim epoch - Thu 28.03.2002 23:00 0
> 1017356400= mktim epoch - Fri 29.03.2002 00:00 0
>
> 1017442800= gmmktim epoch - Fri 29.03.2002 23:00 0
> 1017442800= mktim epoch - Sat 30.03.2002 00:00 0
>
> 1017529200= gmmktim epoch - Sat 30.03.2002 23:00 0
> 1017529200= mktim epoch - Sun 31.03.2002 00:00 0
>                                                     <<<dst on
> 1017619200= gmmktim epoch - Mon 01.04.2002 00:00 0  <<< off by one
hour due to
> DST
> 1017612000= mktim epoch - Mon 01.04.2002 00:00 1
>
> 1017705600= gmmktim epoch - Tue 02.04.2002 00:00 0
> 1017698400= mktim epoch - Tue 02.04.2002 00:00 1
>
> 1017792000= gmmktim epoch - Wed 03.04.2002 00:00 0
> 1017784800= mktim epoch - Wed 03.04.2002 00:00 1
>
>
> -------------------------------------
> print "count seconds:<br>\n";
> $baseepoch = $timloc = mktime(0,0,0,3,28,2002);
> for($day=0; $day<7; $day++){
> $epochnow = $baseepoch + (60 * 60 * 24 * $day);
> print $epochnow . "= gmmktim epoch - " . gmdate("D d.m.Y H:i
I",$epochnow) .
> "<br>\n";
> print $epochnow . "= mktim epoch - " . date("D d.m.Y H:i
I",$epochnow) .
> "<br>\n";
> print "<BR>\n";
> }
> ----
> count seconds:
> 1017270000= gmmktim epoch - Wed 27.03.2002 23:00 0  <<< consistent,
but off by
> -1 (your TZ)
> 1017270000= mktim epoch - Thu 28.03.2002 00:00 0
>
> 1017356400= gmmktim epoch - Thu 28.03.2002 23:00 0
> 1017356400= mktim epoch - Fri 29.03.2002 00:00 0
>
> 1017442800= gmmktim epoch - Fri 29.03.2002 23:00 0
> 1017442800= mktim epoch - Sat 30.03.2002 00:00 0
>
> 1017529200= gmmktim epoch - Sat 30.03.2002 23:00 0
> 1017529200= mktim epoch - Sun 31.03.2002 00:00 0
>
> 1017615600= gmmktim epoch - Sun 31.03.2002 23:00 0
> 1017615600= mktim epoch - Mon 01.04.2002 01:00 1
>
> 1017702000= gmmktim epoch - Mon 01.04.2002 23:00 0
> 1017702000= mktim epoch - Tue 02.04.2002 01:00 1
>
> 1017788400= gmmktim epoch - Tue 02.04.2002 23:00 0
> 1017788400= mktim epoch - Wed 03.04.2002 01:00 1
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
hi all,

i'm new to PHP and PHP installation.  I've tried it before and used the cgi
since I couldn't figure out the module installation.  but i really want to
get it working.  the problem is whatever I do, I get an error message from
Apache.  I installed the binary version of the latest release of PHP and
then added the parameters to httpd.conf:

<snip>
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule php4_module C:/Program Files/Apache Group/PHP/sapi/php4apache.dll

#
#  Reconstruction of the complete module list from all available modules
#  (static and shared ones) to achieve correct module execution order.
#
# The modules listed below, without a corresponding LoadModule directive,
# are static bound into the standard Apache binary distribution for Windows.
#
# Note: The order in which modules are loaded is important.  Don't change
# the order below without expert advice.
#
# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE, UPDATE THIS TOO!]
ClearModuleList
AddModule mod_php4.c
AddType application/x-httpd-php .php
#AddModule mod_vhost_alias.c
AddModule mod_env.c
AddModule mod_log_config.c
</snip>

I also tried it this way:

<snip>
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule unique_id_module modules/mod_unique_id.so

#
#  Reconstruction of the complete module list from all available modules
#  (static and shared ones) to achieve correct module execution order.
#
# The modules listed below, without a corresponding LoadModule directive,
# are static bound into the standard Apache binary distribution for Windows.
#
# Note: The order in which modules are loaded is important.  Don't change
# the order below without expert advice.
#
# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE, UPDATE THIS TOO!]
ClearModuleList
LoadModule php4_module C:/Program Files/Apache Group/PHP/sapi/php4apache.dll
AddModule mod_php4.c
AddType application/x-httpd-php .php
#AddModule mod_vhost_alias.c
AddModule mod_env.c
AddModule mod_log_config.c
</snip>

but in the first case i got:

LoadModule takes two arguments, a module name and the name of a shared
object file to load it from

in the second situation i got:

LoadModule takes two arguments, a module name and the name of a shared
object file to load it from

I looked around and it seems to me that i have to compile from the source in
order to get Apache working with the module.  but i don't have VC++ and
compliling seems too complicated.  any solutions?

thanks



--- End Message ---

Reply via email to