php-general Digest 21 Nov 2007 00:29:50 -0000 Issue 5139

2007-11-20 Thread php-general-digest-help

php-general Digest 21 Nov 2007 00:29:50 - Issue 5139

Topics (messages 264859 through 264886):

Re: overloading members. aghhh!!!
264859 by: Peter Ford
264874 by: Jochem Maas

Re: two small issues with php mail
264860 by: Wolf
264861 by: Jim Lucas
264862 by: Jim Lucas
264863 by: Wolf
264864 by: Stut
264865 by: Philip Thompson
264866 by: Andrés Robinet
264867 by: Børge Holen
264868 by: Stut
264869 by: Børge Holen
264870 by: Per Jessen
264871 by: Michael McGlothlin
264873 by: Jason Pruim
264876 by: Steve Edberg
264877 by: Stephen Johnson

manipulating XML via php DOM
264872 by: pere roca

__sleep() strange behavior with file writting and SESSION using
264875 by: Julien Pauli
264880 by: Julien Pauli
264881 by: chetan rane
264882 by: Andrés Robinet
264883 by: Andrés Robinet
264885 by: Jochem Maas

Re: two small issues with php mail OT
264878 by: Jay Blanchard
264879 by: Stephen Johnson
264884 by: Jochem Maas
264886 by: Børge Holen

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
Jochem Maas wrote:
 Kiketom wrote:
 Hi all.
 Yesterday i have looking for the overloading members

 Member overloading
 void __set ( string name, mixed value )
 mixed __get ( string name )

 As an example i put this code:

 class foo
 {
 private $ID;
 private $Name;
 private $LastName;
 
 when you declare these three as 'real' members, __get() and __set()
 will no longer be called - they are only called for non-existent members.
 
Nope, that's not true. If the members are private, or otherwise inaccessible,
__get() and __set() are called - I've used this in a few places to provide a
read-only member variable, e.g.:

class foo
{
private $bar=0;

public function __get($nm)
{
return $this-$nm;
}

public function __set($nm,$val)
{
if ($nm != 'bar')
{
$this-$nm = $val;
}
}
}
---End Message---
---BeginMessage---
Peter Ford wrote:
 Jochem Maas wrote:
 Kiketom wrote:
 Hi all.
 Yesterday i have looking for the overloading members

 Member overloading
 void __set ( string name, mixed value )
 mixed __get ( string name )

 As an example i put this code:

 class foo
 {
 private $ID;
 private $Name;
 private $LastName;
 when you declare these three as 'real' members, __get() and __set()
 will no longer be called - they are only called for non-existent members.

 Nope, that's not true. 

Indeed. I did post back to say I was talking .

If the members are private, or otherwise inaccessible,

I believe that this was not always the case (i.e. that in
older versions private members behaved the same way as public
members with regard to __get()/__set() - I'm not sure but I think so)

 __get() and __set() are called - I've used this in a few places to provide a
 read-only member variable, e.g.:
 
 class foo
 {
   private $bar=0;
 
   public function __get($nm)
   {
   return $this-$nm;
   }
 
   public function __set($nm,$val)
   {
   if ($nm != 'bar')
   {
   $this-$nm = $val;
   }
   }
 }
 
---End Message---
---BeginMessage---
 Jim Lucas [EMAIL PROTECTED] wrote: 
 Per Jessen wrote:
  Brad wrote:
!-- Snip for brevity --
 
 remember, he is wanting to setup SMTP auth.  So he will not be using 
 PHP's mail() function.
 
 He needs to talk directly to the SMTP server.
 
 Jim
 Jim,

At this point, we need to just get his homework assignment parameters from 
Brad so we can see what next questions he'll have...  I'm not sure he needs 
to do SMTP auth but even if he does, he's going to need to be able to write 
correct syntax and debug his code along the way...

Wolf
---End Message---
---BeginMessage---

Stut wrote:

Brad wrote:

?

$email = $_REQUEST['email'];

$fromaddress = '[EMAIL PROTECTED]';

$fromname = 'Zone of success Club'; $eol = \r\n;

$headers  = 'From: '.$fromname.' '.$fromaddress.''.$eol;

// $headers = 'bcc: '[EMAIL PROTECTED]';

$headers .= 'Reply-To: '.$fromname.' '.$fromaddress.''.$eol;

$headers .= 'Return-Path: '.$fromname.' '.$fromaddress.''.$eol;

$headers .= 'X-Mailer: PHP '.phpversion().$eol;

$headers .= 'Content-Type: text/html; charset=iso-8859-1'.$eol;

$headers .= 'Content-Transfer-Encoding: 8bit';

$subject = 'Your free book!';

$body = 'a
href=http://www.zoneofsuccessclub.com/freePDF/autopilotebook.pdf;Click
ME/a  Here is your FREE autopilot book';

mail($email, $subject, $body, $headers);


[PHP] Re: Yes, here we go again! (was: two small issues with php mail)

2007-11-20 Thread Per Jessen
Brad wrote:

 Yes, here we go again!
 

Hi Brad

Judging from the amount of traffic you've generated, it's too late, but
still - I don't know how you're replying, but you've managed to screw
up the threading which is bad.  Bad#2 is top-posting - you're obviously
new to the game, so no better time to learn some netiquette. 


/Per Jessen, Zürich

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



Re: FW: [PHP] two small issues with php mail

2007-11-20 Thread Per Jessen
Brad wrote:

 Thought it was a support forum!
 Support usually does not mean piss off.
 

Brad, 
another reading suggestion for you:

http://www.catb.org/~esr/faqs/smart-questions.html


/Per Jessen, Zürich

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



RE: [PHP] two small issues with php mail

2007-11-20 Thread Andrés Robinet
But isn't lack of Bcc support in the mail function under windows or some 
delivery failure under linux the reason Brad is trying to build an SMTP auth 
function/component?. I mean, what's the requirement here? Sending Bcc headers 
and getting the emails delivered or talking directly to the SMTP server?

Because if it's the first one, it should work in a linux PHP installation... 
except for some server filter that is to some extent blocking headers for the 
PHP mail function (probably to avoid spam injections, I don't know).
So... just asking, what's the code and what's the system here? It can't be that 
hard to send out a list of emails with CC / Bcc headers!!!

Rob

 -Original Message-
 From: Per Jessen [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 20, 2007 5:44 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] two small issues with php mail
 
 Jim Lucas wrote:
 
  remember, he is wanting to setup SMTP auth.  So he will not be using
  PHP's mail() function.
 
  He needs to talk directly to the SMTP server.
 
 Uh, I guess I must've missed that bit.  Seems a tad complicated for
 sending an email ...
 
 
 /Per Jessen, Zürich
 
 --
 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] two small issues with php mail

2007-11-20 Thread Per Jessen
Jim Lucas wrote:

 remember, he is wanting to setup SMTP auth.  So he will not be using
 PHP's mail() function.
 
 He needs to talk directly to the SMTP server.

Uh, I guess I must've missed that bit.  Seems a tad complicated for
sending an email ...


/Per Jessen, Zürich

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



RE: [PHP] two small issues with php mail

2007-11-20 Thread Per Jessen
Andrés Robinet wrote:

 I don't really know the internals of how and why Bcc won't work with
 the mail function on windows, but if these guys who developed
 PHPMailer say so... Holy Word, so I wouldn't expect the mail
 function on Windows to work with Bcc.
 What you can do? Well... if Bcc is a requirement and you MUST do the
 code for Windows+PHP you'll have to write you own code to login to a
 SMTP server or use PHPMailer... (or any other ready made solution).

No, you don't have to go such lengths.  A BCC-copy is just another email
which doesn't list the recipient in the To: header, so you just send
your email twice:

mail( to-addr, subject, message, headers);
mail( bcc-addr, subject, message, headers);


/Per Jessen, Zürich

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Jim Lucas

Per Jessen wrote:

Brad wrote:


Where should the bcc go if not the header?



In PHP the mail() function does indeed appear to support a
bcc: header, but I'm assuming it will be removed before the email is
passed to sendmail.  



/Per Jessen, Zürich



remember, he is wanting to setup SMTP auth.  So he will not be using 
PHP's mail() function.


He needs to talk directly to the SMTP server.

Jim

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



RE: [PHP] PHP and SAP Business One DI Server

2007-11-20 Thread Robert Cummings
On Tue, 2007-11-20 at 04:55 -0300, Andrés Robinet wrote:
 I can only speak for my experience in PHP+SOAP in a recent project, but not
 on SAP. You'll surely get more information here as the experts will start
 speaking... If this is of any help to you, then PERFECT! If not, well, hope
 not to bother you with well-known stuff at least.
 
 The project I'm involved with uses web services to fetch vehicle data from
 Chrome (http://www.chrome.com). We are using NuSoap, because we found no
 other options for PHP 4 (PHP 5 has a native Soap Extension, but I can only
 tell you that I've READ NuSoap has more features, I didn't even test it).
 
 You can download NuSoap here (pick the last version, the previous ones had a
 name clash problem with PHP 5).
 http://sourceforge.net/project/showfiles.php?group_id=57663
 
 As for how to use it... well... RTFM. I don't have a clue of how the SAP
 part works (I know very generally what SAP is... I never faced a PHP
 integration with it). But I can give you some sample code for the PHP part,
 obviously, the last word is that of SAP's technical specifications.
 
 /* First Create a WSDL Object and save it in the cache */
 $wsdlURL = https://where/is/my/service?WSDL;;
 $cacheDir = /path/to/writable/dir;
 $timeToLive = 86400; // Only one day, but wsdl's don't change that often,
 you can increase it much more
 $wsdlCache = new wsdlcache($cacheDir, $timeToLive);
 $wsdl = $wsdlCache-get($wsdlURL);
 if ($wsdl == null):
   $wsdl = new wsdl($wsdlURL);
   $wsdlCache-put($this-wsdl);
 endif;
 // After this line you have a wsdl object that was either created or
 retrieved from the cache
 
 /* Get the client and the proxy */
 $client = new nusoap_client($wsdl, true);
 $proxy = $client-getProxy();
 
 /* Now call SAP web service functions as documented in the tech spec */
 $param1 = 'my param 1';
 $param2 = array('whatever', 'is', 2, 'be');
 // Call one of SAP functions
 $result = $proxy-myFunctionAsReadFromSAPTechSpec($param1, $param2);
 
 /* Now check for error codes in the result, store them in a db, whatever you
 need */
 If ($result['WhoKnows'] == 'Checking is your job'):
   echo Good Job!;
 else:
   echo RTFM AGAIN!!!;
 endif;

Thanks for the information Andrés though to be honest I'm looking more
for information about the actual SAP Business One integration since I
have done SOAP in the past without problem. Specifically I guess I'm
looking for the following from the group:

- have you integrated SAP BO with PHP via DI server

- any gotchas with respect to configuration and connecting
  to DI server?

There are a few tidbits on the net, some dating to early 2005. But none
that I read had very definitive information about PHP.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



RE: [PHP] two small issues with php mail

2007-11-20 Thread Per Jessen
Andrés Robinet wrote:

 It can't be that hard to send out a list of
 emails with CC / Bcc headers!!!

You wouldn't have thought so, but ...


/Per Jessen, Zürich

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



RE: [PHP] two small issues with php mail

2007-11-20 Thread Per Jessen
Zoltán Németh wrote:

 actually there is Bcc header, and it is standard.
 see:
 http://tools.ietf.org/html/rfc4021#page-9
 http://tools.ietf.org/html/rfc2822#page-22
 

Interesting - I guess I've never needed it.  I've never bothered with
the mail() function, I find it just as easy to format the email-text
and pipe it to sendmail -oi. 


/Per Jessen, Zürich

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



RE: [PHP] two small issues with php mail

2007-11-20 Thread Per Jessen
Brad wrote:

 Where should the bcc go if not the header?
 

In PHP the mail() function does indeed appear to support a
bcc: header, but I'm assuming it will be removed before the email is
passed to sendmail.  


/Per Jessen, Zürich

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



RE: [PHP] two small issues with php mail

2007-11-20 Thread Zoltán Németh
2007. 11. 19, hétfő keltezéssel 19.54-kor Per Jessen ezt írta:
 Brad wrote:
 
  $headers = 'bcc: [EMAIL PROTECTED]';
  
  Works but corrupts the from portion and changes it to nobody
  Which I think goes back too the smtp portion.
 
 There is no bcc: header. BCC'ing someone is normally done by sending
 them the email without listing them explicitly in to: or cc:.

actually there is Bcc header, and it is standard.
see:
http://tools.ietf.org/html/rfc4021#page-9
http://tools.ietf.org/html/rfc2822#page-22

greets,
Zoltán Németh

 
 
 /Per Jessen, Zürich
 

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Stut

Andrés Robinet wrote:

Brad,

This comment is extracted directly from PHPMailer source (before the
implementation for the function AddBCC)

  /**
   * Adds a Bcc address. Note: this function works
   * with the SMTP mailer on win32, not with the mail
   * mailer.
   * @param string $address
   * @param string $name
   * @return void
   */

I don't really know the internals of how and why Bcc won't work with the
mail function on windows, but if these guys who developed PHPMailer say
so... Holy Word, so I wouldn't expect the mail function on Windows to work
with Bcc.


And they were right, all the way up until PHP 4.3.0. From the mail 
manual page...


4.3.0 (Windows only)	 All custom headers (like From, Cc, Bcc and Date) 
are supported, and are not case-sensitive. (As custom headers are not 
interpreted by the MTA in the first place, but are parsed by PHP, PHP  
4.3 only supported the Cc header element and was case-sensitive).


So if you're using = 4.3.0 on Windows the Bcc header will be parsed.

For unix-based servers where mail uses sendmail the Bcc header is 
supported by that and therefore does not need to be supported by PHP.


-Stut

--
http://stut.net/

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Stut

Brad wrote:

?

$email = $_REQUEST['email'];

$fromaddress = '[EMAIL PROTECTED]';

$fromname = 'Zone of success Club'; $eol = \r\n;

$headers  = 'From: '.$fromname.' '.$fromaddress.''.$eol;

// $headers = 'bcc: '[EMAIL PROTECTED]';

$headers .= 'Reply-To: '.$fromname.' '.$fromaddress.''.$eol;

$headers .= 'Return-Path: '.$fromname.' '.$fromaddress.''.$eol;

$headers .= 'X-Mailer: PHP '.phpversion().$eol;

$headers .= 'Content-Type: text/html; charset=iso-8859-1'.$eol;

$headers .= 'Content-Transfer-Encoding: 8bit';

$subject = 'Your free book!';

$body = 'a
href=http://www.zoneofsuccessclub.com/freePDF/autopilotebook.pdf;Click
ME/a  Here is your FREE autopilot book';

mail($email, $subject, $body, $headers);

?


Take this, be grateful and feel free to try Ruby. Email addresses have 
been changed to protect your victims.


?php
  // You REALLY REALLY need to be doing some validation on this variable
  $email = $_REQUEST['email'];
  // This is the address the email will appear to come from
  $fromaddress = '[EMAIL PROTECTED]';
  // And this is the name
  $fromname = 'Zone of success Club';
  // This is the header separator, it *does* need the \r
  $eol = \r\n;
  // Now we start building the headers, starting with from
  $headers  = 'From: '.$fromname.' '.$fromaddress.''.$eol;
  // Then we *concatenate* the next header to $headers
  $headers .= 'bcc: [EMAIL PROTECTED]'.$eol;
  // Some more headers, some pointless but I can't be arsed to argue
  $headers .= 'Reply-To: '.$fromname.' '.$fromaddress.''.$eol;
  // Removed the name on this one - it's not supposed to have one
  $headers .= 'Return-Path: '.$fromaddress.''.$eol;
  $headers .= 'X-Mailer: PHP '.phpversion().$eol;
  $headers .= 'Content-Type: text/html; charset=iso-8859-1'.$eol;
  $headers .= 'Content-Transfer-Encoding: 8bit';
  $subject = 'Your free book!';
  $body = 'a 
href=http://www.zoneofsuccessclub.com/freePDF/autopilotebook.pdf;Click

ME/a  Here is your FREE autopilot book';
  mail($email, $subject, $body, $headers);
?

I've tested this on a pretty standard install of PHP 5.1.1, and it 
works, bcc and all.


-Stut

--
http://stut.net/

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



Re: [PHP] PHP CURL

2007-11-20 Thread Shafiq Rehman
Hi Fahad,

May be you wil find something helpful  at
http://curl.haxx.se/mail/archive-2003-03/0137.html

-- 
Keep Smiling
Shafiq Rehman (ZCE)
http://www.phpgurru.com | http://shafiq.pk
Cell: +92 300 423 9385

On Nov 19, 2007 11:45 AM, Fahad Pervaiz [EMAIL PROTECTED] wrote:

 I am looking forward to write a script that can send invite to contacts in
 gmail,hotmail, yahoo and aol. I think it is possible to write it using php
 CURL. If yes can any one suggest how?
 and can any one help me write this script or join me to write this script?

 --
 Regards
 Fahad Pervaiz
 www.ecommerce-xperts.com
 (Shopping Cart System)



[PHP] Filter Input: Inspekt

2007-11-20 Thread Manuel Vacelet
Hi all,

Does anyone already heard about inspekt library ?
http://code.google.com/p/inspekt/

Quote from the web site:
Inspekt acts as a sort of 'firewall' API between user input and the
rest of the application. It takes PHP superglobal arrays, encapsulates
their data in an cage object, and destroys the original superglobal.
Data can then be retrieved from the input data object using a variety
of accessor methods that apply filtering, or the data can be checked
against validation methods. Raw data can only be accessed via a
'getRaw()' method, forcing the developer to show clear intent.

It seems very interesting unfortunately I didn't see any discussion
channel attached to this project and the project seems rather young.
So it's hard to tell if this is an active project we can rely on for a
long term usage.

Maybe some of you already use it ?

-- Manuel

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



Re: [PHP] overloading members. aghhh!!!

2007-11-20 Thread Peter Ford
Jochem Maas wrote:
 Kiketom wrote:
 Hi all.
 Yesterday i have looking for the overloading members

 Member overloading
 void __set ( string name, mixed value )
 mixed __get ( string name )

 As an example i put this code:

 class foo
 {
 private $ID;
 private $Name;
 private $LastName;
 
 when you declare these three as 'real' members, __get() and __set()
 will no longer be called - they are only called for non-existent members.
 
Nope, that's not true. If the members are private, or otherwise inaccessible,
__get() and __set() are called - I've used this in a few places to provide a
read-only member variable, e.g.:

class foo
{
private $bar=0;

public function __get($nm)
{
return $this-$nm;
}

public function __set($nm,$val)
{
if ($nm != 'bar')
{
$this-$nm = $val;
}
}
}

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Wolf
 Jim Lucas [EMAIL PROTECTED] wrote: 
 Per Jessen wrote:
  Brad wrote:
!-- Snip for brevity --
 
 remember, he is wanting to setup SMTP auth.  So he will not be using 
 PHP's mail() function.
 
 He needs to talk directly to the SMTP server.
 
 Jim
 Jim,

At this point, we need to just get his homework assignment parameters from 
Brad so we can see what next questions he'll have...  I'm not sure he needs 
to do SMTP auth but even if he does, he's going to need to be able to write 
correct syntax and debug his code along the way...

Wolf

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Jim Lucas

Stut wrote:

Brad wrote:

?

$email = $_REQUEST['email'];

$fromaddress = '[EMAIL PROTECTED]';

$fromname = 'Zone of success Club'; $eol = \r\n;

$headers  = 'From: '.$fromname.' '.$fromaddress.''.$eol;

// $headers = 'bcc: '[EMAIL PROTECTED]';

$headers .= 'Reply-To: '.$fromname.' '.$fromaddress.''.$eol;

$headers .= 'Return-Path: '.$fromname.' '.$fromaddress.''.$eol;

$headers .= 'X-Mailer: PHP '.phpversion().$eol;

$headers .= 'Content-Type: text/html; charset=iso-8859-1'.$eol;

$headers .= 'Content-Transfer-Encoding: 8bit';

$subject = 'Your free book!';

$body = 'a
href=http://www.zoneofsuccessclub.com/freePDF/autopilotebook.pdf;Click
ME/a  Here is your FREE autopilot book';

mail($email, $subject, $body, $headers);

?


Take this, be grateful and feel free to try Ruby. Email addresses have 
been changed to protect your victims.


?php
  // You REALLY REALLY need to be doing some validation on this variable
  $email = $_REQUEST['email'];
  // This is the address the email will appear to come from
  $fromaddress = '[EMAIL PROTECTED]';
  // And this is the name
  $fromname = 'Zone of success Club';
  // This is the header separator, it *does* need the \r
  $eol = \r\n;
  // Now we start building the headers, starting with from
  $headers  = 'From: '.$fromname.' '.$fromaddress.''.$eol;
  // Then we *concatenate* the next header to $headers
  $headers .= 'bcc: [EMAIL PROTECTED]'.$eol;
  // Some more headers, some pointless but I can't be arsed to argue
  $headers .= 'Reply-To: '.$fromname.' '.$fromaddress.''.$eol;
  // Removed the name on this one - it's not supposed to have one
  $headers .= 'Return-Path: '.$fromaddress.''.$eol;
  $headers .= 'X-Mailer: PHP '.phpversion().$eol;
  $headers .= 'Content-Type: text/html; charset=iso-8859-1'.$eol;
  $headers .= 'Content-Transfer-Encoding: 8bit';
  $subject = 'Your free book!';
  $body = 'a 
href=http://www.zoneofsuccessclub.com/freePDF/autopilotebook.pdf;Click

ME/a  Here is your FREE autopilot book';
  mail($email, $subject, $body, $headers);
?

I've tested this on a pretty standard install of PHP 5.1.1, and it 
works, bcc and all.


-Stut



You forgot the second part of the project, SMTP auth.  Can't do it this 
way.  Have to use fsockopen() or something to talk directly to the SMTP 
server.



--
Jim Lucas


Perseverance is not a long race;
it is many short races one after the other

Walter Elliot



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

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Jim Lucas

Wolf wrote:
 Jim Lucas [EMAIL PROTECTED] wrote: 

Per Jessen wrote:

Brad wrote:

!-- Snip for brevity --
remember, he is wanting to setup SMTP auth.  So he will not be using 
PHP's mail() function.


He needs to talk directly to the SMTP server.

Jim

 Jim,

At this point, we need to just get his homework assignment parameters from 
Brad so we can see what next questions he'll have...  I'm not sure he needs 
to do SMTP auth but even if he does, he's going to need to be able to write correct 
syntax and debug his code along the way...

Wolf


Well, re-reading his first post, it does seem like the only two things 
he is interested in solving, besides syntax and formatting, are SMTP 
auth and using the BCC to send to additional addresses.


--
Jim Lucas


Perseverance is not a long race;
it is many short races one after the other

Walter Elliot



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

Twelfth Night, Act II, Scene V
by William Shakespeare

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



RE: [PHP] two small issues with php mail

2007-11-20 Thread Andrés Robinet
 Wolf wrote:
   Jim Lucas [EMAIL PROTECTED] wrote:
  Per Jessen wrote:
  Brad wrote:
  !-- Snip for brevity --
  remember, he is wanting to setup SMTP auth.  So he will not be using
  PHP's mail() function.
 
  He needs to talk directly to the SMTP server.
 
  Jim
   Jim,
 
  At this point, we need to just get his homework assignment parameters
 from Brad so we can see what next questions he'll have...  I'm not
 sure he needs to do SMTP auth but even if he does, he's going to need
 to be able to write correct syntax and debug his code along the way...
 
  Wolf
 
 Well, re-reading his first post, it does seem like the only two things
 he is interested in solving, besides syntax and formatting, are SMTP
 auth and using the BCC to send to additional addresses.
 
 --
 Jim Lucas
 
 
  Perseverance is not a long race;
  it is many short races one after the other
 
 Walter Elliot
 
 
 
  Some men are born to greatness, some achieve greatness,
  and some have greatness thrust upon them.
 
 Twelfth Night, Act II, Scene V
  by William Shakespeare
 
 --

Well, I didn't read Brad's first post (I subscribed to this list recently); but 
what I know for sure is that PHP: Talking to a SMTP server cannot be the 
title for an assignment in a first course on PHP (judging for Brad's inquiries, 
this is it).
Nobody (me included) likes doing assignments for anybody, and that's not what 
this list is for either... but I've not seen any of you throwing a link for a 
video tutorial.
When I started learning PHP it was kind of a new world, though I had some 
experience in C, C++, C#, VB, Delphi, Actionscript and Javascript. So I RTFM 
for the syntactic elements to compare and see the differences with other 
languages I knew, and then I jumped over a set of tutorials for the basic 
functionality like using $_GET, $_POST, $_SESSION, sending out emails and 
accessing databases (for Spanish speakers like me we have 
http://www.illasaron.com with tones of GB in FREE training videos, for English 
speakers I don't know). Only when I felt a bit comfortable I started coding my 
stuff... and I didn't bother anybody in any forum or mail list.
I bet my life that the only one goal of Brad's assignment is How to populate 
the headers parameter for the mail function and the rest of it... is the 
result of Brad's googling and not knowing what to ask. I believe 120% he wants 
SMTP Auth only because his code is failing and he thinks that will fix the 
issue.
Anyway... all that said, I only hope that once he gets it straight he says 
Thanks guys, this was the issue and this is how it got solved

Rob

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Philip Thompson
On Nov 20, 2007 9:13 AM, Wolf [EMAIL PROTECTED] wrote:

  Jim Lucas [EMAIL PROTECTED] wrote:
  Wolf wrote:
    Jim Lucas [EMAIL PROTECTED] wrote:
   Per Jessen wrote:
   Brad wrote:
   !-- Snip for brevity --
   remember, he is wanting to setup SMTP auth.  So he will not be using
   PHP's mail() function.
  
   He needs to talk directly to the SMTP server.
  
   Jim
Jim,
  
   At this point, we need to just get his homework assignment parameters
 from Brad so we can see what next questions he'll have...  I'm not sure he
 needs to do SMTP auth but even if he does, he's going to need to be able to
 write correct syntax and debug his code along the way...
  
   Wolf
 
  Well, re-reading his first post, it does seem like the only two things
  he is interested in solving, besides syntax and formatting, are SMTP
  auth and using the BCC to send to additional addresses.
 
  --
  Jim Lucas
 

 Actually, reading his first post tells you that he is trying to get this
 to work for his business and he's too much into this guy for $$$ to go
 with a MySQL databased mailing list setup to get his email sent...

 Wolf



Is there a community agreement that this guy (Brad) should be blacklisted?
=P

~Philip


Re: [PHP] two small issues with php mail

2007-11-20 Thread Wolf
 Jim Lucas [EMAIL PROTECTED] wrote: 
 Wolf wrote:
   Jim Lucas [EMAIL PROTECTED] wrote: 
  Per Jessen wrote:
  Brad wrote:
  !-- Snip for brevity --
  remember, he is wanting to setup SMTP auth.  So he will not be using 
  PHP's mail() function.
 
  He needs to talk directly to the SMTP server.
 
  Jim
   Jim,
  
  At this point, we need to just get his homework assignment parameters from 
  Brad so we can see what next questions he'll have...  I'm not sure he 
  needs to do SMTP auth but even if he does, he's going to need to be able to 
  write correct syntax and debug his code along the way...
  
  Wolf
 
 Well, re-reading his first post, it does seem like the only two things 
 he is interested in solving, besides syntax and formatting, are SMTP 
 auth and using the BCC to send to additional addresses.
 
 -- 
 Jim Lucas
 

Actually, reading his first post tells you that he is trying to get this to 
work for his business and he's too much into this guy for $$$ to go with a 
MySQL databased mailing list setup to get his email sent...

Wolf

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Stut

Jim Lucas wrote:

Stut wrote:

Brad wrote:

?

$email = $_REQUEST['email'];

$fromaddress = '[EMAIL PROTECTED]';

$fromname = 'Zone of success Club'; $eol = \r\n;

$headers  = 'From: '.$fromname.' '.$fromaddress.''.$eol;

// $headers = 'bcc: '[EMAIL PROTECTED]';

$headers .= 'Reply-To: '.$fromname.' '.$fromaddress.''.$eol;

$headers .= 'Return-Path: '.$fromname.' '.$fromaddress.''.$eol;

$headers .= 'X-Mailer: PHP '.phpversion().$eol;

$headers .= 'Content-Type: text/html; charset=iso-8859-1'.$eol;

$headers .= 'Content-Transfer-Encoding: 8bit';

$subject = 'Your free book!';

$body = 'a
href=http://www.zoneofsuccessclub.com/freePDF/autopilotebook.pdf;Click 


ME/a  Here is your FREE autopilot book';

mail($email, $subject, $body, $headers);

?


Take this, be grateful and feel free to try Ruby. Email addresses have 
been changed to protect your victims.


?php
  // You REALLY REALLY need to be doing some validation on this variable
  $email = $_REQUEST['email'];
  // This is the address the email will appear to come from
  $fromaddress = '[EMAIL PROTECTED]';
  // And this is the name
  $fromname = 'Zone of success Club';
  // This is the header separator, it *does* need the \r
  $eol = \r\n;
  // Now we start building the headers, starting with from
  $headers  = 'From: '.$fromname.' '.$fromaddress.''.$eol;
  // Then we *concatenate* the next header to $headers
  $headers .= 'bcc: [EMAIL PROTECTED]'.$eol;
  // Some more headers, some pointless but I can't be arsed to argue
  $headers .= 'Reply-To: '.$fromname.' '.$fromaddress.''.$eol;
  // Removed the name on this one - it's not supposed to have one
  $headers .= 'Return-Path: '.$fromaddress.''.$eol;
  $headers .= 'X-Mailer: PHP '.phpversion().$eol;
  $headers .= 'Content-Type: text/html; charset=iso-8859-1'.$eol;
  $headers .= 'Content-Transfer-Encoding: 8bit';
  $subject = 'Your free book!';
  $body = 'a 
href=http://www.zoneofsuccessclub.com/freePDF/autopilotebook.pdf;Click

ME/a  Here is your FREE autopilot book';
  mail($email, $subject, $body, $headers);
?

I've tested this on a pretty standard install of PHP 5.1.1, and it 
works, bcc and all.


-Stut



You forgot the second part of the project, SMTP auth.  Can't do it this 
way.  Have to use fsockopen() or something to talk directly to the SMTP 
server.


Point me to the message where Brad mentions SMTP auth. I can't find it. 
Looking back at the thread you were the first person to mention SMTP 
auth. Brad talked about SMTP (clearly not understanding what it is) - 
you added the auth.


Let's not go over-complicating the issue, the guy is already having some 
serious problems.


-Stut

--
http://stut.net/

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Stut

Børge Holen wrote:

OMG the top posting on this freakin' issue is a headache


Whereas removing all of the previous message is like a sensual massage.

-Stut

--
http://stut.net/

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Børge Holen
OMG the top posting on this freakin' issue is a headache

-- 
---
Børge Holen
http://www.arivene.net

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Børge Holen
On Tuesday 20 November 2007 17:49:02 Stut wrote:
 Børge Holen wrote:
  OMG the top posting on this freakin' issue is a headache

 Whereas removing all of the previous message is like a sensual massage.

okey...


 -Stut

 --
 http://stut.net/



-- 
---
Børge Holen
http://www.arivene.net

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



[PHP] manipulating XML via php DOM

2007-11-20 Thread pere roca

please, I need some help with php DOM, for me it's becoming a hell!

After trying other methods (check message from 19th november, called php
DOM question), I'm getting a little more success to manipulate XML.

From the code you can see below you generate this xml. Now I just want to
keep only the initial Or and the final /Or. How can I access and delete
the other (the between tags)? 
I suppose there is no way to create an initial Or without the associated
/Or.
Thanks a lot,

Pere
 
This is the WRONG XML generated from code. 
...
And

  PropertyIsEqualTo
PropertyNamegenus/PropertyName
Literalontophaugs332/Literal
  /PropertyIsEqualTo

Or

   PropertyIsEqualTo
 PropertyNamegenus/PropertyName
Literalcopris/Literal
   /PropertyIsEqualTo
/Or
Or

   PropertyIsEqualTo
 PropertyNamegenus/PropertyName
Literalcopris2/Literal
   /PropertyIsEqualTo
/Or
/And

?php
$species=array('ontophaugs332','copris','copris2');
$dom = new DOMDocument;
//XML we will insert the data to
$dom - load('edit_iberia3.xml');


$count=count($species);

foreach ($species as $sp=$value) {
//we pass parameters of the array

$where_to_insert= $dom-getElementsByTagName('And')-item(0);

$child = $dom-createElement('Or'); 
$or=$where_to_insert-appendChild($child);

$child = $dom-createElement('PropertyIsEqualTo');  
$first=$or-appendChild($child);
  
$child2 = $dom-createElement('PropertyName');
$first-appendChild($child2);

$child3 = $dom-createElement('Literal');
$first-appendChild($child3);

//inserting the array data
$values = $dom-createTextNode($value);
$values = $child3-appendChild($values);
 }

echo $dom-save(nou_iberia);
? 
-- 
View this message in context: 
http://www.nabble.com/manipulating-XML-via-php-DOM-tf4845510.html#a13862945
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Per Jessen
Stut wrote:

 Børge Holen wrote:
 OMG the top posting on this freakin' issue is a headache
 
 Whereas removing all of the previous message is like a sensual
 massage.
 

Pure stress-relief. 


/Per Jessen, Zürich

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Michael McGlothlin

I hate top posters. Pure evil.

OMG the top posting on this freakin' issue is a headache
  

Whereas removing all of the previous message is like a sensual
massage

Pure stress-relief.
  


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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Jason Pruim

Honestly for me... top posting,
On Nov 20, 2007, at 1:19 PM, Michael McGlothlin wrote:


I hate top posters. Pure evil.

OMG the top posting on this freakin' issue is a headache


Whereas removing all of the previous message is like a sensual
massage


inline posting,




Pure stress-relief.


bottom posting...

None of it matters... As long as it's CONSISTENT through out the  
thread :) It's all just as easy for me to follow. Now... Trimming on  
the other hand annoys me... if you trim to much then you have to go  
back and look up the e-mail that the info was in :)


*Gets ready to duck* :)








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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



[PHP] __sleep() strange behavior with file writting and SESSION using

2007-11-20 Thread Julien Pauli
Consider that very simple code, that runs on PHP 5.2.5 onto a Windows
machine :
?php
class a
{
public $b;

public function __sleep()
{
file_put_contents(log.txt,ok . PHP_EOL,FILE_APPEND);
echo done!;
return array();
}
}

$a = new a;
serialize($a);
?

No problem here, log.txt is writtable, when it passes on the serialize()
instruction, it goes to __sleep and works well.
OK\r\n is appended to the log file , and done! is displayed.



Now consider this :

?php
session_start();
class a
{
public $b;

public function __sleep()
{
file_put_contents(log.txt,ok . PHP_EOL,FILE_APPEND);
echo done!;
return array();
}
}

$a = new a;
$_SESSION['obj'] = $a;
?

In this case, when the object is going in the session, it naturally passes
throught __sleep().
The problem is that file_put_contents() doesn't work - the file is not
appended OK\r\n as it should be.
done! is displayed , and if you look at the return value of
file_put_contents ( number of bytes that have been written ) : it's all
right ! It simply doesn not write to the file.

Anyone has an idea ?
Is this a bug ?
Thx :)


Re: [PHP] overloading members. aghhh!!!

2007-11-20 Thread Jochem Maas
Peter Ford wrote:
 Jochem Maas wrote:
 Kiketom wrote:
 Hi all.
 Yesterday i have looking for the overloading members

 Member overloading
 void __set ( string name, mixed value )
 mixed __get ( string name )

 As an example i put this code:

 class foo
 {
 private $ID;
 private $Name;
 private $LastName;
 when you declare these three as 'real' members, __get() and __set()
 will no longer be called - they are only called for non-existent members.

 Nope, that's not true. 

Indeed. I did post back to say I was talking .

If the members are private, or otherwise inaccessible,

I believe that this was not always the case (i.e. that in
older versions private members behaved the same way as public
members with regard to __get()/__set() - I'm not sure but I think so)

 __get() and __set() are called - I've used this in a few places to provide a
 read-only member variable, e.g.:
 
 class foo
 {
   private $bar=0;
 
   public function __get($nm)
   {
   return $this-$nm;
   }
 
   public function __set($nm,$val)
   {
   if ($nm != 'bar')
   {
   $this-$nm = $val;
   }
   }
 }
 

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Steve Edberg

Personally  At 1:31 PM -0500 11/20/07, Jason Pruim wrote:
I preferHonestly for me... top posting,
sideOn Nov 20, 2007, at 1:19 PM, Michael McGlothlin wrote:
posting.
I hate top posters. Pure evil.
-steve  OMG the top posting on this freakin' issue is a headache

		Whereas removing all of the previous message is 
like a sensual

massage

inline posting,




PS. Sometimes interlacing is


Pure stress-relief.


appropriate as well.



bottom posting...

		None of it matters... As long as it's CONSISTENT 
through out the thread :) It's all just as easy for me to follow. 
Now... Trimming on the other hand annoys me... if you trim to much 
then you have to go back and look up the e-mail that the info was in 
:)


*Gets ready to duck* :)

--
+--- my people are the people of the dessert, ---+
| Steve Edberghttp://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center[EMAIL PROTECTED] |
| Bioinformatics programming/database/sysadmin (530)754-9127 |
+ said t e lawrence, picking up his fork +

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Stephen Johnson
I wrote about this a long time ago ... In a galaxy far far away...

http://www.thelonecoder.com/Blog/?p=7

Be good lemmings and do as you're told...
--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




 From: Michael McGlothlin [EMAIL PROTECTED]
 Date: Tue, 20 Nov 2007 11:19:22 -0700
 To: Per Jessen [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] two small issues with php mail
 
 I hate top posters. Pure evil.
 OMG the top posting on this freakin' issue is a headache
   
 Whereas removing all of the previous message is like a sensual
 massage
 Pure stress-relief.
   
 
 -- 
 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] two small issues with php mail OT

