php-general Digest 11 Jul 2003 11:04:55 -0000 Issue 2169

Topics (messages 154802 through 154853):

Using DOMXML with homogenous elements
        154802 by: Matt Grimm
        154807 by: Matt Grimm

nlist
        154803 by: Johnny Martinez
        154804 by: Robert C.
        154805 by: David Nicholson
        154806 by: Johnny Martinez

How to hide url on a php link NOT post...
        154808 by: Joey
        154810 by: Shena Delian O'Brien
        154831 by: Jeff Harris

Variable Functions...
        154809 by: Michael Smith
        154835 by: Burhan Khalid

Storing SQL Queries for Reuse in Apps
        154811 by: Jacob C

Storing HTML string in database
        154812 by: Aaron Axelsen
        154814 by: Jacob C
        154817 by: Aaron Axelsen
        154843 by: sven

Re: Blatant newbie question - killing a session
        154813 by: Ow Mun Heng
        154821 by: Bruce Bruen

Re: download php
        154815 by: Ow Mun Heng

Re: Object assignment
        154816 by: Tom Rogers
        154820 by: Tom Rogers

Need hep with mysql function
        154818 by: zlut arch
        154819 by: Robert Cummings

Re: /etc/passwd
        154822 by: Mantas Kriauciunas
        154845 by: Ford, Mike               [LSS]

pdf file error?
        154823 by: Micah Montoy
        154830 by: Micah Montoy

Re: Excel Parser
        154824 by: Tom Rogers

What did I do wrong to cause a parse error?
        154825 by: Phil Powell
        154832 by: Lars Torben Wilson
        154833 by: David Otton
        154836 by: Phil Powell
        154841 by: Ford, Mike               [LSS]

dump $_POST into variables????
        154826 by: Joe Harman
        154828 by: Jason Wong
        154829 by: Joe Harman

just wondering
        154827 by: Artoo
        154839 by: Baroiller Pierre-Emmanuel

Re: regexp problem
        154834 by: Burhan Khalid

Re: Please assist - been on this for hours - Permissions onserver
        154837 by: Steve Jackson
        154840 by: Jason Wong
        154846 by: Steve Jackson
        154850 by: Marek Kilimajer
        154851 by: Steve Jackson

Need Some Basic Help with Arrays
        154838 by: Joe Harman
        154842 by: Geoff Caplan

Re: session data missing
        154844 by: Ford, Mike               [LSS]

Socket connect crashes web server
        154847 by: Chris Morrow
        154848 by: Fejes Jozsef

numbers to text
        154849 by: Pete Morganic
        154852 by: Brian McGarvie
        154853 by: Pete Morganic

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 ---
I have a final kink to work out of an array to XML parser I've been writing.
The array structure is below, along with the example XML it came from.  A
link to the source I'm working on is at bottom.  The only problem this
script runs into is when there are multiple elements with the same name on
the same node level.  It crams all the values into a single element with
that name, and uses only the final element's attributes.  It seemed like
clone_node() was the answer, but it isn't working correctly in this
context -- anyone see why?  I sure don't.

[xml]
<?xml version="1.0"?>
<rootElement>
  <record id="1">Value 1</record>
  <record id="2">Value 2</record>
</rootElement>
[/xml]

[array]
Array
(
    [rootElement] => Array
        (
            [0] => Array
                (
                    [record] => Array
                        (
                            [0] => Array
                                (
                                    [ATTRIBUTES] => Array
                                        (
                                            [id] => 1
                                        )

                                    [VALUE] => Value 1
                                )

                            [1] => Array
                                (
                                    [ATTRIBUTES] => Array
                                        (
                                            [id] => 2
                                        )

                                    [VALUE] => Value 2
                                )

                        )

                )

        )

)
[/array]

Source:
http://www.healthtvchannel.org/test/php2xml.phps

Thanks,
--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK 99508
907.770.6200 ext. 686
907.336.6205 (fax)
E-mail: [EMAIL PROTECTED]
Web: www.healthtvchannel.org



--- End Message ---
--- Begin Message ---
I failed to show the output XML in my last message.  It's outputting like
so:

[xml]
<rootElement>
    <record id="2">Value1Value2</record>
</rootElement>
[/xml]

--
Matt Grimm


"Matt Grimm" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a final kink to work out of an array to XML parser I've been
writing.
> The array structure is below, along with the example XML it came from.  A
> link to the source I'm working on is at bottom.  The only problem this
> script runs into is when there are multiple elements with the same name on
> the same node level.  It crams all the values into a single element with
> that name, and uses only the final element's attributes.  It seemed like
> clone_node() was the answer, but it isn't working correctly in this
> context -- anyone see why?  I sure don't.
>
> [xml]
> <?xml version="1.0"?>
> <rootElement>
>   <record id="1">Value 1</record>
>   <record id="2">Value 2</record>
> </rootElement>
> [/xml]
>
> [array]
> Array
> (
>     [rootElement] => Array
>         (
>             [0] => Array
>                 (
>                     [record] => Array
>                         (
>                             [0] => Array
>                                 (
>                                     [ATTRIBUTES] => Array
>                                         (
>                                             [id] => 1
>                                         )
>
>                                     [VALUE] => Value 1
>                                 )
>
>                             [1] => Array
>                                 (
>                                     [ATTRIBUTES] => Array
>                                         (
>                                             [id] => 2
>                                         )
>
>                                     [VALUE] => Value 2
>                                 )
>
>                         )
>
>                 )
>
>         )
>
> )
> [/array]
>
> Source:
> http://www.healthtvchannel.org/test/php2xml.phps
>
> Thanks,
> --
> Matt Grimm
> Web Developer
> The Health TV Channel, Inc.
> (a non - profit organization)
> 3820 Lake Otis Parkway
> Anchorage, AK 99508
> 907.770.6200 ext. 686
> 907.336.6205 (fax)
> E-mail: [EMAIL PROTECTED]
> Web: www.healthtvchannel.org
>
>



--- End Message ---
--- Begin Message ---
Hi all,
Is there a local filesystem-based function comparable to the ftp-based
'nlist' that lists files in a directory?

Johnny

--- End Message ---
--- Begin Message ---
http://www.php.net/readdir

---- Original Message ----
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED], 
Subject: RE: [PHP] nlist
Date: Thu, 10 Jul 2003 16:17:30 -0700

