php-general Digest 16 Aug 2005 14:53:36 -0000 Issue 3628

Topics (messages 220669 through 220696):

Re: Problem using Metabase
        220669 by: Pablo Gosse
        220671 by: Pablo Gosse
        220676 by: Manuel Lemos

Re: Problem when encoding non-english into UTF-8
        220670 by: Jasper Bryant-Greene
        220685 by: John Nichel

Re: one more mysql question
        220672 by: Esteamedpw.aol.com

Re: Be careful! Look at what this spammer did.
        220673 by: Esteamedpw.aol.com

Re: 'God' has spoken... :-)
        220674 by: George Pitcher
        220677 by: Jochem Maas

Re: php output to string
        220675 by: Jesús Fernández

Re: Javascript Src and HTTP_REFERER
        220678 by: Dotan Cohen
        220679 by: Jasper Bryant-Greene

Windows, DLLs and php.ini
        220680 by: Chris Boget

Advice sought on PHP site maintenance
        220681 by: George Pitcher
        220688 by: John Nichel
        220690 by: George Pitcher
        220694 by: Mark Rees
        220696 by: George Pitcher

Upgrading PHP 4.2.3 to PHP 4.3.2
        220682 by: T.N.Prasad
        220684 by: Jim Moseby
        220686 by: John Nichel
        220687 by: Torgny Bjers
        220689 by: Tim Burgan
        220692 by: Burhan Khalid

I fixed the logic :-) --- Recursive Array on outputing correctly
        220683 by: Gregory Machin

php 5.04 register_globals aint acting right.
        220691 by: Daniel Baughman
        220693 by: Jochem Maas

How to suppress HTTP headers?
        220695 by: Thomas Capote

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 ---
[snip]
> Here's my code:
> 
> require("classes/metabase/metabase_database.php");
> require("classes/metabase/metabase_interface.php");
> 
> $error=MetabaseSetupDatabaseObject(array("Type"=>"odbc-msaccess",
> "IncludePath"=>"classes/metabase"), $db);
> 
> if($error!="") {
>       echo "Database setup error: $error\n";
>       exit;
> }
> 
> $db->SetDatabase("etrakADB");

I tried that code here with PHP 4.3.11 and it works perfectly.

Which version of PHP are you using?

Are you using any PHP cache extension like APC or another?

Metabase loads the class files by the right order but it is possible 
that a buggy caching extension may be causing that problem.

You may also try loading the classes as workaround right after the 
includes you make in your script:

require('classes/metabase/metabase_odbc.php');
require('classes/metabase/metabase_odbc_msaccess.php');
require('classes/metabase/manager_odbc.php');
require('classes/metabase/manager_odbc_msaccess.php');
[/snip]

Thanks, Manuel.  I tried what you suggested but it didn't work.  The server 
this project is housed on is an IIS server running PHP 4.4.0.

I installed the metabase package on a linux server, and was able to connect to 
a postgres database with no troubles at all.

It must be something in our PHP configuration that's causing the problem, but 
I'm pretty sure we have a cache extension installed.  This PHP install was done 
rather quickly, unless there's a cache extension installed by default (which 
there is not as far as I understand, but I could be wrong ...) we likely didn't 
install one.

Thanks,

Pablo

--- End Message ---
--- Begin Message ---
[snip]
It must be something in our PHP configuration that's causing the
problem, but I'm pretty sure we have a cache extension installed.  This
PHP install was done rather quickly, unless there's a cache extension
installed by default (which there is not as far as I understand, but I
could be wrong ...) we likely didn't install one.
[/snip]

Sorry, I meant to say that we likely DO NOT have a cache extension
installed.

Can anyone think of any other reason why the order in which the class
files are loaded would be changed on one server to the next?

Cheers and TIA,

Pablo

--- End Message ---
--- Begin Message ---
Hello,

on 08/16/2005 12:01 AM Pablo Gosse said the following:
Thanks, Manuel.  I tried what you suggested but it didn't work.  The
server this project is housed on is an IIS server running PHP 4.4.0.

I installed the metabase package on a linux server, and was able to
connect to a postgres database with no troubles at all.

It must be something in our PHP configuration that's causing the
problem, but I'm pretty sure we have a cache extension installed.
This PHP install was done rather quickly, unless there's a cache
extension installed by default (which there is not as far as I
understand, but I could be wrong ...) we likely didn't install one.

