Re[2]: [PHP] How to do i18n better?

2010-04-20 Thread Andre Polykanine
Hi Ash,

Yepp, it's understood. But how exactly did you store the
language-specific strings: in an array or using another way?


-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Ashley Sheridan 
To: Jason Pruim 
Date: Tuesday, April 20, 2010, 2:17:47 AM
Subject: [PHP] How to do i18n better?

On Mon, 2010-04-19 at 19:17 -0400, Jason Pruim wrote:

> On Apr 18, 2010, at 6:55 PM, Andre Polykanine wrote:
> 
> > Hi everyone,
> >
> > I posted this in the PHP-i18n list, however got no answer so trying
> > here).
> > We are making a blog platform (http://oire.org/) which is provided in
> > several languages (currently they are Russian, Ukrainian, and
> > English).
> > Now the i18n process is made as follows: we set a cookie on the site
> > and depending on it we select the language to display the site in. We
> > have three (currently) interface files: rus.lng, ukr.lng, and enu.lng
> > (for English US). the format is the following:
> > define ("MSG379", "Welcome!");
> > etc. I know that PHP does support somehow exporting the strings into a
> > .pod file. Maybe it would be better to do that? If so, how can I do
> > it?
> > Could you suggest me maybe a better solution than we currently have?
> > Thanks a lot!
> 
> I've never actually had to do this... But one idea that I came up with  
> is using the browser language in taking a best guess at what language  
> to display... In other words, if the user's browser language is set to  
> Chinese, you can be fairly certain they read Chinese :)
> 
> And now that I typed that out, I realize that may not be what you are  
> really looking for...  And that's when we get into the part where I  
> can't help alot because I've never had to do it :)
> 
> So good luck! :)
> 
> 
> 
> 


That's the check I did on the last site i worked on (vicestyle.com) The
user agent string is checked for a language and the site uses that. If
none is found (bearing in mind that there's no hard and fast rule about
what can go into a UA string) then it defaults to English.

Links within the site itself allow the user to change their language
afterwards, and you could store that in a cookie to it remembers their
choice.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] Mail Function Using PEAR Issues

2010-04-20 Thread Ken Guest
On Tue, Apr 20, 2010 at 2:10 AM, David McGlone  wrote:
> On Mon, 2010-04-19 at 08:25 -0400, Alice Wei wrote:
>
>> I have not changed any of my SMTP settings since my new installation of
>> PHP with Pear. So, I am not sure what the settings are supposed to be.
>> Would I need to install anything else even when the Pear Mail package
>> has been installed?

You might, depending on if you need to use the Mail_Mime or Mail_Queue
packages also (for sending emails with attachments etc etc or for
sending mails in bulk).
 Also there's some rather nice new functionality in the more recent
versions of Mail and Net_SMTP that enable you to log the ESMTP Id of
mails you have submitted to a mail server (along with the SMTP
greeting sent by that server when you connect to it).

> Alice, I never use the PEAR install from my distro, I always download
> and install PEAR into my working folder. The benefit of doing it this
> way is so that when you move your project to a different server, nothing
> will break and you don't have to change anything.
>
> Sometimes when I create a new project, I'll just copy the PEAR folder
> from an older project to the new one. The only thing you may have to
> change in your PHP code is the path to the PEAR libs only if you don't
> put them in the same place every time.
>

When some bug is fixed or dependencies of some of those PEAR packages
change I think you'll find your attitude towards that will change -
there's a pear installer so you don't have to update and track the
dependencies by hand - you do regularly update your packages don't
you? It's smart to do so because at the very least you don't have to
implement work-arounds for bugs that have been fixed in later versions
of those packages - and in the worst-case scenario it means you're not
using versions that have PEAR Security Advisories issued against them.

I believe it's possible to have seperate pear config files per project
so you're not limited to having to use the same versions of packages
across all projects.

If you're using more than a handful of PEAR packages in your project
you might want to write your own meta-package for the project; that
way you don't have to install all those packages individually;
you just do something like "$pear install myProject.xml" and the pear
installer will download and install whichever pear packages you have
described in your xml file.

Details on doing this are at
http://pear.php.net/manual/en/guide.users.dependencytracking.php

For the record, this is the example script that I submitted to
http://www.web-development-blog.com/archives/php-mail-scripts-using-smtp-transport-a-guide-for-beginners/
for demonstrating how to use the PEAR packages for sending a mail with
a file attached.:

“;
$to = “Barney Rubble “;
$subject = “Mail Subject”;
$message = “this is the text of the mail, sent using PEAR’s Mail packages.”;
$host = “smtp.example.com”;
$port = “25″;
$headers = array (‘From’ => $from, ‘To’ => $to, ‘Subject’ => $subject);
$smtp = Mail::factory(’smtp’, array (‘host’ => $host, ‘port’ => $port));
$mime = new Mail_mime();
$mime->setTxtBody($message);
$mime->addAttachment(“/home/ken/logo.png”, ‘image/png’);
$body = $mime->get();
$mail = $smtp->send($to, $mime->headers($headers), $body);

if (PEAR::isError($mail)) {
echo($mail->getMessage() . “!\n”);
} else {
echo(“Message successfully sent to $to!\n”);
echo “Queued As (ESMTP Id): “, $smtp->queued_as, “\n”;
echo “Greeting From Mailserver: “, $smtp->greeting, “\n”;
}

?>


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



-- 
http://blogs.linux.ie/kenguest/

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



[PHP] Excel Report Formatting

2010-04-20 Thread Php Developer
Hi,

Do you know if there is a way to generate a formated Excel report.
I want some rows to be of different colors than the others.

