php-general Digest 12 Aug 2006 16:38:02 -0000 Issue 4289

2006-08-12 Thread php-general-digest-help

php-general Digest 12 Aug 2006 16:38:02 - Issue 4289

Topics (messages 240556 through 240562):

Re: Comment form spammer
240556 by: Colin Guthrie

SETCOOKIE
240557 by: BBC
240558 by: Peter Lauri

Re: A way to stop spam on this list
240559 by: Ryan A

Parsing RSS
240560 by: John Taylor-Johnston
240561 by: Dave Goodchild

Re: requests from 2nd window breaks my program
240562 by: Tony Marston

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:
php-general@lists.php.net


--
---BeginMessage---

Micky Hulse wrote:

Richard Lynch wrote:

The web2 dictionary is Webster's older dictionary, now in the public
domain, and is installed on my server by the webhost -- so presumably
is readily available.


Nice, was not aware of that dictionary, googling now. :)


Also if you just want some random works... /usr/share/dict/words is 
usually available on most *nix boxes. It is the dictionary used by the 
look command.


Col
---End Message---
---BeginMessage---
Hi List,
I want to set the cookie in which that cookie would be deleted automatically as 
visitor closes the browser. I have read an article
from www.php.net/manual/en/function.setcookie  and it is told me that we can 
set that cookie by unset the value time, but it doesn't
work.

Example:
Setcookie($var, $value, time(), $path, $domain, $secure_binary);
time() = without adding.

Any one can tell me the other way ..
Thank in advance.
 Best Regards
BBC
 **o0o**
---End Message---
---BeginMessage---
When you just use time() you tell the cookie to just live until now, so it
dies directly. You have to add some seconds to determine how long the cookie
will live.

/Peter


