php-general Digest 1 Jul 2002 14:21:29 -0000 Issue 1438

Topics (messages 104612 through 104661):

checking date is not greater than today
        104612 by: Timothy J. Luoma
        104619 by: John Holmes
        104621 by: Timothy J. Luoma
        104627 by: Peter J. Schoenster
        104628 by: Timothy J. Luoma

emulating enable_trans_sid
        104613 by: Justin French
        104614 by: Tom Rogers
        104620 by: Justin French
        104630 by: Tom Rogers
        104633 by: Justin French
        104634 by: Martin Towell
        104640 by: Tom Rogers
        104641 by: Justin French

Printing
        104615 by: Chris Kay
        104617 by: Jason Wong
        104637 by: Chris Kay
        104639 by: Justin French

Re: Fast code to partially flatten an array based on several keys?
        104616 by: Morgan Grubb
        104618 by: Martin Towell

Re: XML Problem
        104622 by: Analysis & Solutions

PHP with CSS
        104623 by: Bruce Karstedt
        104624 by: Martin Towell
        104625 by: Peter
        104629 by: Bruce Karstedt
        104631 by: Martin Towell
        104632 by: CC Zona

Re: securing an 'includes' dir
        104626 by: Steve Yates

Increment
        104635 by: Uma Shankari T.
        104636 by: Martin Towell
        104638 by: Mirza Muharemagic

php install
        104642 by: Nigel George
        104643 by: Matt Williams

Re: Globals bug??
        104644 by: Marek Kilimajer

Re: Keeping "Secrets" in PHP Files
        104645 by: Tamas Arpad
        104652 by: Erik Price
        104657 by: Dan Vande More

strip_tags
        104646 by: BB

help with preg_replace()
        104647 by: Gregor Jakša

blob versus file
        104648 by: andy

Re: [PHP-DB] blob versus file
        104649 by: Pierre-Alain Joye

Problem with menu
        104650 by: JJ Harrison

Re: Populate Popup Menu from Database
        104651 by: Erik Price

Re: Javascript to PHP?
        104653 by: Erik Price

creating multidimensional arrays
        104654 by: DoL

Page rendering speed: PostNuke or PHP-Nuke
        104655 by: Andres Montiel

Win98, Apache, PHP Config Problem
        104656 by: Jay Blanchard
        104658 by: Julie Meloni
        104659 by: Bruce Karstedt
        104660 by: Jay Blanchard
        104661 by: Jay Blanchard

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---

I am trying to compare a given date string (i.e. June 30, 2002 is
20020630).  I want to make sure that the input string that is given is not
greater than today (i.e. if today is June 30, and you ask for 20020701, I
want to be able to throw an error).

I'm a newbie, so I'm not sure the best way to do this.  My thought was
that if I take the year (YYYY) and add on the day-of-year (i.e. Feb 10 =
041) then I would be able to compare them as you would any other numbers.

The problem I have then run into is that strftime and date seem to have
different opinions as to what day of the year it is.

date
        z - day of the year; i.e. "0" to "365"

strftime
        %j - day of the year as a decimal number (range 001 to 366)


I have these variables defined

        $SEARCHYEAR = YYYY
i.e 2002

        $SEARCHMONTH = MM
i.e. 06

        $SEARCHDAY = DD
i.e. 30


$TODAYCMP=date ("Yz");

$SEARCHCMP=strftime("%Y%j",mktime(0,0,0,$SEARCHMONTH,$SEARCHDAY,$SEARCHYEAR));

and then I tried it for today and got

        echo "<!-- TODAY is $TODAYCMP SEARCHCMP is $SEARCHCMP --> ";

as a result I get

<!-- TODAY is 2002180 SEARCHCMP is 2002181 -->


So I'm trying to figure out:

A) Why strftime and date don't handle leap years the same way

and (more importantly)

B) The best way to make sure a given date YYYYMMDD is not greater than
        "today"

I did some googling & php.net searching without luck.

Thanks
TjL




--- End Message ---
--- Begin Message ---
$today = date("Ymd");
if($input_date > $today)
{ echo "Date must be before today!"; }

It looks like you're dealing with MySQL dates. There are a ton of useful
functions you can use in your queries that make any time manipulation in
PHP unnecessary. Chapter 6, Date and Time Functions of the MySQL manual.

---John Holmes...

> -----Original Message-----
> From: Timothy J. Luoma [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, June 30, 2002 10:31 PM
> To: PHP Mailing List
> Subject: [PHP] checking date is not greater than today
> 
> 
> I am trying to compare a given date string (i.e. June 30, 2002 is
> 20020630).  I want to make sure that the input string that is given is
not
> greater than today (i.e. if today is June 30, and you ask for
20020701, I
> want to be able to throw an error).
> 
> I'm a newbie, so I'm not sure the best way to do this.  My thought was
> that if I take the year (YYYY) and add on the day-of-year (i.e. Feb 10
=
> 041) then I would be able to compare them as you would any other
numbers.
> 
> The problem I have then run into is that strftime and date seem to
have
> different opinions as to what day of the year it is.
> 
> date
>       z - day of the year; i.e. "0" to "365"
> 
> strftime
>       %j - day of the year as a decimal number (range 001 to 366)
> 
> 
> I have these variables defined
> 
>       $SEARCHYEAR = YYYY
> i.e 2002
> 
>       $SEARCHMONTH = MM
> i.e. 06
> 
>       $SEARCHDAY = DD
> i.e. 30
> 
> 
> $TODAYCMP=date ("Yz");
> 
>
$SEARCHCMP=strftime("%Y%j",mktime(0,0,0,$SEARCHMONTH,$SEARCHDAY,$SEARCHY
EA
> R));
> 
> and then I tried it for today and got
> 
>       echo "<!-- TODAY is $TODAYCMP SEARCHCMP is $SEARCHCMP --> ";
> 
> as a result I get
> 
> <!-- TODAY is 2002180 SEARCHCMP is 2002181 -->
> 
> 
> So I'm trying to figure out:
> 
> A) Why strftime and date don't handle leap years the same way
> 
> and (more importantly)
> 
> B) The best way to make sure a given date YYYYMMDD is not greater than
>       "today"
> 
> I did some googling & php.net searching without luck.
> 
> Thanks
> TjL
> 
> 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
On Sun, 30 Jun 2002, John Holmes wrote:

> $today = date("Ymd");
> if($input_date > $today)
> { echo "Date must be before today!"; }

*thwaps self*

DUH!  Thanks... been staring at this for too long.


> It looks like you're dealing with MySQL dates. There are a ton of useful
> functions you can use in your queries that make any time manipulation in
> PHP unnecessary. Chapter 6, Date and Time Functions of the MySQL manual.

