php-general Digest 21 Nov 2005 16:00:12 -0000 Issue 3807

2005-11-21 Thread php-general-digest-help

php-general Digest 21 Nov 2005 16:00:12 - Issue 3807

Topics (messages 226171 through 226204):

Some good framework for new website
226171 by: ÕÔ¹â
226176 by: Roman Ivanov

new to sessions, but learning
226172 by: matt VanDeWalle
226173 by: Roman Ivanov
226174 by: Roman Ivanov

Can't execute external program
226175 by: Voip tech

Deployment and maintenance of php software
226177 by: Andy Pieters
226192 by: Oliver Grätz

Re: php related segmentation fault with Apache 2.0.55
226178 by: Marco Kaiser

php5 call by refference
226179 by: Georgi Ivanov
226181 by: David Grant
226183 by: Jochem Maas
226185 by: Marcus Bointon
226191 by: Oliver Grätz
226194 by: Georgi Ivanov

Re: mod_rewrite and include paths
226180 by: Marcus Bointon

Re: APC caching keys.
226182 by: Marcus Bointon
226186 by: Jochem Maas
226188 by: Marcus Bointon

Re: using ($test)?$true:$false in a string
226184 by: Jochem Maas
226187 by: Marcus Bointon
226198 by: Chris Boget
226199 by: Robert Cummings
226200 by: Richard Heyes
226201 by: Robert Cummings
226202 by: Richard Heyes
226203 by: Jochem Maas

Re: showing in pages selecting result?
226189 by: Jochem Maas
226193 by: xkorakidis

Re: PHP 4.4.1 on Apache 2.0.x issue
226190 by: Marcus Bointon

Sorting users geographically...
226195 by: Tony Di Croce
226196 by: David Grant
226197 by: Jim Moseby

Cookie problem with IE
226204 by: Kristen G. Thorson

Administrivia:

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

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

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
i am new to php,i want to write a website contain
blog(mutil-user),forum and album.
who can tell me some good framework can accelerate developing.and any
exist web site implement the fuction i wanted,please tell me some for
reference.
thanks for all.
--
/**
* Love in Gentoo-Linux  C and Python
* Look at my blog
* http://poorc.wordpress.com
**/
---End Message---
---BeginMessage---

赵光 wrote:

i am new to php,i want to write a website contain
blog(mutil-user),forum and album.


This is pretty basic stuff. Why don't you try some CMS first?

http://www.xaraya.com/
http://www.joomla.org/
http://www.drupal.org/
---End Message---
---BeginMessage---

hello,
I am writing basically what is hopefully going to turn out eventually to 
be a penpal website.  There are millions out there i know but some are 
to slow and only load half the page whenever it feels like it + 
has a bazillion ads and well, other things..so I decided to write my own.
What I am wanting to know, is it possible to do the signup thing in two 
parts using sessions.  I basically have the signup info first, then so the 
user doesn't have to come back later, they can fill out their profile 
right then and there, on the next page.  I'm thinking about saving the 
signup info and then when the user clicks continue, it would have their 
info.  I know session vars work between two pages but will sessions work 
across 3 and 4 pages or not?

thanks
matt
---End Message---
---BeginMessage---

matt VanDeWalle wrote:

hello,
I know session vars work between two pages but will 
sessions work across 3 and 4 pages or not?


Yes.
---End Message---
---BeginMessage---
I mean, yes they will work across multiple pages. Thy store data locally 
and re-load it, identifying necessary information by session ID which is 
stored in cookie on the client side.
---End Message---
---BeginMessage---
Hello,
I cannot get exec(), system() or passthru() to run an extenal program.
From the command line it runs perfectly:
[EMAIL PROTECTED] html]# /var/www/html/myprog -E 123456789098.dat sample1.txt
sample1.new
(no output, it just creates the file .new)

Here is the php I've created, fairly simple:
?php
exec(/var/www/html/myprog -E 123456789098.dat sample1.txt
sample1.new);
?
I've tried using full paths as well
From other threats I've double-checked this:
 - safe mode is disabled
 - the values for max_execution_time and memory_limit are large enough
for this simple program.
 - permissions are correct for all files involved:
any user can run the program ( rwxr-xr-x )
any user can read input files
apache is the owner of all files involved

I'm getting frustrated, Any  help will be deeply appreciated
Henry
---End Message---
---BeginMessage---
 Hi all

I am a php developer and develop huge packages.  Those packages are then 
installed by my clients or clients of my resellers on a score of webservers.  
As with all applications, bugfixes, and updates are 

Re: [PHP] php related segmentation fault with Apache 2.0.55

2005-11-21 Thread Marco Kaiser
Hi Kristina,

have you tried the lates cvs snap? I know there was some problems with
apache2 and mod_rewrite maybe it is solve in CVS.

--
Marco Kaiser

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



[PHP] php5 call by refference

2005-11-21 Thread Georgi Ivanov
Hi,
AFAIK, in PHP5 one can't call function with function parameters .
The error is that you only can pass variables by reference.
foo(strlen('aaa'),strlen(''));

Is there some sort of workaround ?

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



Re: [PHP] mod_rewrite and include paths

2005-11-21 Thread Marcus Bointon
I found the source of my mod_rewrite problems. I was doing everything  
right to start with - The odd behaviour was due to a PHP bug (http:// 
bugs.php.net/bug.php?id=35059) that's fixed in 4.4.2-dev and 5.1.0RC7- 
dev (I'd assume 5.0.x as well). Recompiling with a new checkout works  
fine.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] php5 call by refference

2005-11-21 Thread David Grant
Georgi,

You should assign the output of the functions to variables before the
call and use those variables as the parameters.

Cheers,

David Grant

Georgi Ivanov wrote:
 Hi,
 AFAIK, in PHP5 one can't call function with function parameters .
 The error is that you only can pass variables by reference.
 foo(strlen('aaa'),strlen(''));
 
 Is there some sort of workaround ?
 

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



Re: [PHP] APC caching keys.

2005-11-21 Thread Marcus Bointon

On 19 Nov 2005, at 04:07, Curt Zirzow wrote:


If you are using mysql i would use the SQL_CACHE flag, it will
eliminate the need for you to manage the cache.


You don't necessarily need to us the SQL_CACHE flag in queries - you  
can just turn on the query cache globally using query_cache_type=1 in  
your my.cnf. Otherwise I quite agree - and MySQL has the huge  
advantage that it will work very nicely across multi-server deployments:


http://dev.mysql.com/doc/refman/5.0/en/query-cache.html


The last version of php5.1 i have installed APC on is a cvs
snapshot of around Feb 4 2005 11:49:05. Nothing special was needed.


The current 3.0.8 release of APC is broken in PHP 5.1.0-dev if you  
ever use __autoload. It will be fixed in 3.0.9 (and is fixed in CVS),  
though Rasmus implied that 3.0.9 is waiting until 5.1 release.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] php5 call by refference

2005-11-21 Thread Jochem Maas

Georgi Ivanov wrote:

Hi,
AFAIK, in PHP5 one can't call function with function parameters .
The error is that you only can pass variables by reference.


which means that you can't use a function call as the argument to a
function that required the argument to be passed by reference, if the
argument is not passed by reference then you can use a function call as
the argument directly.

apart from, atleast,  func_get_args() which cannot be used directly as a
function argument for some reason I don't fully understand (has to do
with engine internals I believe)


foo(strlen('aaa'),strlen(''));

Is there some sort of workaround ?



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



Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Jochem Maas

Dylan wrote:

Hi

Is it possible to use the ($test)?$true:$false construction in a (double
quoted) string without dropping out of the string and concatenating? I have
many lines like:

$var = first part of string .(($a==$b)?$c:$d). rest of string;

and I feel it would be more elegant to be able to do something like:

$var =first part of string {(($a==$b)?$c:$d)} rest of string;


$templateStr = 'first part of string %s rest of string';
$outputStr   = sprintf($templateStr, (($a==$b)?$c:$d));



Cheers
Dylan



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



Re: [PHP] php5 call by refference

2005-11-21 Thread Marcus Bointon

On 21 Nov 2005, at 09:26, Georgi Ivanov wrote:


AFAIK, in PHP5 one can't call function with function parameters .
The error is that you only can pass variables by reference.
foo(strlen('aaa'),strlen(''));


You can call functions like that without problems UNLESS the function  
is expecting values by reference, i.e. results are passed back  
through the parameters. If you supply a function result, then you may  
as well not be calling the function as you'll never be able to get a  
result back from it, hence the error message. e.g.


function foo($a, $b) {
$a = $a.$b;
}

If you call this as you asked, where would the result go?


Is there some sort of workaround ?


As was suggested, put your values in variables before calling the  
function, though the code example you posted suggests you're trying  
to do something odd.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] APC caching keys.

2005-11-21 Thread Jochem Maas

Marcus Bointon wrote:

On 19 Nov 2005, at 04:07, Curt Zirzow wrote:


If you are using mysql i would use the SQL_CACHE flag, it will
eliminate the need for you to manage the cache.



You don't necessarily need to us the SQL_CACHE flag in queries - you  
can just turn on the query cache globally using query_cache_type=1 in  
your my.cnf. Otherwise I quite agree - and MySQL has the huge  advantage 
that it will work very nicely across multi-server deployments:


http://dev.mysql.com/doc/refman/5.0/en/query-cache.html


The last version of php5.1 i have installed APC on is a cvs
snapshot of around Feb 4 2005 11:49:05. Nothing special was needed.



The current 3.0.8 release of APC is broken in PHP 5.1.0-dev if you  ever 
use __autoload. It will be fixed in 3.0.9 (and is fixed in CVS),  though 
Rasmus implied that 3.0.9 is waiting until 5.1 release.


I guess I'll have to try a build myself a copy of APC from cvs - operative
word being try :-/

having said that I don't use __autoload() - I did but it was just a PITA -
but I wonder if the segfault still occurs if there are situations that occur
(missing class[es]) that cause the engine to check-for/try-to-run __autoload()
(even though it doesn't due to the fact that its not defined)??

thanks for the feedback!



Marcus


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



Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Marcus Bointon


On 18 Nov 2005, at 20:13, Dylan wrote:


$var = first part of string .(($a==$b)?$c:$d). rest of string;

and I feel it would be more elegant to be able to do something like:

$var =first part of string {(($a==$b)?$c:$d)} rest of string;


Strange as it may seem, you'll probably find that this is the fastest  
method:


'first part of string '.(($a==$b)?$c:$d).' rest of string'

I benchmarked this a while ago and was surprised to find that  
multiple concats with single quotes are significantly faster than  
interpolation.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] APC caching keys.

2005-11-21 Thread Marcus Bointon

On 21 Nov 2005, at 10:54, Jochem Maas wrote:

having said that I don't use __autoload() - I did but it was just a  
PITA -


I thought it was a good idea for a while... One major irritation with  
it is that with standard error reporting you can't tell where a  
missing class can't be found from (it is reported as having come from  
your __autoload function). You need a stack trace to figure out where  
the original problem occurred - xdebug works a treat (but it won't  
mix with APC).


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] showing in pages selecting result?

2005-11-21 Thread Jochem Maas

xkorakidis wrote:

Hi,
How can I present into pages the result of sql select? (e.g. pages of 10
records)


by performing queries that only grab part of the data and passing along a
variable in the relevant urls that allow you to see how far along
in the list you are (i.e. what page).

the term you want is 'pagination' and if you search the web for that and 'php'
you will find enough examples to get confused by. ;-)






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



Re: [PHP] Re: PHP 4.4.1 on Apache 2.0.x issue

2005-11-21 Thread Marcus Bointon

On 20 Nov 2005, at 15:14, Geert Booster wrote:


  PHP 4.4.0, since PHP developers seem not interested in
  fixing the bug with apache2 and mod_rewrite


I think you might find this bug report of interest, especially since  
it's been fixed: http://bugs.php.net/bug.php?id=35059 It's certainly  
fixed things for me.


Derick's 4.4.2RC1 release note a couple of days ago:

On 18 Nov 2005, at 11:58, Derick Rethans wrote:

I packed PHP 4.4.2RC1 today, which you can find here:
http://downloads.php.net/derick/ . Windows binaries will follow  
shortly.


Please test it carefully, and report any bugs in the bug system, but
only if you have a short reproducable test case.

If everything goes well, we can release it next tuesday. Especially  
test

issues with mod_rewrite and Apache 2 please!


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



[PHP] Re: php5 call by refference

2005-11-21 Thread Oliver Grätz
Georgi Ivanov schrieb:
 Hi,
 AFAIK, in PHP5 one can't call function with function parameters .
 The error is that you only can pass variables by reference.
 foo(strlen('aaa'),strlen(''));
 
 Is there some sort of workaround ?

First of all, the problem with this arises if your function foo is
defined as

  function foo($a,$b) { ... }

There is no problem if a and b are not reference parameters.
So think a second about this: You tell in the definition of foo that you
want to write to the position where a and b are stored. But by calling
the funtion with strlen() you don't have a position in user space
because the results of strlen() are just values which haven't been
explicitly stored.

Now you can decide if you don't write to your parameters a and b. Then
there is no need for call by reference! It is not true that PHP copies
the value and that you save memory by using references! The values of
call-by-value parameters are copied if and only if you WRITE to them!
The Zend Engine 2 is highly optimized for this.

If you want to write to a and/or b then you must supply a storage
container (also called variable *g*). Simplest way of supplying a
temporary container:

  foo($t1=strlen('aaa'),$t2=strlen(''));

Have Fun!
OLLi

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



[PHP] Re: Deployment and maintenance of php software

2005-11-21 Thread Oliver Grätz
Andy Pieters schrieb:

 Is there anyone that can provide a solution to this or suggest another 
 approach to the problem?

First of all something about packages: PEAR is coming up with their own
format .phar for this. These are tar archives that may contain an
additional PHP script that is executed when unpacking the archive. This
gives you all the possibilities of other package management systems.

If you decide to go for standard package formats: I can't tell you
anything about .rpm but I know that it isn't too difficult to build .deb
packages. There are good howtos for the debian format.

As another approach: How about using Subversion? PHP developers have one
advantage: They don't have to compile their code before deployment. So
in other words: Deployment is somehow very similar to just getting the
source code. Subversion on Apache allows for easy access control. You
cann create a deployment branch or even different branches for each of
your customers. After you have created some new features in your project
you can simply merge the changes to your braches. All the client has to
do to fetch this update is one single svn up!

OLLi

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



Re: [PHP] showing in pages selecting result?

2005-11-21 Thread xkorakidis
Thanks so much Jochem,
I found some things in phpclasses (good material, bad design) and I'll
try that.
Thanks!

Jochem Maas wrote:
 xkorakidis wrote:
 Hi,
 How can I present into pages the result of sql select? (e.g. pages of 10
 records)
 
 by performing queries that only grab part of the data and passing along a
 variable in the relevant urls that allow you to see how far along
 in the list you are (i.e. what page).
 
 the term you want is 'pagination' and if you search the web for that and
 'php'
 you will find enough examples to get confused by. ;-)
 
 


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



Re: [PHP] Re: php5 call by refference

2005-11-21 Thread Georgi Ivanov
Thanks !
It's all clear now .
:)


On Monday 21 November 2005 14:45, Oliver Grätz wrote:
 Georgi Ivanov schrieb:
  Hi,
  AFAIK, in PHP5 one can't call function with function parameters .
  The error is that you only can pass variables by reference.
  foo(strlen('aaa'),strlen(''));
 
  Is there some sort of workaround ?

 First of all, the problem with this arises if your function foo is
 defined as

   function foo($a,$b) { ... }

 There is no problem if a and b are not reference parameters.
 So think a second about this: You tell in the definition of foo that you
 want to write to the position where a and b are stored. But by calling
 the funtion with strlen() you don't have a position in user space
 because the results of strlen() are just values which haven't been
 explicitly stored.

 Now you can decide if you don't write to your parameters a and b. Then
 there is no need for call by reference! It is not true that PHP copies
 the value and that you save memory by using references! The values of
 call-by-value parameters are copied if and only if you WRITE to them!
 The Zend Engine 2 is highly optimized for this.

 If you want to write to a and/or b then you must supply a storage
 container (also called variable *g*). Simplest way of supplying a
 temporary container:

   foo($t1=strlen('aaa'),$t2=strlen(''));

 Have Fun!
 OLLi

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



[PHP] Sorting users geographically...

2005-11-21 Thread Tony Di Croce
I'm helping a friend of mine build a matchmaking website, and we have a
doozy of a problem to solve:

What I need to do is two fold:

#1 Collect whatever geographical information I need from each user to enable
#2
#2 Be able to run query's to find people NEAR (geographically) another
person.

Does anyone know of any commercial or free implementations of this? Is it
primarily a database problem or is their some way (computationally) to
compute the probable proximity of two zip codes?

Hopefully someone responds to this with a Pear package that does exactly
what I need! :) If that can't happen, then I'd appreciate any options you
can think of.

td

--
Free Linux Technical Articles
http://www.linuxtecharticles.com


Re: [PHP] Sorting users geographically...

2005-11-21 Thread David Grant
Hi Tony,

I would think the first step would be to find a web service or dataset
to convert a zip code to longitude/latitude.

The formula for calculating distances from long/lat is available here:

http://www.colorado.edu/geography/gcraft/warmup/aquifer/html/distance.html

Cheers,

David Grant

Tony Di Croce wrote:
 I'm helping a friend of mine build a matchmaking website, and we have a
 doozy of a problem to solve:
 
 What I need to do is two fold:
 
 #1 Collect whatever geographical information I need from each user to enable
 #2
 #2 Be able to run query's to find people NEAR (geographically) another
 person.
 
 Does anyone know of any commercial or free implementations of this? Is it
 primarily a database problem or is their some way (computationally) to
 compute the probable proximity of two zip codes?
 
 Hopefully someone responds to this with a Pear package that does exactly
 what I need! :) If that can't happen, then I'd appreciate any options you
 can think of.
 
 td
 
 --
 Free Linux Technical Articles
 http://www.linuxtecharticles.com
 

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



RE: [PHP] Sorting users geographically...

