php-general Digest 11 Jun 2007 16:01:15 -0000 Issue 4842

Topics (messages 256583 through 256602):

Re: Not getting expected result from file()
        256583 by: David Robley
        256584 by: kvigor
        256585 by: Jim Lucas
        256586 by: kvigor
        256587 by: kvigor
        256591 by: Frank Arensmeier

Re: [RFC] HTTP timezone
        256588 by: Tijnema
        256595 by: Lester Caine
        256597 by: Stefanos Harhalakis
        256600 by: Lester Caine
        256601 by: Tijnema

Re: Going from simple to super CAPTCHA
        256589 by: Tijnema
        256596 by: Daniel Brown
        256598 by: Tijnema
        256599 by: tedd
        256602 by: Robert Cummings

Re: Sample
        256590 by: edk.ypass.net
        256592 by: Frank Arensmeier

Formatting output
        256593 by: listas.fernandomarcelo.com
        256594 by: Stut

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 ---
kvigor wrote:

> Hello,
> 
> I'm using the file function create an array.  I'm using a value from a
> form to see if it matches in elements in the array.
> 
> My problem is I expect  the condition to be true but info but my DB isn't
> populated as I in the right DB...
> =================Code
> Begins======================================================
> $theFileArray = file('C:\htdocs\folder1\file.txt');
> 

Your problem starts here - file returns the file in an array. Each element
of the array corresponds to a line in the file, with the newline still
attached. When you compare to a string without the newline at the end, the
comparison fails.

If you have php > 5.0.0 you can use the FILE_IGNORE_NEW_LINES flag in the
file() arguments, otherwise use trim() to remove trailing whitespace from
the array elements.



Cheers
-- 
David Robley

"I hate playing craps," Tom said dicily.
Today is Boomtime, the 16th day of Confusion in the YOLD 3173. 

--- End Message ---
--- Begin Message ---
Sorry I re-wrote for problem clarity.

FYI whenever I do a var_dump it always shows $stringOne as being 2 
characters less

e.g.
var_dump($foodlandPA[45]);
var_dump($storeInfo);

string(31) "Wellston Foodland Wellston OH " string(29) "Wellston Foodland 
Wellston OH"

""kvigor"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello,
>
> I'm using the file function to create an array.  I'm also using values 
> from a form to see if it matches any elements in the array.
>
> My problem is I expect  the condition to be true, but my DB isn't 
> populated as it should be if condition was true.
 =================Code 
