[PHP] mod_php / apache config

2002-09-03 Thread Lee Doolan


I apologize beforehand in case this message is posted twice.


If there is some way to do this, then it has eluded me for several
hours.  I would like to set a variable in the apache config file which
I can then access in a php script.  I'm running mod_php4 and apache 1

I have tried things like this:
php_value WSERVER red2.office.com

and this:
SetEnv WSERVER red2.office.com

with and without quotes.  mod_env is loaded.  I can't find the
variable WSERVER in $GLOBALS or $_ENV of $_GET.

can someone help out?

-- 
Flowers of morning glory.  +-+
The sky above this street  |donate to causes I care about:   |
Begins to overcast.|  http://svcs.affero.net/rm.php?r=leed_25|
   --Sugita+-+

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




[PHP] mod_php4 / apache config question

2002-09-03 Thread Lee Doolan



If there is some way to do this, then it has eluded me for several
hours.  I would like to set a variable in the apache config file which
I can then access in a php script.  I'm running mod_php4 and apache 1

I have tried things like this:
php_value WSERVER red2.office.com

and this:
SetEnv WSERVER red2.office.com

with and without quotes.  mod_env is loaded.  I can't find the
variable WSERVER n $GLOBALS or $_ENV of $_GET.

can someone help out?

-- 
Flowers of morning glory.  +-+
The sky above this street  |donate to causes I care about:   |
Begins to overcast.|  http://svcs.affero.net/rm.php?r=leed_25|
   --Sugita+-+

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




[PHP] how to time an http request

2002-09-18 Thread Lee Doolan



is there a program which i can run in a unix environment (FreeBSD or
redhat) which can run, say, 100 requests on a url and then report the
total time spent on the requests?  i know that i could run curl or
wget in a loop, but i would have to account for the fork-exec time
somehow.  i hope that the question is clear.


-- 
Flowers of morning glory.  +-+
The sky above this street  |donate to causes I care about:   |
Begins to overcast.|  http://svcs.affero.net/rm.php?r=leed_25|
   --Sugita+-+

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




[PHP] my i ramble for a while?

2002-09-20 Thread Lee Doolan




I am posting this message to the php.general newsgroup because I used
php to construct the dynamic portion of our site and because I value
the opinions of many people who frequently post here.  I hope that
this will not be viewed as off-topic --if it is, I will take it
elsewhere.

At affero we are beginning to think in terms of publishing certain
data to whomsoever might wish to use it for whatever reason.  Here's a
first cut attempt to provide such a service:

 http://pws.affero.net/hof/topPatrons


returns an HTML  ...  structure suitable for use as,
say, a server side include.

Another kind of data which we might publish is what we refer to as a
'dense reputation' or a 'reputation summary'.  For an example of a
dense reputation you can point a browser at this URL

http://svcs.affero.net/user-history.php?u=Poole

the dense reputation appears highlighted after the user id on the top
line of the page.



One of the things that concerns me lately is how to make data such as
these available as widely as possible.


I have looked in to RSS for a few days and, while I am somewhat
confused, I have begun to come more or less to the conclusion that RSS
is employed mainly for syndicated news feeds and probably is not
appropriate for publishing tabular data and short strings.


Maybe some kind of procedure call mechanism, eh?  SOAP and XML-RPC
seem to be competing technologies, though.  If we support one of them,
how many sites will be excluded from accessing the data which we wish
to make available?  Should we support both?


XML seems attractive because it can be styled into so many different
kind of presentations, but I just can't tell if this would be
appropriate.


I was wondering if anyone might be able to share thoughts or opinions
or experience related to such issues.



-lee


-- 


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




[PHP] parsing HTML text

2002-05-07 Thread Lee Doolan



I have written form screen which has as one of it's elements a
 box in which a user can input some text --like a simple
bio-- which will appear on another screen.  I'd like to edit check
this text. It would be a good idea to make sure that it has, among other
things, no  elements, say, or to make sure that if a 
tag occurs, that a matching  tag is present.

Is anyone aware of a  class or a package which I can use to parse this
text and do this kind of validation?

tia
-lee

-- 
When the birdcage is open,   | donate to causes I care about: 
the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays.  |

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




[PHP] question about ? :

2002-06-13 Thread Lee Doolan


the arrays below have dates like
dateA= array( 0=> "03", 1=> "22", 2=> "02") 

for 22march2002.

why does this work:

$retval= ($dateA[2] != $dateB[2])
 ? strcmp($dateA[2], $dateB[2])
 : (($dateA[0] != $dateB[0])
 ? strcmp($dateA[0], $dateB[0])
 : (($dateA[1] != $dateB[1])
 ? strcmp($dateA[1], $dateB[1])
 : 0));


but not this:

$retval= ($dateA[2] != $dateB[2])
 ? strcmp($dateA[2], $dateB[2])
 : ($dateA[0] != $dateB[0])
 ? strcmp($dateA[0], $dateB[0])
 : ($dateA[1] != $dateB[1])
 ? strcmp($dateA[1], $dateB[1])
 : 0;

-- 
When the birdcage is open,   | donate to causes I care about: 
the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays.  |

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




Re: [PHP] question about ? :

2002-06-13 Thread Lee Doolan

>>>>> "Miguel" == Miguel Cruz <[EMAIL PROTECTED]> writes:

    Miguel> On 13 Jun 2002, Lee Doolan wrote:
>> the arrays below have dates like dateA= array( 0=> "03", 1=>
>> "22", 2=> "02")
>> 
>> for 22march2002.
>> 
>> why does this work:
>> 
>> $retval= ($dateA[2] != $dateB[2]) ? strcmp($dateA[2],
>> $dateB[2]) : (($dateA[0] != $dateB[0]) ? strcmp($dateA[0],
>> $dateB[0]) : (($dateA[1] != $dateB[1]) ? strcmp($dateA[1],
>> $dateB[1]) : 0));
>> 
>> 
>> but not this:
>> 
>> $retval= ($dateA[2] != $dateB[2]) ? strcmp($dateA[2],
>> $dateB[2]) : ($dateA[0] != $dateB[0]) ? strcmp($dateA[0],
>> $dateB[0]) : ($dateA[1] != $dateB[1]) ? strcmp($dateA[1],
>> $dateB[1]) : 0;

Miguel> Why does this:

Miguel> $x = 3 + 5 * 7;

Miguel> produce different results from this:

Miguel> $x = (3 + 5) * 7;

Miguel> ?

Miguel> miguel

The two cases are not the same.  In the case above, all operators are
ternary --with equal precedence-- but in your case, the operators are
of different precedence.  

As I pointed out to you in e-mail, both of the ternary forms in my
original question would evaluate to the same thing if they were in s C
program.  That, admittedly, is no reason why they should evaluate to
he same thing in PHP but it was enough to make me wonder...

-- 
When the birdcage is open,   | donate to causes I care about: 
the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays.  |

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




[PHP] request for comments

2002-04-03 Thread Lee Doolan



the dynamic portion of the recently launched
www.affero.com has been implemented with php /
smarty / postgreSQL.  

the source can be downloaded here:
http://www.affero.org/source/latest.tar.gz

i would not call this a 'distribution' by any
stretch of the imagination.  for one thing, it will
not work out of the box since no credit card
processing code is included in the tarball.

i would be curious about any remarks, positive or
negative which anyone might have.

-lee

-- 
Share your feedback at Affero:
http://svcs.affero.net/rm.php?r=leed_25

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




[PHP] Re: request for comments

2002-04-04 Thread Lee Doolan

>>>>> "Lee" == Lee Doolan <[EMAIL PROTECTED]> writes:

Lee> the dynamic portion of the recently launched www.affero.com
Lee> has been implemented with php / smarty / postgreSQL.
   [. . .]
Lee> i would be curious about any remarks, positive or negative
Lee> which anyone might have.

So, I have gotten some feedback, mostly negative concerns with the
  static portion of the site and it's similarity to the php.net site.

We are currently looking to get an experienced UI engineer on board,
  but you'd be surprised how hard it is to find one.

Actually, the mission of our service is to try to raise money for Open
  Source projects in particular and, eventually, worthwhile causes in
  general.  If you can get beyond the appearance of the site, I'd really
  like to know what people think about the service.

-- 
Share your feedback at Affero:
http://svcs.affero.net/rm.php?r=leed_25

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




Re: [PHP] how to process URL parameers

2002-04-05 Thread Lee Doolan

> "Erik" == Erik Price <[EMAIL PROTECTED]> writes:
   [. . .]

Erik> There is another way, it's a bit more involved.  You open a
Erik> socket with the server and directly send the data as POST
Erik> data.  This allows you to avoid having to bother with a
Erik> form.  Rasmus Lerdorf wrote a function to do this (takes
Erik> most of the work out of it) but it helps to understand how
Erik> sockets work if you're going to take this route.  Let me
Erik> know if you want this function, I have a copy of it.