2007-11-20 Thread Jay Blanchard
[snip]
I wrote about this a long time ago ... In a galaxy far far away...

http://www.thelonecoder.com/Blog/?p=7

Be good lemmings and do as you're told...
[/snip]

Sitting squarely on the fence he is

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



Re: [PHP] two small issues with php mail OT

2007-11-20 Thread Stephen Johnson
Who says you can't please them all... ;)


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




 From: Jay Blanchard [EMAIL PROTECTED]
 Date: Tue, 20 Nov 2007 14:25:21 -0600
 To: Stephen Johnson [EMAIL PROTECTED], php-general@lists.php.net
 Conversation: [PHP] two small issues with php mail OT
 Subject: RE: [PHP] two small issues with php mail OT
 
 [snip]
 I wrote about this a long time ago ... In a galaxy far far away...
 
 http://www.thelonecoder.com/Blog/?p=7
 
 Be good lemmings and do as you're told...
 [/snip]
 
 Sitting squarely on the fence he is
 
 --
 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] __sleep() strange behavior with file writting and SESSION using

2007-11-20 Thread Julien Pauli
Sorry but it goes throught __sleep() as session serializes objects before
storing them
Proof is that done! is echoed.
Step by step debugging also prove that , the only thing is that
file_put_contents, doesn't execute, but returns a value...