2005-11-21 Thread Jim Moseby
 
 I'm helping a friend of mine build a matchmaking website, and 
 we have a
 doozy of a problem to solve:
 
 What I need to do is two fold:
 
 #1 Collect whatever geographical information I need from each 
 user to enable
 #2
 #2 Be able to run query's to find people NEAR (geographically) another
 person.
 
 Does anyone know of any commercial or free implementations of 
 this? Is it
 primarily a database problem or is their some way (computationally) to
 compute the probable proximity of two zip codes?
 
 Hopefully someone responds to this with a Pear package that 
 does exactly
 what I need! :) If that can't happen, then I'd appreciate any 
 options you
 can think of.
 

http://sniptools.com/latitudeLongitude.php

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



Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Chris Boget

and I feel it would be more elegant to be able to do something like:
$var =first part of string {(($a==$b)?$c:$d)} rest of string;

$templateStr = 'first part of string %s rest of string';
$outputStr   = sprintf($templateStr, (($a==$b)?$c:$d));


That is so totally slick!  I'm definitely going to have to remember this
neat little trick! :)

thnx,
Chris

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



Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Robert Cummings
On Mon, 2005-11-21 at 09:42, Chris Boget wrote:
  and I feel it would be more elegant to be able to do something like:
  $var =first part of string {(($a==$b)?$c:$d)} rest of string;
  $templateStr = 'first part of string %s rest of string';
  $outputStr   = sprintf($templateStr, (($a==$b)?$c:$d));
 
 That is so totally slick!  I'm definitely going to have to remember this
 neat little trick! :)

That's like using a bulldozer to tidy your living room. Why not use the
following even more readable style (and more efficient)?

$outputStr =
'first part of string  '
   .($a == $b ? $c : $d)
   .' rest of string';

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Richard Heyes

Robert Cummings wrote:

On Mon, 2005-11-21 at 09:42, Chris Boget wrote:


and I feel it would be more elegant to be able to do something like:
$var =first part of string {(($a==$b)?$c:$d)} rest of string;


$templateStr = 'first part of string %s rest of string';
$outputStr   = sprintf($templateStr, (($a==$b)?$c:$d));


That is so totally slick!  I'm definitely going to have to remember this
neat little trick! :)



That's like using a bulldozer to tidy your living room. Why not use the
following even more readable style (and more efficient)?

$outputStr =
'first part of string  '
   .($a == $b ? $c : $d)
   .' rest of string';


Readability is in the eye of the beholder.

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

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



Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Robert Cummings
On Mon, 2005-11-21 at 10:02, Richard Heyes wrote:

 Readability is in the eye of the beholder.

But efficiency isn't ;)

Cheers,
Rob
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Richard Heyes

Robert Cummings wrote:

On Mon, 2005-11-21 at 10:02, Richard Heyes wrote:


Readability is in the eye of the beholder.



But efficiency isn't ;)


Try measuring the difference between the various methods over a 
realistic number of iterations, eg. 100. There's little point in going 
through ones code trying to optimise these things. Sure you might gain 
 a millisecond here or there, but so what? You'd have to have a 
*seriously* busy site for that to make a difference.


--
Richard Heyes

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



Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Jochem Maas

Richard Heyes wrote:

Robert Cummings wrote:


On Mon, 2005-11-21 at 10:02, Richard Heyes wrote:


Readability is in the eye of the beholder.




But efficiency isn't ;)


yes it is actually - everything is in the eye of the beholder.
it just so happens that we often have consensus ;-)

with regard to the bulldozer metaphor - true that using sprintf() is
such a simple case may be excessive BUT I was merely introducing the OP to
something new (possibly) - anyone asking such 'simple' questions is
not at a stage that this kind of efficiency is an issue (i.e. give
them 'whats possible' before telling them 'whats best')

the sprintf() example leaves lots of room for creativity and
code reuse (even by relative newcomers) or aleast the possiblity of
writing more managable code Chris Boget liked it anyway :-)


PS - Robert Cummings, I totally agree with your general comments on
internals@ regarding migration/irritation/etc btw. and if I didn't
spend so much time on 'fixing' my working code I might have had time
to take a proper look at your InterJinn project - more's the pity
that I haven't been able to so far :-/




Try measuring the difference between the various methods over a 
realistic number of iterations, eg. 100. There's little point in going 
through ones code trying to optimise these things. Sure you might gain 
 a millisecond here or there, but so what? You'd have to have a 
*seriously* busy site for that to make a difference.




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



[PHP] Cookie problem with IE

2005-11-21 Thread Kristen G. Thorson

Anyone have any suggestions?  I'm still stuck.


thanks,
kgt



Kristen G. Thorson wrote:

I'm having problems with a customer who can't login to a wholesaler 
application.  To ensure the problem was that the cookie was not being 
set, I sent him to this script:


if( !isset( $_REQUEST['page'] ) ) {
 setcookie('VATtest','Cookie has been set.',time()+5, /);
 echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a';
} else if( $_REQUEST['page'] == '1' ) {
 if( isset( $_COOKIE['VATtest'] ) ) {
   echo $_COOKIE['VATtest'];
 } else {
   echo 'Cookie NOT set.';
 }
}
?


He got Cookie NOT set. which means exactly what it says.  He's using 
IE 6.0, and swears up and down that he's set it to always allow 
cookies from this domain.  I can't verify that he's set it correctly, 
but he has been told twice how to do it.  I also know his browser must 
be saving some cookies, as he is able to login to other sites.  Has 
anyone run into other sources of cookie-blockage in the past?  I 
cannot manage to duplicate this when I have IE set to always allow 
cookies from this domain.


Thanks for any tips,

kgt



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



RE: [PHP] Cookie problem with IE

2005-11-21 Thread Jay Blanchard
[snip]
Anyone have any suggestions?  I'm still stuck.
[/snip]

Can you send him another test where a basic cookie gets set and then
checked?

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



Re: [PHP] Cookie problem with IE

2005-11-21 Thread Kristen G. Thorson

Jay Blanchard wrote:


[snip]
Anyone have any suggestions?  I'm still stuck.
[/snip]

Can you send him another test where a basic cookie gets set and then
checked?

.

 




Not sure what you mean.  I sent him to this script:

?php
if( !isset( $_REQUEST['page'] ) ) {
setcookie('VATtest','Cookie has been set.',time()+5, /);
echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a';
} else if( $_REQUEST['page'] == '1' ) {
if( isset( $_COOKIE['VATtest'] ) ) {
  echo $_COOKIE['VATtest'];
} else {
  echo 'Cookie NOT set.';
}
}
?

Which is all I had in entirety.  Is this not a basic cookie?


thanks,

kgt

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



RE: [PHP] Cookie problem with IE

2005-11-21 Thread Jay Blanchard
[snip]
Not sure what you mean.  I sent him to this script:

?php
if( !isset( $_REQUEST['page'] ) ) {
 setcookie('VATtest','Cookie has been set.',time()+5, /);
 echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a';
} else if( $_REQUEST['page'] == '1' ) {
 if( isset( $_COOKIE['VATtest'] ) ) {
   echo $_COOKIE['VATtest'];
 } else {
   echo 'Cookie NOT set.';
 }
}
?

Which is all I had in entirety.  Is this not a basic cookie?
[/snip]

Sorry, I should have paid more attention. Is $_REQUEST['page'] correctly set
when (print_r the array...just for giggles)

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



[PHP] Uploading more than one file

2005-11-21 Thread Shaun
Hi,

I have a form on my page that has many file input fields:

tr
   tdFile A:/td
   tdinput type=file name=file_a/td
  /tr
tr
   tdFile B:/td
   tdinput type=file name=file_b/td
  /tr
...

I have looked on php.net and there is a way to upload an array of files but 
one would need to make the name of all the input fields are the same. I need 
to make sure that the file uploaded is correct by comparing the file name to 
the value requried by the form field name. Is there a way around this?

Thanks for your help.

Shaun 

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



RE: [PHP] Sorting users geographically...

2005-11-21 Thread Sandy Keathley
  Does anyone know of any commercial or free implementations of 
  this? Is it
  primarily a database problem or is their some way (computationally) to
  compute the probable proximity of two zip codes?


There is a class called zipLocator.  I think I found it at 
phpclasses.org.  It uses a large zipcode database, which can be 
downloaded for free (the address is in the class).

This will return all zipcodes within a specified distance from the 
target zipcode (10 mi, 50 mi, etc.).

If you can't find it, contact me offline.

Regards,

   SK


WebDesigns Internet Consulting
E-commerce Solutions
Application Development

Sandy Keathley
Zend Certified Engineer
[EMAIL PROTECTED]
972-569-8464

http://www.KeathleyWebs.com/


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



Re: [PHP] Uploading more than one file

2005-11-21 Thread tg-php
Sorry, my brain's running on one cylinder this morning, but maybe this helps:

http://us2.php.net/manual/en/features.file-upload.multiple.php

If not, excuse my waste of bandwidth :)

-TG

= = = Original message = = =

Hi,

I have a form on my page that has many file input fields:

tr
   tdFile A:/td
   tdinput type=file name=file_a/td
  /tr
tr
   tdFile B:/td
   tdinput type=file name=file_b/td
  /tr
...

I have looked on php.net and there is a way to upload an array of files but 
one would need to make the name of all the input fields are the same. I need 
to make sure that the file uploaded is correct by comparing the file name to 
the value requried by the form field name. Is there a way around this?

