php-general Digest 27 May 2005 01:58:49 -0000 Issue 3477
Topics (messages 215837 through 215844):
Re: extending a class using includes not working
215837 by: Brent Baisley
Recursion: Ugh!
215838 by: Chris W. Parker
215839 by: Marek Kilimajer
215840 by: Chris W. Parker
215842 by: Rory Browne
Retrieving client SSL info
215841 by: Peter Brodersen
215844 by: Peter Brodersen
include file and problems with headers
215843 by: Ross
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:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Is the include in your class 2 file the very first line, before you
start declaring your class 2 classes? The class 1 file has to be loaded
before you start extending it, obviously, but just checking.
The other problem may be with your paths. Wherever your template file
is located is where is your includes will be looked for in relation to,
along with the php.ini include path. For a quick test, you can try
using an absolute path reference for your include files instead of a
relative path and see if that works. If it does, then you have a path
problem.
On May 25, 2005, at 2:30 PM, Charles Kline wrote:
hi all.
i have 2 class files. say for example.
class 1
class 2 extends class 1
class 2 uses include_once("firstclass.php")
then i use include_once ("secondclass.php") in my template. this does
not work. to get it to work, i must put both the files as includes in
my template.
any ideas why?
thanks,
charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--- End Message ---
--- Begin Message ---
Hi everyone,
I've been working on a problem for a few days now and I'm not making any
headway so I think it's time I come to the list for some help (though
this really disappoints me since it appears I'm not capable of solving
this problem on my own!).
Anyway, I'm using the Modified Preorder Tree Traversal method to store
my category hierarchy. Using recursion I can build an array that
accurately depicts the layout of the categories. So far so good. What I
have not been able to do thus far is turn that array into a list that
looks like this:
Food:Fruit:Red
Food:Fruit:Green
Food:Fruit:Yellow
Food:Vegetables:Long
Food:Vegetables:Round
Food:Vegetables:Round:Spikey
Food:Vegetables:Round:Smooth
My array is included at the end of this email. (And yes I typed it by
hand so hopefully there aren't any errors in it.)
I've searched the web but haven't found anything that's helped.
Anyone have a solution?
Thanks,
Chris.
0 => Array
(
[name] => Food
[children] => Array
(
0 => Array
(
[name] => Fruit
[children] => Array
(
0 => Array
(
[name] => Red
[children] =>
)
1 => Array
(
[name] => Green
[children] =>
)
2 => Array
(
[name] => Yello
[children] =>
)
)
)
1 => Array
(
[name] => Vegetables
[children] => Array
(
0 => Array
(
[name] => Long
[children] =>
)
1 => Array
(
[name] => Round
[children] => Array
(
0 => Array
(
[name] => Spikey
[children] =>
)
1 => Array
(
[name] => Smooth
[children] =>
)
)
)
)
)
)
)
--- End Message ---
--- Begin Message ---
Chris W. Parker wrote:
Hi everyone,
I've been working on a problem for a few days now and I'm not making any
headway so I think it's time I come to the list for some help (though
this really disappoints me since it appears I'm not capable of solving
this problem on my own!).
Anyway, I'm using the Modified Preorder Tree Traversal method to store
my category hierarchy. Using recursion I can build an array that
accurately depicts the layout of the categories. So far so good. What I
have not been able to do thus far is turn that array into a list that
looks like this:
Food:Fruit:Red
Food:Fruit:Green
Food:Fruit:Yellow
Food:Vegetables:Long
Food:Vegetables:Round
Food:Vegetables:Round:Spikey
Food:Vegetables:Round:Smooth
My array is included at the end of this email. (And yes I typed it by
hand so hopefully there aren't any errors in it.)
I've searched the web but haven't found anything that's helped.
Anyone have a solution?
untested:
function display($array, $prefix = '') {
echo $prefix ':' . $array['name'] . "\n";
if(is_array($array['children']) && $array['children']) {
foreach($array['children'] as $child) {
display($child, $prefix ':' . $array['name']);
}
}
}
0 => Array
(
[name] => Food
[children] => Array
(
0 => Array
(
[name] => Fruit
[children] => Array
(
0 => Array
(
[name] => Red
[children] =>
)
1 => Array
(
[name] => Green
[children] =>
)
2 => Array
(
[name] => Yello
[children] =>
)
)
)
1 => Array
(
[name] => Vegetables
[children] => Array
(
0 => Array
(
[name] => Long
[children] =>
)
1 => Array
(
[name] => Round
[children] => Array
(
0 => Array
(
[name] => Spikey
[children] =>
)
1 => Array
(
[name] => Smooth
[children] =>
)
)
)
)
)
)
)
--- End Message ---
--- Begin Message ---
Marek Kilimajer <mailto:[EMAIL PROTECTED]>
on Thursday, May 26, 2005 11:35 AM said:
> untested:
>
> function display($array, $prefix = '') {
> echo $prefix ':' . $array['name'] . "\n";
> if(is_array($array['children']) && $array['children']) {
> foreach($array['children'] as $child) {
> display($child, $prefix ':' . $array['name']);
> }
> }
> }
Thanks Marek.
I've had one suggestion off list also and, although I haven't been able
to test this myself, I think my major mistake is that I've been doing
the foreach() BEFORE checking for the existence of an array. Whereas
both suggestions so far are checking for the existence of an array
before the foreach().
I'll report back to the list with my results. Probably tomorrow.
Thanks,
Chris.
--- End Message ---
--- Begin Message ---
This would have been easier if you'd posted the php code to create the
array, as opposed to the output of print_r. I did this:
<?php
$arr = array(
array(
'name' => 'food',
'children' => array(
array(
'name' => 'meat',
'children' =>
array(
array('name' => "beef", "children" => NULL),
array("name" => "pork", "children" => NULL)
)
),
array(
'name' => 'friut',
'children' =>
array(
array('name' => "pears", "children" => NULL),
array('name' => "apples", "children" => NULL),
array('name' => "oranges", "children" => NULL)
)
),
array(
'name' => 'veg',
'children' =>
array(
array('name' => "parsnips", "children" => NULL),
array('name' => "carrots", "children" => NULL),
array('name' => "tomatoes", "children" => NULL),
)
)
)
)
);
function display_array($arr, $prefix=""){
while(list($k, $v) = each($arr)){
if(is_array($ca = $arr[$k]['children'])){
display_array($ca, $prefix . $arr[$k]['name'] . ":");
} else {
echo $prefix . $arr[$k]['name'] . "\n";
}
}
}
display_array($arr);
?>
On 5/26/05, Chris W. Parker <[EMAIL PROTECTED]> wrote:
> Marek Kilimajer <mailto:[EMAIL PROTECTED]>
> on Thursday, May 26, 2005 11:35 AM said:
>
> > untested:
> >
> > function display($array, $prefix = '') {
> > echo $prefix ':' . $array['name'] . "\n";
> > if(is_array($array['children']) && $array['children']) {
> > foreach($array['children'] as $child) {
> > display($child, $prefix ':' . $array['name']);
> > }
> > }
> > }
>
> Thanks Marek.
>
> I've had one suggestion off list also and, although I haven't been able
> to test this myself, I think my major mistake is that I've been doing
> the foreach() BEFORE checking for the existence of an array. Whereas
> both suggestions so far are checking for the existence of an array
> before the foreach().
>
> I'll report back to the list with my results. Probably tomorrow.
>
>
> Thanks,
> Chris.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Hi,
I have an Apache1 webserver running under Linux with mod_ssl and
PHP5.0.4 (debian dotdeb backport).
I have users logging in via SSL, presenting a client certificate:
SSLVerifyClient require
SSLCACertificateFile path/to/CAcert.crt
.. and everything works at this point.
My question is how to retrieve any kind of information regarding the
current SSL connection with PHP, thereby being able to identify the
different clients uniquely (I'm not interested in who they are, just
to be able to store and present different information for the users).
This might be based on the serial in the client certificate.
A phpinfo() only shows that $_SERVER['HTTPS'] has been set to "on".
The mod_ssl-refrence shows though that a lot of other environment
variables should be present:
http://www.modssl.org/docs/2.1/ssl_reference.html#ToC23
.. but I can't seem to retrieve this information anywhere.
I haven't tried apache_getenv() since I'm not running Apache2. I don't
know if variables such as SSL_CLIENT_M_SERIAL are available here.
I have searched the web, in php.general and comp.lang.php without
success. The closest info was a reply from Christ Shiflett:
http://marc.theaimsgroup.com/?l=php-general&m=103828683828825&w=2
Notice that it is my own site that is running under SSL. I am not
trying to connect to a SSL-enabled site using PHP; my users are
connecting to my site (with their browsers and certificates). I don't
think the openssl functions could be helpful here.
--
- Peter Brodersen
--- End Message ---
--- Begin Message ---
On Thu, 26 May 2005 21:32:27 +0200, in php.general [EMAIL PROTECTED] (Peter
Brodersen) wrote:
>I have searched the web, in php.general and comp.lang.php without
>success. The closest info was a reply from Christ Shiflett:
>http://marc.theaimsgroup.com/?l=php-general&m=103828683828825&w=2
What a typo... I admit I do admire his work, but his name is still
Chris :-) Sorry about that.
--
- Peter Brodersen
--- End Message ---
--- Begin Message ---
I have the folowing code which checks whether the user has logged in.
if (!isset ($_SESSION['new_session'] ) )
{
$login_status = "<div class=\"standard_text\">Your are not signed in
</div>";
}
if (isset ($_SESSION['new_session'] ) )
{
$address = $_SESSION['new_session'];
$login_status = "<div class=\"standard_text\">Your are signed in as <span
class=\"under\">$address</span></div>";
}
?>
Now when I have this as a file to be included in each page, status.php (see
code) gives the header error (already sent).
<?php
session_start();
include('status.php');
When the code is pasted in each individual page it works fine. This is no
big deal but it is annoying me! why does this not work.
I have also tried require_once & include_once() but nothin works.
Later on in the page there is a form which sets some cookies and uses
php_self() to send the data to itself.
Ross
--- End Message ---