2007/11/20, chetan rane [EMAIL PROTECTED]:

 This aint a bug

 because __sleep is called only when you serialize an object and not when
 you assign it to a session Variable;

 On Nov 21, 2007 12:21 AM, Julien Pauli  [EMAIL PROTECTED] wrote:

  Consider that very simple code, that runs on PHP 5.2.5 onto a Windows
  machine :
  ?php
  class a
  {
 public $b;
 
 public function __sleep()
 {
 file_put_contents(log.txt,ok . PHP_EOL,FILE_APPEND);
 echo done!;
 return array();
 }
  }
 
  $a = new a;
  serialize($a);
  ?
 
  No problem here, log.txt is writtable, when it passes on the serialize()
  instruction, it goes to __sleep and works well.
  OK\r\n is appended to the log file , and done! is displayed.
 
 
 
  Now consider this :
 
  ?php
  session_start();
  class a
  {
 public $b;
 
 public function __sleep()
 {
 file_put_contents(log.txt,ok . PHP_EOL,FILE_APPEND);
 echo done!;
 return array();
 }
  }
 
  $a = new a;
  $_SESSION['obj'] = $a;
  ?
 
  In this case, when the object is going in the session, it naturally
  passes
  throught __sleep().
  The problem is that file_put_contents() doesn't work - the file is not
  appended OK\r\n as it should be.
  done! is displayed , and if you look at the return value of
  file_put_contents ( number of bytes that have been written ) : it's all
  right ! It simply doesn not write to the file.
 
  Anyone has an idea ?
  Is this a bug ?
  Thx :)
 



 --
 Have A plesant Day
 Chetan. D. Rane
 Location: India
 Contact: +91-9844922489
 otherID: [EMAIL PROTECTED]
 [EMAIL PROTECTED]