>Hi all,
>Is there a local filesystem-based function comparable to the 
>ftp-based
>'nlist' that lists files in a directory?
>
>Johnny
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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


This is a reply to an e-mail that you wrote on Fri, 11 Jul 2003 at 00:17,
lines prefixed by '>' were originally written by you.
> Is there a local filesystem-based function comparable to the ftp-based
> 'nlist' that lists files in a directory?
> Johnny

In PHP 5 you can use scandir()
http://uk.php.net/manual/en/function.scandir.php

In lower versions AFAIK you will have to use the system function to call
either ls (on *nix) or dir (on windows).

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

          Professional Web Development by David Nicholson
                    http://www.djnicholson.com/

    QuizSender.com - How well do your friends actually know you?
                     http://www.quizsender.com/
                    (developed entirely in PHP)

--- End Message ---
--- Begin Message ---
This is it. Thanks guys!

J

-----Original Message-----
From: Robert C. [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 10, 2003 4:24 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] nlist


http://www.php.net/readdir

---- Original Message ----
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED], 
Subject: RE: [PHP] nlist
Date: Thu, 10 Jul 2003 16:17:30 -0700

>Hi all,
>Is there a local filesystem-based function comparable to the 
>ftp-based
>'nlist' that lists files in a directory?
>
>Johnny
>
>-- 
>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

--- End Message ---
--- Begin Message --- How can I hide this link so value can't be changed?
I don't want to change anything at the server level, and its not from a form so I cant do a post -vs- a get.


http://www.abcd.com/popup_SearchRepSet.php?searchby=cust_no&search=1&value=WOR032

Thanks !


--- End Message ---
--- Begin Message --- http://www.tinyurl.com

Joey wrote:
How can I hide this link so value can't be changed?
I don't want to change anything at the server level, and its not from a form so I cant do a post -vs- a get.


http://www.abcd.com/popup_SearchRepSet.php?searchby=cust_no&search=1&value=WOR032


Thanks !




--- End Message ---
--- Begin Message ---
On Jul 10, 2003, "Joey" claimed that:

|How can I hide this link so value can't be changed?
|I don't want to change anything at the server level, and its not from a
|form so I cant do a post -vs- a get.
|
|http://www.abcd.com/popup_SearchRepSet.php?searchby=cust_no&search=1&value=WOR032
|
|Thanks !
|

#1) [Not PHP] Make it a post that looks like a link. See previous posting
at http://marc.theaimsgroup.com/?l=php-general&m=105597453308214&w=2

#2) [Not PHP] If the values will never change, try http://tinyurl.com. If
you're keeping track of referrals, it might mess up your statistics.

#3) [Not PHP] Make that link inside a frame. One frameset would be
invisible, the other would be the link.

-- 
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6  68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.



--- End Message ---
--- Begin Message --- Smarty has a class method where it calls:

$this->$some_var("somevalue");

and this throws errors on Windows versions of php that i've tried. why is that?

-Michael
--
Pratt Museum IT Intern
All programmers are playwrights and all computers are lousy actors.


--- End Message ---
--- Begin Message ---
On Friday, July 11, 2003, 3:11:51 AM, Michael wrote:

MS> Smarty has a class method where it calls:

$this->$some_var("somevalue");

Are you sure about that syntax? I'm not too familiar with Smarty, only
used it once, but I think its $this->some_var("value");

MS> and this throws errors on Windows versions of php that i've tried. why 
MS> is that?

Does it error out on l/unix?



-- 
Regards,
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com


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

I just want to survey the list and see what kind of solutions people are using 
for the storage and reuse of SQL queries.

Right now I am working on an application that has native SQL queries as well 
as custom queries that can be added by developers as they build on the 
framework.

In the past I have done several things to store large sets of SQL queries. 
Some are better than others and some just shouldn't be used (hardcoded):

- Hardcoded into the application (written into classes or procedural code as 
needed).
- Stored in a delimited text file.
- Placed into a function or class method using switch to iterate by category 
and ID.
- Stored in an XML file.

I am kind of leaning towards the XML solution since the native queries can 
then easily be updated for people using the application. Of course using XML 
adds execution time and complexity to the app.

Anybody have any other solutions I haven't thought of or trick/tweaks to the 
ones I have listed?

Thanks!
Jacob

-- 
"If there's a World War III, World War IV will be fought with sticks and 
stones."

--- End Message ---
--- Begin Message ---
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have a php script set up for a user to upload a word document,
which is then coverted to html form, which I would then lke to store
in a database.

Howver, when I run the following command:

INSERT into sermons (data) VALUE ('$output');

It failes to work, because the $output strings contains "", which
messes things up.  Is there some way that this can be ignored while
entering into the databse?

Or am I better of replace all the "" with ''?

Thanks for the assistance.

- ---
Aaron Axelsen
AIM: AAAK2
Email: [EMAIL PROTECTED]

Want reliable web hosting at affordable prices?
www.modevia.com
 
Web Dev/Design Community/Zine
www.developercube.com


-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPw4PI7rnDjSLw9ADEQLL5QCg6rxSs/roIiGyxC6nN3XNiuONg00AoK/T
PSAAAbM+O7+e6iVNMMnpK5AC
=phqJ
-----END PGP SIGNATURE-----



--- End Message ---
--- Begin Message ---
Have a look at:

http://www.php.net/addslashes


Quoting Aaron Axelsen <[EMAIL PROTECTED]>:

>  
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I have a php script set up for a user to upload a word document,
> which is then coverted to html form, which I would then lke to store
> in a database.
> 
> Howver, when I run the following command:
> 
> INSERT into sermons (data) VALUE ('$output');
> 
> It failes to work, because the $output strings contains "", which
> messes things up.  Is there some way that this can be ignored while
> entering into the databse?
> 
> Or am I better of replace all the "" with ''?
> 
> Thanks for the assistance.
> 
> - ---
> Aaron Axelsen
> AIM: AAAK2
> Email: [EMAIL PROTECTED]
> 
> Want reliable web hosting at affordable prices?
> www.modevia.com
>  
> Web Dev/Design Community/Zine
> www.developercube.com
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
> 
> iQA/AwUBPw4PI7rnDjSLw9ADEQLL5QCg6rxSs/roIiGyxC6nN3XNiuONg00AoK/T
> PSAAAbM+O7+e6iVNMMnpK5AC
> =phqJ
> -----END PGP SIGNATURE-----
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
"If there's a World War III, World War IV will be fought with sticks and 
stones."

