Re: [PHP] creating new class from wrapper class (OOP question)

2006-01-19 Thread Jochem Maas

Henrik Gemal wrote:

In a image gallery I have to class'es:

class GPicFilePicture extends GPicFileType
class GPicFileMovie extends GPicFileType

both of them are based on:

abstract class GPicFileType

In my code I need to create a new GPicFilePicture. To avoid duplicated
code I've create a wrapper class:

class GPicFile

that does something like this:

if (fileextension == jpg)
  return new GPicFilePicture();
else
  return new GPicFileMovie();


I assume the above is in your constructor, and running php5.
if so then what your returning is not being returned... php is returning
the GPicFile object you just asked for instead.

try something like:

GPicFile
{
function __construct($f)
{
if (fileextension == jpg)
$this-decoration = new GPicFilePicture();
else
$this-decoration = new GPicFileMovie();
}

function getFileDate()
{
$this-decoration-getFileDate()
}
}

which I believe is called a decorator pattern (don't quote me.)



so my PHP code looks like:
$file = new GPicFile($filename);

getFileDate() is implemented in both GPicFilePicture and GPicFileMovie.

Now I try to do:
$file-getFileDate();

I get an error saying:
Call to undefined method GPicFile::getFileDate()

Where am I going wrong?



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



[PHP] inserting text into a mime message

2006-01-19 Thread Geoff
Hi All,

I've been searching the archives for help on this, but have come up 
empty-handed. Here's the thing:

I'm using a PHP script to parse every message coming through a 
mailserver. The server invokes my script for each message, giving it 
a filename containing the full raw text of the email. The script 
needs to modify the raw message file, inserting a footer (some 
trailing text, eg: a disclaimer) at the end of each part of readable 
message. It doesn't touch file attachments, but it needs to insert 
the footer in any plaintext, HTML text or both (if they exist).

There are so many different mime options and encoding types that it 
seemed like re-inventing the wheel to try working with only the raw 
message text, so instead I decided to use the PEAR Mail_mimeDecode 
module, which returns a very nice object array of all the parts, 
decoded and ready for use.

It's no problem going through this and inserting the footer wherever 
it is needed. That much I've done.

My problem is trying to rebuild that object array (the output of the 
Mail_mimeDecode::decode() function) back into its raw form once 
again, so that I can write the modified raw text back to the message 
file and the email can go on its way.

Another complication is that except for the insertion of the footer, 
I cannot modify the original message. All the headers, dates, 
receive-paths, etc, must remain unchanged.

Has anybody ever done anything like this before - re-encoding a 
message that had been decoded by Mail_mimeDecode::decode()? I've 
looked at the encode() function, but it seems to be used for making 
a simple message from scratch (with just one body part), it is not 
really the opposite of decode(). [I may be wrong about this - there 
are no examples in the PEAR manual].

I'm not hung up about what to use, it doesn't have to be PEAR, I 
will use any library or code that will do the job. Alternatively, if 
it is possible to do this with encode(), I would love to see an 
example, as I couldn't get it to work that way myself.

Many thanks.

Geoff.


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



[PHP] Re: Access Client IP address

2006-01-19 Thread Michelle Konzack
Am 2006-01-04 13:05:05, schrieb Nilanjan Dasgupta:
 Hi,
 Is there any way to client's IP address inside a php document. I am 
 trying to generate a code that depends on the IP address of the client.

From PHP YesNo.  :-)

$_SERVER['REMOTE_ADDR'] can be false, if the $CLIENT connect via a
proxy.

You need a little JavaApplet which check from client side the IP.

 thanks a lot,
 Nilanjan

Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)

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



[PHP] Re: PHP License And Web Server Integration

2006-01-19 Thread Michelle Konzack
You should read the PHP Licence.

It will tell you, that you can do what you want...

...IF you include the original Licence or one of
the higher numbered versions of future versions.

Please read the PHP Licence On-Line on the Website or those one,
which comes with the package.

Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant


Am 2006-01-07 18:53:16, schrieb Sammy Yu:
 Hi,
   I am considering using php as a scripting engine on a custom web
 server for a commerical project.  Are there any licensing restriction
 if I were to distribute the php5ts.dll?   Also, is there any guide
 that would help me write a module to link php to a web server?
 
 Thanks for your help.
 
 Regards,
 Sammy Yu
 
- END OF REPLYED MESSAGE -




-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)

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



[PHP] Re: Re: Greetings

2006-01-19 Thread Michelle Konzack
Hi Wolf,

Am 2006-01-13 11:49:09, schrieb Wolf:

 Use a robust email program to read and filter your email.  At work I get
 over 1000 emails a day, about 15 of which are not spam.  I see MAYBE 30
 in a day total, but my junk box fills up nicely.  I use Thunderbird and
 have it reading and learning.  For domains which host spammers
 ispsimple and ispmyway then my filter is set to check the email From
 line for *.isp*.*  and not only delete it but mark it as junk and
 learn from it.

FullACK

I get per day (depending of the week of the day) between 50 and
8000 SPAM's per day... I have a Xdialog popup coded, which show
me the actual count... maybe a little bit pervers, but funny how
many Pi..s I can get and Lot.s I have won.

I think, I see 5-50 per day.

OK, I am on more then 100 Mailinglists (mainly Debian) and my
E-Mail is known to the Internet since more then 6 years...

I like my E-Mail, my old and new customers know it and I will
never change it...
   ...and I prefer excessiv Mail-Filtering!!!

Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)

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



[PHP] Re: Re: Greetings

2006-01-19 Thread Michelle Konzack
Hello Richard,

Am 2006-01-13 16:44:46, schrieb Richard Lynch:

 I think the anon-XXX solution presented is far too complex / overhead.
 
 The problem, however, is real.
 
 At last count, over a year ago, pre-spam-filter, I'm getting 10,000
 emails PER DAY.
 
 ~9,900 of them are spam.

Arround the same here.

Per day around 1800-2500 messages from over 100 Mailingliste
(mainly Debian) and 50-8000 Spams + 10-150 Viruses.

 I daresay somebody like Rasmus gets WAY more than that, though he may
 never have bothered to check the pre-spam-filter number :-)

:-)

 I am confident that all the PHP net archives listing my email about
 50,000 times are a source of a not insignificant portion of these.

if I use http://www.google.com/linux for searching
linux4michelle I find me arround 60-90.000 times.

 And this is certainly not the first time this issue has come up, not
 even the first on this list, much less on all the lists I'm on.

Yeah, The Debian-Mailinglists are heavily spamed, but
they filter allready excessiv SPAM and viruses.

 Something as simple as:
 $html = str_replace('@', '#64;', $html);
 should not be too onerous to request of archivists.

I have made a short function for my own public archives which
cripple the whole E-Mail so it shows only in a Webbrowser correctly.

I am thinking, that spamers know the trich with the @ and maybe .

 Obviously, the savvy user will subscribe with a throw-away address or
 have significant filtering in-place with the address they subscribe
 with.

;-)

Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)

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



RE: [PHP] PHP Cache (was PHP load to high on server)

2006-01-19 Thread Albert
Jochem Maas wrote:
 take note that APC does 2 things:

 1. op code caching
 2. manage some shared memory (a central place where you can stick stuff
 that needs to be read again and again and again; but doesn't need updating
 very often)

pear install apc failed without reason. I ended up downloading the package
and building it manually.

I opened my login page (worked fine) and then logged in only to get a
Cannot find server. I had to restart Apache to get any other page out.

On inspection of the Apache error log I saw:
[Thu Jan 19 06:47:49 2006] [notice] child pid 16429 exit signal Segmentation
fault (11)

I have Zend Optimizer installed as well. When disabled Zend Optimizer my
server works correctly. When Zend Optimizer is enabled then I get the
segfaults.

It seems that APC and Zend Optimizer does not work together so I cannot use
APC as some of the modules we use from third party suppliers have been
encoded with Zend Safeguard.

Albert

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.20/234 - Release Date: 2006/01/18
 

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



Re: [PHP] URL - stream context

2006-01-19 Thread Jochem Maas

Richard Lynch wrote:

So I've been poring over the docs for the new stream stuff, and it
looks pretty nifty, except...

I'd really like to be able to just hand a URL to PHP like:
http://php.net/manual/en/ref.stream.php


er you can if allow_url_fopen ini setting is set to 1  (can't you?)

$fh = fopen('http://php.net/');


for other kinds of streams (e.g. ftp?) you can write a userland
wrapper and register it so that you can use those kinds (e.g. ftp)
of urls with fopen et al:

http://www.php.net/manual/en/function.stream-wrapper-register.php



And let PHP figure out how to create a stream context out of that, and
which port to use, and how to do the GET to start things off, so I can
just read my data.

In other words, I'm greedy, and I want *BOTH* the simplicity of
fopen() *and* the flexiblity of adding filters and all the fun new
stuff.


well the manual (http://php.net/fopen) says:

$handle = fopen(/home/rasmus/file.txt, r);
$handle = fopen(/home/rasmus/file.gif, wb);
$handle = fopen(http://www.example.com/;, r);
$handle = fopen(ftp://user:[EMAIL PROTECTED]/somefile.txt, w);



I don't want to have to tear apart the URL myself and mess with
sending 'GET ...' and 'host: ...'

Did I miss a stream_url_to_context() function somewhere?...

Not just parse_url() -- That will tear apart the URL, but then I have
to do all the work that's buried in fopen()

Bigger Picture:
I have an old class that will take an array of HTTP URLs, and
fsockopen them, set them non-blocking, and then fread() each in turn,
and gather an array of results.

The class has a 'timeout' parameter that limits how long it will wait
for all this to happen.

Each result set is marked as complete or incomplete.

Complete results may be cached, for however long you choose in another
setting.

If results are incomplete, the cached version is used, no matter how
obsolete.  (This is for a search engine.)

Blah, blah, blah.

Anyway, I'd *LIKE* to be able to just allow *ANY* URL to be passed in,
and have some nifty stream function, not unlike fopen(), that will
take care of the grotty details of doing whatever it takes to get the
data, but let me set the socket non-blocking and read them
asynchronously.

I feel like I must be missing something fundamentally simple here in
all this stream stuff, but it's sure not obvious what I'm missing in
the docs.


and maybe I'm completely misunderstanding you ;-/





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



[PHP] Performance Comments Question

2006-01-19 Thread Rodolfo Andrade
Hi all!

I would like to know if comments in the code affects the performance. I know
that comments are ignored by the interpreter, but it does increase the file
size, so I was thinking about a possible performance hit for highly
commented files.

Can anyone confirm this?
Thanks!

Rodolfo Andrade

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



[PHP] Re: Embedded player

2006-01-19 Thread Barry

Jedidiah wrote:

Hi.  I have been wanting to do something on my site for some time and was
recently told that it could be accomplished.   
 


I started a daily devotion on our church website a few weeks ago, so I
changed all of my files to .php and began using a MySQL database.  

 


I have a sermons page (www.mzbc.com/sermons.php) with a table with links to
.wma sermons.  When clicked in Firefox, it prompts to download.  What I want
is to be able to embed a player that will stay on that page and play all of
the files in the table.  


Embedding players in websites/playlist etc.:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html/adding_windows_media_to_web_pages__etse.asp

Happy programming :)



I have found a player like this at http://musicplayer.sourceforge.net/.
There is also a Windows Media style player that will do the same thing.  The
problem is I either have to create each individual sermon with an embedded
player in a new page, or create a playlist.  I will eventually have way to
many sermons to use a playlist.  I am sure there must be some way to tell
each file in the table to open in that player, but I am not familiar yet
with programming yet.  I have php for dummies which I started reading, but I
am not sure it will do what I want.  

 


Barry

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



[PHP] php5.0.5 include() terminates script BUGBUGBUGBUG

2006-01-19 Thread alex
has anyone had an issue using php5.0.5 i seem to have a problem when my 
scirpt hits the include() statement it terminates the rest of the script... 
the script im using is a complicated login system...the script works fine 
onlinemy server is using php 4.3.1 (i was too before upgrade) and the 
script runs fine you can view it here http://www.phdev.net the script starts 
working in the ebook center section when registering... my first few lines 
at the start of the page and there after have the include statement... so in 
php 5.0.5 none of the pages appear...does anyone have anyidea i have 
altered this comment to require but still the samethe file tree seems to 
be in order too
regards alex 

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



Re: [PHP] Embedded player

2006-01-19 Thread clive

Hi

Have a look at osplayer. Its a flash player that  plays mp3's(it may do 
wma)Ive seen it used with oscommerce on a site that sells cds. it can 
also load a whole bunch of mp3 that the user can select through the player.


http://www.counteractdesign.com/temp.html

clive

Jedidiah wrote:

Hi.  I have been wanting to do something on my site for some time and was
recently told that it could be accomplished.  

 


I started a daily devotion on our church website a few weeks ago, so I
changed all of my files to .php and began using a MySQL database.  

 


I have a sermons page (www.mzbc.com/sermons.php) with a table with links to
.wma sermons.  When clicked in Firefox, it prompts to download.  What I want
is to be able to embed a player that will stay on that page and play all of
the files in the table.  


I have found a player like this at http://musicplayer.sourceforge.net/.
There is also a Windows Media style player that will do the same thing.  The
problem is I either have to create each individual sermon with an embedded
player in a new page, or create a playlist.  I will eventually have way to
many sermons to use a playlist.  I am sure there must be some way to tell
each file in the table to open in that player, but I am not familiar yet
with programming yet.  I have php for dummies which I started reading, but I
am not sure it will do what I want.  

 


Thanks so much,

 

Jedidiah 





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



[PHP] Re: Performance Comments Question

2006-01-19 Thread Barry

Rodolfo Andrade wrote:

Hi all!

I would like to know if comments in the code affects the performance. I know
that comments are ignored by the interpreter, but it does increase the file
size, so I was thinking about a possible performance hit for highly
commented files.

Can anyone confirm this?
Thanks!

Rodolfo Andrade


Im not quietly sure how the parser works but
i think it stops reading a line for example when the // or # are detected

how its about /* and */ im not quitly sure.
but i think this commenting will affect the parser in some way.

And yes i also think commenting affects the parser.
Not much though but well it does.

Barry

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



Re: [PHP] Embedded player

2006-01-19 Thread Barry

clive wrote:

Hi

Have a look at osplayer. Its a flash player that  plays mp3's(it may do 
wma)Ive seen it used with oscommerce on a site that sells cds. it can 
also load a whole bunch of mp3 that the user can select through the player.


http://www.counteractdesign.com/temp.html



I wouldnt use a flash player because flash isnt installed on firefox as 
standard.

And i dont know how they will react getting a popup with
WEE! NO PLUGIN! *scared*!! INSTALL FLASHPLAYER!!! message ^_^

But thats your choice :)

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



Re: [PHP] Embedded player

2006-01-19 Thread Rodolfo Andrade
Hi,

You can use readdir() function for list the files. Here's a sample code from
PHP Doc www.php.net/docs.

if ($handle = opendir('/path/to/files')) {
echo Handler: $handle\n;
echo Files:\n;
while (false !== ($file = readdir($handle))) {
echo $file\n;
}

I don't know how that music player works, but since it uses XML for
playlists, I think you can use readdir() then pass the results to XML.

- Original Message - 
From: Jedidiah
To: php-general@lists.php.net
Sent: Thursday, January 19, 2006 9:36 AM
Subject: [PHP] Embedded player


Hi.  I have been wanting to do something on my site for some time and was
recently told that it could be accomplished.



I started a daily devotion on our church website a few weeks ago, so I
changed all of my files to .php and began using a MySQL database.



I have a sermons page (www.mzbc.com/sermons.php) with a table with links to
.wma sermons.  When clicked in Firefox, it prompts to download.  What I want
is to be able to embed a player that will stay on that page and play all of
the files in the table.

I have found a player like this at http://musicplayer.sourceforge.net/.
There is also a Windows Media style player that will do the same thing.  The
problem is I either have to create each individual sermon with an embedded
player in a new page, or create a playlist.  I will eventually have way to
many sermons to use a playlist.  I am sure there must be some way to tell
each file in the table to open in that player, but I am not familiar yet
with programming yet.  I have php for dummies which I started reading, but I
am not sure it will do what I want.



Thanks so much,



Jedidiah

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



Re: [PHP] Embedded player

2006-01-19 Thread clive
true, but not everyone uses windows as there operating system, so if 
they don't have windows media player they wont even be able to view the 
files.


clive.

Barry wrote:

clive wrote:

Hi

Have a look at osplayer. Its a flash player that  plays mp3's(it may 
do wma)Ive seen it used with oscommerce on a site that sells cds. it 
can also load a whole bunch of mp3 that the user can select through 
the player.


