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 21 Nov 2003 13:01:18 -0000 Issue 2428

php-general-digest-helplists.php.net
Date: Fri Nov 21 2003 - 07:01:18 CST


php-general Digest 21 Nov 2003 13:01:18 -0000 Issue 2428

Topics (messages 170509 through 170556):

Re: Zip Code Locator / Radius Search
        170509 by: Manuel Lemos

Where can i find error log
        170510 by: Manisha Sathe
        170511 by: Martin Towell

How to use SELECT with multiple options enabled in forms....
        170512 by: Robert Restad
        170515 by: John Nichel
        170516 by: John W. Holmes
        170517 by: John Nichel

Re: Curious about something....
        170513 by: John W. Holmes

Re: passthru gives error in httpd/error_log
        170514 by: Tom Rogers

PHP to create Printable format
        170518 by: irinchiang.justeducation.com
        170519 by: John W. Holmes
        170551 by: Jay Blanchard

Re: LAMP jobs
        170520 by: olinux

fighting with functions
        170521 by: Sara Daugherty
        170523 by: Bronislav Klucka
        170525 by: Bronislav Klucka
        170527 by: Evan Nemerson
        170532 by: Tom Rogers

Re: On-the-fly encryption
        170522 by: Evan Nemerson
        170524 by: Bronislav Klucka

Re: XML Parsing....
        170526 by: Evan Nemerson

help me
        170528 by: mansour shahabi nezhad

Re: Using JavaScript variables in PHP
        170529 by: Lars V. Nielsen
        170530 by: Larry_Li.amat.com

Removing security-problematic chars from strings
        170531 by: Troy S
        170534 by: Erin
        170539 by: Adam i Agnieszka Gasiorowski FNORD
        170549 by: John W. Holmes
        170554 by: Wouter van Vliet

encyption using sha1?
        170533 by: Erin
        170537 by: Nigel Jones
        170538 by: Erin

Re: Is there a way to use the strpos() for next string...
        170535 by: Ford, Mike [LSS]

Re: mail -f option for removing nobodylocalhost Return-Path
        170536 by: Burhan Khalid

detaching and running php processes in the background
        170540 by: Gary C. New
        170544 by: Burhan Khalid
        170546 by: Eugene Lee

Re: echo or print
        170541 by: David T-G

Crossed paths?
        170542 by: MIKE YRABEDRA
        170547 by: Eugene Lee
        170552 by: MIKE YRABEDRA

Re: Two-way on-the-fly encryption
        170543 by: David T-G

free PHP OOP book - Web applications desgin
        170545 by: Nagib Abi Fadel
        170548 by: Lucian Cozma
        170550 by: Burhan Khalid

creating a module for php 4.2.2 with Apache 2.0. php 4.3.3
        170553 by: Bernd

Search File
        170555 by: Vernon Webb
        170556 by: Jay Blanchard

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:


Hello,

On 11/20/2003 10:54 PM, Becoming Digital wrote:
>>This class does exactly what you need:
>>
>>Class: phpZipLocator
>>http://www.phpclasses.org/phpziplocator
>
>
> Thanks. I checked the Repository, but apparently not in the right sections. Don't you think it would be more appropriate in the "Geography" section? :-P

Yes, you are right. I guess the category did not exist when the class
was contributed. Usually, the authors propose new categories. If the
author had proposed that category then, it would have been classified
properly. There are certainly many more classes that are not in all
categories that they should, awaiting for somebody to classify them better.

I have added the class to that category now. Thanks for the suggestion.

--

Regards,
Manuel Lemos

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

attached mail follows:


On server display_error is off in php ini, so I do not get the error msgs,
is there anything like error log ? In this case how to find the errors?

regard,
manisha

attached mail follows:


look for this line in your php.ini file

error_log = filename

but that's only going to help if you have

log_errors = On

HTH
Martin

> -----Original Message-----
> From: Manisha Sathe [mailto:manishastarhub.net.sg]
> Sent: Friday, 21 November 2003 12:19 PM
> To: php-generallists.php.net
> Subject: [PHP] Where can i find error log
>
>
> On server display_error is off in php ini, so I do not get
> the error msgs,
> is there anything like error log ? In this case how to find
> the errors?
>
> regard,
> manisha
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Now, use SELECT is simple enough. The Select Name gives a value, the one you selected of course...

However, I yet have to find a way to actually determine how I could fetch i.e. the results from a SELECT multiple-choice menu.
What if I want the website visitor to choose from multiple values, and read them in a PHP script after the form is submitted?

Suggestions or ideas of how to solve this?

I figured this is probably a very easy task, but I've done a couple attempts, and yet unsuccessful... I can make and read the values of multiple checkboxes, but I cant figure out how to do this with a select ...

Best regards,
Robert.

attached mail follows:


Robert Restad wrote:

> Now, use SELECT is simple enough. The Select Name gives a value, the one you selected of course...
>
> However, I yet have to find a way to actually determine how I could fetch i.e. the results from a SELECT multiple-choice menu.
> What if I want the website visitor to choose from multiple values, and read them in a PHP script after the form is submitted?
>
> Suggestions or ideas of how to solve this?
>
> I figured this is probably a very easy task, but I've done a couple attempts, and yet unsuccessful... I can make and read the values of multiple checkboxes, but I cant figure out how to do this with a select ...
>
> Best regards,
> Robert.

This question was just asked a few hours ago, on this very list (not to
mention the few times a week). Anyway, since the list archives /must/
be broken....

<select name="whatever[]" multiple>
        <option value="thisValue" />Choose
        .....
        <option value="thatValue" />Choice
</select>

Now, putting the square brackets after the name of your form element,
will pass the results as an array, which will now be available to your
php script as....

$_POST['whatever']

It will be an array, even if only one option is selected, so please
treat as such.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


Robert Restad wrote:

> I yet have to find a way to actually determine
> how I could fetch i.e. the results from a SELECT
> multiple-choice menu.

I think I already asnwered this today....

<select name="foo[]" multiple>

Now the values the user selected will be in an array, $foo,
$_GET['foo'], $_POST['foo'], $_REQUEST['foo'], etc...

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


John W. Holmes wrote:

> Robert Restad wrote:
>
>> I yet have to find a way to actually determine
>
> > how I could fetch i.e. the results from a SELECT
> > multiple-choice menu.
>
> I think I already asnwered this today....