Thank you



  __
Get the name you've always wanted @ymail.com or @rocketmail.com! Go to 
http://ca.promos.yahoo.com/jacko/


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



RE: [PHP] Excel Report Formatting

2010-04-20 Thread Tommy Pham
> -Original Message-
> From: Php Developer [mailto:pdevelo...@rocketmail.com]
> Sent: Tuesday, April 20, 2010 8:30 AM
> To: php-general@lists.php.net
> Subject: [PHP] Excel Report Formatting
> 
> Hi,
> 
> Do you know if there is a way to generate a formated Excel report.
> I want some rows to be of different colors than the others.
> 
> Thank you
> 
> 
> 
> 
> __
> Get the name you've always wanted @ymail.com or @rocketmail.com! Go to
> http://ca.promos.yahoo.com/jacko/
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-1--P155.html


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



RE: [PHP] Excel Report Formatting

2010-04-20 Thread Jay Blanchard
[snip]
Do you know if there is a way to generate a formated Excel report.
I want some rows to be of different colors than the others.
[/snip]

STFW or STFA much? This was posted yesterday

Stupid browser tricks

http://www.evolt.org/node/26896



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



[PHP] Date Math

2010-04-20 Thread Floyd Resler
I need to get the difference in months between two dates.  The dates could be 
as much as 60 months apart.  Is there any easy way to do this either through 
PHP or MySQL?  I know how I can do it through code but thought there might be a 
simple one or two line option.

Thanks!
Floyd


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



Re: [PHP] Date Math

2010-04-20 Thread Dan Joseph
On Tue, Apr 20, 2010 at 11:40 AM, Floyd Resler wrote:

> I need to get the difference in months between two dates.  The dates could
> be as much as 60 months apart.  Is there any easy way to do this either
> through PHP or MySQL?  I know how I can do it through code but thought there
> might be a simple one or two line option.
>
>
check out:
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


RE: [PHP] Excel Report Formatting

2010-04-20 Thread Tommy Pham
> -Original Message-
> From: Jay Blanchard [mailto:jblanch...@pocket.com]
> Sent: Tuesday, April 20, 2010 8:40 AM
> To: Php Developer; php-general@lists.php.net
> Subject: RE: [PHP] Excel Report Formatting
> 
> [snip]
> Do you know if there is a way to generate a formated Excel report.
> I want some rows to be of different colors than the others.
> [/snip]
> 
> STFW or STFA much? This was posted yesterday
> 
> Stupid browser tricks
> 
> http://www.evolt.org/node/26896
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


I believe the OP wants to format the excel for download.  And not display the 
data in excel like in the web browser.


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



RE: [PHP] Excel Report Formatting

2010-04-20 Thread Jay Blanchard
[snip]I believe the OP wants to format the excel for download.  And not
display the data in excel like in the web browser.[/snip]

He didn't specify that, but you can change the code in the article to
save the file and make available for download. 


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



Re: [PHP] Excel Report Formatting

2010-04-20 Thread Dan Joseph
Its good to see we're all playing nice today!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Excel Report Formatting

2010-04-20 Thread Php Developer
Hi Tommy,

The code in the link is traightforward. The problem is you need to install 
ADOdb.

I'm wondering if there is a way to do it from scratch.

Thanks


- Original Message 
From: Tommy Pham 
To: Php Developer ; php-general@lists.php.net
Sent: Tue, April 20, 2010 11:37:21 AM
Subject: RE: [PHP] Excel Report Formatting

> -Original Message-
> From: Php Developer [mailto:pdevelo...@rocketmail.com]
> Sent: Tuesday, April 20, 2010 8:30 AM
> To: php-general@lists.php.net
> Subject: [PHP] Excel Report Formatting
> 
> Hi,
> 
> Do you know if there is a way to generate a formated Excel report.
> I want some rows to be of different colors than the others.
> 
> Thank you
> 
> 
> 
> 
> __
> Get the name you've always wanted @ymail.com or @rocketmail.com! Go to
> http://ca.promos.yahoo.com/jacko/
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-1--P155.html

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


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



Re: Re[2]: [PHP] How to do i18n better?

2010-04-20 Thread Ashley Sheridan
On Tue, 2010-04-20 at 13:34 +0300, Andre Polykanine wrote:
> Hi Ash,
> 
> Yepp, it's understood. But how exactly did you store the
> language-specific strings: in an array or using another way?
> 
> 
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
> 
> - Original message -
> From: Ashley Sheridan 
> To: Jason Pruim 
> Date: Tuesday, April 20, 2010, 2:17:47 AM
> Subject: [PHP] How to do i18n better?
> 
> On Mon, 2010-04-19 at 19:17 -0400, Jason Pruim wrote:
> 
> > On Apr 18, 2010, at 6:55 PM, Andre Polykanine wrote:
> > 
> > > Hi everyone,
> > >
> > > I posted this in the PHP-i18n list, however got no answer so trying
> > > here).
> > > We are making a blog platform (http://oire.org/) which is provided in
> > > several languages (currently they are Russian, Ukrainian, and
> > > English).
> > > Now the i18n process is made as follows: we set a cookie on the site
> > > and depending on it we select the language to display the site in. We
> > > have three (currently) interface files: rus.lng, ukr.lng, and enu.lng
> > > (for English US). the format is the following:
> > > define ("MSG379", "Welcome!");
> > > etc. I know that PHP does support somehow exporting the strings into a
> > > .pod file. Maybe it would be better to do that? If so, how can I do
> > > it?
> > > Could you suggest me maybe a better solution than we currently have?
> > > Thanks a lot!
> > 
> > I've never actually had to do this... But one idea that I came up with  
> > is using the browser language in taking a best guess at what language  
> > to display... In other words, if the user's browser language is set to  
> > Chinese, you can be fairly certain they read Chinese :)
> > 
> > And now that I typed that out, I realize that may not be what you are  
> > really looking for...  And that's when we get into the part where I  
> > can't help alot because I've never had to do it :)
> > 
> > So good luck! :)
> > 
> > 
> > 
> > 
> 
> 
> That's the check I did on the last site i worked on (vicestyle.com) The
> user agent string is checked for a language and the site uses that. If
> none is found (bearing in mind that there's no hard and fast rule about
> what can go into a UA string) then it defaults to English.
> 
> Links within the site itself allow the user to change their language
> afterwards, and you could store that in a cookie to it remembers their
> choice.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 
> 