http://www.counteractdesign.com/temp.html



I wouldnt use a flash player because flash isnt installed on firefox as 
standard.

And i dont know how they will react getting a popup with
WEE! NO PLUGIN! *scared*!! INSTALL FLASHPLAYER!!! message ^_^

But thats your choice :)



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



RE: [PHP] PHP load to high on server

2006-01-19 Thread Albert
Richard Lynch wrote:
 On Tue, January 17, 2006 11:18 pm, Albert wrote:
  The page having the heaviest load uses 5 simultaneous sessions - they
  refresh every 5 seconds. Even with just one connection there are 16
  Apache
  threads running all occupying between 5 and 20% of CPU.

 Are you saying that you have a page that chews up 5 HTTP connections,
 and each uses PHP heavily, and you reload that page every 5 seconds?

I have a page that loads which never refreshes. 

It displays three images generated with PHP. The three images updates at
least once every 5 seconds because the content actually changes. 

It also has an information page displaying information about the three
images which also updates every time the image changes.

 Maybe you shouldn't do that...

 Stretch it out to 10 seconds and see where your load goes.

At 10 seconds all the problems disappear. Unfortunately the customer
requires this to update at least every 5 seconds.

 Find out which of the 5 sessions is most expensive (slowest).  Can you
 cache the results of that one?  How about the second slowest?  Can you
 cache ANYTHING to make the application faster?

I am now busy converting the three images and info page to use a cached copy
if they have not changed.

  Does anyone have an idea of what I can do (short of recoding)?
 #1. Buy more hardware, and build a server farm.
On the lowest end of the spectrum (up to 5 simultaneous users) I have to
make it work on a Celeron 400 with 512MB RAM.

At the highest end (up to 100 simultaneous users) I have a Dual Xeon 3.4GHZ
with 2GB RAM and SCSI drives.

 #2. Buy the Zend Cache
Will probably to that for the top end machines. The Zend Cache costs more
than my lowest end machine after assembly.

 #3. Install some other Cache product (most of which aren't as
 good/fast/solid as Zend Cache, imho)
I tend to trust Zend a bit more than the other developers (maybe because PHP
is based on the Zend engine).

If I didn't have budget constraints then I would have had the Zend Cache on
each and every machine leaving my office.

Albert

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.20/234 - Release Date: 2006/01/18
 

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



Re: [PHP] php5.0.5 include() terminates script BUGBUGBUGBUG

2006-01-19 Thread Jochem Maas

alex wrote:
has anyone had an issue using php5.0.5 i seem to have a problem when my 
scirpt hits the include() statement it terminates the rest of the script... 
the script im using is a complicated login system...the script works fine 
onlinemy server is using php 4.3.1 (i was too before upgrade) and the 
script runs fine you can view it here http://www.phdev.net the script starts 
working in the ebook center section when registering... my first few lines 
at the start of the page and there after have the include statement... so in 
php 5.0.5 none of the pages appear...does anyone have anyidea i have 


what does the error log say?
I have had problems with php5 whereby some complex code (with many includes)
will silently die when a require/require_once (don't know about 'include')
fails - try to determine if the file to be included is readable/exists for php
just prior to the ponit where you do the include. e.g:

var_dump( file_exists($yourInclude) );

also check the file in question is actually valid syntax

oh - and I'd update 5.0.5 to 5.1.1 (regardless of whether you fix the problem)

altered this comment to require but still the samethe file tree seems to 
be in order too
regards alex 



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



Re: [PHP] Embedded player

2006-01-19 Thread Chris
On Thu, 2006-01-19 at 14:44, clive wrote:
 true, but not everyone uses windows as there operating system, so if 
 they don't have windows media player they wont even be able to view the 
 files.

A problem I`ve come across with many sites whilst using my Linux
box..very irritating.

--
Chris Blake 
Cell: 082 775 1492
Work: +27 11 880 2825
Fax : +27 11 782 0841
Mail: [EMAIL PROTECTED]

I realize that today you have a number of top female athletes such as
Martina Navratilova who can run like deer and bench-press Chevrolet
trucks. But to be brutally frank, women as a group have a long way to go
before they reach the level of intensity and dedication to sports that
enables men to be such incredible jerks about it. -- Dave Barry, Sports
is a Drag

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



Re: [PHP] Re: Performance Comments Question

2006-01-19 Thread Jochem Maas

Barry wrote:

Rodolfo Andrade wrote:


Hi all!

I would like to know if comments in the code affects the performance. 
I know
that comments are ignored by the interpreter, but it does increase the 
file

size, so I was thinking about a possible performance hit for highly
commented files.

Can anyone confirm this?
Thanks!

Rodolfo Andrade



Im not quietly sure how the parser works but
i think it stops reading a line for example when the // or # are detected

how its about /* and */ im not quitly sure.
but i think this commenting will affect the parser in some way.


the comments are parsed by the parser and can be extracted/used for doc building
etc - this means there is some overhead for commented files.

if you use an opcode cache then the overhead is only relevant at the time
a source file is compiled into opcodes (I don't know any opcode cache that
doesn't strip out the comment tokens from the compiled code)

in real life you won't notice the overhead at all.
and people will love you if you'r files are 90% comments :-)



And yes i also think commenting affects the parser.
Not much though but well it does.

Barry



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



Re: [PHP] Embedded player

2006-01-19 Thread Rodolfo Andrade
If you are looking for compatibility then I would recommend the flash player
solution. There are a *LOT* of sites that use flash so I don't think that
making it a must will impact your users.

I don't know which type of users will access your church site, but I'm sure
that if they even use Linux, they will install the plugin, if they haven't
done so.

Just my 2¢
Good luck!
Rodolfo Andrade

- Original Message - 
From: Chris
To: clive
Cc: PHP General
Sent: Thursday, January 19, 2006 10:54 AM
Subject: Re: [PHP] Embedded player


On Thu, 2006-01-19 at 14:44, clive wrote:
 true, but not everyone uses windows as there operating system, so if
 they don't have windows media player they wont even be able to view the
 files.

A problem I`ve come across with many sites whilst using my Linux
box..very irritating.

--
Chris Blake
Cell: 082 775 1492
Work: +27 11 880 2825
Fax : +27 11 782 0841
Mail: [EMAIL PROTECTED]

I realize that today you have a number of top female athletes such as
Martina Navratilova who can run like deer and bench-press Chevrolet
trucks. But to be brutally frank, women as a group have a long way to go
before they reach the level of intensity and dedication to sports that
enables men to be such incredible jerks about it. -- Dave Barry, Sports
is a Drag

-- 
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] Performance Comments Question

2006-01-19 Thread Jochem Maas

Rodolfo Andrade wrote:

Hi all!

I would like to know if comments in the code affects the performance. I know
that comments are ignored by the interpreter, but it does increase the file
size, so I was thinking about a possible performance hit for highly
commented files.


given the fact that you are too lazy to start a new thread when asking a
question on this mailing list I have my doubts as to whether any of your files
are tyhat heavily commented that you'd notice any performance hit. ;-)

(for a proper answer to your question see my other reply :-)

rgds,
Jochem

PS - please start a new thread when you post a fresh/new/unrelated question.



Can anyone confirm this?
Thanks!

Rodolfo Andrade



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



Re: [PHP] Embedded player

2006-01-19 Thread Austin Denyer

On Thu, 19 Jan 2006 11:24:44 -0200
Rodolfo Andrade [EMAIL PROTECTED] wrote:

 If you are looking for compatibility then I would recommend the flash
 player solution. There are a *LOT* of sites that use flash so I don't
 think that making it a must will impact your users.
 
 I don't know which type of users will access your church site, but
 I'm sure that if they even use Linux, they will install the plugin,
 if they haven't done so.

Unfortunately the flash plug-in is not available for all Linux
platforms.  I run Linux on AMD64 (my workstation is a dual-Opteron246),
and there are no 64-bit flash plug-ins for Linux.  It is possible if
you un-install the 64-bit Mozilla and install the 32-bit version into a
32-bit chroot environment, but it's not worth the hassle to me.

I avoid flash like the plague.

Regards,
Ozz.


pgp1Brd52DxeW.pgp
Description: PGP signature


Re: [PHP] Re: Performance Comments Question

2006-01-19 Thread Austin Denyer

On Thu, 19 Jan 2006 14:09:00 +0100
Jochem Maas [EMAIL PROTECTED] wrote:
 
 in real life you won't notice the overhead at all.
 and people will love you if you'r files are 90% comments :-)

I've never been quite that liberal with my comments, but I do have a
few files that are 50% comments...

Regards,
Ozz.


pgprVbyZK7agN.pgp
Description: PGP signature


[PHP] Re: Re: Greetings

2006-01-19 Thread tedd

OK, I am on more then 100 Mailinglists (mainly Debian) and my
E-Mail is known to the Internet since more then 6 years...

I like my E-Mail, my old and new customers know it and I will
never change it...
   ...and I prefer excessiv Mail-Filtering!!!

Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant



Same here -- I've had my email address since 1995.

I use spamcop and it works great.

tedd
--

http://sperling.com/

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



Re: [PHP] Re: Performance Comments Question

2006-01-19 Thread Jochem Maas

Austin Denyer wrote:

On Thu, 19 Jan 2006 14:09:00 +0100
Jochem Maas [EMAIL PROTECTED] wrote:


in real life you won't notice the overhead at all.
and people will love you if you'r files are 90% comments :-)



I've never been quite that liberal with my comments, but I do have a
few files that are 50% comments...


you should be getting a warm and fuzzy feeling right about now :-)
it's not love at first sight but we can work with it ;-)



Regards,
Ozz.


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



Re: [PHP] Drop down directory structure list box

2006-01-19 Thread Jochem Maas

are you sure it was not internet explorer just showing you the last
directory you had opened with a 'browse...' button with in that browsing
session?

Jay Blanchard wrote:

[snip]


Along these same lines, does anyone know how to make the file dialog
start
in a specific directory? I saw this the other day but forgot where. I
clicked browse and the dialog popped up pointed to My Pictures (which
at
least works for most Windblows users). I meant to look at the code,
but
didn't



Yikes!

If it *DOES* work, you've probably got yet another security problem in
Windows.

Suppose, for example, that I do something like this:

form action=http://example.com/; method=post
enctype=multipart/form-data
input style=visibility: hidden name=steal
value=C:\path\to\commonly\used\secret\file\I\should\not\get.secret
What's your name? input name=namebr /
Who's your daddy? input name=daddybr /
input type=submit
/form

Now, the unsuspecting user will be HANDING me the file I shouldn't
have without ever seeing anything about it.

Even if it only lets you pick the directory, but not the file, it
probably exposes too much information about my desktop for my tastes.
[/snip]

Now I need to go back and find it. It was a site having to do with photos,
but I was doing research and visited a lot of them. Since the upload dialog
was looking for photos you can see where the apparent convenience could come
in. But you're rightas a security hole it is big enough for aircrafy
carrier usage.



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



RE: [PHP] Drop down directory structure list box

2006-01-19 Thread Jay Blanchard
[snip]
are you sure it was not internet explorer just showing you the last
directory you had opened with a 'browse...' button with in that browsing
session?
[/snip]

I am familiar with this behavior, and I am pretty sure that it wasn't this,
because it stood out somehow.

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



Re: [PHP] Drop down directory structure list box

2006-01-19 Thread Jochem Maas

Jay Blanchard wrote:

[snip]
are you sure it was not internet explorer just showing you the last
directory you had opened with a 'browse...' button with in that browsing
session?
[/snip]

I am familiar with this behavior, and I am pretty sure that it wasn't this,
because it stood out somehow.


ack. just checking - hope you find the site, I'm quite interested in 
what/how/etc.
(searching for the issue/problem/bug/thing doesn't seem to return anything 
relevant)





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



RE: [PHP] Drop down directory structure list box

2006-01-19 Thread Jay Blanchard
[snip]
 Along these same lines, does anyone know how to make the file dialog
 start
 in a specific directory? I saw this the other day but forgot where. I
 clicked browse and the dialog popped up pointed to My Pictures (which
 at
 least works for most Windblows users). I meant to look at the code,
 but
 didn't

Yikes!

If it *DOES* work, you've probably got yet another security problem in
Windows.

Suppose, for example, that I do something like this:

form action=http://example.com/; method=post
enctype=multipart/form-data
input style=visibility: hidden name=steal
value=C:\path\to\commonly\used\secret\file\I\should\not\get.secret
What's your name? input name=namebr /
Who's your daddy? input name=daddybr /
input type=submit
/form

Now, the unsuspecting user will be HANDING me the file I shouldn't
have without ever seeing anything about it.

Even if it only lets you pick the directory, but not the file, it
probably exposes too much information about my desktop for my tastes.
[/snip]

Now I need to go back and find it. It was a site having to do with photos,
but I was doing research and visited a lot of them. Since the upload dialog
was looking for photos you can see where the apparent convenience could come
in. But you're rightas a security hole it is big enough for aircrafy
carrier usage.

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



Re: [PHP] Image handling advice needed

2006-01-19 Thread tedd

Hello,

I need to build an image 'library'. The library will consist mostly of
images taken with digital cameras. Since unedited digicam pics will most
likely be too big for web usage they need to be edited automatically so that
they can be put to a web page.

I'am trying to deside between two options. To resize (=scale down) the
images once they are uploaded to server and store the smaller file or upload
and store the original BIG file and scale it to thumbnail once it's viewed.
Any opinnions about this.

I think that if the disk space is not an issue I could upload the original
file. But are there performance issues if the thumbnails are created on the
fly if there are hundreds of pics?

Thanks for your advice
-Will


Will:

I don't want to start any my machine will beat-up your machine 
wars, but if I was confronted with the problem (using a Mac), it 
would be a somewhat simple process to automate resizing a bunch of 
pictures using Photoshop and Automator and then make them to the 
size/type I want before uploading.


Barring that, you could use a thumbnail script to cycle through a 
directory and resample pictures to a specific size. But after that, I 
would delete the originals online -- no need to keep them UNLESS you 
are going to use them in some fashion.


As to where to put them, there are two schools of thought: 1) store 
them in folders and put their url's in the dB; 2) or store them 
directly in the dB. I've heard good/bad points about each side and to 
me it boils down to which method are you most comfortable.


As far as performance issues creating thumbnails on the fly, just 
reduce them to a number that the user can comfortably view at one and 
then show them as the user wants. I would guess that no one wants to 
see hundreds of picts at one time.


Please review --

http://xn--ovg.com/mysql

-- to see an example of what I mean. There you can generate up-to 
1000 records but see them a few (5) at a time.


tedd

--

http://sperling.com/

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



Re: [PHP] Drop down directory structure list box

2006-01-19 Thread Rodolfo Andrade
This depends on User-Agent. Internet Explorer queries the registry (MRU
values) looking for the last open directory.

There's no way to do this in PHP or plain HTML (w3 compilant) and probably
you will need to write an ActiveX plugin (which will sucks if you have a
Linux or Firefox user);

This because you can't query the registry
key(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Us
er Shell Folders) and store the paths.

Hope this is useful.
Best Regards
Rodolfo Andrade
- Original Message - 
From: Jochem Maas
To: Jay Blanchard
Cc: '[EMAIL PROTECTED]' ; 'Sumeet' ; PHP-General
Sent: Thursday, January 19, 2006 12:08 PM
Subject: Re: [PHP] Drop down directory structure list box


Jay Blanchard wrote:
 [snip]
 are you sure it was not internet explorer just showing you the last
 directory you had opened with a 'browse...' button with in that browsing
 session?
 [/snip]

 I am familiar with this behavior, and I am pretty sure that it wasn't
this,
 because it stood out somehow.

ack. just checking - hope you find the site, I'm quite interested in
what/how/etc.
(searching for the issue/problem/bug/thing doesn't seem to return anything
relevant)



-- 
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



[PHP] Regular Expression help

