php-general Digest 25 Oct 2002 16:40:19 -0000 Issue 1665

Topics (messages 121385 through 121443):

Sessions help Please
        121385 by: Bryan McLemore
        121387 by: Peter Houchin
        121389 by: Justin French

Re: How many is too many?
        121386 by: Justin French
        121388 by: Leif K-Brooks
        121393 by: Monty
        121396 by: Marek Kilimajer

Re: Adding Content Management to live site
        121390 by: Tariq Murtaza

using curl to get part of the html
        121391 by: Patrick Hsieh
        121417 by: Marek Kilimajer

Re: extract($_POST)
        121392 by: Monty
        121424 by: Rick Emery
        121425 by: Chris Boget
        121426 by: Rick Emery
        121437 by: Johnson, Kirk

Trasformazione XSLT
        121394 by: Agnoletto Christian

Re: ideas for articles?
        121395 by: Marek Kilimajer

sessions
        121397 by: Shaun
        121398 by: Jon Haworth

Adding to cart function.
        121399 by: Steve Jackson
        121401 by: Justin French

Re: processing form checkboxes
        121400 by: Marek Kilimajer

Register Globals Off in .htacces
        121402 by: Tjoumaidis
        121404 by: Jon Haworth
        121405 by: Tjoumaidis
        121406 by: Jon Haworth
        121413 by: Alister
        121427 by: Frank W.
        121428 by: Jon Haworth
        121429 by: Frank W.

session_start... twice?
        121403 by: James Taylor
        121408 by: Marek Kilimajer

Mail form
        121407 by: Trasca Ion-Catalin
        121418 by: Marek Kilimajer
        121419 by: Trasca Ion-Catalin
        121421 by: Robert Samuel White

Re: mkdir and directory permissions
        121409 by: Jason Wong
        121411 by: Marek Kilimajer

Looking for an open source PHP editor on linux
        121410 by: Tariq Murtaza
        121412 by: Clint Tredway
        121415 by: Tariq Murtaza
        121416 by: Frank W.
        121422 by: John Nichel
        121423 by: Maxim Maletsky
        121434 by: Brad Pauly

Re: the xml functions [worth a read]
        121414 by: Robert Samuel White

PHP with FTP support on a Raq4 Server
        121420 by: Chris Morrow

Ereg help
        121430 by: William Glenn
        121431 by: Erwin
        121435 by: Rick Emery

writing pdf files to physical files...
        121432 by: Brian McGarvie
        121442 by: Brian McGarvie

Re: Quick way to test series of integers
        121433 by: Hugh Bothwell

Re: An interesting one!!!
        121436 by: Hugh Bothwell

Problem with set_time_limit() and uploading large files
        121438 by: derek fong

cutted values after posting multiple select list
        121439 by: Heiko Mundle
        121440 by: Rick Emery

DomDocument->dump_file  don't work!
        121441 by: Magnus Stålberg

php and databases
        121443 by: Tyler Durdin

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 ---
Hi guys I'm a little confused on how sessions work.  ok I  use session_start(); to get 
started I know that but then the manual starts to confuse me with all of the garbled 
text about passing the SID.  How do I tell if it was compiled with transparent SID 
passing?  

Also I'm not sure how to use cookies and this is just a small application for private 
use so I don't mind passing it using urls for this iteration of the project.  

Also I'm not quite sure how to auctually perserve the variables across pages.

Thanks,
Bryan

--- End Message ---
--- Begin Message ---
have a look on phpbeginner there is a couple of articles/tutorials that
explain this also look at previous posts :)

> -----Original Message-----
> From: Bryan McLemore [mailto:Kaelten@;worldnet.att.net]
> Sent: Friday, 25 October 2002 6:39 AM
> To: PHP - General
> Subject: [PHP] Sessions help Please
>
>
> Hi guys I'm a little confused on how sessions work.  ok I  use
> session_start(); to get started I know that but then the manual
> starts to confuse me with all of the garbled text about passing
> the SID.  How do I tell if it was compiled with transparent SID passing?
>
> Also I'm not sure how to use cookies and this is just a small
> application for private use so I don't mind passing it using urls
> for this iteration of the project.
>
> Also I'm not quite sure how to auctually perserve the variables
> across pages.
>
> Thanks,
> Bryan
>
>

--- End Message ---
--- Begin Message ---
on 25/10/02 6:38 AM, Bryan McLemore ([EMAIL PROTECTED]) wrote:

> Hi guys I'm a little confused on how sessions work.  ok I  use
> session_start(); to get started I know that but then the manual starts to
> confuse me with all of the garbled text about passing the SID.  How do I tell
> if it was compiled with transparent SID passing?

make a <? phpinfo() ?> file -- it will explain what PHP was compiled with up
the top-ish.


> Also I'm not sure how to use cookies and this is just a small application for
> private use so I don't mind passing it using urls for this iteration of the
> project.  

By default, sessions will work with cookies (at least every install i've
seen)... you don't need to do anything special to get it working.  *IF* you
are worried about people without cookies not being able to maintain the
session, *THEN* passing the SID around in URLs would be the next step.  You
can do this manually (a lot of work), or...

*IF* enable_trans_sid() was compiled (or if you can comile with it), this is
the best option, because everything happens transparently... IF the user
allows cookies, PHP will use them... if not, PHP will re-write your URLs
with the SID in them.

Easy.



> Also I'm not quite sure how to auctually perserve the variables across pages.

Assuming PHP >= 4.1.1 with register globals OFF, and cookies ALLOWED by your
browser OR trans_sid compiled:

page 1:

<?
// maintain or start session
   session_start();
// assign a few variables to it
   $_SESSION['favcolor'] = "#FFCC99";
   $_SESSION['name'] = "Justin";
?>
<HTML>
   <BODY>
      <A HREF="page2.php">click here to see page 2</a>
   </BODY>
</HTML>


page 2:

<?
// maintain or start session
session_start();
?>
<HTML>
   <BODY bgcolor="<?=$_SESSION['favcolor']?>">
      Hi <?=$_SESSION['name']?>, hopefully this session carried forward.<BR>
      <A HREF="page3.php">click here to see it carried to page 3</a>
   </BODY>
</HTML>


page 3:

<?
// maintain or start session
session_start();
?>
<HTML>
   <BODY bgcolor="<?=$_SESSION['favcolor']?>">
      Hi <?=$_SESSION['name']?>, hopefully this session carried forward to
the third page.
   </BODY>
</HTML>


Good luck,


Justin French

--- End Message ---
--- Begin Message ---
I read in here once or twice that it's worth worrying about at the 1000's
mark, not 100's.

However, hashing them into years (/2002/), or categories (/sports/), or
alphabetically (/a/, /b/, /c/), or by author might prove beneficial froma
content management point of view.  Then logical end choice you make will
depend on your site, and how people use it.

For the amount of articles you're talking about, you'd definitely only need
one level of hashing.


Justin


on 25/10/02 2:40 PM, Monty ([EMAIL PROTECTED]) wrote:

> This is a more general server question: I know that having a large number of
> files in one folder can slow down a web server, but, how many would it take
> for this to be a problem? Wondering if I should store all articles for a
> content site in one big 'articles' folder with each article having it's own
> folder within (/articles/article_id/), or if I should organize them by year
> then article name (/articles/2002/article_id). The site will only produce a
> few hundred articles a year. I'd like the keep the file structure shallow
> and simple if possible, but, if it could potentially slow the server down by
> putting so many folder in one I'll split them up more.
> 
> Thanks!
> 

--- End Message ---
--- Begin Message ---
Why not store them in a database with one php script selecting them?

Monty wrote:

This is a more general server question: I know that having a large number of
files in one folder can slow down a web server, but, how many would it take
for this to be a problem? Wondering if I should store all articles for a
content site in one big 'articles' folder with each article having it's own
folder within (/articles/article_id/), or if I should organize them by year
then article name (/articles/2002/article_id). The site will only produce a
few hundred articles a year. I'd like the keep the file structure shallow
and simple if possible, but, if it could potentially slow the server down by
putting so many folder in one I'll split them up more.

Thanks!



--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



--- End Message ---
--- Begin Message ---
I'm storing the article text and details in a database, but, all the assets
(these articles have lots of photos) need to be organized into folders. So
logically I want to create a folder for each article using the article ID
number. But I want to be sure if I have within the Article folder about 700
other folders that contain all the assets for every article that that won't
slow down the server. This site will not be visited by millions necessarily,
but, I still want to be sure I'm setting up the file system as efficiently
as possible.

Thanks!

> From: [EMAIL PROTECTED] (Leif K-Brooks)
> Newsgroups: php.general
> Date: Fri, 25 Oct 2002 00:55:48 -0400
> To: Monty <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] How many is too many?
> 
> Why not store them in a database with one php script selecting them?
> 
> Monty wrote:
> 
>> This is a more general server question: I know that having a large number of
>> files in one folder can slow down a web server, but, how many would it take
>> for this to be a problem? Wondering if I should store all articles for a
>> content site in one big 'articles' folder with each article having it's own
>> folder within (/articles/article_id/), or if I should organize them by year
>> then article name (/articles/2002/article_id). The site will only produce a
>> few hundred articles a year. I'd like the keep the file structure shallow
>> and simple if possible, but, if it could potentially slow the server down by
>> putting so many folder in one I'll split them up more.
>> 
>> Thanks!
>> 

--- End Message ---
--- Begin Message --- This depends on the filesystem used, but I would recomend you to organized them by year. Now you
have few hundred articles, two or three years later it might be 1000, and reorganize it then would be
much harder then to create the directories now.

Monty wrote:

This is a more general server question: I know that having a large number of
files in one folder can slow down a web server, but, how many would it take
for this to be a problem? Wondering if I should store all articles for a
content site in one big 'articles' folder with each article having it's own
folder within (/articles/article_id/), or if I should organize them by year
then article name (/articles/2002/article_id). The site will only produce a
few hundred articles a year. I'd like the keep the file structure shallow
and simple if possible, but, if it could potentially slow the server down by
putting so many folder in one I'll split them up more.

Thanks!




--- End Message ---
--- Begin Message ---
Hi olinux

I wonder how to do that :)
i mean converting static pages to database driven web site.
looking for your comments & sugessions / code

Tariq

olinux wrote:
Depending on the size and current format, you may want
to import everything into the CMS. Might work well for
searching etc.

