php-general Digest 10 Jun 2007 14:15:29 -0000 Issue 4840

Topics (messages 256523 through 256546):

Re: Is it possible to get the name of the top most calling script?
        256523 by: Richard Lynch

Re: Keeping file pointers open after script end
        256524 by: Robert Cummings

Re: PHP5 or PHP4  this is the question
        256525 by: Robert Cummings
        256527 by: Robert Cummings

Re: Difficulties including scripts from another folder (apache2.2, PHP5, Vista)
        256526 by: Robert Cummings

Going from simple to super CAPTCHA
        256528 by: Dave M G
        256529 by: Robert Cummings
        256538 by: Dave M G

Re: php-cli vs python OT
        256530 by: Robert Cummings

Undefined index error
        256531 by: Christian Cantrell
        256532 by: Robert Cummings
        256545 by: Tijnema

Re: None US ASCII characters not allowed in headers?
        256533 by: Crayon Shin Chan
        256535 by: Robert Cummings

Re: [RFC] HTTP timezone
        256534 by: info.phpyellow.com
        256537 by: Stefanos Harhalakis
        256539 by: Tijnema
        256541 by: Stefanos Harhalakis
        256543 by: Tijnema

Re: Transparent image resizing using php 4.4.x
        256536 by: Crayon Shin Chan
        256544 by: Tijnema

session.cookie_path problem
        256540 by: Lasse Brandt
        256542 by: Lasse Brandt

Server side issue with <form>
        256546 by: Roy W

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 ---
On Sat, June 9, 2007 7:18 pm, barophobia wrote:
> I know that __FILE__ and __LINE__ report on the file and line that
> they occur in. What I want is to be able to get the file name and line
> of the calling script. The only way I can do this so far is by passing
> the values through function arguments.
>
> Is there any way around this?

If you want the main file, var_dump($_SERVER);

If you want the whole backtrace, search php.net for backtrace function.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--- End Message ---
--- Begin Message ---
On Sat, 2007-06-09 at 22:23 +0100, Stut wrote:
> Tijnema wrote:
> > On 6/9/07, Stut <[EMAIL PROTECTED]> wrote:
> >> Tijnema wrote:
> >> > On 6/9/07, Stut <[EMAIL PROTECTED]> wrote:
> >> >> Tijnema wrote:
> >> >> > On 6/9/07, Stut <[EMAIL PROTECTED]> wrote:
> >> >> >> Tijnema wrote:
> >> >> >> > Hmm, fseek seems cool, but what about FTP resources? If I open 
> >> them
> >> >> >> > with ftp_connect, do I need to fetch all data from FTP again, and
> >> >> then
> >> >> >> > just trash all data I don't need?
> >> >> >>
> >> >> >> Yes, but depending on what you're actually doing you may be able to
> >> >> >> cache enough to skip large chunks in subsequent requests.
> >> >> >>
> >> >> >> -Stut
> >> >> >
> >> >> > Well, I'm working on a script that can transfer large files over 
> >> HTTP.
> >> >> > The point is that I have a HTTP proxy at school, and so I can use 
> >> HTTP
> >> >> > only. Moreover, they blocked downloading files bigger than 1MB, and
> >> >> > so, I wanted to transfer files in packets of lets say 990KB, so that
> >> >> > they can be downloaded fine through the HTTP proxy. This means i'm
> >> >> > calling repeatly the script for a next chunk, and that's why I 
> >> wanted
> >> >> > to keep the FTP connection open.
> >> >>
> >> >> Write it to a temporary file and store that temporary filename in the
> >> >> session. When the page is called, get the filesize of the temporary 
> >> file
> >> >> and use that as the start of the next chunk to download.
> >> >>
> >> >> -Stut
> >> >
> >> > Do you think this is the best way to do?
> >> > Even for large files , let's say 1 DVD (4,7GB)?
> >>
> >> I can't think of a better way. This way you're building up the file on
> >> disk chunk by chunk, not storing much in the session and it should scale
> >> to any size of file quite well. The only thing you might have to watch
> >> is cleaning up the files created by aborted downloads.
> >>
> >> -Stut
> > 
> > What about creating a new file for each chunk?
> > Would that be faster and less resource intensive then using fseek all 
> > the time?
> 
> No, it would be more resource intensive and probably slower. Seeking 
> through a file is a very cheap thing for most OS's to do.