2006-01-19 Thread Chris Boget
I've been beating my head against the wall for a while trying to come up
with the RE I need to use.  I have a camel case word - let's use
JimJoeBobBriggs.  I need to come up with a RE that will fine all the
upper case characters and insert an underscore prior to those characters
with the exception of a possible first character.  So using the
aforementioned word, the RE would change it to Jim_Joe_Bob_Briggs.

 

Any help would be greatly appreciated!

 

thnx,
Chris



Re: [PHP] Regular Expression help

2006-01-19 Thread Richard Heyes

Chris Boget wrote:

I've been beating my head against the wall for a while trying to come up
with the RE I need to use.  I have a camel case word - let's use
JimJoeBobBriggs.  I need to come up with a RE that will fine all the
upper case characters and insert an underscore prior to those characters
with the exception of a possible first character.  So using the
aforementioned word, the RE would change it to Jim_Joe_Bob_Briggs.


$result = preg_replace('#(.)([A-Z])#', '\1_\2', 'JimJoeBobBriggs');

--
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] Regular Expression help

2006-01-19 Thread Robin Vickery
On 1/19/06, Chris Boget [EMAIL PROTECTED] wrote:
 I've been beating my head against the wall for a while trying to come up
 with the RE I need to use.  I have a camel case word - let's use
 JimJoeBobBriggs.  I need to come up with a RE that will fine all the
 upper case characters and insert an underscore prior to those characters
 with the exception of a possible first character.  So using the
 aforementioned word, the RE would change it to Jim_Joe_Bob_Briggs.


?php
$string = 'JimJoeBobBriggs'';
print preg_replace('/([[:alnum:]])([[:upper:]])/', '\1_\2', $string);
?


Re: [PHP] Regular Expression help

2006-01-19 Thread Chris

Chris Boget wrote:


I've been beating my head against the wall for a while trying to come up
with the RE I need to use.  I have a camel case word - let's use
JimJoeBobBriggs.  I need to come up with a RE that will fine all the
upper case characters and insert an underscore prior to those characters
with the exception of a possible first character.  So using the
aforementioned word, the RE would change it to Jim_Joe_Bob_Briggs.



Any help would be greatly appreciated!



thnx,
Chris


 

Those two had valid ones as well, but I like the negative look-behind 
assertion:


preg_replace('/(?!^)([A-Z])/','_$1','JimJoeBobBriggs');

Chris

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



Re: [PHP] Regular Expression help

2006-01-19 Thread John Nichel

Chris Boget wrote:

I've been beating my head against the wall for a while trying to come up
with the RE I need to use.  I have a camel case word - let's use
JimJoeBobBriggs.  I need to come up with a RE that will fine all the
upper case characters and insert an underscore prior to those characters
with the exception of a possible first character.  So using the
aforementioned word, the RE would change it to Jim_Joe_Bob_Briggs.

 


Any help would be greatly appreciated!


preg_replace ( /(.)([A-Z])/, \1_\2, $string );

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Regular Expression help

2006-01-19 Thread John Nichel

Chris wrote:
snip

preg_replace('/(?!^)([A-Z])/','_$1','JimJoeBobBriggs');


Ohhhregex-fu black belt.  ;)

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



[PHP] odd behavior

2006-01-19 Thread Jay Blanchard
When I expire you will find my hands wrapped tightly around the throat of a
Windows network administrator.

I had PHP installed on a web server, and all was working OK, save for one
small thing. phpinfo() indicated that the path to the php.ini was c:\WINNT,
which it was not. So I copy the file from the c:\php directory to the
c:\winnt directory and restart IIS. Now, when I click a link to take me to a
directory with an index.php I get a 404, not found error. If I refresh the
page shows up just fine. So I remove the ini page, start and stop the IIS
server, click the link, and no problem...the page is delivered just fine.

Has anyone experienced this behavior before, and how do I fix that damned
path to the ini? TIA!

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



Re: [PHP] odd behavior

2006-01-19 Thread Austin Denyer

On Thu, 19 Jan 2006 11:53:04 -0600
Jay Blanchard [EMAIL PROTECTED] wrote:

 Has anyone experienced this behavior before, and how do I fix that
 damned path to the ini? TIA!

Personally, I'd fix it with a Debian install CD, but that's just me.

#;-D

Can't help with the Windoze issue - I don't do Windoze.  Tried it,
didn't like it.

Regards,
Ozz.


pgpUUSTfMwtPU.pgp
Description: PGP signature


Re: [PHP] odd behavior

2006-01-19 Thread John Nichel

Jay Blanchard wrote:
snip

and how do I fix


http://distrowatch.com/

serious mode
I have no idea, I don't do Windows.
/serious mode

Sucks to be you.  ;)

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] parse string

2006-01-19 Thread Ron Eggler (Paykiosks)
yup, I finally got it parsed by simple XML, thank you!

but I got a problem, my xml-string returns many parts like this one:
[xml]
cardSKU category=Local Dial Tone/Telephone Service distributor=EWI
discontinued=false cardtype=PIN transactionType=PURC
  card cardID=180 carrier=Reconex (test) partNumber=PN-180 
region=Optional Services (test) amount=5 wholesalePrice=4.5 
icon=https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif; 
upc=870368000420
cinfo costPerMinute= lifetime=0 longDistRate= roamingRate= 
numberOfMin=/
  /card
  terms
Refer to the Reconex brochure for complete terms and conditions.
  /terms
  pinfo type=Optional Services value=Call Forwarding, Call Waiting, Caller 
ID, Three Way Calling, Speed Dialing amp; Non-Published Number/
/cardSKU
[/xml]

and I wanna read information out of it by:
[php]
$xml = simplexml_load_string($data);
/* a few other things like parsing xml that works fine */
foreach ($xml-cardSKU as $cardSKU)
  {
  array_push($category,(string)$cardSKU['category']);
  }
[/php]
but it seems not to work, the array $category stays empty, why that?
Thank you!

-- 
chEErs roN


Am Mittwoch, den 18.01.2006, 16:40 -0600 schrieb Richard Lynch:
 Simple XML *should* give you all the info somewhere in its data
 structures.
 
 If not, there are at least 2 or 3 other XML parsers that have been
 built s extensions to PHP over the years.
 
 Plus there is at least one XML parser in PEAR, and probably one or
 more in PECL.
 
 A quick search on http://php.net will find them.
 
 If all else fails, and you're really really stuck with no XML parsers
 due to brain-dead web-hosting, it should take you about an hour to
 hack a script to use http://php.net/explode and/or
 http://php.net/preg_match_all to get the info you want, *IF* the XML
 is predictable.
 
 It is NOT recommended that you do this, but here is a start if you
 really have no way to get a real XML parser on-board:
 
 $string = '[insert your XML here]';
 preg_match_all('/(a-z)+\\s*(([a-z]+)=([^]*)\\s*)*\\s*\\//isU',
 $string, $matches);
 var_dump($matches);
 
 You may want to find and download The Regex Coach program to help
 you learn/understand Regular Expressions.
 
 On Wed, January 18, 2006 12:12 pm, Ron Eggler (Paykiosks) wrote:
  Hi,
 
  I need to parse a String like pasted below for all information
  (values)
  those are included like 'var=value'. How can I do that? Are there any
  XML-parsing functions available those'd fit for that job? I've ust
  found
  that one (http://ca.php.net/simplexml) but it seems like i could use
  it
  only for exctracting the 'terms' cause they're in the format that
  simplexml
  expects.
  Thank you for every help!
 
  [String]
  xs:response xmlns:xs=urn:pinXpressSchema
  SKUlisting
  globalInfo slogan=Welcome to PayGo! supportPhone=1-866-339-3299/
  carrierInfo carrier=Reconex (test)
  icon=https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif;
  /
  carrierInfo carrier=IDT POSA
  icon=https://www.pinsprepaid.com/image.aspx?name=; /
  carrierInfo carrier=IDT MasterCard
  icon=https://www.pinsprepaid.com/image.aspx?name=; /
  carrierInfo carrier=PLAYPHONE (Test)
  icon=https://www.pinsprepaid.com/image.aspx?name=PlayPhone-200x100.gif;
  /
  carrierInfo carrier=EWI POSA TEST
  icon=https://www.pinsprepaid.com/image.aspx?name=PayGo_200_100.gif;
  /
  carrierInfo carrier=IDT POSA
  icon=https://www.pinsprepaid.com/image.aspx?name=; /
  carrierInfo carrier=IDT Visa
  icon=https://www.pinsprepaid.com/image.aspx?name=; /
  carrierInfo carrier=Bell Mobility (TEST)
  icon=https://www.pinsprepaid.com/image.aspx?name=; /
  carrierInfo carrier=Boost Mobile (Test)
  icon=https://www.pinsprepaid.com/image.aspx?name=c59-BoostMobile.gif;
  /
  carrierInfo carrier=Cingular (test)
  icon=https://www.pinsprepaid.com/image.aspx?name=cing-blue.gif; /
  carrierInfo carrier=Page Plus (Test)
  icon=https://www.pinsprepaid.com/image.aspx?name=pageplus.gif; /
  carrierInfo carrier=T-Mobile (test)
  icon=https://www.pinsprepaid.com/image.aspx?name=c29-t-mobile_ticketlogo.gif;
  /
  carrierInfo carrier=Unefon
  icon=https://www.pinsprepaid.com/image.aspx?name=unefon_logo.gif; /
  carrierInfo carrier=Verizon (test)
  icon=https://www.pinsprepaid.com/image.aspx?name=verizon.gif; /
  carrierInfo carrier=Virgin Mobile (test)
  icon=https://www.pinsprepaid.com/image.aspx?name=Virgin+Mobile
  +200x100.gif /
  cardSKU category=Local Dial Tone/Telephone Service
  distributor=EWI
  discontinued=false cardtype=PIN transactionType=PURC
card cardID=180 carrier=Reconex (test) partNumber=PN-180
  region=Optional Services (test) amount=5 wholesalePrice=4.5
  icon=https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif;
  upc=870368000420
  cinfo costPerMinute= lifetime=0 longDistRate=
  roamingRate=
  numberOfMin=/
/card
terms
  Refer to the Reconex brochure for complete terms and conditions.
/terms
pinfo type=Optional Services value=Call Forwarding, Call
  Waiting,
  Caller 

[PHP] Re: creating new class from wrapper class (OOP question)

2006-01-19 Thread David Hall

Henrik Gemal wrote:

In a image gallery I have to class'es:

class GPicFilePicture extends GPicFileType
class GPicFileMovie extends GPicFileType

both of them are based on:

abstract class GPicFileType

In my code I need to create a new GPicFilePicture. To avoid duplicated
code I've create a wrapper class:

class GPicFile

that does something like this:

if (fileextension == jpg)
  return new GPicFilePicture();
else
  return new GPicFileMovie();

so my PHP code looks like:
$file = new GPicFile($filename);

getFileDate() is implemented in both GPicFilePicture and GPicFileMovie.

Now I try to do:
$file-getFileDate();

I get an error saying:
Call to undefined method GPicFile::getFileDate()

Where am I going wrong?


My way for doing this summed up by the Factory Pattern described on this 
page: http://www.phptr.com/articles/article.asp?p=346958seqNum=4


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



Re: [PHP] odd behavior

2006-01-19 Thread tg-php
Ok.. now maybe a constructive answer :)

If I recall, PHP on Windows will look for PHP.INI in your Windows system folder 
(in this case C:\WINNT) first, then in the folder where PHP is installed.  
Deleting the PHP.INI under WINNT should be fine (sounds like removing that 
makes things work ok for you).  I'd think phpinfo() would show that it's in 
C:\PHP (or whereever) in that case.

If for some reason you need to use PHP.INI in C:\WINNT then let me ask...  if 
you go to http://www.site.com/ (no index.php) on it, is that when you get the 
404?  Then you say you refresh and it works fine? (does it still read 
http://www.site.com/ or does it read http://www.site.com/index.php before you 
hit refresh?)

If you get 404, it's the web server telling the browser it can't find the page. 
 So it shouldn't be a permissions issue or anything with PHP.INI (although I'd 
check to make sure...  IIS may not have permissions to read things from 
C:\WINNT for security reasons... by default at least... or could be that 
owner/group is now jay or users instead of system or whatever it needs to 
be for IIS to have access to the PHP.INI file.. I forget the exact permissions).

If removing C:\WINNT\PHP.INI doesn't work.. or isn't an option... and 
permissions look ok...  then I'm not sure.  But drop a line back when you've 
messed around with it some more and maybe we can figure it out.

-TG

= = = Original message = = =

When I expire you will find my hands wrapped tightly around the throat of a
Windows network administrator.

I had PHP installed on a web server, and all was working OK, save for one
small thing. phpinfo() indicated that the path to the php.ini was c:\WINNT,
which it was not. So I copy the file from the c:\php directory to the
c:\winnt directory and restart IIS. Now, when I click a link to take me to a
directory with an index.php I get a 404, not found error. If I refresh the
page shows up just fine. So I remove the ini page, start and stop the IIS
server, click the link, and no problem...the page is delivered just fine.

Has anyone experienced this behavior before, and how do I fix that damned
path to the ini? TIA!


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP] Grouping

2006-01-19 Thread Jeffrey Pearson
OK. I know I did this a LONG time ago but I don't remember how I did  
it. Thus, my post.


I have a list of last names from a MySQL database. I need to display  
them grouped by the first letter of their last names and insert a  
separator on display. Similar to a phone book. So it looks like;



A
___
Adams
Apple
Army

B
__
Banjo
Bank
Bark

C
__
Captain
Car



Is there a way without jumping through too many hoops?

Thanks for any input you can give.

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



Re: [PHP] odd behavior

2006-01-19 Thread Rodolfo Andrade
I use PWS with Windows 98 for learning purposes.

I just cut PHP.ini from C:\PHP and paste in %windir% then restart the
server. Works fine for me and I can run ASP and PHP for learning. ^^

Regards, Rodolfo Andrade

- Original Message - 
From: Jay Blanchard
To: PHP General (E-mail)
Sent: Thursday, January 19, 2006 3:53 PM
Subject: [PHP] odd behavior


When I expire you will find my hands wrapped tightly around the throat of a
Windows network administrator.

I had PHP installed on a web server, and all was working OK, save for one
small thing. phpinfo() indicated that the path to the php.ini was c:\WINNT,
which it was not. So I copy the file from the c:\php directory to the
c:\winnt directory and restart IIS. Now, when I click a link to take me to a
directory with an index.php I get a 404, not found error. If I refresh the
page shows up just fine. So I remove the ini page, start and stop the IIS
server, click the link, and no problem...the page is delivered just fine.

Has anyone experienced this behavior before, and how do I fix that damned
path to the ini? TIA!

-- 
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] Grouping

2006-01-19 Thread John Nichel

Jeffrey Pearson wrote:
OK. I know I did this a LONG time ago but I don't remember how I did  
it. Thus, my post.


I have a list of last names from a MySQL database. I need to display  
them grouped by the first letter of their last names and insert a  
separator on display. Similar to a phone book. So it looks like;



A
___
Adams
Apple
Army

B
__
Banjo
Bank
Bark

C
__
Captain
Car



Is there a way without jumping through too many hoops?

Thanks for any input you can give.



Order them with your query

select * from db.table order by table.lastname ASC

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



RE: [PHP] odd behavior

2006-01-19 Thread Jay Blanchard
[snip]
If I recall, PHP on Windows will look for PHP.INI in your Windows system
folder (in this case C:\WINNT) first, then in the folder where PHP is
installed.  Deleting the PHP.INI under WINNT should be fine (sounds like
removing that makes things work ok for you).  I'd think phpinfo() would show
that it's in C:\PHP (or whereever) in that case.
[/snip]

c:\php is in the path statement, but it does not show it as being there when
I remove it from c:\winnt

[snip]
If for some reason you need to use PHP.INI in C:\WINNT then let me ask...  
[/snip]

Changes in php.ini are not reflected in phpinfo() after an IIS restart
(cache cleared). For instance, the extensions folder is c:\php\extensions,
the ini reports c:\php4

[snip]
if you go to http://www.site.com/ (no index.php) on it, is that when you get
the 404?  Then you say you refresh and it works fine? (does it still read
http://www.site.com/ or does it read http://www.site.com/index.php before
you hit refresh?)
[/snip]

Yes.It still reads http://www.site.com before and after refresh.