-Original Message-
From: BBC [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 12, 2006 7:48 PM
To: PHP
Subject: [PHP] SETCOOKIE

Hi List,
I want to set the cookie in which that cookie would be deleted automatically
as visitor closes the browser. I have read an article
from www.php.net/manual/en/function.setcookie  and it is told me that we can
set that cookie by unset the value time, but it doesn't
work.

Example:
Setcookie($var, $value, time(), $path, $domain, $secure_binary);
time() = without adding.

Any one can tell me the other way ..
Thank in advance.
 Best Regards
BBC
 **o0o**

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


 Late answer,
 
 but I was coming back yesterday from Palestine,
 after the Israelien
 Terror Authority had arrest me for making tonns of
 photos and Videos
 about Israeli military crime... (shooting children
 and pregnant women)


Lets keep religion, conflicts, politics and
crappy/stupid messages (like the one above) out of the
list the 419 Nigerian scam is more interesting
than the above.

I am subscribed for PHP, if I want two different
versions of todays news I can go to Al-Jazeera or
one of the western news sites.

-Ryan

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
---End Message---
---BeginMessage---
Is there something already created to open an rss file, parse it, and 
include() the useful stuff into an html file?

Not all my students have an rss reader.

http://jtjohnston.ca/jtjohnston.rss

jt
---End Message---
---BeginMessage---

On 12/08/06, John Taylor-Johnston 
[EMAIL PROTECTED] wrote:


Is there something already created to open an rss file, parse it, and
include() the useful stuff into an html file?
Not all my students have an rss reader.

http://jtjohnston.ca/jtjohnston.rss





Yep. The PEAR XML_RSS class.



for example:

$feed = 'foo.rss';

$rss = new XML_RSS($feed);
$rss-parse();

foreach ($rss-getItems() as $item) {
// output rss
}




--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk
---End Message---
---BeginMessage---
I had a similar problem in my framework some while ago, but I fixed it to 
allow multiple sessions from the same client. Read about it in 
http://www.tonymarston.net/php-mysql/client-clones.html

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 I'll try to explain my problem as better as I can. Please, be gentle :)

 I developed a program for our salespeople (only them, no public) where
 they can order items for their customers. Order form is made of 6 pages
 (order info, items info, artwork, ad 

php-general Digest 13 Aug 2006 05:11:28 -0000 Issue 4290

2006-08-12 Thread php-general-digest-help

php-general Digest 13 Aug 2006 05:11:28 - Issue 4290

Topics (messages 240563 through 240595):

Re: SETCOOKIE
240563 by: Al
240575 by: Richard Lynch

script to check if form is submitted from the same page?
240564 by: Afan Pasalic
240565 by: BBC
240569 by: Richard Lynch

IMAGE LOADED...
240566 by: BBC
240568 by: Richard Lynch

Re: A way to stop spam on this list
240567 by: BBC
240585 by: Gerry D

Re: problem with Firefox print preview?
240570 by: Richard Lynch

Re: calendar Q
240571 by: Richard Lynch

Re: OT? Verifying mail was received
240572 by: Richard Lynch

Re: b4nl() - What, Why, Where...
240573 by: Richard Lynch

Re: break up variable and put each element in an array
240574 by: Richard Lynch
240576 by: Richard Lynch

Re: Comment form spammer
240577 by: Richard Lynch
240584 by: Gerry D

Chicago PHP Conference
240578 by: Richard Lynch
240583 by: Gerry D

New Large Scale Project.
240579 by: Wesley Acheson

Re: suphp problem
240580 by: Richard Lynch

Re: List Meeting NNOT
240581 by: Richard Lynch
240582 by: Richard Lynch

Re: Unicode
240586 by: Gerry D

Internet Explorer doesn't display UTF-8 page using UTF-8 encoding
240587 by: Jonny Bergström
240588 by: Jonny Bergström
240589 by: Jonny Bergström
240590 by: Rasmus Lerdorf

Re: Parsing RSS
240591 by: Rasmus Lerdorf
240593 by: John Taylor-Johnston
240595 by: John Taylor-Johnston

proxy server
240592 by: John Taylor-Johnston

Rasmus: [PHP] Parsing RSS
240594 by: John Taylor-Johnston

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:
php-general@lists.php.net


--
---BeginMessage---

Peter Lauri wrote:

When you just use time() you tell the cookie to just live until now, so it
dies directly. You have to add some seconds to determine how long the cookie
will live.

/Peter


-Original Message-
From: BBC [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 12, 2006 7:48 PM

To: PHP
Subject: [PHP] SETCOOKIE

Hi List,
I want to set the cookie in which that cookie would be deleted automatically
as visitor closes the browser. I have read an article
from www.php.net/manual/en/function.setcookie  and it is told me that we can
set that cookie by unset the value time, but it doesn't
work.

Example:
Setcookie($var, $value, time(), $path, $domain, $secure_binary);
time() = without adding.

Any one can tell me the other way ..
Thank in advance.
 Best Regards
BBC
 **o0o**




Try replacing time() with simply  so it is not set.
---End Message---
---BeginMessage---
On Sat, August 12, 2006 8:00 am, Peter Lauri wrote:
 When you just use time() you tell the cookie to just live until now,
 so it
 dies directly. You have to add some seconds to determine how long the
 cookie
 will live.

Unfortunately, no...

The above solution relies on the USER computer clock being set correctly.

And while it might mostly kinda sorta usually work, that's not really
super reliable.

Using 0 for the time, however, is HTTP Spec for session cookie which
means the cookie will disappear when the browser is quit.

Note that stupidity on the part of MS engineers makes the path
parameter required when you include the time parameter.

I.e., the cookie spec was implemented not as:
setcookie(var, value, [time], [path], ...)

but was instead implemented as:
setcookie(var, value, [time, path], ...)

The inclusing of time requires the inclusion of path

The path of / should work the same as the intended default behaviour.

-- 
Like Music?
http://l-i-e.com/artists.htm
---End Message---
---BeginMessage---
could I use this code to check if form is submitted from the same 
page/same domain


if ($_POST['form_submitted'] == 'Yes')
{
   if (preg_match($_SERVER['HTTP_HOST'], $_SERVER[HTTP_REFERER]) == 0)
   {
   die ('^[EMAIL PROTECTED]');
   }
}

thanks

-afan
---End Message---
---BeginMessage---
 could I use this code to check if form is submitted from the same 
 page/same domain
 
 if ($_POST['form_submitted'] == 'Yes')
 {
 if (preg_match($_SERVER['HTTP_HOST'], $_SERVER[HTTP_REFERER]) == 0)
 {
 die ('^[EMAIL PROTECTED]');
 }
 }


I prefer to use 'session_start();'
http://www.php.net/manual/en/function.session_start
If I'm not wrong
 Best Regards
BBC
 **o0o**
---End Message---
---BeginMessage---
On Sat, August 12, 2006 1:55 pm, Afan Pasalic wrote:
 could I use this code to check if form is submitted from the same
 page/same domain

 if ($_POST['form_submitted'] == 'Yes')
 {
 if 

[PHP] Re: Comment form spammer

2006-08-12 Thread Colin Guthrie

Micky Hulse wrote:

Richard Lynch wrote:

The web2 dictionary is Webster's older dictionary, now in the public
domain, and is installed on my server by the webhost -- so presumably
is readily available.


Nice, was not aware of that dictionary, googling now. :)


Also if you just want some random works... /usr/share/dict/words is 
usually available on most *nix boxes. It is the dictionary used by the 
look command.


Col

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



[PHP] SETCOOKIE

2006-08-12 Thread BBC
Hi List,
I want to set the cookie in which that cookie would be deleted automatically as 
visitor closes the browser. I have read an article
from www.php.net/manual/en/function.setcookie  and it is told me that we can 
set that cookie by unset the value time, but it doesn't
work.

Example:
Setcookie($var, $value, time(), $path, $domain, $secure_binary);
time() = without adding.

Any one can tell me the other way ..
Thank in advance.
 Best Regards
BBC
 **o0o**

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



RE: [PHP] SETCOOKIE

2006-08-12 Thread Peter Lauri
When you just use time() you tell the cookie to just live until now, so it
dies directly. You have to add some seconds to determine how long the cookie
will live.

/Peter


-Original Message-
From: BBC [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 12, 2006 7:48 PM
To: PHP
Subject: [PHP] SETCOOKIE

Hi List,
I want to set the cookie in which that cookie would be deleted automatically
as visitor closes the browser. I have read an article
from www.php.net/manual/en/function.setcookie  and it is told me that we can
set that cookie by unset the value time, but it doesn't
work.

Example:
Setcookie($var, $value, time(), $path, $domain, $secure_binary);
time() = without adding.

Any one can tell me the other way ..
Thank in advance.
 Best Regards
BBC
 **o0o**

-- 
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] Re: A way to stop spam on this list

2006-08-12 Thread Ryan A
Hey,


 Late answer,
 
 but I was coming back yesterday from Palestine,
 after the Israelien
 Terror Authority had arrest me for making tonns of
 photos and Videos
 about Israeli military crime... (shooting children
 and pregnant women)


Lets keep religion, conflicts, politics and
crappy/stupid messages (like the one above) out of the
list the 419 Nigerian scam is more interesting
than the above.

I am subscribed for PHP, if I want two different
versions of todays news I can go to Al-Jazeera or
one of the western news sites.

-Ryan

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
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



[PHP] Parsing RSS

2006-08-12 Thread John Taylor-Johnston
Is there something already created to open an rss file, parse it, and 
include() the useful stuff into an html file?

Not all my students have an rss reader.

http://jtjohnston.ca/jtjohnston.rss

jt

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



Re: [PHP] Parsing RSS

2006-08-12 Thread Dave Goodchild

On 12/08/06, John Taylor-Johnston 
[EMAIL PROTECTED] wrote:


Is there something already created to open an rss file, parse it, and
include() the useful stuff into an html file?
Not all my students have an rss reader.

http://jtjohnston.ca/jtjohnston.rss





Yep. The PEAR XML_RSS class.



for example:

$feed = 'foo.rss';

$rss = new XML_RSS($feed);
$rss-parse();

foreach ($rss-getItems() as $item) {
// output rss
}




--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


[PHP] Re: requests from 2nd window breaks my program

2006-08-12 Thread Tony Marston
I had a similar problem in my framework some while ago, but I fixed it to 
allow multiple sessions from the same client. Read about it in 
http://www.tonymarston.net/php-mysql/client-clones.html

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 I'll try to explain my problem as better as I can. Please, be gentle :)

 I developed a program for our salespeople (only them, no public) where
 they can order items for their customers. Order form is made of 6 pages
 (order info, items info, artwork, ad copies,...). Also, they use the same
 program to manipulate saved/submitted orders, send confirmation to
 customers, requests to suppliers,... Code works fine. But this morning I
 found a bug that if Salesperson open 2nd window in this program, since it
 has the same session id, it would make a mess with session. I.e., on 1st
 window I'm doing an order. Order ID, customer ID, transaction ID are
 stored in session table. In the middle of the order I open 2nd window to
 check a price on an other customer order. After I opened that order new
 order ID and customer ID are stored now in session table and the order
 (1st window) is now broken or goes to wrong place.
 Or, I'm sending request for approval of an order to customer. But, second
 before I submit the request, I open an order of other customer. Other
 customer ID is now stored in session table and conf. email goes to wrong
 place.
 There are few more scenarios of bug make mess.

 Did anybody had a problem with 2nd window and how is it solved? What's
 wrong with structure/idea I used to make a program?
 Any comment will be helpful to determine or give me an idea how to fix
 this bug.

 Thanks for any help.

 -afan 

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



Re: [PHP] SETCOOKIE

2006-08-12 Thread Al

Peter Lauri wrote:

When you just use time() you tell the cookie to just live until now, so it
dies directly. You have to add some seconds to determine how long the cookie
will live.

/Peter


-Original Message-
From: BBC [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 12, 2006 7:48 PM

To: PHP
Subject: [PHP] SETCOOKIE

Hi List,
I want to set the cookie in which that cookie would be deleted automatically
as visitor closes the browser. I have read an article
from www.php.net/manual/en/function.setcookie  and it is told me that we can
set that cookie by unset the value time, but it doesn't
work.

Example:
Setcookie($var, $value, time(), $path, $domain, $secure_binary);
time() = without adding.

Any one can tell me the other way ..
Thank in advance.
 Best Regards
BBC
 **o0o**




Try replacing time() with simply  so it is not set.

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



[PHP] script to check if form is submitted from the same page?

2006-08-12 Thread Afan Pasalic
could I use this code to check if form is submitted from the same 
page/same domain


if ($_POST['form_submitted'] == 'Yes')
{
   if (preg_match($_SERVER['HTTP_HOST'], $_SERVER[HTTP_REFERER]) == 0)
   {
   die ('^[EMAIL PROTECTED]');
   }
}

thanks

-afan

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



Re: [PHP] script to check if form is submitted from the same page?

2006-08-12 Thread BBC
 could I use this code to check if form is submitted from the same 
 page/same domain
 
 if ($_POST['form_submitted'] == 'Yes')
 {
 if (preg_match($_SERVER['HTTP_HOST'], $_SERVER[HTTP_REFERER]) == 0)
 {
 die ('^[EMAIL PROTECTED]');
 }
 }


I prefer to use 'session_start();'
http://www.php.net/manual/en/function.session_start
If I'm not wrong
 Best Regards
BBC
 **o0o**

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



[PHP] IMAGE LOADED...

2006-08-12 Thread BBC
I build a small site in which some images are loaded in all pages. I concern if 
the client have slow connection to internet.
Does any one can tell me how to send such images to client's computer?
I want to increase the speed connection by taking such image from client's 
computer when it's already set (just like cookie or
cache)

 Best Regards
BBC
 **o0o**

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



Re: [PHP] Re: A way to stop spam on this list

2006-08-12 Thread BBC
 Hey,
 
 
  Late answer,
  
  but I was coming back yesterday from Palestine,
  after the Israelien
  Terror Authority had arrest me for making tonns of
  photos and Videos
  about Israeli military crime... (shooting children
  and pregnant women)
 
 
 Lets keep religion, conflicts, politics and
 crappy/stupid messages (like the one above) out of the
 list the 419 Nigerian scam is more interesting
 than the above.
 
 I am subscribed for PHP, if I want two different
 versions of todays news I can go to Al-Jazeera or
 one of the western news sites.
 
 -Ryan

Take it easy guys
He didn't tell you today news, but he told you where has he been.
I'm sure you can't find such news in any sites about where he was.

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



Re: [PHP] IMAGE LOADED...

2006-08-12 Thread Richard Lynch
On Sat, August 12, 2006 3:18 pm, BBC wrote:
 I build a small site in which some images are loaded in all pages. I
 concern if the client have slow connection to internet.
 Does any one can tell me how to send such images to client's computer?
 I want to increase the speed connection by taking such image from
 client's computer when it's already set (just like cookie or
 cache)

If you are using an image tag, and
if the URL does not change for any given image, and
if the headers do not have no-cache, and
if the headers do have a reasonable expiration
then all browsers will cache the image.

In addition, if the first two conditions are met, IE will probably
cache the damn thing anyway, whether it should or not. :-(  This leads
to the opposite problem of IE caching DYNAMIC images when it should
not, which is a whole different rant. :-)

Oh, plus, AOHell will re-sample and re-compress and cache your images,
to decrease bandwidth.  AOLusers can over-ride this in their own
settings, if they can figure out how to click through AOL's interface
hell to do that.

Hope that helps.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] script to check if form is submitted from the same page?

2006-08-12 Thread Richard Lynch
On Sat, August 12, 2006 1:55 pm, Afan Pasalic wrote:
 could I use this code to check if form is submitted from the same
 page/same domain

 if ($_POST['form_submitted'] == 'Yes')
 {
 if (preg_match($_SERVER['HTTP_HOST'], $_SERVER[HTTP_REFERER]) ==
 0)
 {
 die ('^[EMAIL PROTECTED]');
 }
 }

No.

HTTP_REFERER is completely unreliable.

If you want to be sure of the source of your POST data coming from
your form, you need to send a unique unpredictable token in the FORM,
and log it when you send the FORM, and then compare what comes back.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] problem with Firefox print preview?

2006-08-12 Thread Richard Lynch
On Fri, August 11, 2006 7:58 am, Angelo Zanetti wrote:
 I've developed this site in PHP and its basically finished, now I have
 a
 problem with the printing and print preview.
 I have a dynamic table that can span various pages depending on the
 number of records pulled from the database.

 The print preview (and printed page) doesnt print the first few rows
 but
 instead just prints blank then only prints the last line of the table
 on
 a new page. The table is embedded inside a fieldset component. Im not
 sure if its a mozilla/firefox bug because it seems fine in IE.

 Has anyone come across this problem before?

If you want reliable printing, you almost have to go with PDF:
http://php.net/pdf

The new-fangled CSS stuff might work, on current browsers...

But I wouldn't bet the farm on it.

I have NO IDEA what a fieldset component is, so I suspect it's some
made-up Microsoft thing that has no real meaning outside of IE...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] calendar Q