Three more times, and you'll reach your quota.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


Mike Migurski wrote:
>>>Is there any particular advantage to having the default PHP install
>>>exclude a lot of useful modules such as mcrypt, cli, sockets, etc?
>
> The question sounded more like a technical one - is it an advantage in
> terms of memory? CPU? startup overhead? etc.

Yeah, I think I misread that one. Sorry.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


Hi,

Friday, November 21, 2003, 10:53:08 AM, you wrote:
JH> I'm trying to run a super simple command through passthru.

JH> Here's my test.php file:

JH> <html><body>
JH> <? passthru('ls -l'); ?>
JH> </body></html>

JH> It works if run directly with "php test.php".
JH> When this is run from the browser, there is no output, and the
JH> following error is logged in /var/log/httpd/error_log :
JH> sh: /ls: No such file or directory

JH> What does this mean ? Any command I try instead of "ls -l",
JH> gives a similar error.

JH> The funky thing is that it HAS worked, but now it doesn't, and
JH> I have no idea what happened.

JH> Any clues and hints are much appreciated.

JH> /Jesper

You probably have to put the full path to ls

    <? passthru('/bin/ls -l'); ?>

--
regards,
Tom

attached mail follows:


Hi all..

Right now, I am trying to do generation of report using PHP in which the
report should be in a printable format later on.

Is there any solution to use PHP to accomplish such task??

The report is viewed in a web browser and how should I create a navigation
link or something whereby user can click on it to view it in a printable
format and print it ??

Another example site which demonstrate such feature would be:
-->http://www.devshed.com/Server_Side/PHP/patUser/patUser1/page1.html

All help are greatly appreciated. Thank You.

Regards,
Irin.

attached mail follows:


irinchiangjusteducation.com wrote:

> Right now, I am trying to do generation of report using PHP in which the
> report should be in a printable format later on.

How do you define a "printable format"?

Ideally, you want to do this in CSS. The "print version" would just load
a differnet style sheet than the main format.

You can also do it with PHP, like conditionally including / excluding
blocks, changing colors, fonts, sizes, etc....

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


[snip]
> Right now, I am trying to do generation of report using PHP in which
the
> report should be in a printable format later on.

How do you define a "printable format"?

Ideally, you want to do this in CSS. The "print version" would just load

a differnet style sheet than the main format.

You can also do it with PHP, like conditionally including / excluding
blocks, changing colors, fonts, sizes, etc....
[/snip]

I second John's "How do you define a "printable format"?"

I like his plan and just wish to add that you could create printable
PDFs using PHP.

attached mail follows:


For $$$ or for the love?

here's a start:

For the $$$
http://www.elance.com
http://www.scriptlance.com
http://www.rentacoder.com

For the love?
sourceforge.net
freshmeat.net
pear.php.net

olinux

--- Susan Ator <SAtornpr.org> wrote:
> It seems like this question came up before. Is there
> a resource for people
> looking for jobs working with open source products
> (LAMP specifically)?
>
> Thanks,
>
> susan

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

attached mail follows:


I could use a little help. click on the link to see my php code for a
project that creates an array with a list or items and their cost and
calculates tax by using a function called getTax() and also creates a
balance by adding the cost plus the tax in a second function called
getBalance(). I must also create a table where the cells automatically
load so the end result looks like this.
http://www.areawebdirectory.net/taxtable2.txt

Item Cost Tax Running Total
Car 10000.00 600 10600.00
Pencil 1.00 .06 10601.06
Book 14.95 .097 10616.98

I cant seem to first be able to declare my array and succeed at naming
the key as item and the value as price. I have attempted to use
variations of the following with no success.

$items = array (
    0 => array ("item"=>"car","price"=>15000, "tax"=>.065 ),
    1 => array ("item"=>"pencil","price"=>1, "tax"=>.065 ),
    2 => array ("item"=>"book","price"=>14.95, "tax"=>.065)
);

Without being able to declare the key as item and the value as price I
am not sure how to pass these items into my function and I am riddled
with error messages. I think my base problem is to either fix how I am
declaring the array so I may reference "item" and "price" as I am now
doing in my functions or learn how to change the functions accordingly.

I am also pretty sure that my functions are not quite right. I am also
not sure how to link the right answers to get my table to print as above.

Please note that I have included a while loop after my array just to
prove that my array is working. It is needed part of my program. I also
have given each cell in my table some text just so I can find them when
I have figured out how to create the right reference links.

I am sorry that I need as much help with this. Sadly I have been at this
for almost two weeks trying to solve it.

Thanks,
Sara

attached mail follows:


I'm not sure, if I understood, but try this:

<?php
$items = array (
    0 => array ("item"=>"car","price"=>10000, "tax"=>0.06 ),
    1 => array ("item"=>"pencil","price"=>1, "tax"=>0.06 ),
    2 => array ("item"=>"book","price"=>14.95, "tax"=>0.065)
);

function GetTax($item){
        return $item["price"]*$item["tax"];
}

function GetBalance($item){
        return $item["price"]+GetTax($item);
}

function ShowPrice($price){
        return sprintf ("%.2f", $price);
}

$balance=0;
if(sizeof($items)) foreach($items as $item){
        $balance+=GetBalance($item);
        echo
$item["item"]."&nbsp;&nbsp;&nbsp;".ShowPrice($item["price"])."&nbsp;&nbsp;&n
bsp;".ShowPrice(GetTax($item))."&nbsp;&nbsp;&nbsp;".ShowPrice($balance)."<br
>\n";
}
?>

