Re: [PHP] appending to XML file before closing tag

2002-06-26 Thread Brian White

rantmode
Hey - if you read my post a little more carefully
you would see that I was bemoaning the effective
passing of *SGML*. I was on a nostaligia trip.
I am well aware that SGML is a bit of a complicated
beheamoth, but it you have a decent SGML parser
( such as Omnimark or SP) you could do some really
funky things.

XML is a very cut down version of SGML that requires
much simpler tools to process, but every now
and again that simplicity will come back to
bite you and make your life more difficult. This
was one case of that.

Most of the time I am quite happy to put up with
the verbosity.
/rantmode



At 23:24 26/06/2002, Erik Price wrote:

On Tuesday, June 25, 2002, at 08:42  PM, Brian White wrote:

I was actually thinking about this the other
day - every now and again I find my self
yearning for SGML, where you could have
just declared the wrapping element end
tag omissable, and then you would never
have to worry about it - basically
the end of the file would imply the
existence of the end tag (sigh  )

Yes, but that makes parsing very difficult -- if you're expecting to find 
a closing tag, it should be there.  You'd have to write a special set of 
XML-handling functions or a special library to cover this unique breach of 
the XML rules, since most XML modules (for Perl, PHP, Python, Java, 
whatever) expect well-formed documents.

XML is pretty verbose, yes, but the rewards of this are consistency -- as 
long as the document is well-formed, it should be pretty easy to extract 
the data from it without writing special code to handle these kinds of 
exceptions.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd
Knowledge Management Consultancy, SGML  XML
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]

Content Management Requirements Toolkit
112 CMS requirements, ready to cut-and-paste



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




Re: [PHP] store pics on mysql db

2002-04-23 Thread Brian White

Yes. The field would need to be some kind of binary blob.
You would need to access it using a PHP script that
set  the header eg:

 header( Content-type:image/gif )

and then out put the image.



At 16:37 23/04/2002, mm fernandez wrote:

hi...is it possible to store pics (jpeg/gif) on the mysql database? if so, 
how and what type should that field be?

thanks.


_
Join the world's largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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

-
Brian White
Step Two Designs Pty Ltd
Knowledge Management Consultancy, SGML  XML
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]



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




[PHP] Setting the name of a file in a download....

2002-04-22 Thread Brian White

I am using the following code to create a downloader. It works, except
that IE will just dump the contents to it's browser and Netscape 4
asks if I want to save it in a file called blah.php.


 // File: blah.php

 if ( ! $fp = fsockopen (www.steptwo.com.au, 80, $errno, $errstr, 30) )
 {
 echo $errstr ($errno)br\n;
 }
 else
 {
 $userpass = user:password;
 fputs ($fp, GET /files/file.zip HTTP/1.0\r\n .
 Host: www.steptwo.com.au\r\n .
 Authorization: Basic  . base64_encode( $userpass ) . 
\r\n .
 \r\n);

 while ( $headerStr = trim( fgets( $fp , 3072 ) ) )
 {
 if ( strpos( $headerStr, : ) )
 header( $headerStr );
 }


 fpassthru( $fp );
 }

Is there any way to get it to save as a file called file.zip?
Is there any header I can set? The headers it currently returns
are:

Date: Tue, 23 Apr 2002 06:02:36 GMT
Server: Apache/1.3.12 (Unix) ApacheJServ/1.1.2 PHP/4.0.1pl2 
FrontPage/4.0.4.3 mod_ssl/2.6.6 OpenSSL/0.9.5a
Last-Modified: Tue, 23 Apr 2002 05:13:07 GMT
ETag: 61b3e-ba-3cc4ed63
Accept-Ranges: bytes
Content-Length: 186
Connection: close
Content-Type: application/zip

regs

Brian White
-
Brian White
Step Two Designs Pty Ltd
Knowledge Management Consultancy, SGML  XML
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]



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




Re: [PHP] PHP and XML

2001-11-29 Thread Brian White

You could try XML for Dummies as a starting point - I have it on my desk
and I have yet to read it in depth but it looks like it explains most 
things OK,
and it has the advantage for PHP folk that it is aimed at people who already
know alot about how HTML works.


At 19:13 29/11/2001 -0500, Tom Malone wrote:
Can anyone recommend a good book on XML, maybe from a PHP perspective?

Tom Malone



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] WHat has happened to parse_str in the Docs????

2001-11-28 Thread Brian White

I have had a good hunt around the www.php.net site and I can find no reference
to the parse_str function in the docs, except as what looks like
cached results in old searches.

Anyway - the reason I ask is I was wondering if there was a function that
did what parse_str did, except that it put the results of parsing the
query string into an associative array rather than creating variables.
I have a vague recollection of something like that

Regs

Brian White

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] XML DTD

2001-11-12 Thread Brian White

Here's a DTD:

!DOCTYPE stuff [
!ELEMENT stuff  (thing+) 
!ELEMENT thing  (#PCDATA) 
]

Whether it is of any USE to anyone is debatable..



At 12:41 12/11/2001 -0500, Melih Onvural wrote:
I know this is a PHP news group, but i've seen some XML questions before and
I was
wondering if anyone knew how to apply a DTD, or where to find one. thanks
for any
help,

Melih Onvural
[EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] @#$@# Reg Expressions

2001-10-29 Thread Brian White

I am upright and sitting at my desk, but I think
awake is far too generous a description


At 15:21 30/10/2001 +1100, Martin Towell wrote:
Off track - seems like the only ppl awake now are ozzies :)
would I be right?

-Original Message-
From: Brad Hubbard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 30, 2001 3:11 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] @#$@# Reg Expressions


On Tue, 30 Oct 2001 14:47, brendan wrote:
  mate you rock..

You can tell he's an Australian (on ya mate :-)

--
Brad Hubbard
Congo Systems
1/286 Bolton Street, Eltham
Victoria, Australia, 3095.
Email: [EMAIL PROTECTED]
Ph: +61-3-94391200
Fax: +61-3-94391255
Mob: +61-419107559

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Apache Request Ids?

2001-10-23 Thread Brian White

Neat! Unfortunately it looks like it designed simply to be able
to generate unique ids - this isnt much use to me unless I
have a way to query whether the request that generated the id
is still active.

Doesn't matter.

At 09:11 23/10/2001 -0700, Christopher William Wesley wrote:
On Tue, 23 Oct 2001, Brian White wrote:

  process ID belongs to Apache. What I was wondering was there any kind
  of ID that was attached to a particular CGI request that I could
  access and use?

Yes.  Use the Apache module, mod_unique_id, and then in your environment,
$UNIQUE_ID will be available.  Every request to httpd gets its own
UNIQUE_ID.

Details here:
http://httpd.apache.org/docs/mod/mod_unique_id.html

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP usage(s)

2001-10-23 Thread Brian White

At 17:16 23/10/2001 -0500, Wandrer wrote:

 C/ Use a development environment made from PHP like Zope, 
 Midgard, et. al.

Use Textpad as my development environment.

Ditto. Very nice.


 D/ Can share with us a new direction in PHP that will keep it
 competitive?

'Keep it Competitive' ? flame Is there a programming language better 
than PHP ? /flame

Well, I am of the opinion that Python is a better *language* - if
I wasn't spending all my time writing Web Server apps, I would
use that. PHP is a much more *appropriate* for Web Apps.


-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Apache Request Ids?

2001-10-22 Thread Brian White


I am pretty sure I am dreaming here but 

I once wrote a locking tool for UNIX that kept as part of it's information
the process ID. If another process went to grab the lock, one thing it
would do was check if the process that had taken it was still running. If
it wasn't, it knew it could safely take the lock.

This of course won't work under PHP in it's module form because the
process ID belongs to Apache. What I was wondering was there any kind
of ID that was attached to a particular CGI request that I could
access and use?


Brian




-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Why I wish PHP had Python's exception handling....

2001-10-21 Thread Brian White


I am just doing something at the moment in PHP, which is naturally
suited to managing via a try,catch kind of structure which just isn't
in PHP and means I am having to be very, very careful. I just
thought I might use it to put the case for some exceptions.

Basically, I have a whole bunch of tasks to run, called say Task1,
Task2 etc. So in an ideal world, they could run as

 RunTask1();
 RunTask2();
 RunTask3();
 ...

However, I can't let multiple instances try and run these tasks in tandem,
so I put a lock in place:

 GrabLock();
 RunTask1();
 RunTask2();
 RunTask3();
 ...
 ReleaseLock();