As long as it's not on a tape drive >:)

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
On Sat, 2007-06-09 at 18:10 -0400, tedd wrote:
> At 3:27 PM -0400 6/9/07, Robert Cummings wrote:
> >On Sat, 2007-06-09 at 11:59 -0700, elk dolk wrote:
> >>  Hi all,
> >>          After designing and testing my web pages in PHP 5.2.1   I 
> >>learned that  our web server has PHP 4.4.1   and I have to rollback 
> >>to version 4 ! . There is no OO implementation like classes or 
> >>objects in my scripts but every page has some queries the question 
> >>is : will my scripts work in PHP 4 ? or should I re-write all of 
> >>them? or will it affect the speed of queries?
> >
> >Should work mostly fine. PHP5 mostly brought OOP features to the table.
> >Since you say you didn't use any OOP, then you just need to be wary of
> >the odd PHP5 only function.
> >
> >Cheers,
> >Rob.
> 
> 
> My host just upgraded from php 4 to php 5 and while I appreciate the 
> upgrade, now my really exotic functions like date() throw errors -- 
> duh!
> 
> Plus, none of my passwords work anymore, so I can't fit anything -- duh, 
> again!

:( I PHP5 proofed my stuff a long time ago for the inevitable switch. I
still code for PHP4 but I keep in mind the differences and make sure it
works both ways. Are you getting errors or warnings? Date issues sounds
like you need ot set your timezone. Did they also upgrade the MySQL
server (password issue sounds like MySQL).

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
On Sat, 2007-06-09 at 19:18 -0500, Larry Garfield wrote:
> You should get a new server that supports PHP 5.2.1.  PHP 4 is dead.

Must be a zombie then because I see it running almost EVERYWHERE.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
On Sun, 2007-06-10 at 01:02 +0100, brice wrote:
> Thanks a lot guys!
> 
> Eventually Richard hit on the issue:
> 
> >require(".\foo.inc.php"); ?>#
> >
> >If you put .\ in there, then maybe PHP thinks you mean to NOT use the
> >include_path, but only the local directory?
> >
> >Take .\ out.
> 
> it was the .\ that stopped it working. taking it out worked a treat!

I never write any PHP code that relies on the include path. I hate
magical crap like that :)

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
PHP General List,

With a little help from the web, and help from this list, I have a simple CAPTCHA image that works within the content system I'm building.

But it's *really* simple. Basically white text on a black background, with a couple of white lines to obscure the text a little.

I'm pretty sure that in its current state, my CAPTCHA image could be cracked by OCR software from the 1950s.

So I'm hoping to take it up to the next level.

I might be able to figure out how to add more lines, more colours, and those kind of basic changes.

But what I definitely can't comprehend is how some CAPTCHAs have that really warped and distorted text.

Is that possible with PHP? Do I have to make a library of pre-warped text images or something?

Is it possible to make backgrounds that are really crazy with textures and gradients. Would that also rely on a pre-built library of images?

Can someone maybe point me to an online instructional on how to get a CAPTCHA image that really works?

Tips on what differentiates a good CAPTCHA from a bad one would also be really sweet.

Thank you for any advice.

--
Dave M G
Ubuntu Feisty 7.04
Kernel 2.6.20-15-386

--- End Message ---
--- Begin Message ---
On Sun, 2007-06-10 at 12:27 +0900, Dave M G wrote: 
> PHP General List,
> 
> With a little help from the web, and help from this list, I have a 
> simple CAPTCHA image that works within the content system I'm building.
> 
> But it's *really* simple. Basically white text on a black background, 
> with a couple of white lines to obscure the text a little.
> 
> I'm pretty sure that in its current state, my CAPTCHA image could be 
> cracked by OCR software from the 1950s.

You're probably right :)

> So I'm hoping to take it up to the next level.
> 
> I might be able to figure out how to add more lines, more colours, and 
> those kind of basic changes.
> 
> But what I definitely can't comprehend is how some CAPTCHAs have that 
> really warped and distorted text.