I recently converted our companies static website
(11,000 pages - we're a magazine publisher) to a mysql
database. Tough work, but not as gruelling as it
sounds. I wrote a script to parse thru the static html
files and grab the title article and date. Also made
use of the naming conventions to construct the date. A
couple days work to get something that worked
accurately for the different article formats but well
worth it.

Putting together index page and archives pages is
pretty much cake work. A simple query will grab todays
news, the past week, a month from 2000 or whatever.

You can email me if you'd like some code pieces.

olinux


--- Maxim Maletsky <[EMAIL PROTECTED]> wrote:

You could leave the site links the way they are by
working out a good
logic within apache's mod_rewtire routine. So,
basically you would
install CMS for the site and forward there the whole
site's used links
accordingly.

It's the most elegant solution, but not the easiest
to accomplish. I
have done that once for a site with over 600Mb of
static pages. It was a
site for the printed magazine.


--
Maxim Maletsky
[EMAIL PROTECTED]


www.PHPBeginner.com  // PHP for Beginners
www.maxim.cx         // my Home

// my Wish List:     ( Get me something! )

http://www.amazon.com/exec/obidos/registry/2IXE7SMI5EDI3


Tariq Murtaza <[EMAIL PROTECTED]> wrote... :


Try postnuke.com


Ashley M. Kirchner wrote:

   I need to add some type of Content

Management System to an already existing

site.  All my client wants to be able to do is

adding new articles every week,

and have the system update the main (index) page

with those articles (adding

excerpts and keep a list of published articles.)

The criteria is that the

current index page has to stay the way it is

now, just the management has to be

somewhat automated.  Right now everything is

being done manually, every article

manually linked in the index page and the little

excerpts written out by hand.

   Can anyone suggest a CMS program that I can

feed the current page to and

have it work without having to rewrite the whole

site into the CMS program?

--
H | I haven't lost my mind; it's backed up on

tape somewhere.



+--------------------------------------------------------------------

Ashley M. Kirchner <mailto:ashley@;pcraft.com>

.   303.442.6410 x130

IT Director / SysAdmin / WebSmith

.     800.441.3873 x130

Photo Craft Laboratories, Inc. .

3550 Arapahoe Ave. #6

http://www.pcraft.com ..... . . .

Boulder, CO 80303, U.S.A.



--
Tariq Murtaza
Assistant Web Master
Business Technology Team
Small & Medium Enterprise Development Authority
Government of Pakistan
1st Floor, Waheed Trade Complex
36-XX, Khayaban-e-Iqbal, D.H.A
Lahore-54792, PAKISTAN
Tel: (92 42) 111 111 456
Fax: (92 42) 5896619
Website: http://www.smeda.org.pk



--
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



__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/


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

I am writing a php script to fetch a html page and verify its content which 
generated by a remote cgi program. The special cgi program generates endless 
content to the http client. Therefore, I need to figure out a solution for 
curl to fetch part of the html source code(In fact, I only need the first 100 
lines of the html source). I tried CURLOPT_TIMEOUT, but when curl_exec() 
timeouts, it will not return part of the html source it already 
fetched--actually it returns nothing at all.

Is there any way to work around this?


#!/usr/bin/php4 -q
<?php

$url = "http://www.example.com/cgi-bin/large_output.cgi";;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>
-- 
Patrick Hsieh<[EMAIL PROTECTED]>
GnuPG Pubilc Key at http://www.ezplay.tv/~pahud/pahudatezplay.pubkey
MD5 checksum: b948362c94655b74b33e859d58b8de91
--- End Message ---
--- Begin Message --- You have the page in $result, so you need $result=explode("\n",$result), and echo $result[0] - [99]

Patrick Hsieh wrote:

Hello list,

I am writing a php script to fetch a html page and verify its content which generated by a remote cgi program. The special cgi program generates endless content to the http client. Therefore, I need to figure out a solution for curl to fetch part of the html source code(In fact, I only need the first 100 lines of the html source). I tried CURLOPT_TIMEOUT, but when curl_exec() timeouts, it will not return part of the html source it already fetched--actually it returns nothing at all.

Is there any way to work around this?


#!/usr/bin/php4 -q
<?php

$url = "http://www.example.com/cgi-bin/large_output.cgi";;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>


--- End Message ---
--- Begin Message ---
I'm devastated to hear that extract($_POST) or extract($_GET) are security
risks because that's the method I went with for a bunch of scripts I'm
writing now. But I don't understand how this...

    $admin = $_POST['admin'];

... is more secure? Isn't the security risk that they can hijack your var
data? If so, I don't see how the above would make it possible to know
whether the data in $_POST isn't coming from your own scripts. Especially
for forms where it's not really efficient to validate every possibility for
a field, such as a Country field.

But maybe I'm missing the point, and if so I'd like to understand so I can
make my scripts more secure when passing data. It seems like I will need to
basically re-define every form field and GET variable at the beginning of
each script literally.

Monty



> From: [EMAIL PROTECTED] (Mike Ford)
> Newsgroups: php.general
> Date: Thu, 24 Oct 2002 18:41:04 +0100
> To: "'1LT John W. Holmes'" <[EMAIL PROTECTED]>, Rick Emery
> <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> Subject: RE: [PHP] extract($_POST)
> 
>> -----Original Message-----
>> From: 1LT John W. Holmes [mailto:holmes072000@;charter.net]
>> Sent: 23 October 2002 19:51
>> 
>> Say you have something like this:
>> 
>> if($_POST['name'] == "John")
>> { $admin = TRUE; }
>> 
>> if($admin)
>> { show_sensitive_data(); }
>> 
>> Now, if you're using extract(), I can send $admin through the
>> post data and
>> you'll extract it into your script. That's where the security
>> flaw lies, but
>> the flaw is in the programming, not PHP.
>> 
>> You can have a secure example by doing this:
>> 
>> $admin = FALSE;
>> if($_POST['name'] == "John")
>> { $admin = TRUE; }
> 
> Or just $admin = $_POST['name']=="John";
> 
> Actually, I'd also collapse this into the subsequent if, and write it like
> this:
> 
> if ($admin = $_POST['name']=="John"):
> show_sensitive_data();
> endif;
> 
> I love languages where assignments are expressions!
> 
> 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 ---
$_GET is definately insecure because the user can insert values into the URL line, 
which may expose data which should be secure (depending upon how you've written your 
scripts).

$_POST is more secure, if you add additional protective coding.  An excellent example 
was provided a couple days ago.  In the following, assume $admin must be set to 
"trustme" and is set from a form:

INSECURE method 1:
if( ISSET($admin) )
{
    print $sensitive_data;
}

INSECURE method 2:
if( $admin=="trustme" )
{
    print $sensitive data;
}

MORE SECURE method:
$admin = "";
extract($_POST);
if( $admin == "trustme" )
{
    print $sensitive_data;
}

The insecure methods can be fooled by the user guessing/inserting a variable named 
$admin, set to "trustme" in the URL.

The more secure method ensures it MUST come from a form.  Be advised: the user can 
create his own form with $admin as a variable and submit it to your PHP script.  
Therefore, additional precautions and authentication are warranted.

----- Original Message ----- 
From: "Monty" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 25, 2002 12:37 AM
Subject: Re: [PHP] extract($_POST)


I'm devastated to hear that extract($_POST) or extract($_GET) are security
risks because that's the method I went with for a bunch of scripts I'm
writing now. But I don't understand how this...

    $admin = $_POST['admin'];

... is more secure? Isn't the security risk that they can hijack your var
data? If so, I don't see how the above would make it possible to know
whether the data in $_POST isn't coming from your own scripts. Especially
for forms where it's not really efficient to validate every possibility for
a field, such as a Country field.

But maybe I'm missing the point, and if so I'd like to understand so I can
make my scripts more secure when passing data. It seems like I will need to
basically re-define every form field and GET variable at the beginning of
each script literally.

Monty



> From: [EMAIL PROTECTED] (Mike Ford)
> Newsgroups: php.general
> Date: Thu, 24 Oct 2002 18:41:04 +0100
> To: "'1LT John W. Holmes'" <[EMAIL PROTECTED]>, Rick Emery
> <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> Subject: RE: [PHP] extract($_POST)
> 
>> -----Original Message-----
>> From: 1LT John W. Holmes [mailto:holmes072000@;charter.net]
>> Sent: 23 October 2002 19:51
>> 
>> Say you have something like this:
>> 
>> if($_POST['name'] == "John")
>> { $admin = TRUE; }
>> 
>> if($admin)
>> { show_sensitive_data(); }
>> 
>> Now, if you're using extract(), I can send $admin through the
>> post data and
>> you'll extract it into your script. That's where the security
>> flaw lies, but
>> the flaw is in the programming, not PHP.
>> 
>> You can have a secure example by doing this:
>> 
>> $admin = FALSE;
>> if($_POST['name'] == "John")
>> { $admin = TRUE; }
> 
> Or just $admin = $_POST['name']=="John";
> 
> Actually, I'd also collapse this into the subsequent if, and write it like
> this:
> 
> if ($admin = $_POST['name']=="John"):
> show_sensitive_data();
> endif;
> 
> I love languages where assignments are expressions!
> 
> 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 


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


--- End Message ---
--- Begin Message ---
> The more secure method ensures it MUST come from a form.  Be 
> advised: the user can create his own form with $admin as a variable 
> and submit it to your PHP script.  Therefore, additional precautions 
> and authentication are warranted.

And what should these precautions be?  If a malicious user can submit
his own form and you are looking for a POST variable, how can you
ensure that $admin came from your form and not that user's?  And if that
same user can hijack a session, that makes it so you have even less
precautions you can take.
I'm honestly interested in this.  I've read the security section of the manual,
read similar threads and each time, I've come to the conclusion that you
can really only ever be so secure.  And that all of the tests, checks, 
balances you may implement are all for naught where a really determined
malicious user is concerned.

Chris


--- End Message ---
--- Begin Message ---
A determined hacker can get through.  Period.

Additional safeguards might include username/password authentication against a 
database.

You can only make it more difficult for a hacker to break-in.  You can never have 
absolute certainty he won't.

----- Original Message ----- 
From: "Chris Boget" <[EMAIL PROTECTED]>
To: "Rick Emery" <[EMAIL PROTECTED]>
Cc: "PHP General" <[EMAIL PROTECTED]>
Sent: Friday, October 25, 2002 8:53 AM
Subject: Re: [PHP] extract($_POST)


> The more secure method ensures it MUST come from a form.  Be 
> advised: the user can create his own form with $admin as a variable 
> and submit it to your PHP script.  Therefore, additional precautions 
> and authentication are warranted.

And what should these precautions be?  If a malicious user can submit
his own form and you are looking for a POST variable, how can you
ensure that $admin came from your form and not that user's?  And if that
same user can hijack a session, that makes it so you have even less
precautions you can take.
I'm honestly interested in this.  I've read the security section of the manual,
read similar threads and each time, I've come to the conclusion that you
can really only ever be so secure.  And that all of the tests, checks, 
balances you may implement are all for naught where a really determined
malicious user is concerned.

Chris



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


--- End Message ---
--- Begin Message ---
> And what should these precautions be?  If a malicious user can submit
> his own form and you are looking for a POST variable, how can you
> ensure that $admin came from your form and not that user's?  

The problem is when a cracker uses form variables in an attempt to set the
values of "flag" variables kept only in the session, for example, $isAdmin.
As far as the form variables *you* put in your form, it doesn't matter
whether the user submits your form or a form they made themselves. Those
form variables are just data you are trying to collect.

With register_globals on, PHP takes *all* variables (GET, POST, COOKIE)
received from the client and assigns them to global variables. So if the
user posts a value for $isAdmin, she can give herself admin privileges.

The key is to retrieve *only* the form variables *you* put in the form from
the the $_POST array. So don't write a loop and grab *everything* from that
array.

Kirk
--- End Message ---
--- Begin Message ---
Ciao a tutti, ho bisogno di qualche dritta:
Voglio utilizzare la trasformazione xslt ma mi servirebbe un modello xslt di
esempio per vedere se il mio è errato
Allego il mio di test:

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
 <xsl:template match="/">
   <html>
   <head>
     <title><xsl:value-of select="catalogo/data"/></title>
   </head>
   <body>
   <xsl:value-of select="catalogo"/>
   </body>
 </html>
 </xsl:template>
</xsl:stylesheet>

Quando faccio la trasformazione il risultato è uguale al xsl e non alla
fusione col documento xml.
Allego anche la prima parte per chiarezza:

<?php
$doc = domxml_new_doc("1.0");
$catalogo = $doc->add_root('catalogo');

$data     = $catalogo->new_child('data','oggi');

$xml_string=$doc->dump_mem(true);
$xsl_file='style.xsl';
$xsl_parames="";
XSLTrasform($xml_string,$xsl_file,$xsl_params);

function XSLTrasform(&$xml_string,$xsl_file,&$xsl_params){
   $xsl_string=join("",file($xsl_file));
   $arg_buffer=array("/xml" =>$xml_string,"/xslt"=>$xsl_string);
   $xp=xslt_create() or die ("Non posso creare il processo");
   $cwd='file://'.dirname($_SERVER['SCRIPT_FILENAME'])."/";
   xslt_set_base($xp,$cwd);
   if ($result=xslt_process($xp,"arg:/xml","arg:/xslt",null,$arg_buffer)){
     echo $result;
   }else{
      echo ("Errore nell'elaborazione");
   };
   xslt_free($xp);
   return;
};
?>

Distinti saluti,
P.I. Agnoletto Christian
CEDA Computers S.r.l.

--- End Message ---
--- Begin Message ---
My first guess would be exec('lpr somefile');

Jim Hatridge wrote:

Hi Justin et al...

On Thursday 24 October 2002 04:29, Justin French wrote:

Hi,

I've been approached by a couple of site to write an article or two on PHP.
Any ideas on a topic that I might want to tackle? What do people want to
learn about?

Justin

For me an article on how to print from PHP (under Linux) to my HP laserjet. I mean real paper and ink. It seems everytime I find something about printing it only talks about "printing" to the screen (or at very best to file). In fact if any one can give me a hint about this ?????

Thanks

JIM



--- End Message ---
--- Begin Message ---
hi,

When using sessions , how can i test if a browser supports cookies on the
clients browser. When i use cookies why does the PHPSESSID=blah visible in
the url.
Is it dangerous to let php handle the sid in the url if a browser does not
support cookies?Can someone send me an example of good login code.

ps Im a beginner , so go easy on me

Thanks
    Shaun


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

> how can i test if a browser supports cookies 

Try and set one on page A, and then read it on page B. If it's not there,
the browser doesn't support cookies.

> Is it dangerous to let php handle the sid in the url 
> if a browser does not support cookies?

There's an extremely remote possibility a session can be hijacked.

> Can someone send me an example of good login code.

Sure:
http://zend.com/zend/tut/authentication.php

Cheers
Jon
--- End Message ---
--- Begin Message ---
My boss wants me to add a number of items to the cart based on a user
form input. At the moment my add to cart function  checks if anything is
in it and then increments one item (using this code). I can supply the
full function if required but just this part would get me away I think.

if($cart[$new])
      $cart[$new]++;

Instead of incrementing by one how do I increment by a variable which
would be the form input?

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

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

<?
$newamount = 5;

if($cart[$new])
    $cart[$new] = $cart[$new] + $newamount;
?>

--- End Message ---
--- Begin Message --- add squere brackets to the name and loop through $_POST['state'], as this will become an array now

James Taylor wrote:

Heya folks, not sure if this is more of a php question or an html question,
though I'm right now leaning towards a 50% php, 50% html, so I think this is
on topic still.

I have a form filled with checkboxes, each representing one of the 50
states. A user can check as many states as they want, then post the data -
The checkbox form would look *something* like:

<td><input type="checkbox" name="state" value="1">&nbsp;&nbsp;Alabama</td>
<td><input type="checkbox" name="state" value="2">&nbsp;&nbsp;Alaska</td>
<td><input type="checkbox" name="state" value="3">&nbsp;&nbsp;Arizona</td>

Instead of assigning a unique name to each checkbox, I know there's *some*
way to make it so the same name has multiple values, as I've seen it done
before (somehow). When posting the data though, the script is only
recognizing the box checked with the highest value

foreach ($_POST as $value) {
echo "$value<br/>\n";
}

^^^ Only shows the highest value

Any ideas on how to do this without having to check for
isset($_POST['california']), isset($_POST['alabama']) etc. etc.?




--- End Message ---
--- Begin Message --- Hi to Everyone,
I just want to know if there is a way that i can have register_globals On in my php.ini file but for some application i can turn that Off perhaps with a .htacces file.

Thx for any help.

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

> I just want to know if there is a way that i 
> can have register_globals On in my php.ini file 
> but for some application i can turn that Off 
> perhaps with a .htacces file.

In your .htaccess:

  php_flag register_globals on

or

  php_flag register_globals off

Manual pages at 
http://www.php.net/manual/en/configuration.changes.php

Cheers
Jon

--- End Message ---
--- Begin Message --- Thx for your reply It is working.

I also found from php.net that it's possible to set register_globals to "off" on a site-by-site basis via Apache, thus overriding the "global" setting of register_globals in php.ini:

In httpd.conf:

<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot /var/www/html/mysite
php_value register_globals 0 (or 1 for "on")
</VirtualHost>

That way, sites with old code can have register globals turned on, but for all new developments it will be disabled.

Jon Haworth wrote:
Hi,


I just want to know if there is a way that i can have register_globals On in my php.ini file but for some application i can turn that Off perhaps with a .htacces file.

In your .htaccess:

php_flag register_globals on

or

php_flag register_globals off

Manual pages at http://www.php.net/manual/en/configuration.changes.php

Cheers
Jon


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

> Thx for your reply It is working.

No probs, glad to help.

> I also found from php.net that it's possible 
> to set register_globals to "off" on a site-by-
> site basis via Apache, thus overriding the "global" 
> setting of register_globals in php.ini:
> 
> <VirtualHost 127.0.0.1>
> ServerName localhost
> DocumentRoot /var/www/html/mysite
> php_value register_globals 0 (or 1 for "on")
> </VirtualHost>

Yup, or even in directories:

<Directory "/var/www/html/mysite/foo">
  php_value register_globals 0
</Directory>

Which might be handy if you're updating scripts on a live site.

Cheers
Jon
--- End Message ---
--- Begin Message ---
On Fri, 25 Oct 2002 13:16:27 +0300
Tjoumaidis <[EMAIL PROTECTED]> wrote:

> Hi to Everyone,
> I just want to know if there is a way that i can have register_globals 
> On in my php.ini file but for some application i can turn that Off 
> perhaps with a .htacces file.

I prefer it Off in php.ini and On in the .htaccess file. 

php_flag register_globals On

Yes, you can do it.

Alister
--- End Message ---
--- Begin Message ---
it works only if i put it in my httpd.conf - yes allowoveride is set to
all :/

i'm using apache 1.3.27 on win2k.

Jon Haworth wrote:

> Hi,
>
>
> >Thx for your reply It is working.
>
>
> No probs, glad to help.
>
>
> >I also found from php.net that it's possible
> >to set register_globals to "off" on a site-by-
> >site basis via Apache, thus overriding the "global"
> >setting of register_globals in php.ini:
> >
> >
> >ServerName localhost
> >DocumentRoot /var/www/html/mysite
> >php_value register_globals 0 (or 1 for "on")
> >
>
>
> Yup, or even in directories:
>
>
>   php_value register_globals 0
>
>
> Which might be handy if you're updating scripts on a live site.
>
> Cheers
> Jon
>



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

> > ServerName localhost
> > DocumentRoot /var/www/html/mysite
> > php_value register_globals 0 (or 1 for "on")
> 
> it works only if i put it in my httpd.conf - yes 
> allowoveride is set to all :/
> 
> i'm using apache 1.3.27 on win2k.

Well, you're doing *something* wrong, 'cos it works fine here :-)