I suspect that the problem is with file permissions. I recall that since Metabase uses include to load class files, the script will not exit when it fails to include a PHP class file. Assuming that is the case, make sure that all Metabase class files are readable by your Web server user.


--

Regards,
Manuel Lemos

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

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

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

--- End Message ---
--- Begin Message ---
Wong HoWang wrote:
Dear all,

When I try to encode non-english char. such as big5 to UTF-8 with utf8_encode(), it always generate a wrong result, which is not readable. What can I do?

From the manual [1]:

utf8_encode -- Encodes an ISO-8859-1 string to UTF-8

You're using the wrong tool for the job. Take a look at the iconv extension[2].

Jasper

[1] http://www.php.net/utf8_encode
[2] http://www.php.net/iconv

--- End Message ---
--- Begin Message ---
Wong HoWang wrote:
Dear all,

When I try to encode non-english char. such as big5 to UTF-8 with utf8_encode(), it always generate a wrong result, which is not readable. What can I do?

Please help!

http://us2.php.net/iconv

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
 
In a message dated 8/13/2005 6:33:16 P.M. Central Standard Time,  
[EMAIL PROTECTED] writes:

>>while were not on the subject ....
>>John I have a  question about your wife ...

>>oh shit wrong list  ;-)

>>no no I meant to ask about sand - how do I make a CPU using  the stuff?


lol... I thought that was pretty funny too? I would have laughed if it were  
directed at me... ahhh well... 
 
- Clint

--- End Message ---
--- Begin Message ---
Yeah, I had this happen to me a while back... glad some of the biggest have  
been caught lately =)
 
 
<<<<<<<<<<<<<< Original Message  >>>>>>>>>>>>
I have a form that my visitors can email me from. Some jerk is trying
to  fool the mail() function into sending his spam, and I got  this
today:
<start asshole  code>
[EMAIL PROTECTED]
Content-Type: multipart/mixed;  boundary=\"===============0110030565==\"
MIME-Version: 1.0
Subject:  7510b460
To: [EMAIL PROTECTED]
bcc: [EMAIL PROTECTED]
From:  [EMAIL PROTECTED]

This is a multi-part message in MIME  format.

--===============0110030565==
Content-Type: text/plain;  charset=\"us-ascii\"
MIME-Version: 1.0
Content-Transfer-Encoding:  7bit

blrt
--===============0110030565==--
</start asshole  code>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

--- End Message ---
--- Begin Message ---
> Not only that, but as time goes by, community support (this list for
> instance) for 4 will likely diminish as others move on to later releases.
> Not only will the die-hard PHP4 users find it harder to get
> answers to their
> questions, but their answers to others will become less relevant to
> newer-version users.

I can speak form experience here, not PHP as this is such a wonderful
community, but Lasso. I used Lasso v3 from 2001-2005, hooking a FileMaker
solution to the web for a relatively small but complex UK-wide university
service and didn't need to upgrade to v5 when that rolled out (it wasn't
broke etc etc).

As I developed the PHP/MySQL solution that has now replaced it, I still
needed to maintain and improve the existing Lasso site. I found that I was
one of the only v3 users on the list and started getting nil responses to
pleas for help.

If you have the time, it's worth going with the flow, if not, then consider
jumping at say - every two years (at most) to keep up to date.

Just my 2p (no cents in England)

George in Oxford

--- End Message ---
--- Begin Message ---
l0t3k wrote:
not only encoding support, but internationalized date/time/number formatting support (including spellout), collation, breakiteration and transliteration. in many respects we'll be on par with Java I18N support. To see what will be available, see

http://icu.sourceforge.net/userguide/

thanks for the link l0t3k. :-)


and look at the topics on the left


l0t3k

"Jochem Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]

the biggest gain in php6 will be transparent unicode support - that is awesome, a really big plus - I'm crap at encoding et al and would really love it if php could handle all those funny characters without me having to think about it too much (and without having to using mb_string or iconv) - I run a couple of multi-lingual sites - right now I just pray every night that nobody asks me to implement japanese,
or something, there ;-)




--- End Message ---
--- Begin Message ---
thanks everyone, the problem was the url i needed to use. now the problem is 
solved :)