They do x,y shifting, blurring, and various other techniques.

> Is that possible with PHP? Do I have to make a library of pre-warped 
> text images or something?

No, PHP can do it. If you can work with pixels (and you can) then you
can do any advanced mutation of an image... the only issue is how long
it takes to perform the mutations.

> Is it possible to make backgrounds that are really crazy with textures 
> and gradients. Would that also rely on a pre-built library of images?

It can rely on a pre-built library of images (I recently integrated
freecap into a website that uses this technique (amongst others) for
generating the background). It can also be done programmatically
(fractals would be a good example).

> Can someone maybe point me to an online instructional on how to get a 
> CAPTCHA image that really works?

Check out the freecap code perhaps (my eyes, my eyes, the code is
hideous). Check out other CAPTCHA scripts also. Learn from the
techniques they've employed, then roll your own if you still want to
create your own master CAPTCHA system :)

> Tips on what differentiates a good CAPTCHA from a bad one would also be 
> really sweet.

Good CAPTCHA - bots can't figure it out
Bad CAPCTHA  - bots can figure it out

;)

For what it's worth, and my experience with OCR is limited, the main
idea is to make it difficult to determine the characters by thwarting
edge detection and statistical models of pattern colour distribution.
Also keep in mind that you want people to be able to understand it. The
freecap system made some really unintelligible CAPTCHAS until I tweaked
the settings. Additionally many characters looked like many others when
morphed so I pared down the possible characters to less ambiguous
possibilities.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
Robert ,

Thank you for replying.
No, PHP can do it. If you can work with pixels (and you can) then you
can do any advanced mutation of an image... the only issue is how long
it takes to perform the mutations.
That's good to know. I think I can live with a little server time to generate the images, so long as they work well.


Check out the freecap code perhaps
I'm assuming you mean this one:
http://www.puremango.co.uk/cm_php_captcha_script_113.php

Good CAPTCHA - bots can't figure it out
Bad CAPCTHA  - bots can figure it out
Well, yes, but what exactly determines that is not obvious to me. I came across this page:
http://sam.zoy.org/pwntcha/
... which conveys a feeling that some CAPTCHAs that look good actually aren't.

According to this page, the Yahoo CAPTCHA image, which looks quite minimal to me, is actually one of the better ones.

--
Dave M G
Ubuntu Feisty 7.04
Kernel 2.6.20-15-386

--- End Message ---
--- Begin Message ---
On Thu, 2007-06-07 at 23:33 +0100, Colin Guthrie wrote:
> Robert Cummings wrote:
> > On Thu, 2007-06-07 at 16:36 -0400, Daniel Brown wrote:
> >>     Are you using Amarok on Windows, Linux, or other?  I have Amarok
> >> 1.3.1 on KDE 3.4.2 on Mandriva 2006.0 Community on 2.6.12-12mdksmp on
> >> an i686 Intel(R) Pentium(R) 4 CPU 2.60GHz w/ 1GB RAM on a desk with a
> >> bunch of crap on it, and all it does is crash for me.  I use Totem
> >> instead, occasionally using xine for audio, and usually for video
> >> (different subject).  Just wondering how stable Amarok is for you.
> > 
> > I'm running Amarok 1.4.3 (using KDE 3.5.5) on Ubuntu 6.10 (I'm actually
> > a Gnome user). I used Mandrake up till 10.0, I'll never go back. My
> > desktop is an Athlon 2400 with 2 gigs of memory (though consumption
> > rarely goes past half gig unless I'm running several VMWare OSes at the
> > same time). I started using it about 3 days ago, I've had a few crashes,
> > but mostly when doing something major like re-scanning my collection
> > (8000+). Had no trouble grabbing covers, creating playlists, editing
> > 100s of tags within Amarok, etc. Only complaint really is that it's pig
> > slow when switching to or sorting columns on large playlists (well the
> > whole 8000 heheh).
> 
> I'm a Mandriva dev and would have to say that if you've not used it for
> a while I think you'll be pleasently surprised these days. It's come a
> long, long way since 10.0!
> 
> Also the older Amarok run by Daniel is faily unstable (I'm also a bit of
> a KDE dev when I get a mo'!) is fairly old and bug ridden. Whatever your
> distro, I'd upgrade your Amarok to the latest stable for the best
> experience. FWIW, if you add your sources correctly you can just urpmi
> your 2006.0 machine to 2007.1 relatively easily. I've done it on several
> machines now (a couple of them remotely!).

FYI, after a few days of using Amarok I've found it to be extremely
prone to hanging. To try and correct the problem I downloaded the latest
stable source (1.4.5) and built it myself. Still hanging all over the
place (simple selection of new mp3, re-arranging queued songs, etc). It
also appears to keep NFS file handles open (possibly with locks) since
my NFS hung a few times after it died and I had to force an unmount.
Definitely not NFS itself, I've transferred 100s of gigs over months of
uptime without a problem... only seen it hang on an Amarok hang (more
than once now). Anyways, I'll keep giving it a go, I created a wrapper
script when starting it up now that checks the process list and kills
all related Amarok processes before relaunching... makes it a little
more bearable).