you can use curl also.

-- 
Share your feedback at Affero:
http://svcs.affero.net/rm.php?r=leed_25

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




[PHP] Re: Can anyone improve on this?

2002-04-08 Thread Lee Doolan

> "George" == George Pitcher <[EMAIL PROTECTED]> writes:

George> Hi all, I'm working on a small solution and want to do
George> some configuration during the initialising process.

George> The solution is aimed at non tecchies in universities and
George> the idea is that the system does some of the environment
George> stuff for them.

George> This is the first time I've done any of this stuff so I
George> might be off-target.  Any suggested imptovements?

George> George

George>  if(in_array("Windows_NT",$HTTP_ENV_VARS)){
George> $pdf_path="C:\\Pdf\\";
George> if(substr($SERVER_SOFTWARE,0,6)=="Apache"){
George> $webroot=$DOCUMENT_ROOT;
George> }elseif(substr($SERVER_SOFTWARE,0,13)=="Microsoft-IIS"){
George> $webroot=str_replace(str_replace("/","",$PATH_INFO),"",$PATH_TRANSLATED);
George> }
George> }elseif(in_array("linux_gnu",$HTTP_ENV_VARS)){
George> $pdf_path="/var/pdf/";
George> if(substr($SERVER_SOFTWARE,0,6)=="Apache")
George> $webroot=$DOCUMENT_ROOT;
George> }
George> ?>



One thing that I like to do is to make sure that skip chains
are terminated with an else block.  for instance:

if (COND A) {
statements for condition a

} else if (COND B) {
statements for cond b

} else if (COND C) {
statements for cond c

} else {
none of conditions A, B, C held
}


this is a personal preference, though, influenced by my distaste
for analyzing weird faults.

-- 
Share your feedback at Affero:
http://svcs.affero.net/rm.php?r=leed_25

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




[PHP] Re: Scoping functions in PHP

2002-04-11 Thread Lee Doolan

> "Eric" == Eric Starr <[EMAIL PROTECTED]> writes:

Eric> I am a Java programmer learning PHP.  In Java you can have a
Eric> class that contains public and private functions.  Only the
Eric> public functions are accessible outside of the class.  Does
Eric> PHP have a way to hide functions within a class (i.e. make
Eric> the private)?

Well, one thing which you could do is to use the scout's honor
protocol: define all of your private methods or protected methods
according to some naming convention, say, beginning with 'p' followed
by two underbars (p__) for private methods.

Then, use an 'honor lock'; only call such functions from authorized
locii such as own classes for private methods or derived classes
for protected functions and so forth...

-l

-- 
Share your feedback at Affero:
http://svcs.affero.net/rm.php?r=leed_25

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




[PHP] Re: Date Comparsion

2002-06-18 Thread Lee Doolan

> "Jack" == Jack  <[EMAIL PROTECTED]> writes:

Jack> Dear all I had a form which let user to input the leave_from
Jack> and leave_to date into, the format of the date that user
Jack> input is "-mm-dd".  Now i want to compare the leave_from
Jack> and leave_to date to find out the number of days between!

well, here's one way:

$interval_days= (strtotime($to_date) - strtotime($from_date)) / 3600 * 24

adjust to taste.


-- 
When the birdcage is open,   | donate to causes I care about: 
the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays.  |

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




[PHP] Re: another pair of eyes?

2002-07-12 Thread Lee Doolan

> "Jas" == Jas  <[EMAIL PROTECTED]> writes:

Jas> Hello all,
Jas> I have a parse error and I am not sure why, I think my eyes are giving up on
Jas> me, or its a friday.  Any help is appreciated.
Jas> // just trying to compare the session var $date to timeout if older than 5
Jas> minutes
Jas> [snippit]
Jas> /* Begin Session and register timeout, random image & client info variables
Jas> */
Jas>session_start();
Jas>session_register('$var1);
   .
  /\\
 / \ \
   \
missing single quote   '

Jas>session_register('$var2');
Jas>session_register('$var3');
Jas>session_register('$var4');
Jas>session_register('$var5');
Jas>   } elseif (isset($HTTP_SESSION_VARS[$hour]) => $hour + 5*60)) {
  .
 /\\
/ \ \
  \
extra parenthesis  ---'
Jas>header("Location: https://localhost/index.php"};
  .
 /\\
/ \ \
  \
should be paren, not curly'
Jas>   } else {
Jas>   endif(); }
   ??
  .
 /\\