Re: [PHP] __sleep() strange behavior with file writting and SESSION using

2007-11-20 Thread chetan rane
This aint a bug

because __sleep is called only when you serialize an object and not when you
assign it to a session Variable;

On Nov 21, 2007 12:21 AM, Julien Pauli [EMAIL PROTECTED] wrote:

 Consider that very simple code, that runs on PHP 5.2.5 onto a Windows
 machine :
 ?php
 class a
 {
public $b;

public function __sleep()
{
file_put_contents(log.txt,ok . PHP_EOL,FILE_APPEND);
echo done!;
return array();
}
 }

 $a = new a;
 serialize($a);
 ?

 No problem here, log.txt is writtable, when it passes on the serialize()
 instruction, it goes to __sleep and works well.
 OK\r\n is appended to the log file , and done! is displayed.



 Now consider this :

 ?php
 session_start();
 class a
 {
public $b;

public function __sleep()
{
file_put_contents(log.txt,ok . PHP_EOL,FILE_APPEND);
echo done!;
return array();
}
 }

 $a = new a;
 $_SESSION['obj'] = $a;
 ?

 In this case, when the object is going in the session, it naturally passes
 throught __sleep().
 The problem is that file_put_contents() doesn't work - the file is not
 appended OK\r\n as it should be.
 done! is displayed , and if you look at the return value of
 file_put_contents ( number of bytes that have been written ) : it's all
 right ! It simply doesn not write to the file.

 Anyone has an idea ?
 Is this a bug ?
 Thx :)