BTW, I know this isn't your issue or anything Colin, just passing along
my experience for Dan :)

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
I'm getting this error in my Apache log file, and I can't figure out why:

Undefined index:  password in /path/to/file.php on line 82

Some searching on Google turned up a bunch of questions, but no answers.
Any idea what this warning message is referring to?

Thanks,
Christian

--- End Message ---
--- Begin Message ---
On Sun, 2007-06-10 at 00:53 -0400, Christian Cantrell wrote:
> I'm getting this error in my Apache log file, and I can't figure out why:
> 
> Undefined index:  password in /path/to/file.php on line 82

Please post the code on that line of the file indicated.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
On 6/10/07, Christian Cantrell <[EMAIL PROTECTED]> wrote:
I'm getting this error in my Apache log file, and I can't figure out why:

Undefined index:  password in /path/to/file.php on line 82

Some searching on Google turned up a bunch of questions, but no answers.
Any idea what this warning message is referring to?

Thanks,
Christian

Yes, you're probably trying to get a value from an array by using a
key that isn't in the array.
Something like this:
<?php
$array = array( "user"=> "test", "foo"=>"bar");
$value = $array['password']; // Key "password" doesn't exist!
?>

Check the line number and print out the array with var_dump/print_r to
see what's in the array..

Tijnema


--- End Message ---
--- Begin Message ---
On Sunday 10 June 2007 04:05, Robert Cummings wrote:

> Funny how the solution often presents itself after you make your
> problem public *lol* :) Wonder if it falls under Murphy's Law.

There should be a dummy list that people post to, if they don't work out 
the answer themselves 10 minutes after posting to the dummy list they can 
then post to the real list.

-- 
Crayon

--- End Message ---
--- Begin Message ---
On Sun, 2007-06-10 at 13:36 +0800, Crayon Shin Chan wrote:
> On Sunday 10 June 2007 04:05, Robert Cummings wrote:
> 
> > Funny how the solution often presents itself after you make your
> > problem public *lol* :) Wonder if it falls under Murphy's Law.
> 
> There should be a dummy list that people post to, if they don't work out 
> the answer themselves 10 minutes after posting to the dummy list they can 
> then post to the real list.

*lol* The first time I read the above I thought you were suggesting a
list to which idiots could post :)

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
Well, there is some use for a correct user timezone. I wrote php code that 
offers a different css file depending on the server time of day. So for example 
at noon it would use nice bright colors, and at midnight blacks and red, and 
... you get the picture. Trouble was, this representation only worked for the 
timezone the server was in, and not for the timezone the visitor was in. 

Here's the simple PHP timezone code in css_rotate.php:

$hour = date("G");
//echo $hour;
switch($hour) {
        case 0: // theme: sleep
        case 1: 
        case 2:
        case 3:
        case 4:
                $current_css = "sleep.css";
                break;
        case 5: // theme 'dawn'
        case 6:
        case 7:
        case 8:
                $current_css = "dawn.css";
                break;
        case 9: // theme 'morning'
        case 10:
        case 11:
        case 12:
                $current_css = "morning.css";
                break;
        case 13: // theme 'afternoon'
        case 14:
        case 15:
        case 16:
                $current_css = "afternoon.css";
                break;
        case 17: // theme 'dusk'
        case 18:
        case 19:
        case 20:
                $current_css = "dusk.css";
                break;
        case 21: // theme 'night life'
        case 22:
        case 23:
                $current_css = "night.css";
                break;
        default:
                $current_css = "generic.css";           
}
//$current_css = "sleep.css"; // for testing each css file


