OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 20 Jul 2004 06:20:34 -0000 Issue 2887

php-general-digest-helplists.php.net
Date: Tue Jul 20 2004 - 01:20:34 CDT


php-general Digest 20 Jul 2004 06:20:34 -0000 Issue 2887

Topics (messages 191048 through 191115):

Re: Mixing $_POST with text in a variable
        191048 by: Jason Barnett
        191050 by: Torsten Roehr
        191051 by: Jay Blanchard
        191053 by: Markus Stobbs
        191054 by: Tim Traver
        191055 by: Cosmin Chiru
        191069 by: Justin Patrin
        191071 by: Skippy
        191073 by: Justin Patrin
        191075 by: Marek Kilimajer

Re: Sending email without an email server
        191049 by: robert mena
        191065 by: Justin Patrin

Re: Apache 2 and PHP for Production?
        191052 by: Lester Caine
        191059 by: Marten Lehmann
        191085 by: Jason Wong
        191102 by: Matthew Sims
        191104 by: Oliver John V. Tibi
        191107 by: Curt Zirzow

Re: is there anyway to use constants in a string?
        191056 by: Justin Patrin
        191057 by: barophobia
        191070 by: Justin Patrin
        191113 by: Jason Barnett

Login Script
        191058 by: Brian Krausz
        191060 by: Jason Barnett
        191061 by: Jay Blanchard
        191062 by: Brian Krausz
        191063 by: Jay Blanchard
        191064 by: Cosmin Chiru
        191066 by: Brian Krausz
        191067 by: Torsten Roehr
        191074 by: Matthew Sims
        191084 by: Jason Wong

Re: building php5.0 as an apache module, with mysqli functionality
        191068 by: bruce

Re: Embedded Email Directives
        191072 by: Manuel Lemos
        191082 by: Curt Zirzow
        191098 by: Jordi Canals
        191106 by: Curt Zirzow
        191111 by: Manuel Lemos
        191114 by: Curt Zirzow

Re: OT but need guidance in timing page views
        191076 by: Stephen Sadowski
        191083 by: Jason Wong

More PHPEclipse
        191077 by: C.F. Scheidecker Antunes

Importing Excel data using PHP
        191078 by: C.F. Scheidecker Antunes
        191079 by: Matt M.

Re: Warning: could not send message for past 1 hour]
        191080 by: Luis Croker

PHP XL2Web?
        191081 by: Eric Marden
        191110 by: Jason Barnett

Re: imagecreatefromjpeg fails on large files
        191086 by: tmp1000.fastmail.fm

Plain Number
        191087 by: Jeff Oien
        191091 by: Jay Blanchard
        191092 by: Justin Patrin
        191103 by: Matthew Sims

Compiling trouble.
        191088 by: Luis Croker

Dynamic function calls within the echo function, possible?
        191089 by: XeRnOuS ThE
        191090 by: Jay Blanchard
        191093 by: Justin Patrin
        191095 by: Jay Blanchard
        191096 by: Curt Zirzow
        191099 by: Sean Malloy
        191100 by: Sean Malloy
        191115 by: Justin Patrin

Re: Book Required
        191094 by: Stephen Allen

PHP configuration problem on Solaris 2.7
        191097 by: Mark Perkoski
        191101 by: Matthew Sims
        191108 by: Curt Zirzow

Array Losing value
        191105 by: Jonathan Villa
        191112 by: Jason Barnett

Re: Creating Rows and Columns Using for() Loops
        191109 by: php-list.xenonsolutions.com

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Markus Stobbs wrote:

> I'm changing my HTTP POST variable declarations from $variablename to
> $_POST['variablename'] to make my code more compliant with current best
> practices.
>
> However, I find that I cannot mix these new variable declarations into
> big variable strings like I used to. For example, this works:
>
> $message = "
> Name: $Name
> Division: $Division
> Phone: $Phone
> Email: $Email";
>
> ...but when I change $Name and the other variables to $_POST['Name'], I
> get this error:
>
> Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
> expecting T_STRING or T_VARIABLE or T_NUM_STRING in
> /web/scd/vets/Vislab/eventrequest.php on line 94

When you have a variable that is inside a text string (double quotes) like that
then you do not need to have the quotes for your array index. So in your case
something like this should work:

$message = "
Name: $_POST[Name]
Division: $_POST[Division]
Phone: $_POST[Phone]
Email: $_POST[Email]";

attached mail follows:


"Markus Stobbs" <mstobbsucar.edu> wrote in message
news:20040719171955.93613.qmailpb1.pair.com...
> I'm changing my HTTP POST variable declarations from $variablename to
> $_POST['variablename'] to make my code more compliant with current best
> practices.
>
> However, I find that I cannot mix these new variable declarations into
> big variable strings like I used to. For example, this works:
>
> $message = "
> Name: $Name
> Division: $Division
> Phone: $Phone
> Email: $Email";
>
> ...but when I change $Name and the other variables to $_POST['Name'], I
> get this error:
>
> Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
> expecting T_STRING or T_VARIABLE or T_NUM_STRING in
> /web/scd/vets/Vislab/eventrequest.php on line 94
>
> Is there any clean way to avoid having to completely reconstruct all my
> form mail messages by constantly closing quotes, using . to connect text
> and variables within the larger variable.
>
> Markus

Hi Markus,

try putting curly braces around the POST values like "{$_POST['Name']}".

Regards, Torsten Roehr

attached mail follows:


[snip]
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in
/web/scd/vets/Vislab/eventrequest.php on line 94
[/snip]

Can we see line 94 and +/- 10 lines in eventrequest.php please?

attached mail follows:


Jay,

Thanks for the response. Here's the code fragment. I'm basically building a
text variable $message which I send later in the script as an email. Line 94
is the only one where I have implemented $_POST. If I change it back to
$Name, the script works fine.

// format email message

$subject = "VisLab Event Request: $EventType";

$premessage = "This request was submitted via the VisLab Event Request Form
at:
http://vetsdev.ucar.edu/Vislab/eventrequest.php";

$message = "
Name: $_POST['Name']
Division: $Division

Phone: $Phone

Email: $Email

EventType: $EventType

Preferred Date: $PreferredDate

Preferred Start Time: $PreferredStartTime $AMPM

Duration: $DurationHrs hrs $DurationMins min

Participants: $Participants

Description: $Description

Special Needs: $SpecialNeeds";

> --- Jay Blanchard <jay.blanchardniicommunications.com> wrote: ---

> [snip]
> Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
> expecting T_STRING or T_VARIABLE or T_NUM_STRING in
> /web/scd/vets/Vislab/eventrequest.php on line 94
> [/snip]
>
> Can we see line 94 and +/- 10 lines in eventrequest.php please?
>

attached mail follows:


I think the better way is to use brackets to enclose your variable...

So it would look like this :

$message = "
Name: {$_POST['Name']}
Division: {$_POST['Division']}
Phone: {$_POST['Phone']}
Email: {$_POST['Email']}";

Tim.

At 11:15 AM 7/19/2004, Jason Barnett wrote:
>Markus Stobbs wrote:
>
>>I'm changing my HTTP POST variable declarations from $variablename to
>>$_POST['variablename'] to make my code more compliant with current best
>>practices.
>>However, I find that I cannot mix these new variable declarations into
>>big variable strings like I used to. For example, this works:
>>$message = "
>>Name: $Name
>>Division: $Division
>>Phone: $Phone
>>Email: $Email";
>>...but when I change $Name and the other variables to $_POST['Name'], I
>>get this error:
>>Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
>>T_STRING or T_VARIABLE or T_NUM_STRING in
>>/web/scd/vets/Vislab/eventrequest.php on line 94
>
>When you have a variable that is inside a text string (double quotes) like
>that then you do not need to have the quotes for your array index. So in
>your case something like this should work:
>
>$message = "
>Name: $_POST[Name]
>Division: $_POST[Division]
>Phone: $_POST[Phone]
>Email: $_POST[Email]";
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Hello Markus,

Monday, July 19, 2004, 8:17:24 PM, you wrote:

> I'm changing my HTTP POST variable declarations from $variablename to
> $_POST['variablename'] to make my code more compliant with current best
> practices.

> However, I find that I cannot mix these new variable declarations into
> big variable strings like I used to. For example, this works:

> $message = "
> Name: $Name
> Division: $Division
> Phone: $Phone
> Email: $Email";

> ...but when I change $Name and the other variables to $_POST['Name'], I
> get this error:

> Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
> expecting T_STRING or T_VARIABLE or T_NUM_STRING in
> /web/scd/vets/Vislab/eventrequest.php on line 94

> Is there any clean way to avoid having to completely reconstruct all my
> form mail messages by constantly closing quotes, using . to connect text
> and variables within the larger variable.

> Markus

$message = "Name: $_POST['Name']\n";
$message .= "Division: $_POST['Division']\n";
$message .= "Phone: $_POST['Phone']\n";
$message .= "Email: $_POST['Email']\n";