I'm not dealing with MySQL dates yet, just simple query strings, but I'll
check that out before I get into MySQL.

Thanks

TjL




--- End Message ---
--- Begin Message ---
On 30 Jun 2002 at 22:31, Timothy J. Luoma wrote:

> 
> I am trying to compare a given date string (i.e. June 30, 2002 is
> 20020630).  I want to make sure that the input string that is given is
> not greater than today (i.e. if today is June 30, and you ask for
> 20020701, I want to be able to throw an error).

> I'm a newbie, so I'm not sure the best way to do this.  My thought was
> that if I take the year (YYYY) and add on the day-of-year (i.e. Feb 10
> = 041) then I would be able to compare them as you would any other
> numbers.

[...] snipped

I ignored the rest as it was beyond me. I'm also a newbie to PHP but I looked into 
dates in Perl. I quickly began using a module from CPAN as I realized this was more 
complicated than meets the eye 
and you seem to indcate that when you mention leap years.

I would question why you accept input as a particular format. It's certainly easier to 
work with timestamps than arbitrary representations of dates.  I would not be so quick 
to assume you have to accept 
input as is.  Or at least have it fixed to a format ... but the Perl modules I've 
worked with are liberal with what they receive .... :) Anyhow, I'd just find a PHP 
module ot handle this. 

I found this:

http://www.phpbuilder.com/columns/akent20000610.php3

but I'd just want a class (guess you call it that in PHP).


And then this looks real interesting:

> Date/Time Processing with PHP
> By The Disenchanted Developer
> March 19, 2002

http://zope1.devshed.com/zope.devshed.com/Server_Side/PHP/DateTime/page1.html

In Perl I happen to use this moduel for date manipulation:

http://search.cpan.org/doc/STBEY/Date-Calc-5.0/Calc.pod

There must be something similar in PHP but since I too am a newbie (and lazy to boot) 
I don't know what it is. 

Peter



--- End Message ---
--- Begin Message ---
On Mon, 1 Jul 2002, Peter J. Schoenster wrote:

> On 30 Jun 2002 at 22:31, Timothy J. Luoma wrote:
>
> > I am trying to compare a given date string (i.e. June 30, 2002 is
> > 20020630).  I want to make sure that the input string that is given is
> > not greater than today (i.e. if today is June 30, and you ask for
> > 20020701, I want to be able to throw an error).
>
> I would question why you accept input as a particular format. It's
> certainly easier to work with timestamps than arbitrary representations
> of dates.  I would not be so quick to assume you have to accept input as
> is.  Or at least have it fixed to a format ... but the Perl modules I've
> worked with are liberal with what they receive .... :) Anyhow, I'd just
> find a PHP module ot handle this.

In general, the user shouldn't ever have to format the date... it's all
automatically generated.

However, wise users will look at

        http://www.tntluoma.com/ethan/daily/index.php?20020701

and realize that they could possibly "look ahead" by manually editing
the URL and going to

        http://www.tntluoma.com/ethan/daily/index.php?20020702

That's all I wanted to avoid.  I'm using that particular date string
because it works easily with what I am trying to accomplish.

I am surprised, however, that two PHP functions would deal differently
with the way that day#-of-the-year is handled (365 vs 366).

Thanks to all who made suggestions on/off list, I believe I now have it
working.

TjL


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

As discussed a few months back, I'm interested attempting to recreate PHP's
enable_trans_sid feature, for users without cookies.

ONLY if cookies are UNavailable, I want to open the output buffer, build the
page, then run a reg exp or something over the output to append SIDs to all
URLs (GET), then print it.

I've got a pretty good picture in my head of how I'll test for cookies, and
how I'll do the output buffering, but regexp's are NOT my thing :)

I'm interested in hearing some opinions on the most efficient way to append
the SID to all internal URLs on the page... this would include:

- header("Location: something.php")
- <A href="something.php">
- <FORM action="something.php">