-- 
Have A plesant Day
Chetan. D. Rane
Location: India
Contact: +91-9844922489
otherID: [EMAIL PROTECTED]
[EMAIL PROTECTED]


RE: [PHP] __sleep() strange behavior with file writting and SESSION using

2007-11-20 Thread Andrés Robinet
 -Original Message-
 From: Julien Pauli [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 20, 2007 3:51 PM
 To: php-general@lists.php.net
 Subject: [PHP] __sleep() strange behavior with file writting and
 SESSION using
 
 Consider that very simple code, that runs on PHP 5.2.5 onto a Windows
 machine :
 ?php
 class a
 {
 public $b;
 
 public function __sleep()
 {
 file_put_contents(log.txt,ok . PHP_EOL,FILE_APPEND);
 echo done!;
 return array();
 }
 }
 
 $a = new a;
 serialize($a);
 ?
 
 No problem here, log.txt is writtable, when it passes on the
 serialize()
 instruction, it goes to __sleep and works well.
 OK\r\n is appended to the log file , and done! is displayed.
 
 
 
 Now consider this :
 
 ?php
 session_start();
 class a
 {
 public $b;
 
 public function __sleep()
 {
 file_put_contents(log.txt,ok . PHP_EOL,FILE_APPEND);
 echo done!;
 return array();
 }
 }
 
 $a = new a;
 $_SESSION['obj'] = $a;
 ?
 
 In this case, when the object is going in the session, it naturally
 passes
 throught __sleep().
 The problem is that file_put_contents() doesn't work - the file is not
 appended OK\r\n as it should be.
 done! is displayed , and if you look at the return value of
 file_put_contents ( number of bytes that have been written ) : it's all
 right ! It simply doesn not write to the file.
 
 Anyone has an idea ?
 Is this a bug ?
 Thx :)