The nasty thing then comes in that if any task fails, I have to stop. So I
create a convention that every task returns 1 for success, 0 for
failure. Tasks can also be nested. So this gives me a structure like
this:

 if ( ! GrabLock() )
 return 0;

 $retval = 0;
 switch(0){ default:

 if ( ! RunTask1() )
 break;

 if ( ! RunTask2() )
 break;

 if ( ! RunTask3() )
 break;

 $retval = 1;
 }

 ReleaseLock();
 return $retval;

This works, but it is cumbersome, you have to be VERY careful and there are
other complications in terms of reporting sensible error messages when
tasks are shared.

In Python, the code would be written like this:

 try:
 GrabLock();
 try:
 RunTask1();
 RunTask2();
 RunTask3();
 ...
 finally:
  ReleaseLock(); # If GrabLock runs without raising any
 # exceptions this will ALWAYS run
 except:
 # Gracefully handle any exceptions from GrabLock, RunTask1 etc...

which is an awful lot neater, and a lot safer, and can handle error
messages much more cleanly.


Anyway - this is just an example of why I think exceptions would be a really
cool thing to add to PHP.

Regs

Brian White








-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Why I wish PHP had Python's exception handling....

2001-10-21 Thread Brian White

If that happens it would be great.


At 00:33 22/10/2001 -0500, Matt McClanahan wrote:
On Mon, Oct 22, 2001 at 02:57:44PM +1000, Brian White wrote:

Preface to these ramblings: Exception handling is planned for the next
version of the Zend engine.  For details, see

http://www.zend.com/zend/future.php

  The nasty thing then comes in that if any task fails, I have to stop. So I
  create a convention that every task returns 1 for success, 0 for
  failure. Tasks can also be nested. So this gives me a structure like
  this:
 
   if ( ! GrabLock() )
   return 0;
 
   $retval = 0;
   switch(0){ default:
 
   if ( ! RunTask1() )
   break;
 
   if ( ! RunTask2() )
   break;
 
   if ( ! RunTask3() )
   break;
 
   $retval = 1;
   }
 
   ReleaseLock();
   return $retval;
 
  This works, but it is cumbersome, you have to be VERY careful and there are
  other complications in terms of reporting sensible error messages when
  tasks are shared.

This is probably no less messy, but it does allow you to handle an
arbitrary number of steps, possibly with arguments, without having to
add another if check as you're doing above.  This also lets you know
easilly which step failed:

?

function first($a)  { if ($a) return true; else return false; }
function second($a) { if ($a) return true; else return false; }
function third($a)  { if ($a) return true; else return false; }

function GrabLock() { echo Grabbing.\n; return true; }
function ReleaseLock() { echo Releasing.\n; return true; }

$ret = true;
$funcs = Array('first','second','third');
$args = Array(1,1,1);   // Change one to zero to trigger a failure

if (!GrabLock())
 return 0;

while ($ret = $funcs[0]($args[0]))
{
 array_shift($funcs);
 array_shift($args);
 if (!count($funcs)) break;
}

ReleaseLock();

if (count($funcs)) echo Failed at $funcs[0].\n;

?

Matt

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] check if file is already in use before fopen

2001-10-04 Thread Brian White

Check out the flock fucntion

At 16:20 4/10/2001 -0400, Jason Stechschulte wrote:
On Thu, Oct 04, 2001 at 11:10:56AM -0400, Matthew Luchak wrote:
  Is there a way to verify if a file is in use by another user before
  fopening it?

As far as I know this is something you have to program in yourself.  If
you are only worried about your programs accessing the file, then it is
a good idea to create a lock file.  Before you access a file called
mydata, check for a file called mydata.lock.  If that exists, then the
file is in use, so wait and check later.  If it does not exist, create a
file called mydata.lock, open mydata, do with it as you please, close
mydata, and delete mydata.lock.

You also have to be prepared to handle a situation where your program
stops before removing the lock file.  Usually with PHP, it is much
easier to just use a database so all this file locking is dealt with by
the database and not you.
--
Jason Stechschulte
[EMAIL PROTECTED]
--
Sorry.  My testing organization is either too small, or too large, depending
on how you look at it.  :-)
  -- Larry Wall in [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] 2D array from file

2001-09-26 Thread Brian White

I think this is not working because \t is a regular expression and explode
only works on strings..

Actually, I have no idea and I feeling very confused right now but maybe
try split and see how it goes.


Brian

At 13:37 26/09/2001 -0400, John Frenzel wrote:
I have created a 2D array, then written it into a tet file. The file is
written such that all the secondary array elements (the rows) are seperate
lines, with the columns tab-delimited. Now I'd like to read this file back
into a 2D array. I thought this should work:


$array_file = file (array.dat);
for ($k=0; $k = 63; $k++)
{
 $array[$k] = explode( \t, $array_file[$k] );
}

I know that $array[$k] is a valid variable, and that explode returns an
array, so I'm not clear why this isn't working. If I use $array = explode(
\t, $array_file[$k] ); I get the line without any trouble. What am I
missing?

Thanks

--- John Frenzel



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array_multisort

2001-09-26 Thread Brian White

Ok. As far as I can tell from your example - you have a single
multidimensional array. From my reading of array_multisort
it looks like it is supposed to sort multiple arrays that happen
to be the same length, which is a little different.

Conceptually, what I think you have is an array of records which
you want to sort by one of the elements in the record. What I think
you want is uasort, with something like:

function compare( $left, $right )
{
 return ( $left[keycount] - $right[keycount] );
}

uasort( $result, compare );


At 03:43 26/09/2001 -0700, Richard Baskett wrote:
Ok i've gone through the archives.. and you know.. I don't think anybody
really understands this function.  I hope I am wrong, but here goes.

I have an array called let's say.. $results
first dimension are just numbers
and the second has associative names [name],[title],[descript],[keycount] so
basically

$result[0][name]
$result[0][title]
$result[0][descript]
$result[0][keycount]

The first dimension goes up to hmm.. in the three digits and each has the
four other categories,  I want to sort $result by [keycount] which are all
numbers.

How the umm.. heck do you use that funky array_multisort function?

Rick


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Feature?

2001-09-25 Thread Brian White

Actually this is a feature of Python. It is VERY useful and I would be
ecstatic if it turned up in PHP.

Regs

Brian White

At 11:36 25/09/2001 +0300, Andrey Hristov wrote:
  After some days spent in a hospital reading Programming Perl and 
 Oracle Web Applications I found that a language construct
which appears in Perl and PL/SQL is not available in PHP.
As in most 3G languages function call is like that
$bar=foo($bar1,$bar2,$bar3,'bar4');

function foo($par1=1,$par2=2,$par3=3,$par4='foo_bar',...){
...
}
In the case when I've few parameters I've to remember their order, so why not
$bar=foo('par2'=10);
I want to pass value to only one or more but not to all params. Also this 
will make the code clearer I think.
Comments are welcome!

Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Going blind? Plz hlp w/ parse error

2001-09-19 Thread Brian White

At 00:34 20/09/2001 -0400, Anthony Rodriguez wrote:
Please help! There is a parse error in like 10:

?php

// file: root/reg/add_2.php, updated: 08/25/01

$connection=@mysql_connect(localhost,afrodriguez,xxx) or die (No 
connection!);

$db=@mysql_select_db(sbwresearch,$connection) or die (No database!);

$qry_1=select * from cust_info where username=\$username\;