> -----Original Message-----
> From: Sara Daugherty [mailto:saraareawebdirectory.net]
> Sent: Friday, November 21, 2003 10:57 AM
> To: php_kingyahoogroups.com
> Cc: php-beginneregroups.com; php-listyahoogroups.com; PHP LIST
> ; php-lordsyahoogroups.com; php-newbiesyahoogroups.com;
> mikeareawebdirectory.net; Michael Roush; Chris Hubbard
> Subject: [PHP] fighting with functions
>
>
> I could use a little help. click on the link to see my php code for a
> project that creates an array with a list or items and their cost and
> calculates tax by using a function called getTax() and also creates a
> balance by adding the cost plus the tax in a second function called
> getBalance(). I must also create a table where the cells automatically
> load so the end result looks like this.
> http://www.areawebdirectory.net/taxtable2.txt
>
>
> Item Cost Tax Running Total
> Car 10000.00 600 10600.00
> Pencil 1.00 .06 10601.06
> Book 14.95 .097 10616.98
>
>
> I cant seem to first be able to declare my array and succeed at naming
> the key as item and the value as price. I have attempted to use
> variations of the following with no success.
>
> $items = array (
> 0 => array ("item"=>"car","price"=>15000, "tax"=>.065 ),
> 1 => array ("item"=>"pencil","price"=>1, "tax"=>.065 ),
> 2 => array ("item"=>"book","price"=>14.95, "tax"=>.065)
> );
>
> Without being able to declare the key as item and the value as price I
> am not sure how to pass these items into my function and I am riddled
> with error messages. I think my base problem is to either fix how I am
> declaring the array so I may reference "item" and "price" as I am now
> doing in my functions or learn how to change the functions accordingly.
>
> I am also pretty sure that my functions are not quite right. I am also
> not sure how to link the right answers to get my table to print as above.
>
> Please note that I have included a while loop after my array just to
> prove that my array is working. It is needed part of my program. I also
> have given each cell in my table some text just so I can find them when
> I have figured out how to create the right reference links.
>
> I am sorry that I need as much help with this. Sadly I have been at this
> for almost two weeks trying to solve it.
>
> Thanks,
> Sara
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Hi,
Little semantic correction, the function "GetBalance($item)" should be
called "GetFullPrice($item)" because it returns full price of the item, but
the "$balance" variable seems to be partial sum of the current item and
previous items;

Bronislv Klucka.

> -----Original Message-----
> From: Bronislav Klucka [mailto:Bronislav.Kluckapro2-soft.com]
> Sent: Friday, November 21, 2003 8:31 AM
> To: PHP Konference; Sara Daugherty
> Subject: RE: [PHP] fighting with functions
>
>
> I'm not sure, if I understood, but try this:
>
> <?php
> $items = array (
> 0 => array ("item"=>"car","price"=>10000, "tax"=>0.06 ),
> 1 => array ("item"=>"pencil","price"=>1, "tax"=>0.06 ),
> 2 => array ("item"=>"book","price"=>14.95, "tax"=>0.065)
> );
>
> function GetTax($item){
> return $item["price"]*$item["tax"];
> }
>
> function GetBalance($item){
> return $item["price"]+GetTax($item);
> }
>
> function ShowPrice($price){
> return sprintf ("%.2f", $price);
> }
>
> $balance=0;
> if(sizeof($items)) foreach($items as $item){
> $balance+=GetBalance($item);
> echo
> $item["item"]."&nbsp;&nbsp;&nbsp;".ShowPrice($item["price"])."&nbs
> p;&nbsp;&n
> bsp;".ShowPrice(GetTax($item))."&nbsp;&nbsp;&nbsp;".ShowPrice($bal
> ance)."<br
> >\n";
> }
> ?>
>
>
> > -----Original Message-----
> > From: Sara Daugherty [mailto:saraareawebdirectory.net]
> > Sent: Friday, November 21, 2003 10:57 AM
> > To: php_kingyahoogroups.com
> > Cc: php-beginneregroups.com; php-listyahoogroups.com; PHP LIST
> > ; php-lordsyahoogroups.com; php-newbiesyahoogroups.com;
> > mikeareawebdirectory.net; Michael Roush; Chris Hubbard
> > Subject: [PHP] fighting with functions
> >
> >
> > I could use a little help. click on the link to see my php code for a
> > project that creates an array with a list or items and their cost and
> > calculates tax by using a function called getTax() and also creates a
> > balance by adding the cost plus the tax in a second function called
> > getBalance(). I must also create a table where the cells automatically
> > load so the end result looks like this.
> > http://www.areawebdirectory.net/taxtable2.txt
> >
> >
> > Item Cost Tax Running Total
> > Car 10000.00 600 10600.00
> > Pencil 1.00 .06 10601.06
> > Book 14.95 .097 10616.98
> >
> >
> > I cant seem to first be able to declare my array and succeed at naming
> > the key as item and the value as price. I have attempted to use
> > variations of the following with no success.
> >
> > $items = array (
> > 0 => array ("item"=>"car","price"=>15000, "tax"=>.065 ),
> > 1 => array ("item"=>"pencil","price"=>1, "tax"=>.065 ),
> > 2 => array ("item"=>"book","price"=>14.95, "tax"=>.065)
> > );
> >
> > Without being able to declare the key as item and the value as price I
> > am not sure how to pass these items into my function and I am riddled
> > with error messages. I think my base problem is to either fix how I am
> > declaring the array so I may reference "item" and "price" as I am now
> > doing in my functions or learn how to change the functions accordingly.
> >
> > I am also pretty sure that my functions are not quite right. I am also
> > not sure how to link the right answers to get my table to print
> as above.
> >
> > Please note that I have included a while loop after my array just to
> > prove that my array is working. It is needed part of my program. I also
> > have given each cell in my table some text just so I can find them when
> > I have figured out how to create the right reference links.
> >
> > I am sorry that I need as much help with this. Sadly I have been at this
> > for almost two weeks trying to solve it.
> >
> > Thanks,
> > Sara
> >
> > --
> > 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
>

attached mail follows:


First off, please try to refrain from cross-posting, especially to that
degree.

I'm not sure I interpreted the your intentions correctly. If not, could you
try to be a little more precise in saying what you _want_ the code to do?

The first thing that jumps out at me is in the function getTax. Shouldn't it
be getTax($value)? As you have it, value will be unset (search for variable
scope in the manual). I think this may be what you're going for:

function getTax($value) {
        return ($value * 0.065);
}

Next, the list construct will only work with numeric arrays, not associative
ones. In other words, it has to look like array('one', 'two'), not
array('one' => 'two', 'three' => 'four')

Next the way you have it set up, $mypurchases can only contain one set of
three items. I don't get the logic of how car, pencil, and book map to $key,
$value, and $tax.... Maybe you were going for

$mypurchases = array(
        'car' => 15000,
        'pencil' => 1,
        'book' => 14.95);