Begins======================================================
> $theFileArray = file('C:\htdocs\folder1\file.txt');
>
>
> if(isset($_POST['strName'], $_POST['strCity'], $_POST['strState']))
> {
> $space = " ";
> $stringOne = $_POST['strName']. $space. $_POST['strCity']. $space . 
> $_POST['strState'];
>
> }
> //I match the string "Grantsville Foodland Grantsville MD" letter for 
> letter in the form and form info gets stored in unknown table and not 
> central as it should...?
>
> if(in_array($stringOne, $theFileArray)) //Any Problem solvers, 
> suggestions, or new ways to code welcome
> {
>  $queryCentral = "INSERT INTO central (conName, conAddress, conCity,
>
> conState, conZip, conPhone, schName, schAddress, schCity, schState, 
> schZip, strName,
>
> strCity, strState) VALUES('$regName', '$regAddress', '$regCity', 
> '$regState',
>
> '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', 
> '$sclState',
>
> '$sclZip', '$stoName', '$stoCity', '$stoState')";
>
>  mysql_query($queryCentral, $connection) or die("Query failed: ".
>
> mysql_error($connection));
> }
>
>
> else
> {
> $queryUnknown = "INSERT INTO unknown (conName, conAddress, conCity, 
> conState,
>
> conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, 
> strCity,
>
> strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', 
> '$regZip',
>
> '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', 
> '$sclZip',
>
> '$stoName', '$stoCity', '$stoState')";
> mysql_query($queryUnknown, $connection) or die("Query failed: ".
>
> mysql_error($connection));
> }
>
> THIS WHAT FILE LOOKS LIKE //Any Problem solvers and suggestion welcome
> =================================================
> Begin Row 1
> Grantsville Foodland Grantsville MD
> Deep Creek Foodland Fresh Mc Henry MD
> Oakland Foodland Oakland MD
> Bridgeport Foodland Bridgeport WV
> Grafton Foodland Grafton WV
> Morgan's Foodland Fresh Kingwood WV
> Petersburg Foodland Petersburg WV
> Rainelle Foodland Rainelle WV
> 6th Avenue Foodland St. Albans WV
> Weston Foodland Weston WV
> Ambridge Foodland Ambridge PA
> Curry Hollow Road Foodland Baldwin Pleasant Hills PA
> Tusca Plaza Foodland Fresh Beaver PA
> Bethel Park Foodland Bethel Park PA
> Lebanon Shops Foodland Castle Shannon PA
> Fatur's Foodland Delmont PA
> Ford City Ford City PA
> Glassport Foodland Glassport PA
> Mount Royal Foodland Glenshaw PA
> Grindstone Foodland Grindstone PA
> Kittanning Foodland Kittanning PA
> Mars Foodland Mars PA
> Fifth Avenue Foodland Mc Keesport PA
> Mckees Rocks Mckees Rocks PA
> Monessen Foodland Fresh Monessen PA
> Monongahela Foodland Monongahela PA
> Great Valley Foodland N. Versailles PA
> Gold Crown Foodland Nanty Glo PA
> New Brighton Foodland New Brighton PA
> J & J Foodland New Kensington PA
> Brownsville Road Foodland Pittsburgh PA
> Mt Washington Foodland Fresh Pittsburgh PA
> Beechview Foodland Pittsburgh PA
> Mcneilly Road Foodland Pittsburgh PA
> Rochester Road Foodland Pittsburgh PA
> Pines Plaza Foodland Pittsburgh PA
> Point Marion Foodland Point Marion PA
> Beulah Road Foodland Turtle Creek PA
> Midtown Foodland Uniontown PA
> Henderson Avenue Foodland Washington PA
> Interstate Foodland Washington PA
> Maiden Street Foodland Washington PA
> Buttermilk Hollow Foodland West Mifflin PA
> Village Foodland Fresh West Mifflin PA
> Wellston Foodland Wellston OH
> Westmoreland Foodland Fresh Huntington WV 

--- End Message ---
--- Begin Message ---
kvigor wrote:
Sorry I re-wrote for problem clarity.

FYI whenever I do a var_dump it always shows $stringOne as being 2 characters less

e.g.
var_dump($foodlandPA[45]);
var_dump($storeInfo);

string(31) "Wellston Foodland Wellston OH " string(29) "Wellston Foodland Wellston OH"

This would be because of the ' ' and "\n" at the end of the 31 char line

use trim to remove the white space before your comparison and it should work.

One other thing I noticed, in your SQL insert statement, are all variables coming from the post? If so, do you need to reference the $_POST['..'] array instead and clean them??

or have you already done that?


""kvigor"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
Hello,

I'm using the file function to create an array. I'm also using values from a form to see if it matches any elements in the array.

My problem is I expect the condition to be true, but my DB isn't populated as it should be if condition was true.
=================Code Begins======================================================
$theFileArray = file('C:\htdocs\folder1\file.txt');


if(isset($_POST['strName'], $_POST['strCity'], $_POST['strState']))
{
$space = " ";
$stringOne = $_POST['strName']. $space. $_POST['strCity']. $space . $_POST['strState'];

}
//I match the string "Grantsville Foodland Grantsville MD" letter for letter in the form and form info gets stored in unknown table and not central as it should...?

if(in_array($stringOne, $theFileArray)) //Any Problem solvers, suggestions, or new ways to code welcome
{
 $queryCentral = "INSERT INTO central (conName, conAddress, conCity,

conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName,

strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState',

'$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState',

'$sclZip', '$stoName', '$stoCity', '$stoState')";

 mysql_query($queryCentral, $connection) or die("Query failed: ".

mysql_error($connection));
}


else
{
$queryUnknown = "INSERT INTO unknown (conName, conAddress, conCity, conState,

conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity,

strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip',

'$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', '$sclZip',

'$stoName', '$stoCity', '$stoState')";
mysql_query($queryUnknown, $connection) or die("Query failed: ".

mysql_error($connection));
}