-- 
"El único error real es aquel en el que no hemos aprendido nada."

--- End Message ---
--- Begin Message ---
On 8/6/05, Cabbar Duzayak <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I have a web page (say page1) which refers to a php within javascript tag as:
> 
> <script type="text/javascript"
> src="http://mysite.com/javascript_dump.php";></script>
> 
> As you can see, this calls a php file which dumps javascript. The
> problem here is, within this php I couldn't get which page it is
> called from.
> 
> Basically, if it comes from affiliate site 1, I will show some
> content, and if it comes from affiliate site 2, I will show some other
> content.
> 
> And, the thing is, within this javascript_dump.php, HTTP_REFERER shows
> nothing, because it gives you the referer of the html page (page1)
> that contains this <script> tag (which might be something irrelevant,
> i.e. google), and remote_addr gives you the IP address of the user.
> 
> I know that I can add a simple query parameter to specify the source
> web page such as: javascript_dump.php?siteid=xyz, but this can be
> faked very easily, and anyone can introduce themselves as any
> affiliate.
> 
> Is there a way of getting (within the php) the site this php was
> called from in a reasonably secure way? Any ideas/suggestions?
> 
> Thanks..
> 

Duzayak,
Did you get this working the way you intented? If so, please share
with us what you did. Thanks.

Dotan
http://lyricslist.com/lyrics/artist_albums/348/mighty_mighty_bosstones.php
Mighty Mighty Bosstones Song Lyrics

--- End Message ---
--- Begin Message ---
Dotan Cohen wrote:
And, the thing is, within this javascript_dump.php, HTTP_REFERER shows
nothing, because it gives you the referer of the html page (page1)
that contains this <script> tag (which might be something irrelevant,
i.e. google), and remote_addr gives you the IP address of the user.

I know that I can add a simple query parameter to specify the source
web page such as: javascript_dump.php?siteid=xyz, but this can be
faked very easily, and anyone can introduce themselves as any
affiliate.

Is there a way of getting (within the php) the site this php was
called from in a reasonably secure way? Any ideas/suggestions?

Thanks..

Duzayak,
Did you get this working the way you intented? If so, please share
with us what you did. Thanks.

There's no reasonably secure way of doing this. I see three possible solutions.

1. Put a query parameter in, like you said you didn't want to. This is about as easy to fake as HTTP_REFERER, which could hardly be called secure anyway. HTTP_REFERER is set less and less often anyway, as people block it with "security" software.

2. Define a global variable in JavaScript before including the remote script, a la AdSense.

3. If the times on the servers can be expected to be synchronised, or you have some other unique but changing value that both servers know about, get an MD5/SHA1 hash of that value with the affiliate ID appended on the end, and compare it at the other end.

Jasper

--- End Message ---
--- Begin Message ---
I've looked at the documentation but was able to find this.  If anyone
can point
me to the right page, it would be much appreciated.  In any case, where
do you
define where PHP looks for the appropriate DLLs?  For example, if a DLL
(say,
ntwdblib.dll) is in both the "\PHP\dll" directory and the
"\windows\system32"
directory, which does PHP pull in?  And where do you specify which
directory
is used?
 
Additionally, where can you find detailed information about what the
mssql
configuration options actually do?  IE, mssql.textlimit,
mssql.max_persistent,
mssql.timeout, et. al.
 
thnx,
Chris

--- End Message ---
--- Begin Message ---
Hi,

I manage several sites for my company. Some are running our own service to
about 80 customers and others are running a service for some (5 and growing)
of our customers. Its the latter one that I need advice on.

I have an application where each customer has a website on our service. The
functionality and layout are almost identical throughout these sites and I
am striving to move any differences into configuration files. However, when
I make a change, I then need to make that change on each site.

I would like, if possible to maintain a single set of web pages and have
that work for all sites. I currently use PEAR::DB and Smarty templating. The
current url syntax is www.mysite.com/client/ and I would like to keep them
thinking that they each have their own unique site.

Can anyone suggest a structure for this?

MTIA

George in Oxford

--- End Message ---
--- Begin Message ---
George Pitcher wrote:
Hi,

I manage several sites for my company. Some are running our own service to
about 80 customers and others are running a service for some (5 and growing)
of our customers. Its the latter one that I need advice on.