$total = 0;
echo '<table><tr><td>Item</td><td>Cost</td>';
echo '<td>Tax</td><td>Running Total</td></tr>';
foreach ( $mypurchases as $key => $value) {
        $total += $value + ($tax = getTax($value));
        // assuming you want the table in HTML, since you have a <br/>...
        echo "<tr><td>{$key}</td><td>{$value}</td>";
        echo "<td>{$tax}</td><td>{$total}</td></tr>\n";
}
echo '</table>';

???

I'm going to ignore the getBalance function because I don't think it's
required. But you realize your declaring a static variable, then trying to
assign a different value to it on the very next line?

On Friday 21 November 2003 01:56 am, Sara Daugherty wrote:
> I could use a little help. click on the link to see my php code for a
> project that creates an array with a list or items and their cost and
> calculates tax by using a function called getTax() and also creates a
> balance by adding the cost plus the tax in a second function called
> getBalance(). I must also create a table where the cells automatically
> load so the end result looks like this.
> http://www.areawebdirectory.net/taxtable2.txt
>
>
> Item Cost Tax Running Total
> Car 10000.00 600 10600.00
> Pencil 1.00 .06 10601.06
> Book 14.95 .097 10616.98
>
>
> I cant seem to first be able to declare my array and succeed at naming
> the key as item and the value as price. I have attempted to use
> variations of the following with no success.
>
> $items = array (
> 0 => array ("item"=>"car","price"=>15000, "tax"=>.065 ),
> 1 => array ("item"=>"pencil","price"=>1, "tax"=>.065 ),
> 2 => array ("item"=>"book","price"=>14.95, "tax"=>.065)
> );
>
> Without being able to declare the key as item and the value as price I
> am not sure how to pass these items into my function and I am riddled
> with error messages. I think my base problem is to either fix how I am
> declaring the array so I may reference "item" and "price" as I am now
> doing in my functions or learn how to change the functions accordingly.
>
> I am also pretty sure that my functions are not quite right. I am also
> not sure how to link the right answers to get my table to print as above.
>
> Please note that I have included a while loop after my array just to
> prove that my array is working. It is needed part of my program. I also
> have given each cell in my table some text just so I can find them when
> I have figured out how to create the right reference links.
>
> I am sorry that I need as much help with this. Sadly I have been at this
> for almost two weeks trying to solve it.
>
> Thanks,
> Sara

--
Evan Nemerson
evancoeus-group.com
http://coeusgroup.com/en

--
"Truth, like gold, is to be obtained not by its growth, but by washing away
from it all that is not gold. "

-Leo Nikolaevich Tolstoy

attached mail follows:


Hi,

Friday, November 21, 2003, 7:56:34 PM, you wrote:
SD> I could use a little help. click on the link to see my php code for a
SD> project that creates an array with a list or items and their cost and
SD> calculates tax by using a function called getTax() and also creates a
SD> balance by adding the cost plus the tax in a second function called
SD> getBalance(). I must also create a table where the cells automatically
SD> load so the end result looks like this.
SD> http://www.areawebdirectory.net/taxtable2.txt

SD> Item Cost Tax Running Total
SD> Car 10000.00 600 10600.00
SD> Pencil 1.00 .06 10601.06
SD> Book 14.95 .097 10616.98

SD> I cant seem to first be able to declare my array and succeed at naming
SD> the key as item and the value as price. I have attempted to use
SD> variations of the following with no success.

SD> $items = array (
SD> 0 => array ("item"=>"car","price"=>15000, "tax"=>.065 ),
SD> 1 => array ("item"=>"pencil","price"=>1, "tax"=>.065 ),
SD> 2 => array ("item"=>"book","price"=>14.95, "tax"=>.065)
SD> );

SD> Without being able to declare the key as item and the value as price I
SD> am not sure how to pass these items into my function and I am riddled
SD> with error messages. I think my base problem is to either fix how I am
SD> declaring the array so I may reference "item" and "price" as I am now
SD> doing in my functions or learn how to change the functions accordingly.

SD> I am also pretty sure that my functions are not quite right. I am also
SD> not sure how to link the right answers to get my table to print as above.

SD> Please note that I have included a while loop after my array just to
SD> prove that my array is working. It is needed part of my program. I also
SD> have given each cell in my table some text just so I can find them when
SD> I have figured out how to create the right reference links.

SD> I am sorry that I need as much help with this. Sadly I have been at this
SD> for almost two weeks trying to solve it.

SD> Thanks,
SD> Sara

Using this array you need something like this

<?php
$items = array (
    0 => array ("item"=>"car","price"=>15000, "tax"=>.065 ),
    1 => array ("item"=>"pencil","price"=>1, "tax"=>.065 ),
    2 => array ("item"=>"book","price"=>14.95, "tax"=>.065)
);

function getTax($cost,$taxrate){
  return $cost * $taxrate;
}

echo '<table border="1">';
echo '<tr><td>Item number</td><td>Item</td><td>Cost</td><td>Tax</td><td>Total</td></tr>';
$total = 0;
foreach($items as $key=>$item){
  echo '<tr>';
  echo '<td>'.($key+1).'</td>';
  echo '<td>'.$item['item'].'</td>';
  echo '<td>'.$item['price'].'</td>';
  $tax = getTax($item['price'],$item['tax']);
  echo '<td>'.$tax.'</td>';
  $total += ($item['price'] + $tax);
  echo '<td>'.$total.'</td>';
  echo '</tr>';
}
echo '</table>';
?>

You will need to add number formatting but you get the idea.
I always store money as cents in the database and leave them as integers.
Just /100 to display

--
regards,
Tom

attached mail follows:


On Wednesday 19 November 2003 09:43 am, Ray wrote:
> I want to do two-way encryption on a file coming through the web server.
> In this context, I would want to generate a public and private key, encrypt

Do you have any idea how much time and (and entropy) is required to create a
reasonably strong keypair?

> the file stream (i.e., don't want to write the unencrypted file to disk

That's virtually impossible with modern operating systems. They are mysterious
beasts that will often write data to hard drive when you don't want it to.
Swap files are a particularly good example of how it happens.

> first and then encrypt it; I want to encrypt the stream as it comes in)
> with the public, send the private to the recipient, and then destroy both
> keys on my end.

You can play with popen and pipes (even named pipes could be useful), but
seriously there's going to be data written to disk. IMHO you'd be much better
off just writing the data in a predictable manner, then using something like
THC's SecureDelete.