The differences were stored in an array with a file per language like
so:

$lang['Welcome'] = 'Welcome';
$lang['Contact'] = 'Contact';

and in a a different file for German maybe:

$lang['Welcome'] = 'Willkommen';
$lang['Contact'] = 'Kontakt';

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] Excel Report Formatting

2010-04-20 Thread Ashley Sheridan
On Tue, 2010-04-20 at 12:50 -0400, Dan Joseph wrote:

> Its good to see we're all playing nice today!
> 


It's still not an excel file but an HTML table sent with an Excel
mime-type. This is just asking for trouble if the user does not use
Excel, as it's exploiting behaviour that looks very particular to Excel
and not ALL spreadsheet software.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Class constants

2010-04-20 Thread Nathan Rixham
Gary . wrote:
> On Mon, Apr 19, 2010 at 3:12 PM, Ashley Sheridan wrote:
>> On 19 April 2010 14:24, Gary wrote:
> 
>>> Okay. Why not?
> ...
>> Class constants must be defined with static values, not variables. They are 
>> constants after all! If they relied on the value of a variable, surely that 
>> would mean that their own value might change, so they would just become 
>> regular variables not constants.

a constant is something constant (doesn't change), something static is
something static (persistently there, but may change)

> Right. But in fact the only referenced values are *also* constant
> (unless I'm completely misunderstanding the use of 'const'), so I
> think it's a valid thing to want to do. I accept it doesn't seem to be
> possible, I'm now curious as to the thinking behind it.
> 
>> Is there a specific reason that you need to try and achieve this?
> 
> Okay, well here's a more meaningful situation, perhaps:
> class SomeTable
> {
>   const TABLE_NAME = 'mytable';
>   const SELECT = 'SELECT * FROM ' . MyTable::TABLE_NAME;
>   const INSERT = 'INSERT INTO ' .  MyTable::TABLE_NAME ...
> 

try

public static $INSERT = 'INSERT INTO ' .  MyTable::$TABLE_NAME ...

self::$INSERT

> If the table name should change for some reason, it is preferable to
> make the change in one place in the code (i.e. the value of
> TABLE_NAME), surely, than changing the name in the alternative, which
> is something like:
> class SomeTable
> {
> //  const TABLE_NAME = 'mytable';
>   const SELECT = 'SELECT * FROM mytable';
>   const INSERT = 'INSERT INTO mytable...


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



[PHP] Re: Directory permissions question

2010-04-20 Thread Nathan Rixham
Al wrote:
> I'm working on a hosted website that was hacked and found something I
> don't fully understand. Thought someone here may know the answer.
> 
> The site has 4 php malicious files in directories owned by "system" [php
> created dirs on the site are named "nobody"] and permissions 755.
> 
> Is there any way the files could have been written other than by ftp
> access or at the host root level? Clearly a php script couldn't.
> 
> Thanks, Al..

it doesn't matter what the language of the script that did this is, it's
all about the permissions of the process that's running the script

it's the difference between you running a script as www-data and running
it via the shell as root.

SUExec might be at play, some other process, some user with ssh access,
some back door, consider the permissions and owner of the directory
containing the files, if it's nobody then anybody could have written to it.

All in, ask the ISP to check logs and history, ensure all your
permissions on directories are tight, and that you don't have any
scripts on there that can be abused and that they are "safe" - then
you're clear :)

Best,

Nathan

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



RE: [PHP] Excel Report Formatting

2010-04-20 Thread Tommy Pham
> -Original Message-
> From: Php Developer [mailto:pdevelo...@rocketmail.com]
> Sent: Tuesday, April 20, 2010 9:52 AM
> To: Tommy Pham; php-general@lists.php.net
> Subject: Re: [PHP] Excel Report Formatting
> 
> Hi Tommy,
> 
> The code in the link is traightforward. The problem is you need to
> install ADOdb.
> 
> I'm wondering if there is a way to do it from scratch.
> 
> Thanks
> 
> 
> - Original Message 
> From: Tommy Pham 
> To: Php Developer ; php-
> gene...@lists.php.net
> Sent: Tue, April 20, 2010 11:37:21 AM
> Subject: RE: [PHP] Excel Report Formatting
> 
> > -Original Message-
> > From: Php Developer [mailto:pdevelo...@rocketmail.com]
> > Sent: Tuesday, April 20, 2010 8:30 AM
> > To: php-general@lists.php.net
> > Subject: [PHP] Excel Report Formatting
> >
> > Hi,
> >
> > Do you know if there is a way to generate a formated Excel report.
> > I want some rows to be of different colors than the others.
> >
> > Thank you
> >
> >
> >
> >
> > __
> > Get the name you've always wanted @ymail.com or @rocketmail.com! Go
> to
> > http://ca.promos.yahoo.com/jacko/
> >
> 
> http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-
> 1--P155.html
> 

I think the article/sample uses PEAR's Excel Writer.

http://pear.php.net/package/Spreadsheet_Excel_Writer/
http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-format.setfgcolor.php



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



RE: [PHP] Mail Function Using PEAR Issues

2010-04-20 Thread Alice Wei


> From: peter.e.l...@gmail.com
> Date: Mon, 19 Apr 2010 10:15:08 +0200
> Subject: Re: [PHP] Mail Function Using PEAR Issues
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> 
> Most, if not all, mail servers keep log files. You should look for the
> log files to see if the mail server has sent your mail properly or is
> experiencing problems (those may not feed back into PHP).
> 
> Regards
> Peter
> 
> -- 
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> Flickr: http://www.flickr.com/photos/fake51
> BeWelcome: Fake51
> Couchsurfing: Fake51
> 

You know where I can find that? I use Evolution Mail, a mail server? I found it 
through Ubuntu yesterday. Here is the link: 
http://projects.gnome.org/evolution/ It asks me to put in the type of mail 
service I used, it grabbed Google, which is smtp.google.com. I still cannot 
send mail. I start to wonder what is going on. 

Alice
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

Re: [PHP] How to do i18n better?

2010-04-20 Thread Per Jessen
Ashley Sheridan wrote:

> That's the check I did on the last site i worked on (vicestyle.com)
> The user agent string is checked for a language and the site uses
> that. If none is found (bearing in mind that there's no hard and fast
> rule about what can go into a UA string) then it defaults to English.

The language preference is not set in the UA string, it is set in the
Accept-Language header along with the priority. 

> Links within the site itself allow the user to change their language
> afterwards, and you could store that in a cookie to it remembers their
> choice.

The standard in Apache is 'prefer-language'.



-- 
Per Jessen, Zürich (12.4°C)


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



RE: [PHP] Excel Report Formatting

2010-04-20 Thread Jay Blanchard
[snip]
It's still not an excel file but an HTML table sent with an Excel
mime-type. This is just asking for trouble if the user does not use
Excel, as it's exploiting behaviour that looks very particular to Excel
and not ALL spreadsheet software.
[/snip]

This is true, it is exploiting behavior that is particular to Excel. I
was able to do this with Open Office too, even though I didn't fully
bake the code for that.

The article is pretty old and there are other tools that would probably
work a lot better, but the OP asked about Excel and coloring.

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



Re: [PHP] Get Power Saving Settings of the Server

2010-04-20 Thread kranthi
>> Your server management software may provide a way to get this information 
>> either through the command line or through a network interface

Using exec('gconftool-2 -g
/apps/gnome-power-manager/timeout/sleep_display_ac') helped. Thanks

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



Re: [PHP] How to do i18n better?

2010-04-20 Thread Ashley Sheridan
On Tue, 2010-04-20 at 20:27 +0200, Per Jessen wrote:

> Ashley Sheridan wrote:
> 
> > That's the check I did on the last site i worked on (vicestyle.com)
> > The user agent string is checked for a language and the site uses
> > that. If none is found (bearing in mind that there's no hard and fast
> > rule about what can go into a UA string) then it defaults to English.
> 
> The language preference is not set in the UA string, it is set in the
> Accept-Language header along with the priority. 
> 
> > Links within the site itself allow the user to change their language
> > afterwards, and you could store that in a cookie to it remembers their
> > choice.
> 
> The standard in Apache is 'prefer-language'.
> 
> 
> 
> -- 
> Per Jessen, Zürich (12.4°C)
> 
> 


I wasn't aware of that one, but I know most browsers send a language
with part of the UA string

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Date Math

2010-04-20 Thread tedd

At 11:40 AM -0400 4/20/10, Floyd Resler wrote:
I need to get the difference in months between two dates.  The dates 
could be as much as 60 months apart.  Is there any easy way to do 
this either through PHP or MySQL?  I know how I can do it through 
code but thought there might be a simple one or two line option.


Thanks!
Floyd






I this will work, but the question of what constitutes a month might 
come into play.


Cheers,

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

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



Re: [PHP] Excel Report Formatting

2010-04-20 Thread Php Developer
Hi, somebody knows if it is possible to open excel content in a new window? 
what i want is basically initialize the headers and instead of echo $content i 
want it to open in a new window. is that possible?



- Original Message 
From: Tommy Pham 
To: Php Developer ; php-general@lists.php.net
Sent: Tue, April 20, 2010 1:47:40 PM
Subject: RE: [PHP] Excel Report Formatting

> -Original Message-
> From: Php Developer [mailto:pdevelo...@rocketmail.com]
> Sent: Tuesday, April 20, 2010 9:52 AM
> To: Tommy Pham; php-general@lists.php.net
> Subject: Re: [PHP] Excel Report Formatting
> 
> Hi Tommy,
> 
> The code in the link is traightforward. The problem is you need to
> install ADOdb.
> 
> I'm wondering if there is a way to do it from scratch.
> 
> Thanks
> 
> 
> - Original Message 
> From: Tommy Pham 
> To: Php Developer ; php-
> gene...@lists.php.net
> Sent: Tue, April 20, 2010 11:37:21 AM
> Subject: RE: [PHP] Excel Report Formatting
> 
> > -Original Message-
> > From: Php Developer [mailto:pdevelo...@rocketmail.com]
> > Sent: Tuesday, April 20, 2010 8:30 AM
> > To: php-general@lists.php.net
> > Subject: [PHP] Excel Report Formatting
> >
> > Hi,
> >
> > Do you know if there is a way to generate a formated Excel report.
> > I want some rows to be of different colors than the others.
> >
> > Thank you
> >
> >
> >
> >
> > __
> > Get the name you've always wanted @ymail.com or @rocketmail.com! Go
> to
> > http://ca.promos.yahoo.com/jacko/
> >
> 
> http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-
> 1--P155.html
> 

I think the article/sample uses PEAR's Excel Writer.

http://pear.php.net/package/Spreadsheet_Excel_Writer/
http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-format.setfgcolor.php



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




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



Re: [PHP] Excel Report Formatting

2010-04-20 Thread Ashley Sheridan
On Tue, 2010-04-20 at 12:58 -0700, Php Developer wrote:

> Hi, somebody knows if it is possible to open excel content in a new window? 
> what i want is basically initialize the headers and instead of echo $content 
> i want it to open in a new window. is that possible?
> 
> 
> 
> - Original Message 
> From: Tommy Pham 
> To: Php Developer ; php-general@lists.php.net
> Sent: Tue, April 20, 2010 1:47:40 PM
> Subject: RE: [PHP] Excel Report Formatting
> 
> > -Original Message-
> > From: Php Developer [mailto:pdevelo...@rocketmail.com]
> > Sent: Tuesday, April 20, 2010 9:52 AM
> > To: Tommy Pham; php-general@lists.php.net
> > Subject: Re: [PHP] Excel Report Formatting
> > 
> > Hi Tommy,
> > 
> > The code in the link is traightforward. The problem is you need to
> > install ADOdb.
> > 
> > I'm wondering if there is a way to do it from scratch.
> > 
> > Thanks
> > 
> > 
> > - Original Message 
> > From: Tommy Pham 
> > To: Php Developer ; php-
> > gene...@lists.php.net
> > Sent: Tue, April 20, 2010 11:37:21 AM
> > Subject: RE: [PHP] Excel Report Formatting
> > 
> > > -Original Message-
> > > From: Php Developer [mailto:pdevelo...@rocketmail.com]
> > > Sent: Tuesday, April 20, 2010 8:30 AM
> > > To: php-general@lists.php.net
> > > Subject: [PHP] Excel Report Formatting
> > >
> > > Hi,
> > >
> > > Do you know if there is a way to generate a formated Excel report.
> > > I want some rows to be of different colors than the others.
> > >
> > > Thank you
> > >
> > >
> > >
> > >
> > > __
> > > Get the name you've always wanted @ymail.com or @rocketmail.com! Go
> > to
> > > http://ca.promos.yahoo.com/jacko/
> > >
> > 
> > http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-
> > 1--P155.html
> > 
> 
> I think the article/sample uses PEAR's Excel Writer.
> 
> http://pear.php.net/package/Spreadsheet_Excel_Writer/
> http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-format.setfgcolor.php
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 


Erm, why?

Wouldn't it be easier to output the table as HTML in a new window?

Excel does have plugins for *some* browsers that allow the browser to
open Excel files within its own window (in that annoying way that PDF's
try to open up within the browser) but this can be turned off by the
user (and I can't imagine many people who wouldn't turn it off tbh) This
is also only available for some browsers on some operating systems, and
you could well be alienating users who don't use Microsoft software.

Are you looking to allow a way for users to edit spreadsheets within
your web app? It's worth considering that this is a huge task. There are
some Javascript-based plugins that you can use to embed spreadsheet-like
data into your web pages, but I think anything more than basic
formatting and data entry is a pipe dream at the moment. The only really
usable web-based spreadsheets I've seen come from the likes of very big
companies like Google and Microsoft.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Date Math

2010-04-20 Thread Paul M Foster
On Tue, Apr 20, 2010 at 03:32:58PM -0400, tedd wrote:

> At 11:40 AM -0400 4/20/10, Floyd Resler wrote:
>> I need to get the difference in months between two dates.  The dates
>> could be as much as 60 months apart.  Is there any easy way to do
>> this either through PHP or MySQL?  I know how I can do it through
>> code but thought there might be a simple one or two line option.
>>
>> Thanks!
>> Floyd
>>
>
>
> 
> $date1 = '2009-02-27';
> $date2 = '2004-12-03';
>
> $udate1 = strtotime($date1);
> $udate2 = strtotime($date2);

$from = getdate($udate1);
$from_year = $from['year'];
$from_month = $from['month'];

$to = getdate($udate2);
$to_year = $to['year'];
$to_month = $to['month'];

// Assumes $to_date is later than $from_date

if ($from_year == $to_year)
$months = $to_month - $from_month;
elseif ($to_month >= $from_month) {
$num_years = $to_year - $from_year;
$add_months = $num_years * 12;
$base_months = $to_month - $from_month;
$months = $base_months + $add_months;
}
else { // $to_month < $from_month
$num_years = $to_year - $from_year;
$base_months = $num_years * 12;
$sub_months = $from_month - $to_month;
$months = $base_months - $sub_months;
}

This will give the months between two dates, ignoring the actual day of
the month for each date (may not be exactly what you want, and code is
untested).

>
> $difference = $udate1 - $udate2;
>
> $months_difference = floor($difference / 2678400);
>
> echo("The difference is $months_difference months");
>
> ?>
>
> I this will work, but the question of what constitutes a month might
> come into play.

My code above is submitted because I don't like doing calculations with
seconds. Tedd's right, the OP's questions can't be answered precisely
because months vary in number of days.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Mail Function Using PEAR Issues

2010-04-20 Thread Peter Lind
On 20 April 2010 20:17, Alice Wei  wrote:
>
>> From: peter.e.l...@gmail.com
>> Date: Mon, 19 Apr 2010 10:15:08 +0200
>> Subject: Re: [PHP] Mail Function Using PEAR Issues
>> To: aj...@alumni.iu.edu
>> CC: php-general@lists.php.net
>>
>> Most, if not all, mail servers keep log files. You should look for the
>> log files to see if the mail server has sent your mail properly or is
>> experiencing problems (those may not feed back into PHP).
>>
>> Regards
>> Peter
>>
>> --
>> 
>> WWW: http://plphp.dk / http://plind.dk
>> LinkedIn: http://www.linkedin.com/in/plind
>> Flickr: http://www.flickr.com/photos/fake51
>> BeWelcome: Fake51
>> Couchsurfing: Fake51
>> 
>
> You know where I can find that? I use Evolution Mail, a mail server? I found
> it through Ubuntu yesterday. Here is the link:
> http://projects.gnome.org/evolution/ It asks me to put in the type of mail
> service I used, it grabbed Google, which is smtp.google.com. I still cannot
> send mail. I start to wonder what is going on.
>
> Alice
>

Evolution is a mail client, not a mail server. Apart from that, you're
using the 'mail' (PHPs mail function) as the backend mailer in your
PEAR script - try using smtp instead and pass the SMTP config data you
normally use. Have a look at
http://pear.php.net/manual/en/package.mail.mail.factory.php - the smtp
part.

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



Re: [PHP] Mail Function Using PEAR Issues

2010-04-20 Thread Ashley Sheridan
On Tue, 2010-04-20 at 22:17 +0200, Peter Lind wrote:

> On 20 April 2010 20:17, Alice Wei  wrote:
> >
> >> From: peter.e.l...@gmail.com
> >> Date: Mon, 19 Apr 2010 10:15:08 +0200
> >> Subject: Re: [PHP] Mail Function Using PEAR Issues
> >> To: aj...@alumni.iu.edu
> >> CC: php-general@lists.php.net
> >>
> >> Most, if not all, mail servers keep log files. You should look for the
> >> log files to see if the mail server has sent your mail properly or is
> >> experiencing problems (those may not feed back into PHP).
> >>
> >> Regards
> >> Peter
> >>
> >> --
> >> 
> >> WWW: http://plphp.dk / http://plind.dk
> >> LinkedIn: http://www.linkedin.com/in/plind
> >> Flickr: http://www.flickr.com/photos/fake51
> >> BeWelcome: Fake51
> >> Couchsurfing: Fake51
> >> 
> >
> > You know where I can find that? I use Evolution Mail, a mail server? I found
> > it through Ubuntu yesterday. Here is the link:
> > http://projects.gnome.org/evolution/ It asks me to put in the type of mail
> > service I used, it grabbed Google, which is smtp.google.com. I still cannot
> > send mail. I start to wonder what is going on.
> >
> > Alice
> >
> 
> Evolution is a mail client, not a mail server. Apart from that, you're
> using the 'mail' (PHPs mail function) as the backend mailer in your
> PEAR script - try using smtp instead and pass the SMTP config data you
> normally use. Have a look at
> http://pear.php.net/manual/en/package.mail.mail.factory.php - the smtp
> part.
> 
> Regards
> Peter
> 
> -- 
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> Flickr: http://www.flickr.com/photos/fake51
> BeWelcome: Fake51
> Couchsurfing: Fake51
> 
> 


If you've got Pear on Ubuntu, can Pear not default to sendmail if no
SMTP connection is set up?

Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] Excel Report Formatting

2010-04-20 Thread Jay Blanchard
[snip]
Hi, somebody knows if it is possible to open excel content in a new
window? what i want is basically initialize the headers and instead of
echo $content i want it to open in a new window. is that possible?
[/snip]

Yes, it is possible.  Is this too obvious?


















My apologies, I am in a funky mood today.

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



[PHP] Hello everybody - php newbie from switzerland

2010-04-20 Thread Nick Balestra
Hello everybody,

I am NIck, from Locarno (southern switzerland) i am getting into php 
development for my own start-up company, maybe there are other people near me 
that would be nice to know for networking and alike. I will post here all my 
questions if i don't find any answer already on this list.


Cheers from Switzerland

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



Re: [PHP] Excel Report Formatting

2010-04-20 Thread Tommy Pham
On Tue, Apr 20, 2010 at 1:00 PM, Ashley Sheridan
 wrote:
>
> On Tue, 2010-04-20 at 12:58 -0700, Php Developer wrote:
>
> Hi, somebody knows if it is possible to open excel content in a new window? 
> what i want is basically initialize the headers and instead of echo $content 
> i want it to open in a new window. is that possible?
>
>
>
> - Original Message 
> From: Tommy Pham 
> To: Php Developer ; php-general@lists.php.net
> Sent: Tue, April 20, 2010 1:47:40 PM
> Subject: RE: [PHP] Excel Report Formatting
>
> > -Original Message-
> > From: Php Developer [mailto:pdevelo...@rocketmail.com]
> > Sent: Tuesday, April 20, 2010 9:52 AM
> > To: Tommy Pham; php-general@lists.php.net
> > Subject: Re: [PHP] Excel Report Formatting
> >
> > Hi Tommy,
> >
> > The code in the link is traightforward. The problem is you need to
> > install ADOdb.
> >
> > I'm wondering if there is a way to do it from scratch.
> >
> > Thanks
> >
> >
> > - Original Message 
> > From: Tommy Pham 
> > To: Php Developer ; php-
> > gene...@lists.php.net
> > Sent: Tue, April 20, 2010 11:37:21 AM
> > Subject: RE: [PHP] Excel Report Formatting
> >
> > > -Original Message-
> > > From: Php Developer [mailto:pdevelo...@rocketmail.com]
> > > Sent: Tuesday, April 20, 2010 8:30 AM
> > > To: php-general@lists.php.net
> > > Subject: [PHP] Excel Report Formatting
> > >
> > > Hi,
> > >
> > > Do you know if there is a way to generate a formated Excel report.
> > > I want some rows to be of different colors than the others.
> > >
> > > Thank you
> > >
> > >
> > >
> > >
> > > __
> > > Get the name you've always wanted @ymail.com or @rocketmail.com! Go
> > to
> > > http://ca.promos.yahoo.com/jacko/
> > >
> >
> > http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-
> > 1--P155.html
> >
>
> I think the article/sample uses PEAR's Excel Writer.
>
> http://pear.php.net/package/Spreadsheet_Excel_Writer/
> http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-format.setfgcolor.php
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>
> Erm, why?
>
> Wouldn't it be easier to output the table as HTML in a new window?
>
> Excel does have plugins for *some* browsers that allow the browser to open 
> Excel files within its own window (in that annoying way that PDF's try to 
> open up within the browser) but this can be turned off by the user (and I 
> can't imagine many people who wouldn't turn it off tbh) This is also only 
> available for some browsers on some operating systems, and you could well be 
> alienating users who don't use Microsoft software.
>
> Are you looking to allow a way for users to edit spreadsheets within your web 
> app? It's worth considering that this is a huge task. There are some 
> Javascript-based plugins that you can use to embed spreadsheet-like data into 
> your web pages, but I think anything more than basic formatting and data 
> entry is a pipe dream at the moment. The only really usable web-based 
> spreadsheets I've seen come from the likes of very big companies like Google 
> and Microsoft.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>

If you're looking for something like Google's spreadsheet document
capability, you got a LOT of work of you ;)

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



Re: [PHP] Hello everybody - php newbie from switzerland

2010-04-20 Thread Dan Joseph
On Tue, Apr 20, 2010 at 6:08 PM, Nick Balestra  wrote:

> I am NIck, from Locarno (southern switzerland) i am getting into php
> development for my own start-up company, maybe there are other people near
> me that would be nice to know for networking and alike. I will post here all
> my questions if i don't find any answer already on this list.
>
>
Hi Nick,

Welcome to the community!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


[PHP] How to enable mail function with postfix supported.

2010-04-20 Thread ttplayer
Hello,
 The PHP mail function works well with sendmail installed, however, when I 
install the postfix instead of sendmail , the PHP mail function can't work 
normally. Why? How can I do with the problem? Should I change the group postfix 
or apache with the command chgrp?
 Thank you.

RE: [PHP] Mail Function Using PEAR Issues

2010-04-20 Thread Alice Wei


Subject: Re: [PHP] Mail Function Using PEAR Issues
From: a...@ashleysheridan.co.uk
To: peter.e.l...@gmail.com
CC: aj...@alumni.iu.edu; php-general@lists.php.net
Date: Tue, 20 Apr 2010 21:16:03 +0100






  
  


On Tue, 2010-04-20 at 22:17 +0200, Peter Lind wrote:

On 20 April 2010 20:17, Alice Wei  wrote:
>
>> From: peter.e.l...@gmail.com
>> Date: Mon, 19 Apr 2010 10:15:08 +0200
>> Subject: Re: [PHP] Mail Function Using PEAR Issues
>> To: aj...@alumni.iu.edu
>> CC: php-general@lists.php.net
>>
>> Most, if not all, mail servers keep log files. You should look for the
>> log files to see if the mail server has sent your mail properly or is
>> experiencing problems (those may not feed back into PHP).
>>
>> Regards
>> Peter
>>
>> --
>> 
>> WWW: http://plphp.dk / http://plind.dk
>> LinkedIn: http://www.linkedin.com/in/plind
>> Flickr: http://www.flickr.com/photos/fake51
>> BeWelcome: Fake51
>> Couchsurfing: Fake51
>> 
>
> You know where I can find that? I use Evolution Mail, a mail server? I found
> it through Ubuntu yesterday. Here is the link:
> http://projects.gnome.org/evolution/ It asks me to put in the type of mail
> service I used, it grabbed Google, which is smtp.google.com. I still cannot
> send mail. I start to wonder what is going on.
>
> Alice
>

Evolution is a mail client, not a mail server. Apart from that, you're
using the 'mail' (PHPs mail function) as the backend mailer in your
PEAR script - try using smtp instead and pass the SMTP config data you
normally use. Have a look at
http://pear.php.net/manual/en/package.mail.mail.factory.php - the smtp
part.

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51





If you've got Pear on Ubuntu, can Pear not default to sendmail if no SMTP 
connection is set up?


Well, from my experience with Ubuntu, looks like that it does not do that. 
Unless, I am doing it wrong?






Thanks,

Ash

http://www.ashleysheridan.co.uk







  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

RE: [PHP] Mail Function Using PEAR Issues

2010-04-20 Thread Alice Wei


Subject: Re: [PHP] Mail Function Using PEAR Issues
From: a...@ashleysheridan.co.uk
To: peter.e.l...@gmail.com
CC: aj...@alumni.iu.edu; php-general@lists.php.net
Date: Tue, 20 Apr 2010 21:16:03 +0100






  
  


On Tue, 2010-04-20 at 22:17 +0200, Peter Lind wrote:

On 20 April 2010 20:17, Alice Wei  wrote:
>
>> From: peter.e.l...@gmail.com
>> Date: Mon, 19 Apr 2010 10:15:08 +0200
>> Subject: Re: [PHP] Mail Function Using PEAR Issues
>> To: aj...@alumni.iu.edu
>> CC: php-general@lists.php.net
>>
>> Most, if not all, mail servers keep log files. You should look for the
>> log files to see if the mail server has sent your mail properly or is
>> experiencing problems (those may not feed back into PHP).
>>
>> Regards
>> Peter
>>
>> --
>> 
>> WWW: http://plphp.dk / http://plind.dk
>> LinkedIn: http://www.linkedin.com/in/plind
>> Flickr: http://www.flickr.com/photos/fake51
>> BeWelcome: Fake51
>> Couchsurfing: Fake51
>> 
>
> You know where I can find that? I use Evolution Mail, a mail server? I found
> it through Ubuntu yesterday. Here is the link:
> http://projects.gnome.org/evolution/ It asks me to put in the type of mail
> service I used, it grabbed Google, which is smtp.google.com. I still cannot
> send mail. I start to wonder what is going on.
>
> Alice
>

Evolution is a mail client, not a mail server. Apart from that, you're
using the 'mail' (PHPs mail function) as the backend mailer in your
PEAR script - try using smtp instead and pass the SMTP config data you
normally use. Have a look at
http://pear.php.net/manual/en/package.mail.mail.factory.php - the smtp
part.

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51





If you've got Pear on Ubuntu, can Pear not default to sendmail if no SMTP 
connection is set up?


Well, from my experience with Ubuntu, looks like that it does not do that. 
Unless, I am doing it wrong?






Thanks,

Ash

http://www.ashleysheridan.co.uk







  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Re: [PHP] How to enable mail function with postfix supported.

2010-04-20 Thread Paul M Foster
On Wed, Apr 21, 2010 at 10:16:50AM +0800, ttplayer wrote:

> Hello,
>  The PHP mail function works well with sendmail installed, however, when I 
> install the postfix instead of sendmail , the PHP mail function can't work 
> normally. Why? How can I do with the problem? Should I change the group 
> postfix or apache with the command chgrp?
>  Thank you.

Postfix is meant to function almost identically to sendmail, and usually
has its own "sendmail" command which calls postfix. However, if you
don't configure postfix properly, it won't work properly. That said,
what do you mean by, "can't work normally"?

Paul

-- 
Paul M. Foster

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



Re: [PHP] How to do i18n better?

2010-04-20 Thread Per Jessen
Ashley Sheridan wrote:

> On Tue, 2010-04-20 at 20:27 +0200, Per Jessen wrote:
> 
>> Ashley Sheridan wrote:
>> 
>> > That's the check I did on the last site i worked on (vicestyle.com)
>> > The user agent string is checked for a language and the site uses
>> > that. If none is found (bearing in mind that there's no hard and
>> > fast rule about what can go into a UA string) then it defaults to
>> > English.
>> 
>> The language preference is not set in the UA string, it is set in the
>> Accept-Language header along with the priority.
>> 
>> [snip] 
> 
> 
> I wasn't aware of that one, but I know most browsers send a language
> with part of the UA string
> 
> Thanks,
> Ash

Accept-Language, the 'prefer-language' cookie, the various apache config
options etc. are all part of the Apache content-negotiation
setup/framework.  On our website(s), I rely entirely on
Accept-Language. In the very rare case where it isn't set, I set a
default based on the IP-address of the client.  


-- 
Per Jessen, Zürich (8.4°C)


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



Re: [PHP] How to enable mail function with postfix supported.

2010-04-20 Thread Per Jessen
ttplayer wrote:

> Hello,
>  The PHP mail function works well with sendmail installed, however,
>  when I install the postfix instead of sendmail , the PHP mail
>  function can't work normally. Why? How can I do with the problem?

Start by describing the problem in detail.  Postfix comes with its own
sendmail equivalent, yuo should not have any problem using postfix. I
certainly don't.


-- 
Per Jessen, Zürich (8.2°C)


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



[PHP] PHP imap_open login delay (Cyrus IMAP)

2010-04-20 Thread Evgeniy Arbatov
Hello,

I would like to ask you a question about the PHP imap_open call.

I have an issue with imap_open producing an unreasonable delay when
logging into the Cyrus IMAP server. The delay is exactly 5 seconds and
it is constant across different connections.

  1   0.00  TCP 40496 > imap [SYN] Seq=0 Win=5840 Len=0 MSS=1460
TSV=5166 TSER=0 WS=6

  2   0.588600  TCP imap > 40496 [SYN, ACK] Seq=0 Ack=1 Win=5792 Len=0
MSS=1350 TSV=3543919597 TSER=5166 WS=6

  3   0.588659  TCP 40496 > imap [ACK] Seq=1 Ack=1 Win=5888 Len=0
TSV=5225 TSER=3543919597

  4   0.597507  IMAP Response: * OK [CAPABILITY IMAP4 IMAP4rev1
LITERAL+ ID STARTTLS] Cyrus IMAP v2.3.14 server ready

  5   0.597527  TCP 40496 > imap [ACK] Seq=1 Ack=127 Win=5888 Len=0
TSV=5226 TSER=3543919613

  6   5.643035  IMAP Request:  LOGIN username password

   
  7   5.750195  TCP imap > 40496 [ACK] Seq=127 Ack=35 Win=5824 Len=0
TSV=3543924696 TSER=5731

  8   5.945506  IMAP Response:  OK ...

The Cyrus IMAP server is working fine and responds without delay to
non-PHP logins. On the other hand, when imap_open is called for
Courier IMAP server, there is no 5 seconds delay and PHP logins
proceed smoothly.

The code I am using for PHP imap_open is

 

I am new to PHP and would be much grateful to receive pointers for
debugging this issue.

Thank you!

Evgeniy

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