2006-08-12 Thread Richard Lynch
On Fri, August 11, 2006 12:23 am, William Stokes wrote:
 One more question. I have dates as a datetime in DB. Like 2006-08-11
 08:20:00 and I'm playing only with date part in the calendar
 2006-08-11. So
 how to compare this date to the datetime info in DB? Do I need to use
 DATE_FORMAT or someting like this in the query?

One easy way would be to type-cast it to date in your query:

where convert(whatdate, 'date') = '2006-08-11'

However, not all SQL engines do data type conversion the same way...

If you never ever need the time part, then you could just change the
schema to use only 'date' and not 'timestamp'

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] OT? Verifying mail was received

2006-08-12 Thread Richard Lynch
On Thu, August 10, 2006 9:59 pm, tedd wrote:
 Not a php solution, but send them all a buck via PayPal. For $90
 you'll learn if their email addresses are correct.

This assumes a much higher market penetration for PayPal than it has,
I think...

I know I definitely would not get the email from PayPal, much less the
$1, because I gave up on PayPal ages and ages ago.

Not because of any inherent problem with PayPal itself, but because
the sheer volume of phishing/spam claiming to be PayPal made it
impossible to find the legitimate PayPal traffic, which made PayPal
useless to me.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] b4nl() - What, Why, Where...