You have got an "AccessFileName .htaccess" directive, right?

You might like to try asking in
news:comp.infosystems.www.servers.ms-windows, or hanging around here until
an Apache guru turns up...

Cheers
Jon

--- End Message ---
--- Begin Message --- well, i found my mistake ;)

on windows i forgot to change the name of the .htaccess-files because on win they couldnt have a extentsion without a name.

So i've named them now only "htaccess" without the dot and it works fine

Frank W. wrote:

it works only if i put it in my httpd.conf - yes allowoveride is set to
all :/

i'm using apache 1.3.27 on win2k.

Jon Haworth wrote:

 > Hi,
 >
 >
 > >Thx for your reply It is working.
 >
 >
 > No probs, glad to help.
 >
 >
 > >I also found from php.net that it's possible
 > >to set register_globals to "off" on a site-by-
 > >site basis via Apache, thus overriding the "global"
 > >setting of register_globals in php.ini:
 > >
 > >
 > >ServerName localhost
 > >DocumentRoot /var/www/html/mysite
 > >php_value register_globals 0 (or 1 for "on")
 > >
 >
 >
 > Yup, or even in directories:
 >
 >
 >   php_value register_globals 0
 >
 >
 > Which might be handy if you're updating scripts on a live site.
 >
 > Cheers
 > Jon
 >