Thanks for your help.

Shaun 


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

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



[PHP] PRINTing Problem with CheckBox

2005-11-21 Thread Chirantan Ghosh
Hi All,

I have developed this form where people click the check boxes of interested 
phone numbers which gets emailed to me.

My ACT guys tells me I need to print all the Check Box values as unique fields 
for his intake.

I have posted the problem in detail in following URL:
http://www.primarywave.com/NONworkingCODE.txt

Can anyone please help me sort this out.

 Thanks,
C


Re: [PHP] Cookie problem with IE

2005-11-21 Thread Kristen G. Thorson

Jay Blanchard wrote:


[snip]
Not sure what you mean.  I sent him to this script:

?php
if( !isset( $_REQUEST['page'] ) ) {
setcookie('VATtest','Cookie has been set.',time()+5, /);
echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a';
} else if( $_REQUEST['page'] == '1' ) {
if( isset( $_COOKIE['VATtest'] ) ) {
  echo $_COOKIE['VATtest'];
} else {
  echo 'Cookie NOT set.';
}
}
?

Which is all I had in entirety.  Is this not a basic cookie?
[/snip]

Sorry, I should have paid more attention. Is $_REQUEST['page'] correctly set
when (print_r the array...just for giggles)

.

 



I can verify $_REQUEST is correct for me, and I'm sure it's correct for 
him too, since he gets Cookie NOT set.  The second if statement 
requires $_REQUEST['page'] to be 1 to even get to that line.  If 
$_REQUEST['page'] is not set, he should get no output at all.


I've been looking through the comments in the manual, and several people 
mention privacy policies creating a problem in IE.  My problem is none 
of this can be duplicated on my machine (or any other so far), and this 
customer is in Florida and I'm in Virginia.  I've also never seen in 
other applications that a privacy policy truly needed to be sent to 
allow a cookie to be set, and apparently the web site manager settings 
(where you explicitly allow or block cookies from certain domains) 
override all privacy settings in IE anyways.  So that seems like a dead end.




thanks,

kgt

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



RE: [PHP] Cookie problem with IE

2005-11-21 Thread Jay Blanchard
[snip]
Sorry, I should have paid more attention. Is $_REQUEST['page'] correctly
set
when (print_r the array...just for giggles)

I can verify $_REQUEST is correct for me, and I'm sure it's correct for 
him too, since he gets Cookie NOT set.  The second if statement 
requires $_REQUEST['page'] to be 1 to even get to that line.  If 
$_REQUEST['page'] is not set, he should get no output at all.
[/snip]

But I sure would like to see the URL once he has clicked it. Have you tried
changing to $_GET['page']? Again, all of this is just for gigglesbut
there is likely to be a clue.

On privacy policies in IE (can he try another browser?) what is his setting?

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



Re[2]: [PHP] Cookie problem with IE

2005-11-21 Thread Richard Davey
Hi Kristen,

Monday, November 21, 2005, 4:48:26 PM, you wrote:

 I've been looking through the comments in the manual, and several
 people mention privacy policies creating a problem in IE. My problem
 is none of this can be duplicated on my machine (or any other so
 far), and this customer is in Florida and I'm in Virginia. I've also
 never seen in other applications that a privacy policy truly needed
 to be sent to allow a cookie to be set, and apparently the web site
 manager settings (where you explicitly allow or block cookies from
 certain domains) override all privacy settings in IE anyways. So
 that seems like a dead end.

What about third party software? Norton for example has cookie
features that will totally over-ride any IE setting with regards to
blocking them, etc. It's not the only one.

Cheers,

Rich
-- 
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

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



Re: [PHP] php related segmentation fault with Apache 2.0.55

2005-11-21 Thread kristina clair
Hi,

I just installed the latest available snap, and now I'm seeing a zend
error, but not a sapi error:

Reading symbols from /home/sys/Zend/lib/ZendExtensionManager.so...done.
Loaded symbols for /home/sys/Zend/lib/ZendExtensionManager.so
Error while reading shared library symbols:
.//home/sys/Zend/etc/pfpro.so: No such file or directory.
Reading symbols from /home/sys/verisign/lib/libpfpro.so...done.
Loaded symbols for /usr/local/verisign//lib/libpfpro.so
#0  _efree (ptr=0x0)
at /usr/local/src/php4-STABLE-200511211545/Zend/zend_alloc.c:242
242 CALCULATE_REAL_SIZE_AND_CACHE_INDEX(p-size);

(gdb) bt full
#0  _efree (ptr=0x0)
at /usr/local/src/php4-STABLE-200511211545/Zend/zend_alloc.c:242
p = (zend_mem_header *) 0xfff4
cache_index = Variable cache_index is not available.
(gdb)


I think there are two things worth noting:
1. /home/sys/Zend is a separate installation of Zend ... does this
need to be updated as well?
2. this segfault is only happening for one script, as far as we know. 
Is there anything I should look for in this script to narrow things
down?

Thanks,
Kristina

On 11/21/05, Marco Kaiser [EMAIL PROTECTED] wrote:
 Hi Kristina,

 have you tried the lates cvs snap? I know there was some problems with
 apache2 and mod_rewrite maybe it is solve in CVS.

 --
 Marco Kaiser



--
In most cases, people, even wicked people, are far more naive and
simple-hearted than one generally assumes.  And so are we.
/* last line, 1st ch., The Brothers Karamazov */

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



Re: [PHP] php related segmentation fault with Apache 2.0.55

2005-11-21 Thread Marco Kaiser
Hi Kristina,

I think there is no version available for 5.1.0-cvs. Try to remove the
Zend Extensions and give me please feedback.

 I just installed the latest available snap, and now I'm seeing a zend
 error, but not a sapi error:
--
Marco Kaiser

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



[PHP] Decision table/business rule parser?

2005-11-21 Thread Geoff - Creative Living
Hi

Does anyone know of an open source or commercial php library for parsing
decision tables? Or failing that, a more general business rules parser?
I can't find anything on the usual php script sites.

Unless I'm missing something, this seems to be a gap - in the Java world
there is a wide choice of native solutions.


Geoff Caplan
Creative Living

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



[PHP] forking off in php

2005-11-21 Thread matt VanDeWalle

hello,
I have what may seem like a small problem but its not obvious to me.
I have a script that I forked and that part works fine, it forks, tells me 
the pid like I wanted, and keeps running.  Well, the problem that was not 
apparent to me until about 3 days ago when I was wondering why the 
script(my php chat server) was crashing at seeminly random times.  I 
finally  figured out that when I logged out of my shell in linux, the 
talker would go down as well.  Obviously I don't want that but what do I 
need to add to the line when i start the script

thanks
matt
ps If it helps, I am  running php 4.3.10 on slackware

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



Re: [PHP] Uploading more than one file

2005-11-21 Thread -k.
If you named the fields like this:
 
input type=file name=files[file_name_one] / 
input type=file name=files[file_name_two] / 
input type=file name=files[file_name_three] / 

Then did something like (or whatever):

?PHP
foreach ($_FILES[files][error] as $key = $error) {
echo $key.BR;
echo $_FILES[files][tmp_name][$key].BR;
echo $_FILES[files][name][$key].BR;
}
?

Would that do what you need to get done?




-k.



__ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs

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



Re: [PHP] Sorting users geographically...

2005-11-21 Thread Marcus Bointon


On 21 Nov 2005, at 14:14, Tony Di Croce wrote:

Does anyone know of any commercial or free implementations of this?  
Is it

primarily a database problem or is their some way (computationally) to
compute the probable proximity of two zip codes?


All the suggested packages could be all you need, but also note that  
MySQL 5 has built-in GIS features which may make searches like these  
way more efficient should they use them:


http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions-in-mysql.html
http://dev.mysql.com/doc/refman/5.0/en/functions-that-test-spatial- 
relationships-between-geometries.html


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] php related segmentation fault with Apache 2.0.55

2005-11-21 Thread kristina clair
Hi,

When I said I installed the latest available snapshot, I meant I
installed the latest available snap in the 4.4.x tree - so, the
version I installed was php4-STABLE-200511211545.tar.gz.

Kristina

On 11/21/05, Marco Kaiser [EMAIL PROTECTED] wrote:
 Hi Kristina,

 I think there is no version available for 5.1.0-cvs. Try to remove the
 Zend Extensions and give me please feedback.

  I just installed the latest available snap, and now I'm seeing a zend
  error, but not a sapi error:
 --
 Marco Kaiser



--
In most cases, people, even wicked people, are far more naive and
simple-hearted than one generally assumes.  And so are we.
/* last line, 1st ch., The Brothers Karamazov */

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



RE: [PHP] forking off in php

2005-11-21 Thread Jay Blanchard
[snip]
hello,
I have what may seem like a small problem but its not obvious to me.
I have a script that I forked and that part works fine, it forks, tells me 
the pid like I wanted, and keeps running.  Well, the problem that was not 
apparent to me until about 3 days ago when I was wondering why the 
script(my php chat server) was crashing at seeminly random times.  I 
finally  figured out that when I logged out of my shell in linux, the 
talker would go down as well.  Obviously I don't want that but what do I 
need to add to the line when i start the script
thanks
matt
ps If it helps, I am  running php 4.3.10 on slackware
[/snip]