2006-08-12 Thread Richard Lynch
On Thu, August 10, 2006 5:48 pm, Micky Hulse wrote:
 b4nl($foo);

 Could not find info on php.net maybe I did not look hard enough.

Arooo?

Maybe you are thinking of:
http://php.net/nl2br

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] break up variable and put each element in an array

2006-08-12 Thread Richard Lynch
On Fri, August 11, 2006 2:40 am, Reinhart Viane wrote:
 Actually, I know that it's browser/OS dependent, cuz I had a bunch of
 Mac users who sent only \r all the time.

 This may be true only of OS 9, and you may not care about them
 anymore, but there it is.

 I also would not be so quick to claim that Linux sends \r\n -- It
 could be dependent on the browser, the OS version, the OS distro, some
 OS settings, ...

 Better safe than sorry, and I *know* I ran into this with some Mac
 users.

 Plus I hate trying to edit the text chunks in vi with those icky \r
 thingies that turn into ^M :-)

 What would you suggest to use then?

I would suggest using the code I posted that started this
sub-thread... :-)

//The order of operations is crucual here:
$string = str_replace(\r\n, \n, $string);
$string = str_replace(\r, \n, $string);

You could use arrays for str_replace, and reduce the function calls,
but that relies on the ORDER in which the array/substitutions are
processed.