--- End Message ---
--- Begin Message ---
I have a single page site I'm working on that displays the contents of your
current session.  Users can clear the contents by clicking a link that
triggers a $PHP_SELF?clear=1 - Before any headers are sent out, the script
checks for $_GET['clear'], and if it's set, it does a session_destroy();.
For some reason though, the contents of the session are STILL displayed
until you do a refresh on the page.  However, for some bizarre reason, if I
call session_start() at the very beginning, call session_destroy(); and then
session_start() AGAIN after the destroy, it seems to work like it's supposed
to.  Is this a bug, or is it working properly?  Also - I'm sure there's a
better method than this - Any suggestions on what that might be?  If there
are no better methods well... Are there any downsides to what I'm doing?

Below is a "sample" version of the script, to give you an idea of what I
mean incase my ramblings above didn't make sense. Thanks!.


<?php

session_start();                // Start the session

if (isset($_GET['clear'])) {
   session_destroy();             // If they chose to clear the session, then we do
so
}

session_start();                          // Start it again; it works for whatever 
reason

?>
<html><body>

(some other stuff)

<?

/*
   Here I just print out whatever's in the session.  Unless session_start is
called
   the second time after the destroy, a user will have to click refresh
before the
   data appears to be gone
*/

if (isset($_SESSION['states'])) {
   foreach ($_SESSION['states'] as $value) {
      echo "$value<br/>\n";
   }
}

// and lastly, here's our "clear session" link below
?>
<a href="index.php?clear=1">Clear the session</a>
</body></html>

--- End Message ---
--- Begin Message --- This has to do with how php works with session internaly. $_SESSION is set after the fist call to
session_start(), session_destroy() destroys only data that are already stored, the second call to
session_start() tries to retrieve these data, but there are none. Use $_SESSION=array() before
session_destroy() as the documentation sugests

James Taylor wrote:

I have a single page site I'm working on that displays the contents of your
current session. Users can clear the contents by clicking a link that
triggers a $PHP_SELF?clear=1 - Before any headers are sent out, the script
checks for $_GET['clear'], and if it's set, it does a session_destroy();.
For some reason though, the contents of the session are STILL displayed
until you do a refresh on the page. However, for some bizarre reason, if I
call session_start() at the very beginning, call session_destroy(); and then
session_start() AGAIN after the destroy, it seems to work like it's supposed
to. Is this a bug, or is it working properly? Also - I'm sure there's a
better method than this - Any suggestions on what that might be? If there
are no better methods well... Are there any downsides to what I'm doing?

Below is a "sample" version of the script, to give you an idea of what I
mean incase my ramblings above didn't make sense. Thanks!.


<?php

session_start(); // Start the session

if (isset($_GET['clear'])) {
session_destroy(); // If they chose to clear the session, then we do
so
}

session_start(); // Start it again; it works for whatever reason

?>
<html><body>

(some other stuff)

<?

/*
Here I just print out whatever's in the session. Unless session_start is
called
the second time after the destroy, a user will have to click refresh
before the
data appears to be gone
*/

if (isset($_SESSION['states'])) {
foreach ($_SESSION['states'] as $value) {
echo "$value<br/>\n";
}
}

// and lastly, here's our "clear session" link below
?>
<a href="index.php?clear=1">Clear the session</a>
</body></html>




--- End Message ---
--- Begin Message ---
Why my mail prcessing script don't recognize the value from the form file.
If I call the $numele variable it's just output a null.
This is the form.html
<html>
<head>
<title>Numele</title>

<body>
<form name="form" method=post action="mail.php">

  <p align="center">Nume:
    <input name="numele" type="text" value="Cum vrei tu">
  </p>
  <div align="center">
    <input type="submit" name="Submit" value="Trimite">
  </div>
</form>
</body>
</html>
And this is mail.php
<html></head><title>Mesajul este trimis</title>
<?php
$email = "Nume:\t$numele";
$to = "[EMAIL PROTECTED]";
$subject = "Nume";
# mail($to, $subject, $email);
?>
</head>
<body><div align="justify">
 <? echo ("Ai trimis numele $numele"); ?>

</div>
</body>
</html>
the mail command is commentet for testing purpose, I don't want to receive a
e-mail every time I test the script.

--
Trasca Ion-Catalin


--- End Message ---
--- Begin Message --- Register globals problem - either use $_POST['numele'] (prefered), or turn register_globals on.

Trasca Ion-Catalin wrote:

Why my mail prcessing script don't recognize the value from the form file.
If I call the $numele variable it's just output a null.
This is the form.html
<html>
<head>
<title>Numele</title>

<body>
<form name="form" method=post action="mail.php">

<p align="center">Nume:
<input name="numele" type="text" value="Cum vrei tu">
</p>
<div align="center">
<input type="submit" name="Submit" value="Trimite">
</div>
</form>
</body>
</html>
And this is mail.php
<html></head><title>Mesajul este trimis</title>
<?php
$email = "Nume:\t$numele";
$to = "[EMAIL PROTECTED]";
$subject = "Nume";
# mail($to, $subject, $email);
?>
</head>
<body><div align="justify">
<? echo ("Ai trimis numele $numele"); ?>

</div>
</body>
</html>
the mail command is commentet for testing purpose, I don't want to receive a
e-mail every time I test the script.

--
Trasca Ion-Catalin





--- End Message ---
--- Begin Message ---
Now I noticed that I can't take any variable from another file. It's my
programs fault or I have to modify something in Apache or PHP?

--
Trasca Ion-Catalin
"Trasca Ion-Catalin" <[EMAIL PROTECTED]> wrote in message
news:20021025100207.89943.qmail@;pb1.pair.com...
> Why my mail prcessing script don't recognize the value from the form file.
> If I call the $numele variable it's just output a null.
> This is the form.html
> <html>
> <head>
> <title>Numele</title>
>
> <body>
> <form name="form" method=post action="mail.php">
>
>   <p align="center">Nume:
>     <input name="numele" type="text" value="Cum vrei tu">
>   </p>
>   <div align="center">
>     <input type="submit" name="Submit" value="Trimite">
>   </div>
> </form>
> </body>
> </html>
> And this is mail.php
> <html></head><title>Mesajul este trimis</title>
> <?php
> $email = "Nume:\t$numele";
> $to = "[EMAIL PROTECTED]";
> $subject = "Nume";
> # mail($to, $subject, $email);
> ?>
> </head>
> <body><div align="justify">
>  <? echo ("Ai trimis numele $numele"); ?>
>
> </div>
> </body>
> </html>
> the mail command is commentet for testing purpose, I don't want to receive
a
> e-mail every time I test the script.
>
> --
> Trasca Ion-Catalin
>
>


--- End Message ---
--- Begin Message ---
You need to use $_POST["numele"] instead of $numele - that or edit your
php.ini file.
 
 
 
Now I noticed that I can't take any variable from another file. It's my
programs fault or I have to modify something in Apache or PHP?
 