Maybe I drank too much coffee last night, but this is working for me if I
add dirname(__FILE__) to log.txt (PHP version 5.2.4) and not otherwise

?php
session_start();
class a
{
public $b;

public function __sleep()
{
file_put_contents(dirname(__FILE__)./log.txt,ok .
PHP_EOL,FILE_APPEND);
echo done!;
return array();
}
}

$a = new a;
$_SESSION['obj'] = $a;
?

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



RE: [PHP] __sleep() strange behavior with file writting and SESSION using

2007-11-20 Thread Andrés Robinet
 -Original Message-
 From: Andrés Robinet [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 20, 2007 7:41 PM
 To: php-general@lists.php.net
 Subject: RE: [PHP] __sleep() strange behavior with file writting and
 SESSION using
 
  -Original Message-
  From: Julien Pauli [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, November 20, 2007 3:51 PM
  To: php-general@lists.php.net
  Subject: [PHP] __sleep() strange behavior with file writting and
  SESSION using
 
  Consider that very simple code, that runs on PHP 5.2.5 onto a Windows
  machine :
  ?php
  class a
  {
  public $b;
 
  public function __sleep()
  {
  file_put_contents(log.txt,ok . PHP_EOL,FILE_APPEND);
  echo done!;
  return array();
  }
  }
 
  $a = new a;
  serialize($a);
  ?
 
  No problem here, log.txt is writtable, when it passes on the
  serialize()
  instruction, it goes to __sleep and works well.
  OK\r\n is appended to the log file , and done! is displayed.
 
 
 
  Now consider this :
 
  ?php
  session_start();
  class a
  {
  public $b;
 
  public function __sleep()
  {
  file_put_contents(log.txt,ok . PHP_EOL,FILE_APPEND);
  echo done!;
  return array();
  }
  }
 
  $a = new a;
  $_SESSION['obj'] = $a;
  ?
 
  In this case, when the object is going in the session, it naturally
  passes
  throught __sleep().
  The problem is that file_put_contents() doesn't work - the file is
 not
  appended OK\r\n as it should be.
  done! is displayed , and if you look at the return value of
  file_put_contents ( number of bytes that have been written ) : it's
 all
  right ! It simply doesn not write to the file.
 
  Anyone has an idea ?
  Is this a bug ?
  Thx :)
 
 Maybe I drank too much coffee last night, but this is working for me if
 I
 add dirname(__FILE__) to log.txt (PHP version 5.2.4) and not
 otherwise
 
 ?php
 session_start();
 class a
 {
 public $b;
 
 public function __sleep()
 {
 file_put_contents(dirname(__FILE__)./log.txt,ok .
PHP_EOL,FILE_APPEND);
 echo done!;
 return array();
 }
 }
 
 $a = new a;
 $_SESSION['obj'] = $a;
 ?
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Just wanted to add, I found a log.txt at D:\xampp\apache which happens to
be the root of the apache installation on my system... so, moral of the
story, the current dir is not always the script's dir.
dirname(__FILE__)./log.txt will do the trick.

Rob

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



Re: [PHP] two small issues with php mail OT

2007-11-20 Thread Jochem Maas
Stephen Johnson wrote:
 Who says you can't please them all... ;)
 

Erin Brokovich.

 --
 Stephen Johnson c | eh
 The Lone Coder
 
 http://www.thelonecoder.com
 continuing the struggle against bad code
 
 http://www.thumbnailresume.com
 --
 
 
 
 
 From: Jay Blanchard [EMAIL PROTECTED]
 Date: Tue, 20 Nov 2007 14:25:21 -0600
 To: Stephen Johnson [EMAIL PROTECTED], php-general@lists.php.net
 Conversation: [PHP] two small issues with php mail OT
 Subject: RE: [PHP] two small issues with php mail OT

 [snip]
 I wrote about this a long time ago ... In a galaxy far far away...

 http://www.thelonecoder.com/Blog/?p=7

 Be good lemmings and do as you're told...
 [/snip]

 Sitting squarely on the fence he is

 --
 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] __sleep() strange behavior with file writting and SESSION using