--- End Message ---
--- Begin Message ---
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I had forgotten about that, thanks alot

- ---
Aaron Axelsen
AIM: AAAK2
Email: [EMAIL PROTECTED]

Want reliable web hosting at affordable prices?
www.modevia.com
 
Web Dev/Design Community/Zine
www.developercube.com



- -----Original Message-----
From: Jacob C [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 10, 2003 8:18 PM
To: Aaron Axelsen
Subject: Re: [PHP] Storing HTML string in database


Have a look at:

http://www.php.net/addslashes


Quoting Aaron Axelsen <[EMAIL PROTECTED]>:

>  
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I have a php script set up for a user to upload a word document,
> which  is then coverted to html form, which I would then lke to
> store in a  database.
> 
> Howver, when I run the following command:
> 
> INSERT into sermons (data) VALUE ('$output');
> 
> It failes to work, because the $output strings contains "", which 
> messes things up.  Is there some way that this can be ignored while
>  entering into the databse?
> 
> Or am I better of replace all the "" with ''?
> 
> Thanks for the assistance.
> 
> - ---
> Aaron Axelsen
> AIM: AAAK2
> Email: [EMAIL PROTECTED]
> 
> Want reliable web hosting at affordable prices? www.modevia.com
>  
> Web Dev/Design Community/Zine
> www.developercube.com
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: PGPfreeware 7.0.3 for non-commercial use
> <http://www.pgp.com>  
> 
> iQA/AwUBPw4PI7rnDjSLw9ADEQLL5QCg6rxSs/roIiGyxC6nN3XNiuONg00AoK/T
> PSAAAbM+O7+e6iVNMMnpK5AC
> =phqJ
> -----END PGP SIGNATURE-----
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


- -- 
"If there's a World War III, World War IV will be fought with sticks
and 
stones."

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPw4S7rrnDjSLw9ADEQIQXACfYZfZ7CAp0q2tbwC0cpZQthcfS3wAn2XM
0vltmGXLCHmFaUFAx5paU8ya
=TYDm
-----END PGP SIGNATURE-----



--- End Message ---
--- Begin Message ---
is escaping a solution?
addslashes() for your insert-query
stripslashes() for your select-query

"Aaron Axelsen" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I have a php script set up for a user to upload a word document,
> which is then coverted to html form, which I would then lke to store
> in a database.
>
> Howver, when I run the following command:
>
> INSERT into sermons (data) VALUE ('$output');
>
> It failes to work, because the $output strings contains "", which
> messes things up.  Is there some way that this can be ignored while
> entering into the databse?
>
> Or am I better of replace all the "" with ''?
>
> Thanks for the assistance.
>
> - ---
> Aaron Axelsen
> AIM: AAAK2
> Email: [EMAIL PROTECTED]
>
> Want reliable web hosting at affordable prices?
> www.modevia.com
>
> Web Dev/Design Community/Zine
> www.developercube.com
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
>
> iQA/AwUBPw4PI7rnDjSLw9ADEQLL5QCg6rxSs/roIiGyxC6nN3XNiuONg00AoK/T
> PSAAAbM+O7+e6iVNMMnpK5AC
> =phqJ
> -----END PGP SIGNATURE-----
>
>



--- End Message ---
--- Begin Message ---
session_destroy()??

Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-----Original Message-----
From: Bruce Bruen [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 10, 2003 2:48 PM
To: [EMAIL PROTECTED]
Subject: Blatant newbie question - killing a session


Hi, this is my first question to the list and ... Yes I'm a newbie,
verrry wet behind the ears.

I am trying to set up a secured site under IIS.  I have done pretty well
by my standard to get to where I have.  Authoursed users can access the
site, unauthorised ones get sent elsewhere.  So, I am now up to testing
the various security combinations and its driving me mad that the
session persists when I'm testing bad logins.

How or where does one set up a "session extuinguisher"?  After one two
or n attempts I want to kill the entire session and start afresh - note
this is in testig only, the way it works now is great for live.

Tia
Bruce


--- End Message ---
--- Begin Message ---
Thanks,

That did the trick.  Nicely encapsualable too, so I can easily remove
it.

Regards
Bruce

-----Original Message-----
From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 10 July 2003 8:23 PM
To: Bruce Bruen
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Blatant newbie question - killing a session


You mean killing the session cookie?
setcookie (session_name(), "", time() - 3600);
session_unset(); // or $_SESSION = array();
session_destroy();

Bruce Bruen wrote:

> Hi, this is my first question to the list and ... Yes I'm a newbie, 
> verrry wet behind the ears.
> 
> I am trying to set up a secured site under IIS.  I have done pretty 
> well by my standard to get to where I have.  Authoursed users can 
> access the site, unauthorised ones get sent elsewhere.  So, I am now 
> up to testing the various security combinations and its driving me mad

> that the session persists when I'm testing bad logins.
> 
> How or where does one set up a "session extuinguisher"?  After one two

> or n attempts I want to kill the entire session and start afresh - 
> note this is in testig only, the way it works now is great for live.
> 
> Tia
> Bruce
> 
> 


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


--- End Message ---
--- Begin Message ---
I'm not sure about FreeBSD but on Redhat, the /etc/passwd 'IS' meant to be
world readable. But fortunately it's only stores usernames and Real names
and etc.. whereas /etc/shadow is only root readable and it's the file that
stores user's passwords.

I think that's pretty secure.

Why are you parsing through /etc/passwd anyway?

Anyway, I might have gotten your question wrongly or something. I still need
to figure out how to "JAIL" apache or 'ensure that you put files like
/etc/passwd OUTSIDE your web root.' That;s something which I've not know how
to do YET.

Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-----Original Message-----
From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED]
Sent: Friday, July 11, 2003 1:46 AM
To: Marek Kilimajer; Mantas Kriauciunas
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] download php


You should also store passwords in a non-readable to the world directory.  

-Dan

----- Original Message ----- 
From: "Marek Kilimajer" <[EMAIL PROTECTED]>
To: "Mantas Kriauciunas" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 5:01 AM
Subject: Re: [PHP] download php