While I can't imagine the array version of str_replace doing them in
reverse order, it is not currently a documented behaviour, so I
personally would just take the penalty of 2 function calls, unless
it's a proven performance problem (which seems unlikely).

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] SETCOOKIE

2006-08-12 Thread Richard Lynch
On Sat, August 12, 2006 8:00 am, Peter Lauri wrote:
 When you just use time() you tell the cookie to just live until now,
 so it
 dies directly. You have to add some seconds to determine how long the
 cookie
 will live.

Unfortunately, no...

The above solution relies on the USER computer clock being set correctly.

And while it might mostly kinda sorta usually work, that's not really
super reliable.

Using 0 for the time, however, is HTTP Spec for session cookie which
means the cookie will disappear when the browser is quit.

Note that stupidity on the part of MS engineers makes the path
parameter required when you include the time parameter.

I.e., the cookie spec was implemented not as:
setcookie(var, value, [time], [path], ...)

but was instead implemented as:
setcookie(var, value, [time, path], ...)

The inclusing of time requires the inclusion of path

The path of / should work the same as the intended default behaviour.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] break up variable and put each element in an array

2006-08-12 Thread Richard Lynch
On Fri, August 11, 2006 3:11 am, Ivo F.A.C. Fokkema wrote:
 Well, if it's true that some browsers on some platforms ignore the W3C
 standard, I guess we could use:

Or perhaps these browsers pre-date W3C standards. :-)

 $datelist =
 str_replace(array(\r\n,\n,\r),'BR',$_POST['datelist']);

Two problems here.

This assumes a specific undocumented ordering to the replacement in
processing the array argument.  If, for some insane reason, the PHP
implementation of str_replace chooses to process that input array in
reverse order, you would end up with double BR for \r\n input. 
This is incredibly unlikely, but it's NOT (yet) documented that the
arrays are processed in order.

The next problem is that replacing newline (in any form) with BR on
the INPUT phase of your program is just a Bad Idea. :-)

The INPUT data should be kept sacrosanct and the OS-dependent newlines
should be converted to newlines.

If the data is output later to a browser, nl2br() should be used.

Because someday you may want to output that same data to RSS, XML, or
XYZ, in which case BR is NOT what you want for your newlines.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Re: Comment form spammer

2006-08-12 Thread Richard Lynch
On Sat, August 12, 2006 7:39 am, Colin Guthrie wrote:
 Micky Hulse wrote:
 Richard Lynch wrote:
 The web2 dictionary is Webster's older dictionary, now in the
 public
 domain, and is installed on my server by the webhost -- so
 presumably
 is readily available.

 Nice, was not aware of that dictionary, googling now. :)

 Also if you just want some random works... /usr/share/dict/words is
 usually available on most *nix boxes. It is the dictionary used by the
 look command.

On my webhosted box, these two dirs are the same.

In fact, /words is a symlink to /web2

:-)

YMMV

I don't know enough about the standards and distrabutions to have any
idea which is more common, standard or Morally Correct.  You're on
your own to figure that bit out. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Chicago PHP Conference

2006-08-12 Thread Richard Lynch
It may have started as a joke on PHP-General, but this just isn't
funny anymore.

I'm in the pre-planning phase of organizing a PHP Conference in Chicago.

Due to Chicago weather patterns, the ideal time would be Spring or
Autumn.

Given that cheap airfare generally requires significant advance
notice, I am pre-emptorily eliminating Autumn 2006 as a viable option.

If you are interested in attending please reply OFF-LIST with your
name, email, and some basic input for ideal time-frames in the FALL or
SPRING of 2007.

Suggested Topics would be great, and offers to be a Speaker by
well-known responders would also be MOST welcome.

Example Input:
Richard Lynch
[EMAIL PROTECTED]
Last week of May fits my schedule really well.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] New Large Scale Project.

2006-08-12 Thread Wesley Acheson

I'm looking to do a fairly large scale project.

The problem is I don't know how much of it to write myself how much I
could get away with using existing components (modified as necessary).

Basically the different areas I would need are authentication,
galleries (for images), permission levels.  Internal messaging (not
real time), forums (hopefully I can just plugin an existing one but
intregrated with my new so that registering users for the site
registers for the forum and vice versa, also I would like each new
gallery entry to create a new forum entry for that image).   Comments,
ratings and such like. Sales (This would have to be a script written
elsewhere, I am in no way confident when it comes to dealing with
sensitve info like credit card details.) etc. etc.

My other problem is even though I'm confident coding I find design
very difficult I've a good idea of how the website would work but only
in general terms.

Out of the box mambo or drupal doesn't seem to do what I want really
(obviously) but maybe they would give a good foundation in which to
plugin my own building blocks, has anyone tried this?

Regards,
Wes

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



Re: [PHP] suphp problem

2006-08-12 Thread Richard Lynch
On Sat, July 22, 2006 4:05 pm, Michelle Konzack wrote:
 I have around 8000 VHosts and normaly do not use suphp for security
 reason.  All VHosts have there own UID/GID and the Apache VHosts are
 setup with

 User$UID
 Group   $GID