My thoughts are that it would only be done for relative links
(dir/something.php), NOT for fully qualified URLs (http://otherdomain.com,
ftp://, mailto:, https://, ?????), as per enable_trans_sid documentation.

It would also have to accommodate URLs which already have a query string...
if there's an existing query string, just append &SID, otherwise append
?SID.


This seems to me like a rather in-depth regexp already, and I'm sure i'm
forgetting something.

Perhaps there's a simpler way that I'm missing?  The only simpler way I can
think of would be to search for '.php' and '.php?' and act accordingly, but
this has obvious problems when 'something.php' is type, but not in context
of a link or header redirection.

Where would I look to see the source of enable_trans_sid -- maybe this will
give me some hints??


Justin French

--- End Message ---
--- Begin Message ---
Hi
enable_trans_sid does exactly what you are trying to re create, if no 
cookies are available it modifies all the urls automatically.
and transparently
Tom


At 12:48 PM 1/07/2002 +1000, Justin French wrote:
>Hi,
>
>As discussed a few months back, I'm interested attempting to recreate PHP's
>enable_trans_sid feature, for users without cookies.
>
>ONLY if cookies are UNavailable, I want to open the output buffer, build the
>page, then run a reg exp or something over the output to append SIDs to all
>URLs (GET), then print it.
>
>I've got a pretty good picture in my head of how I'll test for cookies, and
>how I'll do the output buffering, but regexp's are NOT my thing :)
>
>I'm interested in hearing some opinions on the most efficient way to append
>the SID to all internal URLs on the page... this would include:
>
>- header("Location: something.php")
>- <A href="something.php">
>- <FORM action="something.php">
>
>My thoughts are that it would only be done for relative links
>(dir/something.php), NOT for fully qualified URLs (http://otherdomain.com,
>ftp://, mailto:, https://, ?????), as per enable_trans_sid documentation.
>
>It would also have to accommodate URLs which already have a query string...
>if there's an existing query string, just append &SID, otherwise append
>?SID.
>
>
>This seems to me like a rather in-depth regexp already, and I'm sure i'm
>forgetting something.
>
>Perhaps there's a simpler way that I'm missing?  The only simpler way I can
>think of would be to search for '.php' and '.php?' and act accordingly, but
>this has obvious problems when 'something.php' is type, but not in context
>of a link or header redirection.
>
>Where would I look to see the source of enable_trans_sid -- maybe this will
>give me some hints??
>
>
>Justin French
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
I'm aware of this.  What I'm trying to do is emulate this process on servers
which have not compiled with --enable_trans_sid.  I thought that was pretty
clear, but perhaps not.

In the ideal world, enable_trans_sid would have been compiled, but I'm yet
to find many shared hosts where this has been done.  And since shared
servers seem to be what my current client set are using, I'm looking at
emulating enable_trans_sid.

Regards,

Justin French



on 01/07/02 1:07 PM, Tom Rogers ([EMAIL PROTECTED]) wrote:

> Hi
> enable_trans_sid does exactly what you are trying to re create, if no
> cookies are available it modifies all the urls automatically.
> and transparently
> Tom
> 
> 
> At 12:48 PM 1/07/2002 +1000, Justin French wrote:
>> Hi,
>> 
>> As discussed a few months back, I'm interested attempting to recreate PHP's
>> enable_trans_sid feature, for users without cookies.
>> 
>> ONLY if cookies are UNavailable, I want to open the output buffer, build the
>> page, then run a reg exp or something over the output to append SIDs to all
>> URLs (GET), then print it.
>> 
>> I've got a pretty good picture in my head of how I'll test for cookies, and
>> how I'll do the output buffering, but regexp's are NOT my thing :)
>> 
>> I'm interested in hearing some opinions on the most efficient way to append
>> the SID to all internal URLs on the page... this would include:
>> 
>> - header("Location: something.php")
>> - <A href="something.php">
>> - <FORM action="something.php">
>> 
>> My thoughts are that it would only be done for relative links
>> (dir/something.php), NOT for fully qualified URLs (http://otherdomain.com,
>> ftp://, mailto:, https://, ?????), as per enable_trans_sid documentation.
>> 
>> It would also have to accommodate URLs which already have a query string...
>> if there's an existing query string, just append &SID, otherwise append
>> ?SID.
>> 
>> 
>> This seems to me like a rather in-depth regexp already, and I'm sure i'm
>> forgetting something.
>> 
>> Perhaps there's a simpler way that I'm missing?  The only simpler way I can
>> think of would be to search for '.php' and '.php?' and act accordingly, but
>> this has obvious problems when 'something.php' is type, but not in context
>> of a link or header redirection.
>> 
>> Where would I look to see the source of enable_trans_sid -- maybe this will
>> give me some hints??
>> 
>> 
>> Justin French
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Hi
Ok probably the easiest is just to add <?if(!empty(SID) echo 'sid='.SID?> 
to the end of each url, if cookies are supported SID will be an empty string.
Tom


At 01:59 PM 1/07/2002 +1000, you wrote:
>I'm aware of this.  What I'm trying to do is emulate this process on servers
>which have not compiled with --enable_trans_sid.  I thought that was pretty
>clear, but perhaps not.
>
>In the ideal world, enable_trans_sid would have been compiled, but I'm yet
>to find many shared hosts where this has been done.  And since shared
>servers seem to be what my current client set are using, I'm looking at
>emulating enable_trans_sid.
>
>Regards,
>
>Justin French
>
>
>
>on 01/07/02 1:07 PM, Tom Rogers ([EMAIL PROTECTED]) wrote:
>
> > Hi
> > enable_trans_sid does exactly what you are trying to re create, if no
> > cookies are available it modifies all the urls automatically.
> > and transparently
> > Tom
> >
> >
> > At 12:48 PM 1/07/2002 +1000, Justin French wrote:
> >> Hi,
> >>
> >> As discussed a few months back, I'm interested attempting to recreate 
> PHP's
> >> enable_trans_sid feature, for users without cookies.
> >>
> >> ONLY if cookies are UNavailable, I want to open the output buffer, 
> build the
> >> page, then run a reg exp or something over the output to append SIDs 
> to all
> >> URLs (GET), then print it.
> >>
> >> I've got a pretty good picture in my head of how I'll test for 
> cookies, and
> >> how I'll do the output buffering, but regexp's are NOT my thing :)
> >>
> >> I'm interested in hearing some opinions on the most efficient way to 
> append
> >> the SID to all internal URLs on the page... this would include:
> >>
> >> - header("Location: something.php")
> >> - <A href="something.php">
> >> - <FORM action="something.php">
> >>
> >> My thoughts are that it would only be done for relative links
> >> (dir/something.php), NOT for fully qualified URLs (http://otherdomain.com,
> >> ftp://, mailto:, https://, ?????), as per enable_trans_sid documentation.
> >>
> >> It would also have to accommodate URLs which already have a query 
> string...
> >> if there's an existing query string, just append &SID, otherwise append
> >> ?SID.
> >>
> >>
> >> This seems to me like a rather in-depth regexp already, and I'm sure i'm
> >> forgetting something.
> >>
> >> Perhaps there's a simpler way that I'm missing?  The only simpler way 
> I can
> >> think of would be to search for '.php' and '.php?' and act 
> accordingly, but
> >> this has obvious problems when 'something.php' is type, but not in context
> >> of a link or header redirection.
> >>
> >> Where would I look to see the source of enable_trans_sid -- maybe this 
> will
> >> give me some hints??
> >>
> >>
> >> Justin French
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
on 01/07/02 3:36 PM, Tom Rogers ([EMAIL PROTECTED]) wrote:

> Ok probably the easiest is just to add <?if(!empty(SID) echo 'sid='.SID?>
> to the end of each url, if cookies are supported SID will be an empty string.

I want to avoid this, because it adds a level of complexity to the
construction of pages that I'm not comfortable with.  With multiple writers,
designers and programmers passing stuff around, it'll be way too easy to
loose the session.

I'm not really looking for "easiest", I'm looking for "the solution",
regardless of how long it take to perfect, because this will be a write-once
solution that I'll use over and over.

It's quite possible that the end solution will require a decent HTML parser
or state engine.  Fun fun :)


Justin French

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

> It's quite possible that the end solution will require a decent HTML
parser
> or state engine.  Fun fun :)

Do you have any JS that will have to be "altered" because of what you're
trying to do. 'Cause if you have to write an HTML parser, you'd prob have to
write a JS parser too :) More fun for ya!

Martin
--- End Message ---
--- Begin Message ---
Hi
It just so happens I have been playing with an html parser making an html 
to xml converter. I started with phpHTMLparse class but it couldn't cope 
with the html generated by microsoft so I have modified it to better handle 
carriage returns,white space,comments and embedded commands in the html. 
Your quite welcome to the files if it'll help.
Tom

  At 04:03 PM 1/07/2002 +1000, Justin French wrote:
>on 01/07/02 3:36 PM, Tom Rogers ([EMAIL PROTECTED]) wrote:
>
> > Ok probably the easiest is just to add <?if(!empty(SID) echo 'sid='.SID?>
> > to the end of each url, if cookies are supported SID will be an empty 
> string.
>
>I want to avoid this, because it adds a level of complexity to the
>construction of pages that I'm not comfortable with.  With multiple writers,
>designers and programmers passing stuff around, it'll be way too easy to
>loose the session.
>
>I'm not really looking for "easiest", I'm looking for "the solution",
>regardless of how long it take to perfect, because this will be a write-once
>solution that I'll use over and over.
>
>It's quite possible that the end solution will require a decent HTML parser
>or state engine.  Fun fun :)
>
>
>Justin French
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
That'd be great -- for inspiration if nothing else :)