/ \ \
  \
huh?   ---'

Jas> [end snippit]




--
When the birdcage is open,   | donate to causes I care about:
the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays.  |

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




[PHP] Re: Submit code

2002-07-16 Thread Lee Doolan



here's an excerpt from a script in which I do something like that:

$pdArgs=
 "demo=" . urlencode($argAry['demo']) . "&" .
 "first_name=" . urlencode($argAry['first_name']) . "&" .
 "last_name=" . urlencode($argAry['last_name']) . "&" .

   [. . .]


$URL= "https://HOST.DOMAIN/SCRIPT.php";;
exec("/usr/bin/curl -m 120 -d \"$pdArgs\" $URL -L", $httpResponse, $exitCode);
if ($exitCode != 0) {
header ("Location: error.php?code=" . urlencode("https: failure.  Exit code is 
$exitCode"));
exit;
}

--
When the birdcage is open,   | donate to causes I care about:
the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays.  |

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




[PHP] Re: Comma question

2002-07-22 Thread Lee Doolan

> "B" == B I G D O G <[EMAIL PROTECTED]> writes:

B> Tried to check the archive, but it is offline...  What does the
B> "," and "{}" do in this type of statement?

B> Example: echo "{$strName}", htmlspecialchars(

in this case, the {}s don't really do anything; but {}s allow variables
like this

echo "{$obj->strName[$i]}";

and so forth.

   

-- 
When the birdcage is open,   | donate to causes I care about: 
the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays.  |

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




[PHP] Re: OO Programming - get practical

2002-07-23 Thread Lee Doolan

> "Paul" == Paul Dionne <[EMAIL PROTECTED]> writes:
   [. . .]

Paul> So, I guess my point is that if people want to encourage use
Paul> of OO programming, they need to use more examples in their
Paul> books instead of what is "easy."

   [. . .]

then again there is the time honored tradition of reading code.  this
is really not as hard as it seems.  may i recommend this link?

http://phpclasses.optip.com/browse.html/browse.html

i'm sure that if you look around, you can find others.  php is
everywhere.


-- 
When the birdcage is open,   | donate to causes I care about: 
the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays.  |

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




Re: [PHP] Credit card checks?

2002-07-23 Thread Lee Doolan

> "Kristopher" == Kristopher Yates <[EMAIL PROTECTED]> writes:
   [. . .]
Kristopher> I dont know about AuthorizeNet, but LinkPoint has an
Kristopher> API written in PHP that is supposed to be inexpensive,
Kristopher> and easilly integratable into any PHP apps.  I heard
Kristopher> it was only $125.00..  Not a bad price for a few
Kristopher> hundred lines of code.  I am in no way affiliated with
Kristopher> or trying to advertise for these companies.  Hope this
Kristopher> helps, Kris

The linpoint API is, indeed, easy o integrate into a PHP app.   Linkpoint's
level of service could use some improvement, however.  


-- 
When the birdcage is open,   | donate to causes I care about: 
the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays.  |

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




[PHP] Re: parsing

2002-07-23 Thread Lee Doolan

> "Dave" == Dave At Sinewaves Net <[EMAIL PROTECTED]> writes:

Dave> Okay, I want to know if anybody has a clue which is more
Dave> efficient, processorwise/parsingwise:

Dave> this: -- echo
Dave> "".$somevar."".$somevardesc."";

Dave> or this: -- echo
Dave> "{$somevar}{$somevardesc}";


Dave> I almost always use the first method (just seems more
Dave> readable to me), but with all of the discussion popping up
Dave> about curly brackets, i was wondering if it really makes a
Dave> difference?  Any vets out there care to put in their $0.02?

I bet that this would beat the pants off of both:

echo ''. $somevar . '' . $somevardesc . '';


-- 
When the birdcage is open,   | donate to causes I care about: 
the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays.  |

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




[PHP] Re: how to debug mail() problem?

2002-07-30 Thread Lee Doolan

> "Manuel" == Manuel Lemos <[EMAIL PROTECTED]> writes:
   [. . .]

Manuel> Anyway, if all else fails, you may want to try to use this
Manuel> class:

Manuel> http://www.phpclasses.org/smtpclass

Manuel> maybe in conjunction with this

Manuel> http://www.phpclasses.org/mimemessage

Just by way of affirmation, here --as _though_ it were actually needed-- 
I've been using the smtpclass for a while now.  It rocks.

-lee

-- 
When the birdcage is open,   | donate to causes I care about: 
the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays.  |

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




Re: [PHP] How to become a good PHP coder?

2002-07-31 Thread Lee Doolan

> "Wee" == Wee Keat <[EMAIL PROTECTED]> writes:
   [. . .]
Wee> might be new, but I deeply appreciate the generosity that all
Wee> of you have given us

One way to show your appreciation sincerely would be to help others
in the same way that people have helped you.


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




[PHP] Re: Cookie array

2002-08-10 Thread Lee Doolan

> "Jan" == Jan  <[EMAIL PROTECTED]> writes:

Jan> Hi !  How can I stoor array in to a cookie ?

Jan> Do I just define an array and stoore it in a cookie ?  How do
Jan> I access the data in the array then ?

you can use serialize() / unserialize() but be careful because the
amount of storage allowed in a cookie is limited.  what i do is to
store thing like serialized arrays and serialized objects in a database
table indexed by the session id.


-- 
Flowers of morning glory.  +-+
The sky above this street  |donate to causes I care about:   |
Begins to overcast.|  http://svcs.affero.net/rm.php?r=leed_25|
   --Sugita+-+

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




[PHP] Re: XML Array

2003-07-16 Thread Lee Doolan
> "Michael" == Michael Smith <[EMAIL PROTECTED]> writes:

Michael> Hey, I'm looking for a function to take an XML file and
Michael> turn it into a PHP array with the same structure.

here's something that I found on the internet a few months back.  I've
used it a number of times:

  C U TH E R E  C U TH E R E  C U TH E R E 


/* xmlize() is by Hans Anderson, [EMAIL PROTECTED]
 *
 * Ye Ole "Feel Free To Use it However" License [PHP, BSD, GPL].
 * some code in xml_depth is based on code written by other PHPers
 * as well as one Perl script.  Poor programming practice and organization
 * on my part is to blame for the credit these people aren't receiving.
 * None of the code was copyrighted, though.
 *
 * This is a stable release, 1.0.  I don't foresee any changes, but you
 * might check http://www.hansanderson.com/php/xml/ to see
 *
 * usage: $xml = xmlize($array);
 *
 * See the function traverse_xmlize() for information about the
 * structure of the array, it's much easier to explain by showing you.
 * Be aware that the array is somewhat tricky.  I use xmlize all the time,
 * but still need to use traverse_xmlize quite often to show me the structure!
 *
 */

function xmlize($data, $WHITE=1) {

$data = trim($data);
$vals = $index = $array = array();
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, $WHITE);
xml_parse_into_struct($parser, $data, $vals, $index);
xml_parser_free($parser);

$i = 0;

$tagname = $vals[$i]['tag'];
if ( isset ($vals[$i]['attributes'] ) )
{
$array[$tagname]['@'] = $vals[$i]['attributes'];
} else {
$array[$tagname]['@'] = array();
}

$array[$tagname]["#"] = xml_depth($vals, $i);

return $array;
}

/*
 *
 * You don't need to do anything with this function, it's called by
 * xmlize.  It's a recursive function, calling itself as it goes deeper
 * into the xml levels.  If you make any improvements, please let me know.
 *
 *
 */

function xml_depth($vals, &$i) {
$children = array();

if ( isset($vals[$i]['value']) )
{
array_push($children, $vals[$i]['value']);
}

while (++$i < count($vals)) {

switch ($vals[$i]['type']) {

   case 'open':

if ( isset ( $vals[$i]['tag'] ) )
{
$tagname = $vals[$i]['tag'];
} else {
$tagname = '';
}

if ( isset ( $children[$tagname] ) )
{
$size = sizeof($children[$tagname]);
} else {
$size = 0;
}

if ( isset ( $vals[$i]['attributes'] ) ) {
$children[$tagname][$size]['@'] = $vals[$i]["attributes"];
}

$children[$tagname][$size]['#'] = xml_depth($vals, $i);

break;


case 'cdata':
array_push($children, $vals[$i]['value']);
break;

case 'complete':
$tagname = $vals[$i]['tag'];

if( isset ($children[$tagname]) )
{
$size = sizeof($children[$tagname]);
} else {
$size = 0;
}

if( isset ( $vals[$i]['value'] ) )
{
$children[$tagname][$size]["#"] = $vals[$i]['value'];
} else {
$children[$tagname][$size]["#"] = '';
}

if ( isset ($vals[$i]['attributes']) ) {
$children[$tagname][$size]['@']
 = $vals[$i]['attributes'];
}

break;

case 'close':
return $children;
break;
}

}

return $children;

}


/* function by [EMAIL PROTECTED], a HUGE help!
 *
 * this helps you understand the structure of the array xmlize() outputs
 *
 * usage:
 * traverse_xmlize($xml, 'xml_');
 * print '' . implode("", $traverse_array . '';
 *
 *
 */

function traverse_xmlize($array, $arrName = "array", $level = 0) {

foreach($array as $key=>$val)
{
if ( is_array($val) )
{
traverse_xmlize($val, $arrName . "[" . $key . "]", $level + 1);
} else {
$GLOBALS['traverse_array'][] = '$' . $arrName . '[' . $key . '] = "' . 
$val . "\"\n";
}
}

return 1;

}

-- 
Flowers of morning glory.  +-+
The sky above this street  |donate to causes I care about:   |
Begins to overcast.| http://svcs.affero.net/rm.php?r=leed_25 |
   --Sugita+-+

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



[PHP] Re: XML Array

2003-07-16 Thread Lee Doolan
>>>>> "Lee" == Lee Doolan <[EMAIL PROTECTED]> writes:
>>>>> "Michael" == Michael Smith <[EMAIL PROTECTED]> writes:
Michael> Hey, I'm looking for a function to take an XML file and
Michael> turn it into a PHP array with the same structure.

Lee> here's something that I found on the internet a few months
Lee> back.

here I am following up my own post yet again.. I forgot to include an example of
use.  here's a little snippet that uses xmlize():


##  probably actually should use join here.  I guess I was too concerned
##  about the whitespace  
$xData="";
while (list($k, $v)= each($xml)) {
$xData .= trim($v);
}

##  turn the XML into an array
$ary= xmlize($xData);

##  split into several different arrays depending on donation amount
$hofTable= $ary['patronHofTable']['#']['tableData']['0']['#']['hofTableEntry'];
$platinumAry= $goldAry= $silverAry= $insiderAry= array();

if (!isset($hofTable['0']['#']['text'])) {
foreach($hofTable as $hofkey => $hofVal) {
$entry= $hofVal['#']['Data']['0']['#'];
if ($entry > 999) {
$platinumAry[]= $hofVal;

} else if ($entry > 499) {
$goldAry[]= $hofVal;

} else if ($entry > 99) {
$silverAry[]= $hofVal;

} else {
$insiderAry[]= $hofVal;
}
}
}

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



[PHP] Re: replacing everything between 2 strings

2003-07-21 Thread Lee Doolan
> "Matt" == Matt Palermo <[EMAIL PROTECTED]> writes:

Matt> Is there a way to replace everything between 2 given strings
Matt> if it exists?  Say I have:
 
Matt> $str = "replace anything and everything in here.";
 
Matt> Now I want to replace everything between the word "replace"
Matt> and "here.", so the new string could read something like
Matt> this:
 
Matt> $str = "replace NOTHING here.";

how about something like this (untested)
$newStr= preg_replace("/^(replace).*(here)$/", "${1} NOTHING ${2}", $str);

sort of  like in the manual:
http://www.php.net/manual/en/function.preg-replace.php 

-- 

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



[PHP] Re: preg_match

2003-08-02 Thread Lee Doolan
> "Michael" == Michael Temeschinko <[EMAIL PROTECTED]> writes:

Michael> Hello,
Michael> I would like to split a String containing ingredience with additional
Michael> assigned footnotes...

Michael> my problem I only get the first ingredience ($zutat at line 32 has
Michael> only one times the awaited value) but the print on line 29 shows me
Michael> that the value of $zutat is right at this point.

Michael> what's wrong 

Michael>1 2
Michael>3 $products_ingredience = 'Gersten-Grütze²*, Gerstenmehl²*,
Michael> Haferflocken*, Gemüse 12 % (Lauch*, Möhren*, Zwiebeln*), Haferkleie*,
Michael> Steinsalz, Petersilie*, Kartoffelstärke*, Hefeextrakt, Sellerieblatt*,
Michael> Kurkuma*, Muskatnuß*, Pfeffer*, Liebstöckl*';
Michael>4
Michael>5 ArtikelZutaten ($products_ingredience);
Michael>6
Michael>7
Michael>8 function ArtikelZutaten($products_ingredience) {
Michael>9
Michael>   10
Michael>   11 print "\n\n\n$products_ingredience)";
Michael>   12 $Zutaten = explode(",", $products_ingredience);
Michael>   13
Michael>   14 foreach ($Zutaten as $zutat) {
Michael>   15 if (preg_match("/\²/", $zutat))
Michael>   16 $FussnoteID = 2;
Michael>   17 else
Michael>   18 $FussnoteID = '';
Michael>   19
Michael>   20 if (preg_match("/¹/", $zutat))
Michael>   21 $FussnoteID = 1;
Michael>   22
Michael>   23 if (preg_match("/\*/", $zutat))
Michael>   24 $kbA = 1;
Michael>   25 else
Michael>   26 $kbA = 0;
Michael>   27
Michael>   28 preg_match("/\b.*\b/", $zutat, $matches);
Michael>   29 print "\n-->>$zutat";
Michael>   30 $zutat = $matches[0];
Michael>   31
Michael>   32 print "\nZutat $zutat FussnotenID $FussnoteID kbA $kbA";
Michael>   33
Michael>   34 }
Michael>   35
Michael>   36 }
Michael>   37
Michael>   38 ?>

what do you get if you 
  print "\nmatches matches..."; var_dump($matches);

right after line 32?

-- 
no toll on the internet; there are paths of many kinds;
whoever passes this portal will travel freely in the world

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



[PHP] reserver variable names

2003-05-31 Thread Lee Doolan

I could swear that I once saw a statement to the effect that
certain variable names were reserved in PHP.  Something along
the lines of

''variable names starting with two underscores (__) are
reserved... ''

Is anyone else aware of this or do I have a circuit crossed
somewhere?

thanx
--lee

-- 
Flowers of morning glory.  +-+
The sky above this street  |donate to causes I care about:   |
Begins to overcast.| http://svcs.affero.net/rm.php?r=leed_25 |
   --Sugita+-+

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



Re: [PHP] converting GET to POST

2003-10-16 Thread Lee Doolan
> "Marek" == Marek Kilimajer <[EMAIL PROTECTED]> writes:
> "Kris" == Kris Yates writes:

Marek> You can do it this way:
Marek> https://www.fake.com/fake.php";>
Marek> 
Marek> 
Marek> 

Actually, I think that if you do it this way, someone will have to
click on the submit button.  If you want to redirect with a post, then
look in to using the CURL library.

Marek> Kris Yates wrote:
Kris> Currently, I am posting via GET to third party server as seen below:
Kris> $item=urlencode($item);
Kris> header("Location: https://www.fake.com/fake.php?item=$item";);
Kris> I want to reconfigure my header calls to POST instead of using GET
Kris> for sending $item to third party server.  Is this doable?
Kris> Thank you,
Kris> Kris
Kris> 

-- 
no toll on the internet; there are paths of many kinds;
whoever passes this portal will travel freely in the world

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



[PHP] Re: [PHP-DB] $_POST in MySQL query issue...

2003-10-19 Thread Lee Doolan
> "Adam" == Adam Reiswig <[EMAIL PROTECTED]> writes:

Adam> A couple of days ago I placed a post regarding using the
Adam> $_POST[] variable in an insert sql query.  Both

Adam> $sql="insert into $table set Name =
Adam> '".$_POST['elementName']."'"; and $sql="insert into $table
Adam> set Name = '{$_POST['elementName']}'";

The only remark which I would make here is to beware of SQL injection.
Here are a couple of good resources to explain what an SQL injection
attack is and what you should do to protect your code:
http://www.securiteam.com/securityreviews/5DP0N1P76E.html
http://www.sitepoint.com/article/794


-- 
no toll on the internet; there are paths of many kinds;
whoever passes this portal will travel freely in the world

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



Re: [PHP] recursive acronym - PHP

2003-11-02 Thread Lee Doolan
> "Joachim" == Joachim Krebs <[EMAIL PROTECTED]> writes:

Joachim> Perhaps it is time to break the record.
Joachim> Evan Nemerson wrote:
>> How can you forget the Hurd???

Xinu Is Not Unix

also

MT XINU is UNIX TM backwards

-- 
no toll on the internet; there are paths of many kinds;
whoever passes this portal will travel freely in the world

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