>
> When the file was accessed and the private key was provided, I would want
> to stream the unencrypted file out without ever writing the unencrypted
> file to disk.

man gpg
(hint: -o or --output)

>
> Any ideas on how to accomplish this within the PHP construct?

man gpg

Now, where exactly do you gain security over using a symetric-key system?
You're really just forcing the user to save the passphrase and private key...
Just encrypt the file with AES/Twofish/IDEA/3DES/ad/nauseum, and tell the
user the passphrase.

Furthermore, all the encrypted storage in the world isn't going to do you much
good when you're transmitting stuff in cleartext. Someone is going to fire up
dsniff/snort/whatever and get all the goods without ever bothering to break
into your box.

I don't know what problem you're trying to solve, so I won't suggest an
alternative course of action, but if you'd like to send your problem to the
list, I (and probably others) would be happy to suggest alternatives.

>
> Thanks!

--
Evan Nemerson
evancoeus-group.com
http://coeusgroup.com/en

--
"The public have an insatiable curiosity to know everything. Except what is
worth knowing. Journalism, conscious of this, and having tradesman-like
habits, supplies their demands."

-Oscar Wilde

attached mail follows:


Hi,
Little semantic correction, the function "GetBalance($item)" should be
called "GetFullPrice($item)" because it returns full price of the item, but
the "$balance" variable seems to be partial sum of the current item and
previous items;

Bronislv Klucka.

> -----Original Message-----
> From: Bronislav Klucka [mailto:Bronislav.Kluckapro2-soft.com]
> Sent: Friday, November 21, 2003 8:31 AM
> To: PHP Konference; Sara Daugherty
> Subject: RE: [PHP] fighting with functions
>
>
> I'm not sure, if I understood, but try this:
>
> <?php
> $items = array (
> 0 => array ("item"=>"car","price"=>10000, "tax"=>0.06 ),
> 1 => array ("item"=>"pencil","price"=>1, "tax"=>0.06 ),
> 2 => array ("item"=>"book","price"=>14.95, "tax"=>0.065)
> );
>
> function GetTax($item){
> return $item["price"]*$item["tax"];
> }
>
> function GetBalance($item){
> return $item["price"]+GetTax($item);
> }
>
> function ShowPrice($price){
> return sprintf ("%.2f", $price);
> }
>
> $balance=0;
> if(sizeof($items)) foreach($items as $item){
> $balance+=GetBalance($item);
> echo
> $item["item"]."&nbsp;&nbsp;&nbsp;".ShowPrice($item["price"])."&nbs
> p;&nbsp;&n
> bsp;".ShowPrice(GetTax($item))."&nbsp;&nbsp;&nbsp;".ShowPrice($bal
> ance)."<br
> >\n";
> }
> ?>
>
>
> > -----Original Message-----
> > From: Sara Daugherty [mailto:saraareawebdirectory.net]
> > Sent: Friday, November 21, 2003 10:57 AM
> > To: php_kingyahoogroups.com
> > Cc: php-beginneregroups.com; php-listyahoogroups.com; PHP LIST
> > ; php-lordsyahoogroups.com; php-newbiesyahoogroups.com;
> > mikeareawebdirectory.net; Michael Roush; Chris Hubbard
> > Subject: [PHP] fighting with functions
> >
> >
> > I could use a little help. click on the link to see my php code for a
> > project that creates an array with a list or items and their cost and
> > calculates tax by using a function called getTax() and also creates a
> > balance by adding the cost plus the tax in a second function called
> > getBalance(). I must also create a table where the cells automatically
> > load so the end result looks like this.
> > http://www.areawebdirectory.net/taxtable2.txt
> >
> >
> > Item Cost Tax Running Total
> > Car 10000.00 600 10600.00
> > Pencil 1.00 .06 10601.06
> > Book 14.95 .097 10616.98
> >
> >
> > I cant seem to first be able to declare my array and succeed at naming
> > the key as item and the value as price. I have attempted to use
> > variations of the following with no success.
> >
> > $items = array (
> > 0 => array ("item"=>"car","price"=>15000, "tax"=>.065 ),
> > 1 => array ("item"=>"pencil","price"=>1, "tax"=>.065 ),
> > 2 => array ("item"=>"book","price"=>14.95, "tax"=>.065)
> > );
> >
> > Without being able to declare the key as item and the value as price I
> > am not sure how to pass these items into my function and I am riddled
> > with error messages. I think my base problem is to either fix how I am
> > declaring the array so I may reference "item" and "price" as I am now
> > doing in my functions or learn how to change the functions accordingly.
> >
> > I am also pretty sure that my functions are not quite right. I am also
> > not sure how to link the right answers to get my table to print
> as above.
> >
> > Please note that I have included a while loop after my array just to
> > prove that my array is working. It is needed part of my program. I also
> > have given each cell in my table some text just so I can find them when
> > I have figured out how to create the right reference links.
> >
> > I am sorry that I need as much help with this. Sadly I have been at this
> > for almost two weeks trying to solve it.
> >
> > Thanks,
> > Sara
> >
> > --
> > 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
>

attached mail follows:


On Thursday 20 November 2003 08:18 am, Scott Fletcher wrote:
> Hi Everyone!
>
> I'm having a little trouble understanding how exactly to use the XML
> parser. I haven't found the right settings to set up the XML Parser's
> option because of no definition of the encoding setting in the XML tags I
> received. So, I'll post the script here and hope to get some feedback on
> this...
>
>
> --snip--
> $data = "<REPORT_RESPONSE>";
> //Lots of XML tags goes here but is taken out for shorter
> scripting....
> $data = " <![CDATA[<?xml version="1.0" encoding="UTF-8"?>";
> //Lots of other XML tags goes here but is taken out for
> shorter scripting....
> $data = " <![CDATA[***HTML CODES GOES HERE****]]>";
> //Lots of other XML tags goes here but is taken out for
> shorter scripting....
> $data = " ]]>";
> //Lots of other XML tags goes here but is taken out for
> shorter scripting....
> $data .= "</REPORT_RESPONSE>";
>
> $parser = xml_parser_create('ISO-8859-1');
> xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
> xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
> xml_parse_into_struct($parser, $data, $vals, $index);
> xml_parser_free($parser);
> --snip--
>
> The problem here is that I have like two different XML encoding
> format....