2007-11-20 Thread Jochem Maas
Andrés Robinet wrote:
 -Original Message-

...


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 Just wanted to add, I found a log.txt at D:\xampp\apache which happens to
 be the root of the apache installation on my system... so, moral of the
 story, the current dir is not always the script's dir.
 dirname(__FILE__)./log.txt will do the trick.

I was stumped when originally reading your question. I guess I glossed
over the fact that you weren't using an absolute path for the log file.

the problem makes sense - the CWD is the directory of the script that was 
called,
but during the startup/shutdown phases of php there is no script, the CWD is 
then
whatever the CWD is of the process that started php - apache in this case. 
additionally
some code may change the CWD and there maybe countless of other factors that 
could effect
it.

I suggest always using absolute paths - of only to avoid little mind-benders 
like this.

:-)

 
 Rob
 

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



Re: [PHP] two small issues with php mail OT

2007-11-20 Thread Børge Holen
On Wednesday 21 November 2007 00:53:14 Jochem Maas wrote:
 Stephen Johnson wrote:
  Who says you can't please them all... ;)

 Erin Brokovich.

nah you sure? why cant i remember that.
must be that early  altzheimers syndrome or something


  --
  Stephen Johnson c | eh
  The Lone Coder
 
  http://www.thelonecoder.com
  continuing the struggle against bad code
 
  http://www.thumbnailresume.com
  --
 
  From: Jay Blanchard [EMAIL PROTECTED]
  Date: Tue, 20 Nov 2007 14:25:21 -0600
  To: Stephen Johnson [EMAIL PROTECTED],
  php-general@lists.php.net Conversation: [PHP] two small issues with
  php mail OT
  Subject: RE: [PHP] two small issues with php mail OT
 
  [snip]
  I wrote about this a long time ago ... In a galaxy far far away...
 
  http://www.thelonecoder.com/Blog/?p=7
 
  Be good lemmings and do as you're told...
  [/snip]
 
  Sitting squarely on the fence he is
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php