THIS WHAT FILE LOOKS LIKE //Any Problem solvers and suggestion welcome
=================================================
Begin Row 1
Grantsville Foodland Grantsville MD
Deep Creek Foodland Fresh Mc Henry MD
Oakland Foodland Oakland MD
Bridgeport Foodland Bridgeport WV
Grafton Foodland Grafton WV
Morgan's Foodland Fresh Kingwood WV
Petersburg Foodland Petersburg WV
Rainelle Foodland Rainelle WV
6th Avenue Foodland St. Albans WV
Weston Foodland Weston WV
Ambridge Foodland Ambridge PA
Curry Hollow Road Foodland Baldwin Pleasant Hills PA
Tusca Plaza Foodland Fresh Beaver PA
Bethel Park Foodland Bethel Park PA
Lebanon Shops Foodland Castle Shannon PA
Fatur's Foodland Delmont PA
Ford City Ford City PA
Glassport Foodland Glassport PA
Mount Royal Foodland Glenshaw PA
Grindstone Foodland Grindstone PA
Kittanning Foodland Kittanning PA
Mars Foodland Mars PA
Fifth Avenue Foodland Mc Keesport PA
Mckees Rocks Mckees Rocks PA
Monessen Foodland Fresh Monessen PA
Monongahela Foodland Monongahela PA
Great Valley Foodland N. Versailles PA
Gold Crown Foodland Nanty Glo PA
New Brighton Foodland New Brighton PA
J & J Foodland New Kensington PA
Brownsville Road Foodland Pittsburgh PA
Mt Washington Foodland Fresh Pittsburgh PA
Beechview Foodland Pittsburgh PA
Mcneilly Road Foodland Pittsburgh PA
Rochester Road Foodland Pittsburgh PA
Pines Plaza Foodland Pittsburgh PA
Point Marion Foodland Point Marion PA
Beulah Road Foodland Turtle Creek PA
Midtown Foodland Uniontown PA
Henderson Avenue Foodland Washington PA
Interstate Foodland Washington PA
Maiden Street Foodland Washington PA
Buttermilk Hollow Foodland West Mifflin PA
Village Foodland Fresh West Mifflin PA
Wellston Foodland Wellston OH
Westmoreland Foodland Fresh Huntington WV



--
Jim Lucas

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

Unknown

--- End Message ---
--- Begin Message ---
OK, I trimmed the elements in the array. using var_dump() it shows strings 
are identical, however nothing is storing in DB still.

view new code
=====================================//doesn't store in central still, also 
shows no MySQL errors.
$theFileArray = file('C:\htdocs\folder1\file.txt');

function trim_value(&$value)
{
    $value = trim($value);
}

array_walk($theFileArray, 'trim_value');


if(isset($_POST['strName'], $_POST['strCity'], $_POST['strState']))
{
 $space = " ";
 $stringOne = $_POST['strName']. $space. $_POST['strCity']. $space . 
$_POST['strState'];

}
 if(in_array($storeInfo, $theFileArray))
 {
  $queryCentral = "INSERT INTO central (conName, conAddress, conCity, 
conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, 
strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', 
'$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', 
'$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')";

  mysql_query($queryCentral, $connection) or die("Query failed: ". 
mysql_error($connection));
 }


else
{
$queryUnknown = "INSERT INTO unknown (conName, conAddress, conCity, 
conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, 
strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', 
'$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', 
'$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')";
mysql_query($queryUnknown, $connection) or die("Query failed: ". 
mysql_error($connection));
}
=====================================

"David Robley" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> kvigor wrote:
>
>> Hello,
>>
>> I'm using the file function create an array.  I'm using a value from a
>> form to see if it matches in elements in the array.
>>
>> My problem is I expect  the condition to be true but info but my DB isn't
>> populated as I in the right DB...
>> =================Code
>> Begins======================================================
>> $theFileArray = file('C:\htdocs\folder1\file.txt');
>>
>
> Your problem starts here - file returns the file in an array. Each element
> of the array corresponds to a line in the file, with the newline still
> attached. When you compare to a string without the newline at the end, the
> comparison fails.
>
> If you have php > 5.0.0 you can use the FILE_IGNORE_NEW_LINES flag in the
> file() arguments, otherwise use trim() to remove trailing whitespace from
> the array elements.
>
>
>
> Cheers
> -- 
> David Robley
>
> "I hate playing craps," Tom said dicily.
> Today is Boomtime, the 16th day of Confusion in the YOLD 3173. 