Do you actually have data in two diferent formats in the same XML file, or can
you just change xml_parser_create to UTF-8 and be done with it? Does the XML
standard even allow multiple encodings???

>
> Thanks,
> Scott

--
Evan Nemerson
evancoeus-group.com
http://coeusgroup.com/en

--
"The greatest mistake is to imagine that the human being is an autonomous
individual. The secret freedom which you can supposedly enjoy under a
despotic government is nonsense, because your thoughts are never entirely
your own. Philosophers, writers, artists, even scientists, not only need
encouragement and an audience, they need constant stimulation from other
people. It is almost impossible to think without talking. If Defoe had really
lived on a desert island, he could not have written Robinson Crusoe, nor
would he have wanted to. Take away freedom of speech, and the creative
faculties dry up."

-George Orwell

attached mail follows:


I have php 4.3.4 installed on a winxp system .
also i use apache 2.0.48 / mysql 4.0.15
When i try some php program like phpnuke7.0 the page opened very slowly. can you please send me the php.ini file that correct this problem ?
 Thank You
Mansour

attached mail follows:


You might be able to share values between PHP and JavaScript by using
cookies.

--
Lars V. Nielsen

attached mail follows:


<form method="post" action="your_php_file.php">
<input name=id>
</form>

in your_php_file.php, try

"select * from somedatabase where field=$id"

"Mike Knittel" <mikecmsgis.com>
11/20/2003 11:45 PM
 
        To: php-generallists.php.net
        cc:
        Subject: [PHP] Using JavaScript variables in PHP
 

How does one go about using a JavaScript variable with PHP code. I have a
function in JavaScript that takes a single input parameter (ID). I want
to
use this ID variable as the value on the where clause of a database query.

Example: "select * from somedatabase where field=ID"

Can this be done, and if so how? I have been unable to figure this out.

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

attached mail follows:


Greetings,
 
What is the best way to remove the characters from strings that may
cause security problems? Namely, `, ', ", <, >, \ and all non-printing
strings. Did I miss any? Thanks.
 
Troy
 

attached mail follows:


use preg_match or eregi

:>

"Troy S" <troysocks-twigsyahoo.com> wrote in message
news:20031121090433.12103.qmailweb13409.mail.yahoo.com...
> Greetings,
>
> What is the best way to remove the characters from strings that may
> cause security problems? Namely, `, ', ", <, >, \ and all non-printing
> strings. Did I miss any? Thanks.
>
> Troy
>
>
>

attached mail follows:


Troy S wrote:

> What is the best way to remove the characters from strings that may
> cause security problems? Namely, `, ', ", <, >, \ and all non-printing
> strings. Did I miss any? Thanks.

        Do it the other way, allow only characters
 you know are safe and strip the rest. Use, for
 example, a preg_replace pattern with negated
 character range. Put all the allowed characters
 into this range and '' as replace text.

 $query = preg_replace('{[^' . preg_quote(ALLOWED_CHARS) . ']}', '', $query);

 , where ALLOWED_CHARS is a constant containing...
 allowed characters :8].

--
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info { iWanToDie } WiNoNa ) (
http://szatanowskie-ladacznice.0-700.pl foReVeR( * )
Poznaj jej zwiewne kształty... http://www.opera.com 007

attached mail follows:


Troy S wrote:

> What is the best way to remove the characters from strings that may
> cause security problems? Namely, `, ', ", <, >, \ and all non-printing
> strings. Did I miss any? Thanks.

Why do you need to remove them? So I can't type <grin>? Is that a
security violation? All you need to do is use htmlentities() and/or
addslashes() to protect data being displayed or entered into a database.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