[snip]
If you get 404, it's the web server telling the browser it can't find the
page.  So it shouldn't be a permissions issue or anything with PHP.INI
(although I'd check to make sure...  IIS may not have permissions to read
things from C:\WINNT for security reasons... by default at least... or could
be that owner/group is now jay or users instead of system or whatever
it needs to be for IIS to have access to the PHP.INI file.. I forget the
exact permissions).
[/snip]

I'll check it.

[snip]
If removing C:\WINNT\PHP.INI doesn't work.. or isn't an option... and
permissions look ok...  then I'm not sure.  But drop a line back when you've
messed around with it some more and maybe we can figure it out.
[/snip]

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



Re: [PHP] Grouping

2006-01-19 Thread Geoff
Sound like a straightforward control-break (at least, that's what 
they used to call it in the COBOL days :-)  

assuming you're getting data into an assoc array called $records, 
you could stick this into your loop:  

{
$letter = $records['LastName']{0};
if ($prev != $letter) {
print(br$letter$sep);
$prev = $letter;
}
print($records['LastName'] . br);
}

If you want to keep it neat, you can put it in a function, using a 
static var to keep hold of $prev. It can return an empty string when 
there is no change, or the delimiter if the letter has changed.  

Geoff.


On 19 Jan 2006 at 10:19, Jeffrey Pearson wrote:

 OK. I know I did this a LONG time ago but I don't remember how I did  
 it. Thus, my post.
 
 I have a list of last names from a MySQL database. I need to display  
 them grouped by the first letter of their last names and insert a  
 separator on display. Similar to a phone book. So it looks like;
 
 
 A
 ___
 Adams
 Apple
 Army
 
 B
 __
 Banjo
 Bank
 Bark
 
 C
 __
 Captain
 Car
 
 
 
 Is there a way without jumping through too many hoops?
 
 Thanks for any input you can give.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 !DSPAM:43cfe677219529533614314!
 

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



[PHP] Re: odd behavior

2006-01-19 Thread James Benson

Could these help?


http://www.php.net/manual/en/faq.installation.php#faq.installation.phprc
http://php.net/configuration



James



Jay Blanchard wrote:

When I expire you will find my hands wrapped tightly around the throat of a
Windows network administrator.

I had PHP installed on a web server, and all was working OK, save for one
small thing. phpinfo() indicated that the path to the php.ini was c:\WINNT,
which it was not. So I copy the file from the c:\php directory to the
c:\winnt directory and restart IIS. Now, when I click a link to take me to a
directory with an index.php I get a 404, not found error. If I refresh the
page shows up just fine. So I remove the ini page, start and stop the IIS
server, click the link, and no problem...the page is delivered just fine.

Has anyone experienced this behavior before, and how do I fix that damned
path to the ini? TIA!


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



Re: [PHP] parse string

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 12:08 pm, Ron Eggler (Paykiosks) wrote:
 cardSKU category=Local Dial Tone/Telephone Service
 distributor=EWI
 discontinued=false cardtype=PIN transactionType=PURC
.
.
.
 /cardSKU
 [/xml]

 and I wanna read information out of it by:
 [php]
 $xml = simplexml_load_string($data);
 /* a few other things like parsing xml that works fine */
 foreach ($xml-cardSKU as $cardSKU)
   {
   array_push($category,(string)$cardSKU['category']);
   }
 [/php]
 but it seems not to work, the array $category stays empty, why that?

It's pretty much the same problem you posted yesterday...

category is going to be the $key of the array, not the value.

echo prexml-cardSKU:br /\n;
var_dump($xml-cardSKU);
echo hr /\n;
foreach($xml-cardSKU as $key = $cardSKU){
  echo key: $keybr /\n
  var_dump($cardSKU);
  echo hr /\n;
}

When you don't get the data you expect, use var_dump() on the data
BEFORE that to see where the bits you want exist -- You'll usually
find that they array/key/value/object structure has what you want,
just in different places than you were looking.

-- 
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: odd behavior

2006-01-19 Thread Jay Blanchard
[snip]
Could these help?
http://www.php.net/manual/en/faq.installation.php#faq.installation.phprc
http://php.net/configuration
[/snip]

I'll give those a try as I did do the manual installationwhich does not
refer to this as far as I can tell.

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



Re: [PHP] Grouping

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 12:19 pm, Jeffrey Pearson wrote:
 OK. I know I did this a LONG time ago but I don't remember how I did
 it. Thus, my post.

 I have a list of last names from a MySQL database. I need to display
 them grouped by the first letter of their last names and insert a
 separator on display. Similar to a phone book. So it looks like;

It might be slightly more clear to have MySQL get the initial letter,
rather than PHP...

//Also note use of 'upper' in case you have mixed case names.
// You presumably want all caps for alpha section names
$query = select upper(substring(name, 0, 1)), name from names order
by name;
//next line is bad code, for simplicity of example:
$names = mysql_query($query) or die(mysql_error());
$last_letter = 'an extremely unlikely single character';
while (list($letter, $name) = mysql_fetch_row($names)){
  if ($letter != $last_letter) echo $letter, hr /\n;
  echo $name, br /\n;
}

As an exercise for the reader, you should consider lumping all non A-Z
characters together, rather than individually.

-- 
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] odd behavior

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 11:53 am, Jay Blanchard wrote:
 I had PHP installed on a web server, and all was working OK, save for
 one
 small thing. phpinfo() indicated that the path to the php.ini was
 c:\WINNT,
 which it was not. So I copy the file from the c:\php directory to the
 c:\winnt directory and restart IIS. Now, when I click a link to take
 me to a
 directory with an index.php I get a 404, not found error. If I refresh
 the
 page shows up just fine. So I remove the ini page, start and stop the
 IIS
 server, click the link, and no problem...the page is delivered just
 fine.

 Has anyone experienced this behavior before, and how do I fix that
 damned
 path to the ini? TIA!

How you fix the path to php.ini is what you did in the first place,
except you shouldn't leave behind the c:\php\php.ini to confuse
yourself some other day.

MOVE the file to c:\winnt where PHP thinks it must be.

Other Options:
Re-compile PHP from scratch to choose a different path for php.ini

Use that new-fangled Apache directive to tell Apache where to find
php.ini -- This implies dumping IIS and using Apache, which you should
do anyway :-)

Meanwhile, back at the ranch, your question SHOULD be:

How do I get IIS to not return 404 for the first hit on a URL, then
the correct content on subsequent hits?

Standard Windows Debugging 101:

#1
Re-boot the whole machine and pray.

#2
Re-install the entire OS and all software.

#3
Switch to Linux.

The first two steps are what Microsoft always tells me to do. :-)

Sorry.  Best I can do for you...

PS
I suspect that in this case, some sort of brain-dead IIS/DNS/MS-OS
cache is screwing you up and a re-boot (#1) actually WILL solve the
problem.  This is, however, only a guess.

-- 
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] odd behavior

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 12:31 pm, Jay Blanchard wrote:
 [snip]
 If I recall, PHP on Windows will look for PHP.INI in your Windows
 system
 folder (in this case C:\WINNT) first, then in the folder where PHP is
 installed.  Deleting the PHP.INI under WINNT should be fine (sounds
 like
 removing that makes things work ok for you).  I'd think phpinfo()
 would show
 that it's in C:\PHP (or whereever) in that case.
 [/snip]

Almost for sure, this is just plain wrong.

It is maybe correct for DLLs, with the caveat that PHP will also look
in the extensions directory in php.ini, assuming you get php.ini
loaded in the first place.

 c:\php is in the path statement, but it does not show it as being
 there when
 I remove it from c:\winnt

 [snip]

PHP doesn't consider 'path' at all when looking for php.ini, almost
for sure.  It's a constant compiled into the software, essentially,
except for the new-fangled Apache directive to change it.

 If for some reason you need to use PHP.INI in C:\WINNT then let me
 ask...
 [/snip]

 Changes in php.ini are not reflected in phpinfo() after an IIS restart
 (cache cleared). For instance, the extensions folder is
 c:\php\extensions,
 the ini reports c:\php4

Changes in php.ini are irrelevant until you get php.ini loaded by
putting it into c:\winnt where PHP is looking.

Your 404 problem is entirely separate and distinct from this issue.

Solve them separately.

php.ini problem is easily solved.

404, you're on your own.

 [snip]
 if you go to http://www.site.com/ (no index.php) on it, is that when
 you get
 the 404?  Then you say you refresh and it works fine? (does it still
 read
 http://www.site.com/ or does it read http://www.site.com/index.php
 before
 you hit refresh?)
 [/snip]

This is probably dependent on web-server configuration.  Or, at least,
it is possible to configure Apache in such a way that it will actually
force the user to be re-directed to the DocumentIndex, I think.

Or perhaps naive inexperienced Apache users do this as a work-around
since they don't understand DocumentIndex.

I got no idea how IIS handles any of the DocumentIndex-like stuff.

 Yes.It still reads http://www.site.com before and after refresh.

 [snip]
 If you get 404, it's the web server telling the browser it can't find
 the
 page.  So it shouldn't be a permissions issue or anything with PHP.INI
 (although I'd check to make sure...  IIS may not have permissions to
 read
 things from C:\WINNT for security reasons... by default at least... or
 could
 be that owner/group is now jay or users instead of system or
 whatever
 it needs to be for IIS to have access to the PHP.INI file.. I forget
 the
 exact permissions).
 [/snip]

If it doesn't have permissions the first page hit, it won't have
permissions the second time.

Seems unlikely to be the source of the problem...

-- 
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] Email Form

2006-01-19 Thread Thomas Bonham

Hello All,

I don't remember how to do email with php. I have all of it done, except 
for I can't get it to show the senders email address. All I get it from 
[EMAIL PROTECTED]


If some one has a example that they can post that would be great.

Thank You

Thomas

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



[PHP] Re: Email Form

2006-01-19 Thread David Dorward
Thomas Bonham wrote:

 I don't remember how to do email with php. I have all of it done, except
 for I can't get it to show the senders email address. All I get it from
 [EMAIL PROTECTED]
 
 If some one has a example that they can post that would be great.

http://uk.php.net/manual/en/function.mail.php

Note additional_headers in the Parameters section.

-- 
David Dorward   http://blog.dorward.me.uk/   http://dorward.me.uk/
 Home is where the ~/.bashrc is

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



Re: [PHP] URL - stream context

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 5:17 am, Jochem Maas wrote:
 Richard Lynch wrote:
 So I've been poring over the docs for the new stream stuff, and it
 looks pretty nifty, except...

 I'd really like to be able to just hand a URL to PHP like:
 http://php.net/manual/en/ref.stream.php

 er you can if allow_url_fopen ini setting is set to 1  (can't you?)

 $fh = fopen('http://php.net/');

The crucial point buried too far into my initial post (sorry):

I NEED to specify a timeout for the initial CONNECTION to acquire the
data.

fopen does not allow this.

fsockopen does, but then I'm stuck with re-inventing the wheel on
handling dozens of different protocols to initiate the process to get
the data rolling.

For HTTP, you have to send GET $path HTTP/1.0\n
For FTP, you have to send GET $path\n
For a file, you don't send anything
.
.
.

So to get all the functionality of fopen() I'd need a monster long
switch statement with a bunch of protocols about which I know almost
nothing, including some rather complex stuff I can guarantee is over
my head for ssl:// https:// ftps:// and friends.

I really do not want to re-code all that, when I know it's down in the
guts of 'fopen'

In other words, I need an additional 'timeout' argument to fopen()
that works when url_wrappers is on, or a function to set the default
timeout for fopen() to wait.

PLEASE don't refer me to stream_set_timeout.  THAT only applies to how
long to wait for data AFTER the stream is open and you are reading
data.

I'm asking for:

The convenience of fopen() that knows about dozens of protocols and
takes care of the grotty details so I can just start reading data.

The power of fsockopen() that allows one to specify how long to wait
for a slow source feed.

What I was hoping for, then, was that I could call this mythical
function url2context() that would convert *any* URL into an
appropriate stream context.

Then I thought I would be able to use that contact for fsockopen()
with a timeout for connection.

I now see that fsockopen() does not even take a stream_context, but
that fopen() now does, and none of this would do me any good at all...

I guess I was thinking that the magic of fopen() being able to handle
all those protocols had been bundled into the streams code, and that I
ought to be able to utilize that somehow WITH a timeout on the
connection.

I guess I'm stuck with re-coding all the stuff from fopen() in a giant
PHP switch and using my old-school fsockopen, just so I can have
control over connection timeout.  :-(

And it looks like all the new streams stuff is very nifty for some
things, but rather useless for the feature that I believe quite a few
users have been asking for:

Gimme fopen() with control over timeout, so I can ignore all the
minutia of what kind of file/stream/URL/whatever I'm reading, but not
have my application waiting for 2 minutes when somebody else's server
goes down.

I tried to open a Feature Request to this, but it's already been
closed as Bogus wherein I was told to rtfm.

I've re-opened it, but based on my past mixed experience with the
people behind bugs.php.net, I figure I've only got a 50/50 chance of
somebody who actually reads and comprehends what I typed seeing it
before it gets closed again and ignored. :-(

Don't get me wrong -- I know what a monumental task they face, and am
aware that there are certain Pavlovian automatic reactions, and that's
how it is when they see the keywords embedded in my Change Request, so
I'm not dis-ing them... It's just Reality that a worthy feature worth
considering is probably going to get buried in the Bogus pile. [shrug]

If anybody reading this actually agrees with me, feel free to vote here:
http://bugs.php.net/bug.php?id=36072

If you think I'm an idiot, by all means vote against the feature request.

-- 
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] parse string

2006-01-19 Thread Ron Eggler (Paykiosks)
Am Donnerstag, den 19.01.2006, 13:51 -0600 schrieb Richard Lynch:
 On Thu, January 19, 2006 12:08 pm, Ron Eggler (Paykiosks) wrote:
  cardSKU category=Local Dial Tone/Telephone Service
  distributor=EWI
  discontinued=false cardtype=PIN transactionType=PURC
 .
 .
 .
  /cardSKU
  [/xml]
 
  and I wanna read information out of it by:
  [php]
  $xml = simplexml_load_string($data);
  /* a few other things like parsing xml that works fine */
  foreach ($xml-cardSKU as $cardSKU)
{
array_push($category,(string)$cardSKU['category']);
}
  [/php]
  but it seems not to work, the array $category stays empty, why that?
 
 It's pretty much the same problem you posted yesterday...
 
 category is going to be the $key of the array, not the value.
 
 echo prexml-cardSKU:br /\n;
 var_dump($xml-cardSKU);
 echo hr /\n;
 foreach($xml-cardSKU as $key = $cardSKU){
   echo key: $keybr /\n
   var_dump($cardSKU);
   echo hr /\n;
 }
 
 When you don't get the data you expect, use var_dump() on the data
 BEFORE that to see where the bits you want exist -- You'll usually
 find that they array/key/value/object structure has what you want,
 just in different places than you were looking.
 
Sorry, I can' really get it :( 
I inserted your code and got this:
[html]
prexml-cardSKU:br /
object(SimpleXMLElement)#3 (0) {
}
hr /
[/html]
shouldn't there be listed all elements of 'category'?
Thanks again and sorry if I'm driving you crazy by that but it's the really 
first time I'm doing something like that...

__

Ron Eggler
Intern 
866-999-4179
www.paykiosks.net

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



Re: [PHP] Re: Performance Comments Question

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 7:09 am, Jochem Maas wrote:
 Barry wrote:
 Rodolfo Andrade wrote:
 and people will love you if you'r files are 90% comments :-)

Actually, the times I've seen THAT much commenting, it was generally a
lot of useless noise and I hated it...

Consider this common practice:

/**
  Function: foo
   Purpose: foo the input string and return a string
Inputs: $string, the input string
Output: result string of foo
Author: Some I. Guy [EMAIL PROTECTED]
  Date: 4/1/2005
**/
function foo($string){
  //code I don't understand
  return $result; // I got this part :-)
}

Note: The Author no longer works at Example, and his email address is
invalid, of course.

If you're going to comment, then comment on the high-level stuff of
what you are *DOING*, not the minutia I can read in the source in the
first place!

Oh yeah:
Comments with increased file size certainly matter, depending on the
disk block size, the OS cache size, PHP's cache sizes, the number of
times you foolishly 'include' them, the number of files you've broken
things into, etc...

You'd have to have a HELL of a lot of comments for that part to matter.

The PHP parser can't be working TOO hard to rip out comments -- It
doesn't even allow nested comments /* ... /*  ... */  ... */ so it
only has to scan ahead for the character combination '*/' and that's
pretty fast.

If you are using an opcode cache, it becomes even more meaning less,
as noted.

You could almost for sure find a comment-stripper out there and
benchmark for yourself on your own hardware:
http://info.com/php+comment+strip

-- 
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] Email Form