--- End Message ---
--- Begin Message ---
Trimmed elements in the array.  I still can't get it to store in central 
table.  No MySQL errors either. :-(
 (Also, all form values are escaped.) Strings compared in if condition are 
now identical.


newcode
===============================================
theFileArray = file('C:\htdocs\folder1\file.txt');

function trim_value(&$value)
{
    $value = trim($value);
}

array_walk($theFileArray, 'trim_value');


if(isset($_POST['strName'], $_POST['strCity'], $_POST['strState']))
{
 $space = " ";
 $stringOne = $_POST['strName']. $space. $_POST['strCity']. $space . 
$_POST['strState'];
}

 if(in_array($stringOne, $theFileArray)) // string were identical after I 
trimmed an did var_dump on $stringOne and $theFileArray[2]
 {
  $queryCentral = "INSERT INTO central (conName, conAddress, conCity, 
conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, 
strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', 
'$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', 
'$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')";

  mysql_query($queryCentral, $connection) or die("Query failed: ". 
mysql_error($connection));
 }


else
{
$queryUnknown = "INSERT INTO unknown (conName, conAddress, conCity, 
conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, 
strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', 
'$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', 
'$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')";
mysql_query($queryUnknown, $connection) or die("Query failed: ". 
mysql_error($connection));
}
============================================================================
"David Robley" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> kvigor wrote:
>
>> Hello,
>>
>> I'm using the file function create an array.  I'm using a value from a
>> form to see if it matches in elements in the array.
>>
>> My problem is I expect  the condition to be true but info but my DB isn't
>> populated as I in the right DB...
>> =================Code
>> Begins======================================================
>> $theFileArray = file('C:\htdocs\folder1\file.txt');
>>
>
> Your problem starts here - file returns the file in an array. Each element
> of the array corresponds to a line in the file, with the newline still
> attached. When you compare to a string without the newline at the end, the
> comparison fails.
>
> If you have php > 5.0.0 you can use the FILE_IGNORE_NEW_LINES flag in the
> file() arguments, otherwise use trim() to remove trailing whitespace from
> the array elements.
>
>
>
> Cheers
> -- 
> David Robley
>
> "I hate playing craps," Tom said dicily.
> Today is Boomtime, the 16th day of Confusion in the YOLD 3173. 

--- End Message ---
--- Begin Message --- If you are not able to get anything into your DB (and your connection is ok), then two things might be wrong: your input or the query string itself.

Echo out the query string and try to use the query "manually" (directly with a MySQL client). If the query string is ok, you might check your MySQL connection settings (var_dump, echo etc). If the query string is not ok, you have to look at the input values for the query ($regName, $regAddress etc).

//frank


11 jun 2007 kl. 07.27 skrev kvigor:

Trimmed elements in the array. I still can't get it to store in central
table.  No MySQL errors either. :-(
(Also, all form values are escaped.) Strings compared in if condition are
now identical.


newcode
===============================================
theFileArray = file('C:\htdocs\folder1\file.txt');

function trim_value(&$value)
{
    $value = trim($value);
}

array_walk($theFileArray, 'trim_value');


if(isset($_POST['strName'], $_POST['strCity'], $_POST['strState']))
{
 $space = " ";
 $stringOne = $_POST['strName']. $space. $_POST['strCity']. $space .
$_POST['strState'];
}

if(in_array($stringOne, $theFileArray)) // string were identical after I
trimmed an did var_dump on $stringOne and $theFileArray[2]
 {
  $queryCentral = "INSERT INTO central (conName, conAddress, conCity,
conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity',
'$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')";

  mysql_query($queryCentral, $connection) or die("Query failed: ".
mysql_error($connection));
 }


else
{
$queryUnknown = "INSERT INTO unknown (conName, conAddress, conCity,
conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity',
'$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')";
mysql_query($queryUnknown, $connection) or die("Query failed: ".
mysql_error($connection));
}
====================================================================== ======
"David Robley" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
kvigor wrote:

Hello,

I'm using the file function create an array. I'm using a value from a
form to see if it matches in elements in the array.

My problem is I expect the condition to be true but info but my DB isn't
populated as I in the right DB...
=================Code
Begins======================================================
$theFileArray = file('C:\htdocs\folder1\file.txt');


Your problem starts here - file returns the file in an array. Each element of the array corresponds to a line in the file, with the newline still attached. When you compare to a string without the newline at the end, the
comparison fails.

If you have php > 5.0.0 you can use the FILE_IGNORE_NEW_LINES flag in the file() arguments, otherwise use trim() to remove trailing whitespace from
the array elements.



Cheers
--
David Robley

"I hate playing craps," Tom said dicily.
Today is Boomtime, the 16th day of Confusion in the YOLD 3173.

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


--- End Message ---
--- Begin Message ---
On 6/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I agree with Tijnema he's hit the nail on the head. And the inability to handle 
daylight time really is a big potential snag - who in North America isn't on 
daylight time at some point in the year?  If the timezone data is unreliable 
then no thinking developer will use it. The question then becomes: As a 
developer why WOULD you use unreliable timezone data?

Sincerely,
Rob

Yes, I think that you can compare it with the Referrer header, it's
unreliable too, and which developer uses it these days?

Tijnema

>
> 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 ---
Stefanos Harhalakis wrote:
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.

Timezone information is only of use for the CURRENT day - even if it is wrong. It is ESSENTIAL that any changes also include the daylight saving information. Since this is not included, all current sites handling event related information in real time need to manually log a users PROPER time and daylight saving information so that they know if 8AM today is the same as 8AM tomorrow.

If this is not going to actually fix the problem - don't bother wasting time on it :)

--
Lester Caine - G8HFL
-----------------------------
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
On Monday 11 June 2007 16:05, Lester Caine wrote:
> Timezone information is only of use for the CURRENT day - even if it is
> wrong. It is ESSENTIAL that any changes also include the daylight saving
> information. Since this is not included, all current sites handling event
> related information in real time need to manually log a users PROPER time
> and daylight saving information so that they know if 8AM today is the same
> as 8AM tomorrow.

  Since HTTP is a query and response protocol, timezone information will be 
sent on each query. Lets say that it is XX of month Y 1:59 and that the 
timeoffset is changed at '2:00' by +1. A request  sent at 1:59 will have an 
offset, lets say +0200. A request sent at 3:00 (that's one minute after 1:59) 
will have an offset of +0300. 

  Full timezone information requires a POSIX 1003.1 timezone string that is 
quite complex to parse and support, since the server side script must be able 
to identify all of the available timezones. The first draft proposed this 
representation but was changed after the suggestions of ietf-http-wg mailing 
list people to only include the offset for simplicity.

  Timezone information is not meant to be stored as session information nor 
being used for anything else than one-time time/date representation. It is 
just a way for the client to say: If you're going to show me something that 
is time related then you should know that you should represent it using this 
offset from GMT. Something like the Accepted-Language header.

  Lets say you're viewing an MRTG generated graph. This graph uses the time as 
the X-axis value. Lets say that the server is in Greece where the offset is 
+0200 (+0300 during DST) and that the time is 14:10. The graph will end its X 
axis at the current time (14:10). Someone from the UK visits the graph page 
and he should see the same graph ending in 12:10 (UK is +0000). An incorrect 
timezone string will only result in 'bad' time representation which will be 
the case anyway (without TZ).

  There is no need to include the DST information since when on DST the client 
will be sending the propper offset. For example, EET+2EEST is +0200 during 
winter and +0300 during DST.

  Hope this clears things a bit... 

  By the way, what makes you think that most people have an invalid timezone 
configured? Windows XP have NTP support that is enabled by default. Without a 
proper timezone this should result in an always invalid time. Linux and BSD 
systems have more experienced users that set their timezone correctly most of 
the time.

--- End Message ---
--- Begin Message ---
Stefanos Harhalakis wrote:
On Monday 11 June 2007 16:05, Lester Caine wrote:
<SNIP - misses the point!!!>
Hope this clears things a bit...

As I actually USE a clients time offset, I know what the problem is. The DATA is ALL stored as UTC time data, so it does not matter who enters it. It will be stored without a time offset. When building a calender of events, I need to know the clients daylight saving time - since it is not available in the browser we have to handle it manually anyway so the browser feed is always a waste of time since it simply does not give you any USEFUL information. If I am building a calender of events over a change in daylight saving I NEED to know !!! Now it would be possible to ignore time zone and daylight saving when storing data, but THAT becomes an even worse mess when trying to manage meetings across Europe. They can all be at 9AM but not happening at the same time as you have to track the daylight saving at each location :)