It would have been nice to see your command line. Add '' i.e.

/usr/local/bin/foo 

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



Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Marcus Bointon

On 21 Nov 2005, at 15:43, Jochem Maas wrote:


using sprintf() is
such a simple case may be excessive BUT I was merely introducing  
the OP to

something new (possibly) - anyone asking such 'simple' questions is
not at a stage that this kind of efficiency is an issue (i.e. give
them 'whats possible' before telling them 'whats best')


sprintf is also a good example of a different way of thinking about  
string interpolation, and what's more it's remarkably close to the  
whole concept of using prepared statements in SQL, a measure that can  
gain you both speed and security, plus it's supported very nicely in  
PDO in PHP 5.1. A tangent I know, but a useful one nonetheless. Hey,  
and I remember when print using was considered a 'power user'  
feature in BASIC in 1981!


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] php related segmentation fault with Apache 2.0.55

2005-11-21 Thread Marco Kaiser
Hi Kristina,

 When I said I installed the latest available snapshot, I meant I
 installed the latest available snap in the 4.4.x tree - so, the
 version I installed was php4-STABLE-200511211545.tar.gz.

tha Zend API changed so your installed zend products doenst work with
cvs version of php. Disable alle Zend Stuff in you php.ini and tell me
if this error still happen.

--
Marco Kaiser

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



Re: [PHP] forking off in php

2005-11-21 Thread Marcus Bointon

On 21 Nov 2005, at 17:39, matt VanDeWalle wrote:


I have what may seem like a small problem but its not obvious to me.
I have a script that I forked and that part works fine, it forks,  
tells me the pid like I wanted, and keeps running.  Well, the  
problem that was not apparent to me until about 3 days ago when I  
was wondering why the script(my php chat server) was crashing at  
seeminly random times.  I finally  figured out that when I logged  
out of my shell in linux, the talker would go down as well.   
Obviously I don't want that but what do I need to add to the line  
when i start the script


Example1 on the php docs page is what you need:

http://www.php.net/manual/en/ref.pcntl.php

The important thing is the call to posix_setsid(), which detaches  
your forked process from your terminal process. Works great for me -  
I've had PHP daemons running for over 9 months without a break.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] forking off in php

2005-11-21 Thread Marcus Bointon

On 21 Nov 2005, at 17:47, Jay Blanchard wrote:


It would have been nice to see your command line. Add '' i.e.


You don't need to do that - the forking script will start, spawn a  
child process then exit, so adding  will do nothing. Having said  
that, you could achieve something similar by not forking and using  
nohup (look it up with man) with , however, that will mean it runs  
as you, whereas a forked process can easily switch users and drop  
privileges for increased security.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] php related segmentation fault with Apache 2.0.55

2005-11-21 Thread kristina clair
On 11/21/05, Marco Kaiser [EMAIL PROTECTED] wrote:
 Hi Kristina,

  When I said I installed the latest available snapshot, I meant I
  installed the latest available snap in the 4.4.x tree - so, the
  version I installed was php4-STABLE-200511211545.tar.gz.

 tha Zend API changed so your installed zend products doenst work with
 cvs version of php. Disable alle Zend Stuff in you php.ini and tell me
 if this error still happen.

After disabling Zend in php.ini, I get:

#0  0xb7df5ee9 in yy_push_state (new_state=1)
at Zend/zend_language_scanner.c:5831
5831yy_start_stack[yy_start_stack_ptr++] = YY_START;
(gdb) bt full
#0  0xb7df5ee9 in yy_push_state (new_state=1)
at Zend/zend_language_scanner.c:5831
new_size = Variable new_size is not available.
(gdb)

php is, of course, still installing its own zend extension.  But all
of the lines pertaining to Zend were indeed removed from php.ini.

Thanks,
Kristina

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



[PHP] Re: Can't execute external program

2005-11-21 Thread Ben

Voip tech said the following on 11/20/2005 10:31 PM:

Hello,
I cannot get exec(), system() or passthru() to run an extenal program.
From the command line it runs perfectly:


snip


I'm getting frustrated, Any  help will be deeply appreciated
Henry


The answer is probably in your php.ini.  Look into whether you are 
running in safe mode or not, and if you are whether you have your 
program in the safe_mode_exec_dir or not.  Also check disable_functions 
to see if any of the ones you are having trouble with are listed.


- Ben

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



Re: [PHP] forking off in php

2005-11-21 Thread matt VanDeWalle

ah ok thanks, am reading it now

On Mon, 21 Nov 2005, Marcus Bointon wrote:


On 21 Nov 2005, at 17:39, matt VanDeWalle wrote:


I have what may seem like a small problem but its not obvious to me.
I have a script that I forked and that part works fine, it forks, tells me 
the pid like I wanted, and keeps running.  Well, the problem that was not 
apparent to me until about 3 days ago when I was wondering why the 
script(my php chat server) was crashing at seeminly random times.  I 
finally  figured out that when I logged out of my shell in linux, the 
talker would go down as well.  Obviously I don't want that but what do I 
need to add to the line when i start the script


Example1 on the php docs page is what you need:

http://www.php.net/manual/en/ref.pcntl.php

The important thing is the call to posix_setsid(), which detaches your forked 
process from your terminal process. Works great for me - I've had PHP daemons 
running for over 9 months without a break.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



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



[PHP] Re: Re: better way to mix html and php code?

2005-11-21 Thread Dan Baker
Robert Cummings [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Here is an example of a layout template:

 -
 jinn:prepend/
 html

 head
  titlejinn:pageTitle//title

  style type=text/css
  !--
jinn:template path=css/main.template/
  --
  /style

  jinn:accumulatorFlush name=javaScriptTags/
  jinn:accumulatorFlush name=javaScriptTags dynamic=true/

  // --
  /script

 /head

I'm curious ... how do you generally handle forms and urls?  What if the 
programmer wants to add a link, something like:
a href=page.php?op=Viewid=1234View my info/a

How is the data (op=Viewid=1234) separated from the formatting?

Thanks
DanB

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



[PHP] Trying to send data via POST

2005-11-21 Thread Anders Norrbring


I'm trying to set up a script that will post a picture file to a hosting 
site. Normally, the site accepts uploads via a web form using a POST action.
How can I make this file transfer to the host so it'll think it's posted 
by it's own web form?  I just don't get how to set it up..

--

Anders Norrbring

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



Re: [PHP] Re: Re: better way to mix html and php code?

2005-11-21 Thread Robert Cummings
On Mon, 2005-11-21 at 13:41, Dan Baker wrote:
 Robert Cummings [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
  Here is an example of a layout template:
 
  -
  jinn:prepend/
  html
 
  head
   titlejinn:pageTitle//title
 
   style type=text/css
   !--
 jinn:template path=css/main.template/
   --
   /style
 
   jinn:accumulatorFlush name=javaScriptTags/
   jinn:accumulatorFlush name=javaScriptTags dynamic=true/
 
   // --
   /script
 
  /head
 
 I'm curious ... how do you generally handle forms and urls?  What if the 
 programmer wants to add a link, something like:
 a href=page.php?op=Viewid=1234View my info/a
 
 How is the data (op=Viewid=1234) separated from the formatting?

There are two ways for retrieving data. The first you have seen is the
tag form, but obviously that's a problem when the data goes into a tag
:) For this there is the embed form (a simple example follows but data
can be retrieved from modules/components in the same way):

a href=page.php?op=Viewid={jinn:echo value={jinn:getValue name=_GET,
path=id}}

Embeds can be nested as can tags. Additionally, embeds can be used
outside of tags, they're just most convenient there.

With respect to forms, InterJinn supplies a form engine that does most
of the rendering, and which can be assigned to slices. Then output is as
simple as:

jinn:render name=someModule selector=formOpen
jinn:render name=someModule selector=country_field/
jinn:render name=someModule selector=formClose

Or if you want to customize the form field but still have the internal
validation semantics:

jinn:render name=someModule selector=formOpen/
input type=text name=country value={jinn:echo value={jinn:getValue
...}} size=20 /
jinn:render name=someModule selector=formClose/

As long as you use the internal form open and close semantics, and use
the same name given to the field internally, you can render the field as
you would in HTML. I generally don't use that method, since I like to
use configuration arrays or properties to determine how the fields look.
Either way, the engine is very flexible and gives the developer lots of
choice in how they go about the display and how much control they give
the designer.

Unfortunately the documentation for the form engine isn't currently up
to date, since I've added less cumbersome techniques for creating forms
than what it currently documents. The faster techniques don't require
working with the objects but rather just define configuration arrays
that then generate everything else.

Let me know if you have any other questions.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Trying to send data via POST

2005-11-21 Thread Richard Davey
Hi Anders,

Monday, November 21, 2005, 7:13:40 PM, you wrote:

 I'm trying to set up a script that will post a picture file to a
 hosting site. Normally, the site accepts uploads via a web form
 using a POST action. How can I make this file transfer to the host
 so it'll think it's posted by it's own web form? I just don't get
 how to set it up..

Start with something like cURL or Snoopy, to make life a little
easier. Otherwise you can simulate this through standard socket
commands.

Cheers,

Rich
-- 
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

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



Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Robert Cummings
On Mon, 2005-11-21 at 10:31, Richard Heyes wrote:
 Robert Cummings wrote:
  On Mon, 2005-11-21 at 10:02, Richard Heyes wrote:
  
 Readability is in the eye of the beholder.
  
  
  But efficiency isn't ;)
 
 Try measuring the difference between the various methods over a 
 realistic number of iterations, eg. 100. There's little point in going 
 through ones code trying to optimise these things. Sure you might gain 
   a millisecond here or there, but so what? You'd have to have a 
 *seriously* busy site for that to make a difference.

I won't disagree, but I'd say being in the habit of writing semi-optimal
code in the fist place, will save you needing to learn new habits later
when you do work on a *seriously* busy site :) I didn't argue for ''
versus , but sprintf() is a cycle pig in comparison to either. not
only that, but since it's not a keyword, it incurs stack overhead.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