2006-01-19 Thread Weber Sites LTD
Check out :

http://www.weberdev.com/get_example-336.html  

http://www.weberdev.com/get_example-1557.html

In general you need to add the From header :

Mail($To,$subject,$body,From:[EMAIL PROTECTED]);

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP code examples : http://www.weberdev.com 
PHP Web Logs : http://www.weberblog.com/ 
PHP  MySQL Forums : http://www.weberforums.com/ 
Learn PHP Playing Trivia http://www.webertrivia.com 
Web Development Index http://www.weberindex.com 
Web Templates http://www.webertemplates.com
Search for PHP Code from your browser http://toolbar.weberdev.com 



-Original Message-
From: Thomas Bonham [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 19, 2006 10:41 PM
To: php-general@lists.php.net
Subject: [PHP] Email Form

Hello All,

I don't remember how to do email with php. I have all of it done, except for
I can't get it to show the senders email address. All I get it from
[EMAIL PROTECTED]

If some one has a example that they can post that would be great.

Thank You

Thomas

--
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] Embedded player

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 5:36 am, Jedidiah wrote:
 I have a sermons page (www.mzbc.com/sermons.php) with a table with
 links to
 .wma sermons.  When clicked in Firefox, it prompts to download.  What

You should also consider switching to MP3, since there is NO WAY I'll
ever hear your .wma sermons -- It's Windows-only doesn't work on most
of my computers.

MP3 works well on all platforms.

 I want
 is to be able to embed a player that will stay on that page and play
 all of
 the files in the table.

Honestly, I'd just as soon you didn't...

I'm then stuck with your whole page open in my browser if I want to
keep listening, and have to mess with right-click and such to keep
listening and surfing at the same time.

A dedicated player allows me to queue up listening material while
surfing.

If you go further and embed it in a Flash movie, then:
A) I can't even hope to listen on Linux, since Flash support for my
Linux box sucks.
B) I can't use right-click on the links to keep your Flash player
going while I'm surfing other pages, so I'm screwed twice-over.

I probably have put a lot more thought into this topic than most,
since I spend a great deal of time reviewing demos of musician who
want to perform at a venue for one of my Jobs...

If you insist on taking away control of what I listen to, and how I
listen to it, and when I listen to it, and where I listen to it, then,
really, I'm not all that interested in listening to what you have to
say... :-)

At a MINIMUM, you should at least consider including a clickable link
within the player to downloads, so those of us who prefer our freedoms
have the option of exercising them and listening, rather than not
listening.  Not exercising our freedoms is not an option. :-)

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



[PHP] Sessions

2006-01-19 Thread PHP Mail
Hi

 

My site is running a custom session handler (into MySQL 3.28). all was well
until I needed to test session in files. it was only a 5 minute test

 

Now I can't get the DB sessions active. Absolutely nothing is registering in
the DB

 

PHP version is 4.3.10. Help please because I can't figure this out. I've
tried everything I can think of

 

TIA

 

Dan

 

 

 



Re: [PHP] Embedded player

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 7:24 am, Rodolfo Andrade wrote:
 If you are looking for compatibility then I would recommend the flash
 player
 solution. There are a *LOT* of sites that use flash so I don't think
 that
 making it a must will impact your users.

You're wrong...

 I don't know which type of users will access your church site, but I'm
 sure
 that if they even use Linux, they will install the plugin, if they
 haven't
 done so.

because the Flash player on Linux just plain sucks.

I get half-movies, movies whose controls don't work, movies with no
sound, ...

The Linux Flash player lags SIGNIFICANTLY behind the Flash designer
output featureset -- to the point where Flash for Linux is a joke, as
far as I'm concerned.

PS I also have about 2,000 audio files available at:
http://uncommonground.com
for anybody who is into acoustic music.

You may need to listen to the playlist twice for technical reasons way
too complex to go into here...

Short version:
Webhost: 500 Meg
Reality: 150,000 Meg
Webcache, cable-modem up backend, dog-slow first play, zippy second play.

PHP rocks. :-)

PPS
I've got to get the back end audio archive on the T1 at the coffehouse
some time RSN.

-- 
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] Email Form

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 3:25 pm, Weber Sites LTD wrote:
 Check out :

 http://www.weberdev.com/get_example-336.html

 http://www.weberdev.com/get_example-1557.html

 In general you need to add the From header :

 Mail($To,$subject,$body,From:[EMAIL PROTECTED]);

In the ideal world, you also will want to upgrade and use the FIFTH
(optional) argument to http://php.net/mail and provide a Return-path:
header that matches your From: line with [EMAIL PROTECTED]

Otherwise, you lose points in spam filters, and some recipients will
probably not ever see the email.

-- 
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] parse string

2006-01-19 Thread Richard Lynch

Then var_dump($xml) and see what's in there.

The data you want is in there somewhere -- you just need to figure out
where it is.


On Thu, January 19, 2006 3:10 pm, Ron Eggler (Paykiosks) wrote:
 Am Donnerstag, den 19.01.2006, 13:51 -0600 schrieb Richard Lynch:
 On Thu, January 19, 2006 12:08 pm, Ron Eggler (Paykiosks) wrote:
  cardSKU category=Local Dial Tone/Telephone Service
  distributor=EWI
  discontinued=false cardtype=PIN transactionType=PURC
 .
 .
 .
  /cardSKU
  [/xml]
 
  and I wanna read information out of it by:
  [php]
  $xml = simplexml_load_string($data);
  /* a few other things like parsing xml that works fine */
  foreach ($xml-cardSKU as $cardSKU)
{
array_push($category,(string)$cardSKU['category']);
}
  [/php]
  but it seems not to work, the array $category stays empty, why
 that?

 It's pretty much the same problem you posted yesterday...

 category is going to be the $key of the array, not the value.

 echo prexml-cardSKU:br /\n;
 var_dump($xml-cardSKU);
 echo hr /\n;
 foreach($xml-cardSKU as $key = $cardSKU){
   echo key: $keybr /\n
   var_dump($cardSKU);
   echo hr /\n;
 }

 When you don't get the data you expect, use var_dump() on the data
 BEFORE that to see where the bits you want exist -- You'll usually
 find that they array/key/value/object structure has what you want,
 just in different places than you were looking.

 Sorry, I can' really get it :(
 I inserted your code and got this:
 [html]
 prexml-cardSKU:br /
 object(SimpleXMLElement)#3 (0) {
 }
 hr /
 [/html]
 shouldn't there be listed all elements of 'category'?
 Thanks again and sorry if I'm driving you crazy by that but it's the
 really first time I'm doing something like that...

 __

 Ron Eggler
 Intern
 866-999-4179
 www.paykiosks.net






-- 
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] Drop down directory structure list box

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 8:04 am, Jay Blanchard wrote:
 [snip]
 are you sure it was not internet explorer just showing you the last
 directory you had opened with a 'browse...' button with in that
 browsing
 session?
 [/snip]

 I am familiar with this behavior, and I am pretty sure that it wasn't
 this,
 because it stood out somehow.

I seem to recall that flickr (flicker?) did something like this...

I certainly didn't go back after that experience.

-- 
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: Re: Greetings

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 4:32 am, Michelle Konzack wrote:
 Hello Richard,

 Am 2006-01-13 16:44:46, schrieb Richard Lynch:

 I am thinking, that spamers know the trich with the @ and maybe .

Last actual experiement I saw, by Netscape? Netcraft? ??? showed
pretty conclusively that any kind of obfuscation, even the most
trivial, was effective.

It's not that they don't know of it -- It's that every time they cast
their line, the get a zillion fish anyway.

If every time you cast your line, you get a million fish, do you worry
about beating obfuscation?

[shrug]

I'm not saying that it's not going to turn into an arms race
eventually, but, so far, the email harvesters have so much yeild that
they haven't even pulled out a slingshot yet.

-- 
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] Embedded Player

2006-01-19 Thread Jedidiah
Thanks for the input.  I think you have slightly misunderstood my post.
Currently, if you visit www.mzbc.com/sermons.php (not trying to promote, but
perhaps it will clarify), you will see a table without about 10 links to 10
different sermons.  I even have instructions below on downloading these
files to your computer.  

 

My reason for using an embedded player was basically just for design
purposes, but perhaps that is not a good idea.  I did not consider the fact
of not being able to leave the site while listening, and since these are as
long as 40 minutes, this might get annoying.  IE currently streams these
files by default, but Firefox automatically downloads them for some reason
even when I choose to open rather than save.  

 

I had planned to use mp3s, but switched to .wma files for size/quality
reasons.  Though I lose some quality with the current bit rate, it sounds
pretty good and the size is between 3-4MB.  This same quality in MP3 format
is 5-6MB.  For high speed users this is not much of a difference, but for
those of us who live in the middle of nowhere who are stuck using dial-up,
this makes a big difference.  Who is unable to play wma files?  Mac and
Linux users?  I was not aware of this.

 

Thanks for all the input,

 

Jedidiah

 



[PHP] New to PHP

2006-01-19 Thread Jedidiah
I mentioned earlier that I recently switched my site over to PHP.  I had a
couple of reasons for this:

1: I was using Server Side Includes, and had been told that PHP includes
were better and definitely more popular.

2: I began sending out a newsletter which was written by someone else in
PHP.

 

I am beginning to wonder if this was a good idea.  I can no longer preview
my pages without uploading the files to the server.  This can really become
a problem when I am making slight formatting changes to my CSS file where I
need to refresh the page every few seconds until I get the look just right.

Is it really worth changing all the files to PHP files and using includes?
Is there any way around this, or am I stuck uploading??

 

Thanks,


Jedidiah



RE: [PHP] odd behavior SOLVED

2006-01-19 Thread Jay Blanchard
[snip]
...lots of valuable information
[/snip]

From the offices of You Ain't Gonna' Beleeeve Dis, Inc.

We barked up several trees, but there were no real squirrels.

PHP 4.4.1, the version on the server in question, comes with 2 flavors of
ini file, the dist and the recommended. I had copied the recommended and
renamed it php.ini, which is the one we have been using all day. I am
standing in the data center cursing and swearing and the network admin says,
Maybe the ini file is hosed somehow. Of course I said that that could not
be the case. What could possibly be bad in the text file to cause this kind
of behavior?

As the afternoon wore on he kept asking if I could water down the ini file
because it was the placement of that file that caused the problem. Even when
I went the route of changing the environment variable I had problems. I told
him that several of the best minds in the world were working on the problem
and that the ini file could not be at fault really. I wanted to prove to him
that this could not be the case, so I renamed the
recommend-php.ini-php.ini.old and copied the dist version which was
renamed to php.ini. I moved it to the WINNT folder. I stopped and started
IIS. Lo' and behold, the php pages loaded fine, with no 404 error. I made a
change to the ini file. It showed up properly in phpinfo(). Dammit he had a
smug look on his faced when I departed the data center.

Apparently there is something wrong with the 'recommended' version. I will
have to compare them to see the differences so that maybe the problem could
be isolated so that furture users do not encounter the several hours of
frustration that I have encountered. You're all to be praised for your
knowledge and insight. Thank you.

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



RE: [PHP] PHP load to high on server

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 3:20 am, Albert wrote:
 Richard Lynch wrote:
 On Tue, January 17, 2006 11:18 pm, Albert wrote:
  The page having the heaviest load uses 5 simultaneous sessions -
 they
  refresh every 5 seconds. Even with just one connection there are
 16
  Apache
  threads running all occupying between 5 and 20% of CPU.

 Are you saying that you have a page that chews up 5 HTTP
 connections,
 and each uses PHP heavily, and you reload that page every 5 seconds?

 I have a page that loads which never refreshes.

 It displays three images generated with PHP. The three images updates
 at
 least once every 5 seconds because the content actually changes.

I'm sure you have thought of it, but consider (again) things like:

Slightly smaller images.
Fewer colors (for GIF/PNG)
Lower quality/resolution (for JPEG)

If you can chop the image file size down, even a little, it may help
some.

Maybe consider posting your image generation code -- Frequently
there's a faster way to do something on that for incredible
performance boost.  Though, again, I would assume you've already been
over this with a fine-tooth comb...

Still, you never know.

If the information page is a lot of text, maybe gzip it, if you can
specify the browser at a level that will support zipped content.  This
will only matter if there's a fair amount of text there...
gzipping the images probably won't help.

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


-- 
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] New to PHP

2006-01-19 Thread Jesús Fernández
You can always install Apache+PHP on your box to try it whenever you want...

--
Esú - http://esu.proyectoanonimo.com
http://www.proyectoanonimo.com


RE: [PHP] PHP Cache (was PHP load to high on server)

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 12:56 am, Albert wrote:
 Jochem Maas wrote:
 take note that APC does 2 things:

 1. op code caching
 2. manage some shared memory (a central place where you can stick
 stuff
 that needs to be read again and again and again; but doesn't need
 updating
 very often)

 pear install apc failed without reason. I ended up downloading the
 package
 and building it manually.

 I opened my login page (worked fine) and then logged in only to get a
 Cannot find server. I had to restart Apache to get any other page
 out.

 On inspection of the Apache error log I saw:
 [Thu Jan 19 06:47:49 2006] [notice] child pid 16429 exit signal
 Segmentation
 fault (11)

 I have Zend Optimizer installed as well. When disabled Zend Optimizer
 my
 server works correctly. When Zend Optimizer is enabled then I get the
 segfaults.

 It seems that APC and Zend Optimizer does not work together so I
 cannot use
 APC as some of the modules we use from third party suppliers have been
 encoded with Zend Safeguard.

You *MIGHT* be able to segregate the Zend-encoded files from the image
files, on sub-domains or separate servers, and then you could
configure one to use Zend Optimizer, and the other to use APC...

Just an idea.  Not sure it's workable in your situation.

-- 
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] URL - stream context

2006-01-19 Thread Geoff
3 suggestions:

I honestly have no idea if this would work, but maybe fopen supports 
non-blocking connections? Or creation of context-based connections 
(for which you can use stream_set_blocking). If so, you could take a 
stamp of the current time plus a timeout value, make the fopen call 
(which would return immediately) then wait politely (I mean that 
from a CPU perspective) in a loop until you have data, or the 
current time goes past your time stamp.

Another avenue for investigation might be to try file_get_contents 
to see if it's connection timeout can be controlled. It seems to 
work in a similar way to fopen, in terms of having wrappers that are 
aware of multiple resource types.

It might also be worth taking a look at cURL or similar libraries 
that are also multi-resource aware, but give you greater control of 
connections parameters and timeouts.

Geoff.