By the way, what makes you think that most people have an invalid timezone configured? Windows XP have NTP support that is enabled by default. Without a proper timezone this should result in an always invalid time. Linux and BSD systems have more experienced users that set their timezone correctly most of the time.

Correct, so people select the timezone that gives the right time, if the daylight saving switch is off. And then the calendar gives the wrong times when trying to display a weekend containing a daylight saving change. ( THAT one wasted a few hours before we twigged what was wrong - since the clock was right :) )

--
Lester Caine - G8HFL
-----------------------------
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
On 6/11/07, Stefanos Harhalakis <[EMAIL PROTECTED]> wrote:
On Monday 11 June 2007 16:05, Lester Caine wrote:
<snip>
 By the way, what makes you think that most people have an invalid timezone
configured? Windows XP have NTP support that is enabled by default. Without a
proper timezone this should result in an always invalid time. Linux and BSD
systems have more experienced users that set their timezone correctly most of
the time.

Like if the NTP works :P, when I go to the settings I see that my time
was last synchronised on the date I installed XP, and when I try to
run it manually, both servers fail to update. While i have a 24/7
Internet connection :)
This is the same for all my XPSP2/XPMCE installations. And what does
make you think that most people have correct time? On my school there
are about 20 computers in one place, and I checked the time for all of
them, all different, all wrong!
For my computers at home, I do have the correct Time, but Incorrect
time zone... (except 1 :P)
So, the information send to the server in the header would be wrong
for all PCs here in my LAN and at school, better said, 100% of the
computers I use pass wrong information, and so how reliable would that
header be?

Tijnema

--- End Message ---
--- Begin Message ---
On 6/10/07, tedd <[EMAIL PROTECTED]> wrote:
>Tedd:
>
>Please don't spread the code of your Audio CAPTCHA, we had a big
>discussion about it, and we concluded that it was quite easy to crack.
>I remember i've cracked some other CAPTCHAs, but if you still think
>your Audio CAPTCHA isn't hard to crack, then just let me know and i'll
>start cracking it :)
>
>Dave:

Dave:

The point is not how easy my Audio CAPTCHA is to crack, but rather
one of accessibility.

If one insist on using a graphic CAPTCHA, which in most cases can be
cracked, then at least add an Audio CAPTCHA to allow access for the
visually disabled.

Or, is the point here to allow bots and block the visually disabled
-- I think not.

Surely not, but what you're doing with adding a weak audio CAPTCHA is
adding more options for a hacker. Since the form can be submitted by
either completing one of both CAPTCHA programs, the hacker can choose
whichever way he likes. So if you have a very very strong Graphic
CAPTCHA, but a very weak Audio CAPTHCA, than it isn't too hard to
crack, as the hacker would only crack the Audio CAPTCHA...


Look at the CAPTCHA's use here:

http://sam.zoy.org/pwntcha/

and their efficiently at blocking bots, which next to nil.

So, if people are going to believe in the false notion that CAPTCHA's
block bots, then why not provide a way for the visually disabled to
obtain access as well? Why just block the visually disabled?

The question is not if the CAPTCHAs are crackable, because they are!
But, like we said in the other thread, it's by finding the right way
between the time needed to crack, and the time needed to type
over/listen to CAPTCHA. Adding Audio CAPTCHA decreases time to
crack...


>I think you remember the thread tedd ;)

I remember the threads, but nothing that was said there is counter to
what I said here.

Cheers,

tedd

It's atleast an interesting thread about CAPTCHA.

Tijnema