Does that actually work?

Last I heard, that wouldn't actually affect the UID/GID of the running
application...

Or maybe it works for the CGI...

 Now I have added to a singel VHost directive

 ifModule mod_actions.c
 Action  application/x-httpd-php  /cgi-bin/php5
 /ifModule

 and NOT restarted Apache as written.  I have killed it and then
 started
 from scratch but nothing is working...

 Then I have removed libapache-mod-php5 and now Mozilla let me
 download
 the php files and if I use http://domain/server-info I see the
 mod_actions enabled and the Action is configured.  Now I have
 restarted the Server again and I get an error 500.

I would expect User/Group inside of VHost to give error 500...

 The problem is, that I need libapache-mod-php5 on all VHosts,
 but php-cgi only on 7.

The action bit SHOULD work for this part.

 So what is the secret to get suphp running?

I dunno nothing about suphp.

 Yet I have reinstalled libapache-mod-php5 and the Website is working
 again, but I can not use 'fopen(/home/server/log/some.log, a)'.

 I need suphp only on those 7 VHosts, since the must write to some
 files OUTSIDE of the $DOCUMENTROOT but in the USERSPACE of the VHost.

suphp should allow this, in theory, as I understand it...

But I don't think the Apache User/Group settings inside of VHost is
the way to make suphp to work, as I don't think Apache will allow that
in the first place, which I think is causing your 500 error.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] List Meeting NNOT

2006-08-12 Thread Richard Lynch
On Fri, August 11, 2006 8:08 am, David Robley wrote:
 Ligaya Turmelle wrote:

 tedd wrote:
 At 7:22 AM +0200 8/10/06, Paul Scott wrote:

 On Wed, 2006-08-09 at 18:54 -0500, Jay Blanchard wrote:

  Yes, but not everyone can get to or goes to conferences. And
 this
  would stand on its own don'tcha think? I think that Chicago is
  perfect, because it is centrally located (kinda') and a neat
 place to
  boot.


 Kinda...Chicago is a bit of a drive for us in Cape Town, South
 Africa... ;)

 --Paul


 Start driving now and remember to roll up the windows.

 tedd
 Wonder if I can get a scuba diving tank large enough...

 Also whether you can inflate the tyres enough to keep it afloat...

You could just by one of them boat/bus thingies they cram a bunch of
tourists onto (at least in Dublin for the Viking tour)...

If you Google for amphibious vehicles you'd probably find one for sale.

:-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] List Meeting NNOT

2006-08-12 Thread Richard Lynch
On Wed, August 9, 2006 6:26 pm, Jay Blanchard wrote:
 Here is a thought that a couple of us have shared off-list; why don't
 we
 list denizens plan a get together? A face-to-face with the good, the
 bad
 and the ugly. A mano y' mano curly brace holy war. Beers and meat. The
 whole 9.2 Mb's.

 So, what say you? Shall we start a more formal process? Set a date and
 a
 place some time in the near (6 mos. or so) future? All are welcome,
 from
 the newest of new to the crotchitiest of old.

 Double-dog dare you.

On a more serious note...

It DOES seem like there is enough serious interest to followup with
this for real...

I'll be posting a new thread in seconds with some basic pre-planning
questions...

It will be titled Chicago PHP Conference

I'm using a new thread as I assume some would be interested but have
'killed' the current thread that is more humor-oriented.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Chicago PHP Conference

2006-08-12 Thread Gerry D

Richard,

Within the US that might be ok, but given latest developments, who
wants to fly into the US from elsewhere? I could drive from Canada if
I take 2 weeks vacation...

I don't want to be a show stopper, but I think you need to explain
what your target audience is re global travel, not just weather in
Chicago.

Having said that, I like your idea.

Gerry

On 8/12/06, Richard Lynch [EMAIL PROTECTED] wrote:

It may have started as a joke on PHP-General, but this just isn't
funny anymore.

I'm in the pre-planning phase of organizing a PHP Conference in Chicago.

Due to Chicago weather patterns, the ideal time would be Spring or
Autumn.

Given that cheap airfare generally requires significant advance
notice, I am pre-emptorily eliminating Autumn 2006 as a viable option.

If you are interested in attending please reply OFF-LIST with your
name, email, and some basic input for ideal time-frames in the FALL or
SPRING of 2007.

Suggested Topics would be great, and offers to be a Speaker by
well-known responders would also be MOST welcome.


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



Re: [PHP] Comment form spammer

2006-08-12 Thread Gerry D

My implementation of captcha eliminated chinese spam.

See http://www.lilyregister.com/page/?p=contact

Gerry

On 8/9/06, Micky Hulse [EMAIL PROTECTED] wrote:

Hi,

Recently, a client of mine was getting a ton of spam email from a site
called hotbox.com. I updated her form to one with more spam security,
but she is still receiving junk email.

Anyone feel like sharing code snippets that will help beef-up spam
protection for a contact script?

Do you all enable a CAPTCHA system?

Here is what I am currently using in my contact form script to protect
from spam:



# Error text:
$no_go = 'Forbidden - You are not authorized to view this page!';