On 19 Jan 2006 at 14:49, Richard Lynch wrote:

 On Thu, January 19, 2006 5:17 am, Jochem Maas wrote:
  Richard Lynch wrote:
  So I've been poring over the docs for the new stream stuff, and it
  looks pretty nifty, except...
 
  I'd really like to be able to just hand a URL to PHP like:
  http://php.net/manual/en/ref.stream.php
 
  er you can if allow_url_fopen ini setting is set to 1  (can't you?)
 
  $fh = fopen('http://php.net/');
 
 The crucial point buried too far into my initial post (sorry):
 
 I NEED to specify a timeout for the initial CONNECTION to acquire the
 data.
 
 fopen does not allow this.
 
 fsockopen does, but then I'm stuck with re-inventing the wheel on
 handling dozens of different protocols to initiate the process to get
 the data rolling.
 
 For HTTP, you have to send GET $path HTTP/1.0\n
 For FTP, you have to send GET $path\n
 For a file, you don't send anything
 ..
 ..
 ..
 
 So to get all the functionality of fopen() I'd need a monster long
 switch statement with a bunch of protocols about which I know almost
 nothing, including some rather complex stuff I can guarantee is over
 my head for ssl:// https:// ftps:// and friends.
 
 I really do not want to re-code all that, when I know it's down in the
 guts of 'fopen'
 
 In other words, I need an additional 'timeout' argument to fopen()
 that works when url_wrappers is on, or a function to set the default
 timeout for fopen() to wait.
 
 PLEASE don't refer me to stream_set_timeout.  THAT only applies to how
 long to wait for data AFTER the stream is open and you are reading
 data.
 
 I'm asking for:
 
 The convenience of fopen() that knows about dozens of protocols and
 takes care of the grotty details so I can just start reading data.
 
 The power of fsockopen() that allows one to specify how long to wait
 for a slow source feed.
 
 What I was hoping for, then, was that I could call this mythical
 function url2context() that would convert *any* URL into an
 appropriate stream context.
 
 Then I thought I would be able to use that contact for fsockopen()
 with a timeout for connection.
 
 I now see that fsockopen() does not even take a stream_context, but
 that fopen() now does, and none of this would do me any good at all...
 
 I guess I was thinking that the magic of fopen() being able to handle
 all those protocols had been bundled into the streams code, and that I
 ought to be able to utilize that somehow WITH a timeout on the
 connection.
 
 I guess I'm stuck with re-coding all the stuff from fopen() in a giant
 PHP switch and using my old-school fsockopen, just so I can have
 control over connection timeout.  :-(
 
 And it looks like all the new streams stuff is very nifty for some
 things, but rather useless for the feature that I believe quite a few
 users have been asking for:
 
 Gimme fopen() with control over timeout, so I can ignore all the
 minutia of what kind of file/stream/URL/whatever I'm reading, but not
 have my application waiting for 2 minutes when somebody else's server
 goes down.
 
 I tried to open a Feature Request to this, but it's already been
 closed as Bogus wherein I was told to rtfm.
 
 I've re-opened it, but based on my past mixed experience with the
 people behind bugs.php.net, I figure I've only got a 50/50 chance of
 somebody who actually reads and comprehends what I typed seeing it
 before it gets closed again and ignored. :-(
 
 Don't get me wrong -- I know what a monumental task they face, and am
 aware that there are certain Pavlovian automatic reactions, and that's
 how it is when they see the keywords embedded in my Change Request, so
 I'm not dis-ing them... It's just Reality that a worthy feature worth
 considering is probably going to get buried in the Bogus pile. [shrug]
 
 If anybody reading this actually agrees with me, feel free to vote here:
 http://bugs.php.net/bug.php?id=36072
 
 If you think I'm an idiot, by all means vote against the feature request.
 
 -- 
 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] $_SESSION saves all values but Class -- works on one server but not another?!

2006-01-19 Thread Daevid Vincent
Thank you for the reply. I don't think that's the issue.

I have:

; Initialize session on request startup.
session.auto_start = 0

But this is the same setting as the box that DOES work.

What's really confusing me is that part of the SESSION does work. I would
expect an all or nothing case. Everything but the class is restored.

You had me at EHLO --E.Webb (10.04.05)  

 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, January 19, 2006 1:54 PM
 To: Daevid Vincent
 Subject: Re: [PHP] $_SESSION saves all values but Class -- 
 works on one server but not another?!
 
 On Wed, January 18, 2006 11:27 pm, Daevid Vincent wrote:
  I have a gentoo server that doesn't save/restore the CLASS 
 portion of
  a
  session, but it does retain other $_SESSION values. This code works
 
 Sounds to me like the Gentoo box does not have 'autoload' so the
 objects coming back out of the session have no 'class' to build
 themselves from...
 
 I confess to not reading all the details you posted to see if autoload
 was on/off differently in the two...
 
 Especially since I have no idea how to turn it on/off as I 
 never used it.
 
 -- 
 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] New to PHP

2006-01-19 Thread Geoff
I have a local web server running on my development PC, with an 
exact copy of all my sites stored locally, so I can develop and test 
as I go, only uploading when I know everything is 100%.
For Windows machines, you can choose IIS or Apache, although I'd 
recommend you go with whatever your web server is running.

Geoff.


On 19 Jan 2006 at 16:02, Jedidiah wrote:

 I mentioned earlier that I recently switched my site over to PHP.  I had a
 couple of reasons for this:
 
 1: I was using Server Side Includes, and had been told that PHP includes
 were better and definitely more popular.
 
 2: I began sending out a newsletter which was written by someone else in
 PHP.
 
  
 
 I am beginning to wonder if this was a good idea.  I can no longer preview
 my pages without uploading the files to the server.  This can really become
 a problem when I am making slight formatting changes to my CSS file where I
 need to refresh the page every few seconds until I get the look just right.
 
 Is it really worth changing all the files to PHP files and using includes?
 Is there any way around this, or am I stuck uploading??
 
  
 
 Thanks,
 
 
 Jedidiah
 
 
 
 !DSPAM:43d01a9147492034818120!
 

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



Re: [PHP] Help with regular expressions

2006-01-19 Thread Richard Lynch
On Tue, January 17, 2006 1:54 pm, Carl Furst wrote:
 Ok I am so stumped.. I'm doing something stupid and I can't figure it
 out..

 Here's the code:

 ?php

 $eml = '[EMAIL PROTECTED]
 ceo';
 if (strpos($eml, ' ')) echo yep, there are spaces\n; //does strpos
 see the
 spaces?
 echo preg_replace('/\s/', '',  $eml); //WTF? Preg_replace does not?
 echo $eml\n;


 ?

 As you can see there are a bunch of spaces in that email address. I'm
 trying
 to use preg_replace to get rid of them. Strpos sees the spaces and the
 first
 echo statement is executed. The second echo prints nothing and the
 third
 prints the original $eml with nothing substituted.

 Can anyone see why the perl reg isn't seeing the spaces?

It should work...

Though I would recommend using \\s instead of \s, because \ is a
special character to '' and when I see \s I think you mean something
like \n, only not...

-- 
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] parse string

2006-01-19 Thread Ron Eggler (Paykiosks)
[snipped everything]

Okay, If I'm gonna dump $xml i get a huge output put can't fin category
in there:
[Output]
object(SimpleXMLElement)#1 (1) {
  [SKUlisting]=
  object(SimpleXMLElement)#3 (3) {
[globalInfo]=
object(SimpleXMLElement)#4 (0) {
}
[carrierInfo]=
array(15) {
  [0]=
  object(SimpleXMLElement)#2 (0) {
  }
  [1]=
  object(SimpleXMLElement)#6 (0) {
  }
  [2]=
  object(SimpleXMLElement)#7 (0) {
  }
  [3]=
  object(SimpleXMLElement)#8 (0) {
  }
  [4]=
  object(SimpleXMLElement)#9 (0) {
  }
  [5]=
  object(SimpleXMLElement)#10 (0) {
  }
  [6]=
  object(SimpleXMLElement)#11 (0) {
  }
  [7]=
  object(SimpleXMLElement)#12 (0) {
  }
  [8]=
  object(SimpleXMLElement)#13 (0) {
  }
  [9]=
  object(SimpleXMLElement)#14 (0) {
  }
  [10]=
  object(SimpleXMLElement)#15 (0) {
  }
  [11]=
  object(SimpleXMLElement)#16 (0) {
  }
  [12]=
  object(SimpleXMLElement)#17 (0) {
  }
  [13]=
  object(SimpleXMLElement)#18 (0) {
  }
  [14]=
  object(SimpleXMLElement)#19 (0) {
  }
}
[cardSKU]=
array(45) {
  [0]=
  object(SimpleXMLElement)#20 (3) {
[card]=
object(SimpleXMLElement)#65 (1) {
  [cinfo]=
  object(SimpleXMLElement)#67 (0) {
  }
}
[terms]=
string(65) Refer to the Reconex brochure for complete terms and 
conditions. 
[pinfo]=
object(SimpleXMLElement)#66 (0) {
}
  }
  [1]=
  object(SimpleXMLElement)#21 (3) {
[card]=
object(SimpleXMLElement)#68 (1) {
  [cinfo]=
  object(SimpleXMLElement)#70 (0) {
  }
}
[terms]=
string(65) Refer to the Reconex brochure for complete terms and 
conditions. 
[pinfo]=
object(SimpleXMLElement)#69 (0) {
}
  }
  [2]=
  object(SimpleXMLElement)#22 (3) {
[card]=
object(SimpleXMLElement)#71 (1) {
  [cinfo]=
  object(SimpleXMLElement)#73 (0) {
  }
}
[terms]=
string(65) Refer to the Reconex brochure for complete terms and 
conditions. 
[pinfo]=
object(SimpleXMLElement)#72 (0) {
}
  }
  [3]=
  object(SimpleXMLElement)#23 (3) {
[card]=
object(SimpleXMLElement)#74 (1) {
  [cinfo]=
  object(SimpleXMLElement)#76 (0) {
  }
}
[terms]=
string(65) Refer to the Reconex brochure for complete terms and 
conditions. 
[pinfo]=
object(SimpleXMLElement)#75 (0) {
}
  }
  [4]=
  object(SimpleXMLElement)#24 (3) {
[skuswipe]=
object(SimpleXMLElement)#77 (0) {
}
[card]=
object(SimpleXMLElement)#78 (1) {
  [cinfo]=
  object(SimpleXMLElement)#80 (0) {
  }
}
[terms]=
object(SimpleXMLElement)#79 (0) {
}
  }
  [5]=
  object(SimpleXMLElement)#25 (3) {
[skuswipe]=
object(SimpleXMLElement)#81 (0) {
}
[card]=
object(SimpleXMLElement)#82 (1) {
  [cinfo]=
  object(SimpleXMLElement)#84 (0) {
  }
}
[terms]=
object(SimpleXMLElement)#83 (0) {
}
  }
  [6]=
  object(SimpleXMLElement)#26 (3) {
[skuswipe]=
object(SimpleXMLElement)#85 (0) {
}
[card]=
object(SimpleXMLElement)#86 (1) {
  [cinfo]=
  object(SimpleXMLElement)#88 (0) {
  }
}
[terms]=
object(SimpleXMLElement)#87 (0) {
}
  }
  [7]=
  object(SimpleXMLElement)#27 (4) {
[skuswipe]=
object(SimpleXMLElement)#89 (0) {
}
[loadValueInfo]=
object(SimpleXMLElement)#90 (0) {
}
[card]=
object(SimpleXMLElement)#91 (1) {
  [cinfo]=
  object(SimpleXMLElement)#93 (0) {
  }
}
[terms]=
object(SimpleXMLElement)#92 (0) {
}
  }
  [8]=
  object(SimpleXMLElement)#28 (4) {
[skuswipe]=
object(SimpleXMLElement)#94 (0) {
}
[loadValueInfo]=
object(SimpleXMLElement)#95 (0) {
}
[card]=
object(SimpleXMLElement)#96 (1) {
  [cinfo]=
  object(SimpleXMLElement)#98 (0) {
  }
}
[terms]=
object(SimpleXMLElement)#97 (0) {
}
  }
  [9]=
  object(SimpleXMLElement)#29 (4) {
[skuswipe]=
object(SimpleXMLElement)#99 (0) {
}
[loadValueInfo]=
object(SimpleXMLElement)#100 (0) {
}
[card]=
object(SimpleXMLElement)#101 (1) {
  [cinfo]=
  object(SimpleXMLElement)#103 (0) {
  }
}
[terms]=
object(SimpleXMLElement)#102 (0) {
}
   

[PHP] (Fwd) inserting text into a mime message

2006-01-19 Thread Geoff
Nobody got any ideas on this? I would be interested to hear from 
anyone who has successfully adjusted parts of an email message while 
it is in transit, by ANY method. I'm getting desparate and will try 
anything, even if it is not 100% PHP.

All ideas, suggestions greatly appreciated.

Geoff.


--- Forwarded message follows ---
From:   Geoff [EMAIL PROTECTED]
To: php-general@lists.php.net
Subject:inserting text into a mime message
Date sent:  Thu, 19 Jan 2006 10:51:37 +0200

Hi All,

I've been searching the archives for help on this, but have come up 
empty-handed. Here's the thing:

I'm using a PHP script to parse every message coming through a 
mailserver. The server invokes my script for each message, giving it 
a filename containing the full raw text of the email. The script 
needs to modify the raw message file, inserting a footer (some 
trailing text, eg: a disclaimer) at the end of each part of readable 
message. It doesn't touch file attachments, but it needs to insert 
the footer in any plaintext, HTML text or both (if they exist).

There are so many different mime options and encoding types that it 
seemed like re-inventing the wheel to try working with only the raw 
message text, so instead I decided to use the PEAR Mail_mimeDecode 
module, which returns a very nice object array of all the parts, 
decoded and ready for use.

It's no problem going through this and inserting the footer wherever 
it is needed. That much I've done.

My problem is trying to rebuild that object array (the output of the 
Mail_mimeDecode::decode() function) back into its raw form once 
again, so that I can write the modified raw text back to the message 
file and the email can go on its way.

Another complication is that except for the insertion of the footer, 
I cannot modify the original message. All the headers, dates, 
receive-paths, etc, must remain unchanged.

Has anybody ever done anything like this before - re-encoding a 
message that had been decoded by Mail_mimeDecode::decode()? I've 
looked at the encode() function, but it seems to be used for making 
a simple message from scratch (with just one body part), it is not 
really the opposite of decode(). [I may be wrong about this - there 
are no examples in the PEAR manual].

I'm not hung up about what to use, it doesn't have to be PEAR, I 
will use any library or code that will do the job. Alternatively, if 
it is possible to do this with encode(), I would love to see an 
example, as I couldn't get it to work that way myself.

Many thanks.

Geoff.

--- End of forwarded message ---

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



Re: [PHP] RE: header data being inserted into message

2006-01-19 Thread Richard Lynch
On Tue, January 17, 2006 9:12 am, ET Support wrote:
 I am having a problem using PHP's mail function to send mail via BCC
 to
 multiple recipients. Here's my code;
 --
 $get_emails = pg_exec($dbh,SELECT email FROM mailing_list WHERE conf
 = 1);
 $count = pg_numrows($get_emails);
 $bcc_count = $envelope_count = 0;
 $bcc_limit = 200;
 $subject = $body = 'test message';
 $from = '[EMAIL PROTECTED]';
 $header = From: $from\r\n;

You probably want Reply-to: here as well...

 for($x = 0; $x  $count; $x++) {
   $email = pg_result($get_emails,$x,0);
   if($bcc_count = $bcc_limit) {
   if($x  0) {
   $envelope_count++;
   mail($from,$subject,$body,$headers);
   }
   $headers = $header . Bcc: $email\r\n;

   $bcc_count = 1;
   } else {
   $headers .= Bcc: $email\r\n;
   $bcc_count++;
   }
 }
 # send the last envelope
 mail($from,$subject,$body,$headers);
 --

 The problem is that for some recipients they get a message body like
 this;

 --
 Message-Id: [EMAIL PROTECTED]
 Date: Mon, 16 Jan 2006 17:06:40 + (GMT)

 test message
 --

 Any idea why those headers are being inserted into the message body
 and how
 that can be prevented?

If $email contains a newline, or a \r\n, then you might see that...

Because your Bcc: $email\r\n turns into:

Bcc: junk\n
\r\n
Message-Id: 


At which point you're not in the heades any more because your 'email'
forced you out of them with a blank line.

How 'clean' are the emails in your database?... :-)

If they've come from a web signup form, and you weren't validating the
input, then I guarantee you've got spammers trying to use your form to
send out junk by forcing newlines and the headers THEY want into your
'email' field...

-- 
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] creating new class from wrapper class (OOP question)

2006-01-19 Thread Richard Lynch
On Tue, January 17, 2006 8:56 am, Henrik Gemal wrote:
 In a image gallery I have to class'es:

 class GPicFilePicture extends GPicFileType
 class GPicFileMovie extends GPicFileType

 both of them are based on:

 abstract class GPicFileType

 In my code I need to create a new GPicFilePicture. To avoid duplicated
 code I've create a wrapper class:

 class GPicFile

 that does something like this:

 if (fileextension == jpg)
return new GPicFilePicture();
 else
return new GPicFileMovie();

This isn't in the constructor, is it?

You would need to do something like:

class GPicFile {
  var $implementor = NULL;

  function implementor($filename){
if (fileextension == 'jpg')
  $this-implementor = new GPicFilePicture();
else
  $this-implementor = new GPicFileMovie();
  }

  function getFileDate(){
return $this-implementor-getFileDate();
  }
}