--
Best regards,
 Cosmin mailto:Psychewolfheart.ro

attached mail follows:


On Mon, 19 Jul 2004 11:17:24 -0600, Markus Stobbs <mstobbsucar.edu> wrote:
> I'm changing my HTTP POST variable declarations from $variablename to
> $_POST['variablename'] to make my code more compliant with current best
> practices.
>
> However, I find that I cannot mix these new variable declarations into
> big variable strings like I used to. For example, this works:
>
> $message = "
> Name: $Name
> Division: $Division
> Phone: $Phone
> Email: $Email";
>
> ...but when I change $Name and the other variables to $_POST['Name'], I
> get this error:
>
> Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
> expecting T_STRING or T_VARIABLE or T_NUM_STRING in
> /web/scd/vets/Vislab/eventrequest.php on line 94
>
> Is there any clean way to avoid having to completely reconstruct all my
> form mail messages by constantly closing quotes, using . to connect text
> and variables within the larger variable.
>

IMHO, it's best to use single quotes for strings (less parsing
overhead) and use concatenation for things like this.

$message = '
Name: '.$_POST['Name'].'
Division: '.$_POST['Division'].'
Phone: '.$_POST['Phone'].'
Email: '.$_POST['Email'];

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


On Mon, 19 Jul 2004 14:15:09 -0400 Jason Barnett <jasbarneindiana.edu>
wrote:
> Markus Stobbs wrote:
> > $message = "
> > Name: $Name
> > Division: $Division
> > Phone: $Phone
> > Email: $Email";
> >
> > ...but when I change $Name and the other variables to $_POST['Name'], I
> > get this error:
> >
> > Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
> > expecting T_STRING or T_VARIABLE or T_NUM_STRING in
> > /web/scd/vets/Vislab/eventrequest.php on line 94
>
> When you have a variable that is inside a text string (double quotes) like
> that then you do not need to have the quotes for your array index. So in
> your case something like this should work:
>
> $message = "
> Name: $_POST[Name]
> Division: $_POST[Division]
> Phone: $_POST[Phone]
> Email: $_POST[Email]";

I think this is just solving one bad practice (inserting array elements
directly in strings) with another (letting undefined constants such as Name
pass as variable values).

The problem for Markus is that there's a limit to what kind of variables you
can use directly inside strings. In particular, as he noticed, array elements
referred by association ($_POST['Name']) won't work.

Your workaround uses a trick: by not enclosing the element identificator
(Name) in quotes, it is considered to be a constant. Since there's no
constant with that name defined, it evaluates to the name of the constant,
which is Name. This is bad practice; the manual page for constants
specifically calls it that. And because you don't use quotes to delimitate
the identificator, you don't have Markus's problem.

The proper solution is to use string concatenation and thus place your
variables outside of the string:

$message = "
Name: ".$_POST['Name']."
Division: ".$_POST['Division']."
Phone: ".$_POST['Phone']."
Email: ".$_POST['Email'];

It's good habit to restrain yourself from both the above bad practices.
Try to always use concatenation and specifically put variables outside of
strings, and always use the quotes for array identificators. Once the habit
is in you'll have less headaches to worry about.

--
Skippy - Romanian Web Developers - http://ROWD.ORG

attached mail follows:


On Mon, 19 Jul 2004 22:01:01 +0300, Skippy <skippyzuavra.net> wrote:
> On Mon, 19 Jul 2004 14:15:09 -0400 Jason Barnett <jasbarneindiana.edu>
> wrote:
> > Markus Stobbs wrote:
> > > $message = "
> > > Name: $Name
> > > Division: $Division
> > > Phone: $Phone
> > > Email: $Email";
> > >
> > > ...but when I change $Name and the other variables to $_POST['Name'], I
> > > get this error:
> > >
> > > Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
> > > expecting T_STRING or T_VARIABLE or T_NUM_STRING in
> > > /web/scd/vets/Vislab/eventrequest.php on line 94
> >
> > When you have a variable that is inside a text string (double quotes) like
> > that then you do not need to have the quotes for your array index. So in
> > your case something like this should work:
> >
> > $message = "
> > Name: $_POST[Name]
> > Division: $_POST[Division]
> > Phone: $_POST[Phone]
> > Email: $_POST[Email]";
>
> I think this is just solving one bad practice (inserting array elements
> directly in strings) with another (letting undefined constants such as Name
> pass as variable values).
>
> The problem for Markus is that there's a limit to what kind of variables you
> can use directly inside strings. In particular, as he noticed, array elements
> referred by association ($_POST['Name']) won't work.
>
> Your workaround uses a trick: by not enclosing the element identificator
> (Name) in quotes, it is considered to be a constant. Since there's no
> constant with that name defined, it evaluates to the name of the constant,
> which is Name. This is bad practice; the manual page for constants
> specifically calls it that. And because you don't use quotes to delimitate
> the identificator, you don't have Markus's problem.
>
> The proper solution is to use string concatenation and thus place your
> variables outside of the string:
>
> $message = "
> Name: ".$_POST['Name']."
> Division: ".$_POST['Division']."
> Phone: ".$_POST['Phone']."
> Email: ".$_POST['Email'];
>
> It's good habit to restrain yourself from both the above bad practices.
> Try to always use concatenation and specifically put variables outside of
> strings, and always use the quotes for array identificators. Once the habit
> is in you'll have less headaches to worry about.
>