--
Trasca Ion-Catalin
"Trasca Ion-Catalin" <[EMAIL PROTECTED]> wrote in message
news:20021025100207.89943.qmail@;pb1.pair.com...
> Why my mail prcessing script don't recognize the value from the form
file.
> If I call the $numele variable it's just output a null.
> This is the form.html
> <html>
> <head>
> <title>Numele</title>
>
> <body>
> <form name="form" method=post action="mail.php">
>
>   <p align="center">Nume:
>     <input name="numele" type="text" value="Cum vrei tu">
>   </p>
>   <div align="center">
>     <input type="submit" name="Submit" value="Trimite">
>   </div>
> </form>
> </body>
> </html>
> And this is mail.php
> <html></head><title>Mesajul este trimis</title>
> <?php
> $email = "Nume:\t$numele";
> $to = "[EMAIL PROTECTED]";
> $subject = "Nume";
> # mail($to, $subject, $email);
> ?>
> </head>
> <body><div align="justify">
>  <? echo ("Ai trimis numele $numele"); ?>
>
> </div>
> </body>
> </html>
> the mail command is commentet for testing purpose, I don't want to
receive
a
> e-mail every time I test the script.
>
> --
> Trasca Ion-Catalin
>
--- End Message ---
--- Begin Message ---
On Friday 25 October 2002 06:51, Matias Silva wrote:
> Hi-ya all, here's a quickie.......
>
> In my script I create a directory (mysql.backup.timestamp/) within a
> directory called backup/.
> I use  the function  mkdir("mysql.backup.timestamp", "0777");  and it shows
> the permissions
> as after the function executes:
>
>     dr----x--t   2 nobody    daemon    1024 Oct 24 15:16
> mysql.backup.October-24-2002-1516
>
> Where's the permissions (dr----x--t   2 nobody   daemon) coming from?  Is
> it the php.ini, apache conf or
> the operating system?

The permissions (r----x--t) is coming from your mode setting in your mkdir() 
function AND from the system setting umask -- see manual -> umask() and check 
out user comments as well.

> I would like to set the owner to "root" and the group to "nc".  How can
> this be achieved
> by the php script?  Or do I have set this up in the other environments (OS
> or Apache)?

You can't.

The user:group comes from the user running the webserver, which in your case 
is nobody:daemon.

Only root can the the user:group ownership of files and directories. So unless 
your webserver is running as root you cannot use chown()/chgrp().


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
After years of research, scientists recently reported that there is,
indeed, arroz in Spanish Harlem.
*/

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Richard B. Johnson wrote:
> It's a "tomorrow" thing. Ten hours it too long to stare at a
> screen.

Sissy!

        - Jens Axboe on linux-kernel
*/

--- End Message ---
--- Begin Message --- Actualy, you can use chgrp(), but apache must be a member of the group you are changing to.

Jason Wong wrote:

On Friday 25 October 2002 06:51, Matias Silva wrote:

Hi-ya all, here's a quickie.......

In my script I create a directory (mysql.backup.timestamp/) within a
directory called backup/.
I use the function mkdir("mysql.backup.timestamp", "0777"); and it shows
the permissions
as after the function executes:

dr----x--t 2 nobody daemon 1024 Oct 24 15:16
mysql.backup.October-24-2002-1516

Where's the permissions (dr----x--t 2 nobody daemon) coming from? Is
it the php.ini, apache conf or
the operating system?

The permissions (r----x--t) is coming from your mode setting in your mkdir() function AND from the system setting umask -- see manual -> umask() and check out user comments as well.


I would like to set the owner to "root" and the group to "nc". How can
this be achieved
by the php script? Or do I have set this up in the other environments (OS
or Apache)?

You can't.

The user:group comes from the user running the webserver, which in your case is nobody:daemon.

Only root can the the user:group ownership of files and directories. So unless your webserver is running as root you cannot use chown()/chgrp().




--- End Message ---
--- Begin Message --- Dear All

I am wondering if anyone know, some good open source editor for PHP on linux/Unix

Hopping for The Best :)

Tariq


--- End Message ---
--- Begin Message ---
Have a look at www.jedit.org 

This editor is not specific to PHP but it does handle PHP well.

Clint

-----Original Message-----
From: Tariq Murtaza [mailto:tariq@;smeda.org.pk] 
Sent: Friday, October 25, 2002 6:01 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Looking for an open source PHP editor on linux


Dear All

I am wondering if anyone know, some good open source editor for PHP on 
linux/Unix

Hopping for The Best :)

Tariq



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





--- End Message ---
--- Begin Message --- Thanks Clint Tredway

Actually i am looking for syntax highlighting / help feature of PHP in editor.

Any body????

Tariq

Clint Tredway wrote:
Have a look at www.jedit.org
This editor is not specific to PHP but it does handle PHP well.

Clint

-----Original Message-----
From: Tariq Murtaza [mailto:tariq@;smeda.org.pk] Sent: Friday, October 25, 2002 6:01 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Looking for an open source PHP editor on linux


Dear All

I am wondering if anyone know, some good open source editor for PHP on linux/Unix

Hopping for The Best :)

Tariq

--- End Message ---
--- Begin Message ---
the personal edition (2.0) from www.zend.com

well - its not open source but it has nice help and debug-features for PHP.

Tariq Murtaza wrote:

Dear All

I am wondering if anyone know, some good open source editor for PHP on
linux/Unix

Hopping for The Best :)

Tariq




--- End Message ---
--- Begin Message ---
You can try....

http://quanta.sourceforge.net

or.....

http://nusphere.com/products/phpadv.htm  (this one isn't free)

Tariq Murtaza wrote:
Thanks Clint Tredway

Actually i am looking for syntax highlighting / help feature of PHP in editor.

Any body????

Tariq

Clint Tredway wrote:

Have a look at www.jedit.org
This editor is not specific to PHP but it does handle PHP well.

Clint

-----Original Message-----
From: Tariq Murtaza [mailto:tariq@;smeda.org.pk] Sent: Friday, October 25, 2002 6:01 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Looking for an open source PHP editor on linux


Dear All

I am wondering if anyone know, some good open source editor for PHP on linux/Unix

Hopping for The Best :)

Tariq




--- End Message ---
--- Begin Message ---
VIM :)



--
Maxim Maletsky
[EMAIL PROTECTED]


www.PHPBeginner.com  // PHP for Beginners
www.maxim.cx         // my Home

// my Wish List:     ( Get me something! )
http://www.amazon.com/exec/obidos/registry/2IXE7SMI5EDI3



Tariq Murtaza <[EMAIL PROTECTED]> wrote... :

> Dear All
> 
> I am wondering if anyone know, some good open source editor for PHP on 
> linux/Unix
> 
> Hopping for The Best :)
> 
> Tariq
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
I think Glimmer is pretty good.

http://glimmer.sourceforge.net/

Brad

On Fri, 2002-10-25 at 07:49, Maxim Maletsky wrote:
> 
> VIM :)
> 
> 
> 
> --
> Maxim Maletsky
> [EMAIL PROTECTED]
> 
> 
> www.PHPBeginner.com  // PHP for Beginners
> www.maxim.cx         // my Home
> 
> // my Wish List:     ( Get me something! )
> http://www.amazon.com/exec/obidos/registry/2IXE7SMI5EDI3
> 
> 
> 
> Tariq Murtaza <[EMAIL PROTECTED]> wrote... :
> 
> > Dear All
> > 
> > I am wondering if anyone know, some good open source editor for PHP on 
> > linux/Unix
> > 
> > Hopping for The Best :)
> > 
> > Tariq
> > 
> > 
> > 
> > -- 
> > 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 ---
Thank you for your response.  First of all, I'm not sure if you are
familiar, but I am working on a project called eNetwizard Content
Management Server.  More is available here:
http://www.sourceforge.net/projects/enetwizard/
 