# First, make sure the form was posted from a browser.
# For basic web-forms, we don't care about anything other than requests
from a browser:
if(!isset($_SERVER['HTTP_USER_AGENT'])) { die($no_go); exit(); }
# Make sure the form was indeed POST'ed (requires your html form to use
action=post):
if(!$_SERVER['REQUEST_METHOD'] == POST) { die($no_go); exit(); }
# Host names from where the form is authorized to be posted from:
$auth_hosts = array(site1.com, site2.com);
# Where have we been posted from?
$from_array = parse_url(strtolower($_SERVER['HTTP_REFERER']));
# Test to see if the $from_array used www to get here.
$www_used = strpos($from_array['host'], www.);
# Make sure the form was posted from an approved host name:
if(!in_array(($www_used === false ? $from_array['host'] :
substr(stristr($from_array['host'], '.'), 1)), $auth_hosts)) {
//log_bad_request();
header(HTTP/1.0 403 Forbidden);
exit();
}
# Attempt to defend against header injections:
$bad_strings = array(Content-Type:, MIME-Version:,
Content-Transfer-Encoding:, bcc:, cc:);
# Loop through each POST'ed value and test if it contains one of the
$bad_strings:
foreach($_POST as $k = $v) {
foreach($bad_strings as $v2) {
if(strpos($v, $v2) !== false) {
log_bad_request();
header(HTTP/1.0 403 Forbidden);
exit();
}
}
}
# Made it past spammer test, free up some memory and continue rest of
script:
unset($k, $v, $v2, $bad_strings, $auth_hosts, $from_array, $www_used);

--
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] A way to stop spam on this list

2006-08-12 Thread Gerry D

They're not Jap but Chi. And they drove me crazy on my websites until
I fixed them.

http://www.lilyregister.com/page/?p=contact is what stopped the idiots.

Gerry

On 6/19/06, Denis Gerasimov [EMAIL PROTECTED] wrote:

Hello List Members,



I am very tired of deleting spam messages received from PHP mailing lists
and I think we all are.



As I can see most of the spam messages are in Chinese / Japanese.  Since
this is an English-only mailing list I would like to suggest blocking all
messages containing such Chinese / Japanese characters in body, or at least
marking all of them with the word [SPAM] in subject (so mail clients will be
able to deliver it to the Spam folder). AFAIK PHP lists use some home-grown
moderator so doing this should be an easy task.



Of course that may affect some legal users that have such characters in
their signatures, but in this case it sounds reasonable just to reply with
an email explaining blocking policy so any legal user will know what to do
to get his message go through the moderator.



What do you think?



Have a great day,



Denis S Gerasimov
Web Developer
Team Force LLC

Web:http://www.team-force.org/ www.team-force.org

RU  Int'l:   +7 8362-213555

email:[EMAIL PROTECTED]







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



Re: [PHP] Unicode

2006-08-12 Thread Gerry D

Tedd,

Interesting that nobody knows the answer... I am struggling with this
very issue for an international lily register...
http://www.lilyregister.com/

Gerry

On 6/5/06, tedd [EMAIL PROTECTED] wrote:

At 7:08 PM -0700 6/4/06, Rasmus Lerdorf wrote:
Larry Garfield wrote:
In C or C++, yes.  In PHP, do not assume the same string-number mapping.  
Numeric definition is irrelevant.

Right, and now bring Unicode into the picture and this becomes even more true.

-Rasmus

I know there's always RTFM, but if you would care to discuss it, I would like 
to know why. How does php handle Unicode code-points and char-sets?


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



[PHP] Internet Explorer doesn't display UTF-8 page using UTF-8 encoding

2006-08-12 Thread Jonny Bergström

but Firefox does.

this is the page: http://shiinaringo.se/guestbook.php

You can see that a lot of characters (Swedish, Japanese) are totally garbled
when using IE. Works fine in FF. If you try to look at some of the other
pages linked to in the menu, they will work with IE as well. So I just don't
know what is the problem with this one page.
All pages on this site includes a header file which starts with:

---cut---
?php echo '?xml version=1.0 encoding=UTF-8?';?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html
   head
   meta name=Content-type content=text/html; charset=UTF-8 /
---cut---


Which means that in my view I tell the browser through the meta tag which
charset is used (UTF-8). However IE doesn't seem to give a damn about this.
I'm pulling my hair. :-(


[PHP] Re: Internet Explorer doesn't display UTF-8 page using UTF-8 encoding

2006-08-12 Thread Jonny Bergström

...btw, I have been thinking, does IE only display UTF8 pages if the source
file is saved using UTF8 *including* the BOM? I save all pages without the
BOM because using BOM is impossible when you need to set cookies on client.


[PHP] Re: Internet Explorer doesn't display UTF-8 page using UTF-8 encoding

2006-08-12 Thread Jonny Bergström

It's me again. I might have solved it... in a way. Still quite puzzled about
why IE don't give a dime about the meta encoding line in the html head tag.

Here's what I did. The aforementioned header file now adds a header()
statement sending a content-type that also tells the charset, utf-8. :

---snip---
?php
header('Content-Type: text/html; charset=utf-8');
echo '?xml version=1.0 encoding=UTF-8?';?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html
   head
   meta name=Content-type content=text/html; charset=UTF-8 /

---snip---


I don't know if it's the best way to solve it but IE seems happy with it,
and I haven't seen any sideeffects in FF so far.


Re: [PHP] Re: Internet Explorer doesn't display UTF-8 page using UTF-8 encoding