RE: [PHP] Trying to send data via POST

2005-11-21 Thread Jay Blanchard
[snip]
I'm trying to set up a script that will post a picture file to a hosting 
site. Normally, the site accepts uploads via a web form using a POST action.
How can I make this file transfer to the host so it'll think it's posted 
by it's own web form?  I just don't get how to set it up..
[/snip]

http://www.php.net/curl

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



Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Robert Cummings
On Mon, 2005-11-21 at 10:43, Jochem Maas wrote:
 Richard Heyes wrote:
  Robert Cummings wrote:
  
  On Mon, 2005-11-21 at 10:02, Richard Heyes wrote:
 
  Readability is in the eye of the beholder.
 
 
 
  But efficiency isn't ;)
 
 yes it is actually - everything is in the eye of the beholder.
 it just so happens that we often have consensus ;-)

*lol* I was hoping nobody would call me on that ;)

 with regard to the bulldozer metaphor - true that using sprintf() is
 such a simple case may be excessive BUT I was merely introducing the OP to
 something new (possibly) - anyone asking such 'simple' questions is
 not at a stage that this kind of efficiency is an issue (i.e. give
 them 'whats possible' before telling them 'whats best')

 the sprintf() example leaves lots of room for creativity and
 code reuse (even by relative newcomers) or aleast the possiblity of
 writing more managable code Chris Boget liked it anyway :-)

True, coming from a C background I can attest to my love for the *printf
series of functions. In fact, 6 years ago I might have actually liked
Java more if they had bothered to add it (I've heard it's been added
since).

 PS - Robert Cummings, I totally agree with your general comments on
 internals@ regarding migration/irritation/etc btw. and if I didn't
 spend so much time on 'fixing' my working code I might have had time
 to take a proper look at your InterJinn project - more's the pity
 that I haven't been able to so far :-/

*lol* Might be good till I clean the docs up. Also I've been adding a
flurry of stuff lately to support better inclusion of external resources
like JavaScript. I want clean including of javascript modules within
templates and modules such that requesting the resource never includes
it twice and so that I have the same replaceable modularity that exists
in InterJinn. Also I want to have dependencies managed internally rather
than having to think about it myself. I guess I'm making a mini
JavaScript InterJinn lib *lol*. This will tie in nicely with my work to
bring in almost transparent XmlHttpRequest functionality.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Regex for balanced brackets?

2005-11-21 Thread Jeffrey Sambells

I came across this method of matching brackets with regex in .NET

http://puzzleware.net/blogs/archive/2005/08/13/22.aspx

but I am wondering if it is possible to do the same in PHP?

I've tried it a bit but I can't seem to get it to work properly. I'm  
just wondering if I am doing something wrong or if it is just not  
possible.


Thanks.

here is the code I was playing with:

?php

$pattern = PATTERN
\{
(?
[^{}]+
|
\{ (?PDEPTH)
|
\} (?P-DEPTH)
)*
(?(DEPTH)(?!))

\}
PATTERN;

$subject = SUBJECT
test {
test2 {
test3
}
}

test4
{

}
SUBJECT;


preg_match_all(/$pattern/ix,$subject,$matches);

header(content-type: text/plain; );

var_dump($matches);

?


- Jeff



~~
Jeffrey Sambells
Director of Research and Development
Zend Certified Engineer (ZCE)

We-Create Inc.
[EMAIL PROTECTED] email
519.745.7374 office
519.897.2552 mobile

~~
Get Mozilla Firefox at
http://spreadfirefox.com

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



Re: [PHP] Decision table/business rule parser?

2005-11-21 Thread Geoff - Creative Living
Mike

 How about jBPM (http://www.jboss.org/products/jbpm)? I looked at it,
 briefly, awhile back. May implement it in the next release of my
 company software. Anyone have any experience with it?

There's a wide range of Java solutions:

http://www.manageability.org/blog/stuff/rule_engines/view

Most of them are over-specified for our relatively modest requirements.
Plus, I've never really looked into the practicality of using Java
libraries with Php 4. The only practical option I've found is this
project:

http://sourceforge.net/project/showfiles.php?group_id=117793

... but it's only got a couple of developers and I'm wary of betting my
business on a library like this. Do you know a better way?

With our modest needs, I'd much prefer to find a native solution, (if
such a thing exists) rather than add a layer of complexity and potential
unreliability by inter-operating with the Java VM.


Geoff Caplan
Creative Living

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



Re: [PHP] Decision table/business rule parser?