Content is stored as XML, but not in the usual manner.  eNetwizard is
able to manage an unlimited number of domains and websites from a
central web environment.  It does this because it acts as a web server
and determines what content to deliver based on the URL string.  Content
is stored in a matrix folder like this:
 
/matrix
/matrix/net
/matrix/net/enetwizard
/matrix/net/enetwizard/www
 
In this manner, all content for www.enetwizard.net
<http://www.enetwizard.net/>  is stored in the
/matrix/net/enetwizard/www folder.  However, it is even more complicated
than that.  Content is compiled by scope.  /matrix is considered the
global scope.  /matrix/net/enetwizard is in the domain scope.
/matrix/net/enetwizard/www is in the website scope.  And the files in
that directory are in the page scope.  Each of these directories can
have a file (_.rsw) which is a part of the eNetwizard XML that is
compiled.  It must be fully-conformant XML and this is determined by the
class I wrote to validate it.  My understanding is that PHP does not
have the ability to use DTD's - am I wrong about this?





Anyway, the reason for the scope is to build complex templates and
pages.  For example, maybe you want a copyright at the bottom of every
page that is on the enetwizard.net domain - you simply put it in the
<TAIL> section of the domain scope .RSW file.  When eNetwizard is
called, it compiles it all, validates it, and then converts it to HTML
(or anything else you want it to really).
 
Here's an example:
 
www.natural-law.net/default.exml  (this file is the result of compiling
and validating the .RSW files)
 
www.natural-law.net/default.ehtml  (this file is the result of
converting it)
 
Now, to get to what I'm trying to get at:  I understand that XML used
the ampersands as reserved words.  This is a good thing in most
instances, because it will be nice to define these entities, but how do
I do that with the limitations of the PHP parser functions?  And what is
the way around this?  I believe that the way I have things set up now, I
would like it to simply treat them as CDATA, because these can be dealt
with in the $Server class later on (when doing the conversions to HTML,
etc.)
 
Also, in order to validate the DTD (that I could make if PHP can work
with it) - it would have to wait till after the compilation of the .RSW
files - the .RSW files are also parsed as XML and first put into an
associative array - it organizes them by their main grouping and scope
-- <STYLE>, <META>, <HEAD>, <BODY>, and <TAIL> -- it works really
nicely, as those two links will show...
 
If you'd like to see the code for these two classes, let me know, and
I'll send them to you, and you can see how I have this set up.  It may
help to have a more interactive tour of how all of this works, but I
haven't gotten that far in the project yet.  I just finished the last of
the core (this XML stuff) and am about to start creating the wizards
(management panels) for the project, then the documentation, then the
release...
 
Thanks very much if you can give me an idea on how to tackle this unique
issue.
 
-Samuel
 
 
Robert Samuel White wrote:
> I am having a hard time understanding one of the features of the xml
> parser functions.
>  
> If the string I am parsing includes &nbsp; or something similar, it
> encounters an error.  I've read the docs and I don't understand how to
> have the parser process these.  Any advice would be great.
> 
 
Basically, unless you've coded something to deal with them ampersands 
are the ultimate reserved word in XML. The easiest way to deal with them

is to scrub them to &amp;nbsp; before they go through the XML parser.
 
The "right" way to deal with them is to define &nbsp; as a valid entity 
in your DTD and make sure that all XML strings have a DTD when they are 
fed through the parser.
 
J Wynia
phpgeek.com
 
--- End Message ---
--- Begin Message ---
Hi People,

I am running PHP 4.1.2 on a Cobalt Raq4 server. I'm pretty new to Linux and
can't understand why the server has come preinstalled with 2 diffrent
versions of PHP. When I run phpinfo() from scripts on the site through my
browser it says PHP is installed as an Apache module, but when I run it from
the command line it still has the same version number but says its a CGI
install.

I'm trying to use the ftp_connect() function in a script that is run from
the command line, ie. the CGI version and everytime I run it it says 'Call
to undefined function ftp_connect()' yet when I run it through the browser
on my site which is running the same version of PHP just the Apache module
it works fine.

Does anyone know what causes this strange behaviour or what I can do to get
my ftp_connect() function working from the command line on a Raq4 server?

Thanks for any help.

Chris Morrow


--- End Message ---
--- Begin Message ---
Hey all,
I've been fighting this all night, I need a bit of help. I have a string like.

#21-935 Item Description: $35.95

Where the part # could be 10-2034 a combination of 2 and 3 or 4 digits, and the price 
could be a combination of 1,2,3 . 2 digits. I want to chop that string into Part # / 
Description / Price. 

I'd appreciate any help, I know this is probably real simple :) Thanks in advance.

Thanks,
William Glenn
Import Parts Plus
http://www.importpartsplus.com
--- End Message ---
--- Begin Message ---
> "William Glenn" <[EMAIL PROTECTED]> wrote in message
news:003101c27c3b$ff8c61a0$6401a8c0@;cortez.co.charter.net...
> Hey all,
> I've been fighting this all night, I need a bit of help. I have a string
like.
>
> #21-935 Item Description: $35.95
>
> Where the part # could be 10-2034 a combination of 2 and 3 or 4 digits,
and the price could be a combination of 1,2,3 . 2 digits. I want to chop
that string into Part # / Description / Price.
>
> I'd appreciate any help, I know this is probably real simple :) Thanks in
advance.

Try:

<?
$item = '#21-935 Item Description: $35.95';
$all = explode( ' ', $item );
$part_nr = substr( array_shift( $all ), 1 );
$rest = explode( '$', implode( ' ', $all ) );
$description = substr( trim( $rest[0] ), 0, -1 );
$price = $rest[1];
?>