> -----Oorspronkelijk bericht-----
> Van: John W. Holmes [mailto:holmes072000charter.net]
>
> Troy S wrote:
>
> > What is the best way to remove the characters from strings that may
> > cause security problems? Namely, `, ', ", <, >, \ and all non-printing
> > strings. Did I miss any? Thanks.
>
> Why do you need to remove them? So I can't type <grin>? Is that a
> security violation? All you need to do is use htmlentities() and/or
> addslashes() to protect data being displayed or entered into a database.
>

If you're worried about HTML code being entered (guess from desire to strip
<, > and /) and messing up your site's layout, you might wanna call
strip_tags($String, $AllowedTags); where $AllowedTags is a string like
'<b><u><i>' if you want to allow bold, underline and italics.

What is your intention?

attached mail follows:


Hi all,
    I need some help with storing passwords does anyone have any thoughts on
sha1()?

Any other ideas are welcome.

Am i right in thinking that to use sha1 ya do this:

$hashed_string = sha1{$string);

R

attached mail follows:


Last Message Messed Up So here goes again...

$hashed_string = sha1{$string); is correct except use $hashed_string =
sha1($string); - watch out for Curly Brackets they give you those annoying
Phase Errors

Resource: http://nz2.php.net/manual/en/function.sha1.php

-----Original Message-----
From: Erin [mailto:xpcookra.co.uk]
Sent: Friday, November 21, 2003 10:34 PM
To: php-generallists.php.net
Subject: [PHP] encyption using sha1?

Hi all,
    I need some help with storing passwords does anyone have any thoughts on
sha1()?

Any other ideas are welcome.

Am i right in thinking that to use sha1 ya do this:

$hashed_string = sha1{$string);

R

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

attached mail follows:


Many thanks, youre right about those curl ones...lol

R

----- Original Message -----
From: "Nigel Jones" <njonezihug.co.nz>
To: "Erin" <xpcookra.co.uk>
Cc: <php-generallists.php.net>
Sent: Friday, November 21, 2003 10:20 AM
Subject: RE: [PHP] encyption using sha1?

> Last Message Messed Up So here goes again...
>
> $hashed_string = sha1{$string); is correct except use $hashed_string =
> sha1($string); - watch out for Curly Brackets they give you those annoying
> Phase Errors
>
>
> Resource: http://nz2.php.net/manual/en/function.sha1.php
>
> -----Original Message-----
> From: Erin [mailto:xpcookra.co.uk]
> Sent: Friday, November 21, 2003 10:34 PM
> To: php-generallists.php.net
> Subject: [PHP] encyption using sha1?
>
>
> Hi all,
> I need some help with storing passwords does anyone have any thoughts
on
> sha1()?
>
> Any other ideas are welcome.
>
> Am i right in thinking that to use sha1 ya do this:
>
> $hashed_string = sha1{$string);
>
>
> R
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>

attached mail follows:


On 20 November 2003 20:39, Scott Fletcher wrote:

> Yea, the manual is clear but honestly, don't know what the offset
> really meant since there is no definition or explaination of how the
> offset work.

Well, I really don't know how much clearer the sentence that says "The optional offset parameter allows you to specify which character in haystack to start searching" can be -- if you can suggest some better wording, that would have worked for you, then maybe one of us can add a user note to the manual and/or a documentation bug requesting an enhancement. And, notwithstanding the clarity of the description, I agree it would be useful to have another example showing the use of the 3rd argument, so that could be done in the same way.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.fordleedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


Manuel Lemos wrote:

[ snip ]

> Anyway, you may want to try this class that has work arounds to mail
> function bugs and emulates what you want by passing the Return-Path header:
>
> http://www.phpclasses.org/mimemessage

Another good one is http://phpmailer.sourceforge.net
PEAR also has a good Mail package.

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
-----------------------
"Documentation is like sex: when it is good,
  it is very, very good; and when it is bad,
  it is better than nothing."

attached mail follows:


What is the best way to detach and run a command line based php script
in the background from a web-based php script, without the need for
reporting?

I have a web-based php script that gathers information and then passes
it off to several functions, which execute several other php scripts.
The problem is that the main php script does not return until all the
processes have signaled and is taking about 30 sec to complete. There
is no need for the child processes spawned by the main php script to
signal. I would like to spawn and detach them to finish in the
background; thus, dramatically reducing the load time of the main php
script.

It has been suggested to me to use the & with the shell_exec function,
but this still requires the child processes to signal.

Another suggestion was to use the pcntl_fork function, but my reading
suggest that this is not to be used with web-based applications and does
not compile in with mod_php (only the binary version). If I were to use
the binary version would I even be able to detach the forked child
processes? Doesn't pcntl_fork still require the child processes to
signal to the parent before exiting otherwise becoming zombie processes?

Any suggestions on the best way to handle this?

Respectfully,

Gary

attached mail follows:


Gary C. New wrote:

> What is the best way to detach and run a command line based php script
> in the background from a web-based php script, without the need for
> reporting?

Try something like :

if (!($handle = popen("script.sh 2>&1 > /dev/null &", "r")))
{
    echo "Couldn't run process";
}

http://www.php.net/popen

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
-----------------------
"Documentation is like sex: when it is good,
  it is very, very good; and when it is bad,
  it is better than nothing."

attached mail follows:


On Fri, Nov 21, 2003 at 03:40:05AM -0700, Gary C. New wrote:
:
: What is the best way to detach and run a command line based php script
: in the background from a web-based php script, without the need for
: reporting?

How about exec('command &') ?

attached mail follows:


Eugene, et al --

...and then Eugene Lee said...
%
% <p class="tonue-in-cheek">
%
% Also, the letter 'e' is smaller than 'p', so ASCII-based function
% lookups will be faster as well.

Most of these speed increases can't be noticed in a small script, where
the end is within a few lines, but echo() really works well in larger
scripts where the end is far away.

In addition, print() only sort of works well in the "near" case and
doesn't work at all in the "far" case (as demonstrated when trying to
throw something printed, such as a book).

Finally, echo()ed statements always remain in the proper order, but
throwing a bunch of print()s will just get you a big mess on the floor
requiring an intelligent sort() to clean up -- and you know how tough it
can be to write a quick sort() algorithm!

%
% </p>

HTH & HAND

;-D
--
David T-G * There is too much animal courage in
(play) davidtgjustpickone.org * society and not sufficient moral courage.
(work) davidtgworkjustpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

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

iD8DBQE/vfGmGb7uCXufRwARAjzQAKDRnxmtlY8O5ua1HxQEbeiVToQ/6QCgvKih
wffJMnjMfdy8jVGSTVFTiQM=
=PiIm
-----END PGP SIGNATURE-----

attached mail follows:


A customer of mine has recently started to see a weird error. He will get
the typical 'open_basedir' error, but it will say his allowed path is
another clients allowed path??? See an example below.

Warning : Unknown(): open_basedir restriction in effect.
File(/Sites/thissite.com/www/forums/admin/template.php) is not within the
allowed path(s): (/sites/othersite.com) in Unknown on line 0

I set all my clients up with 'php_admin_value' parameters in their config
files. Each vhost is assigned their own directory.

Any ideas? Where should I look to troubleshoot this one?

+--------------------------------------------+
Mike Yrabedra (President)
323 Incorporated
Home of MacDock.com, MacAgent.com and MacShirt.com
+--------------------------------------------+
W: http://www.323inc.com/
P: 770.382.1195
F: 734.448.5164
E: mike323inc.com
I: ichatmacdock
+--------------------------------------------+
"Whatever you do, work at it with all your heart,
as working for the Lord, not for men."
~Colossians 3:23 <{{{><
+--------------------------------------------+

attached mail follows:


On Fri, Nov 21, 2003 at 06:09:44AM -0500, MIKE YRABEDRA wrote:
:
: A customer of mine has recently started to see a weird error. He will get
: the typical 'open_basedir' error, but it will say his allowed path is
: another clients allowed path??? See an example below.
:
: Warning : Unknown(): open_basedir restriction in effect.
: File(/Sites/thissite.com/www/forums/admin/template.php) is not within the
: allowed path(s): (/sites/othersite.com) in Unknown on line 0
:
: I set all my clients up with 'php_admin_value' parameters in their config
: files. Each vhost is assigned their own directory.
:
: Any ideas? Where should I look to troubleshoot this one?

The most obvious difference is "/Sites" vs. "/sites". If your PHP
server is using a case-sensitive filesystem, I'd check the whole
uppercase-lowercase thing first.

attached mail follows:


on 11/21/03 6:47 AM, Eugene Lee at list-php-1fsck.net wrote:

> : A customer of mine has recently started to see a weird error. He will get
> : the typical 'open_basedir' error, but it will say his allowed path is
> : another clients allowed path??? See an example below.
> :
> : Warning : Unknown(): open_basedir restriction in effect.
> : File(/Sites/thissite.com/www/forums/admin/template.php) is not within the
> : allowed path(s): (/sites/othersite.com) in Unknown on line 0
> :
> : I set all my clients up with 'php_admin_value' parameters in their config
> : files. Each vhost is assigned their own directory.
> :
> : Any ideas? Where should I look to troubleshoot this one?
>
> The most obvious difference is "/Sites" vs. "/sites". If your PHP
> server is using a case-sensitive filesystem, I'd check the whole
> uppercase-lowercase thing first.

Not likely, I am running Mac OS X and have never had a 'case' problem.

+--------------------------------------------+
Mike Yrabedra (President)
323 Incorporated
Home of MacDock.com, MacAgent.com and MacShirt.com
+--------------------------------------------+
W: http://www.323inc.com/
P: 770.382.1195
F: 734.448.5164
E: mike323inc.com
I: ichatmacdock
+--------------------------------------------+
"Whatever you do, work at it with all your heart,
as working for the Lord, not for men."
~Colossians 3:23 <{{{><
+--------------------------------------------+

attached mail follows:


Ray --

...and then Ray said...
%
% I want to do two-way encryption on a file coming through the web server. In

That's an interesting name for it.

% this context, I would want to generate a public and private key, encrypt the
% file stream (i.e., don't want to write the unencrypted file to disk first
% and then encrypt it; I want to encrypt the stream as it comes in) with the

OK. Be aware that it will possibly get written to disk, though.

% public, send the private to the recipient, and then destroy both keys on my
% end.

Hmmm... *thinks* I can't remember if a private key alone is sufficient
to decrypt, although the public key alone is certainly enough to encrypt.
You might check on that.

%
% When the file was accessed and the private key was provided, I would want to
% stream the unencrypted file out without ever writing the unencrypted file to
% disk.

Note that your clear text could very well get written to disk: you are
very likely to have a swap space. I don't know of any way to tell php
that you don't want it (or really the OS) to lock some chunk in memory.

%
% Any ideas on how to accomplish this within the PHP construct?

Well, gnupg can encrypt and decrypt a stream, and there is a GNUPG class
at phpclasses.org, so I would probably leave all of the encryption and
key work to it and go that way.

If you really wanted to be secure, you might implement some javascript
or a java applet to encrypt it before it ever left the browser (and,
similarly, decrypt it when it's requested later); then you only ever
deal with the encrypted version (ick -- I can't believe I just suggested
J-anything).

%
% Thanks!

So what in the world is this data which must be so secure that even you
can't see it?

HTH & HAND

:-D
--
David T-G * There is too much animal courage in
(play) davidtgjustpickone.org * society and not sufficient moral courage.
(work) davidtgworkjustpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

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

iD8DBQE/vfR2Gb7uCXufRwARAm0PAJ9BSnGhOK07ZZV4cnmMQJim58XexQCeI4nG
cK5qJeVOFY/HT4A3tRA3eOY=
=HkYq
-----END PGP SIGNATURE-----

attached mail follows:


Hi,
can anyone suggest a free PHP Object Oriented
Programming book ...
Or an Object Oriented Book for web applications.

Plus i want to design customizable web pages:
- I can change the hole layout by changing one file
- If i change a database table i don't have to change
alot in the code
...

Is there any books that helps ??

thx.

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

attached mail follows:


    If you want customizable layout without changing the logic, try the MVC
approach (model-view-control).
    The best way to do it is to create the data from php in a XML (generate
the logic), then create the layout with XSL. Thus, if you want to change the
layout, all you have to do is to change the XSL. Aso, if you change the
logic, you'll vave to change just the php generating the XML.
    Right now I'm doing just that, and I think this is the best approach
(for me at least).
    There are several platforms that already have this MVC approach
implemented
    Take a look at: http://www.interakt.ro/products/Krysalis/
    It's a free PHP/XML/XSL platform that will help you to just that.

Regards,
Lucian

"Nagib Abi Fadel" <nagib_phpyahoo.com> wrote in message
news:20031121113446.5870.qmailweb60210.mail.yahoo.com...
> Hi,
> can anyone suggest a free PHP Object Oriented
> Programming book ...
> Or an Object Oriented Book for web applications.
>
> Plus i want to design customizable web pages:
> - I can change the hole layout by changing one file
> - If i change a database table i don't have to change
> alot in the code
> ...
>
> Is there any books that helps ??
>
> thx.
>
>
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/

attached mail follows:


Nagib Abi Fadel wrote:

> Hi,
> can anyone suggest a free PHP Object Oriented
> Programming book ...

I don't know of a free one. But
http://www.php.net/manual/en/ref.classobj.php is good starting point.
Also try http://www.zend.com/zend/tut/

> Or an Object Oriented Book for web applications.
>
> Plus i want to design customizable web pages:
> - I can change the hole layout by changing one file

http://www.w3.org/Style/CSS
http://www.glish/CSS
http://www.bluerobot.com

> - If i change a database table i don't have to change
> alot in the code

Use an external database abstraction library. Like PEAR::DB -- however
good database design will help a lot in this regard.

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
-----------------------
"Documentation is like sex: when it is good,
  it is very, very good; and when it is bad,
  it is better than nothing."

attached mail follows:


Hello,
my probelm is, if i create a module with apache 2.0 php 4.3.3 it doesn`t
work on the server were
apache 1.3.7 with php 4.2.2. is installed.
how can i create a modul with apache 2.0. with php 4.3.3 that works fine
with apache 1.3.7 and php 4.2.2 ?

--
thanks
Bernd

attached mail follows:


I'm trying to find a way to search text files in a directory using php. I've
done some researching under the filesystem section on php.net but seem to
have come up empty handed. Is there a way to do keyword searches on a txt
file in a directory hopefully with some type of relevance ranking?

Thanks

attached mail follows:


[snip]
I'm trying to find a way to search text files in a directory using php.
I've
done some researching under the filesystem section on php.net but seem
to
have come up empty handed. Is there a way to do keyword searches on a
txt
file in a directory hopefully with some type of relevance ranking?
[/snip]

This approach is rather simplistic, but may point you in the right
direction.

Open each file in the directory and count the number of times each key
word appears.
Return a list of links ranked by the number of times each key word
appears in each text file.

Just a starting point...HTH