2006-08-12 Thread Rasmus Lerdorf
IE doesn't actually support XHTML, so if your primary target for 
something is IE, you really shouldn't be using XHTML.  Even IE7 doesn't 
fully support it.


Setting the charset in the response header like you did is the best 
approach.  You can do it for all your pages in your php.ini file with:


default_charset = UTF-8

If you want to do it in your page contents, it needs to look like this:

META HTTP-EQUIV=CONTENT-TYPE CONTENT=text/html; charset=UTF-8

Your attempt with the xml header would have worked if IE knew what the 
heck XHTML was.


By the way, everyone should be setting a charset.  If you don't set it, 
IE will look at the first 4k of the body of the page and take a wild 
guess.  If it guesses wrong, typically because someone injected UTF-7 
into your page, then you have an XSS on your hands.


-Rasmus

Jonny Bergström wrote:
It's me again. I might have solved it... in a way. Still quite puzzled 
about

why IE don't give a dime about the meta encoding line in the html head tag.

Here's what I did. The aforementioned header file now adds a header()
statement sending a content-type that also tells the charset, utf-8. :

---snip---
?php
header('Content-Type: text/html; charset=utf-8');
echo '?xml version=1.0 encoding=UTF-8?';?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html
   head
   meta name=Content-type content=text/html; charset=UTF-8 /

---snip---


I don't know if it's the best way to solve it but IE seems happy with it,
and I haven't seen any sideeffects in FF so far.



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



Re: [PHP] Parsing RSS

2006-08-12 Thread Rasmus Lerdorf

John Taylor-Johnston wrote:
Is there something already created to open an rss file, parse it, and 
include() the useful stuff into an html file?

Not all my students have an rss reader.

http://jtjohnston.ca/jtjohnston.rss


RSS is just XML.  Use SimpleXML to map it to a PHP object and just print 
out whatever you want from it directly.


eg.

?php
$rss = simplexml_load_file('http://jtjohnston.ca/jtjohnston.rss');
$channel = $rss-channel;
echo EOB
img src={$channel-image-url} style=float: right;/
h1{$channel-title}/h1
h2{$channel-description}/h2
EOB;
foreach($channel-item as $item) {
  echo EOB
h3a href={$item-link}{$item-title}/a ({$item-pubDate})/h3
{$item-description}
br clear=left /
hr /
EOB;
}
?

Very ugly HTML markup there, of course, but add a bit of CSS and make it 
prettier.


-Rasmus

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



[PHP] proxy server

2006-08-12 Thread John Taylor-Johnston
I have a bulk emailing list to a select group (I never spam, only to 
those who want it). Sometimes their imap/pop servers block my mail.
I know I can assign another smtp over-riding what is in the php.ini 
file. I can likely find enough code here:

http://ca3.php.net/manual/en/ref.mail.php
So, where can I find another smtp server that will send my mail (using 
php) and certify that it comes from me?

Is a proxy server the way to go? Costly?
John
||
--
John Taylor-Johnston
-
If it's not Open Source, it's Murphy's Law.

''' Cégep de Sherbrooke:
ô¿ô http://www.cegepsherbrooke.qc.ca/languesmodernes/
- 819-569-2064

°v° Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures

/(_)\ Université de Sherbrooke
^ ^ http://compcanlit.ca/ T: 819.569.2064


Re: [PHP] Parsing RSS

2006-08-12 Thread John Taylor-Johnston
I've gotten some excellent responses. Thanks! Anything I can implement 
in PHP 4 - until i get IT to update to PHP 5?

John

Dave Goodchild wrote:

Yep. The PEAR XML_RSS class. 





[PHP] Rasmus: [PHP] Parsing RSS

2006-08-12 Thread John Taylor-Johnston

Thanks. P.S. excellent interview with Leo Laporte!
http://www.twit.tv/floss12
Your interview made me think of Cathedrals  Bazaars and the notion of 
free riders.
I've been much of a php free rider myself, but try to find ways to give 
back, usually through phpmyadmin.net

Thanks to everyone who give their time, and responses to my queries!
John

Rasmus Lerdorf wrote:


John Taylor-Johnston wrote:

Is there something already created to open an rss file, parse it, and 
include() the useful stuff into an html file?

Not all my students have an rss reader.

http://jtjohnston.ca/jtjohnston.rss



RSS is just XML.  Use SimpleXML to map it to a PHP object and just 
print out whatever you want from it directly.


eg.

?php
$rss = simplexml_load_file('http://jtjohnston.ca/jtjohnston.rss');
$channel = $rss-channel;
echo EOB
img src={$channel-image-url} style=float: right;/
h1{$channel-title}/h1
h2{$channel-description}/h2
EOB;
foreach($channel-item as $item) {
  echo EOB
h3a href={$item-link}{$item-title}/a ({$item-pubDate})/h3
{$item-description}
br clear=left /
hr /
EOB;
}
?

Very ugly HTML markup there, of course, but add a bit of CSS and make 
it prettier.


-Rasmus


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



Re: [PHP] Parsing RSS

2006-08-12 Thread John Taylor-Johnston

Richard,
Found this: http://www.phpclasses.org/browse/package/2263.html
Real small and works in PHP4. Time for a little CSS tweaking ;) and it 
will look great!

Thanks,
John
http://jtjohnston.ca/news/news.php

Richard Lynch wrote:


I'm willing to bet that if you check Google or even just
http://phpclasses.org you can find something specifically for RSS.


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