--- End Message ---
--- Begin Message ---
On 6/11/07, Tijnema <[EMAIL PROTECTED]> wrote:
On 6/10/07, tedd <[EMAIL PROTECTED]> wrote:
> >Tedd:
> >
> >Please don't spread the code of your Audio CAPTCHA, we had a big
> >discussion about it, and we concluded that it was quite easy to crack.
> >I remember i've cracked some other CAPTCHAs, but if you still think
> >your Audio CAPTCHA isn't hard to crack, then just let me know and i'll
> >start cracking it :)
> >
> >Dave:
>
> Dave:
>
> The point is not how easy my Audio CAPTCHA is to crack, but rather
> one of accessibility.
>
> If one insist on using a graphic CAPTCHA, which in most cases can be
> cracked, then at least add an Audio CAPTCHA to allow access for the
> visually disabled.
>
> Or, is the point here to allow bots and block the visually disabled
> -- I think not.

Surely not, but what you're doing with adding a weak audio CAPTCHA is
adding more options for a hacker. Since the form can be submitted by
either completing one of both CAPTCHA programs, the hacker can choose
whichever way he likes. So if you have a very very strong Graphic
CAPTCHA, but a very weak Audio CAPTHCA, than it isn't too hard to
crack, as the hacker would only crack the Audio CAPTCHA...

>
> Look at the CAPTCHA's use here:
>
> http://sam.zoy.org/pwntcha/
>
> and their efficiently at blocking bots, which next to nil.
>
> So, if people are going to believe in the false notion that CAPTCHA's
> block bots, then why not provide a way for the visually disabled to
> obtain access as well? Why just block the visually disabled?

The question is not if the CAPTCHAs are crackable, because they are!
But, like we said in the other thread, it's by finding the right way
between the time needed to crack, and the time needed to type
over/listen to CAPTCHA. Adding Audio CAPTCHA decreases time to
crack...
>
>
> >I think you remember the thread tedd ;)
>
> I remember the threads, but nothing that was said there is counter to
> what I said here.
>
> Cheers,
>
> tedd

It's atleast an interesting thread about CAPTCHA.

Tijnema

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



   Quote of the day, hands down:

   "The brightest ideas have to pass through the dimmest minds...."
                ~ Tedd (speaking of programmer-vs-management obstacles)


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--- End Message ---
--- Begin Message ---
On 6/11/07, Daniel Brown <[EMAIL PROTECTED]> wrote:
On 6/11/07, Tijnema <[EMAIL PROTECTED]> wrote:
> On 6/10/07, tedd <[EMAIL PROTECTED]> wrote:
> > >Tedd:
> > >
> > >Please don't spread the code of your Audio CAPTCHA, we had a big
> > >discussion about it, and we concluded that it was quite easy to crack.
> > >I remember i've cracked some other CAPTCHAs, but if you still think
> > >your Audio CAPTCHA isn't hard to crack, then just let me know and i'll
> > >start cracking it :)
> > >
> > >Dave:
> >
> > Dave:
> >
> > The point is not how easy my Audio CAPTCHA is to crack, but rather
> > one of accessibility.
> >
> > If one insist on using a graphic CAPTCHA, which in most cases can be
> > cracked, then at least add an Audio CAPTCHA to allow access for the
> > visually disabled.
> >
> > Or, is the point here to allow bots and block the visually disabled
> > -- I think not.
>
> Surely not, but what you're doing with adding a weak audio CAPTCHA is
> adding more options for a hacker. Since the form can be submitted by
> either completing one of both CAPTCHA programs, the hacker can choose
> whichever way he likes. So if you have a very very strong Graphic
> CAPTCHA, but a very weak Audio CAPTHCA, than it isn't too hard to
> crack, as the hacker would only crack the Audio CAPTCHA...
>
> >
> > Look at the CAPTCHA's use here:
> >
> > http://sam.zoy.org/pwntcha/
> >
> > and their efficiently at blocking bots, which next to nil.
> >
> > So, if people are going to believe in the false notion that CAPTCHA's
> > block bots, then why not provide a way for the visually disabled to
> > obtain access as well? Why just block the visually disabled?
>
> The question is not if the CAPTCHAs are crackable, because they are!
> But, like we said in the other thread, it's by finding the right way
> between the time needed to crack, and the time needed to type
> over/listen to CAPTCHA. Adding Audio CAPTCHA decreases time to
> crack...
> >
> >
> > >I think you remember the thread tedd ;)
> >
> > I remember the threads, but nothing that was said there is counter to
> > what I said here.
> >
> > Cheers,
> >
> > tedd
>
> It's atleast an interesting thread about CAPTCHA.
>
> Tijnema
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

   Quote of the day, hands down:

   "The brightest ideas have to pass through the dimmest minds...."
                ~ Tedd (speaking of programmer-vs-management obstacles)