Justin French


on 01/07/02 6:35 PM, Tom Rogers ([EMAIL PROTECTED]) wrote:

> Hi
> It just so happens I have been playing with an html parser making an html
> to xml converter. I started with phpHTMLparse class but it couldn't cope
> with the html generated by microsoft so I have modified it to better handle
> carriage returns,white space,comments and embedded commands in the html.
> Your quite welcome to the files if it'll help.
> Tom
> 
> At 04:03 PM 1/07/2002 +1000, Justin French wrote:
>> on 01/07/02 3:36 PM, Tom Rogers ([EMAIL PROTECTED]) wrote:
>> 
>>> Ok probably the easiest is just to add <?if(!empty(SID) echo 'sid='.SID?>
>>> to the end of each url, if cookies are supported SID will be an empty
>> string.
>> 
>> I want to avoid this, because it adds a level of complexity to the
>> construction of pages that I'm not comfortable with.  With multiple writers,
>> designers and programmers passing stuff around, it'll be way too easy to
>> loose the session.
>> 
>> I'm not really looking for "easiest", I'm looking for "the solution",
>> regardless of how long it take to perfect, because this will be a write-once
>> solution that I'll use over and over.
>> 
>> It's quite possible that the end solution will require a decent HTML parser
>> or state engine.  Fun fun :)
>> 
>> 
>> Justin French
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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

Is there a way to bypass the print popup window within linux?

I wish to run a print job of 200 or so invoices and don't want the promp for every 
page I print..

Is any one able to point me in the right direction..

Thanks in advance..

---------------------------------------------------------------------------
Chris Kay
Technical Support - Techex Communications 
Website: www.techex.com.au   Email: [EMAIL PROTECTED]
Telephone: 1300 88 111 2 - Fax: (02) 9970 5788 
Address: Suite 13, 5 Vuko Place, Warriewood, NSW 2102 
Platinum Channel Partner of the Year - Request DSL - Broadband for Business
---------------------------------------------------------------------------
--- End Message ---
--- Begin Message ---
On Monday 01 July 2002 11:16, Chris Kay wrote:
> Is there a way to bypass the print popup window within linux?

That's a function of whatever browser you're using!

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

/*
Such a foolish notion, that war is called devotion, when the greatest
warriors are the ones who stand for peace.
*/

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

You saying there is a way for the scripts to know what kind of browser u r using?

---------------------------------------------------------------------------
Chris Kay
Technical Support - Techex Communications 
Website: www.techex.com.au   Email: [EMAIL PROTECTED]
Telephone: 1300 88 111 2 - Fax: (02) 9970 5788 
Address: Suite 13, 5 Vuko Place, Warriewood, NSW 2102 
Platinum Channel Partner of the Year - Request DSL - Broadband for Business
---------------------------------------------------------------------------

> -----Original Message-----
> From: Jason Wong [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, 1 July 2002 1:34 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Printing
> 
> 
> On Monday 01 July 2002 11:16, Chris Kay wrote:
> > Is there a way to bypass the print popup window within linux?
> 
> That's a function of whatever browser you're using!
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications 
> Development *
> 
> /*
> Such a foolish notion, that war is called devotion, when the 
> greatest warriors are the ones who stand for peace. */
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
--- End Message ---
--- Begin Message ---
on 01/07/02 5:01 PM, Chris Kay ([EMAIL PROTECTED]) wrote:

> You saying there is a way for the scripts to know what kind of browser u r
> using?

Yes, there are ways of determining the browser, but I believe what Jason was
saying is that PHP happens on the server side (here we go again)... In other
words, by the time it hits your browser, it's just HTML, combined with any
JavaScript or CSS that you choose.

So PHP can't interact with any client (browser)-side systems (like printing)
at all.

Printing a page is entirely up to the browser or client implementation.


You may want to consider generating a multi-page RTF file or PDF which is
generated on the fly, saved to disc, and printed upon your request.  At
least you only get the print window once.


Justin French



--- End Message ---
--- Begin Message ---
Martin,

I said I'd let you know how I got on.

It's all working, but only realistically for no more than 500 or so records.
When I feed it 10000+ records, the machine chokes.

So I'm back to textbooks just looking for clues on really fast sorting and
searching algorithms. I've written a mostly working quicksort routine, which
seems to have cut the time down significantly on searches, so I'll keep
plugging away at this.

Of course, now that it *appears* to be working, I'm getting a lot more work
dumped on me, so finishing it off is going to take a bit longer. =)


Morgan Grubb.