$result=@mysql_query($qry_1,$connection) or die (No query # 1!);

$row_1=@mysql_affected_rows();

if ($row_1==0)

{

   $qry_2=insert into cust_info (username,password,mother) values 
 ($username,$password,$mother) or die (No query #2!);

   $result=@mysql_query($qry_2,$connection);

You've got all muddled up . perhaps:

   $qry_2=insert into cust_info (username,password,mother) values 
(\$username\,\$password\,\$mother
);

   $result=@mysql_query($qry_2,$connection) or die (No query #2!);



   @mysql_free_result($result);

   @mysql_close($connection);

   echo 

   html

   etc.

Thank you!


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] I beleive I have found a bug.....

2001-08-29 Thread Brian White

Renze Munnik said:
I don't _think_ this is a bug (note: think). I haven't taken a very
good look at your code, but as I understand you believe that:

   foreach ($data as $key)

delivers the same $key as in:

   foreach ($data as $key=$value)

You didn't read my code closely enough:

I said:
  If I replace the problem line
   foreach ( array_keys($data) as $key2 )
 ^^
  with the alternate
   foreach ( $data as $key2=$val2 )


At 09:54 29/08/2001 +0200, * RzE: wrote:
Original message
From: Brian White [EMAIL PROTECTED]
Date: Wed, Aug 29, 2001 at 04:01:06PM +1000
Message-ID: [EMAIL PROTECTED]
Subject: [PHP] I beleive I have found a bug.

  ... I just thought I would see if anyone else can reproduce it!
 
  Ok. The problem is in the following snippet of code. ( Note : this exmaple
  is extremely contrived, and is the essence of a much more complicated
  situation involving a function call from a class method... )
 
  ?php
   $data = array( A = AA , B = BB, C= CC, D= DD, E
  = EE );
 
   print pre\n;
   foreach ( $data as $key1=$val1 )
   {
  //foreach ( $data as $key2=$val2 )
   foreach ( array_keys($data) as $key2 )   // = PROBLEM IS HERE
   {
   if ( $key1 == $key2 )
   print b$key2/b;
   else
   print $key2;
 
   print   ;
   }
   print \n;
   }
 
   print /pre;
  ?
 
  I beleive it should generate
  pre
  bA/b  B  C  D  E
  A  bB/b  C  D  E
  A  B  bC/b  D  E
  A  B  C  bD/b  E
  A  B  C  D  bE/b
  /pre
 
  Instead it generates
  pre
  bA/b  B  C  D  E
  /pre
 
  If I replace the problem line
   foreach ( array_keys($data) as $key2 )
 
  with the alternate
   foreach ( $data as $key2=$val2 )
 
  then it works fine.
 
  I am using PHP 4.0.4pl1.
 
 
  Regs
 
  Brian White
 
  -
  Brian White
  Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
  Phone: +612-93197901
  Web:   http://www.steptwo.com.au/
  Email: [EMAIL PROTECTED]
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

/Original message

Reply

Hai Brain,

I don't _think_ this is a bug (note: think). I haven't taken a very
good look at your code, but as I understand you believe that:

   foreach ($data as $key)

delivers the same $key as in:

   foreach ($data as $key=$value)

Well... it doesn't. Check the manual on it. If you use the
foreach ($x as $y) construction, $y is the value... not the key.
Take a look at:

http://www.php.net/manual/en/control-structures.foreach.php

Quote from PHP manual
foreach(array_expression as $value)
foreach(array_expression as $key = $value)
/Quote from PHP manual

I think this solves your problem...

/Reply

--

* RzE:


-- 
-- Renze Munnik
-- DataLink BV
--
-- E: [EMAIL PROTECTED]
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM  HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] I beleive I have found a bug.....

2001-08-28 Thread Brian White

... I just thought I would see if anyone else can reproduce it!

Ok. The problem is in the following snippet of code. ( Note : this exmaple
is extremely contrived, and is the essence of a much more complicated
situation involving a function call from a class method... )

?php
 $data = array( A = AA , B = BB, C= CC, D= DD, E 
= EE );

 print pre\n;
 foreach ( $data as $key1=$val1 )
 {
//foreach ( $data as $key2=$val2 )
 foreach ( array_keys($data) as $key2 )   // = PROBLEM IS HERE
 {
 if ( $key1 == $key2 )
 print b$key2/b;
 else
 print $key2;

 print   ;
 }
 print \n;
 }

 print /pre;
?

I beleive it should generate
pre
bA/b  B  C  D  E
A  bB/b  C  D  E
A  B  bC/b  D  E
A  B  C  bD/b  E
A  B  C  D  bE/b
/pre

Instead it generates
pre
bA/b  B  C  D  E
/pre

If I replace the problem line
 foreach ( array_keys($data) as $key2 )

with the alternate
 foreach ( $data as $key2=$val2 )

then it works fine.

I am using PHP 4.0.4pl1.


Regs

Brian White

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Unable to use fopen to read a URL - DNS Problem?

2001-08-21 Thread Brian White

This is a repost.

To summarise: My installtion of PHP is unable to resolve names. I can't use 
fopen
   to open a URL which uses a name, but if I manually calculate 
the IP
   address, I can read in the page OK. ( see example below ).

I need some tips on where to start looking to solve this problem.

If it helps, my config options when I built PHP were:

--with-gd=/usr/local/src/gd-1.8.4/
--enable-gd-imgstrttf
--with-ttf=/usr/local/freetype/
--enable-calendar
--disable-short-tags
--with-mysql=/usr/local/mysql/
--with-jpeg-dir=/usr/local/src/jpeg-6b/
--with-apxs=/usr/local/apache/bin/apxs

and I am running PHP 4.0.4pl1 under Debian Potato Linux and Apache 1.3

Regs

Brian White

At 16:28 14/08/2001 +1000, Brian White wrote:
The following code:

$url = http://www.php.net/;;
print ( implode( , file( $url ) ));

causes my browser to sit and twiddle it's thumbs for ages and then produce:

 Warning: file(http://www.php.net/;) - Bad file descriptor in 
 myfile.php on line 33

 Warning: Bad arguments to implode() in myfile.php on line 33

If, however, I explictly use the IP address:

 $url = http://208.247.106.187/;;
 print ( implode( , file( $url ) ));

it will successfully dump a copy of the php front page.

This says to me that PHP can't resolve names. It is not a problem
with the linux box it's running on, given that I ran ping www.php.net
on that particular box to find the IP address.

Can anyone tell me what I need to do to make it work?

Regs

Brian White
-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Using fopen to read a URL - DNS Problem?

2001-08-14 Thread Brian White

The following code:

$url = http://www.php.net/;;
print ( implode( , file( $url ) ));

causes my browser to sit and twiddle it's thumbs for ages and then produce:

 Warning: file(http://www.php.net/;) - Bad file descriptor in 
myfile.php on line 33

 Warning: Bad arguments to implode() in myfile.php on line 33

If, however, I explictly use the IP address:

 $url = http://208.247.106.187/;;
 print ( implode( , file( $url ) ));

it will successfully dump a copy of the php front page.

This says to me that PHP can't resolve names. It is not a problem
with the linux box it's running on, given that I ran ping www.php.net
on that particular box to find the IP address.

Can anyone tell me what I need to do to make it work?

Regs

Brian White
-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Oh and one more thing

2001-08-03 Thread Brian White


Ditto!

At 13:27 2/08/2001 -0400, Jeff Lewis wrote:
Ok, I have to admit, that made me laugh out loud here in the office :)

Jeff
- Original Message -
From: scott [gts] [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Thursday, August 02, 2001 1:05 PM
Subject: RE: [PHP] Oh and one more thing


  it's a little bit complicated, but here goes.
 
  1) format your harddrive
  2) take out your motherboard and spraypaint it
  bright orange.
  3) dance around the desk three times holding the
  motherboard above your head chanting
  mail mail, give me mail
  date date, give me date
  ga booga woooga shooga
  4) install linux
  5) install apache
  6) install PHP
 
 
   -Original Message-
   From: Kyle Smith [mailto:[EMAIL PROTECTED]]
   Sent: Thursday, August 02, 2001 8:45 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] Oh and one more thing
  
  
   How do i set up extra functions on my computer like mail() and
date()
  
  
   -lk6-
   http://www.StupeedStudios.f2s.com
   Home of the burning lego man!
  
   ICQ: 115852509
   MSN: [EMAIL PROTECTED]
   AIM: legokiller666
  
  
  
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: FAQ

2001-08-02 Thread Brian White

If I am talking to other geeky types I explain the full history of 
Personal Home
Page outgrowing it's name to become PHP: Hypertext Processor , recursive 
like
GNU ete. etc.

If I am talking to non geeky types, and they bother to ask, I go with 
Professional
Hypertext Processor.

Brian


At 22:54 1/08/2001 -0700, Rasmus Lerdorf wrote:
   PHP Hypertext Preprocessor.
 
  Which does not explain the php

Sure it does - look in the titlebar of your browser when you go to
http://php.net

-Rasmus


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] in_array() with associate array?

2001-07-31 Thread Brian White

in_array is for testing that a value exists in an array. What you want is

if ( isset( $some_array[some_key] ) )
print HAS KEY;
else
print DOESN'T HAVE KEY;


At 14:23 31/07/2001 -0400, Jaxon wrote:
hi,

in_array is confusing me :)

can someone show me an example of how to test if

$some_array[some_key]

actually has a value, without outputting the value?

tia,
jaxon


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Java Jock - 1st line syntax

2001-07-31 Thread Brian White

Well, maybe the code is all on one line!

I remember another time when I was getting all the errors being on one line
when validating SGML documents. It turned out that the problem was that they
had been created on a Mac, and the validator was getting confused by only
only having Ctrl-M for a line break instead of Ctrl-J or Ctrl-M,Ctrl-J.

Maybe worth a look

Brian

At 16:05 31/07/2001 +0100, Greg Fyans wrote:

you got an example you can show us

--
Greg Fyans
www.syntonik.co.uk


  I recently just started using PHP. I searched this list's archives first,
  but couldn't find an answer to my question:
 
  Whenever I get a syntax error it's always reported on line 1, even
  when it's obviously not on line 1. I *never* get an error reported on any
  other line #.
 
  Any thoughts on this?
 
  Thanks!



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Global Variables - Local Scope

2001-07-29 Thread Brian White

Well, you could try:

extract( $GLOBALS )

inside a function - that might work..

At 22:14 26/07/2001 -0400, [EMAIL PROTECTED] wrote:
How can I read in all of the global variables and give them local
scope?  PLEASE HELP ME.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Newbie Help (CLASS WAR!)

2001-07-26 Thread Brian White


I use classes a lot and don't have this problem. This is because
the names of the class ( and thus the constructor name ) tends to be a noun
and otherfunctions tend to be verbs, so I am don't have this kind of clash.

I am VERY glad that PHP has classes and I use them alot.

However 

rant_mode

My biggest bug-bear with classes in PHP is the lack of a super operator
There are times when I would really like to be able to do:

class A
{
 function DoStuff()
 {
.
 }
}

class B extends A
{
 function DoStuff()
 {
.
$super-DoStuff(); // Calls the function in A
 }
}

A super operator could allow a fixed name constructor ( like the 
__new__ in Python )
and the parent constructor could be called using super, which would 
eliminate
Matthew's problem.

/rant_mode


At 08:47 26/07/2001 +0800, Matthew Schubert wrote:
I was reading through the PHP manual and got to the section on constructors.

snip

class A {
   function A() {
 echo I am the constructor of A.br\n;
   }

   function B() {
 echo I am a regular function named B in class A.br\n;
 echo I am not a constructor in A.br\n;
   }
}

class B extends A {
   function C() {
 echo I am a regular function.br\n;
   }
}

// This will call B() as a constructor.
$b = new B;




In PHP 3, the function B() in class A will suddenly become a constructor in
class B, although it was never intended to be. The rule in PHP 3 is: 'A
constructor is a function of the same name as the class.'. PHP 3 does not
care if the function is being defined in class B, or if it has been
inherited.

This is fixed in PHP 4 by modifying the rule to: 'A constructor is a
function of the same name as the class it is being defined in.'. Thus in PHP
4, the class B would have no constructor function of its own and the
constructor of the base class would have been called, printing 'I am the
constructor of A.br'.
/snip

It says that when a new class B was made, that the class B would have no
constructor, because the function B() was in the base class. Instead the
class B was supposed to derive it's constructor from class A and output 'I
am the constructor of A.br'

When I tried this script, this did not happen and the Function B() was
called as the constructor of class B, even though the function was in the
base class...can anyone help to clear up this matter?
thanx




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] parser outside of web tree. whats the trick?

2001-07-26 Thread Brian White

What this sounds like to me is that as well as having a PHP binary, that
PHP is installed as a module in your web server.

For whatever reason ( more than likely, the file extension ) the web server
is NOT executing it as a CGI itself, but passing it to the PHP module to
deal with. That is just treating the #! line as text and passing it
out to the browser.

You need to figure out what is going on and pick one way to do it.

Brian

At 22:41 25/07/2001 -0400, Darren Henderson wrote:

If I have php installed as an executable outside the web tree I can't seem
to get php scripts, called as a cgi, to work correctly. When run from the
command line this script

-
#!/usr/local/bin/php
?php echo hello world\n; ?
-

Produces

-
X-Powered-By: PHP/4.0.4pl1
Content-type: text/html

hello world
-

Just as expected. However, when called from a browser it ends up getting

-
#!/usr/local/bin/php
hello world
-

when we view the source with a browser. If we telnet to port 80 and do a get
for the url in question we find that the above is all that we get, no
headers of any kind.

If we add a -q the #! line we get the behavior we expect from the command
line, the headers are supresed, but the browser ends up getting No input
file specified. sans headers or any html tags.

Why am I seeing this behavior? I would expect the script the produce the
exact same output whether it is called via the command line or as a cgi
outside the web tree. I had thought that perhaps it was a system dependent
bug, however, I am seeing this same behavior on several machines, AIX 4.2
running 4.06, FreeBSD 4.3 running 4.0.4.pl1, and I've found similar reports
in the bug db for HP/UX etc.

So... this leads me to believe I must be missing something somewhere
anyone have any thoughts?

How do I supress the printing of the #! line? It has to be in col 1 row 1,
if it wasn't for that I could manually enter the headers at least and
continue on my way, Where did the headers go? if I use the -q option to
purposely turn off headers, I could provide my own, but if I have that
option it tells me that there is no input file specified if its not invoked
from the command line.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Query String Name ?

2001-07-26 Thread Brian White

In PHP, if you set the input fields to be array names then all the results 
get put in an
array:

So: test.php?name[]=joename[]=bob

would create an array(joe, bob ) in PHP.

If you really can't set it in the form you could access the QUERY_STRING 
environment
variable and parse it directly.

At 11:14 26/07/2001 +0100, A wrote:
Hi there,

is there any way to access two variables in a query string that have the 
same name e.g

test.php?name=joename=bob

Is there any way to extract both values of name without changing the way 
the query string is created?


Thanks,
Abe

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Opening another page in code (PROPOSED FAQ)

2001-07-25 Thread Brian White

I have seen this question alot recently. Maybe it is time for an FAQ. Maybe 
somebody
else would like to have an attempt at wording this better:

Q: (7.15?) I want to use the header function to do something like a 
redirect, but I keep
getting messages about the headers having already been sent.

A:  The headers are sent to the browser just before the first piece of content
 is sent. Content is
a) Any text generated by a PHP output function ( such as print or 
echo )
b) Any text before, after or between the ?php ... ? blocks.

 The usual reason to get this error message, when you would swear blind 
you
 aren't outputting anything yet, is white space before outside of the code
 blocks. Eg:

   ?php require(user_logging.inc) ?

   ?php header (Content-Type: audio/x-pn-realaudio); ?
   // Broken, Note the blank lines above will be treated as
   // content and cause the headers to be sent

 If you changed the above code to

   ?php
 require(user_logging.inc);
 header (Content-Type: audio/x-pn-realaudio);
   ?

 and still got the error, then that probably means extra white-space
 somewhere in user_logging.inc




At 07:30 25/07/2001 -0600, Nelson Goforth wrote:
This seems simple, but for some reason I can't find what I'm looking for 
in books or the archive.  Might just be looking for the wrong words.

I just want to open another page, sending some parameters, at a point in a 
script - without the user clicking on anything (I can do this in a form - 
I want to do it WITHOUT the form).

Like:if($test) {
   GO_TO_PAGE (http://www.site.dom/page.php?id=838383);
  }

Except with code that actually works, of course.

I tried header (Location:...) but got an error message that I can't add 
to the headers.

What have I missed?

Thanks,
Nelson
--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] When did this become the advertising Mailing List

2001-07-24 Thread Brian White

It happens alot. Just sigh a little and delete it.

I always think of it as a very quick email to deal with out of the 180
I get each day


At 17:33 23/07/2001 +1000, ReDucTor wrote:
When?!?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Hack on Server.

2001-07-19 Thread Brian White

Maybe the hacker got into the httpd.conf and set the auto-prepend setting
to a file that contained the message.

Brian

At 00:34 20/07/2001 +0300, [EMAIL PROTECTED] wrote:
Hi Jean-Francois!
On Thu, 19 Jul 2001, Jean-Francois Jauvin wrote:

  Hi, my server with php on it has been hacked or something., what
  appened is every PHP pages displayed a certain message like Hacked by blah
  blah blah
  None of the HTML pages were affected, only the PHP ones
  but the scripts were not altered, I've shut down IIS,  reinstalled PHP, and
Ah, IIS, the magic word.

Maybe you have  been hacked by the Bady worm, I saw it in action in the
test lab :)

-- teodor

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] explode()

2001-07-16 Thread Brian White

$arr = explode(-,$row[5]); $reqmonth=$arr[1];

Well, it's all on one line.


At 16:23 16/07/2001 -0700, Adam Plocher wrote:
$reqmonth = ${}[1];

Is there anyway I can get that to work without having to use multiple lines
of code?

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] email counter

2001-07-16 Thread Brian White

How about changing link to

a href=mymailer.php?[EMAIL PROTECTED] Big George /a

Where mymailer.php is something like

?php
/*
Do whatever it is you need to do with $email
  */

header(Location: mailto:$email; );

?