.. and the invocation in the external css call:
include( INSTALL_DIR . "css/css_rotate.php");
LINK rel="stylesheet" type="text/css" href="<?php echo INSTALLPATH;?>css/<?php 
echo $current_css;?>">

.. and that produced a timezone flavored website look and feel.

I wanted to add that I have found more than one server time to be incorrectly 
set too, so you cannot count 100% on the server either, but i would give it 
odds over a user passed timezone.

sincerely,
Rob
http://phpyellow.com


From: Stefanos Harhalakis <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Sun, 10 Jun 2007 03:15:33 +0300
CC: [EMAIL PROTECTED]
Subject: Re: [PHP] [RFC] HTTP timezone
On Sunday 10 June 2007, Richard Lynch wrote:
> On Sat, June 9, 2007 8:06 am, Stefanos Harhalakis wrote:
> > Timezone: +0200
> >
> > that will specify their timezone offset. This way scripts will be able
> > to
> > provide appropriate date/time strings/representations and/or content.
>
> It's pretty useless and unreliable since user's clocks/timezone
> settings are incorrect far too often...

I'm only considering the timezone information. I believe that this is not the
proper way to think before making a start. The fact that many user's timezone
is incorrect doesn't mean that this is not needed. Lets just hope that one
day Windows will do the right thing and keep the time in UTC while displaying
it using the appropriate timezone. 

--- End Message ---
--- Begin Message ---
On Sunday 10 June 2007, Tijnema wrote:
> On 6/9/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
> > On Sat, June 9, 2007 8:06 am, Stefanos Harhalakis wrote:
> > > Timezone: +0200
> > >
> > > that will specify their timezone offset. This way scripts will be able
> > > to
> > > provide appropriate date/time strings/representations and/or content.
> >
> > It's pretty useless and unreliable since user's clocks/timezone
> > settings are incorrect far too often...
> >
> > YMMV
>
> I agree with you, clock settings are incorrect way too often, I just
> checked my own, and I see that the time is correct, but the Timezone
> is at GMT, while i live in GMT+1, but in summer, it's GMT+2.
> That brings me to the next point, what about DST?
> I've read your complete draft, and it doesn't say anything about DST,
> What should browsers send for my country? +0100 or +0200?

In DST the offset from UTC is adjusted and thus it will become +2 in your 
case. Perhaps a note about DST would be usefull. The original idea was to use 
the POSIX 1003.1 timezone string that optionally includes the DST information 
but this introduces a lot of complexity and was changed to include just the 
current offset.

> Ps. what's the next thing we send to the browser? We already sent a
> lot of info through the user-agent header... Next year we send our
> computers specs to the server so that we get a site that is made for
> the performance of our computer?

Perhaps you didn't had a need about this in the past. Have you ever tried 
looking at graphs that include time information in them? Just have a look at 
mrtg graphs or stock graphs and try to figure what time each point is 
supposed to represent.

--- End Message ---
--- Begin Message ---
On 6/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Well, there is some use for a correct user timezone. I wrote php code that 
offers a different css file depending on the server time of day. So for example 
at noon it would use nice bright colors, and at midnight blacks and red, and 
... you get the picture. Trouble was, this representation only worked for the 
timezone the server was in, and not for the timezone the visitor was in.

Here's the simple PHP timezone code in css_rotate.php:

$hour = date("G");
//echo $hour;
switch($hour) {
       case 0: // theme: sleep
       case 1:
       case 2:
       case 3:
       case 4:
               $current_css = "sleep.css";
               break;
       case 5: // theme 'dawn'
       case 6:
       case 7:
       case 8:
               $current_css = "dawn.css";
               break;
       case 9: // theme 'morning'
       case 10:
       case 11:
       case 12:
               $current_css = "morning.css";
               break;
       case 13: // theme 'afternoon'
       case 14:
       case 15:
       case 16:
               $current_css = "afternoon.css";
               break;
       case 17: // theme 'dusk'
       case 18:
       case 19:
       case 20:
               $current_css = "dusk.css";
               break;
       case 21: // theme 'night life'
       case 22:
       case 23:
               $current_css = "night.css";
               break;
       default:
               $current_css = "generic.css";
}
//$current_css = "sleep.css"; // for testing each css file


.. and the invocation in the external css call:
include( INSTALL_DIR . "css/css_rotate.php");
LINK rel="stylesheet" type="text/css" href="<?php echo INSTALLPATH;?>css/<?php echo 
$current_css;?>">

.. and that produced a timezone flavored website look and feel.

I wanted to add that I have found more than one server time to be incorrectly 
set too, so you cannot count 100% on the server either, but i would give it 
odds over a user passed timezone.

sincerely,
Rob
http://phpyellow.com


From: Stefanos Harhalakis <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Sun, 10 Jun 2007 03:15:33 +0300
CC: [EMAIL PROTECTED]
Subject: Re: [PHP] [RFC] HTTP timezone
On Sunday 10 June 2007, Richard Lynch wrote:
> On Sat, June 9, 2007 8:06 am, Stefanos Harhalakis wrote:
> > Timezone: +0200
> >
> > that will specify their timezone offset. This way scripts will be able
> > to
> > provide appropriate date/time strings/representations and/or content.
>
> It's pretty useless and unreliable since user's clocks/timezone
> settings are incorrect far too often...

I'm only considering the timezone information. I believe that this is not the
proper way to think before making a start. The fact that many user's timezone
is incorrect doesn't mean that this is not needed. Lets just hope that one
day Windows will do the right thing and keep the time in UTC while displaying
it using the appropriate timezone.


Well, in this case you could use javascript to get the time of the
client, and then update the CSS code according to the time.

To get back to the point, I think that the timezone should be defined
on what time it actually is at his PC, and what time it is on
time.nist.gov for example, and not lookng at some setting... Timezone
setting is often wrong, people just update their time to match the
time of their watch. This sets the UTC time wrong too, but still
displays the right time to the user. So if you compare this time to
time on web servers that are allways right, and you compare the
difference between that, then you know the timezone that is probably
right.

Tijnema

--- End Message ---
--- Begin Message ---
On Sunday 10 June 2007, Tijnema wrote:
> To get back to the point, I think that the timezone should be defined
> on what time it actually is at his PC, and what time it is on
> time.nist.gov for example, and not lookng at some setting... Timezone
> setting is often wrong, people just update their time to match the
> time of their watch. This sets the UTC time wrong too, but still
> displays the right time to the user. So if you compare this time to
> time on web servers that are allways right, and you compare the
> difference between that, then you know the timezone that is probably
> right.

  Timezone is a property of the user and some times of the session. It is not 