"Martin Towell" <[EMAIL PROTECTED]> wrote in message
6416776FCC55D511BC4E0090274EFEF508A550@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A550@EXCHANGE...
> This is what I came up with before I saw this email, and "eek", we think
the
> same (sorta)
>
> This is going to be a bit iffy, but here goes (BTW: this hasn't been
tested,
> so expect heaps of errors :)  )
>
>     $i = 0;
>     while ($row = mysql_fetch_assoc($result)) {
>         for ($j = 0, $found = false; $j < $i && !$found; $j++) {
>             if ($vehicles[$j]['dealer_id'] == $row['dealer_id'] &&
>                 $vehicles[$j]['vehicle_id'] == $row['vehicle_id']) {
>                 $found = true;
>                 $idx = $j
>             }
>         }
>         if (!$found) {
>             $idx = $i;
>             $i++;
>         }
>         $vehicles[$idx]['dealer_id'] = $row['dealer_id'];
>         $vehicles[$idx]['vehicle_id'] = $row['vehicle_id'];
>         $vehicles[$idx][$row['company_id']] = $row['page_views'];
>     }
>
> The other thing I just thought of is: can $row['dealer_id'] and
> $row['vehicle_id'] be indexes to the array
>
$vehicles[$row['dealer_id']][$row['vehicle_id']][$row['company_id']]
> = $row['page_views'];
>
> so you'd get something like (manually created result...):
> (
>     [645] => Array
>         (
>             [35073] => Array
>                 (
>                     [1] => 10
>                     [0] => 6
>                 )
>         )
> )
>
> -----Original Message-----
> From: Morgan Grubb [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 28, 2002 11:35 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Fast code to partially flatten an array based on
> several keys?
>
>
> Martin,
>
> Here's an example of what I implemented (simplified down again).
>
> As you can see, it's hideously simple and not optimized in the least.
>
> It works well on small datasets, but you can see by looking at it that
large
> datasets get exponentially slower.
>
>     while ($row = mysql_fetch_assoc($result)) {
>         $found = false;
>         $count = count($vehicles);
>         for ($j = 0; $j < $count; $j++) {
>             if (   $vehicles[$j]['dealer_id'] == $row['dealer_id'] &&
> $vehicles[$j]['vehicle_id'] == $row['vehicle_id'] ) {
>                 $vehicles[$j][$row['company_id']] = $row['page_views'];
>                 $found = true;
>             }
>         }
>         if (!$found) {
>             $vehicles[$i]['dealer_id'] = $row['dealer_id'];
>             $vehicles[$i]['vehicle_id'] = $row['vehicle_id'];
>             $vehicles[$i][$row['company_id']] = $row['page_views'];
>         }
>
>         $i++;
>     }
>
>
>
> Morgan Grubb.
>
>
> "Martin Towell" <[EMAIL PROTECTED]> wrote in message
> 6416776FCC55D511BC4E0090274EFEF508A54E@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A54E@EXCHANGE...
> > this sort of merging would be easier to do when you create the array
> > (unless you need the other format for something else?)
> >
> > -----Original Message-----
> > From: Morgan Grubb [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, June 28, 2002 11:09 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Fast code to partially flatten an array based on several
> > keys?
> >
> >
> > I have a large dataset which can contain many different fields, and I'm
> > trying to flatten them in such a way that I can display it happily in a
> > table.
> >
> > To simplify: I'm populating the array such (many many more fields, but
> these
> > will do):
> >
> >     $i = 0;
> >     while ($row = mysql_fetch_assoc($result)) {
> >         $vehicles[$i]['dealer_id'] = $row['dealer_id'];
> >         $vehicles[$i]['vehicle_id'] = $row['vehicle_id'];
> >         $vehicles[$i][$row['company_id']] = $row['page_views'];
> >         $i++;
> >     }
> >
> > Now, if that vehicle_id and dealer_id combination exist, instead of
adding
> > it as another record completely,
> > just add
> >
> >     $vehicles[$existing_id][$row['company_id']] = $row['page_views'];
> >
> > The end result of this would be (if given two 'company_id' records for
the
> > given dealer):
> >
> > (
> >     [0] => Array
> >         (
> >             [dealer_id] => 645
> >             [vehicle_id] => 35073
> >             [1] => 10
> >         )
> >
> >     [1] => Array
> >         (
> >             [dealer_id] => 645
> >             [vehicle_id] => 35073
> >             [0] => 6
> >         )
> > )
> >
> > Turns into:
> >
> > (
> >     [0] => Array
> >         (
> >             [dealer_id] => 645
> >             [vehicle_id] => 35073
> >             [1] => 10
> >             [0] => 6
> >         )
> > )
> >
> > Can anyone think of a fast way to do this either during creation of the
> > array or after the array has been created? (A sort of
fast_flatten($array)
> > function) ?
> >
> > If anyone can think of something, I'd be really appreciative.
> >
> >
> >
> > Cheers,
> > Morgan Grubb.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Sorting - are you sorting the array keys or the values ?

If you're sorting the keys, maybe it would be better to have another array
that holds a list of keys, sort that, and then use that as a "pointer" to
the actual array.

If you're sorting the values, then php has a good sort function (uses the
quick sort algorithm if I remember rightly)

-----Original Message-----
From: Morgan Grubb [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 1:16 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Fast code to partially flatten an array based on
several keys?

Martin,

I said I'd let you know how I got on.

It's all working, but only realistically for no more than 500 or so records.
When I feed it 10000+ records, the machine chokes.

So I'm back to textbooks just looking for clues on really fast sorting and
searching algorithms. I've written a mostly working quicksort routine, which
seems to have cut the time down significantly on searches, so I'll keep
plugging away at this.

Of course, now that it *appears* to be working, I'm getting a lot more work
dumped on me, so finishing it off is going to take a bit longer. =)

Morgan Grubb.

[snip]
--- End Message ---
--- Begin Message ---
Sire:

On Sun, Jun 30, 2002 at 10:21:40PM +0200, Sebastian A. wrote:
>
> Later on, you make the $Cdata a string, $temp, and then the next time you
> use it: $Temp = $Data['TRADE-DATETIME']
> You re-assign it again without using the data. Did I miss something?

Yes.  Further down was the default case, with the line:

   $Data[$Elem] = $Temp;

But, that's not there any more.  I reworked that file a bit to clarify 
that and add in more error checking.

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
--- End Message ---
--- Begin Message ---
Quick question?

Is their anything in Apache or PHP that would keep styles from working. Both
external (CSS) and inline styles are ignored.

Environment :

Win XP Pro
Apache 2.0.39
PHP 4.2.1

Writing & Debugging on Homesite 4.0.1

Bruce Karstedt
President
Technology Consulting Associates, Ltd.
Tel: 847-735-9488
Fax: 847-735-9474

--- End Message ---
--- Begin Message ---
if in-line styles aren't working (and you can see them when you do a "view
source") then it's nothing to do with apache.

(unless there's a header() command I don't know about that stops them from
working...)

Martin