( Now watch me get shot down for saying something silly  )


At 09:30 17/07/2001 -0500, Jack wrote:
Dear people,
I have an email link on my page like this
a href=mailto:[EMAIL PROTECTED]; Big George /a
and I want to know how may people click on on this particular link to keep 
the record, may be insert this record into a table as well ( but don't 
erally have to) Is there any technique at all to achieve this?
Jack
[EMAIL PROTECTED]
Love your enemies, it will drive them nuts

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] replacing part of string with values in array

2001-07-12 Thread Brian White

Shoot from the hip response... untested

function resolveParts( $str, $partsArray )
{
 // explode the original $str based on 'PART'
 $stringBits = explode( 'PART', $str );

 //Ok. So now we have two arrays. The length of partsArray
 // should be one less than stringBits

 $blended = array( array_shift( $stringBits ));

 while ( $stringBits )
 {
 $blended[] = array_shift( $partsArray );
 $blended[] = array_shift( $stringBits );
 }

 return implode( $blended,  );
}






At 01:30 13/07/2001 +0200, Gregor Jaksa wrote:
hello,

ok heres the thing ;)
lets say i have array(part1, part2, part3, part4);
now i have string like
$string = here's PART and heres PART, another PART here and final PART
here;
now i wanna replace first PART in string with part1 from array and second
PART with part2 from array ...
one more thing is that i dont know how many parts there will be in string ..
but i know that array and string will have the same number of parts ;)

help plz :)



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Strong typing?

2001-07-12 Thread Brian White

U... you could write a fuction like

function CheckInputAgainstRE( $val, $re )
{
 if ( ! ereg( $re, $val ) )
 {
 ( ... some kind of code that writes out an error message and dies 
... )
 }
 return $val;
}

and then a series of functions like

function CheckInt( $val )
{
 return (integer)CheckInputAgainstRE( $val, ^-?[0-9]+$ );
}

which you could then use as your input protection

Would that help?

Brian

At 23:55 12/07/2001 +, Dr. Evil wrote:

PHP is a great language.  It makes it fast and easy to create web
pages.  However, one feature which is critical for doing rock-solid
stable websites is strong typing.  The reason for this is that you're
dealing with untrusted user input.  Strong typing helps because if you
are expecting an INT, and the user gave you something else, and you
made a mistake in your input checking, the program will fail when you
attempt to assign the value to the strongly-type INT variable.  This
is a good thing when you are dealing with money, or other contexts
where you need very solid code.

First, is there a plan to introduce a strong typing option, like
perl's strict mode?

Second, is there a way to get something equivalent to strong typing
using the class system?

Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] The need for strong typing...

2001-07-12 Thread Brian White
and safety.  Strong typing is one of those contraints.

This doesn't mean that PHP should be changed to allow strong typing.
It may mean though that PHP isn't the right language for rigorous
applications like financial transactions.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] .htaccess php_value

2001-07-11 Thread Brian White

I am still learning about .htaccess files - what you suggested could be useful
to me.

The approach I have taken is to use the auto_prepend feature, namely

php_value auto_prepend_file /path/to/autoprepend.php

This is then a single hook, and the contents of autoprepend.php
can then be as complex as you like.

Regs

Brian


At 11:33 11/07/2001 -0700, Aaron Bennett wrote:
Hi There,
   I currently use .htaccess files to override the include path, which works
great for me... One of my concerns was the portability of the code, and the
possibility of not having control of http.conf

I'm now in the process of porting some of the sites onto a winnt architecure
(but still using apache as my webserver...). The contents of some of these
.htaccess files looks simelar to:

php_value include_path
.:/home/www/htdocs/php-lib:/home/www/htdocs/includes

unfortunatly, apache for windows would prefer the format somewhat like:

php_value include_path .;c:\web\site\php-lib;c:\php\whatever\includes

(note the use of ';' rather than ':' as well)

So my question, is whats the best way to make the site's as portable as can
be? I assume that i could go thru _all_ the code and make include references
relative rather than relying on the config to find include()'s Any
suggestions?

--
Aaron Bennett
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] stripping white space?

2001-07-10 Thread Brian White
://www.geocities.com/mimodit
*

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] using image place holders in a database field?

2001-07-10 Thread Brian White

I am going to take this sideways and push my own agenda.  :-)

In your position, I would consider storing the newsletter text
as blobs of XML. Keep it dead simple to start with:

!ELEMENT blob  (p+) 
!ELEMENT p  (#PCDATA|img) 
!ELEMENT img   (#PCDATA) 

which would make your article text:

blobpthe article text imgimage_name/img some more article 
text/p/blob

and you could then use eregi_replace to turn into HTML:

$text = blobpthe article text imgimage_name/img some more article 
text/p/blob;

// Remove the blob tags
$text = eregi_replace( [\/]?blob,  , , $text );
// Resolve the image element
$text = eregi_replace(img([^#]+)/img, img src=\\\1\, $text)

Disadvantages:
   * A little more complex up front

Advantages:
   * You have given yourself room to move if you need to start expanding on 
what
 you can do with inline markers

At 15:38 11/07/2001 +1200, Matthew Delmarter wrote:
Hi all,

I want to use image place holders in a mysql field. The field will store a
newsletter article and I want to include and display an image in the
article.

For example I will have:
the article text ##image_name## some more article text.

I will use str_replace to replace ##image_name## with the html tag to
display such as img src='/images/image_name'.

But - I don't know how to write the str_replace! Can anyone help?

Also, is there are better way to do this?? Can I have images displayed in
the middle of text from a field some other way?

I also cannot seem to find much on using place holders in a field - but I
can see it's advantages.

I hope this all makes sense...

Regards,

Matthew Delmarter


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Global Variables -- why not have them?

2001-07-08 Thread Brian White

At 20:13 8/07/2001 -0500, Mark Charette wrote:
  I dislike the GLOBAL statement in that many of the bugs that get me
  scratching my
  head are to do with when I have forgotten to use it.

Then you're probably using it way too often.

It is usually for SCRIPT_NAME, or one of the CGI parameters.

The CGI parameters are arguable, but I pretty much consider SCRIPT_NAME to be
a global constant.

Brian
-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Need help with timestamp....

2001-07-05 Thread Brian White

As I understand it,
* strftime takes a format string and an integer timestamp and returns a 
date string
* date takes a different type of format string and an integer timestamp 
and returns a date string

In both cases they default to using the timestamp for the current time.

SO: what you code is doing is
1) Calculating a date string using date based on the current time
2) Passing that string to strfttime at a point where it is expecting an integer
timestamp, and that is being interpreted as 0 or -1 ( not sure which )

Maybe just:

define('SUB_BAR_TITLE', strftime(DATE_FORMAT_LONG));


At 20:46 5/07/2001 -0400, JustinS wrote:
I want to stamp the CURRENT time on my page...

as of right now it's reading

==

Wednesday 31 December, 1969

==

i assume im not doing something correctly...

the following is how i have the line written atm

define('SUB_BAR_TITLE', strftime(DATE_FORMAT_LONG, (date (F d, Y h:i:s 
A;

no, i did not write this script, which is the reason i dunno what the heck 
im doing -- im curious if anyone has some insight on the problem

Thanks in advance.


-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: changing to a different file in browser

2001-07-05 Thread Brian White
cribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-----
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Re: changing to a different file in browser

2001-07-05 Thread Brian White

You didn't quite get what I meant - in login.php, you have two lumps
of PHP code ( lump being ?PHP ... ? ) separated by a little bit of white
space. That little bit of white-space BETWEEN the lumps is what is causing
your problems.

Reduce it down to one lump and try again.

Ie:

login.php:
?PHP
session_start();

// ? ... ?PHP removed from here

// Connect to the database
   $db = mysql_connect(localhost, user, pass);
   if( !$db )die (Couldnt connect to server, try again soon. );

( ... remainder of login.php ...)



At 14:20 6/07/2001 +1000, Brad Wright wrote:


i'm not sure which file you meant but i took out all whityespace , hence:


login.php:
***
?PHP session_start();?
?PHP
// Connect to the database
   $db = mysql_connect(localhost, user, pass);
   if( !$db ) die (Couldnt connect to server, try again soon..);
// Select Database
mysql_select_db(LoginDB, $db) or die (Couldn't connect  to database);
// Query Database table
$query = select * from Admin_Login_TB where teamLogin = '$teamLogin' 
teamPass = '$teamPass'  ;
$result = mysql_query($query,$db);
// LIst the matching row values
list ($teamLogin, $teamPass, $teamNo)=mysql_fetch_row($result);
// Test to see if a match was found
// If not: the die
// if match found then continue
if (!mysql_numrows($result) ) {
die ( username/password not valid);
}
else{
header(Location: adminMenu.php);
exit; }
?
***

menu.php:
**
?PHP session_start();?
**

I still get the same error..



any ideas???


cheers,
brad
  From: Brian White [EMAIL PROTECTED]
  Date: Fri, 06 Jul 2001 13:59:45 +1000
  To: Brad Wright [EMAIL PROTECTED], PHP General List
  [EMAIL PROTECTED]
  Subject: Re: [PHP] Re: changing to a different file in browser
 
  At 13:36 6/07/2001 +1000, Brad Wright wrote:
  I'm sure there is something REALLY simple Im missing here below is the
  ...
 
  OK. I think your problem is here. Between the first ? and the second
  ?PHP
  is a piece of white-space. This is treated by PHP as text, which 
 triggers it
  to
  send the headers, before sending off the encountered text.
 
  Try making removing them and see what happens.
 
  login.php:
  ?PHP
  session_start();
  ?
  ?PHP
 
  // Connect to the database
  $db = mysql_connect(localhost, user, pass);
  if( !$db )die (Couldnt connect to server, try again soon. );
 
  // Select Database
 
  mysql_select_db(LoginDB, $db) or die (Couldn't connect  to the 
 database,
  sorry.);
 
  // Query Database table
  $query = select * from Admin_Login_TB where teamLogin = '$teamLogin' 
  teamPass = '$teamPass'  ;
  $result = mysql_query($query,$db);
 
  // LIst the matching row values
  list ($teamLogin, $teamPass, $teamNo)=mysql_fetch_row($result);
 
 
 
 
  // Test to see if a match was found
  // If not: then die
  // if match found then continue
 
  if (!mysql_numrows($result) ) {
  die ( username/password not valid);
  }
  else{
  header(Location: menu.php);
  exit;  }
  ?
 
 
  *
 
  menu.php
  ?PHP session_start();
  ?
  test
  
 
  I hope you can see a glareingly obvious problem that i can't
 
  Cheers,
  Brad
 
  From: ..s.c.o.t.t.. [EMAIL PROTECTED]
  Date: Thu, 5 Jul 2001 23:13:09 -0700
  To: Php-General [EMAIL PROTECTED]
  Subject: RE: [PHP] Re: changing to a different file in browser
 
  even a blank line at the end of a file that you're
  include()ing will break header.
 
  you could use output buffering, but i dont think
  you really want to go to all that trouble for a simple
  redirect  :)
 
  -Original Message-
  From: Chris Anderson [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, July 05, 2001 19:47
  To: Brad Wright; PHP General List
  Subject: Re: [PHP] Re: changing to a different file in browser
 
 
  If you use Header after ANY page output, even a space, it will not work
  - Original Message -
  From: Brad Wright [EMAIL PROTECTED]
  To: PHP General List [EMAIL PROTECTED]
  Sent: Thursday, July 05, 2001 10:25 PM
  Subject: Re: [PHP] Re: changing to a different file in browser
 
 
  tried it, but it didn't work... still getting the same message in 
 IE. Am I
  missing something? Can I actually use the headr() function to redirect
  to a
  different page while using sesions and session variables??
 
  From: ..s.c.o.t.t.. [EMAIL PROTECTED]
  Date: Thu, 5 Jul 2001 22:32:22 -0700
  To: Php-General [EMAIL PROTECTED]
  Subject: RE: [PHP] Re: changing to a different file in browser
 
  put Location before the URL:
 
  header(Location: http://server.com/file.php;);
  or
  header(Location: ./file.php);
 
 
  -Original Message-
  From: Brad Wright [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, July 05, 2001 18:54
  To: PHP General List
  Subject: Re: [PHP] Re: changing to a different file in browser
 
 
  ihave tried the header() function

RE: [PHP] Security of PHP code

2001-07-04 Thread Brian White


Possibilities for improving security on a sourec displayer.

1) Maybe you could restrict your source shower to only look at
particular types of files - maybe the file has to end in .php
or .inc before it is even considered.

2) Given that something that displays the source needs to read the file,
maybe it could just look for some kind of marker that would
have to appear within the first N lines of a file, otherwise it
would be rejected. For example, every file that could be displayed
might need to look like this:

?php
   //DISPLAYABLE
...


At 16:54 4/07/2001 +0100, Jon Haworth wrote:
Yes, I would have thought this would do it:

if (strstr($file, /usr/local/apache/htdocs/) {
 show_source($file);
} else {
 echo File must be in /usr/local/apache/htdocs!;
}

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Function Reqest/Question

2001-07-03 Thread Brian White


Personally, I kind of like:

switch(1){ default: // BREAK BLOCK START

blah blah blah...

// Want to get out of here...
break;

} // BREAK BLOCK END

It's a little more cumbersome than the while construct, but it is absolutely
guaranteed to only go through once, whilst the while version you HAVE to
rememeber to put in the closing break, otherwise you risk an infinite
loop.

At 16:25 2/07/2001 -0400, Matthew Loff wrote:

The best way I've seen this done is:

?php
while(0)

( ... and it should be while(1)  )

{
 blah blah blah...

 // Want to get out of here...
 break;
}
?

But putting it within while(0), you can simply break; from it...

There may be better ways... Any other suggestions?

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] configuring with gd for TTF

2001-07-03 Thread Brian White

I completely gave up trying to compile freetype 2.x into GD. However
I was able to successfully compile freetype 1.3 directly into PHP
which seems to work fine.

IE:
forget trying to use:
  --enable-gd-native-ttf

instead:
  --with-ttf=/usr/local/freetype/

which assumes you have freetype 1.3 installed to  /usr/local/freetype


BTW  - I have my own question. To restart apache at the moment I have to set
and export:

 LD_LIBRARY_PATH=/usr/local/freetype/lib/

Anyone know what I need to do to get this recognised by Apache internally.
( I am running Debian Linux Potato )

Regs

Brian White


At 08:50 3/07/2001 +0200, Ray Hilton wrote:
I'm having all sorts of headaches trying to get TTF support in gd to
work.  I have compiled from scratch gd 1.8 with ttf support by way of
freetype 2, this compiles fine.  Then I compile php using the configure
statement below and all I get when I try and call a TTF function is:

Warning: libgd was not built with TrueType font support in
/home/ray/webroot/rayh/htdocs/gfx/image.php on line 48

Etc etc...  Can anyone point me in the right direction?  Am I right in
thinking that you can either use gd's native ttf support or compile
freetype into php seperatley?

./configure  --with-xml --with-dom --with-mysql=/usr/local/mysql
--with-apxs=/usr/local/apache/bin/apxs --with-sablot
--with-openssl=/usr/local/ssl --with-zlib --with-ttf=no --with-gd
--enable-shared-pdflib --with-imap --with-t1lib=/usr/local/lib/
--with-jpeg-dir=/usr/lib/ --with-freetype-dir=/usr/local/lib/
--enable-gd-native-tt


Cheers,
Ray Hilton
-
[EMAIL PROTECTED]
http://rayh.co.uk



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] configuring with gd for TTF

2001-07-03 Thread Brian White

Ok.  Well, given mine works, I thought I would tell you what I have!

My phpinfo says exactly the same:

GD Support enabled
GD Version 1.6.2 or higher
FreeType Support enabled
FreeType Linkage with TTF library
JPG Support enabled
PNG Support enabled
WBMP Support enabled

My configure options were:

./configure --with-gd=/usr/local/src/gd-1.8.4/
   --enable-gd-imgstrttf
   --with-ttf=/usr/local/freetype/
   --enable-calendar
   --disable-short-tags
   --with-mysql=/usr/local/mysql/
   --with-jpeg-dir=/usr/local/src/jpeg-6b/
   --with-apxs=/usr/local/apache/bin/apxs

gd-1.8.4 is actually compiled ( theoretically ) with freetype2.x support, 
though that
shouldn't be making any difference, I would have thought. Freetype is 1.3.

Also, whenever I configured and then compiled I always deleted config.cache 
and ran
make clean first.

Hope this helps.

Brian


At 09:36 3/07/2001 +0200, Ray Hilton wrote:
Nope, not a sausage, I tried it with and without gd's ttf, specifiying
to compile in freetype 1.x, or freetype 2, and numerous other
combinations... Its doing my nut in!!

I think the lib thing your talking about is just a matter of sticking
the path in /etc/ld.so.conf and then running ldconfig...

I just recompiled php, and according to php info:

GD Support enabled
GD Version 1.6.2 or higher
FreeType Support enabled
FreeType Linkage with freetype
T1Lib Support enabled
JPG Support enabled
WBMP Support enabled

Which is exactly the same as it was 10 compiles ago... And yet I still
get:

Warning: libgd was not built with TrueType font support in
/home/ray/webroot/rayh/htdocs/gfx/image.php on line 48

Every single time...

Ray Hilton
-
[EMAIL PROTECTED]
http://rayh.co.uk

-Original Message-
From: Brian White [mailto:[EMAIL PROTECTED]]
Sent: 03 July 2001 09:08
To: Ray Hilton; 'PHP Mailing List'
Subject: Re: [PHP] configuring with gd for TTF


I completely gave up trying to compile freetype 2.x into GD. However I
was able to successfully compile freetype 1.3 directly into PHP which
seems to work fine.

IE:
 forget trying to use:
   --enable-gd-native-ttf

 instead:
   --with-ttf=/usr/local/freetype/

 which assumes you have freetype 1.3 installed to
/usr/local/freetype


BTW  - I have my own question. To restart apache at the moment I have to
set and export:

  LD_LIBRARY_PATH=/usr/local/freetype/lib/

Anyone know what I need to do to get this recognised by Apache
internally. ( I am running Debian Linux Potato )

Regs

Brian White


At 08:50 3/07/2001 +0200, Ray Hilton wrote:
 I'm having all sorts of headaches trying to get TTF support in gd to
 work.  I have compiled from scratch gd 1.8 with ttf support by way of
 freetype 2, this compiles fine.  Then I compile php using the configure

 statement below and all I get when I try and call a TTF function is:
 
 Warning: libgd was not built with TrueType font support in
 /home/ray/webroot/rayh/htdocs/gfx/image.php on line 48
 
 Etc etc...  Can anyone point me in the right direction?  Am I right in
 thinking that you can either use gd's native ttf support or compile
 freetype into php seperatley?
 
 ./configure  --with-xml --with-dom --with-mysql=/usr/local/mysql
 --with-apxs=/usr/local/apache/bin/apxs --with-sablot
 --with-openssl=/usr/local/ssl --with-zlib --with-ttf=no --with-gd
 --enable-shared-pdflib --with-imap --with-t1lib=/usr/local/lib/
 --with-jpeg-dir=/usr/lib/ --with-freetype-dir=/usr/local/lib/
 --enable-gd-native-tt
 
 
 Cheers,
 Ray Hilton
 -
 [EMAIL PROTECTED]
 http://rayh.co.uk
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED] To
 contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] HTML book recommendation

2001-03-08 Thread Brian White

I "learnt" SGML long before I learnt HTML, so all I've ever needed is a
a good reference.

So: I think the O'Reilly Koala Book is excellent because it is well
indexed and has useful lists of what elements there are, what attributes
they have, what values they can have etc.

However, I am not really in a position to judge how good it is to "learn"
from.

Regs

Brian White


  This is a bit off-topic, but I'm curious what you PHP'ers would 
 recommend as
  a good HTML book.  I think I need to learn some stylesheet stuff and the
  tutorial I've got covers the basics, but I'd like some more in-depth 
 info on
  the commands.

-----
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] anchor # not working?

2001-03-04 Thread Brian White

Try:
a name="1"/a

At 06:02 PM 3/4/01 -0500, andrew wrote:
hi folks!

I've got a baffling, but probably simple problem (the worst kind)

In my index.php page, I'm dynamically generating links like this:
http://localhost/news.php#1


When I click the link, the url string get's passed in, and looking at the
source of the news.php page shows:

a href="#1"/a

about half-way down.. but the page doesn't align with the anchor tag.

I assume PHP doesn't do anything funky?

Can anyone see what I've overlooked?

tia!
andrew



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-----
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP4 directives in httpd.conf not working

2001-02-25 Thread Brian White

I have php4 running under Apache. Under that apache I have several
VirtualHosts. I want to set to some of the PHP.INI values under
one of those hosts. So far I have tried the following values in
my httpd.conf file:

1) include_path   "/my/phpinc/path"
2) php_include_path   "/my/phpinc/path"
3) php3_include_path  "/my/phpinc/path"
4) php4_include_path  "/my/phpinc/path"