-- 
---
Børge Holen
http://www.arivene.net

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



[PHP] Should I put pictures into a database?

2007-11-20 Thread Ronald Wiplinger
I have an application, where I use pictures. The size of the picture is
about 90kB and to speed up the preview, I made a thumbnail of each
picture which is about 2.5 to 5kB.
I use now a directory structure of   ../$a/$b/$c/pictures

I wonder if it would be good to put the thumbnails into the current
table, in a different table or leave it like it is now. Same for the
pictures.

What is your opinion and why?

bye

Ronald

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



RE: [PHP] Should I put pictures into a database?

2007-11-20 Thread Bastien Koert

Well, this was just hashed out last week, again. 
 
Its a personal thing. I am against it, having seen the slowdown and database 
bloat caused when this is done. I prefer a pointer to the image to be stored in 
the table and use that. I have found that after about 12Gb of binary data gets 
into the table, it really starts to affect perfomance (in mysql).
 
The arguments for storing the image:
- automatically backed up with the db (you do back up, right?)
- stored with the relevant backing data
 
Against:
- more complex to show image
- db bloat (size of db balloons, may affect cost of storage)
- performance slowdowns as image data grows
 
regards,
 
bastien Date: Wed, 21 Nov 2007 10:14:43 +0800 From: [EMAIL PROTECTED] To: 
php-general@lists.php.net Subject: [PHP] Should I put pictures into a 
database?  I have an application, where I use pictures. The size of the 
picture is about 90kB and to speed up the preview, I made a thumbnail of each 
picture which is about 2.5 to 5kB. I use now a directory structure of 
../$a/$b/$c/pictures  I wonder if it would be good to put the thumbnails 
into the current table, in a different table or leave it like it is now. Same 
for the pictures.  What is your opinion and why?  bye  Ronald  --  
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
http://www.php.net/unsub.php 
_
Send a smile, make someone laugh, have some fun! Start now!
http://www.freemessengeremoticons.ca/?icid=EMENCA122

[PHP] Basic question - PHP usage of SVG files

2007-11-20 Thread Dave M G

PHP list,

I have some images that are in SVG format. What I want to do with them 
is manipulate them by resizing and overlaying one on top of the other.


I do this frequently with PNG images, and I could first convert these 
images to PNG before manipulating them in PHP.


However, I'd like to preserve line quality by keeping them as SVG until 
the last moment.


I can't see on the online documentation if SVG is supported and if it 
requires different commands than raster image formats.


What is the support for SVG in PHP, and where is the online 
documentation for it?


Thank you for your help.

--
Dave M G

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



Re: [PHP] Basic question - PHP usage of SVG files

2007-11-20 Thread Casey
On Nov 20, 2007 7:24 PM, Dave M G [EMAIL PROTECTED] wrote:
 PHP list,

 I have some images that are in SVG format. What I want to do with them
 is manipulate them by resizing and overlaying one on top of the other.

 I do this frequently with PNG images, and I could first convert these
 images to PNG before manipulating them in PHP.

 However, I'd like to preserve line quality by keeping them as SVG until
 the last moment.

 I can't see on the online documentation if SVG is supported and if it
 requires different commands than raster image formats.

 What is the support for SVG in PHP, and where is the online
 documentation for it?

 Thank you for your help.

 --
 Dave M G

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



There is no SVG support in PHP, as far as I know. However, since SVG's
are XML's, you could extract the contents of svg in both files and
merge them together.

-Casey

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