-----Original Message-----
From: Bruce Karstedt [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 2:32 PM
To: PHP - General List (E-mail)
Subject: [PHP] PHP with CSS


Quick question?

Is their anything in Apache or PHP that would keep styles from working. Both
external (CSS) and inline styles are ignored.

Environment :

Win XP Pro
Apache 2.0.39
PHP 4.2.1

Writing & Debugging on Homesite 4.0.1

Bruce Karstedt
President
Technology Consulting Associates, Ltd.
Tel: 847-735-9488
Fax: 847-735-9474


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

there is nothing stopping it from working unless they are turned off in the browser's 
settings... just be mindful that CSS works slightly differently in netscape to ie..

-----Original Message-----
From: Bruce Karstedt [mailto:[EMAIL PROTECTED]]
Sent: Monday, 1 July 2002 2:32 PM
To: PHP - General List (E-mail)
Subject: [PHP] PHP with CSS


Quick question?

Is their anything in Apache or PHP that would keep styles from working. Both
external (CSS) and inline styles are ignored.

Environment :

Win XP Pro
Apache 2.0.39
PHP 4.2.1

Writing & Debugging on Homesite 4.0.1

Bruce Karstedt
President
Technology Consulting Associates, Ltd.
Tel: 847-735-9488
Fax: 847-735-9474


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

--- End Message ---
--- Begin Message ---
Checking "view source" was the first thing I thought of. The inline code
"appears" OK, style sheets, I only see the link of course.

Bruce Karstedt
President
Technology Consulting Associates, Ltd.
Tel: 847-735-9488
Fax: 847-735-9474


-----Original Message-----
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Sunday, June 30, 2002 11:31 PM
To: '[EMAIL PROTECTED]'; PHP - General List (E-mail)
Subject: RE: [PHP] PHP with CSS
Importance: Low


if in-line styles aren't working (and you can see them when you do a "view
source") then it's nothing to do with apache.

(unless there's a header() command I don't know about that stops them from
working...)

Martin

-----Original Message-----
From: Bruce Karstedt [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 2:32 PM
To: PHP - General List (E-mail)
Subject: [PHP] PHP with CSS


Quick question?

Is their anything in Apache or PHP that would keep styles from working. Both
external (CSS) and inline styles are ignored.

Environment :

Win XP Pro
Apache 2.0.39
PHP 4.2.1

Writing & Debugging on Homesite 4.0.1

Bruce Karstedt
President
Technology Consulting Associates, Ltd.
Tel: 847-735-9488
Fax: 847-735-9474


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

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

--- End Message ---
--- Begin Message ---
1. when you say "the link", you're talking about the <link> tag right?
        if so, are you sure your syntax is correct - this tag is something I
keep stuffing up
        (using src instead of href, forgetting rel="stylesheet" [is this
required?], setting type="text/stylesheet" instead of type="text/css")

2. is the style sheet file accessable from the web

can't think of anything else that could be wrong

-----Original Message-----
From: Bruce Karstedt [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 3:17 PM
To: 'Martin Towell'; 'PHP - General List (E-mail)'
Subject: RE: [PHP] PHP with CSS


Checking "view source" was the first thing I thought of. The inline code
"appears" OK, style sheets, I only see the link of course.

Bruce Karstedt
President
Technology Consulting Associates, Ltd.
Tel: 847-735-9488
Fax: 847-735-9474


-----Original Message-----
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Sunday, June 30, 2002 11:31 PM
To: '[EMAIL PROTECTED]'; PHP - General List (E-mail)
Subject: RE: [PHP] PHP with CSS
Importance: Low


if in-line styles aren't working (and you can see them when you do a "view
source") then it's nothing to do with apache.

(unless there's a header() command I don't know about that stops them from
working...)

Martin

-----Original Message-----
From: Bruce Karstedt [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 2:32 PM
To: PHP - General List (E-mail)
Subject: [PHP] PHP with CSS


Quick question?

Is their anything in Apache or PHP that would keep styles from working. Both
external (CSS) and inline styles are ignored.

Environment :

Win XP Pro
Apache 2.0.39
PHP 4.2.1

Writing & Debugging on Homesite 4.0.1

Bruce Karstedt
President
Technology Consulting Associates, Ltd.
Tel: 847-735-9488
Fax: 847-735-9474


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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
In article <001101c220b8$5338fc30$768c3841@c3>,
 [EMAIL PROTECTED] (Bruce Karstedt) wrote:

> Quick question?
> 
> Is their anything in Apache or PHP that would keep styles from working. Both
> external (CSS) and inline styles are ignored.

If it was the only the external stylesheet that wasn't working, the first 
thing to do would be to check that Apache is configured to the right 
content type (text/css) for it and that the PHP code isn't doing anything 
silly like sending the dynamically-generating the *.css page with a 
header() declaring a different content type; but with the inline styles 
also not working, that scenario would either be unlikely or only part of 
the story.

Have the HTML and CSS both been validated yet?  If the output of your PHP 
includes syntactically-flawed HTML, that could lead to problems with the 
CSS rendering as well.  And of course, invalid CSS will not render as 
expected.  This final thought may already be obvious to you, but is there 
any chance that the styles you're using are either not supported by your 
browser, or that your page's doctype has accidentally triggered the 
browser's less-forgiving "standards mode"? (If any of this sounds 
unfamiliar, you can follow-up with a newsgroup or list where CSS is 
on-topic, such as <news:comp.infosystems.www.authoring.stylesheets>.)

Good luck!

-- 
CC
--- End Message ---
--- Begin Message ---
"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Steve Yates wrote:
> >If you name them *.php then put anything in them inside a function, then
> >when the user browses to that file he/she won't see anything at all.
> >
> I think this is a very poor tactic, because it "covers up" the problem
> rather than doing anything about it.
>(...)
> It's much better to properly name your included files *.inc as suggested
> by Mr. French and either:
> 1. don't put them under document root (my preference)
> or:
> 2. configure your Web server to not allow access to .inc files

    I guess I wasn't trying to say that my suggestion was a complete
solution, but one thing to consider.  For instance, what happens if the
.htaccess file is accidentally deleted?  Then there's no protection.  Or say
the host upgrades PHP or Apache and for whatever reason PHP files aren't
being parsed?  Then my suggestion doesn't solve things (but moving them
outside the htdocs structure will, if available as an option).

    Is there an advantage to not putting code in included files inside
functions?  I wasn't sure if you were critiquing that part of my suggestion
also.

 - Steve Yates
 - Edit. Assemble. Link. Run. Curse. Boot.

/ Taglines by Taglinator - www.srtware.com /




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

Hello,

 Can anyone please clear my doubt...
Actually i am retrieving the entire record details from the database..I
want to display 1 row at a time..after clicking a button i want to display
the next record..after clicking the next button i want to display the 3 
record and so on..How do i go about with this...


Thanks & Regards,
Uma 

--- End Message ---
--- Begin Message ---
on the "next" link have some sort of counter that lets you know which record
to display.
If that counter isn't present, then display the first record

HTH
Martin

-----Original Message-----
From: Uma Shankari T. [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 4:52 PM
To: PHP
Subject: [PHP] Increment 



Hello,

 Can anyone please clear my doubt...
Actually i am retrieving the entire record details from the database..I
want to display 1 row at a time..after clicking a button i want to display
the next record..after clicking the next button i want to display the 3 
record and so on..How do i go about with this...


Thanks & Regards,
Uma 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi Uma,

     when u make a query, make it for two rows. than show the 1st one,
     and per psot method send the id of the next row to the next
     query.

     $last_id = $_POST["id"];
     
     $result = select id, yourcolumns
     from table
     ...
     limit $last_id, 2

     $secondrow = 1;
     
     while ($row=mysql_fetch_row($result))
     {
           if ($secondrow == 0)
           {
                ##make your button with id

                $button = "<form>\n".
                          "<input type=submit value="next">\n".
                          "<input type=hidden  name="id" value="<?php
                          echo $row[0]; ?>">\n".
                          "</form>\n";
           }
           
           else
           {
                echo "data of the first row";
                $secondrow--;
           }
     }
     
     Mirza [EMAIL PROTECTED]


01.07.2002 08:52


> Hello,

>  Can anyone please clear my doubt...
> Actually i am retrieving the entire record details from the database..I
> want to display 1 row at a time..after clicking a button i want to display
> the next record..after clicking the next button i want to display the 3 
> record and so on..How do i go about with this...


> Thanks & Regards,
> Uma 


--- End Message ---
--- Begin Message ---
Hi, I'm trying to install PHP 4.2.1 on SuSE SLES 7.3 and I get the following
error message

checking lex output file root... ./configure: lex: command not found
configure: error: cannot find output from lex; giving up

any ideas?

Nigel
--- End Message ---
--- Begin Message ---
On Monday 01 July 2002 11:20, Nigel George wrote:

> Hi, I'm trying to install PHP 4.2.1 on SuSE SLES 7.3 and I get the
> following error message
>
> checking lex output file root... ./configure: lex: command not found
> configure: error: cannot find output from lex; giving up
>
> any ideas?

install flex

matt
--- End Message ---
--- Begin Message ---
Are you using any opcode cache? Are you sure it is another process or 
might it be another thread.

    Marek

[EMAIL PROTECTED] wrote:

>We are seeing a rare bug that seems to imply that there is a bug in PHP's
>global variables across httpd processes. To make a long story short, it 
>appears that on rare occassions our script gets the value of a HTTP_GET_VARS
>variable from another user's process. Is this possible? BTW, it seems to occur
>when using HTTP_GET_VARS and the new 'super globals'.
>
>FWIW, we're using PHP 4.1.2 on (Red Hat) Linux 2.4.9 with Apache 1.3.12.
>
>Thanks!
>
>(please reply via email in addition to posting here if possible)
>
>
>
>  
>


--- End Message ---
--- Begin Message ---
On Sunday 30 June 2002 09:52, Justin French wrote:
> on 29/06/02 3:20 AM, Tamas Arpad ([EMAIL PROTECTED]) wrote:
> >> I was thinking if you use 90 character long filenames, assuming you
> >> only use the letters of the alphabet and the digits then you would
> >> have 62^90 different filenames, which is roughly 2E161 (2 followed by
> >> 161 zeros), which is quite a bit. Hopefully the numbers involved
> >> would make it infeasible for an attacker to loop through all the
> >> permutations.
> >
> > But what if the attacker just knows one file's name, for example
> > index.php or something that's in the url in the browser. Then he/she
> > can stole that file, read it, and gets other filenames because of
> > includes/requires. With some work he/she can get all the files without
> > any bruteforce filename guessing.
>
[...]
> If you adopt some of the practices (I think) included earlier in this
> thread by me, you could restrict browser access to your inc files by the
> use of smart file naming, dedicated directories and .htaccess files,
> then this should cover the basics of people grabbing your included files
> (with passwords etc) via http (browser).
>
> It doesn't cover people within the server (others on a shared server,
> etc) though.

Yes, but I think we were talking about the latter, when users have shell 
access on a shared server. Preventing from getting the php source through 
the web server is relatively easy, there are really a dozen of ways.

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

On Friday, June 28, 2002, at 06:14  PM, Lazor, Ed wrote:

> The hosting provider could probably implement a solution...  Alter the 
> FTP
> configuration to automatically set the group permission to that of the 
> web
> server when you transfer files.  You wouldn't need to be in the group.
> You're the owner and can modify your own files.  World Read access 
> would be
> unnecessary.

Someone pointed out last week that a maleficant can write a script that 
reads other files' data [and does something evil with that], since it 
will be executed as the web server user and the web server user can read 
all those files.

Erik




----

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

--- End Message ---
--- Begin Message ---
Easy,

http://www.zend.com/store/products/zend-encoder.php

Dan

-----Original Message-----
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 7:29 AM
To: Lazor, Ed
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Keeping "Secrets" in PHP Files



On Friday, June 28, 2002, at 06:14  PM, Lazor, Ed wrote:

> The hosting provider could probably implement a solution...  Alter the 
> FTP
> configuration to automatically set the group permission to that of the 
> web
> server when you transfer files.  You wouldn't need to be in the group.
> You're the owner and can modify your own files.  World Read access 
> would be
> unnecessary.

Someone pointed out last week that a maleficant can write a script that 
reads other files' data [and does something evil with that], since it 
will be executed as the web server user and the web server user can read 
all those files.

Erik




----

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


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

--- End Message ---
--- Begin Message ---
I'm having a problem using strip_tags.

When I try and run a table through strip_tags with the following vars, it
looses everything after the first cell with content in, i.e: nothing after
the first cell is returned, not even a </td>

can anyone help?

is this a PHP bug?


--- End Message ---
--- Begin Message ---
ive been tryin to find a solution for this problem for some hours now, but i
just dont know how to do it... so i ask for ur assistance. Lemme list some
examples, so u can see what im tryin to do :)
"word" = "word"
>word = >| word |
<word = <| word |
>"word = >|word |
<word" = <| word|

So if pattern is "word" it should stay "word", if patter is >"word it should
replace it with >|word | and so on as u see from examples... any help or
hints would be helpfull...

thats what i have now: preg_replace("#^[<|>]?[^\"](.*?)[^\"]$#i", "| \\0 |",
$string); .. but it doesnt work :P

thx in advance !


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

I am wondering if anybody has experiance in saving images to blob in mysql.

I do save images with 1 K and 4 KB to blob fields while I used to save them
to file. It seams to me that this is much slower accessing the files. The
images take a bit (really short but absolutly noticable) to show up on the
site. Is there a way to improve the performance, and why is this happening?
I thought the performance might even boost after storing them to blobs.

Thank you for any comments on that,

Andy

PS: I was planing to store all the other images (20 - 50 KB) to blobs as
well (thousands) but after this first experiance I am a bit confused if the
performance would even more suffer. Would you guys recommend this?


--- End Message ---
--- Begin Message ---
On Mon, 1 Jul 2002 14:17:53 +0200
"andy" <[EMAIL PROTECTED]> wrote:

> Hi there,
> 
> I am wondering if anybody has experiance in saving images to blob in mysql.
> 
> I do save images with 1 K and 4 KB to blob fields while I used to save them
> to file. It seams to me that this is much slower accessing the files. The
> images take a bit (really short but absolutly noticable) to show up on the
> site. Is there a way to improve the performance, and why is this happening?
> I thought the performance might even boost after storing them to blobs.

Not really, the OS filesystem contains features that makes it always faster than a sql 
query, that will increase your network traffic too.

Inserting images or whatever binary data in a database does not have much sense, you 
could not do a query with this field, cannot be indexed (dunno if exists a DB that 
implement a image indexer ;) ). Storing relative pathes gave me always more 
portabilities between DBM.