None of them have worked - I can't even restart Apache with them in place.
"/my/phpinc/path" definitely exists.

What am I doing wrong?

Regs

Brian White
-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Why Arrays in Forms? ( Was Accessing variables from a form )

2001-02-21 Thread Brian White

Why do you have to specify multi-value fields in HTML
forms specifically as PHP arrays?

It seems incompatible with other CGI languages, and
could make it difficlt to chop and change CGI engines in
the background.

At 19:08 21/02/2001 +0200, Pavel Jartsev wrote:
If you create your fields like this:
?
...
echo 'input type="text" name="name['.$rownum.']"';
echo 'input type="text" name="phone['.$rownum.']"';
echo 'input type="text" name="fax['.$rownum.']"';
...
?

Regs

Brian White
-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] image orientation/resizing images

2001-02-21 Thread Brian White

Three quite related posts all in rapid sucesssion

At 17:48 21/02/2001 -0500, Jaxon wrote:
Is there any way to take an image from the filesystem, say a .jpg or .png,
and display it in a different orientation?  e.g. 20 degrees to the right?

At 17:18 21/02/2001 -0500, Dale Frohman wrote:
Does anyone know of a way to resize images as they are being uploaded?
Would you write these images to a mysql database or straight to a file on
the server?  The pictures will be small  100k


In both cases, the answer will have to be some kind of server side utility
that can dynamically feed up translated images. Chris' very nice "image from
database" snippet gives a guidline on how this might work - whether or not what
you want can be done in PHP, I don't know.