LOL... :)

Saved it ;)

Tijnema


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


--- End Message ---
--- Begin Message ---
Gnag:

I know we can beat this thing to death, as we have in previous threads and I don't anyone wants to travel previously traveled ground.

However, Rob said:

"A good captcha will try to exploit a computer's weaknesses."

So, let's expound on that -- what do you consider to be a computer's weakness?

Cheers,

tedd

PS: I know, better minds have reviewed this issue before, but this is now.
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Mon, 2007-06-11 at 10:38 -0400, tedd wrote:
> Gnag:
> 
> I know we can beat this thing to death, as we have in previous 
> threads and I don't anyone wants to travel previously traveled ground.
> 
> However, Rob said:
> 
> "A good captcha will try to exploit a computer's weaknesses."
> 
> So, let's expound on that -- what do you consider to be a computer's weakness?

Well for instance as humans we can fairly easily recognize similar
shapes. We can recognize an apple whether it is red, green, yellow, has
a stem, has a leaf, is half eaten. A computer might recognize a circle,
and might guess that the circle is an apple based on further analysis.
But we as humans could recognize it as an apple even if we stretched it
a bit so it was no longer circular, or as I said, if it was a crescent
because someone had taken a huge bite out of it. This is something
humans excel at... inferring information from similar previous
experiences.

Taking the image captcha to a different level, one could combine our
ability to understand language as well as imagery. For instance we could
have an icon repository of animals, vehicles, plants, etc (very obvious
ones anyways). Then to create a captcha we could randomly select X
icons, slightly morph them to spoof matching them within the captcha
image itself, then ask:

    What animal do you see in the above picture?

I think someone already said microsoft or someone does something
similar. The principle is that we know what generally constitutes an
animal and a computer does not. Similarly, an audio complement would be
to have a background sound of maybe low level radio chatter overlaid
with the sounds of various everyday items... then one could ask:

    What did you hear ringing?

Possible answers... a bell, the telephone, an alarm, etc.

The problem then becomes an issue of people who can't spell or are
terrible at recognizing everyday things.

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 have corrected your document.


--- End Message ---
--- Begin Message ---
Thats nice! Could "correct" mine also? ;-)

//frank

11 jun 2007 kl. 11.01 skrev [EMAIL PROTECTED]:

I have corrected your document.


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

--- End Message ---
--- Begin Message ---
Hello,

I would like to format the output of a PHP page into a single line and use
gzip compression too.

I know that i can use something like this to get in a single line ( will
workout on this function later to remove spaces ).

<?php
function my_function( $buffer )
{
                $str = str_replace( "\n" , " " , $buffer );
                return $str;
}

ob_start("my_function");

echo 'hello';

ob_end_flush();
?>

And gzip compression is used with

<?php
ob_start("ob_gzhandler");

echo 'hello';

ob_end_flush();
?>

Is there a way to "mix" those codes?

Thanks.

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
I would like to format the output of a PHP page into a single line and use
gzip compression too.

I know that i can use something like this to get in a single line ( will
workout on this function later to remove spaces ).

<?php
function my_function( $buffer )
{
                $str = str_replace( "\n" , " " , $buffer );
                return $str;
}

ob_start("my_function");

echo 'hello';

ob_end_flush();
?>

And gzip compression is used with

<?php
ob_start("ob_gzhandler");

echo 'hello';

ob_end_flush();
?>

Is there a way to "mix" those codes?

Output buffers can be stacked. So simply start the gzip bugger with ob_start, then call it again with your handler. The handlers will be called in reverse order when the buffers get flushed.

BTW, you don't need to ob_end_flush at the end of a script - this gets done automagically when the script ends.

-Stut

--- End Message ---

Reply via email to