2005-11-21 Thread Mike Smith
I'm not aware of any. I am kind of developing my own for my current
Materials System. We purchase aluminum and glass from multiple
suppliers. The costing of those materials can vary supplier to
supplier. I'm working on an interface that will basically let the
Material dept work with a Part Profile (taking specific
characteristics specific to a certain set of parts) and create a
formula (by supplier) and whatever grouping from the part profile
(e.g. the Glass profile has a combo item called Thickness with several
options 3MM, 4MM, 5MM... That's probably more than you wanted to know.
All that to say, if your requirements are modest it may be worth it to
roll your own.

With jBPM I hope I'll be able to change routing/approval of
electronic documents more easily than it is currently.

Good luck,
Mike

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



[PHP] php 5.1rc6, oci8, and ldap

2005-11-21 Thread Robert Hopson

Greetings,

I am trying to compile PHP 5.1RC6 with support for both ldap and the
oci8 extension (using the Oracle Instant Client).  To get this working
under PHP4, I had to modify the Apache (1.3) environment like so:

   LD_LIBRARY_PATH=/usr/lib:${ORACLE_HOME}
   LD_PRELOAD=libldap.so.2:libclntsh.so.10.1

Given those settings (and a valid ORACLE_HOME location), the following
code works on a PHP4 build:

   $res = ldap_connect(ldaps://$ldapserver);
   ldap_bind($res, $bindrdn, $bindpw);

But under PHP5, running that code gives the error:

   Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Out
   of memory in filename on line 3

The oci8 library functions correctly.  Does anyone have a working setup
for this, or any thoughts on what else I might try?

Thanks,

-Robert

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



[PHP] forking problem and logging off - solved

2005-11-21 Thread matt VanDeWalle
I have fixed my prier problem of my script crashing down whenever i logged 
out of the shell, I got a bright idea, (one of the few it seems i'm having 
lately :p )
I found out that there is a nohup command ..i guess i knew there was but 
i had forgotten that until today.  I put this in a script now to run my 
chat now with nohup, something like this

/* my script to start server */
#!/usr/bin/bash
nohup ./server.php 

of course i have to be in the right directory to do this but it works and 
finally, i can log off of my account without the server going down yay!

matt

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



[PHP] username format when binding to Active Directory?

2005-11-21 Thread Bing Du

Hello,

The following script returns 'LDAP bind failed...'.

?php
echo Connecting ...br /;

$ldaprdn = [EMAIL PROTECTED];
$ldappass = jsmithpass;

$ds=ldap_connect(ad.dept.some.edu);

if ($ds) {
   echo Binding ...br /;
   $r=ldap_bind($ds, $ldaprdn, $ldappass);

   if ($r) {
   echo LDAP bind successful...br /;
   } else {
   echo LDAP bind failed...br /;
   }
} else {
 echo LDAP connection failed...br /;
   }

?

If I change $ldaprdn to be CN=John 
Smith,OU=Users,OU=DEPT,DC=some,DC=edu, then bind returns 'LDAP bind 
successful...'.


However AD supports username to be in [EMAIL PROTECTED] format 
because querying from the command line works:


% ldapsearch -h ad.dept.some.edu -s sub -b dc=dept,dc=some,dc=edu -x 
-D [EMAIL PROTECTED] -W samaccountname=jsmith


Our AD only allows authenicated bindings.  We don't know user's DN 
before binding.  So anybody know how to make PHP allow 
$ldaprdn=[EMAIL PROTECTED]?


Thanks in advance,

Bing

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



[PHP] security question... man in the middle attacks

2005-11-21 Thread bruce
hey...

anybody here have a serious background in security, or with 'man in the
middle attacks'???

in particular, i'm trying to get my hands around ways of preventing a
server/browser app to be susceptible to a 'man in the middle attack'

serious pointers would be helpful. searching across google hasn't turned up
any examples of how this can be accomplished...

thanks

-bruce
[EMAIL PROTECTED]

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



[PHP] Including classes

2005-11-21 Thread Philip Thompson

Hi all.

Here's what's going on. I have a page which calls itself in a form.  
On this page, I include two classes from other file I've created. On  
load, the page reads the class stuff just fine. If I submit the form  
(call the page again), then the class doesn't like to show any results.


code

?
require (myclass1.php);
require (myclass2.php);

if ($_POST[submitted]) {
   // do stuff which includes the class - this does not work
} else {
   // do stuff which includes the class - this works fine
}
?

form action=thispage.php
   !-- stuff that uses the class info --
   input type=hidden name=submitted value=1 /
/form

/code


Any thoughts on why the class is not working after the submit? I have  
tried using coderequire_once (myclass1.php);/code, but that  
does not work either. Any suggestions would be greatly appreciated!


Thanks in advance.
~Philip

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



[PHP] Re: Re: Re: better way to mix html and php code?

2005-11-21 Thread Dan Baker
Robert Cummings [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Mon, 2005-11-21 at 13:41, Dan Baker wrote:
 There are two ways for retrieving data. The first you have seen is the
 tag form, but obviously that's a problem when the data goes into a tag
 :) For this there is the embed form (a simple example follows but data
 can be retrieved from modules/components in the same way):

 a href=page.php?op=Viewid={jinn:echo value={jinn:getValue name=_GET,
 path=id}}

So, how do you go about having optional links?  Like, admin people get a 
button that other don't?

Thanks for the info!
DanB

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



Re: [PHP] Re: Re: Re: better way to mix html and php code?

2005-11-21 Thread Robert Cummings
On Mon, 2005-11-21 at 18:17, Dan Baker wrote:
 Robert Cummings [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
  On Mon, 2005-11-21 at 13:41, Dan Baker wrote:
  There are two ways for retrieving data. The first you have seen is the
  tag form, but obviously that's a problem when the data goes into a tag
  :) For this there is the embed form (a simple example follows but data
  can be retrieved from modules/components in the same way):
 
  a href=page.php?op=Viewid={jinn:echo value={jinn:getValue name=_GET,
  path=id}}
 
 So, how do you go about having optional links?  Like, admin people get a 
 button that other don't?

I guess you missed the custom tag post I made before:

project:access level=admin
a href=page.php?op=Viewid={jinn:echo value={jinn:getValue name=_GET,
path=id}}
/project:access

project is an arbitrary name generally chosen to reflect a project.
For different projects I usually assign unique tag spaces for any given
project. Often used tags that I share between projects I usually assign
a tag space name of common. And tags that come packaged with interjinn
are assigned the jinn tag space name.

There's other ways too. InterJinn supports if/elseif/else tags for
display logic (such as optional content based on some status). The
custom tag just happens to be very concise and clear which is generally
how I tend to make my templates :)

The templating engine isn't just limited to these types of tags, custom
compilers can choose to extend the base tag or embed classes, or they
can do whatever they want to the content. The tag system just happens to
be what I tied in most closely with the application engine.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Re: Re: Re: better way to mix html and php code?

2005-11-21 Thread Dan Baker
Robert Cummings [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Mon, 2005-11-21 at 13:41, Dan Baker wrote:
 I'm curious ... how do you generally handle forms and urls?  What if the
 programmer wants to add a link, something like:
 a href=page.php?op=Viewid=1234View my info/a

 How is the data (op=Viewid=1234) separated from the formatting?

 There are two ways for retrieving data. The first you have seen is the
 tag form, but obviously that's a problem when the data goes into a tag
 :) For this there is the embed form (a simple example follows but data
 can be retrieved from modules/components in the same way):

 a href=page.php?op=Viewid={jinn:echo value={jinn:getValue name=_GET,
 path=id}}

It appears that the data op=View is embedded in the html data.  This seems 
strange, because the PHP programmer is the one who needs to set this value, 
not the page designer.

Also, the jinn:getValue seems a lot like programming -- The id value must 
come from a database, based on who is currently logged in.  I assume it can 
be done, but seems like these queries would get rather complex, as well as 
redundant. Seems like you are changing from programming in PHP to 
programming in this new jinn language.

I am interested in how this works, but am skeptical.
DanB

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



Re: [PHP] Re: Re: Re: better way to mix html and php code?

2005-11-21 Thread Robert Cummings
On Mon, 2005-11-21 at 18:46, Dan Baker wrote:
 Robert Cummings [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
  On Mon, 2005-11-21 at 13:41, Dan Baker wrote:
  I'm curious ... how do you generally handle forms and urls?  What if the
  programmer wants to add a link, something like:
  a href=page.php?op=Viewid=1234View my info/a
 
  How is the data (op=Viewid=1234) separated from the formatting?
 
  There are two ways for retrieving data. The first you have seen is the
  tag form, but obviously that's a problem when the data goes into a tag
  :) For this there is the embed form (a simple example follows but data
  can be retrieved from modules/components in the same way):
 
  a href=page.php?op=Viewid={jinn:echo value={jinn:getValue name=_GET,
  path=id}}
 
 It appears that the data op=View is embedded in the html data.  This seems 
 strange, because the PHP programmer is the one who needs to set this value, 
 not the page designer.

You asked for a sample of how to do dynamic link parameters. Dynamic
parameters can come from many sources (_GET, _POST, component, foreach,
etc). I gave you an example of one parameter being dynamic, the first I
left as static since perhaps the page itself determines the value.
InterJinn's TemplateJinn employes a data pull philosophy. Component
developers make available data and templates consume it (reverse of
smart which forces developers to import templates and populate the
template). Generally for simplicity I just set member vars on the
component object. But vars can be set anywhere depending on what is
agreed upon by the developer and the designer. The render tag bypasses
lower level data retrieval and just requests a chunk of output by
selector name.

 Also, the jinn:getValue seems a lot like programming -- The id value must 
 come from a database, based on who is currently logged in.  I assume it can 
 be done, but seems like these queries would get rather complex, as well as 
 redundant.

Decisions are made in any design. Since InterJinn employs data pull
mechanisms, and modules/components are created to be consumed by
templates, such that designers can import any module they want (and as
many) and just layout the data how they please, it was imperative that
one module's data not stomp on another module's data. In this way the
{getValue} embed drills down into the data structures of an existing
array or object. is this programming? Not really, it's no more
programming than you opening up a dictionary, jumping to the A section,
and then looking for Apple. This is data retrieval.

  Seems like you are changing from programming in PHP to 
 programming in this new jinn language.

TemplateJinn employes very few logic techniques. Business logic is
expected to occur in the modules/components/compilers. I guess in the
above example I could have used the following instead:

a href=page.php?op=Viewid={jinn:render name=someModule, path=id}

But this presumes the id comes from a module. I just showed an example
of retrieving the ID from the GET parameters to the current page
*shrug*. Also, it is true that TemplateJinn introduces new syntax, I
never said it didn't, but I am happy to pay the small price of some new
syntax to increase the readability and brevity of my templates.

 The id value must come from a database, based on who is
 currently logged in.

As pointed out in a previous post, a developer can wrap such low level
data requests in custom tags. if I want cross site template access to
the currently logged in user's ID then I'd add a custom tag to do the
following:

a href=page.php?op=Viewid={project:user field=id}

 I am interested in how this works, but am skeptical.

No problem, the programming in X template instead of programming in
PHP objection is raised often. I've given previous arguments about the
merits of templates and concise data retrieval, display logic versus
business logic, and meta tags versus traditional tags. Everything done
in TemplateJinn can be done in PHP, absolutely since templates compile
to PHP pages, but templates provide a layer between the soup of PHP
necessary to accomplish that, and the designer. Even as a developer I
don't want to engage in the soup necessary to accomplish everything
TemplateJinn now does for me -- unfortunately I maintain some sites that
do employ the soup system.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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

Re: [PHP] Regex for balanced brackets?

2005-11-21 Thread David Tulloh
I think you are doing it wrong, though reading other people's regex 
easily is a skill I lack.

It is however very possible.

The php manual has a section on recursive regex where it explains how to 
solve the bracket problem.

http://php.net/manual/en/reference.pcre.pattern.syntax.php#regexp.reference.recursive
I think of recursive regex as creating goto loops, with all the power 
and problems that come with it.


You will also have to enable the multiline flag for your test data.


David

Jeffrey Sambells wrote:


I came across this method of matching brackets with regex in .NET

http://puzzleware.net/blogs/archive/2005/08/13/22.aspx

but I am wondering if it is possible to do the same in PHP?

I've tried it a bit but I can't seem to get it to work properly. I'm  
just wondering if I am doing something wrong or if it is just not  
possible.


Thanks.

here is the code I was playing with:

?php

$pattern = PATTERN
\{
(?
[^{}]+
|
\{ (?PDEPTH)
|
\} (?P-DEPTH)
)*
(?(DEPTH)(?!))

\}
PATTERN;

$subject = SUBJECT
test {
test2 {
test3
}
}

test4
{

}
SUBJECT;


preg_match_all(/$pattern/ix,$subject,$matches);

header(content-type: text/plain; );

var_dump($matches);

?


- Jeff




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



[PHP] PHP 5.0.5

2005-11-21 Thread Ashley M. Kirchner


   Trying to compile APXS version of PHP5.05 and towards the end, when 
it tries to compile the CLI version, it bombs with the following:


ext/ftp/ftp.lo(.text+0x76): In function `data_close':
/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1566: undefined reference 
to `SSL_shutdown'
ext/ftp/ftp.lo(.text+0x96):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1557: 
undefined reference to `SSL_shutdown'

ext/ftp/ftp.lo(.text+0x15e): In function `ftp_close':
/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:184: undefined reference 
to `SSL_shutdown'

ext/ftp/ftp.lo(.text+0x22b): In function `my_send':
/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1246: undefined reference 
to `SSL_write'
ext/ftp/ftp.lo(.text+0x250):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1244: 
undefined reference to `SSL_write'

ext/ftp/ftp.lo(.text+0x415): In function `data_accept':
/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1511: undefined reference 
to `SSLv23_client_method'
ext/ftp/ftp.lo(.text+0x41e):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1511: 
undefined reference to `SSL_CTX_new'
ext/ftp/ftp.lo(.text+0x434):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1517: 
undefined reference to `SSL_new'
ext/ftp/ftp.lo(.text+0x451):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1525: 
undefined reference to `SSL_set_fd'
ext/ftp/ftp.lo(.text+0x470):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1531: 
undefined reference to `SSL_connect'
ext/ftp/ftp.lo(.text+0x534):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1528: 
undefined reference to `SSL_copy_session_id'
ext/ftp/ftp.lo(.text+0x589):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1520: 
undefined reference to `SSL_CTX_free'
ext/ftp/ftp.lo(.text+0x5ae):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1533: 
undefined reference to `SSL_shutdown'

ext/ftp/ftp.lo(.text+0x652): In function `my_recv':
/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1286: undefined reference 
to `SSL_read'
ext/ftp/ftp.lo(.text+0x686):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1284: 
undefined reference to `SSL_read'

ext/ftp/ftp.lo(.text+0x1bb1): In function `ftp_login':
/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:278: undefined reference 
to `SSLv23_client_method'
ext/ftp/ftp.lo(.text+0x1bba):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:278: 
undefined reference to `SSL_CTX_new'
ext/ftp/ftp.lo(.text+0x1bd0):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:284: 
undefined reference to `SSL_new'
ext/ftp/ftp.lo(.text+0x1bec):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:291: 
undefined reference to `SSL_set_fd'
ext/ftp/ftp.lo(.text+0x1bf8):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:293: 
undefined reference to `SSL_connect'
ext/ftp/ftp.lo(.text+0x1cdc):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:287: 
undefined reference to `SSL_CTX_free'
ext/ftp/ftp.lo(.text+0x1d01):/usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:295: 
undefined reference to `SSL_shutdown'

collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1


   libphp5.so compiles just fine just before this bomb.  Any sugestions 
anyone?


--
R | I haven't lost my mind; it's backed up on tape somewhere.
 +
 Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
 IT Director / SysAdmin / WebSmith . 800.441.3873 x130
 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.

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



Re: [PHP] PHP 5.0.5

2005-11-21 Thread Curt Zirzow
On Mon, Nov 21, 2005 at 09:41:40PM -0700, Ashley M. Kirchner wrote:
 
Trying to compile APXS version of PHP5.05 and towards the end, when 
 it tries to compile the CLI version, it bombs with the following:
 
 ext/ftp/ftp.lo(.text+0x76): In function `data_close':
 /usr/local/src/apache/php-5.0.5/ext/ftp/ftp.c:1566: undefined reference 
 to `SSL_shutdown'

This means basically that the header files (*.h) where found but
none of the libraries were found.

You're compile path looks awkward to me.

 
libphp5.so compiles just fine just before this bomb.  Any sugestions 
 anyone?

what does your ./configure line look like?


Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] PHP 5.0.5