At 08:09 21/02/2001 -0800, Chris Lee wrote:
dspimage.inc
?php

   include_once('database.egn');

   header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
   header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
   header('Cache-Control: no-cache, must-revalidate');
   header('Pragma: no-cache');

   if ( $prod_r = fetch_db_value('product_image', "WHERE product_id =
$product_id ") )
   {
   if ($prod_r['product_image'])
   {
Header("Content-Type: {$prod_r['product_image_type']}");
echo $prod_r['product_image'];
exit();
   }
   }
  Header('Content-Type: image/gif');
   readfile("$DOCUMENT_ROOT/image/nopic.gif");
?

index.php
?php
 echo "
 img src='include/dspimage.inc?product_id=123456'
 ";
?


-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Why Arrays in Forms? ( Was Accessing variables from a form )

2001-02-21 Thread Brian White

That's the point - why do I have to have 'name="myArray[]"'. Why
do I have to specify the '[]'s at all?

Brian

At 13:44 21/02/2001 -0800, jason cox wrote:
You don't have to specify them as "PHP arrays".  You
can do something like:

input type=text name="myArray[]"
input type=text name="myArray[]"
input type=text name="myArray[]"
input type=text name="myArray[]"

PHP will create the array for you.

Jason

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] REgular expression....difficult is it?

2001-02-18 Thread Brian White


At 21:23 18/02/2001 -0800, Dhaval Desai wrote:
I am not able to understand this REgular expression.

/Wil?/

English Translation: Find a string that contains "Wi" that may or may not
   be followed by "l".

In pure "does the string match?" terms, your example is equivalent to

/Wi/

would match "Winnie", "Wimpy" "Wilson" and "William",
though not "Wendy" or "Wolf".

Howz taht..?


Does that help?

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Indexing Engine

2001-02-07 Thread Brian White

I did some research and decided to go with ht://Dig - the other thing on the
short list of free products was mnoGoSearch.

Try this link for a list of available serach engines:
http://www.searchtools.com/tools/tools.html

Regs

Brian White

At 23:29 6/02/2001 -0500, Steve Werby wrote:
"Diego Fulgueira" [EMAIL PROTECTED] wrote:
  I was wondering if anyone around knows of a tool (free if possible) to
index
  all the pages of my website and implement a search engine. I prefer it to
  run on NT.

My favorite is mnoGoSearch (formerly udmsearch) found at
http://search.mnogo.ru/.  I could hype it in great detail, but I'll let you
do your own research.  It's an indexer, backend and frontend search engine.
ht://Dig is also pretty popular.  Both are free.  Both run on many
Linux/Unix flavors.  I don't believe either run on NT.

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-----
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP is the VMS of CGI languages...( Was UN-Escaping text from a form submit? )

2001-02-07 Thread Brian White

... which isnt necesarily a bad thing.

At 14:27 8/02/2001 +1030, David Robley wrote:
On Thu,  8 Feb 2001 14:17, John Vanderbeck wrote:
...
  The title of this book doesn\'t really matter to \"me\"!
 
  Note the addition of the escape sequences.  How can I stop this?
...
addslashes and stripslashes are the functions you need.

I remember somebody once saying about VMS that it wasn't that easy to
string commands together and munge them in the way you could with Unix,
but most of the time it didn't matter - if you dug about in the manuals
a bit you were eventually going to find something that did what you wanted.

I remember making the comparison when I saw the "hebrev" function
(http://www.php.net/manual/en/function.hebrev.php) which
will "convert logical Hebrew text to visual text".  What other language,
other than PHP ( or something done specifically for use in Talmudic
Studies ) would have as part of it's base code set a function
for processing hebrew text?

The thing is that PHP is designed to run as a Web Server module
which , in programming terms, is a bit of a desert island - you have to be
as self sufficient a you can because it isn't easy to duck down to the
corner store to get a sorting algorithm. So it makes sense to have as much
useful functionality on hand as possible.

So the moral of this long ramble is: if you need to do something like
stripping out or adding slashes it is well worth your while having a
dig through the manual - you may well find the function you need.


-----
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] feature that should be there and isn't

2001-01-30 Thread Brian White

Let me start by saying "Can of Worms!"
At 20:07 30/01/2001 -0800, Joe Stump wrote:

BUT you can't do this:

   function foo($var=date("Y-m-d"))
   {


   }

Why? This would be a kick ass little trick!


The question is: when do you resolves something like this?
Is it at "compile time" or at "function call" time. That could
get really nasty if the functions had internal counters etc.

Regs

Brian White
-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Outputting a 2 digit number 10

2001-01-29 Thread Brian White

I normally solve this problem by doing a " 10" test, on the assumption it
is quicker. Something like

for ($i=00;$i$daysinmonth;$i++)
{
   $str_i= (string) $i;
   if ( $i  10 ) { $str_i = "0$str_i"; }

   if ($i == $day)
   {
  echo("option SELECTED value=\"$str_i\"$str_i/option\n");
   }
   else
   {
  echo("option value=\"$str_i\"$str_i/option\n");
   }
}

? echo"select name=\"form_date_day\"";
   $day = (date ("d"));
   $daysinmonth = (date("t"));
 for ($i=00;$i$daysinmonth;$i++){
   if ($i == $day) {
echo("option SELECTED value=\"$i\"$i/option\n");
   } else {
 echo("option value=\"$i\"$i/option\n");
}
  }
  echo"/select"
   ?

At 01:07 26/01/2001 +0800, you wrote:
I need to enable a user to insert an 'NEWS' item into a mySQL table one of
the definable limits for the user is to be the date that the news is to be
displayed. Currently the collum is in a 'date' format and should be stored
in a MMDD - being Australian we are used to the exact reverse of that so
I though it best to produce a series of three select options in html and
then joing the values before inserting them

  $form_date = $form_date_Year . $form_date_month . $form_date_day;

CRUX: the looping format I'm using to make the options needs to output a 2
digit number as a single digit like 1 as compared to 01 will invalidate the
date

Sample of a loop I use to output an option

? echo"select name=\"form_date_day\"";
   $day = (date ("d"));
   $daysinmonth = (date("t"));
 for ($i=00;$i$daysinmonth;$i++){
   if ($i == $day) {
echo("option SELECTED value=\"$i\"$i/option\n");
   } else {
 echo("option value=\"$i\"$i/option\n");
}
  }
  echo"/select"
   ?

Any help will be apreciated
Jamie

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] VIRUS ON LIST?

2001-01-29 Thread Brian White

You left some attributes off:

   joke type="bad" ratingOutOf10="2"

At 20:02 29/01/2001 -0700, Ashley M. Kirchner wrote:
Maxim Maletsky wrote:

  my firewall reports this at last once a moth ...

 joke
   So, uuhhh, how many moths have you caught so far?  Must be
   quite an insect collection by now.  You may want to clean out
   your firewall before it gets clogged up by all those moths.
 /joke

 AMK4

--
H | Hi, I'm currently out of my mind.  Please leave a message.  BP!
   |
   ~
   Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
   Director of Internet Operations / SysAdmin. 800.441.3873 x130
   Photo Craft Laboratories, Inc. .eFax 248.671.0909
   http://www.pcraft.com  .3550 Arapahoe Ave, #6
   .. .  .  . .Boulder, CO 80303, U.S.A.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-----
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: XML Processing Instruction ( was ? PHP vs. ? )

2001-01-23 Thread Brian White

At 05:24 PM 1/23/01 +0100, Jirka Kosek wrote:
Teodor Cimpoesu wrote:
  my follow-up was from an suggest of using % though :)
  it exists in C, ASP and JSP. We have it in PHP, why not use it?
 
Because it is not compatible with XML syntax.

I agree. The short answer is to the question is "Standards".

There are heaps of tools around for processing data that conforms to the
XML standard - if you keep you documents ( and code script is just a
  document ) in XML those tools are available to you.

This is one of the big arguments in favour of XSLT - because it is stored
in XML the argument is that you can manage you XML content documents
and the XSLT code you process it with all with the same set of tools.
This includes editors, document storage, validators, pretty printers etc.

( Note: whether the benefits outweigh the cost in my example are
   arguable and I am not going there )



-----
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy

http://www.steptwo.com.au/
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] XML Parser is a bit strict

2001-01-18 Thread Brian White

( I am still not used to this mailing list - I keep hiting "Reply" and
only sending it to the poster. )

Part of the XML standard is that every element will have start and end
tags. HTML actually uses the syntax of SGML, which allows some tags
to have their end tags omitted - therefore, on some level you *can't*
process HTML as XML because it isn't XML.

As far as I understand XHMTL, it simply HTML made XML compliant, which
basically means you always have to put in an end tag.

BTW - if you have an empty element such as "br" , in XML you have two
choices:

1) br/br
2) br/ (shorthand for (1) )


At 05:09 PM 1/18/01 +, you wrote:

I am using php 4.02 and Apache 1.3.12 and am trying to do some XML parsing.
HTML is also in the text I'm parsing and the xml parsing dies if it sees an
html tag that does not have a matching closing tag.  Is there any work around
to this and if so is there a way to make it so XML tags don't need to be
closed too?

--
Shaun Butler
[EMAIL PROTECTED]
x2905

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
-----
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy

http://www.steptwo.com.au/
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: XML, what is that supposed to do?

2001-01-16 Thread Brian White

I thought I might weigh into this debate in a small way. My background
is a little different. I have spent the last five years playing with
SGML ( Standard Generalised Markup Language ) which is the ancestor of
XML - basically, XML was invented by elements of the SGML community to
create a "lighter" form of SGML that could be used in client side
apps and didn't require a CRAY to be able to do things quickly.

The primary benefit of XML is that you have more control over the
markup of your data. This has several aspects

1) You can markup a piece of data to describe what it *actually is*
rather just marking it up how you would like it displayed in one
particular media - it puts some intelligence in the data and allows
you to mark up some of the context that us humans are generally
able to infer. This also "future proofs" your data against
the "display" formats changing.

2) You can use a DTD (Document Type Definition) to create the compliance
part of what I like to call a "data contract" - two or more parties can
agree on a data format that suits them. The contract is "if you give
me data in this format I can process" it. XML allows you to
 (a) have a standard way to write these "contracts"
 (b) provided standard tools to check whether the "contract
 conditions" have been met

3) If you are creating more than one kind of output, you need to be able
 to store the original content in such a way that it is easy to
 create the different kinds of output.

What this means is that one of the most currently useful places to use XML
a *storage* format. If all you are doing with you data is delivering
it in a bland way to Web browsers, then you may as well just use HTML.
If you have to deliver two kinds of HTML ( eg: frames/ no frames ) and
set of PDF files, then XML is an excellent way to store your data - there
are heaps of tools out there than can easily do the transformations.


Re Tools: the other posters have done quite a good job of summarising
some of the tools and standards. I will only add a couple of
things.

1) Calling "DOM" the big brother of "SAX" is not really correct - they
are more like cousins. They each have their place and used for
different things. If you need to be able to arbitrarily rearrange
the elements of an XML "tree" into weird and interesting shapes then
go with the "DOM" but don't expect to process anything larger than
about 1MB. When speed and size are an issue, you need to use
a serial/event driven processor such as Omnimark or a SAX tool.

2) What I understand about XSLT is
 a) It is a tree based processor so you have all the limitation
 of the "DOM"
 b) It is an absolute pig to write code in by hand
but other than that it's fine .



Regs

Brian White
-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy

http://www.steptwo.com.au/
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]