I have an application where each customer has a website on our service. The
functionality and layout are almost identical throughout these sites and I
am striving to move any differences into configuration files. However, when
I make a change, I then need to make that change on each site.

I would like, if possible to maintain a single set of web pages and have
that work for all sites. I currently use PEAR::DB and Smarty templating. The
current url syntax is www.mysite.com/client/ and I would like to keep them
thinking that they each have their own unique site.

Can anyone suggest a structure for this?

If I'm reading you right, you're looking to keep a group of scripts/classes in one place that all sites can draw from. If this is the case, you could always set a global include directory (make it read only for the users of your service), and configure that path in Apache's httpd.conf or an .htaccess. I do this on our box (all the sites are ours, but when I have to update Smarty/PEAR/custom scripts, I like to just do it in one place).

<VirtualHostDirectory>
        -><VirtualHost1>
                -><docs>
        -><VirtualHost2>
                -><docs>
        -><VirtualHost3>
                -><docs>
        -><VirtualHost4>
                -><docs>
        -><GlobalInclude>
                -><PEAR>
                -><Smarty>
                -><Custom>

So on, and so forth.



--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
John,

Thanks for the input. I just knew I hadn't covered everything. My server is
currently set up as NT4/IIS. I suppose I could look to switching to Apache
though.

Cheers

George