And if you follow the concatenation idea, you should also use single
quotes around your strings unless you need things like \n and \t.
Single quotes are not parsed for backslash replacements (except \\ and
\') and variables, so they give a slight performance increase.

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


Skippy wrote:
> On Mon, 19 Jul 2004 14:15:09 -0400 Jason Barnett <jasbarneindiana.edu>
> wrote:
>
>>Markus Stobbs wrote:
>>
>>>$message = "
>>>Name: $Name
>>>Division: $Division
>>>Phone: $Phone
>>>Email: $Email";
>>>
>>>...but when I change $Name and the other variables to $_POST['Name'], I
>>>get this error:
>>>
>>>Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
>>>expecting T_STRING or T_VARIABLE or T_NUM_STRING in
>>>/web/scd/vets/Vislab/eventrequest.php on line 94
>>
>>When you have a variable that is inside a text string (double quotes) like
>>that then you do not need to have the quotes for your array index. So in
>>your case something like this should work:
>>
>>$message = "
>>Name: $_POST[Name]
>>Division: $_POST[Division]
>>Phone: $_POST[Phone]
>>Email: $_POST[Email]";
>
>
> I think this is just solving one bad practice (inserting array elements
> directly in strings) with another (letting undefined constants such as Name
> pass as variable values).
>
> The problem for Markus is that there's a limit to what kind of variables you
> can use directly inside strings. In particular, as he noticed, array elements
> referred by association ($_POST['Name']) won't work.

Not quite true

>
> Your workaround uses a trick: by not enclosing the element identificator
> (Name) in quotes, it is considered to be a constant. Since there's no
> constant with that name defined, it evaluates to the name of the constant,
> which is Name. This is bad practice; the manual page for constants
> specifically calls it that. And because you don't use quotes to delimitate
> the identificator, you don't have Markus's problem.

It is completely legal. Name, Division, Phone and Email are not
constants, because they are in a string:

"Name: $_POST[Name]";
  ^^^^ ^^^^
  | |
  string string

attached mail follows:


Hi jason,

I've added the SMTP to a smtp server, saved the .ini and restarted the
server with no luck.

It complains

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:"
header missing in c:\program files\apache
group\apache\htdocs\email.php on line 131

Line 131 is the end of the file (?>)

The mail command is

mail("Webmail <".$emailTo.">","[Contact]",$msg,"From: Webmail
<webmaildomain.com> \nReply-To: ".$name." <".$emailFrom.">\n");

Any tips ?

On Tue, 13 Jul 2004 19:20:25 +0800, Jason Wong <php-generalgremlins.biz> wrote:
>
>
> On Tuesday 13 July 2004 18:46, robert mena wrote:
>
> > I have a small script hosted in a win32/apache/php4 enviroment where I
> > do not have a local email server.
> >
> > I was wondering how could I send emails either connecting directly to
> > the mx or sending through a relay.
>
> mail() on Windows system does (only) use SMTP. Just configure your php.ini
> correctly and it should work.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
>

attached mail follows:


Set this in your php.ini:
sendmail_from = "webmaildomain.com"

On Mon, 19 Jul 2004 14:17:17 -0400, robert mena <robert.menagmail.com> wrote:
> Hi jason,
>
> I've added the SMTP to a smtp server, saved the .ini and restarted the
> server with no luck.
>
> It complains
>
> Warning: mail(): "sendmail_from" not set in php.ini or custom "From:"
> header missing in c:\program files\apache
> group\apache\htdocs\email.php on line 131
>
> Line 131 is the end of the file (?>)
>
> The mail command is
>
> mail("Webmail <".$emailTo.">","[Contact]",$msg,"From: Webmail
> <webmaildomain.com> \nReply-To: ".$name." <".$emailFrom.">\n");
>
> Any tips ?
>
>
>
> On Tue, 13 Jul 2004 19:20:25 +0800, Jason Wong <php-generalgremlins.biz> wrote:
> >
> >
> > On Tuesday 13 July 2004 18:46, robert mena wrote:
> >
> > > I have a small script hosted in a win32/apache/php4 enviroment where I
> > > do not have a local email server.
> > >
> > > I was wondering how could I send emails either connecting directly to
> > > the mx or sending through a relay.
> >
> > mail() on Windows system does (only) use SMTP. Just configure your php.ini
> > correctly and it should work.
> >
> > --
> > Jason Wong -> Gremlins Associates -> www.gremlins.biz
> > Open Source Software Systems Integrators
> > * Web Design & Hosting * Internet & Intranet Applications Development *
> > ------------------------------------------
> > Search the list archives before you post
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> !DSPAM:40fc1472196622019318716!
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


Chris Hayes wrote:

>> And for a longer explaination:
>> http://marc.theaimsgroup.com/?l=php-dev&m=108736540021355&w=2
>
> Very well explained. Untill now this problem was explained to me with a
> lot of techno mumbo jumbo, and I could not make sense of it. But now I
> think I really understand what's going on.

And following the last line - I'm still running Apache2 with PHP5 on
Windows on an increasing number of sites, without a single problem to
date ;)

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services

attached mail follows:


Hi,

I just wanted to post almost the same question: PHP for Apache 2 is
idling around for years now. configure --with-apxs2 is still marked as
[EXPERIMENTAL] and the documentation still warns:

"Do not use Apache 2.0 and PHP in a production environment neither on
Unix nor on Windows."

What is the problem with PHP on Apache 2? Using the prefork-modell, it
seems to run fine? I thought, that Apache 2 will be supported better
with the 5.x releases of PHP, but all I said above reflects the state of
the latest PHP release (5.0.0).

Why shouldn't I use PHP 5.0.0 with Apache 2.0.50?

Regards
Marten

attached mail follows:


On Tuesday 20 July 2004 03:22, Marten Lehmann wrote:

> Why shouldn't I use PHP 5.0.0 with Apache 2.0.50?

You can, if it works for you, but ...

  http://marc.theaimsgroup.com/?l=php-general&m=107916708217647&w=2

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
spagmumps, n.:
        Any of the millions of Styrofoam wads that accompany mail-order items.
                -- "Sniglets", Rich Hall & Friends
*/

attached mail follows:


> On Tuesday 20 July 2004 03:22, Marten Lehmann wrote:
>
>> Why shouldn't I use PHP 5.0.0 with Apache 2.0.50?
>
> You can, if it works for you, but ...
>
> http://marc.theaimsgroup.com/?l=php-general&m=107916708217647&w=2
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz

Apache2 had been well known to not work completely with PHP. It's not
PHP's fault. Though some people have managed to get it right. YMMV.

You'll probably have an easier time using Apache1.3.

--Matthew Sims
--<http://killermookie.org>

attached mail follows:


Wow! And come to think of it, how did you do it? Or should I stick with
Apache1 until there is a viable solution to this upgrade dilemma?

--

Running 'ojtibi' on '127.0.0.1' (BATCH_OPTIMISTIC mode).
"Live free() or die()."

"Lester Caine" <lesterlsces.co.uk> wrote in message
news:20040719183244.99195.qmailpb1.pair.com...
> Chris Hayes wrote:
>
> >> And for a longer explaination:
> >> http://marc.theaimsgroup.com/?l=php-dev&m=108736540021355&w=2
> >
> > Very well explained. Untill now this problem was explained to me with a
> > lot of techno mumbo jumbo, and I could not make sense of it. But now I
> > think I really understand what's going on.
>
> And following the last line - I'm still running Apache2 with PHP5 on
> Windows on an increasing number of sites, without a single problem to
> date ;)
>
> --
> Lester Caine
> -----------------------------
> L.S.Caine Electronic Services

attached mail follows:


* Thus wrote Oliver John V. Tibi:
> Wow! And come to think of it, how did you do it? Or should I stick with
> Apache1 until there is a viable solution to this upgrade dilemma?

I would stay with stick with apache 1.x.

The only reason I would consider apache2 is if there was a module
only available in apache2 and no other reasonable solution that can
be done otherwise, that your site must have.

With apache2, I have one site that runs flawless, the other one has
spiratic wierd things happen that are unexplainable.

If you have an OS that installs apache2 by default (not to mention
any names) I would recomend an 'rpm delete apache2' and install
manually :)

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


On Mon, 19 Jul 2004 10:22:42 -0700, barophobia <barophobiagmail.com> wrote:
> hello.
>
> <?php
>
> define("MY_CONSTANT", "http://google.com/");
>
> $my_string = <<<QQQ
>
> MY_CONSTANT: does not work for obvious reasons
> {MY_CONSTANT}: does not work for obvious reasons
> {$MY_CONSTANT}: does not work for obvious reasons
>
> QQQ;
>
> ?>
>

$my_string = 'pre'.MY_CONSTANT.'post';

> here are my options:
>
> 1. assign the constant to a temporary variable and then use that.
>
> i.e. $tmp_MY_CONSTANT = MY_CONSTANT;
>
> 2. use an array instead of a constant
>
> i.e. $config['MY_CONSTANT'] = "http://google.com/";
>
> 3. find some secret way to work around the above two options and keep
> my constants.
>
> anybody have any ideas to share?
>
> chris.
>
> p.s. if you don't know the "obvious reasons" just say so and i (or
> someone else) will explain.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> !DSPAM:40fc053b159457466720899!
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


On Mon, 19 Jul 2004 11:48:02 -0700, Justin Patrin <papercranegmail.com> wrote:
> On Mon, 19 Jul 2004 10:22:42 -0700, barophobia <barophobiagmail.com> wrote:

> > $my_string = <<<QQQ
> >
> > MY_CONSTANT: does not work for obvious reasons
> > {MY_CONSTANT}: does not work for obvious reasons
> > {$MY_CONSTANT}: does not work for obvious reasons
> >
> > QQQ;

> $my_string = 'pre'.MY_CONSTANT.'post';

yeah but did you notice in my example i'm using a heredoc? i did that
on purpose. :)

chris.

attached mail follows:


Yes, I know. You can't use defined constants within a normal string,
so it won't work in a heredoc either:

define('FOO', 'bar');
echo "show me FOO";

You have to use:
echo 'show me '.FOO;

On Mon, 19 Jul 2004 12:05:40 -0700, barophobia <barophobiagmail.com> wrote:
> On Mon, 19 Jul 2004 11:48:02 -0700, Justin Patrin <papercranegmail.com> wrote:
> > On Mon, 19 Jul 2004 10:22:42 -0700, barophobia <barophobiagmail.com> wrote:
>
> > > $my_string = <<<QQQ
> > >
> > > MY_CONSTANT: does not work for obvious reasons
> > > {MY_CONSTANT}: does not work for obvious reasons
> > > {$MY_CONSTANT}: does not work for obvious reasons
> > >
> > > QQQ;
>
> > $my_string = 'pre'.MY_CONSTANT.'post';
>
> yeah but did you notice in my example i'm using a heredoc? i did that
> on purpose. :)
>
> chris.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> !DSPAM:40fc1eea223154764716344!
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


I was working on something else tonight when I literally stumbled across another
solution that works here... pick your poison:

<?php
$heredoc = <<<XML
<?xml version="1.0" encoding="iso-8859-1" ?>
<root>
   <node attribute="I am an attribute">
     <text>I am a text node.</text>
   </node>
   <dynamic>
     <string1>%1\$s</string1>
     <string1>%1\$s</string1>
     <string2>%2\$s</string2>
     <integer>%3\$d</integer>
   </dynamic>
</root>
XML;

echo '<pre>';
define ('string1', 'Well looky here, some text.');
define ('string2', 'Man, I wish I could be a knight who said nee!');
define ('integer', 123452345.23232);

$xml = sprintf($heredoc, string1, string2, integer);

print_r(htmlentities($xml));

?>

attached mail follows:


While I know there are many scripts out there, and have spent many hours
looking through them, I am having trouble finding a login script that
fits my needs. I am looking for the following:

A MySQL-based login system that doesn't use Pear :: DB. All I would
like is for it to support cookies and all those things that would make
it more secure.

I have had trouble finding this...any suggestions?

Thanks

attached mail follows:


Brian Krausz wrote:
> While I know there are many scripts out there, and have spent many hours
> looking through them, I am having trouble finding a login script that
> fits my needs. I am looking for the following:
>
> A MySQL-based login system that doesn't use Pear :: DB. All I would
> like is for it to support cookies and all those things that would make
> it more secure.
>
> I have had trouble finding this...any suggestions?
>
> Thanks

Build one yourself? We can all pitch in and help you out if/when you have any
questions. In a few hours' time you could at least get a simple login started,
then you can figure out where to go from there.