> Do you use secure connection? Well, you should.
> 
> Mantas Kriauciunas wrote:
> 
> > Hello php-general,
> > 
> >   some hacker just tries his luck everyday to get me pissed, is it
> >   possible to make php files not downloadable? or coded? or something?
> >   because some dude knows my passwords every time, and with them
> >   passes the shity security to main user, thank god not root.
> > 
> >   So is there any way?
> > 
> >   if anyone knows any links or resources, please reply, i'll check
> >   them, i need to put this to end
> > 
> >   P.S system is freebsd.
> > 
> >   Thank you!!!
> > 
> >   there are even more and more kids that want to be named haker,
> >   lookin at their age, could be even my son:)
> > 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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

Friday, July 11, 2003, 4:30:41 AM, you wrote:
MG> Well I've made a signifigant improvement to this function, and it's now the
MG> parsing operation is only something like 26 lines.  It works flawlessly (so
MG> far) for XML that does not have repeat element names on the same level.
MG> Which seems to be bad form anyway, using similar element names and
MG> distinguishing them with attributes.

MG> I'd still like the code to work with XML that did have similarly named
MG> elements in the same node level.. can you see anything in my DOMXML calls
MG> that might indicate the problem?

I rearranged the way you did your parsing and came up with this:

function parseBranch($branch, &$doc, &$parent)
{
        static $elements = array();
        foreach ($branch as $key => $val) { 
                switch ($key) { 
                        // parent attributes 
                        case ('ATTRIBUTES'): 
                                foreach ($val as $attrName => $attrVal) {
                                        switch ($attrName){
                                                case 'VALUE':
                                                        $nodeValue  = 
$doc->create_text_node($attrVal);
                                                        $parentValue = 
$parent->append_child($nodeValue); 
                                                break;
                                                default:
                                                        
$parent->set_attribute($attrName, $attrVal);
                                                break;
                                        }
                                } 
                        break; 
                        // parent value 
                        case ('VALUE'): 
                                $nodeValue  = $doc->create_text_node($val); 
                                $parentValue = $parent->append_child($nodeValue); 
                        break; 
                        default: 
                                // add child element
                                if(!isset($elements[$key])){
                                        $elements[$key] = $doc->create_element($key);
                                }
                                // parse children of this node 
                                foreach ($val as $children) {
                                        //create node
                                        $child = 
$parent->append_child($elements[$key]->clone_node());
                                        //set its elements
                                        parseBranch($children, $doc, $child); 
                                } 
                        break; 
                } 
        } 
}

which gives

<?xml version="1.0"?>
<ROOTELEMENT ID="1">
  <RECORD ID="1">Value 1</RECORD>
  <RECORD ID="2">Value 2</RECORD>
</ROOTELEMENT>

-- 
regards,
Tom


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

Did some more tweaking and if we create a new element for each node
ther is no need to clone, saves a few lines of code :)

function parseBranch($branch, &$doc, &$parent)
{
        foreach ($branch as $key => $val) { 
                switch ($key) { 
                        // parent attributes 
                        case ('ATTRIBUTES'): 
                                foreach ($val as $attrName => $attrVal) {
                                        switch ($attrName){
                                                case 'VALUE':
                                                        $nodeValue  = 
$doc->create_text_node($attrVal);
                                                        $parentValue = 
$parent->append_child($nodeValue); 
                                                break;
                                                default:
                                                        
$parent->set_attribute($attrName, $attrVal);
                                                break;
                                        }
                                } 
                        break; 
                        // parent value 
                        case ('VALUE'): 
                                $nodeValue  = $doc->create_text_node($val); 
                                $parentValue = $parent->append_child($nodeValue); 
                        break; 
                        default: 
                                // parse children of this node 
                                foreach ($val as $children) {
                                        //create node
                                        $node = $doc->create_element($key);
                                        $child = $parent->append_child($node);
                                        //set is elements
                                        parseBranch($children, $doc, $child); 
                                } 
                        break; 
                } 
        } 
}





-- 
regards,
Tom


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

I encountered a problem that I have never seen in my 3 years of using php and mysql. Yesterday, I installed MySql, php5, and apache2 on my new laptop. php5 worked fine with apache2, and MySql was working fine on its own. But when I tried to connect to MySql database, I get a strange error message: "Fatal error: Call to undefined function: mysql_connect()". I thought this is very strange since mysql_connect() is a built-in function in php5. How can it be an undefined function? Does anyone know what is going on?

Thanks,

Zlutarch

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail



--- End Message ---
--- Begin Message ---
This has been discussed a lot on many of the PHP forums in the past few
weeks. Mysql is not longer bundled with PHP. You need to use the
configuration option and set the location of your mysql base directory.

Cheers,
Rob.