2005-11-21 Thread Ashley M. Kirchner

Curt Zirzow wrote:


You're compile path looks awkward to me.

   How so?  /usr/local/src/apache is simply a folder where I have all 
apache related sources dumped and compiled prior to installation.  So 
naturally PHP's source becomes /usr/local/src/apache/php-5.0.5



what does your ./configure line look like?
 


   This same configure line compiles PHP4.4.1 just fine.  It's long:

   ./configure --sysconfdir=/etc/httpd/conf --mandir=/usr/share/man 
--with-apxs --enable-force-cgi-redirect --enable-discard-path 
--enable-fastcgi --with-config-file-path=/etc/httpd/conf/ 
--enable-safe-mode --with-exec-dir=/etc/httpd/php --enable-magic-quotes 
--with-zlib=shared --enable-bcmath --with-bz2=shared --enable-calendar 
--with-bcmath=shared --with-calendar=shared --with-jpeg=shared 
--with-tiff=shared --enable-dba --with-dba=shared --with-gdbm=shared 
--with-db4=shared --with-dom=shared --with-dom-xslt=shared 
--with-dom-exslt=shared --enable-ftp --with-gd=shared --with-png=shared 
--with-freetype-dir --enable-gd-native-ttf --with-gettext=shared 
--with-gmp=shared --with-imap=shared --with-kerberos --with-imap-ssl 
--with-mcrypt=shared --with-mime-magic=/etc/httpd/conf/magic 
--with-mysql=/usr --with-ncurses=shared --with-zlib=shared 
--enable-sockets --with-tsrm-pthreads --with-ldap=shared 
--with-openssl=shared --with-mcal=shared


--
R | I haven't lost my mind; it's backed up on tape somewhere.
 +
 Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
 IT Director / SysAdmin / WebSmith . 800.441.3873 x130
 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.

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



RE: [PHP] security question... man in the middle attacks

2005-11-21 Thread bruce
your questions are on point...

if you're going to really talk about doing transactions... it appears to me
that you really need to solve this. www.passmarksecurity.com claims to have
solved this.. although i'm not sure i agree with them.. for one, i can't
find a thorough independent analysis, for two, from what i can tell... they
rely on the server app getting information from the browser. their approach
appears to depend on their belief that the intermediary (fake) app can't be
in the middle, therefore they'll only get valid information from the 'real'
browser...

as far as i can tell, their solution is to look at certain information (mac
address/headers/etc...) that they're inclined to believe can't be
altered/spoofed. i'm not buying it

as far as i can tell... you essentially need multiple information streams on
the client(browser) machine coming from the server... in actuality, i can
envision the following...



   master server   customer client
/  \
   /\
  biz server --- customer browser

the customer and the biz server talk to each other
the customer client and master server talk to each other
the customer client and browser are on the same machine

 the idea would be for the client app to be abel to 'get/see' the url that
the biz server app is sending for return requests. the client app would then
go back to the master server to 'determine' if the url/ip address is corect
for the given site. this can be accomplished fairly quickly by polling
random dns servers at the master level.

if the majority of the polled dns servers return the same address as the one
from the biz server, we can assume that the biz server is giving the correct
url/ip addresses.. this could be done for every request.

this kind of approach would be pretty difficult to corrupt, unless the
client app where somehow mangled/forged. you could determine if the client
was ever screwed with by using an SMS type of system via the cell phone...

-bruce



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Monday, November 21, 2005 8:34 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] security question... man in the middle attacks


'man in the middle' relates to any interception/redirection and I see I was
looking at it more as a hacker posing as the user interacting with a
legitmate site rather than the user interacting with a bogus site.   Two
sides to a similar coin.


real site  bogus user - bogus site - real user


the session ID issue I was talking about helps prevent a bogus user from
posing as a legitimate one because only the real-site and the real-user
should know the session ID being used but then again, it could be
intercepted.  I think there's more to it than I'm explaining, but it's not
coming to me right now.  My apologies for not being more specific.

Definitely check out Chris Shiflett's site: http://shiflett.org/ (I got
un-lazy for a moment to look it up).. he might have something in there
somewhere.

I think what you're talking about is going to be kind of tricky because more
so than other security issues, this issue seems more susceptible to
measure/countermeasure type things.   You could use a secure connection, but
what happens if the hacker gets a certificate for their bogus site?  What
happens if they mask the URL so it appears to be coming from the legitmate
site?

I'm wondering how often the scenario you're talking about will come into
play though.  Seems that unless someone hacks your site and puts in some
bogus URLs that drag your legit users away from your legit site, the only
way someone's going to get lured into this situation is if someone is
posting bogus URLs somewhere else.. like on online forums or something
saying Come see Bruce's website! and going to a totally different URL
posing as yours.  In which case you can really only rely on your user's
intelligence to NOT fall for it.

Anyway, just some things to ponder while you find a real answer. :)  I
have some experience with security issues, but wouldn't necessarily call
myself an 'expert'.  Working on it though.

-TG

= = = Original message = = =

i'm not sure i see how this would affect a man in the middle attack...

a man in the middle attack, for the purpose of this thread is the insertion
of a clone/fake web app between the user's browaser and the original web
site...

i'm looking for ways/solutions that will prevent a fake/clone site from
redirecting the user, or intercepting the user/initial site traffic...

  original  fake user
site   ---site   -  browser

in this case a fake site could look like the original site, intercepting the
communication between the original/user. how can it be detected, can it
really be prevented?

as far as i can tell, what ever the original might send to the user's
browser, can simply be intercepted by the fake site, and in