attached mail follows:


[snip]
While I know there are many scripts out there, and have spent many hours

looking through them, I am having trouble finding a login script that
fits my needs. I am looking for the following:

A MySQL-based login system that doesn't use Pear :: DB. All I would
like is for it to support cookies and all those things that would make
it more secure.

I have had trouble finding this...any suggestions?
[/snip]

Do you mean a login script where the username and password are stored in
a MySQL database table? One where if the login is good a cookie is set?

Nope.

:)

attached mail follows:


Well I already have a db with username/password fields, etc. I'm just
looking for code for a login page and a file to include at the top of
each page for auth.

Jay Blanchard wrote:
> [snip]
> While I know there are many scripts out there, and have spent many hours
>
> looking through them, I am having trouble finding a login script that
> fits my needs. I am looking for the following:
>
> A MySQL-based login system that doesn't use Pear :: DB. All I would
> like is for it to support cookies and all those things that would make
> it more secure.
>
> I have had trouble finding this...any suggestions?
> [/snip]
>
> Do you mean a login script where the username and password are stored in
> a MySQL database table? One where if the login is good a cookie is set?
>
>
> Nope.
>
>
>
> :)

attached mail follows:


[snip]
Well I already have a db with username/password fields, etc. I'm just
looking for code for a login page and a file to include at the top of
each page for auth.
[/snip]

a. do not reply off-list unless asked, your question may not receive the
attention it needs

2. You do know basic PHP, correct? Create a page that accepts a username
and password. Have the un and pw checked against the db. If it is good,
set a cookie and check for the cookie with each page, if not redirect to
the proper location.

attached mail follows:


Hello Brian,

Take a look at setcookie() in the PHP manual. The algorithm is pretty
simple. Once the user submits the form, you compare form data with the
data in the database. If the password matches, then set a cookie with
the username (using setcookie()). Then you'll just have to check if the
cookie is set - if(isset($_COOKIE['username'])) {...} - and if it's set,
proceed to user page; if not, display the login form again.

--
Best regards,
 Cosmin

attached mail follows:


[snip]
a. do not reply off-list unless asked, your question may not receive the
attention it needs
[/snip]
Sorry, I got the email before the board post so I assumed you were only
replying off-list.

[snip]
2. You do know basic PHP, correct? Create a page that accepts a username
and password. Have the un and pw checked against the db. If it is good,
set a cookie and check for the cookie with each page, if not redirect to
the proper location.
[/snip]
My 2 main concern are security and user-friendlyness. I would like
anyone (regardless of cookies being allowed or not) to be able to use my
service, but I would still like it to be secure.

But I guess I'll try making my own script...worth a shot.

attached mail follows:


"Brian Krausz" <briannerdlife.net> wrote in message
news:20040719195920.87535.qmailpb1.pair.com...
> [snip]
> a. do not reply off-list unless asked, your question may not receive the
> attention it needs
> [/snip]
> Sorry, I got the email before the board post so I assumed you were only
> replying off-list.
>
> [snip]
> 2. You do know basic PHP, correct? Create a page that accepts a username
> and password. Have the un and pw checked against the db. If it is good,
> set a cookie and check for the cookie with each page, if not redirect to
> the proper location.
> [/snip]
> My 2 main concern are security and user-friendlyness. I would like
> anyone (regardless of cookies being allowed or not) to be able to use my
> service, but I would still like it to be secure.
>
> But I guess I'll try making my own script...worth a shot.

Hi Brian,

if you want to be independent of the user's browser cookie settings you have
to pass the session id from page to page via POST (e.g. as a hidden field in
a form) or GET:

<a href="page2.php<?php= SID ?>">link</a>

I would recommend searching the mailing list archives. You will find LOADS
of useful information on sessions.

Regards, Torsten Roehr

attached mail follows:


> [snip]
> a. do not reply off-list unless asked, your question may not receive the
> attention it needs
> [/snip]
> Sorry, I got the email before the board post so I assumed you were only
> replying off-list.
>
> [snip]
> 2. You do know basic PHP, correct? Create a page that accepts a username
> and password. Have the un and pw checked against the db. If it is good,
> set a cookie and check for the cookie with each page, if not redirect to
> the proper location.
> [/snip]
> My 2 main concern are security and user-friendlyness. I would like
> anyone (regardless of cookies being allowed or not) to be able to use my
> service, but I would still like it to be secure.
>

If security is in mind, adding SSL to your website is a great start.

--Matthew Sims
--<http://killermookie.org>

attached mail follows:


On Tuesday 20 July 2004 03:24, Brian Krausz wrote:
> While I know there are many scripts out there, and have spent many hours
> looking through them, I am having trouble finding a login script that
> fits my needs. I am looking for the following:
>
> A MySQL-based login system that doesn't use Pear :: DB. All I would
> like is for it to support cookies and all those things that would make
> it more secure.
>
> I have had trouble finding this...any suggestions?

I find it hard to believe that there is nothing out there that suits your
purpose. But anyway, it would be helpful if you listed what packages you've
tried that didn't meet your requirements so people don't recommend those.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Life is both difficult and time consuming.
*/

attached mail follows:


hi...

in regards to the php5/mysql/mysqli/apache2 issue...

the following should be helpful... i've managed to get it working, so that i
have mysql and mysqli both being displayed using "phpinfo()"...

----------------------------
for a linux rh8.0
use mysql-4.1.3-beta.tar.gz
copy it to whatever dir you want it in (eg.. /usr/src)
gunzip mysql-4.1.3-beta.tar.gz
tar -xvf mysql-4.1.3-beta.tar (which creates a mysql-4.1.3-beta dir and
places the files underneath)

i prefer to build the mysql code by using the default process...
./configure
make clean
make
make install

(this builds the required rpms)
i then install the rpms
rpm -ivh MySQL-server-4.1.3-0.i386.rpm
rpm -ivh MySQL-devel-4.1.3-0.i386.rpm
rpm -ivh MySQL-shared-4.1.3-0.i386.rpm

(if you're building php on a client system with mysql/mysqli on another
box, you can leave off the server rpm)

at this point, you now have the basic libs for mysql installed...

go ahead and do the php..

use php-5.0.0.tar.gz

copy it to whatever dir you want it in (eg.. /usr/src)
gunzip php-5.0.0.tar.gz
tar -xvf php-5.0.0.tar (which creates a php-5.0.0 dir and places the files
underneath)

i've found that it appears that you need to make sure /usr/local/mysql/lib
is clean off
any "mysql lib*" stuff to prevent conflicts with old mysql versions...
it looks like if you do a
rpm -ivh --force MySQL-devel-4.1.3-0.i386.rpm
rpm -ivh --force MySQL-shared-4.1.3-0.i386.rpm

then the shared libs are placed in the
/usr/lib
/usr/lib/mysql dir structure...

(you can see where files are placed by doing a "rpm -qpl MySQL-**.rpm")

set up the "./configure" using
./configure --with-apxs2=/usr/sbin/apxs --with-config-file-path=/etc --with
-mysql=/usr --with-mysqli=/usr/local/mysql/bin/mysql_config --with-ldap --wi
th-pgsql

(you might choose different options depending on your needs...)

/usr/lib/mysql/libdbug.a
/usr/lib/mysql/libheap.a
/usr/lib/mysql/libmerge.a
/usr/lib/mysql/libmyisam.a
/usr/lib/mysql/libmyisammrg.a
/usr/lib/mysql/libmysqlclient.a
/usr/lib/mysql/libmysqlclient.la
/usr/lib/mysql/libmysqlclient_r.a
/usr/lib/mysql/libmysqlclient_r.la
/usr/lib/mysql/libmystrings.a
/usr/lib/mysql/libmysys.a
/usr/lib/mysql/libnisam.a
/usr/lib/mysql/libvio.a

make clean
./configure
make
make install

the results at this stage are a clean build with a libphp5.so...

make the required changes to the httpd.conf/php.ini files, restart httpd and
you should be up/running....

feel free to make any suggestions/changes.. this should help those who've
been struggling to get this working!!!!

-bruce

-----Original Message-----
From: Curt Zirzow [mailto:php-generalzirzow.dyndns.org]
Sent: Sunday, July 18, 2004 7:23 PM
To: bruce
Cc: mysqllists.mysql.com; php-generallists.php.net;
devhttpd.apache.org; usershttpd.apache.org
Subject: Re: [PHP] building php5.0 as an apache module, with mysqli
functionality

* Thus wrote bruce:
> hi...
>
> this is cross posted to a number of lists as it seems to touch on all the
> apps...

Please don't do this.

>
> i'm trying to use the following "configure"
>
>
./configure --with-apxs2=/usr/sbin/apxs --with-config-file-path=/etc --with
> -mysql=/usr/include/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config
 -
> -with-ldap --with-pgsql

If you read the installation at http://php.net/mysqli, you can not
include two versions of mysql and mysqli client libraries.