In some case, you have to insert images (or every others binary data) in DB (due to 
global permissions system only avaible for the DB and not for the filesystem, for 
example), but as far is possible, I avoid to do it so.

IMHO :)

pa
--- End Message ---
--- Begin Message ---
I have a table with id, pid(parent), title and page_name(url) fields.

The vars provided to the script are the current page's title, id and
pid(parent)

When I am on the parent page I get this(Which is what I want):
[ Chronological History ][ Website Chronological History ]

When I am in the Child I get this:

[ Website Chronological History ][ Website Chronological History ]

What am I doing wrong???

I have stared at this two many times now and am probably missing the obvious

function menu($id, $pid, $title) {
    $query = "select * from meta_data WHERE pid = '$id' OR pid = '$pid' &&
pid != 0";
    $result = mysql_query($query);
    $num_results = mysql_num_rows($result);
  if($num_results != 0){
  ?>
<table width="100%">
<tr><td align="center">
  <?
    echo '[ '.$title.' ]';
    for ($i=0; $i < $num_results; $i++)
      {
        $row = mysql_fetch_array($result);
        if($id == $row['id']){
            echo '[ '.$row['title'].' ]';
        } elseif($row['pid'] == $id || $row['id'] == $pid && $pid != 0) {
            echo '[ <a
href="'.$row['page_name'].'">'.$row['title'].'</a> ]';
        }
      }
    ?>
</td></tr>
</table>
  <?
  }




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