a property of a system. Different users of a system may use different 
timezones (unless they use Windows where they can't). 

  Anyway, I strongly believe that the issue of providing the correct timezone 
should be a concern of the end user and the browser. Any error checking and 
workarounds should be performed by those two and not by the server side 
scripts.

  In any way, there is no guarantee that the timezone information provided by 
clients will be correct. That's why it should only be used for informational 
purposes and not for security etc.

--- End Message ---
--- Begin Message ---
On 6/10/07, Stefanos Harhalakis <[EMAIL PROTECTED]> wrote:
On Sunday 10 June 2007, Tijnema wrote:
> To get back to the point, I think that the timezone should be defined
> on what time it actually is at his PC, and what time it is on
> time.nist.gov for example, and not lookng at some setting... Timezone
> setting is often wrong, people just update their time to match the
> time of their watch. This sets the UTC time wrong too, but still
> displays the right time to the user. So if you compare this time to
> time on web servers that are allways right, and you compare the
> difference between that, then you know the timezone that is probably
> right.

 Timezone is a property of the user and some times of the session. It is not
a property of a system. Different users of a system may use different
timezones (unless they use Windows where they can't).

 Anyway, I strongly believe that the issue of providing the correct timezone
should be a concern of the end user and the browser. Any error checking and
workarounds should be performed by those two and not by the server side
scripts.

 In any way, there is no guarantee that the timezone information provided by
clients will be correct. That's why it should only be used for informational
purposes and not for security etc.

Sure, but if this setting will be incorrect for 90-95% of the time,
then there won't be a lot people that are actually gonna use it,
because why do we want to know information that is probably wrong?

Tijnema

--- End Message ---
--- Begin Message ---
On Sunday 10 June 2007 04:12, Sukhwinder Singh wrote:

> $img_resized = ImageCreateTrueColor ($img_new_width, $img_new_height);

> But the above doesn't work using php 4.4.x and creates images with lots
> of white lines/dots in it. Some pixel is transparent and some it isn't.
> I have no knowedge about image manuplation like alpha channels etc.
> Could anyone please provide me a solution which works using php 4.4.x

Are you sure you're getting a transparent image at all? From what I 
understand GIF does not support more than 8 bits. Why not use PNG 
instead?

-- 
Crayon

--- End Message ---
--- Begin Message ---
On 6/9/07, Sukhwinder Singh <[EMAIL PROTECTED]> wrote:
I have tried many ways to resize a transparent gif but it works on my local
server which has php 5.1.6 but none works using php 4.4.x

Also the below works when using imagecopyresized and not imagecopyresampled.
I have no clue why that is the case as imagecopyresampled is supposed to
produce better results.

I have php version 5.1.6 locally (windows) and this works:

<snipped code>

But the above doesn't work using php 4.4.x and creates images with lots of
white lines/dots in it. Some pixel is transparent and some it isn't. I have
no knowedge about image manuplation like alpha channels etc.
Could anyone please provide me a solution which works using php 4.4.x

Sukhwinder Singh

I don't think it has anything to do with the PHP version, but with the
version of the GD library used.
What version of GD are you using on both systems? You can see it with phpinfo:
<?php phpinfo(); ?>

Tijnema

--- End Message ---
--- Begin Message ---
Hi,

I am having some trouble with my sessions cookie_path - it doesn't
seem to work - or maybe I am not working, I don't know at the moment
:)

Apache 2.2.3 and PHP 5.3.2 as module.

What I want to achieve, is 2 separate sessions in the same website -
in different directories of course.

My test setup is the following:

http://sessiontest.dev.codefrog.dk/app1/.htaccess contains
       php_value session.cookie_path /app1/

http://sessiontest.dev.codefrog.dk/app1/index.php contains
<?php
       session_start();

       $_SESSION['val1'] = "test1";

       print_r($_SESSION);
       print_r(session_get_cookie_params());
?>

and

http://sessiontest.dev.codefrog.dk/app2/.htaccess contains
       php_value session.cookie_path /app2/

http://sessiontest.dev.codefrog.dk/app2/index.php contains
<?php
       session_start();

       $_SESSION['val2'] = "test2";

       print_r($_SESSION);
       print_r(session_get_cookie_params());
?>

I visit /app1/ and $_SESSION contains 'val1' => 'test1' - as expected.
I then visit /app2/ and $_SESSION then contains both 'val1' => 'test1'
and 'val2' => 'test2' - not as expected.

I would expect that each $_SESSION would only hold its own data.

And I can see from the print_r(session_get_cookie_params()) that the
cookie has changed its path like it should according to my .htaccess
file.

Am I missing something obvious?

--

Kind Regards
Lasse Brandt

--- End Message ---
--- Begin Message ---
Am I missing something obvious?

I am so sorry - I was missing something obvious.

At some early stage of my test, I had a /index.php on my test website
doing a: session_start()
And the apparently made my session work in both sub directories and
thus poisoning my test result.

After closing my browser and going straight to /app1/ and then /app2/
I actually got the correct result.

So sorry to disturb you - have a nice day :)

--

Kind Regards
Lasse Brandt

--- End Message ---
--- Begin Message ---
My host company must have an installation/configuration issue.

Variables from forms are not being passed to the php scripts that are sent via <Form>

Has anyone heard of this and know of the fix?
--- End Message ---

Reply via email to