> the issue i'm having is that i can't get make portion to work without
> returning "multiple define" errors like
>
> [rootlserver2 php-5.0.0]# make
> /bin/sh
/usr/src/php-5.0.0/libtool --silent --preserve-dup-deps --mode=link
>
> [snip way to much output ]

Can you compile mysql without mysqli and vise versa without
problems?

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


Hello,

On 07/19/2004 11:45 AM, Justin Patrin wrote:
> As you can see, Curt, and others, it's impossible to talk to Manuel as
> he has an obvious bias for his own site and always assumes that
> anything you say is an attack on him or his site personally. He
> doesn't read what you write and says the same things over and over.
>
> I just leave his posts alone now and give users the option of using
> PEAR classes and simple PHP code as well. I really don't care if they
> use something over PEAR, it's the user's decision.

Thank you for confirming what I previously described as "PEAR zealots
that pop in once in a while". Curt was trying to pass the impression
that this thing of PEAR zealots that try to compete with the PHP Classes
site was something that I invented.

You may recall this thread below when you decide to push PEAR mail
package to do something that the original poster requested but PEAR mail
package could not do which was a way to send messages without relaying
in an intermediate SMTP server, which is a feature that AFAIK, only my
mail classes provide.

http://www.phpbuilder.com/lists/php-windows/2004021/index.php#98

When you finally realized that PEAR mail could not do what the original
poster asked, you even presented a copied solution that was proposed to
PEAR but ended up being discarded for the lack of interest from the PEAR
developers apparently because in the PEAR discussion it was proven that
your implementation was weak as it did not address the concerns raised
by them.

This is just to remind you that what you claim about me that I do not
read what others write, applies directly to you because you
systematically recommend PEAR solutions in reaction to my
recommendations that happen to be classes available in the PHP Classes site.

I do not have a problem that you do that as long as you address the
original poster problem, which often you don't. But "you should not
through stones to me when your roof is made of glass".

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

attached mail follows:


* Thus wrote Manuel Lemos:
> Hello,
>
> Thank you for confirming what I previously described as "PEAR zealots
> that pop in once in a while". Curt was trying to pass the impression
> that this thing of PEAR zealots that try to compete with the PHP Classes
> site was something that I invented.

Um, I think I have to repeat myself to many times. I am in no way
associated with PEAR.

Your infatuation with Pear zealots sure seems to cause you problems.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


Jordi Canals wrote:

> Dennis Gearon wrote:
>
> > remove carriage returns to prevent embedded email directives
>
> In an other thread, I readed that sentence. I'm interested to find more
> information about that. I have some mail forms and want to make them as
> secure and possible, but do not know about what and where should I filter.
>
> Should I filter all CR and LF Just in headers or also I should do that
> in the message body? (Which is sent in the SMTP DATA section).
>
After the big threat that followed my question, just want to say a
couple of things:

I only wanted to know how to prevent embedded email directives sent by
user, and if this directives can be found in the Headers or in the Body
of message.

I normally use the mail() function (In Linux) and rarely use any class
to send mail. Just because all e-mail I send from a website normally is
plain text with no attachments. Even sending mails in HTML had no
problems if we follow the standards.

The only problem I had with the function, was with a windows site and
about bad header composition. I can see this is the only bug opened and
assigned related to the mail function
(http://bugs.php.net/bug.php?id=28038). Hope Wez will correct it some day ;)

Except this case, the mail() function always worked for me.

Regards,
Jordi Canals

attached mail follows:


* Thus wrote Jordi Canals:
> Jordi Canals wrote:
>
> >Dennis Gearon wrote:
> >
> > > remove carriage returns to prevent embedded email directives
> >
> >In an other thread, I readed that sentence. I'm interested to find more
> >information about that. I have some mail forms and want to make them as
> >secure and possible, but do not know about what and where should I filter.
> >
> >Should I filter all CR and LF Just in headers or also I should do that
> >in the message body? (Which is sent in the SMTP DATA section).
> >
> After the big threat that followed my question, just want to say a
> couple of things:
>
> I only wanted to know how to prevent embedded email directives sent by
> user, and if this directives can be found in the Headers or in the Body
> of message.

One of the things to ensure you dont do is blindly allow user
entered data sending into the $headers portion of the mail() call
for example:

  $headers = 'CC: ' . $_POST['CC'] . "\r\n";
  
The user can easily trick another 'rcpt to:' or other smtp headers
into the posted CC variable.

Be expecially careful if you allow any data to the 5th parameter
(the one that passes arguments to sendmail).

The $to and $subject lines get 'filtered' so \r \n or \t get
translated to ' ', to prevent such injection.

It basically comes down to the fact that any time you are sending
any sort of data to an external program, being either a shell exec,
database query, mail() etc. Validation of the data should be done.

Thanks for your patients.. And double thanks for bringing this
topic back under control :)

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


Hello,

On 07/19/2004 10:46 PM, Jordi Canals wrote:
>> > remove carriage returns to prevent embedded email directives
>>
>> In an other thread, I readed that sentence. I'm interested to find
>> more information about that. I have some mail forms and want to make
>> them as secure and possible, but do not know about what and where
>> should I filter.
>>
>> Should I filter all CR and LF Just in headers or also I should do that
>> in the message body? (Which is sent in the SMTP DATA section).
>>
> After the big threat that followed my question, just want to say a
> couple of things:
>
> I only wanted to know how to prevent embedded email directives sent by
> user, and if this directives can be found in the Headers or in the Body
> of message.

If you do not exclude whatever characters may have special meanings in
the message, undesirable effects may happen. You should not take
arbitrary definitions of headers without validating them.

For instance, if you are taking e-mail addresses from user input, you
need to validate them for instance with a regular expression.

You may also validate the actual (non-)existance of the addresses to
prevent user typos by actually consulting the destination SMTP server
but that may be more than what you need now.

> I normally use the mail() function (In Linux) and rarely use any class
> to send mail. Just because all e-mail I send from a website normally is
> plain text with no attachments. Even sending mails in HTML had no
> problems if we follow the standards.

Following the standards today is not enough. Due to the growth of spam,
many e-mail account provides have installed filters that reject messages
that follow the standards and are not really spam. For instance, if you
send a plain HTML message to an Hotmail account, it may end up being
tagged as spam and the recipient never sees it.

> The only problem I had with the function, was with a windows site and
> about bad header composition. I can see this is the only bug opened and
> assigned related to the mail function
> (http://bugs.php.net/bug.php?id=28038). Hope Wez will correct it some
> day ;)
>
> Except this case, the mail() function always worked for me.