On Saturday, June 29, 2002, at 11:41  AM, Mike Tuller wrote:

> What is here is beyond my understanding, and seems like it is a little 
> much
> for what I need.
>
> Here is what my database table looks like:
>
> Departments
>     department_id
>     department_name
>
> I just want to list the department name in the popup.

although I wrote this instruction in response to a question about 
integrating the listbox with javaScript, ignore the JS stuff, and you 
will see how to dynamically populate a listbox with database data:

http://marc.theaimsgroup.com/?l=php-general&m=102503848224300&w=2



----

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

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

On Saturday, June 29, 2002, at 03:13  PM, Jed Verity wrote:

> I can't find any information on passing JavaScript variables to PHP on 
> the
> same page (i.e. not through the POST information of a submitted form). 
> Is
> this because it's not possible?
>
> To take the load off the server, I'm trying to do a bunch of string
> manipulations and loops in JavaScript and then hand that info off to PHP
> once it's done.

How will you communicate with PHP without submitting an HTTP request of 
some sort?  So, really, you will need to submit -something-, though it 
could be GET data, POST data, or COOKIE data.

You can't have JavaScript talk to PHP "within the same page" since the 
webserver/PHP "forgets" all information related to that page as soon as 
it shoots it to the user-agent.

I'm assuming you know how to use JavaScript to set a cookie, and/or make 
a new request with GET or POST data attached.  If not, let me know.


Erik




----

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

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

I want to create a multi dimensional arrays as below

$result[$something]['$key_string_01] = value_01
$result[$something]['$key_string_02] = value_02
$result[$something]['$key_string_03] = value_03
$result[$something]['$key_string_04] = value_04
$result[$something][0] = value_06
$result[$something][1] = value_07
$result[$something][2] = value_08
.
.
.

Here is what I did
1. use some assign statement $result[$something]['$key_string_0n'] =
value_0n for the first four elements
2. for the fifth elements onward, I used this
$result[$something] = preg_split(....);

However, as I test it with foreach loop, I am only getting

$result[$something][0] = value_06
$result[$something][1] = value_07
$result[$something][2] = value_08
.
.
.

I lost the first four elements!! Can anyone help on this please?

Thanks
/dl


--- End Message ---
--- Begin Message ---
To those who have used these content management systems: which one
renders pages faster, PostNuke or PHP-Nuke? I plan to set up a site on
my Linux box and want to know which one I should use. :)

Also, would anyone know of a PHP based content management system that
does not have the usual 3 columns look?

- Andoy




--- End Message ---
--- Begin Message ---
Good morning!

Over the weekend I attempted to set up another test platform on a Win98
laptop, running Apache as the server and MySQL as the database engine. Just
want to use it for some testing locally. No matter what I attempted I could
not get PHP to work. I followed suggestions from;

http://www.php.net/manual/en/install.windows.php

I tried some other experiments, and finally gave up. I would either get file
not found messages, or a server error. Has anyone ever done this kind of
install, and if so, is there something I can do to get it working? If not I
am going to install Linux on the laptop.

Thanks!

Jay


--- End Message ---
--- Begin Message ---
JB> Over the weekend I attempted to set up another test platform on a Win98
JB> laptop, running Apache as the server and MySQL as the database engine.

JB> I tried some other experiments, and finally gave up. I would either get file
JB> not found messages, or a server error. Has anyone ever done this kind of
JB> install,

All the time.  Never had a problem.

Tutorials here:
http://www.thickbook.com/extra/index.html?t=in

Installing MySQL on Windows is just an installer file.  PHP is already
configured to use it; nothing extra needed.


- Julie

--> Julie Meloni
--> [EMAIL PROTECTED]
--> www.thickbook.com

Find "Sams Teach Yourself MySQL in 24 Hours" at
http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20

--- End Message ---
--- Begin Message ---
Just went through - versions please?

Bruce Karstedt
President
Technology Consulting Associates, Ltd.
Tel: 847-735-9488
Fax: 847-735-9474


-----Original Message-----
From: Jay Blanchard [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 8:53 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Win98, Apache, PHP Config Problem
Importance: Low


Good morning!

Over the weekend I attempted to set up another test platform on a Win98
laptop, running Apache as the server and MySQL as the database engine. Just
want to use it for some testing locally. No matter what I attempted I could
not get PHP to work. I followed suggestions from;

http://www.php.net/manual/en/install.windows.php

I tried some other experiments, and finally gave up. I would either get file
not found messages, or a server error. Has anyone ever done this kind of
install, and if so, is there something I can do to get it working? If not I
am going to install Linux on the laptop.

Thanks!

Jay



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

--- End Message ---
--- Begin Message ---
[snip]
Just went through - versions please?
[/snip]

Apache 1.3, PHP 4.1

Thx!

Jay

--- End Message ---
--- Begin Message ---
[snip]
All the time.  Never had a problem.

Tutorials here:
http://www.thickbook.com/extra/index.html?t=in

Installing MySQL on Windows is just an installer file.  PHP is already
configured to use it; nothing extra needed.
[/snip]

 Yeah, I knew that about MySQL, I just couldn't get PHP working under
Apache. Apparently I am missing one of the .dll's (php4apache.dll). Thanks
for the insight, I will try to get it running again tonight using newer
versions of all.

Thanks!

Jay



--- End Message ---

Reply via email to