You can't have a wrapper class that returns one class or another.

You could have a FUNCTION that would return one or the other, and then
you'd have to make sure you handled either kind of object, but not a
class that pretends to be two different kinds of objects.

 so my PHP code looks like:
 $file = new GPicFile($filename);

 getFileDate() is implemented in both GPicFilePicture and
 GPicFileMovie.

 Now I try to do:
 $file-getFileDate();

 I get an error saying:
 Call to undefined method GPicFile::getFileDate()

You can't make really make GPicFile object sometimes be a
GPicFilePicture and sometimes be a GPicFileMovie...

You could sort of do this if PHP had multiple inheritence, but it
doesn't.

There might be something in the fancy new PHP5 stuff about interface
and whatnot that would be more elegant than the hack above.

But you're on your own for that.

-- 
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] New to PHP

2006-01-19 Thread Mike Rondeau
I use Xampp because I'm new to all of this also, and it makes setup a breeze.
http://www.apachefriends.org/en/
This installs Apache, mysql, php, pearl, ftpzilla, all kinds of stuff, already 
configured and ready to rock.
It doesn't get any easier.

Mike
  - Original Message - 
  From: Jesús Fernández 
  Cc: php-general@lists.php.net 
  Sent: Thursday, January 19, 2006 2:05 PM
  Subject: Re: [PHP] New to PHP


  You can always install Apache+PHP on your box to try it whenever you want...

  --
  Esú - http://esu.proyectoanonimo.com
  http://www.proyectoanonimo.com


Re: [PHP] (Fwd) inserting text into a mime message

2006-01-19 Thread Richard Lynch
All them lawyerly crapola signatures outside the control of the actual
user implies that there is SOME kind of software available to do it...

It seems to me that if you looked at the raw email and found the
boundary, and focused on the only mime-types you care about, you'd be
able to hack the file pretty easily...

And if it's not mime-encoded, it's just text, and a simple fopen($x,
'a'); fwrite($x, $sig); fclose($x); would do it.

Maybe I'm over-simplifying something?


On Thu, January 19, 2006 4:22 pm, Geoff wrote:
 Nobody got any ideas on this? I would be interested to hear from
 anyone who has successfully adjusted parts of an email message while
 it is in transit, by ANY method. I'm getting desparate and will try
 anything, even if it is not 100% PHP.

 All ideas, suggestions greatly appreciated.

 Geoff.


 --- Forwarded message follows ---
 From: Geoff [EMAIL PROTECTED]
 To:   php-general@lists.php.net
 Subject:  inserting text into a mime message
 Date sent:Thu, 19 Jan 2006 10:51:37 +0200

 Hi All,

 I've been searching the archives for help on this, but have come up
 empty-handed. Here's the thing:

 I'm using a PHP script to parse every message coming through a
 mailserver. The server invokes my script for each message, giving it
 a filename containing the full raw text of the email. The script
 needs to modify the raw message file, inserting a footer (some
 trailing text, eg: a disclaimer) at the end of each part of readable
 message. It doesn't touch file attachments, but it needs to insert
 the footer in any plaintext, HTML text or both (if they exist).

 There are so many different mime options and encoding types that it
 seemed like re-inventing the wheel to try working with only the raw
 message text, so instead I decided to use the PEAR Mail_mimeDecode
 module, which returns a very nice object array of all the parts,
 decoded and ready for use.

 It's no problem going through this and inserting the footer wherever
 it is needed. That much I've done.

 My problem is trying to rebuild that object array (the output of the
 Mail_mimeDecode::decode() function) back into its raw form once
 again, so that I can write the modified raw text back to the message
 file and the email can go on its way.

 Another complication is that except for the insertion of the footer,
 I cannot modify the original message. All the headers, dates,
 receive-paths, etc, must remain unchanged.

 Has anybody ever done anything like this before - re-encoding a
 message that had been decoded by Mail_mimeDecode::decode()? I've
 looked at the encode() function, but it seems to be used for making
 a simple message from scratch (with just one body part), it is not
 really the opposite of decode(). [I may be wrong about this - there
 are no examples in the PEAR manual].

 I'm not hung up about what to use, it doesn't have to be PEAR, I
 will use any library or code that will do the job. Alternatively, if
 it is possible to do this with encode(), I would love to see an
 example, as I couldn't get it to work that way myself.

 Many thanks.

 Geoff.

 --- End of forwarded message ---

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




-- 
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] parse string

2006-01-19 Thread Richard Lynch
G.  I forgot PHP Object printing was so primitive, even under
var_dump. :-(

function walkout($object, $indent = 0){
  if (is_object($object) or is_array($object)){
foreach($object as $k = $v){
  echo str_repeat('  ', $indent), $k, ' =gt; ';
  walkout($v, $indent + 1);
}
  }
  else echo $v, br /\n;
}

echo pre;
walkout($xml);
echo /pre;

On Thu, January 19, 2006 4:21 pm, Ron Eggler (Paykiosks) wrote:
 [snipped everything]

 Okay, If I'm gonna dump $xml i get a huge output put can't fin
 category
 in there:
 [Output]
 object(SimpleXMLElement)#1 (1) {
   [SKUlisting]=
   object(SimpleXMLElement)#3 (3) {
 [globalInfo]=
 object(SimpleXMLElement)#4 (0) {
 }
 [carrierInfo]=
 array(15) {
   [0]=
   object(SimpleXMLElement)#2 (0) {
   }
   [1]=
   object(SimpleXMLElement)#6 (0) {
   }
   [2]=
   object(SimpleXMLElement)#7 (0) {
   }
   [3]=
   object(SimpleXMLElement)#8 (0) {
   }
   [4]=
   object(SimpleXMLElement)#9 (0) {
   }
   [5]=
   object(SimpleXMLElement)#10 (0) {
   }
   [6]=
   object(SimpleXMLElement)#11 (0) {
   }
   [7]=
   object(SimpleXMLElement)#12 (0) {
   }
   [8]=
   object(SimpleXMLElement)#13 (0) {
   }
   [9]=
   object(SimpleXMLElement)#14 (0) {
   }
   [10]=
   object(SimpleXMLElement)#15 (0) {
   }
   [11]=
   object(SimpleXMLElement)#16 (0) {
   }
   [12]=
   object(SimpleXMLElement)#17 (0) {
   }
   [13]=
   object(SimpleXMLElement)#18 (0) {
   }
   [14]=
   object(SimpleXMLElement)#19 (0) {
   }
 }
 [cardSKU]=
 array(45) {
   [0]=
   object(SimpleXMLElement)#20 (3) {
 [card]=
 object(SimpleXMLElement)#65 (1) {
   [cinfo]=
   object(SimpleXMLElement)#67 (0) {
   }
 }
 [terms]=
 string(65) Refer to the Reconex brochure for complete terms
 and conditions. 
 [pinfo]=
 object(SimpleXMLElement)#66 (0) {
 }
   }
   [1]=
   object(SimpleXMLElement)#21 (3) {
 [card]=
 object(SimpleXMLElement)#68 (1) {
   [cinfo]=
   object(SimpleXMLElement)#70 (0) {
   }
 }
 [terms]=
 string(65) Refer to the Reconex brochure for complete terms
 and conditions. 
 [pinfo]=
 object(SimpleXMLElement)#69 (0) {
 }
   }
   [2]=
   object(SimpleXMLElement)#22 (3) {
 [card]=
 object(SimpleXMLElement)#71 (1) {
   [cinfo]=
   object(SimpleXMLElement)#73 (0) {
   }
 }
 [terms]=
 string(65) Refer to the Reconex brochure for complete terms
 and conditions. 
 [pinfo]=
 object(SimpleXMLElement)#72 (0) {
 }
   }
   [3]=
   object(SimpleXMLElement)#23 (3) {
 [card]=
 object(SimpleXMLElement)#74 (1) {
   [cinfo]=
   object(SimpleXMLElement)#76 (0) {
   }
 }
 [terms]=
 string(65) Refer to the Reconex brochure for complete terms
 and conditions. 
 [pinfo]=
 object(SimpleXMLElement)#75 (0) {
 }
   }
   [4]=
   object(SimpleXMLElement)#24 (3) {
 [skuswipe]=
 object(SimpleXMLElement)#77 (0) {
 }
 [card]=
 object(SimpleXMLElement)#78 (1) {
   [cinfo]=
   object(SimpleXMLElement)#80 (0) {
   }
 }
 [terms]=
 object(SimpleXMLElement)#79 (0) {
 }
   }
   [5]=
   object(SimpleXMLElement)#25 (3) {
 [skuswipe]=
 object(SimpleXMLElement)#81 (0) {
 }
 [card]=
 object(SimpleXMLElement)#82 (1) {
   [cinfo]=
   object(SimpleXMLElement)#84 (0) {
   }
 }
 [terms]=
 object(SimpleXMLElement)#83 (0) {
 }
   }
   [6]=
   object(SimpleXMLElement)#26 (3) {
 [skuswipe]=
 object(SimpleXMLElement)#85 (0) {
 }
 [card]=
 object(SimpleXMLElement)#86 (1) {
   [cinfo]=
   object(SimpleXMLElement)#88 (0) {
   }
 }
 [terms]=
 object(SimpleXMLElement)#87 (0) {
 }
   }
   [7]=
   object(SimpleXMLElement)#27 (4) {
 [skuswipe]=
 object(SimpleXMLElement)#89 (0) {
 }
 [loadValueInfo]=
 object(SimpleXMLElement)#90 (0) {
 }
 [card]=
 object(SimpleXMLElement)#91 (1) {
   [cinfo]=
   object(SimpleXMLElement)#93 (0) {
   }
 }
 [terms]=
 object(SimpleXMLElement)#92 (0) {
 }
   }
   [8]=
   object(SimpleXMLElement)#28 (4) {
 [skuswipe]=
 object(SimpleXMLElement)#94 (0) {
 }
 [loadValueInfo]=
 object(SimpleXMLElement)#95 (0) {
 }
 [card]=
 

RE: [PHP] $_SESSION saves all values but Class -- works on one server but not another?!

2006-01-19 Thread Richard Lynch


Object 'autoload' has absolutely NOTHING to do with session.auto_start.

http://www.php.net/autoload

On Thu, January 19, 2006 4:10 pm, Daevid Vincent wrote:
 Thank you for the reply. I don't think that's the issue.

 I have:

 ; Initialize session on request startup.
 session.auto_start = 0

 But this is the same setting as the box that DOES work.

 What's really confusing me is that part of the SESSION does work. I
 would
 expect an all or nothing case. Everything but the class is restored.

 You had me at EHLO --E.Webb (10.04.05)

 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Thursday, January 19, 2006 1:54 PM
 To: Daevid Vincent
 Subject: Re: [PHP] $_SESSION saves all values but Class --
 works on one server but not another?!

 On Wed, January 18, 2006 11:27 pm, Daevid Vincent wrote:
  I have a gentoo server that doesn't save/restore the CLASS
 portion of
  a
  session, but it does retain other $_SESSION values. This code
 works

 Sounds to me like the Gentoo box does not have 'autoload' so the
 objects coming back out of the session have no 'class' to build
 themselves from...

 I confess to not reading all the details you posted to see if
 autoload
 was on/off differently in the two...

 Especially since I have no idea how to turn it on/off as I
 never used it.

 --
 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




-- 
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] Embedded Player

2006-01-19 Thread Brady Mitchell
 -Original Message-
 My reason for using an embedded player was basically just for 
 design purposes, but perhaps that is not a good idea.  I did 
 not consider the fact of not being able to leave the site 
 while listening, and since these are as long as 40 minutes, 
 this might get annoying.  

Perhaps keeping your current setup and adding a link that opens an
embedded player in a popup window would be a good compromise.  That way
people who just want to stream the sermons can do so, and with the
player in a popup window they could still surf the web while listening.

As far as file format, it might be worth looking into using the OGG
Vorbis format.  There are players on Windows/Mac/Linux that support the
format and it uses compression, so the file sizes should be a bit
smaller than mp3s.  Take a look at http://www.vorbis.com/ for more info.

Just some ideas..

Brady

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



Re: [PHP] New to PHP

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 4:02 pm, Jedidiah wrote:
 I mentioned earlier that I recently switched my site over to PHP.  I
 had a
 couple of reasons for this:

 1: I was using Server Side Includes, and had been told that PHP
 includes
 were better and definitely more popular.

 2: I began sending out a newsletter which was written by someone else
 in
 PHP.

 I am beginning to wonder if this was a good idea.  I can no longer
 preview
 my pages without uploading the files to the server.  This can really
 become
 a problem when I am making slight formatting changes to my CSS file
 where I
 need to refresh the page every few seconds until I get the look just
 right.

 Is it really worth changing all the files to PHP files and using
 includes?
 Is there any way around this, or am I stuck uploading??

Several options spring to mind.

#1.
Install Apache (free) and PHP (free) and MySQL (free) on your desktop
where you build your pages.

You'll have your own little Intranet with one (1) server (your
computer) and one client (your comupter) and one user (you).

You can then test to your heart's content all kinds of fun stuff in
your page and have no worry that anybody but you will be affected.

This is a pretty standard development model.  Most PHP developers do
this because it's quite easy, and you can then work with any new
technology you want without worrying about it crashing the real
server.

If you have a laptop, you can also then work anywhere at all.

#2.
Consider using a template library such as Smarty so that your Template
files can be viewed/edited independently of the program logic, so that
CSS changes aren't affected as much by PHP, and you MIGHT be able to
skip #1...  But you probably shouldn't.

-- 
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] parse string