Nah, the mail function does not have bugs, even less it does wrong
filtering. Ask Curt, and he'll tell you it is all Manuel Lemos
imagination trying to push you to his site! (sorry couldn't resist! ;-) )

Now seriously, apart from the actual bug reported above, your last
remark about the Return-Path header is a result of a misunderstanding.

Believe it or not, that misunderstanding is probably my fault. What
happens the way to specify the bounce address where messages that can't
be delivered are bounced, depends on the way you send your messages:
mail() function, SMTP, sendmail program, qmail program, etc.. Those are
the delivery methods that are supported by this class for composing and
sending messages that I started developing in 1999.

http://www.phpclasses.org/mimemessage

To the bounce address delivery method independent, I have chosen the
Return-Path header to specify it. Then each of the classes responsible
for each delivery method process that header accordingly. However, this
header is virtual. Specifying it in a message is meaningless to the SMTP
protocol or any MTA.

I just have chosen that header name because MTAs adds that header to the
message during delivery but it does not have to be present when you pass
the message to the MTA and the receiving SMTP address may remove it when
the message is successfully received. You may read more about this
virtual header in the documentation of this class.

What happened is that some people that have read my messages telling to
use this class and the Return-Path header to set the bounce address
assumed that the Return-Path was something that would be interpreted by
the MTA. Setting the Return-Path with the bounce address was such a good
idea that several other PHP mailer classes also adopted the same convention.

Bottom line, adding the Return-Path header to a message is meaningless,
therefore the mail function is not expected to do anything with it.

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

attached mail follows:


* Thus wrote Manuel Lemos:
> Hello,
>
> Nah, the mail function does not have bugs, even less it does wrong
> filtering. Ask Curt, and he'll tell you it is all Manuel Lemos
> imagination trying to push you to his site! (sorry couldn't resist! ;-) )

Would you please desist from dragging your ego trips into all your
posts and leave me out of topics unlreated to what was indiscussed
earlier.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


> >>I know that this is somewhat off topic, but I just need a starting place
> >>to do the research and thought someone here might be able to help. I am
> >>developing an application in which I need to time how long a visitor
> >>remains within a module and how long they view each page.

It seems like alot of people are focusing on what you can't do. As the
client seems not to care, you could take the immediate approach and
mimic several other online education sites, combining JavaScript to
monitor the browsing habits and submitting a php script when the page
is left.

IE, use onload/onfocus to start a timer, onblur to pause it, and then
onunload to perhaps popup or popunder a new window, populate a form
with your necessary data, auto-submit and close that window. Sure, not
entirely accurate, and you can still fool it if you have the know-how,
but much more accurate than refreshing a frame every 2 minutes, and
you have control of a timer than can be stopped when the user's not
viewing the page.

IIRC, there are several 'defensive driving' online sites that use this
approach in the US.

-SS

attached mail follows:


On Tuesday 20 July 2004 05:41, Stephen Sadowski wrote:

> It seems like alot of people are focusing on what you can't do.

Doing something which is plainly pointless seems dubious practice.

> As the client seems not to care

The client needs education.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
The best way to accelerate a Macintoy is at 9.8 meters per second per second.
*/

attached mail follows:


Dan,

I have done the same thing and I have the same problem. Did you make it
work yet?

In my case however, under Windows, preferences I can see PHP SQL
(Quantum DB) but not the rest of the
PHP options.

My registry shows (under Help, Configuration details)

*** Plug-in Registry:
net.sourceforge.phpeclipse.debug.core (1.1.0) "PHPEclipse Debug Core"
net.sourceforge.phpeclipse.debug.ui (1.1.0) "PHPEclipse Debug UI"
net.sourceforge.phpeclipse.launching (1.1.0) "PHPEclipse Launching Support"
net.sourceforge.phpeclipse.phphelp (1.1.0) "PHP Plugin Help"
net.sourceforge.phpeclipse.quantum.sql (2.3.3) "Quantum DB Utility"

Dan Joseph wrote:

>Hi,
>
> I was wondering, is anyone running Eclipse 3.0 w/PHPEclipse 1.1.0?
>I'm having trouble getting it working. I downloaded the July .ZIP file and
>unzipped it into the plugins directory. Its not recognizing it. Anyone
>have this working?
>
>-Dan Joseph
>
>
>

attached mail follows:


Hello all,

I need to have some excel capabilities for an automated script. Excel
can save files in CSV which are very easy to read and parse with PHP as
they are nothing more than text files.

Pear has a module called Spreadsheet_Excel_Writer so that you can create
Excel files.

However I need to read data from a simple Excel spreadsheet.

Anyway to do it using PHP?

Thanks in advance.

attached mail follows:


> Anyway to do it using PHP?

Com objects or use perl
http://search.cpan.org/~kwitknr/Spreadsheet-ParseExcel-0.2603/ParseExcel.pm

attached mail follows:


    Hi...
   
    Im trying to compile PHP 4.3.8 on Solaris 7 with apache 1.3.27.
First, I configure PHP using this parameters:

# ./configure --with-apache=../apache_1.3.27 --enable-versioning \
--without-mysql --with-sybase=/usr/local/freetds --without-gd \
--enable-track-vars --with-system-regex --enable-trans-id

    It works fine, but I got this error when I execute make:

# make

/bin/sh /usr/local/src/temp/temp/php-4.3.8/libtool --silent
--preserve-dup-deps --mode=link gcc -export-dynamic
-I/usr/local/include -L/usr/ucblib
-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2
-L/usr/local/freetds/lib -R /usr/ucblib -R
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2 -R
/usr/local/freetds/lib ext/ctype/ctype.lo ext/overload/overload.lo
ext/pcre/pcrelib/maketables.lo ext/pcre/pcrelib/get.lo
ext/pcre/pcrelib/study.lo ext/pcre/pcrelib/pcre.lo ext/pcre/php_pcre.lo
ext/posix/posix.lo ext/session/session.lo ext/session/mod_files.lo
ext/session/mod_mm.lo ext/session/mod_user.lo regex/regcomp.lo
regex/regexec.lo regex/regerror.lo regex/regfree.lo
ext/standard/array.lo ext/standard/base64.lo
ext/standard/basic_functions.lo ext/standard/browscap.lo
ext/standard/crc32.lo ext/standard/crypt.lo ext/standard/cyr_convert.lo
ext/standard/datetime.lo ext/standard/dir.lo ext/standard/dl.lo
ext/standard/dns.lo ext/standard/exec.lo ext/standard/file.lo
ext/standard/filestat.lo ext/standard/flock_compat.lo
ext/standard/formatted_print.lo ext/standard/fsock.lo
ext/standard/head.lo ext/standard/html.lo ext/standard/image.lo
ext/standard/info.lo ext/standard/iptc.lo ext/standard/lcg.lo
ext/standard/link.lo ext/standard/mail.lo ext/standard/math.lo
ext/standard/md5.lo ext/standard/metaphone.lo ext/standard/microtime.lo
ext/standard/pack.lo ext/standard/pageinfo.lo ext/standard/parsedate.lo
ext/standard/quot_print.lo ext/standard/rand.lo ext/standard/reg.lo
ext/standard/soundex.lo ext/standard/string.lo ext/standard/scanf.lo
ext/standard/syslog.lo ext/standard/type.lo ext/standard/uniqid.lo
ext/standard/url.lo ext/standard/url_scanner.lo ext/standard/var.lo
ext/standard/versioning.lo ext/standard/assert.lo
ext/standard/strnatcmp.lo ext/standard/levenshtein.lo
ext/standard/incomplete_class.lo ext/standard/url_scanner_ex.lo
ext/standard/ftp_fopen_wrapper.lo ext/standard/http_fopen_wrapper.lo
ext/standard/php_fopen_wrapper.lo ext/standard/credits.lo
ext/standard/css.lo ext/standard/var_unserializer.lo
ext/standard/ftok.lo ext/standard/aggregation.lo ext/standard/sha1.lo
ext/sybase/php_sybase_db.lo ext/tokenizer/tokenizer.lo ext/xml/xml.lo
ext/xml/expat/xmlparse.lo ext/xml/expat/xmlrole.lo
ext/xml/expat/xmltok.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo
TSRM/tsrm_virtual_cwd.lo main/main.lo main/snprintf.lo main/spprintf.lo
main/php_sprintf.lo main/safe_mode.lo main/fopen_wrappers.lo
main/alloca.lo main/php_scandir.lo main/php_ini.lo main/SAPI.lo
main/rfc1867.lo main/php_content_types.lo main/strlcpy.lo
main/strlcat.lo main/mergesort.lo main/reentrancy.lo
main/php_variables.lo main/php_ticks.lo main/streams.lo main/network.lo
main/php_open_temporary_file.lo main/php_logos.lo main/output.lo
main/memory_streams.lo main/user_streams.lo Zend/zend_language_parser.lo
Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo
Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo
Zend/zend_constants.lo Zend/zend_dynamic_array.lo
Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo
Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo
Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo
Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo
Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo
Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo
Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo
main/internal_functions_cli.lo -lsybdb -lresolv -lm -ldl -lnsl -lbind
-lgcc -o sapi/cli/php
ld: warning: symbol `__p_type_syms' has differing sizes:
        (file /usr/lib/libresolv.so value=0x1ec; file
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2/../../../libbind.a(res_debug.o) value=0x258);
       
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2/../../../libbind.a(res_debug.o) definition taken
Undefined first referenced
symbol in file
getsockopt main/network.o (symbol belongs to
implicit dependency /usr/lib/libsocket.so.1)
send main/network.o (symbol belongs to
implicit dependency /usr/lib/libsocket.so.1)
recvfrom
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2/../../../libbind.a(res_send.o) (symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
connect main/network.o (symbol belongs to
implicit dependency /usr/lib/libsocket.so.1)
dbopen ext/sybase/php_sybase_db.o
getsockname
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2/../../../libbind.a(res_send.o) (symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
getpeername
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2/../../../libbind.a(res_send.o) (symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
recv main/network.o (symbol belongs to
implicit dependency /usr/lib/libsocket.so.1)
socket main/network.o (symbol belongs to
implicit dependency /usr/lib/libsocket.so.1)
ld: fatal: Symbol referencing errors. No output written to sapi/cli/php
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

   Any ideas ??? Should I change some paths ???

setenv LIBS_SHLIB -lbind
setenv CFLAGS -I/usr/local/include
setenv LDFLAGS -L/usr/local/lib
setenv LIBS -lbind
setenv LD_LIBRARY_PATH /usr/local/lib

   Thanks. Regards.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQBA/Euo0Y+cLVZWMw0RAipiAJ9fjo4sylKVanlTg747/lHCdxRJyACeOLW0
Jc17YUsfJzdDkO31zxz+Qxs=
=r2FV
-----END PGP SIGNATURE-----

attached mail follows:


I recently heard of a product called XL2Web (www.xl2web.com) and
wanted to know if there is a php variant out there, perferably open
source. It's going to be used for one or two excel files (our budget
spread sheets) so i can't see spending the money on the commercial
product.

thanks!

--
---
eric marden
http://xentek.net
---

attached mail follows:


Eric Marden wrote:

> I recently heard of a product called XL2Web (www.xl2web.com) and
> wanted to know if there is a php variant out there, perferably open
> source. It's going to be used for one or two excel files (our budget
> spread sheets) so i can't see spending the money on the commercial
> product.
>
> thanks!
>

I have NOT used this service, although I have seen the demo for a product like
this. It uses PHP, but I think you only get the source code if you pay big
bucks (not sure on that one).

http://www.jedox.com/show.php?link=r0159755

attached mail follows:


[Sorry if there's multiple posts...]
Raditha,

Thanks for the good suggestion. It turns out that the call to
imagecreatefromjpeg succeeds when run from the command line and fails
when invoked via the web server. I guess it is a memory limit issue
of some sort. I tried upping the memory_limit via ini_set and while
my setting seems to take effect according to phpinfo(), the
imagecreate call still fails.

So seeing that it runs from the command line, I tried to have php code
from the web server call a php script via exec(). This resulted in
some truly strange behavior. It seemed that instead of running the
script I asked exec() to run, it ran the same php page that was being
served up by the server. It's like exec was not actually launching
any new process, and I had the same trouble with system() and
back-tics.

I'm pretty much ready to give up on this one. Thanks again for your
help.

-Dave

jabberraditha.com (Raditha Dissanayake) on Sat, 17 Jul 2004 08:55:26 +0600:

> Hav you had luck running the script from the command line? if that
> works for you it could be that you are hitting the memory limits for
> your php scripts. A JPEG when loaded in memory could take up more
> memory than the size of the file.

attached mail follows:


Is there an easy way to make a number have no comma or decmal points?
I've tried string replace with the comma but thought there would be a
better alternative that I'm missing to cover more bases. number_format
seems to add instead of take away items.
Jeff

attached mail follows:


[snip]
Is there an easy way to make a number have no comma or decmal points?
I've tried string replace with the comma but thought there would be a
better alternative that I'm missing to cover more bases. number_format
seems to add instead of take away items.
[/snip]

number_format($theNumber, 0, '', ''); (I think I have all of the attributes here, check http://www.php.net/number_format to make sure) has no decimal places, no seperator, and no comma.

attached mail follows:


I would suggest just using str_replace.

On Mon, 19 Jul 2004 17:52:32 -0500, Jeff Oien <jeffwebdesigns1.com> wrote:
> Is there an easy way to make a number have no comma or decmal points?
> I've tried string replace with the comma but thought there would be a
> better alternative that I'm missing to cover more bases. number_format
> seems to add instead of take away items.
> Jeff
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> !DSPAM:40fc5c8246165620915879!
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


> Is there an easy way to make a number have no comma or decmal points?
> I've tried string replace with the comma but thought there would be a
> better alternative that I'm missing to cover more bases. number_format
> seems to add instead of take away items.
> Jeff
>

If by no comma or decimal point you mean rounding to a whole integer,
check out the round() function.

http://us3.php.net/manual/en/function.round.php

--Matthew Sims
--<http://killermookie.org>

attached mail follows:


    Hi...
   
    Im trying to compile PHP 4.3.8 on Solaris 7 with apache 1.3.27.
First, I configure PHP using this parameters:

# ./configure --with-apache=../apache_1.3.27 --enable-versioning \
--without-mysql --with-sybase=/usr/local/freetds --without-gd \
--enable-track-vars --with-system-regex --enable-trans-id

    It works fine, but I got this error when I execute make:

# make

/bin/sh /usr/local/src/temp/temp/php-4.3.8/libtool --silent
--preserve-dup-deps --mode=link gcc -export-dynamic
-I/usr/local/include -L/usr/ucblib
-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2
-L/usr/local/freetds/lib -R /usr/ucblib -R
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2 -R
/usr/local/freetds/lib ext/ctype/ctype.lo ext/overload/overload.lo
ext/pcre/pcrelib/maketables.lo ext/pcre/pcrelib/get.lo
ext/pcre/pcrelib/study.lo ext/pcre/pcrelib/pcre.lo ext/pcre/php_pcre.lo
ext/posix/posix.lo ext/session/session.lo ext/session/mod_files.lo
ext/session/mod_mm.lo ext/session/mod_user.lo regex/regcomp.lo
regex/regexec.lo regex/regerror.lo regex/regfree.lo
ext/standard/array.lo ext/standard/base64.lo
ext/standard/basic_functions.lo ext/standard/browscap.lo
ext/standard/crc32.lo ext/standard/crypt.lo ext/standard/cyr_convert.lo
ext/standard/datetime.lo ext/standard/dir.lo ext/standard/dl.lo
ext/standard/dns.lo ext/standard/exec.lo ext/standard/file.lo
ext/standard/filestat.lo ext/standard/flock_compat.lo
ext/standard/formatted_print.lo ext/standard/fsock.lo
ext/standard/head.lo ext/standard/html.lo ext/standard/image.lo
ext/standard/info.lo ext/standard/iptc.lo ext/standard/lcg.lo
ext/standard/link.lo ext/standard/mail.lo ext/standard/math.lo
ext/standard/md5.lo ext/standard/metaphone.lo ext/standard/microtime.lo
ext/standard/pack.lo ext/standard/pageinfo.lo ext/standard/parsedate.lo
ext/standard/quot_print.lo ext/standard/rand.lo ext/standard/reg.lo
ext/standard/soundex.lo ext/standard/string.lo ext/standard/scanf.lo
ext/standard/syslog.lo ext/standard/type.lo ext/standard/uniqid.lo
ext/standard/url.lo ext/standard/url_scanner.lo ext/standard/var.lo
ext/standard/versioning.lo ext/standard/assert.lo
ext/standard/strnatcmp.lo ext/standard/levenshtein.lo
ext/standard/incomplete_class.lo ext/standard/url_scanner_ex.lo
ext/standard/ftp_fopen_wrapper.lo ext/standard/http_fopen_wrapper.lo
ext/standard/php_fopen_wrapper.lo ext/standard/credits.lo
ext/standard/css.lo ext/standard/var_unserializer.lo
ext/standard/ftok.lo ext/standard/aggregation.lo ext/standard/sha1.lo
ext/sybase/php_sybase_db.lo ext/tokenizer/tokenizer.lo ext/xml/xml.lo
ext/xml/expat/xmlparse.lo ext/xml/expat/xmlrole.lo
ext/xml/expat/xmltok.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo
TSRM/tsrm_virtual_cwd.lo main/main.lo main/snprintf.lo main/spprintf.lo
main/php_sprintf.lo main/safe_mode.lo main/fopen_wrappers.lo
main/alloca.lo main/php_scandir.lo main/php_ini.lo main/SAPI.lo
main/rfc1867.lo main/php_content_types.lo main/strlcpy.lo
main/strlcat.lo main/mergesort.lo main/reentrancy.lo
main/php_variables.lo main/php_ticks.lo main/streams.lo main/network.lo
main/php_open_temporary_file.lo main/php_logos.lo main/output.lo
main/memory_streams.lo main/user_streams.lo Zend/zend_language_parser.lo
Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo
Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo
Zend/zend_constants.lo Zend/zend_dynamic_array.lo
Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo
Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo
Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo
Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo
Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo
Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo
Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo
main/internal_functions_cli.lo -lsybdb -lresolv -lm -ldl -lnsl -lbind
-lgcc -o sapi/cli/php
ld: warning: symbol `__p_type_syms' has differing sizes:
        (file /usr/lib/libresolv.so value=0x1ec; file
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2/../../../libbind.a(res_debug.o) value=0x258);
       
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2/../../../libbind.a(res_debug.o) definition taken
Undefined first referenced
 symbol in file
getsockopt main/network.o (symbol belongs to
implicit dependency /usr/lib/libsocket.so.1)
send main/network.o (symbol belongs to
implicit dependency /usr/lib/libsocket.so.1)
recvfrom
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2/../../../libbind.a(res_send.o) (symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
connect main/network.o (symbol belongs to
implicit dependency /usr/lib/libsocket.so.1)
dbopen ext/sybase/php_sybase_db.o
getsockname
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2/../../../libbind.a(res_send.o) (symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
getpeername
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.3.2/../../../libbind.a(res_send.o) (symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
recv main/network.o (symbol belongs to
implicit dependency /usr/lib/libsocket.so.1)
socket main/network.o (symbol belongs to
implicit dependency /usr/lib/libsocket.so.1)
ld: fatal: Symbol referencing errors. No output written to sapi/cli/php
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

   Any ideas ??? Should I change some paths ???

setenv LIBS_SHLIB -lbind
setenv CFLAGS -I/usr/local/include
setenv LDFLAGS -L/usr/local/lib
setenv LIBS -lbind
setenv LD_LIBRARY_PATH /usr/local/lib

   Thanks. Regards.

Luis Cróker.
www.megared.net.mx
_______________________________
pub 1024D/5656330D - <lcrokermegared.net.mx>
Key fingerprint = 01A9 1D8C 99A7 415F A8DC EF94 D18F 9C2D 5656 330D

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQBA/DZ30Y+cLVZWMw0RAnQfAJ93UhxmnbJzBu2CKG1RW5jjkAKIEgCbB+Fq
BwDEpelbzD+q0L8VFlyH9N4ävr
-----END PGP SIGNATURE-----

attached mail follows:


Yo, i run some fairly simplistic sites, and still don't know to much PHP.

Anyways i have this function called row color, it works fairly simply.

$row1 = "bgcolor='#c0c0c0'";
$row2 = "bgcolor='#808080'";
function row_color(&$row_color=null)
{
          static $row_count=0;
          $row_color = ($row_count % 2) ? $GLOBALS['row1'] :
$GLOBALS['row2'];
          $row_count++
          return $row_color;
}

what i want to do, is somehow dynamicly call that funciton within an echo or
print function though.
something like
$row = "row_color";

echo "$row()<br>$row()<br>$row()";
but i cant seem to find a way to properly do this. That just returns null
values, i have been screwing around with it for about a week now, and
another two weeks trying to get it working on classes, but i cant figure out
if it is even possible to do.

The idea bewteen the &$row_color is so that i can optionally use referencing
on other places in the scripts i have.
-XeRnOuS

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/

attached mail follows:


[snip]
Yo, i run some fairly simplistic sites, and still don't know to much PHP.

Anyways i have this function called row color, it works fairly simply.

$row1 = "bgcolor='#c0c0c0'";
$row2 = "bgcolor='#808080'";
function row_color(&$row_color=null)
{
          static $row_count=0;
          $row_color = ($row_count % 2) ? $GLOBALS['row1'] :
$GLOBALS['row2'];
          $row_count++
          return $row_color;
}

what i want to do, is somehow dynamicly call that funciton within an echo or
print function though.
something like
$row = "row_color";

echo "$row()<br>$row()<br>$row()";
but i cant seem to find a way to properly do this. That just returns null
values, i have been screwing around with it for about a week now, and
another two weeks trying to get it working on classes, but i cant figure out
if it is even possible to do.

The idea bewteen the &$row_color is so that i can optionally use referencing
on other places in the scripts i have.
[/snip]

Does $row = row_color($passTheRowDataThatNeedsPassing); not work?

attached mail follows:


Yo....:-/

Hmmm, this must be PHP5 as in PHP4 parameters can't be by ref and have
a default value.

You can just use concatenation (as you really should be for all vars
and function call in echo statements).

echo '<tr style="background-color: '.row_color().';"><td>data</td></tr>';

But then again, this is a waste of resources. Here's the CSS friendly way:

echo '<style>
.row1 {
  background-color: #c0c0c0;
}
.row2 {
  backgorund-color: #808080;
}
</style>
<table>
';

for($i = 0; $i < 5; ++$i) {
  echo '<tr class="row'.($i % 2 ? '1' : '2').'"><td>Row '.$i.'</td></tr>
';
}

On Mon, 19 Jul 2004 16:55:13 -0700, XeRnOuS ThE <xernoushotmail.com> wrote:
> Yo, i run some fairly simplistic sites, and still don't know to much PHP.
>
> Anyways i have this function called row color, it works fairly simply.
>
> $row1 = "bgcolor='#c0c0c0'";
> $row2 = "bgcolor='#808080'";
> function row_color(&$row_color=null)
> {
> static $row_count=0;
> $row_color = ($row_count % 2) ? $GLOBALS['row1'] :
> $GLOBALS['row2'];
> $row_count++
> return $row_color;
> }
>
> what i want to do, is somehow dynamicly call that funciton within an echo or
> print function though.
> something like
> $row = "row_color";
>
> echo "$row()<br>$row()<br>$row()";
> but i cant seem to find a way to properly do this. That just returns null
> values, i have been screwing around with it for about a week now, and
> another two weeks trying to get it working on classes, but i cant figure out
> if it is even possible to do.
>
> The idea bewteen the &$row_color is so that i can optionally use referencing
> on other places in the scripts i have.
> -XeRnOuS
>
> _________________________________________________________________
> Don't just search. Find. Check out the new MSN Search!
> http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> !DSPAM:40fc5db348948405712292!
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


[snip]
Well that could work, but i want to re call it every time it finds the
occurance of $row

if you said $row = row_color();
then echo "$row<br>$row<br>$row";

it would output the content of $row1 three times.
Because $row =row_color calls it, defines the returned value of row_color as
the contents of it, and never calls it again. I need it to dynamicly call it
every time around.
[/snip]

Top posting == bad
replying off list == bad

Then loop through the rows with either a for loop or while loop.

while(TRUE === $row){
   echo row_color($row) . "<br>";
}

attached mail follows:


* Thus wrote Justin Patrin:
> Yo....:-/
>
> Hmmm, this must be PHP5 as in PHP4 parameters can't be by ref and have
> a default value.

yes, that is php5 specific.

>
> echo '<style>
> .row1 {
> background-color: #c0c0c0;
> }
> .row2 {
> backgorund-color: #808080;
> }
> </style>

I can't wait till

tr:nth-child(odd) { background-color: #c0c0c0; }
tr:nth-child(even) { background-color: #808080; }

become standard :)

http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#nth-child-pseudo

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


I know this isn't solving your problem, but here is how I do it:

class RowAlternator
{
  private $on;
  private $off;
  private $state;

  function RowAlternator($on = "On", $off = "Off")
  {
    $this->on = $on;
    $this->off = $off;
  }

  function switchState()
  {
    $this->state = !$this->state;
  }

  function Next()
  {
    $this->switchState();
    return $this->Current();
  }

  function Current()
  {
    if ($this->state)
      return $this->on;
    return $this->off;
  }
}

then...

using CSS style attributes:

$row = new RowAlternator("background-color: #EDEDED;", "background-color:
#FFFFFF;");
$i = 10;
while ($i--)
{
  echo "<tr style='" . $row->Next() . "'><td>Hello</td></tr>";
}

or using CSS Class definitions

$row = new RowAlternator();
$i = 10;
while ($i--)
{
  echo "<tr class='" . $row->Next() . "'><td>Hello</td></tr>";
}

as far as dynamically calling functions in echo.. why not do this:

$row = 'row_color';
echo sprintf('%s<br />%s<br />%s', $row(), $row(), $row());

or something

btw, defining parameters like so: &o=null

only works in PHP 5.

"Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message
news:C8F323573C030A448F3E5A2B6FE2070B0430C677nemesis...
[snip]
Well that could work, but i want to re call it every time it finds the
occurance of $row

if you said $row = row_color();
then echo "$row<br>$row<br>$row";

it would output the content of $row1 three times.
Because $row =row_color calls it, defines the returned value of row_color as
the contents of it, and never calls it again. I need it to dynamicly call it
every time around.
[/snip]

Top posting == bad
replying off list == bad

Then loop through the rows with either a for loop or while loop.

while(TRUE === $row){
   echo row_color($row) . "<br>";
}

attached mail follows:


> class RowAlternator
> {
> private $on;
> private $off;
> private $state;
>

oops, I only half removed PHP5 only syntax.

class RowAlternator
{
  var $on;
  var $off;
  var $state;

attached mail follows:


On Tue, 20 Jul 2004 01:13:38 +0000, Curt Zirzow
<php-generalzirzow.dyndns.org> wrote:
> * Thus wrote Justin Patrin:
> > Yo....:-/
> >
> > Hmmm, this must be PHP5 as in PHP4 parameters can't be by ref and have
> > a default value.
>
> yes, that is php5 specific.
>
> >
> > echo '<style>
> > .row1 {
> > background-color: #c0c0c0;
> > }
> > .row2 {
> > backgorund-color: #808080;
> > }
> > </style>
>
> I can't wait till
>
> tr:nth-child(odd) { background-color: #c0c0c0; }
> tr:nth-child(even) { background-color: #808080; }
>
> become standard :)

Don't we all wish.....you'd think it wouldn't be *that* hard...

>
> http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#nth-child-pseudo
>
> Curt
> --
> First, let me assure you that this is not one of those shady pyramid schemes
> you've been hearing about. No, sir. Our model is the trapezoid!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


On Sat, Jul 17, 2004 at 02:59:56AM -0500 or thereabouts, linuxe75.com wrote:
> I agree that PHP & MySQL Web Development (By Luke Welling and Laura
> Thompson) is a great resource for learning PHP. Armed with that book
> and the online PHP manual (with user comments), and you're on your way
> to being a well-informed developer.
>
> The second edition (2003) covers PHP 4.3, so it's still quite useful...
> I'm pretty sure the third edition will be written to cover 5.0.

I agree the foregoing is an excellent book -- BUT, not for beginners. When
beginners are asking for a good book, that assumes they know nothing, and has a
very good teaching manner, I always recommend a Visual Quick Start book.

One such book is "Larry Ullman's PHP for the World Wide Web" second editon. It's
published by Peachpit Press, so the proofreading is of an excellent calibre.

I'm not in any way affliated with Larry Ullman, just a satisfied purchaser.

PHP & MySQL Web Developement is a good reference book, but not a beginners book,
unless one has prior experience in programming. I would add this book to my
libray after reading and completing a beginner's book.