> -----Original Message-----
> From: John Nichel [mailto:[EMAIL PROTECTED]
> Sent: 16 August 2005 2:25 pm
> To: [email protected]
> Subject: Re: [PHP] Advice sought on PHP site maintenance
>
>
> George Pitcher wrote:
> > Hi,
> >
> > I manage several sites for my company. Some are running our own
> service to
> > about 80 customers and others are running a service for some (5
> and growing)
> > of our customers. Its the latter one that I need advice on.
> >
> > I have an application where each customer has a website on our
> service. The
> > functionality and layout are almost identical throughout these
> sites and I
> > am striving to move any differences into configuration files.
> However, when
> > I make a change, I then need to make that change on each site.
> >
> > I would like, if possible to maintain a single set of web pages and have
> > that work for all sites. I currently use PEAR::DB and Smarty
> templating. The
> > current url syntax is www.mysite.com/client/ and I would like
> to keep them
> > thinking that they each have their own unique site.
> >
> > Can anyone suggest a structure for this?
>
> If I'm reading you right, you're looking to keep a group of
> scripts/classes in one place that all sites can draw from.  If this is
> the case, you could always set a global include directory (make it read
> only for the users of your service), and configure that path in Apache's
> httpd.conf or an .htaccess.  I do this on our box (all the sites are
> ours, but when I have to update Smarty/PEAR/custom scripts, I like to
> just do it in one place).
>
> <VirtualHostDirectory>
>       -><VirtualHost1>
>               -><docs>
>       -><VirtualHost2>
>               -><docs>
>       -><VirtualHost3>
>               -><docs>
>       -><VirtualHost4>
>               -><docs>
>       -><GlobalInclude>
>               -><PEAR>
>               -><Smarty>
>               -><Custom>
>
> So on, and so forth.
>
>
>
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
""George Pitcher"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> John,
>
> Thanks for the input. I just knew I hadn't covered everything. My server
is
> currently set up as NT4/IIS. I suppose I could look to switching to Apache
> though.

Far be it from me to discrouage you from switching to Apache. However, on
IIS, you can store the include files and classes you wish to use across
several sites in a single location. You can then make this accessible to all
sites by adding the location in as a virtual directory. This basically
allows you to refer to it as if it were a directory within your webroot (if
I remember right, it's been a while).

There's a brief guide here:
http://www.mvps.org/marksxp/WindowsXP/IIS/iis3.php

Giood luck

Mark

>
> Cheers
>
> George
>
> > -----Original Message-----
> > From: John Nichel [mailto:[EMAIL PROTECTED]
> > Sent: 16 August 2005 2:25 pm
> > To: [email protected]
> > Subject: Re: [PHP] Advice sought on PHP site maintenance
> >
> >
> > George Pitcher wrote:
> > > Hi,
> > >
> > > I manage several sites for my company. Some are running our own
> > service to
> > > about 80 customers and others are running a service for some (5
> > and growing)
> > > of our customers. Its the latter one that I need advice on.
> > >
> > > I have an application where each customer has a website on our
> > service. The
> > > functionality and layout are almost identical throughout these
> > sites and I
> > > am striving to move any differences into configuration files.
> > However, when
> > > I make a change, I then need to make that change on each site.
> > >
> > > I would like, if possible to maintain a single set of web pages and
have
> > > that work for all sites. I currently use PEAR::DB and Smarty
> > templating. The
> > > current url syntax is www.mysite.com/client/ and I would like
> > to keep them
> > > thinking that they each have their own unique site.
> > >
> > > Can anyone suggest a structure for this?
> >
> > If I'm reading you right, you're looking to keep a group of
> > scripts/classes in one place that all sites can draw from.  If this is
> > the case, you could always set a global include directory (make it read
> > only for the users of your service), and configure that path in Apache's
> > httpd.conf or an .htaccess.  I do this on our box (all the sites are
> > ours, but when I have to update Smarty/PEAR/custom scripts, I like to
> > just do it in one place).
> >
> > <VirtualHostDirectory>
> > -><VirtualHost1>
> > -><docs>
> > -><VirtualHost2>
> > -><docs>
> > -><VirtualHost3>
> > -><docs>
> > -><VirtualHost4>
> > -><docs>
> > -><GlobalInclude>
> > -><PEAR>
> > -><Smarty>
> > -><Custom>
> >
> > So on, and so forth.

--- End Message ---
--- Begin Message ---
Mark,

Thanks, I'll follow that up as well. I don't have to do this straight away.

Cheers

George

> -----Original Message-----
> From: Mark Rees [mailto:[EMAIL PROTECTED]
> Sent: 16 August 2005 3:33 pm
> To: [email protected]
> Subject: Re: [PHP] Advice sought on PHP site maintenance
>
>
> ""George Pitcher"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > John,
> >
> > Thanks for the input. I just knew I hadn't covered everything. My server
> is
> > currently set up as NT4/IIS. I suppose I could look to
> switching to Apache
> > though.
>
> Far be it from me to discrouage you from switching to Apache. However, on
> IIS, you can store the include files and classes you wish to use across
> several sites in a single location. You can then make this
> accessible to all
> sites by adding the location in as a virtual directory. This basically
> allows you to refer to it as if it were a directory within your
> webroot (if
> I remember right, it's been a while).
>
> There's a brief guide here:
> http://www.mvps.org/marksxp/WindowsXP/IIS/iis3.php
>
> Giood luck
>
> Mark
>
> >
> > Cheers
> >
> > George
> >
> > > -----Original Message-----
> > > From: John Nichel [mailto:[EMAIL PROTECTED]
> > > Sent: 16 August 2005 2:25 pm
> > > To: [email protected]
> > > Subject: Re: [PHP] Advice sought on PHP site maintenance
> > >
> > >
> > > George Pitcher wrote:
> > > > Hi,
> > > >
> > > > I manage several sites for my company. Some are running our own
> > > service to
> > > > about 80 customers and others are running a service for some (5
> > > and growing)
> > > > of our customers. Its the latter one that I need advice on.
> > > >
> > > > I have an application where each customer has a website on our
> > > service. The
> > > > functionality and layout are almost identical throughout these
> > > sites and I
> > > > am striving to move any differences into configuration files.
> > > However, when
> > > > I make a change, I then need to make that change on each site.
> > > >
> > > > I would like, if possible to maintain a single set of web pages and
> have
> > > > that work for all sites. I currently use PEAR::DB and Smarty
> > > templating. The
> > > > current url syntax is www.mysite.com/client/ and I would like
> > > to keep them
> > > > thinking that they each have their own unique site.
> > > >
> > > > Can anyone suggest a structure for this?
> > >
> > > If I'm reading you right, you're looking to keep a group of
> > > scripts/classes in one place that all sites can draw from.  If this is
> > > the case, you could always set a global include directory
> (make it read
> > > only for the users of your service), and configure that path
> in Apache's
> > > httpd.conf or an .htaccess.  I do this on our box (all the sites are
> > > ours, but when I have to update Smarty/PEAR/custom scripts, I like to
> > > just do it in one place).
> > >
> > > <VirtualHostDirectory>
> > > -><VirtualHost1>
> > > -><docs>
> > > -><VirtualHost2>
> > > -><docs>
> > > -><VirtualHost3>
> > > -><docs>
> > > -><VirtualHost4>
> > > -><docs>
> > > -><GlobalInclude>
> > > -><PEAR>
> > > -><Smarty>
> > > -><Custom>
> > >
> > > So on, and so forth.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
HI All,
 
Our company servers are being upgraded from 4.2.3 to 4.3.2.
 
Is there any special care that I should take (as far as my scripts are
concerned)?
 
Plz help me. I'm new to PHP.
 
 
Thanks
TNP
Professional Services
ZUSTEK INDIA 
________________________________________________________________________
 

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: T.N.Prasad [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, August 16, 2005 9:00 AM
> To: [email protected]
> Subject: [PHP] Upgrading PHP 4.2.3 to PHP 4.3.2
> Importance: High
> 
> 
> HI All,
>  
> Our company servers are being upgraded from 4.2.3 to 4.3.2.
>  
> Is there any special care that I should take (as far as my scripts are
> concerned)?
>  
> Plz help me. I'm new to PHP.

Greetings,

You are the only one who knows how your scripts are written, so you will
have to answer that question for yourself.  I don't know of any specific
problems between those versions, but you can see ALL the things that have
changed between them here:
http://www.php.net/ChangeLog-4.php

Cheers!

JM

--- End Message ---
--- Begin Message ---
T.N.Prasad wrote:
HI All,
Our company servers are being upgraded from 4.2.3 to 4.3.2. Is there any special care that I should take (as far as my scripts are
concerned)?
Plz help me. I'm new to PHP.

In theory, no. However, theory can get you into trouble. Check the change log, and if possible, install 4.3.2 on a non-production box to test your scripts there.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
T.N.Prasad wrote:

>HI All,
> 
>Our company servers are being upgraded from 4.2.3 to 4.3.2.
> 
>Is there any special care that I should take (as far as my scripts are
>concerned)?
> 
>Plz help me. I'm new to PHP.
>

Hello,

You don't have to worry at all.

Nothing have changed between those versions that break compatibility
with older scripts. If you were to downgrade from 4.3.2 to 4.2.3
instead, that would pose problems if you for instance were using
internal functions such as file_get_contents() which appeared in 4.3.0. :)

Regards,
Torgny

--- End Message ---
--- Begin Message ---
Can I extend this..

On a live server I have PHP 4.1. If I upgrade to PHP 5, is something likely to stop working?

I've been putting off upgrading for months because of the unknown of something going wrong.

Thanks

--- End Message ---
--- Begin Message ---
Tim Burgan wrote:
Can I extend this..

On a live server I have PHP 4.1. If I upgrade to PHP 5, is something likely to stop working?

99% yes. Especially if you really mean 4.1.0 -- that's quite old.

--- End Message ---
--- Begin Message ---
Here it is..
i found the problem.. 1) all the menu objects->arrChildren have an array ,
if there are on submenus.. then the array is empty .. the function was
trying to recurse through empty arrays. 2) the recursive call needed to
pass  the arrChildren to recurse correctly
"display_menu($value->arrChildren);"

now just to get the html output and css to live together :-)...

Thanks All form the support, all bets greg..


<?php
$link = mysql_connect("127.0.0.1", "root", "");
if (!$link) {
   die('Could not connect: ' . mysql_error());
}

// make  the current db
$db_selected = mysql_select_db('NEW_CMS', $link);
if (!$db_selected) {
   die (" can't connect to database : " . mysql_error());
}
class MenuItem
{
    var $intID = 0;
        var $names = '';
    var $arrChildren = array( );
    //
    // Constructor
    function MenuItem ( $intID, $text )
    {
        $this->intID = $intID;
                $this->names = $text;
        $this->addChildren( );
    }
    function addChildren ( )
    {
        $strSQL = "select id, name from newCMS_section where Parent = ".
$this->intID ."";

        $rseResult = mysql_query($strSQL);


      while ( $arrRecord = mysql_fetch_array( $rseResult, MYSQL_BOTH ) )
                                                                              {
        $this->arrChildren[] = new MenuItem( trim(  $arrRecord[0] ),
trim($arrRecord[1]) );
                                                                              }
    }

}

$Menu =& new MenuItem(0,'');

$txt = $Menu->arrChildren;



function display_menu($array) {
$link ='';
$namez ='';

    foreach ($array as $key => $value) {
        if(empty($value->arrChildren)){ //arrChildren =>Array
                // problem was with the above if statment.
                        $namez = $value->names;
                        $link = $value->names;
                echo "<li><a href='{$link}'>{$namez}</a></li>\n";

  } else {
                        $namez = $value->names;

                echo "<ul><li><a>{$namez}</a><ul>";

                            display_menu($value->arrChildren);

                    echo '</ul></li></ul>';

        } // end of else
    } // end of foreach loop
} // end of function
//echo "<ul>";
echo "<ul id='nav' >";
display_menu($txt);

?>



-- 
Many Thanks
Gregory Machin (flamer)
072 524 8096
www.linuxpro.co.za
[EMAIL PROTECTED]

Agent for iberry.info hosting solutions



--

--- End Message ---
--- Begin Message ---


 
 
 
 
 
 
 
 
 I have register globals enabled, or set to “On”.  Isn’t this suppose to
take all of the $_POST variables and $_GET variables and make initialize
them by name?

i.e. $_POST[‘runquery’] will be accessible via simply $runquery

??

 
Dan Baughman
IT Technician
Professional Bull Riders, Inc.
719-471-3008 x 3161

CONFIDENTIAL, FOR DESIGNATED RECIPIENTS ONLY:  The preceding e-mail message
(including any attachments) contains information that may be confidential,
privileged, or non-public information. It is intended to be conveyed only to
the designated recipient(s) named above. If you are not an intended
recipient, please notify the sender by replying to this message and then
delete all copies of it from your computer system. Any use, dissemination,
distribution, or reproduction of this message by unintended recipients is
not authorized and may be unlawful.  DISCLAIMER OF ELECTRONIC TRANSACTION: 
This communication does not reflect an intention by the sender to conduct a
transaction or make any agreement by electronic means.  Nothing contained
herein shall constitute an electronic signature or a contract under any law,
rule or regulation applicable to electronic transactions.



--- End Message ---
--- Begin Message ---
Daniel Baughman wrote:


I have register globals enabled, or set to “On”. Isn’t this suppose to
take all of the $_POST variables and $_GET variables and make initialize
them by name?

register_globals should do that. but not "register globals",
regardless is a shitty setting. don't use it. besides its depreciated
just use $_POST['whatever']


i.e. $_POST[‘runquery’] will be accessible via simply $runquery

looks like you are stuffing SQL into a GET/POST param - sure you want to do 
that?




??

Dan Baughman
IT Technician
Professional Bull Riders, Inc.
719-471-3008 x 3161

CONFIDENTIAL, FOR DESIGNATED RECIPIENTS ONLY:  The preceding e-mail message
(including any attachments) contains information that may be confidential,
privileged, or non-public information. It is intended to be conveyed only to
the designated recipient(s) named above. If you are not an intended
recipient, please notify the sender by replying to this message and then
delete all copies of it from your computer system. Any use, dissemination,
distribution, or reproduction of this message by unintended recipients is
not authorized and may be unlawful. DISCLAIMER OF ELECTRONIC TRANSACTION: This communication does not reflect an intention by the sender to conduct a
transaction or make any agreement by electronic means.  Nothing contained
herein shall constitute an electronic signature or a contract under any law,
rule or regulation applicable to electronic transactions.




--- End Message ---
--- Begin Message ---
I am coding a PHP page to deal with a badly implemented automated status
update script on a remote server (that I do not control) which fails if my
response to it's POST request has HTTP headers. Go figure. So the question
is "How do I NOT send HTTP headers in my response?" or "How can my script
suppress headers completely?" Whatever the solution, it should affect only
this page/script.

In chapter 43, the PHP Manual states: "Though the CGI SAPI provides a way to
suppress HTTP headers, there's no equivalent switch to enable them in the
CLI SAPI." How would one suppress HTTP headers, as noted above, in the CGI
SAPI for a particular page on my site?
 
Somebody, please help.
--TC.

--- End Message ---

Reply via email to