I bet there is a much nicer (and maybe faster way), but this is by far the
easiest (it doesn't cost one night) ;-))
One hundred thousand of these iterations took about 2 seconds...

Grtz Erwin

--- End Message ---
--- Begin Message ---
<?php
$s = "#12-3456 The Item description $35.43";

$qq = ereg("#([0-9]*-[0-9]*) ([a-zA-Z0-9 ]*) \\$([0-9]{1,3}\.[0-9]{2})", $s,$a);

$val = $a[1]."/".$a[2]."/".$a[3];
print $val;

?>

----- Original Message -----
From: "William Glenn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 25, 2002 10:34 AM
Subject: [PHP] Ereg help


Hey all,
I've been fighting this all night, I need a bit of help. I have a string like.

#21-935 Item Description: $35.95

Where the part # could be 10-2034 a combination of 2 and 3 or 4 digits, and the price
could be a combination of 1,2,3 . 2 digits. I want to chop that string into Part # /
Description / Price.

I'd appreciate any help, I know this is probably real simple :) Thanks in advance.

Thanks,
William Glenn
Import Parts Plus
http://www.importpartsplus.com

--- End Message ---
--- Begin Message ---
I presently generate pdf files as required...

I use FPDF for writing PDF...

I require to save these to file... is it a simple case of:

where the script: generate_stats_view_table_pdf.php generates the PDF...

<?
    $fcontents= file
('http://www.domain.com/autoreport/generate_stats_view_table_pdf.php');
    while (list ($line_num, $line) = each ($fcontents)) {
        $display .= $line;
    }

$fp=fopen("/usr/local/psa/home/vhosts/domain.com/httpdocs/admin/hourly/stats
_detailed.pdf","w");
    fputs($fp,$display);
    fclose($fp);
?>

TIA...


--- End Message ---
--- Begin Message ---
yes it does...

/me answered myself again ;)

"Brian McGarvie" <[EMAIL PROTECTED]> wrote in message
news:20021025145239.65314.qmail@;pb1.pair.com...
> I presently generate pdf files as required...
>
> I use FPDF for writing PDF...
>
> I require to save these to file... is it a simple case of:
>
> where the script: generate_stats_view_table_pdf.php generates the PDF...
>
> <?
>     $fcontents= file
> ('http://www.domain.com/autoreport/generate_stats_view_table_pdf.php');
>     while (list ($line_num, $line) = each ($fcontents)) {
>         $display .= $line;
>     }
>
>
$fp=fopen("/usr/local/psa/home/vhosts/domain.com/httpdocs/admin/hourly/stats
> _detailed.pdf","w");
>     fputs($fp,$display);
>     fclose($fp);
> ?>
>
> TIA...
>
>


--- End Message ---
--- Begin Message ---
"Paul Kaiser" <[EMAIL PROTECTED]> wrote in message
news:58851.208.216.64.17.1035495310.squirrel@;illinimedia.com...
> I have around 50 checkboxes on an HTML form. Their "value" is "1". So,
> when a user check the box, then no problem -- the value returned by the
> form is "1" and I can enter that into my SQL database.
>
> HOWEVER...
>
> If the user does not check the box, I'm in trouble, because the "value"
> does not default to "0", but rather <nil> I'm guessing...


You can take advantage of the way PHP parses passed values...

If you have two (or more) form inputs with the same name, the last value
over-writes the previous one(s).  ie if your script is called like
   myscript.php?n=0&n=1
then you get
  $_GET["n"] == 1

Sure, you say, but how can I make use of that?

Well, if the last value weren't sent, you would still have the previous
value, ie $_GET["n"] == 0

Try this:

    <input type=hidden name=n value=0>        // this value is *always* sent
    <input type=checkbox name=n value=1>    // this value is only sent if
checked!

NOTE:  the order is important!  The conditional input must come *after*
the default!


--- End Message ---
--- Begin Message ---
"Tim Haynes" <[EMAIL PROTECTED]> wrote in message
news:20021023162115.16675.qmail@;pb1.pair.com...
> Here is a puzzle, infact it is a game that I need to do in PHP, here is
the
> spec
>
> 3 prizes to be won every day over a month by clicking on 24 seperate
> windows....and thats it
>
> How could I go about deciding whether a user that clicked on one of the
> windows is a winner or not, obviously I wouln't want the prizes to go in
the
> first hour of the day, so would need to spread it out abit.

Obviously you don't know how many contestants you will have, so you can't
base it on that.

What about varying the probability of a win by the time since the last
page-view?
You could adjust this by hourly activity (to decrease the advantage for
people
hitting it at 2am) and by (time remaining / prizes remaining) to ensure
coming
out near your number-of-prizes target.

Does it *have* to be three prizes per day, or is that *on average*?  I
prefer
the latter; it makes things more tractable.


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

I am having a major problem getting set_time_limit() to work at all with PHP 4.2.3 running as a CGI program under IIS for Windows 2000 (I originally posted this message to php-win, but am hoping someone here can shed some light on this). I have a form that accepts large files for upload, with the following lines at the top of the form action script:

<?php
// let this script take as long as it needs to complete its work
// and ignore if user hits stops button in his browser
set_time_limit(0);
ignore_user_abort(true);

// include site-wide configs and other include files
require_once('../includes/site.php');
...

If the file upload takes longer than 30 seconds, PHP bombs out with the following error:

"Fatal error: Maximum execution time of 30 seconds exceeded in D:\InetPub\test.php on line 3"

I've also tried adding:

ini_set('max_execution_time', 60000);

before the set_time_limit() function, but to no avail. PHP is not running in safe mode. Does anyone have any ideas why this is not working as expected? I'm sure it's something obvious, but I don't know what it is.

Thanks in advance,

-f


--
Derek Fong
Web Application Developer
subtitle designs inc. <http://www.subtitled.com/>

"Mistakes are the portals of discovery." --James Joyce
>> GPG key/fingerprint available upon request <<

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

i struggling with multiple select lists in HTML forms. The resulting $_REQUEST array cuts some characters from the values. If the value is value="999999" i will get "99" after posting...

my php file:
*******
<html><head></head>
<?php
echo "{$_SERVER['REQUEST_URI']} <br>";
echo "First: {$_REQUEST['msel'][0]} <br>";
echo "Count: " . count($_REQUEST['msel']) . "<br><hr>";
$i = 0;
foreach ($_REQUEST['msel'] as $v)
{
echo "$i: $v <br>";
$i++;
}
?>
<form method="GET" action="<?= $_SERVER['PHP_SELF'] ?>">
<select name="msel[]" size="6" multiple="multiple">
<option value="999999">erwin</option>
<option value="99999">admin</option>
<option value="9999">hm10</option>
<option value="999">hm30</option>
<option value="99">muhe</option>
<option value="9">hannes</option>
</select>
<input type="submit">
</form>
</body></html>
*******

The result after selecting all:
********
/PARAMOUNT/multisel2.php?msel%5B%5D=999999&msel%5B%5D=99999&msel%5B%5D=9999&msel%5B%5D=999&msel%5B%5D=99&msel%5B%5D=9
First: 99
Count: 6

--------------------------------------------------------------------------------
0: 99
1: 9
2:
3: 999
4: 99
5: 9
********

MY system:
PHP Version 4.2.3
Apache/1.3.26
SuSE Linux 8.1

When I use the same php file on a MS windows apache, it works

Regards Heiko

--- End Message ---
--- Begin Message ---
use $_POST, not $_REQUEST
----- Original Message -----
From: "Heiko Mundle" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 25, 2002 10:39 AM
Subject: [PHP] cutted values after posting multiple select list


Hi

i struggling with multiple select lists in HTML forms. The resulting
$_REQUEST array cuts some characters from the values. If the value is
value="999999" i will get "99" after posting...

my php file:
*******
<html><head></head>
<?php
echo "{$_SERVER['REQUEST_URI']} <br>";
echo "First: {$_REQUEST['msel'][0]} <br>";
echo "Count: " . count($_REQUEST['msel']) . "<br><hr>";
$i = 0;
foreach ($_REQUEST['msel'] as $v)
{
   echo "$i: $v <br>";
   $i++;
}
?>
<form method="GET" action="<?= $_SERVER['PHP_SELF'] ?>">
   <select name="msel[]" size="6" multiple="multiple">
   <option value="999999">erwin</option>
   <option value="99999">admin</option>
   <option value="9999">hm10</option>
   <option value="999">hm30</option>
   <option value="99">muhe</option>
   <option value="9">hannes</option>
   </select>
<input type="submit">
</form>
</body></html>
*******

The result after selecting all:
********
/PARAMOUNT/multisel2.php?msel%5B%5D=999999&msel%5B%5D=99999&msel%5B%5D=9999&msel%5B%5D=999
&msel%5B%5D=99&msel%5B%5D=9

First: 99
Count: 6

--------------------------------------------------------------------------------
0: 99
1: 9
2:
3: 999
4: 99
5: 9
********

MY system:
PHP Version 4.2.3
Apache/1.3.26
SuSE Linux 8.1

When I use the same php file on a MS windows apache, it works

Regards Heiko


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



--- End Message ---
--- Begin Message ---
I can't get the DomDocument->dump_file($file, false, true); to work.!
help needed!
Everyting else works just fine.

Running
IIS5
PHP 4.2.3


--- End Message ---
--- Begin Message --- Is there anyway to have php convert a database from mySQL to Access via a webpage? I have a couple of people here who use Access to do mail merging things with word and it would make my life a ton easier if I did not have to convert the db's everytime they want the info. If anyone has any thoughts on how to go about this it would be greatly appreciated. Thanks in advance.

Bobby





_________________________________________________________________
Surf the Web without missing calls! Get MSN Broadband. http://resourcecenter.msn.com/access/plans/freeactivation.asp

--- End Message ---

Reply via email to