2006-01-19 Thread Ron Eggler (Paykiosks)
Am Donnerstag, den 19.01.2006, 16:42 -0600 schrieb Richard Lynch:
 G.  I forgot PHP Object printing was so primitive, even under
 var_dump. :-(
 
 function walkout($object, $indent = 0){
   if (is_object($object) or is_array($object)){
 foreach($object as $k = $v){
   echo str_repeat('  ', $indent), $k, ' =gt; ';
   walkout($v, $indent + 1);
 }
   }
   else echo $v, br /\n;
 }
 
 echo pre;
 walkout($xml);
 echo /pre;
yes, and now? it just prints every subject like:

  SKUlisting = 

  globalInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  carrierInfo = 

  cardSKU = 

card = 

  cinfo = 

changed the function a bit [just inserted br]
I have no idea yet, how I'm gonna reach my goal... :(
__

Ron Eggler
Intern 
866-999-4179
www.paykiosks.net

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



Re: [PHP] Email Form

2006-01-19 Thread AK


- Original Message - 
From: Thomas Bonham [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, January 19, 2006 12:40 PM
Subject: [PHP] Email Form



Hello All,

I don't remember how to do email with php. I have all of it done, except 
for I can't get it to show the senders email address. All I get it from 
[EMAIL PROTECTED]


If some one has a example that they can post that would be great.

Thank You

Thomas

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




Hello,

http://us2.php.net/manual/en/function.mail.php

Example 2. Sending mail with extra headers.

The addition of basic headers, telling the MUA the From and Reply-To 
addresses:


?php
$to  = '[EMAIL PROTECTED]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [EMAIL PROTECTED]' . \r\n .
  'Reply-To: [EMAIL PROTECTED]' . \r\n .
  'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?

Best regards,

Andras Kende
http://www.kende.com

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



Re: [PHP] (Fwd) inserting text into a mime message

2006-01-19 Thread Geoff
 It seems to me that if you looked at the raw email and found the
 boundary, and focused on the only mime-types you care about, you'd
 be able to hack the file pretty easily... 

I just may have to do that. One problem though is that many mails 
are encoded in some way (I mean byte-encoding, like base 64) and I 
was hoping to make use of the transparent decoding capability of a 
class or library made to do that sort of thing. But if I cannot, 
then yours is the approach I will probably use.

 All them lawyerly crapola signatures outside the control of the
 actual user implies that there is SOME kind of software available
 to do it... 

...but many of them are in commercial packages, or are plugins to 
MSExchange or similar. And most of the open-source ones only stick 
the footer in the first piece of text/plain that they find, without 
being aware of multiparts.

Thanks,

Geoff.


On 19 Jan 2006 at 16:38, Richard Lynch wrote:

 All them lawyerly crapola signatures outside the control of the actual
 user implies that there is SOME kind of software available to do it...
 
 It seems to me that if you looked at the raw email and found the
 boundary, and focused on the only mime-types you care about, you'd be
 able to hack the file pretty easily...
 
 And if it's not mime-encoded, it's just text, and a simple fopen($x,
 'a'); fwrite($x, $sig); fclose($x); would do it.
 
 Maybe I'm over-simplifying something?
 
 
 On Thu, January 19, 2006 4:22 pm, Geoff wrote:
  Nobody got any ideas on this? I would be interested to hear from
  anyone who has successfully adjusted parts of an email message while
  it is in transit, by ANY method. I'm getting desparate and will try
  anything, even if it is not 100% PHP.
 
  All ideas, suggestions greatly appreciated.
 
  Geoff.
 
 
  --- Forwarded message follows ---
  From:   Geoff [EMAIL PROTECTED]
  To: php-general@lists.php.net
  Subject:inserting text into a mime message
  Date sent:  Thu, 19 Jan 2006 10:51:37 +0200
 
  Hi All,
 
  I've been searching the archives for help on this, but have come up
  empty-handed. Here's the thing:
 
  I'm using a PHP script to parse every message coming through a
  mailserver. The server invokes my script for each message, giving it
  a filename containing the full raw text of the email. The script
  needs to modify the raw message file, inserting a footer (some
  trailing text, eg: a disclaimer) at the end of each part of readable
  message. It doesn't touch file attachments, but it needs to insert
  the footer in any plaintext, HTML text or both (if they exist).
 
  There are so many different mime options and encoding types that it
  seemed like re-inventing the wheel to try working with only the raw
  message text, so instead I decided to use the PEAR Mail_mimeDecode
  module, which returns a very nice object array of all the parts,
  decoded and ready for use.
 
  It's no problem going through this and inserting the footer wherever
  it is needed. That much I've done.
 
  My problem is trying to rebuild that object array (the output of the
  Mail_mimeDecode::decode() function) back into its raw form once
  again, so that I can write the modified raw text back to the message
  file and the email can go on its way.
 
  Another complication is that except for the insertion of the footer,
  I cannot modify the original message. All the headers, dates,
  receive-paths, etc, must remain unchanged.
 
  Has anybody ever done anything like this before - re-encoding a
  message that had been decoded by Mail_mimeDecode::decode()? I've
  looked at the encode() function, but it seems to be used for making
  a simple message from scratch (with just one body part), it is not
  really the opposite of decode(). [I may be wrong about this - there
  are no examples in the PEAR manual].
 
  I'm not hung up about what to use, it doesn't have to be PEAR, I
  will use any library or code that will do the job. Alternatively, if
  it is possible to do this with encode(), I would love to see an
  example, as I couldn't get it to work that way myself.
 
  Many thanks.
 
  Geoff.
 
  --- End of forwarded message ---
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 -- 
 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
 
 
 
 !DSPAM:43d0236364872042218820!
 

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



[PHP] Re: New to PHP

2006-01-19 Thread Dan Baker
Jedidiah [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I mentioned earlier that I recently switched my site over to PHP.
snip
 I can no longer preview
 my pages without uploading the files to the server.  This can really 
 become
 a problem when I am making slight formatting changes to my CSS file where 
 I
 need to refresh the page every few seconds until I get the look just 
 right.

 Is it really worth changing all the files to PHP files and using includes?
 Is there any way around this, or am I stuck uploading??

There are a couple things you can do:
(1) Create a local webserver/PHP environment, like others have suggested
(2) Made yourself a small test bed are on your external server, upload your 
files, and try them out.  If you have a fast internet connection, this 
usually isn't too bad.

Dan 

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



Re: [PHP] URL - stream context

2006-01-19 Thread Richard Lynch
On Thu, January 19, 2006 4:08 pm, Geoff wrote:
 I honestly have no idea if this would work, but maybe fopen supports
 non-blocking connections?

Not as far as I can tell...

You can call stream_set_blocking after it's open, but that doesn't
help a slow connection in the first place.

 Or creation of context-based connections
 (for which you can use stream_set_blocking).

Unless I'm seriously mis-reading docs, stream_set_blocking can only be
called on an already-open stream, not on the soon-to-be-opened stream.

fopen() in PHP5 does take a context, and if I could figure out how to
embed the concepts of do not block and timeout in $x seconds
within a context from the docs, and if fopen() would still handle all
the details of the various protocols, I'd be all set...

That's sort of what I was asking for in the original email, but...

It seems like you have to specify the 'scheme' as the key in the
context array.

So, I guess, I could, in theory, find a listing of all the schemes
fopen() supports, which might even be in a function, iterate over all
of those, and do something like:
$schemes = function_that_returns_all_schemes_fopen_supports();
$opts = array();
foreach($schemes as $scheme){
  $opts[$scheme]['some_magic_undocumented_thing'] =
STREAM_CLIENT_ASYNC_CONNECT | STREAM_CLIENT_CONNECT ;
}

$foo = fopen($url, 'r', false, $opts);
if ($foo == false) $errors[] = $url timed out;

Only problem is, these constants are documented ONLY to work with:
http://www.php.net/manual/en/function.stream-socket-client.php
and that pretty clearly is working at a much lower-level than fopen
(and friends) as the very first example shows using TCP as a protocol,
and then you have to send the GET and any other headers, which is
exactly what I'm trying to avoid having to re-code in the first place.

So I'm back to square one, as far as I can see from the docs...

It's possible (still) that I'm just mis-reading docs, or am
continually skipping over the one new page in 'streams' that is making
everybody think this should be so simple, but I don't think so, since
I've read EVERY page in the new streams section several times now.

I'm not claiming 100% comprehension of every implication on every
page, mind you :-)

 If so, you could take a
 stamp of the current time plus a timeout value, make the fopen call
 (which would return immediately) then wait politely (I mean that
 from a CPU perspective) in a loop until you have data, or the
 current time goes past your time stamp.

Yes -- if I could compose a stream_context doohickey that convinced
fopen() to use a time-out...

 Another avenue for investigation might be to try file_get_contents
 to see if it's connection timeout can be controlled. It seems to
 work in a similar way to fopen, in terms of having wrappers that are
 aware of multiple resource types.

file_get_contents() seems to suffer from the exact same limitations of
file()

I get the simplicity of fopen() with no control over connection timeout.

Maybe there is some underlying voodoo going on in the PHP internals
that some makes it crystal-clear why that has to be, but to this naive
user, if fsockopen can have a timeout, fopen and friends out to be
able to also, at least for schemes that support such a thing.

Obviously SOME kind of timeout is involved somewhere in fopen()
because it WILL timeout on some sites sometimes, even though
experimentation has shown that had it waited, it would have gotten
data eventually.

 It might also be worth taking a look at cURL or similar libraries
 that are also multi-resource aware, but give you greater control of
 connections parameters and timeouts.

Maybe I've been mis-using cURL all these years, but it doesn't seem to
be anywhere near as simple as the mythical function I've described,
and really not much better than a giant switch for fsockopen to
duplicate all that code that's gotta be down in the guts of fopen (and
friends)

-- 
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] Sessions

2006-01-19 Thread Richard Lynch


You changed php.ini back to 'user' instead of 'file' for the session
handling?

You re-started the web-server? (Apache, IIS, whatever)

If it's a Windows box, reboot for good measure.

On Thu, January 19, 2006 3:29 pm, PHP Mail wrote:
 Hi



 My site is running a custom session handler (into MySQL 3.28). all was
 well
 until I needed to test session in files. it was only a 5 minute test



 Now I can't get the DB sessions active. Absolutely nothing is
 registering in
 the DB



 PHP version is 4.3.10. Help please because I can't figure this out.
 I've
 tried everything I can think of



 TIA



 Dan










-- 
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] (Fwd) inserting text into a mime message

2006-01-19 Thread Richard Lynch
Sounds like they all hit the same wall you have hit...

Could be an opportunity...

:-)

On Thu, January 19, 2006 4:55 pm, Geoff wrote:
 It seems to me that if you looked at the raw email and found the
 boundary, and focused on the only mime-types you care about, you'd
 be able to hack the file pretty easily...

 I just may have to do that. One problem though is that many mails
 are encoded in some way (I mean byte-encoding, like base 64) and I
 was hoping to make use of the transparent decoding capability of a
 class or library made to do that sort of thing. But if I cannot,
 then yours is the approach I will probably use.

 All them lawyerly crapola signatures outside the control of the
 actual user implies that there is SOME kind of software available
 to do it...

 ...but many of them are in commercial packages, or are plugins to
 MSExchange or similar. And most of the open-source ones only stick
 the footer in the first piece of text/plain that they find, without
 being aware of multiparts.

 Thanks,

 Geoff.


 On 19 Jan 2006 at 16:38, Richard Lynch wrote:

 All them lawyerly crapola signatures outside the control of the
 actual
 user implies that there is SOME kind of software available to do
 it...

 It seems to me that if you looked at the raw email and found the
 boundary, and focused on the only mime-types you care about, you'd
 be
 able to hack the file pretty easily...

 And if it's not mime-encoded, it's just text, and a simple fopen($x,
 'a'); fwrite($x, $sig); fclose($x); would do it.

 Maybe I'm over-simplifying something?


 On Thu, January 19, 2006 4:22 pm, Geoff wrote:
  Nobody got any ideas on this? I would be interested to hear from
  anyone who has successfully adjusted parts of an email message
 while
  it is in transit, by ANY method. I'm getting desparate and will
 try
  anything, even if it is not 100% PHP.
 
  All ideas, suggestions greatly appreciated.
 
  Geoff.
 
 
  --- Forwarded message follows ---
  From:  Geoff [EMAIL PROTECTED]
  To:php-general@lists.php.net
  Subject:   inserting text into a mime message
  Date sent: Thu, 19 Jan 2006 10:51:37 +0200
 
  Hi All,
 
  I've been searching the archives for help on this, but have come
 up
  empty-handed. Here's the thing:
 
  I'm using a PHP script to parse every message coming through a
  mailserver. The server invokes my script for each message, giving
 it
  a filename containing the full raw text of the email. The script
  needs to modify the raw message file, inserting a footer (some
  trailing text, eg: a disclaimer) at the end of each part of
 readable
  message. It doesn't touch file attachments, but it needs to insert
  the footer in any plaintext, HTML text or both (if they exist).
 
  There are so many different mime options and encoding types that
 it
  seemed like re-inventing the wheel to try working with only the
 raw
  message text, so instead I decided to use the PEAR Mail_mimeDecode
  module, which returns a very nice object array of all the parts,
  decoded and ready for use.
 
  It's no problem going through this and inserting the footer
 wherever
  it is needed. That much I've done.
 
  My problem is trying to rebuild that object array (the output of
 the
  Mail_mimeDecode::decode() function) back into its raw form once
  again, so that I can write the modified raw text back to the
 message
  file and the email can go on its way.
 
  Another complication is that except for the insertion of the
 footer,
  I cannot modify the original message. All the headers, dates,
  receive-paths, etc, must remain unchanged.
 
  Has anybody ever done anything like this before - re-encoding a
  message that had been decoded by Mail_mimeDecode::decode()? I've
  looked at the encode() function, but it seems to be used for
 making
  a simple message from scratch (with just one body part), it is not
  really the opposite of decode(). [I may be wrong about this -
 there
  are no examples in the PEAR manual].
 
  I'm not hung up about what to use, it doesn't have to be PEAR, I
  will use any library or code that will do the job. Alternatively,
 if
  it is possible to do this with encode(), I would love to see an
  example, as I couldn't get it to work that way myself.
 
  Many thanks.
 
  Geoff.
 
  --- End of forwarded message ---
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --
 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



 !DSPAM:43d0236364872042218820!






-- 
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] generate database driven web pages

2006-01-19 Thread Richard Lynch
On Tue, January 17, 2006 4:27 pm, Bing Du wrote:
 Hello everyone,

 Here is what I want to accomplish.  Query the backend database and
 generate a page listing all the staff members in table format that has
 name, title, phone and office address.  Staff name should be a link.
 Clicking the link should query the database again and use the
 information retrieved (e.g. projects, educations, etc.) to generate a
 page for each staff member.  A staff list page can be generated pretty
 easily.

 Now my question is how to keep the staffID (although it is not shown
 on
 the staff list page, but is queried along with name, title, etc.) so
 that when a staff name is clicked, his/her staffID will then be used
 to
 query the DB for personal information.

 Anybody have any handy working examples to give me some hints?

if (isset($_REQUEST['staff_id'])){
  $staff_id = (int) $_REQUEST['staff_id']; //crude but effective
filtering / validation
  $query = select * from staff where staff_id = $staff_id;
  //next line is BAD CODE, for example purposes only:
  $detailed_profile = mysql_query($query) or die(mysql_error());
  $row = mysql_fetch_row($detailed_profile);
  //this is not so pretty...
  echo pre; var_dump($row); echo /pre\n;
}
else{
  $query = select staff_id, name from staff order by name;
  //more bad code next line (see above):
  $staff = mysql_query($query) or die(mysql_error());
  while (list($staff_id, $name) = mysql_fetch_row($staff)){
echo a
href=\$_SERVER[PHP_SELF]?staff_id=$staff_id\$name/abr /\n;
  }
}

-- 
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] PHP and LDAP...

2006-01-19 Thread Richard Lynch
On Tue, January 17, 2006 3:08 am, David BERCOT wrote:
 I'm new on this list and with PHP. But I am a old web developer (with
 ASP).
 I'm looking for verifying a username/password in Active Directory with
 a
 LDAP request...
 I have this error :
 Warning: ldap_search() [function.ldap-search]: Search: Operations
 error
 in /var/www/ldap.html on line 69

 I think my criterias are not OK but I think there are classical :
 $sr=ldap_search($ds,o=Justice, c=FR,(sn=Berc*));

 Do you have a little example which always return an answer, in AD or
 in
 true LDAP (because I have two different servers) ?

 Then, I have another question... As I said, I'd like to verify
 username/password. Is it possible ? With AD ? With LDAP ?
 Is the password clear on network ? Do I have some solutions to resolve
 that problem ?

I don't know the answer directly, but I do know this:

You should get it to work with real LDAP first, using OpenSource
tutorials, help, etc.

This is probably going to be fairly easy once you focus on just PHP +
LDAP.

Then attack Active Directory as a separate problem, because there are
some funky things with AD -- but you can probably find them here:
http://info.com/PHP+LDAP+Active+Directory

-- 
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: Using GPG in Safe Mode

2006-01-19 Thread Edwin Barrios
Hi, emil

Using safe_mode_exec_dir, it's a solution if  you has access to your
php.ini or http.conf, because it's a PHP_INI_SYSTEM var. For these reason
you can't set this var with ini_set() function on a php script.

If your ISP has a very restricted setting, i think that the solutions that
comex comments it's a good one, it'sn't my prefered solution by security
issues.

P.S.D
i never have proved if setting PHP_INI_SYSTEM vars it's posible on a
.htacces file.



On 1/18/06, M [EMAIL PROTECTED] wrote:

 [EMAIL PROTECTED] wrote:
  Hi Edwin!
 
  Thanks for the tips but my ISP hasn't given me root. I'm very sad to
 hear gpg from cli won't work under safe mode. Are there any 100% php
 implementations of GPG I could use? (because I guess that is the only way
 that is left?)
 
  /Emil
 
 
 If you are using gnupg comand line, there is not way on PHP-safe mode.
 The only way that i know to wrap around this problem it's install pecl
 extension package
 

 there is a way. if gpg binary is in safe_mode_exec_dir

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




Re: [PHP] how 2 open File Browser window in PHP

2006-01-19 Thread Richard Lynch
On Tue, January 17, 2006 1:38 am, suresh kumar wrote:
  i dont know   exact  PHP code for how 2 open file browser window
 to uplad file or an image plz help me.its very urgent.

form enctype=multipart/form-data
input type=file name=upload /
input type=submit /
/form

Forgetting the enctype is the most common problem.

Did I mention you needed an ENCTYPE attribute in the FORM tag?

-- 
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] Site down?

2006-01-19 Thread Richard Lynch
On Tue, January 17, 2006 12:34 am, Dotan Cohen wrote:
 I just noticed that http://www.io.org/~rasmus is down. Anybody else
 remember this site?

WILD GUESS:
http://www.lerdorf.ca/
???

-- 
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



  1   2   >