On Thu, 2003-07-10 at 21:30, zlut arch wrote:
> Hi,
> 
> I encountered a problem that I have never seen in my 3 years of using php 
> and mysql. Yesterday, I installed MySql, php5, and apache2 on my new laptop. 
> php5 worked fine with apache2, and MySql was working fine on its own. But 
> when I tried to connect to MySql database, I get a strange error message: 
> "Fatal error: Call to undefined function: mysql_connect()". I thought this 
> is very strange since mysql_connect() is a built-in function in php5. How 
> can it be an undefined function? Does anyone know what is going on?
> 
> Thanks,
> 
> Zlutarch
> 
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.  
> http://join.msn.com/?page=features/featuredemail
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org   |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.    |
`---------------------------------------------'

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

Thursday, July 10, 2003, 6:59:25 AM, you wrote:

>>>  So how to make sure that no one can access other people files and
>>>  server files? and is there any way that nobody would be able to
>>>  download php files or how to make them look like code when they are
>>>  downloaded. Thanks!

WB> I think he means "How do I keep people who have access to upload their
WB> OWN php scripts to my server from accessing files outside their
WB> directory?"  :)

WB> Check out the following:

>> http://www.php.net/manual/en/features.safe-mode.php#ini.open-basedir

>> http://www.php.net/manual/en/security.php
>> http://www.php.net/manual/en/features.safe-mode.php#ini.safe-mode




Thanks a lot! that helped :)

-- 
Best regards,
 Mantas                            mailto:[EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Fejes Jozsef [mailto:[EMAIL PROTECTED]
> Sent: 10 July 2003 12:33
> 
> My method is:
> 1. check if id starts with /
> if(ereg("^\/", $id))
>   goaway;

That's a rather expensive (and slightly obscure) way of performing that check. Try:

  if ($id{0}=='/')
    goaway;


> 2. check if there is .. in it
> if(ereg("\.\.", $id))
>   goaway;

Likewise:

  if (strpos($id, '..')!==FALSE)
    goaway;

Cheers!

Mike

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

--- End Message ---
--- Begin Message ---
I did my research.  We'll, searched the net anyway without a solution.  I am
getting the error:

Fatal error: PDFlib error: function 'PDF_set_info' must not be called in
'object' scope in
c:\inetpub\wwwroot\webpage10\example\utilities\pdf_maker\act_p_makePDF.php
on line 4

I read that this is because file write permissions are not set on the
directory where the file is to be written, so I set write permissions and
still the exact same thing. I even set write permissions for the whole
directory and restarted IIS with the same results.  Now when I use the exact
same script in a completely different directory on the webserver, it creates
the PDF just fine.  The permissions are the same, just a different
directory.  Here is the PDF script I'm testing out:

<?php
$pdf = pdf_new();
pdf_open_file($pdf, "test.pdf");
pdf_set_info($pdf, "Author", "Uwe Steinmann");  //line 4
pdf_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0");
pdf_set_info($pdf, "Creator", "See Author");
pdf_set_info($pdf, "Subject", "Testing");
pdf_begin_page($pdf, 595, 842);
pdf_add_outline($pdf, "Page 5");
$font = pdf_findfont($pdf, "Times New Roman", "winansi", 1);
pdf_setfont($pdf, $font, 10);
pdf_set_value($pdf, "textrendering", 1);
pdf_show_xy($pdf, "Times Roman outlined", 50, 750);
pdf_moveto($pdf, 50, 740);
pdf_lineto($pdf, 530, 740);
pdf_stroke($pdf);
pdf_end_page($pdf);
pdf_close($pdf);
pdf_delete($pdf);
echo "<A HREF=getitem.php>finished</A>";
?>

Anyone encounter such a thing and have a possible solution for this?

thanks



--- End Message ---
--- Begin Message ---
Never mind.  I found the error.

thanks

"Micah Montoy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I did my research.  We'll, searched the net anyway without a solution.  I
am
> getting the error:
>
> Fatal error: PDFlib error: function 'PDF_set_info' must not be called in
> 'object' scope in
> c:\inetpub\wwwroot\webpage10\example\utilities\pdf_maker\act_p_makePDF.php
> on line 4
>
> I read that this is because file write permissions are not set on the
> directory where the file is to be written, so I set write permissions and
> still the exact same thing. I even set write permissions for the whole
> directory and restarted IIS with the same results.  Now when I use the
exact
> same script in a completely different directory on the webserver, it
creates
> the PDF just fine.  The permissions are the same, just a different
> directory.  Here is the PDF script I'm testing out:
>
> <?php
> $pdf = pdf_new();
> pdf_open_file($pdf, "test.pdf");
> pdf_set_info($pdf, "Author", "Uwe Steinmann");  //line 4
> pdf_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0");
> pdf_set_info($pdf, "Creator", "See Author");
> pdf_set_info($pdf, "Subject", "Testing");
> pdf_begin_page($pdf, 595, 842);
> pdf_add_outline($pdf, "Page 5");
> $font = pdf_findfont($pdf, "Times New Roman", "winansi", 1);
> pdf_setfont($pdf, $font, 10);
> pdf_set_value($pdf, "textrendering", 1);
> pdf_show_xy($pdf, "Times Roman outlined", 50, 750);
> pdf_moveto($pdf, 50, 740);
> pdf_lineto($pdf, 530, 740);
> pdf_stroke($pdf);
> pdf_end_page($pdf);
> pdf_close($pdf);
> pdf_delete($pdf);
> echo "<A HREF=getitem.php>finished</A>";
> ?>
>
> Anyone encounter such a thing and have a possible solution for this?
>
> thanks
>
>



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

Friday, July 11, 2003, 4:27:13 AM, you wrote:
JM> Hi all,
JM> Does anyone know of any free Excel parsing non-COM code available on the
JM> net? Just straight php driven?

JM> I've found a couple commercial solutions but would like to try this myself
JM> or save money. Thanks for any help.

JM> Johnny

I have started an exel reader class that outputs a table and a style
sheet that may help get you started. still needs quite a bit of work
but the basics are there. Let me know and I'll email you the files.

-- 
regards,
Tom


--- End Message ---
--- Begin Message ---
foreach ($profileArray[$i][attributes] as $key => $val) {
     $singleProfileHTML .= $key . "=\"" . str_replace("'", '&#039;', str_replace('"', 
'&quot;', $val)) . "\"\n";
    }

The parsing error occurs in the "$singleProfileHTML.." line.  I'm completely don't get 
it; I see absolutely nothing wrong with this, what did I miss?

Phil

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

On Thu, 2003-07-10 at 21:53, Phil Powell wrote:
> foreach ($profileArray[$i][attributes] as $key => $val) {
                             ^^^^^^^^^^
You should quote the word 'attributes':

http://www.php.net/manual/en/language.types.array.php#language.types.array.donts

Sorry...that link might wrap. Anyway, I doubt that's the problem...

>      $singleProfileHTML .= $key . "=\"" . str_replace("'", '&#039;', 
> str_replace('"', '&quot;', $val)) . "\"\n";
>     }

No idea. All I did was copy-paste your code and add a test definition
for the other vars, and I just got this:

[Script]
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('html_errors', true);

$profileArray = 
array('1' => 
      array('attributes' =>
            array('height' => '"168" cm',
                  'weight' => '\'65\' kg')));

$singleProfileHTML = '';
$i = 1;

foreach ($profileArray[$i][attributes] as $key => $val) {
    $singleProfileHTML .= $key . "=\"" . str_replace("'", '&#039;',
str_replace('"', '&quot;', $val)) . "\"\n";
}

print_r($singleProfileHTML);
?>

[Output]
Notice:  Use of undefined constant attributes - assumed 'attributes' in 
/home/torben/public_html/phptest/__phplist.html on line 36

height=""168" cm"
weight="'65' kg"

> The parsing error occurs in the "$singleProfileHTML.." line.  I'm
>  completely don't get it; I see absolutely nothing wrong with this,
>  what did I miss?
>
> Phil

I don't see anything wrong. Perhaps you have a non-printable control
character embedded in your code? Try copy-pasting the above code (but
quote that array key) and see if that helps. Also, check the code
before that line for unclosed quotes and braces/parens or other
problems; some parse errors can show up far from where they actually
occurred.

Other than that, without knowing anything else, it's hard to say off the
top of my head.


-- 
 Torben Wilson <[EMAIL PROTECTED]>                        +1.604.709.0506
 http://www.thebuttlesschaps.com          http://www.inflatableeye.com
 http://www.hybrid17.com                  http://www.themainonmain.com
 -----==== Boycott Starbucks!  http://www.haidabuckscafe.com ====-----




--- End Message ---
--- Begin Message ---
On Fri, 11 Jul 2003 00:53:32 -0400, you wrote:

>foreach ($profileArray[$i][attributes] as $key => $val) {
>     $singleProfileHTML .= $key . "=\"" . str_replace("'", '&#039;', str_replace('"', 
> '&quot;', $val)) . "\"\n";
>    }
>
>The parsing error occurs in the "$singleProfileHTML.." line.  I'm completely don't 
>get it; I see absolutely nothing wrong with this, what did I miss?

Line 1 - attributes should have a $ in front of it, or be a string literal.

BTW, that's a really nasty line. Maybe it would be easier to read as :

foreach ($profileArray[$i][$attributes] as $key => $val) {
        $val = str_replace('"', '&quot;', $val);
        $val = str_replace("'", '&#039;', $val);
        $singleProfileHTML .= "$key=\"$val\"\n";
}


--- End Message ---
--- Begin Message ---
Thanx I got it to work, however, I have no idea why it works now considering
I did nothing different:

$singleProfileHTML .= "<!--\n";
     foreach ($profileArray[$i][attributes] as $key => $val) {
      $singleProfileHTML .= strtolower($key) . '="' . str_replace("'",
'&#039;', str_replace('"', '&quot;', stripslashes($val))) . "\"\n";
     }
     $singleProfileHTML .= "-->\n";

Beats the heck out of me!

Phil
----- Original Message -----
From: "David Otton" <[EMAIL PROTECTED]>
To: "Phil Powell" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, July 11, 2003 2:48 AM
Subject: Re: [PHP] What did I do wrong to cause a parse error?


> On Fri, 11 Jul 2003 00:53:32 -0400, you wrote:
>
> >foreach ($profileArray[$i][attributes] as $key => $val) {
> >     $singleProfileHTML .= $key . "=\"" . str_replace("'", '&#039;',
str_replace('"', '&quot;', $val)) . "\"\n";
> >    }
> >
> >The parsing error occurs in the "$singleProfileHTML.." line.  I'm
completely don't get it; I see absolutely nothing wrong with this, what did
I miss?
>
> Line 1 - attributes should have a $ in front of it, or be a string
literal.
>
> BTW, that's a really nasty line. Maybe it would be easier to read as :
>
> foreach ($profileArray[$i][$attributes] as $key => $val) {
> $val = str_replace('"', '&quot;', $val);
> $val = str_replace("'", '&#039;', $val);
> $singleProfileHTML .= "$key=\"$val\"\n";
> }
>


--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Phil Powell [mailto:[EMAIL PROTECTED]
> Sent: 11 July 2003 05:54
> 
> foreach ($profileArray[$i][attributes] as $key => $val) {
>      $singleProfileHTML .= $key . "=\"" . str_replace("'", 
> '&#039;', str_replace('"', '&quot;', $val)) . "\"\n";
>     }
> 
> The parsing error occurs in the "$singleProfileHTML.." line.  
> I'm completely don't get it; I see absolutely nothing wrong 
> with this, what did I miss?

Well, I can see nothing wrong with that line, so I can't help there.  I do,
however, wonder why you aren't using htmlentities() instead of those two
ugle str_replace()s.  And I hope you have a constant defined called
attributes, otherwise that array index must be either quoted (e.g.
'attributes'), or $attributes.

Cheers!

Mike

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

--- End Message ---
--- Begin Message ---
Okay, curious if there is an easier way to do this... here is what I do
 
<?php
 $ZipCode = $_POST['zip'];
 $Distance = $_POST['distance'];
?>
 
can't I just dump these into an array and and assign it to a variable...
maybe that doesn't make sense... basically I just want to have one
command that retrives all the "POST" variables... then list my variables
ie $ZipCode, $Distance, $Blah - have them dump in to each!!!
 
thanks
 
Joe Harman

http://www.HarmanMedia.com

You will never be happy if you continue to search for what happiness
consists of. You will never live if you are looking for the meaning of
life. - Albert Camus 
 

--- End Message ---
--- Begin Message ---
On Friday 11 July 2003 13:01, Joe Harman wrote:
> Okay, curious if there is an easier way to do this... here is what I do
>
> <?php
>  $ZipCode = $_POST['zip'];
>  $Distance = $_POST['distance'];
> ?>
>
> can't I just dump these into an array and and assign it to a variable...
> maybe that doesn't make sense... basically I just want to have one
> command that retrives all the "POST" variables... then list my variables
> ie $ZipCode, $Distance, $Blah - have them dump in to each!!!

extract()

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I THINK THEY SHOULD CONTINUE the policy of not giving a Nobel Prize for
paneling.
                -- Jack Handley, The New Mexican, 1988.
*/


--- End Message ---
--- Begin Message ---
Ah... Jason.... Man Of Few Words! THANKs... You have saved me time and
lines in my code :-)

Cheers!
Joe

-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 11, 2003 1:13 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] dump $_POST into variables????


On Friday 11 July 2003 13:01, Joe Harman wrote:
> Okay, curious if there is an easier way to do this... here is what I 
> do
>
> <?php
>  $ZipCode = $_POST['zip'];
>  $Distance = $_POST['distance'];
> ?>
>
> can't I just dump these into an array and and assign it to a 
> variable... maybe that doesn't make sense... basically I just want to 
> have one command that retrives all the "POST" variables... then list 
> my variables ie $ZipCode, $Distance, $Blah - have them dump in to 
> each!!!

extract()

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I THINK THEY SHOULD CONTINUE the policy of not giving a Nobel Prize for
paneling.
                -- Jack Handley, The New Mexican, 1988.
*/


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




--- End Message ---
--- Begin Message ---
Just wondering if there's a clear screen function in PHP like the clrscr()
in 'C'.

Thanks



--- End Message ---
--- Begin Message ---
hmm...
and... what would you do with a clear screen function on a web page with php
?

I can't see how it could work.. :)

PHP is server side, so you can't clear the user screen like with C or other
language ...

Regards,

P.E. Baroiller

"Artoo" <[EMAIL PROTECTED]> a écrit dans le message de
news:[EMAIL PROTECTED]
> Just wondering if there's a clear screen function in PHP like the clrscr()
> in 'C'.
>
> Thanks
>
>



--- End Message ---
--- Begin Message ---
On Thursday, July 10, 2003, 9:25:31 PM, Taylor wrote:

TY> First,
TY> I need the code to replace the link in a string, like

TY> <BASE HREF="www.google.com"> with <BASE HREF="mystring">

TY> ereg_replace("'<BASE HREF=\"'(.*)'\">'", "'<BASE HREF=\"$my_string\">'",
TY> $old);

TY> That was the closest i got, but (.*) makes it take the first BASE HREF, and
the last ">>, which sucks.
TY> Can anyone help?

I'm not a regex guru by any means, but I think your problem here is
that your expression is "greedy". Try (.?) ... I think.

TY> Second,
TY> I hate asking for help on Regexps...I would like a tutorial online that
TY> steps me through one method of them at a time, and then lets me move
TY> on...kindof like math. You have to know the basics befor you can get
TY> advanced.  Any help there either?

I have found that the best people to ask for regex questions are PERL
programmers. They seem to have the insider knowledge on this stuff.

There are a few online tutorials that I've seen, but none that I could
recommend with any confidence. They are simply "this expression does
this, and put it together ... wow it works! Regexs are great!"

There is a #perl channel on freenode (IRC) that I have found to be
extremely helpful in this regard.

If you do find any good tutorials, I would appreciate an offline.


-- 
Regards,
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com


--- End Message ---
--- Begin Message ---
> 
> Writing and moving require the same permissions. Also, there is a big
> difference between root and webroot. Which one are you talking about?

Web root.
Sorry not the root directory of the server but the webroot. 1 directory
back in fact is all I need so the structure would be:

Web> Cms> generator.php
Web> generated.php

So I can protect the CMS directory which currently needs to be chmod 777
in order to write the page (at least that was the only way I could get
the write function to work) and then just have the written files drop
back into the web root so that if someone typed:

http://www.mysite.com/generated.php

They would get the page.

Not (as I can currently do) http://www.mysite.com/cms/generated.php

Thanks.


Steve Jackson
Web Development and Marketing Manager
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159


--- End Message ---
--- Begin Message ---
On Friday 11 July 2003 15:20, Steve Jackson wrote:
> > Writing and moving require the same permissions. Also, there is a big
> > difference between root and webroot. Which one are you talking about?
>
> Web root.
> Sorry not the root directory of the server but the webroot. 1 directory
> back in fact is all I need so the structure would be:
>
> Web> Cms> generator.php
> Web> generated.php
>
> So I can protect the CMS directory which currently needs to be chmod 777
> in order to write the page (at least that was the only way I could get
> the write function to work) and then just have the written files drop
> back into the web root so that if someone typed:
>
> http://www.mysite.com/generated.php
>
> They would get the page.
>
> Not (as I can currently do) http://www.mysite.com/cms/generated.php

You can use php's ftp functions to write the file into your webroot directory.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
One enemy soldier is never enough, but two is entirely too many
                -- Murphy's Military Laws n68
*/


--- End Message ---
--- Begin Message ---
Interesting.

Do I need to open an FTP connection do you think or use wrappers?

I tried this: 
// Define the filename to write to.
$filename = 'test.txt';
// Open the file for overwriting.
$fp = fopen($filename, "w");
// Write the string to the file
$write = fputs($fp, $string);
// Close the file
fclose($fp);
// rename the filename in the root directory to the pagename
rename($filename, "$pagename.php");
$url = "172.16.2.4/~stephenj/misc/webpage";
$final_url = "ftp://$url/$pagename.php";;
$fp2 = fopen("ftp://$url/cms/$pagename.php";, "r"); <<<< Line 59.
$move = fputs($fp2, $final_url);
fclose($fp2);
// end of function.

and get a really odd error:
Warning:
fopen("ftp://172.16.2.4/~stephenj/misc/webpage/cms/this_wont_work.php",";
r") - Inappropriate ioctl for device on line 59  

Any ideas people?

Steve Jackson
Web Development and Marketing Manager
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159





> -----Original Message-----
> From: Jason Wong [mailto:[EMAIL PROTECTED] 
> Sent: 11. heinäkuuta 2003 11:47
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Please assist - been on this for hours - 
> Permissions onserver
> 
> 
> On Friday 11 July 2003 15:20, Steve Jackson wrote:
> > > Writing and moving require the same permissions. Also, there is a 
> > > big difference between root and webroot. Which one are 
> you talking 
> > > about?
> >
> > Web root.
> > Sorry not the root directory of the server but the webroot. 1 
> > directory back in fact is all I need so the structure would be:
> >
> > Web> Cms> generator.php
> > Web> generated.php
> >
> > So I can protect the CMS directory which currently needs to 
> be chmod 
> > 777 in order to write the page (at least that was the only 
> way I could 
> > get the write function to work) and then just have the 
> written files 
> > drop back into the web root so that if someone typed:
> >
> > http://www.mysite.com/generated.php
> >
> > They would get the page.
> >
> > Not (as I can currently do) http://www.mysite.com/cms/generated.php
> 
> You can use php's ftp functions to write the file into your 
> webroot directory.
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications 
> Development *
> ------------------------------------------
> Search the list archives before you post 
> http://marc.theaimsgroup.com/?l=php-general
> 
> ------------------------------------------
> /*
> One enemy soldier is never enough, but two is entirely too many
>               -- Murphy's Military Laws n68
> */
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message --- Write the file with ftp right away:

// Define the filename to write to.
$filename = 'ftp://username:[EMAIL PROTECTED]/your_webdir/test.txt';
// Open the file for overwriting.
$fp = fopen($filename, "w");
// Write the string to the file
$write = fputs($fp, $string);
// Close the file
fclose($fp);



--- End Message ---
--- Begin Message ---
Same error.
Warning: fopen("ftp://[EMAIL PROTECTED]/misc/webpage/cms/test.txt","w") -
Inappropriate ioctl for device in
/home/stephenj/public_html/misc/webpage/cms/generator.php on line 51

Think this is going to get too complicated for a user interface as well
so I might have to abandon this idea. I think I'll just try uploading a
template file with it's unique ID rather than writing one directly to
the server. I don't want to have to have users put their ftp username
and password into the CMS for it to work.

Unless you think I am not far from success with this method? All I
wanted was for a file to be written into a safe directory and then moved
automatically to the webroot.

Steve Jackson
Web Development and Marketing Manager
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159





> -----Original Message-----
> From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
> Sent: 11. heinäkuuta 2003 13:32
> To: Steve Jackson
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Please assist - been on this for hours - 
> Permissions onserver
> 
> 
> Write the file with ftp right away:
> 
> // Define the filename to write to.
> $filename = 'ftp://username:[EMAIL PROTECTED]/your_webdir/test.txt';
> // Open the file for overwriting.
> $fp = fopen($filename, "w");
> // Write the string to the file
> $write = fputs($fp, $string);
> // Close the file
> fclose($fp);
> 
> 


--- End Message ---
--- Begin Message ---
Okay Ladies and gents... I am sure I am not the only one who doesn't
take advantage of arrays like they should be... would some be so kind as
to explain them... you kow I can read the manual and all... but to tell
you the truth.. it's a little confusing... maybe some of you have some
good ways to explain it to a right brainer like myself
 
Joe Harman

http://www.HarmanMedia.com

You will never be happy if you continue to search for what happiness
consists of. You will never live if you are looking for the meaning of
life. - Albert Camus 
 

--- End Message ---
--- Begin Message ---
Joe,

JH> Okay Ladies and gents... I am sure I am not the only one who doesn't
JH> take advantage of arrays like they should be... would some be so kind as
JH> to explain them...

You won't get much joy from this list with this kind of question - it
is simply too general for anyone to answer. You have to help us to
help you. What precisely do you find confusing?

If you find the manual confusing (and it does tend to assume some
knowledge) you might benefit from reading one of the many books aimed
at introducing PHP to people new to programming. I personally like
Teach Yourself PHP4 in 24 hours by Zandstra (Sams Publishing). This is
a short, affordable book that explains the basic concepts pretty
clearly.

PHP is an easy language to learn, but you can't expect it to be
painless, any more than learning, say, French would be painless. The
more effort you put in, the more the language will reward you...

Geoff Caplan
Advantae


--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Kevin Stone [mailto:[EMAIL PROTECTED]
> Sent: 09 July 2003 20:30
> 
> ----- Original Message -----
> From: "ulf sundin" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 09, 2003 1:00 PM
> Subject: Re: [PHP] session data missing
> 
> 
> > ok, so now the variable names are registred and stored in 
> the file. But
> > without values.
> > check this:
> >
> > --firstpage.php----
> > session_start()
> > session_register('foo');
> > $HTTP_SESSION_VARS['foo'] = 'bar';
> > echo $HTTP_SESSION_VARS['foo']; //outputs bar;
> >
> > transport by a href to:
> > ----secondpage.php----
> > session_start();
> > echo $HTTP_SESSION_VARS['foo']; //outputs nothing
> >
> > ---
> > checking the contents of the file called /tmp/sess_{session_id}:
> >  !foo|
> (snip)
> 
> 
> Make a choice here..
> 
> => session_register('foo');
> => $HTTP_SESSION_VARS['foo'] = 'bar';
> 
> Use either the session_register() function or the session 
> global array.  Not
> both.

Not true -- $HTTP_SESSION_VARS is *not* like $_SESSION, and its values are *not* 
auto-registered.  In fact, I still have my copy of the 4.0.6 manual around, and it 
specifically gives this as an example:

> Example 1. Registering a variable 
> 
> <?php
> session_register("count");
> $HTTP_SESSION_VARS["count"]++;
> ?>

However, it's a little unclear on whether this should still work regardless of the 
register_globals setting, as it also gives this as an example:

> Example 2. Registering a variable with register_globals enabled 
> 
> <?php
> session_register("count");
> $count++;
> ?>

I guess I'd have to go away and try it to be sure of what behaviour occurs for each 
setting of register_globals -- but there seems little point given that using $_SESSION 
has been much the best option for several versions now!

Cheers!

Mike

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

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

I wonder if any of you can help with this....

I'm using sockets in php to connect my script to an outside system. More
often than not this works fine, but every so often, say twice a day, it
brings down my whole web server.

When this has happened all the sites im serving can take up to 5 minutes to
be displayed in your browser, if I look in the web logs their have been no
accesses for a couple of minutes which is not usual and if I look in
performance monitor in Win2k there is a flat line for Web Server bytes sent,
NIC bytes sent and File Read Bytes/sec.

Can anyone explain why this connect to sockets can bring down the whole
server? Is it not possible to have the function work in isolation rather
than having a knock on effect on everything else?

Also in the Win2k system event viewer I get the error:

"The script started from the URL '/myscript/index.php' with parameters ''
has not responded within the configured timeout period. The HTTP server is
terminating the script."

Any help anyone please? I'm going mad here!

Thanks,
Chris



--- End Message ---
--- Begin Message ---
> "The script started from the URL '/myscript/index.php' with parameters ''
> has not responded within the configured timeout period. The HTTP server is
> terminating the script."

maybe the problem is not with the sockets but you have an endless loop bug?
do you have an up-to-date version of php? i can't imagine a single connect
slowing down an entire server




--- End Message ---
--- Begin Message --- Anyone know of a class or function that converts numbers to readable text

eg inputing the number would output text as in

120 = one hundred and twenty
3600 = three thousand six hundred


tia


pete


--- End Message ---
--- Begin Message ---
> Anyone know of a class or function that converts numbers to readable text

Oh how old... coud you just not even be bothered with Google or any other
search engine?

To save you the trouble:
http://www.phpclasses.org/browse.html/package/754.html



--- End Message ---
--- Begin Message ---
>?> just not even be bothered with Google
I did but didnt find any

Thanks ;-)

pete



Brian McGarvie wrote:
Anyone know of a class or function that converts numbers to readable text


Oh how old... coud you just not even be bothered with Google or any other
search engine?

To save you the trouble:
http://www.phpclasses.org/browse.html/package/754.html




--- End Message ---

Reply via email to