php-general Digest 24 Nov 2002 21:40:01 -0000 Issue 1724

Topics (messages 125773 through 125836):

Re: Newbie: element index array
        125773 by: Chase Urich
        125774 by: Kyle Gibson

Re: does //commenting reduce performance?
        125775 by: Kyle Gibson
        125781 by: DL Neil
        125783 by: Ernest E Vogelsinger
        125797 by: Ernest E Vogelsinger
        125798 by: . Edwin
        125804 by: DL Neil
        125806 by: DL Neil
        125808 by: Sterling Hughes
        125811 by: Ernest E Vogelsinger
        125817 by: Vincent Vandemeulebrouck

Creating mySql search feature.....
        125776 by: Cookra
        125777 by: Jean-Christian Imbeault
        125778 by: Hatem Ben
        125827 by: Marek Kilimajer

Re: sessions and trans-sid problem/question
        125779 by: Ernest E Vogelsinger
        125780 by: Ernest E Vogelsinger
        125785 by: Jean-Christian Imbeault
        125790 by: Justin French
        125793 by: Jean-Christian Imbeault
        125800 by: Ernest E Vogelsinger
        125801 by: Ernest E Vogelsinger
        125814 by: Michael Sims
        125819 by: Chris Shiflett

get info of sub-directories
        125782 by: gamin

Re: [PHP-WIN] Unable to upload.. :(
        125784 by: Boris Kolev

getting mysql dump using php
        125786 by: See Kok Boon
        125789 by: See Kok Boon
        125792 by: . Edwin
        125831 by: See Kok Boon

Stripslashes through an array.........
        125787 by: Cookra

backticks vs Safe Mode
        125788 by: Vincent Starre

Huffman encoding
        125791 by: Hatem Ben
        125794 by: Jean-Christian Imbeault
        125795 by: Jean-Christian Imbeault

Re: Secureing PHP.
        125796 by: . Edwin

Re: Huffman encoding / almost done
        125799 by: Hatem Ben

How do I Install PHP on Apache 2.0?
        125802 by: Tweak2x
        125803 by: Stephan Seidt
        125809 by: Tweak2x
        125810 by: Stephan Seidt
        125812 by: Tweak2x

Frequent question..Which Mailing List Script
        125805 by: Bret L Conard

rad tools, form paser/validator
        125807 by: Robert Mena

security of stand alone script
        125813 by: gamin
        125822 by: gamin
        125823 by: Stephen
        125825 by: DL Neil
        125830 by: Ernest E Vogelsinger

Re: Linux Question
        125815 by: Marek Kilimajer

Re: Insert file into sql server binary field.
        125816 by: Marek Kilimajer
        125818 by: Sterling Hughes
        125826 by: Marek Kilimajer
        125832 by: Chris Shiflett

php and caching
        125820 by: Alex
        125824 by: Stephan Seidt
        125828 by: Marek Kilimajer
        125833 by: Marco Tabini
        125834 by: Ernest E Vogelsinger

Parse URLs
        125821 by: Stephen

Cookies
        125829 by: Omid

Another cookie question
        125835 by: Øystein Håland
        125836 by: Kyle Gibson

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 ---
unset($a['element2']);

http://www.php.net/manual/en/function.unset.php

> I would like to ask that how can I completely delete the $a['element2'] in
> the array? That's mean I will get 'false' in 'isset($a['element2']) after
> the delete process is taken place.
-- 
Linux: Because rebooting is for adding hardware.
Fingerprint = CE24 057D 1E88 A253 3196 89DB 9FF0 9EF0 2F70 8BE8 BE8

Attachment: signature.asc
Description: This is a digitally signed message part

--- End Message ---
--- Begin Message ---
If I declared an element indexed array and put some values into it:

$a['element1'] = array('btime' => '19D', 'etime' => '22D', 'dayname' => 4);
$a['element2'] = array('btime' => '12D', 'etime' => '20D', 'dayname' => 2);
$a['element3'] = array('btime' => '15D', 'etime' => '17D', 'dayname' => 3);

I would like to ask that how can I completely delete the $a['element2'] in
the array? That's mean I will get 'false' in 'isset($a['element2']) after
the delete process is taken place.

Thanks for your help.
Use unset()

http://www.php.net/manual/en/function.unset.php

--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/

--- End Message ---
--- Begin Message ---
I have always had the opinion that the more comments you put into php
scripts, the slower they will run because there is more data to be read...
Can someone tell me if there is any truth in this or whether commenting has
absolutely 'no' impact on the performance of a script?
The comments are ignored, except the characters that initiate the actual comment.

//some comment
$somevar="va";

"some comment" wouldn't even be looked at. PHP sees the //, and goes to the next line.

I suppose on a large scale this could reduce performance, but the performance that is lost in standard applications is minuscule.

One thing you might want to avoid is using comments inside loops.


--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/

--- End Message ---
--- Begin Message ---
Adam,

> I have always had the opinion that the more comments you put into php
> scripts, the slower they will run because there is more data to be read...
> Can someone tell me if there is any truth in this or whether commenting
has
> absolutely 'no' impact on the performance of a script?


An answer proposed that there was little impact, but then suggested comments
not be used within loops (one presumes from this, the concern is that even a
little impact can mount up when repeated many times).

Why don't you run a microtime testbench to time a commented and an
uncommented loop, settle your mind, and report back with REAL information!?

Computer programming is the embodiment of 'write once, run many' manta.
Comments are no use at all during execution, but should be intended to be of
considerable assistance during the writing/maintaining phases. Never give
anyone an excuse for not writing (meaningful) comments - enough energy
already goes into creative excuses for that - and you may be the next to
suffer from some predecessor's arrogance! There are routines available which
take in a developer's script and output a comment-less, stripped-down for
maximum slipstream, dense code, version - ready for execution.

Regards,
=dn

--- End Message ---
--- Begin Message ---
At 09:42 24.11.2002, Adam said:
--------------------[snip]--------------------
>I have always had the opinion that the more comments you put into php
>scripts, the slower they will run because there is more data to be read...
>Can someone tell me if there is any truth in this or whether commenting has
>absolutely 'no' impact on the performance of a script?
--------------------[snip]-------------------- 

As PHP is an interpreter it needs to scan every line and every token of
code as it runs it. Thus said, of course using comments takes more time to
execute than having no comments.

I have no profiling yet how much having comments or blank lines would
actually effect execution times, but I doubt it would be really an issue
since PHP, once a comment start is encountered, doesn't parse the text but
just scans for the end-comment tag.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
At 12:58 24.11.2002, DL Neil said:
--------------------[snip]--------------------
>Why don't you run a microtime testbench to time a commented and an
>uncommented loop, settle your mind, and report back with REAL information!?
--------------------[snip]-------------------- 

Some time ago I've made myself a framework for such tests and have run it
against a commented loop. This test was run on a dual PIII/1000 Dell server.

    $hpr = _fwx_profile_start('Loop with end-of-line comment', true);
    for ($i = 0; $i < 1000000; ++$i) {
        $a += 1;        // this is an end-of-line comment
    }
    _fwx_profile_end($hpr, $i);
Average time per loop: 0.059 msec

    $hpr = _fwx_profile_start('Loop with inline comment', true);
    for ($i = 0; $i < 1000000; ++$i) {
        /* this is an inline comment */ $a += 1;
    }
    _fwx_profile_end($hpr, $i);
Average time per loop: 0.059 msec

    $hpr = _fwx_profile_start('Loop without comment', true);
    for ($i = 0; $i < 1000000; ++$i) {
        $a += 1;
    }
    _fwx_profile_end($hpr, $i);
Average time per loop: 0.059 msec

Conclusio: I didn't find any measurable difference in these loops, be it an
end-of-line comment, an inline comment, or no comment.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


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

"Ernest E Vogelsinger" <[EMAIL PROTECTED]> wrote:

> As PHP is an interpreter it needs to scan every line and every token of
> code as it runs it. Thus said, of course using comments takes more time to
> execute than having no comments.
>
> I have no profiling yet how much having comments or blank lines would
> actually effect execution times, but I doubt it would be really an issue
> since PHP, once a comment start is encountered, doesn't parse the text but
> just scans for the end-comment tag.

That said, it's reasonable to think that

//
//  I
//  have
//  long
//  comments
//  that
//  extends
//  hundreds,
//  if not,
//  thousands
//  of lines.
//  Just kidding! :)
//

  would be faster (unnoticeable it may be) than

/* -------------------------------------------------------------

 I
 have
 long
 comments
 that
 extends
 hundreds,
 if not,
 thousands
 of lines.
 Just kidding! :)

------------------------------------------------------------- */

Anyway, it's *always* better to have comments than nothing at all...

- E
--- End Message ---
--- Begin Message ---
Neatly done Ernest!
Also in showing how these questions are best answered with five minutes on
the PC, than a msg to the list...


> At 12:58 24.11.2002, DL Neil said:
> --------------------[snip]--------------------
> >Why don't you run a microtime testbench to time a commented and an
> >uncommented loop, settle your mind, and report back with REAL
information!?
> --------------------[snip]--------------------
>
> Some time ago I've made myself a framework for such tests and have run it
> against a commented loop. This test was run on a dual PIII/1000 Dell
server.
>
>     $hpr = _fwx_profile_start('Loop with end-of-line comment', true);
>     for ($i = 0; $i < 1000000; ++$i) {
>         $a += 1;        // this is an end-of-line comment
>     }
>     _fwx_profile_end($hpr, $i);
> Average time per loop: 0.059 msec
>
>     $hpr = _fwx_profile_start('Loop with inline comment', true);
>     for ($i = 0; $i < 1000000; ++$i) {
>         /* this is an inline comment */ $a += 1;
>     }
>     _fwx_profile_end($hpr, $i);
> Average time per loop: 0.059 msec
>
>     $hpr = _fwx_profile_start('Loop without comment', true);
>     for ($i = 0; $i < 1000000; ++$i) {
>         $a += 1;
>     }
>     _fwx_profile_end($hpr, $i);
> Average time per loop: 0.059 msec
>
> Conclusio: I didn't find any measurable difference in these loops, be it
an
> end-of-line comment, an inline comment, or no comment.
>
>
> --
>    >O     Ernest E. Vogelsinger
>    (\)    ICQ #13394035
>     ^     http://www.vogelsinger.at/
>
>
>

--- End Message ---
--- Begin Message ---
Ernest,

> Some time ago I've made myself a framework for such tests and have run it
> against a commented loop. This test was run on a dual PIII/1000 Dell
server.
>
>     $hpr = _fwx_profile_start('Loop with end-of-line comment', true);
>     for ($i = 0; $i < 1000000; ++$i) {
>         $a += 1;        // this is an end-of-line comment
>     }
>     _fwx_profile_end($hpr, $i);
> Average time per loop: 0.059 msec
>
>     $hpr = _fwx_profile_start('Loop with inline comment', true);
>     for ($i = 0; $i < 1000000; ++$i) {
>         /* this is an inline comment */ $a += 1;
>     }
>     _fwx_profile_end($hpr, $i);
> Average time per loop: 0.059 msec
>
>     $hpr = _fwx_profile_start('Loop without comment', true);
>     for ($i = 0; $i < 1000000; ++$i) {
>         $a += 1;
>     }
>     _fwx_profile_end($hpr, $i);
> Average time per loop: 0.059 msec
>
> Conclusio: I didn't find any measurable difference in these loops, be it
an
> end-of-line comment, an inline comment, or no comment.


=Apologies: I hit 'Send' on the preceding msg, even before signing off...
Duh!

=I have a similar test bench/frame, but which only puts out microtime
differences. My personal/dev PC is an Armada portable with 266MHz processor
and so is considerably more modest than your own beastie.

=I find that because the wee beastie is running PHP, Apache server, MySQL
server, etc, etc; that multiple runs of the same code can yield considerable
differences in execution time - see also warnings in manual, eg 'caching'.
Accordingly I run six cycles and record the last three:

=Herewith:
End of line comment: 4.3118, 4.415713, 4.342078
Inline comment: 4.331843, 4.403446, 4.339082
Loop without comment: 4.415728, 4.399776, 4.420114

=however a quick analysis shows that the fastest-slowest differences are:
.104, .072, and .021 (secs, resp)

=the differences between test types run to:
slow end: .012, and .017
fast end: .020 and .068

=In other words, apart from the first set of tests, any and all differences
are insignificant/disappear into 'noise'. However, if the "Loop without
comment" results make sense to you - you're a better man than I, Gunga Din!

=Concur completely with your own analysis,
=dn

--- End Message ---
--- Begin Message ---
> At 09:42 24.11.2002, Adam said:
> --------------------[snip]--------------------
> >I have always had the opinion that the more comments you put into php
> >scripts, the slower they will run because there is more data to be read...
> >Can someone tell me if there is any truth in this or whether commenting has
> >absolutely 'no' impact on the performance of a script?
> --------------------[snip]-------------------- 
> 
> As PHP is an interpreter it needs to scan every line and every token of
> code as it runs it. Thus said, of course using comments takes more time to
> execute than having no comments.
> 
> I have no profiling yet how much having comments or blank lines would
> actually effect execution times, but I doubt it would be really an issue
> since PHP, once a comment start is encountered, doesn't parse the text but
> just scans for the end-comment tag.
>

Having comments within loops is no different than having comments anywhere else
in your PHP scripts, comments are stripped out in the lexical analysis phase, 
and therefore, they don't even enter into consideration in the execution phase.

If you're worried about the extra lex/io time on your scripts then (besides 
being a little insane :), you should just be using a cache like the PHP 
Accelerator or APC, which will make comments give you absolutely no performance
hit.

-Sterling
--- End Message ---
--- Begin Message ---
At 16:10 24.11.2002, DL Neil said:
--------------------[snip]--------------------
>However, if the "Loop without
>comment" results make sense to you - you're a better man than I, Gunga Din!
--------------------[snip]-------------------- 

I'd rather have my scripts crawl than having no comments in them *g*


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
> I have always had the opinion that the more comments you put into php
> scripts, the slower they will run because there is more data to be read...
> Can someone tell me if there is any truth in this or whether commenting
has
> absolutely 'no' impact on the performance of a script?

If the overhead of the parser removing comments becomes an issue for you,
you'll probably be in the situation where your application is heavy, with
thousands of scripts, and a lot of commenting everywhere.

As said before, the comments only impact the parsing. So, you just have to
implement a "stripcomment" script, that you run when you move your script
from your development server to your production server.

And anyway, this would not be significant, unless you recompile a custom PHP
version where you remove the comment parsing. This would be intereting if
your code was already optimized...

Vincent Vandemeulebrouck

--- End Message ---
--- Begin Message ---
Hi all,
    Need a little help here been at this for a while now...

I have a database holding a table which in turn holds a collection of fields
I need to search.

Ive set up search form that sends the variable $S_For and $S_From, these
variables represent the following:

$S_For = the search keyword itself
$S_From = the column which I need to search

Ive created this and it works fine for single words, the problem as you may
of guessed is when I enter a string of words ie:

apple - works fine

orange - works fine

apple orange - doesnt

Any help would be ideal!!!!

-----------------

Databse = clientacc
Table = hospitality

-----------------

Everything else works on my site apart from this search
feature.............. please help!


Regards

R


--- End Message ---
--- Begin Message ---
Cookra wrote:
Any help would be ideal!!!!
Some code would be nice. Youdidn't post any code so we have no idea what your problem might be ... do you get an error message, or no results, or the wrong results?

We don't even what what SQL query you are using ...

Jc

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

What you need is :
1-     parse your query and make it boolean
"apple orange"  become "apple and orange" and so on

2- then you can generate a MySQL query based on that like this way

-----------
SELECT id, field1
match (field1) against (' apple orange ') as relevance
FROM hospitality
WHERE
match (field1) against ('apple')>0 AND match (field1) against ('orange')>0
HAVING relevance>0
ORDER BY relevance DESC
-----------

field1 will be your field(s) you're searching in.

Hope this will help
Hatem


"Cookra" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> Hi all,
>     Need a little help here been at this for a while now...
>
> I have a database holding a table which in turn holds a collection of
fields
> I need to search.
>
> Ive set up search form that sends the variable $S_For and $S_From, these
> variables represent the following:
>
> $S_For = the search keyword itself
> $S_From = the column which I need to search
>
> Ive created this and it works fine for single words, the problem as you
may
> of guessed is when I enter a string of words ie:
>
> apple - works fine
>
> orange - works fine
>
> apple orange - doesnt
>
> Any help would be ideal!!!!
>
> -----------------
>
> Databse = clientacc
> Table = hospitality
>
> -----------------
>
> Everything else works on my site apart from this search
> feature.............. please help!
>
>
> Regards
>
> R
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message --- You first need to separate the words and then build your query:

$words = explode(' ',$S_For);
$cond='';
foreach($word as $str) {
$cond .= " $S_From LIKE '%$str%' AND "; // replace AND with OR if you want ANY word
}
// remove trailing AND(last 4 chars) or OR(last 3 chars)
$cond = substr($cond, 0, strlen($cond) - 4); // this is for AND

And I hope you check the value of $S_From if it is valid


Cookra wrote:

Hi all,
Need a little help here been at this for a while now...

I have a database holding a table which in turn holds a collection of fields
I need to search.

Ive set up search form that sends the variable $S_For and $S_From, these
variables represent the following:

$S_For = the search keyword itself
$S_From = the column which I need to search

Ive created this and it works fine for single words, the problem as you may
of guessed is when I enter a string of words ie:

apple - works fine

orange - works fine

apple orange - doesnt

Any help would be ideal!!!!

-----------------

Databse = clientacc
Table = hospitality

-----------------

Everything else works on my site apart from this search
feature.............. please help!


Regards

R





--- End Message ---
--- Begin Message ---
At 08:47 24.11.2002, Jean-Christian Imbeault said:
--------------------[snip]--------------------
>Ernest E Vogelsinger wrote:
> >
>>     if ($_COOKIE[$_SESSION['cookie_name']] == $_SESSION['cookie_token']) {
>
>Ok, please forgive my ignorance, but in PHP isn't $_COOKIES the same as 
>$_SESSION?. I thought it was if the user had cookies turned off (and 
>even if the user had cookies turned on come to think of it) ... If not 
>I'm in trouble.
>
>I was always under the impression that $_SESSION vars were passed as 
>cookies ...
--------------------[snip]-------------------- 

No, that's a misunderstanding. Session var's are never passed to and from
the client, only the session _name_ is passed, either via a cookie
(PHPSESSIONID) or via trans-sid href encoding.

Session vars are kept server-side in session storage, which is (by default)
a file located in the directory where session.save_path is pointing to. The
default file name  is sess_<session-identifier>. The client only transmits
the session identifier so the server is able to correlate a session to a
particular request.

What I did for this particular application was to extend the system with a
cookie that's programmatically sent, using a random cookie name and a
random cookie content. Thus I am able to distinguish between multiple
logical sessions using the same session identifier, a scenario that could
happen when a URL containing a trans-sid has been bookmarked or transfered,
or when the client had opened a new window within the same session and
continued in "split mode".

Whatever the client passes to PHP as a cookie you can access in the
$_COOKIES array. Whatever PHP has stored in session storage can be accessed
in the $_SESSION array. They are quite different.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
At 08:56 24.11.2002, Jean-Christian Imbeault said:
--------------------[snip]--------------------
>session.gc_maxlifetime does set the lifetime of a session, but a session 
>will not be cleaned by PHP until session.gc_probability has been hit. 
>Again, if my understanding is correct, PHP doesn't automatically check 
>to see if a session has expired before accessing it. It pre-supposes 
>that any session file lying around is till active. And those session 
>file will stay there until session.gc_probability has been hit.
>
>I might be wrong though ...
--------------------[snip]-------------------- 

You're quite right :=


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
Ernest E Vogelsinger wrote:
No, that's a misunderstanding. Session var's are never passed to and from
the client, only the session _name_ is passed, either via a cookie
(PHPSESSIONID) or via trans-sid href encoding.
Thanks for clearing that up! I hadn't realized that only the session name was passed around. I thought all the session data was too.

This now hands me a dilemma ... I was building my site conservatively, i.e. assuming the user would have cookies turned off. And so I am making heavy use of session variables. *But* I had thought that if the user had cookies enabled then the variables would be saved as cookie information, hence saving my server a lot of disk reads and writes. Now you have shown me the err of my ways ...

I have to consider rewriting my scripts so that if cookies *are* enabled the session information is sent has cookie data. Hum ... I hate re-writes ....

Jc

--- End Message ---
--- Begin Message ---
on 24/11/02 11:10 PM, Jean-Christian Imbeault ([EMAIL PROTECTED]) wrote:

> This now hands me a dilemma ... I was building my site conservatively,
> i.e. assuming the user would have cookies turned off. And so I am making
> heavy use of session variables. *But* I had thought that if the user had
> cookies enabled then the variables would be saved as cookie information,
> hence saving my server a lot of disk reads and writes. Now you have
> shown me the err of my ways ...
> 
> I have to consider rewriting my scripts so that if cookies *are* enabled
> the session information is sent has cookie data. Hum ... I hate
> re-writes ....

I'd leave it as is... this ensures that ALL users can use the site, because
the session id can be passed around in either the URL or cookies... and
enabling trans sid means you don't even have to worry about it... PHP will
use cookies if possible, or else append it to the URLs.

What sort of stuff are you storing in the session that your are worried
about with too many writes?



Justin French
--------------------
http://Indent.com.au
Web Development & 
Graphic Design
--------------------

--- End Message ---
--- Begin Message ---
Justin French wrote:
What sort of stuff are you storing in the session that your are worried
about with too many writes?
Oh, this site is just your regular, run-of-the-mill, amazon.com copy.

For each open session I store up to 20 variables. It's not a lot, but each access to a script means a disk read/write so they will eventually add up if there are enough users.

Of course this problem goes away if you throw enough money at the hardware ...

Jc

--- End Message ---
--- Begin Message ---
At 13:10 24.11.2002, Jean-Christian Imbeault said:
--------------------[snip]--------------------
>This now hands me a dilemma ... I was building my site conservatively, 
>i.e. assuming the user would have cookies turned off. And so I am making 
>heavy use of session variables. *But* I had thought that if the user had 
>cookies enabled then the variables would be saved as cookie information, 
>hence saving my server a lot of disk reads and writes. Now you have 
>shown me the err of my ways ...
>
>I have to consider rewriting my scripts so that if cookies *are* enabled 
>the session information is sent has cookie data. Hum ... I hate 
>re-writes ....
--------------------[snip]-------------------- 

Why would you do that? session data is read and decoded once from a LOCAL
file, while transmitting all session data over a REMOTE line would be much
slower. Further it's MORE than insecure to hand possibly sensitive session
data to the client where any bad guy might tamper with it and harm your
application. Lastly cookies are limited to a certain size of data (I
believe it's 1k but I don't know exactly).

Use sessions as intended, it's a very well tested and very fast way to
create a persistent state across multiple subsequent connections.

If you don't like the file approach you can always invent your own session
handling system, be it database-driven (which would be even slower), or
some kind of session-server process that runs locally and gets contacted by
the applications, or even some shared memory... choose your ways, but keep
your data at the server's.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
At 14:15 24.11.2002, Jean-Christian Imbeault said:
--------------------[snip]--------------------
>Oh, this site is just your regular, run-of-the-mill, amazon.com copy.
>
>For each open session I store up to 20 variables. It's not a lot, but 
>each access to a script means a disk read/write so they will eventually 
>add up if there are enough users.
>
>Of course this problem goes away if you throw enough money at the 
>hardware ...
--------------------[snip]-------------------- 

Assuming you're running a server operating system (either Linux, or other
X, or even Win2K _server_) disk i/o gets already greatly reduced by the OS.
Any server OS implements its own decent file i/o cache that leverages
repeated disk i/o transparently. I wouldn't bother about that too much.

What you should keep in mind that the OS needs enough memory to build up
its decent cache. Which would mean that you plug in more memory banks the
more users you have. If you suspect your server is slowing down because of
disk i/o why not run a realtime performance log to see where bottlenecks
are, and to act accordingly then?

My experience shows that file session storage is the very last bottleneck
that ever would occur; the database times add up much quicker than any
session file i/o would ever be able to.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
On Sun, 24 Nov 2002 17:01:21 +0900, you wrote:

>Michael Sims wrote:
>> 
>> Then I suppose it's just an added feature of the session handler I am
>> using.  Maybe the OP should give it a shot, as I use it and I
>> definitely don't have a problem with expired sessions
>
>I'll think about writing my own session handler as it can be quite 
>useful. However I need to evaluate the amount of extra disk read/writes 
>it would add. Using a DB vs the file system does add some overhead ...

Experience has taught me that the additional overhead is negligible,
especially if the database is running locally on the web server...

Having a DB based session handler comes in very handy when you are
troubleshooting a new session-based application.  It's much easier to
run queries against active sessions that to mess around with files,
IMHO.

Good luck...
--- End Message ---
--- Begin Message ---
--- Jean-Christian Imbeault <[EMAIL PROTECTED]> wrote:

> This now hands me a dilemma ... I was building my site
> conservatively, i.e. assuming the user would have
> cookies turned off. And so I am making heavy use of
> session variables. *But* I had thought that if the
> user had cookies enabled then the variables would be
> saved as cookie information, hence saving my server a
> lot of disk reads and writes.
>
> Now you have shown me the err of my ways ...
> 
> I have to consider rewriting my scripts so that if
> cookies *are* enabled the session information is sent
> has cookie data.

There are two reasons why you should not consider such a rewrite:

1. performance
2. security

You say you want to pass data as cookies to save your server the
latency of disk access. Think about that for a moment, and you will
see that it makes no sense. This is similar to making a decision to
store all of your data on a remote FTP server rather than your local
disk, thinking that this somehow saves you time. Regardless of how
much bandwidth your network has and how slow your disk is, there is
no way transmitting this data to/from the client across the Internet
is going to be faster than local disk access. Floppy access is
probably not even as slow as what you are considering.

A more important reason to avoid the rewrite you are considering is
security. A cookie is sent by the client. The client can be anyone
using your site. What if the client is trying to circumvent your
site's security in some way? Do you really want to trust everyone who
visits to be honest?

When you set a cookie, you are asking the client to send that cookie
(value unchanged of course) in future requests. There is nothing
aside from honesty that keeps a client from changing the cookie.

Also, cookies are intended as a mechanism for maintaining state. This
means that they are well-suited for helping you identify a client
(the Web browser). Session management requires a little bit more, and
this is where PHP sessions come into play. Cookies are a poor choice
for session management (state management + maintaining client data),
and this is what it seems like you are considering.

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

   i wanted to know if given a certain dir it is possible to get all the
sub-directories and files in an XML document. There could be many ways to do
this, just wandering if anybody has already done this.

thx in advance

gamin.


--- End Message ---
--- Begin Message ---
This is a forwarded message
From: Boris Kolev <[EMAIL PROTECTED]>
To: toby z <[EMAIL PROTECTED]>
Date: Sunday, November 24, 2002, 2:02:09 PM
Subject: [PHP-WIN] Unable to upload.. :(

===8<==============Original message text===============
Hello toby,

Sunday, November 24, 2002, 1:04:25 PM, you wrote:

tz> Hi all
tz> I am trying to upload a file. It works fine on my local Apache, but
tz> gives me "Permission denied to create file" error on my online host..
tz> Any clue???

tz> $file = $_FILES['userfile']['tmp_name'];
tz> if (is_uploaded_file($file)) 
tz>    print_r("Copying ".$file);
tz>      if (copy($file, "./files/". $_FILES['userfile']['name'])) 
tz>               echo("Success");

tz>      else
tz>               echo("Failure");


tz> __________________________________________________
tz> Do You Yahoo!?
tz> Everything you'll ever need on one web page
tz> from News and Sport to Email and Music Charts
tz> http://uk.my.yahoo.com

Hi
because online apache use user to create files in folder but your
administrator must give rights(access) to tish user in this folder to
create files :))

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

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

yes think i need more info to the "mysqldump utility". i suppose you mean
there is in fact this utility?

-----Original Message-----
From: Rich Gray [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 24, 2002 8:14 PM
To: See Kok Boon; PHP
Subject: RE: [PHP] getting mysql dump using php


Answer is No. 2)

Use cron to run the mysqldump utility instead of a php script.
Let me know if you need more info.

Cheers
Rich




--- End Message ---
--- Begin Message ---
thanks Morgan,

i am sure your script will do a great job... unfortunately, crontab returns
/bin/mail permission denied... and i cant chage system settings because i am
not the WSP (or ISP)

actually... i am thinking of something really silly.. but it will work
surely... and that is to use "SELECT *" then use a loop to format the
results into a database dump (data and structure) and then email the content
to myself. how's that?

-----Original Message-----
From: Morgan Hughes [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 24, 2002 12:35 PM
To: PHP
Subject: RE: [PHP] getting mysql dump using php


On Sun, 24 Nov 2002, Rich Gray wrote:

> Answer is No. 2)
> Use cron to run the mysqldump utility instead of a php script.
> Let me know if you need more info.

  I use this one with crontab, it works pretty well, if your email program
  can handle uuencode:


#!/bin/sh
# File    : db_backup.sh
# Descript: Runs a ful mysqldump of one or more MySQL databases, uuencodes
#           and compresses them, and mails them to a specified address.
#           Requires mysqldump, gzip, uuencode, mail or mailx, and crontab.
#
#           Normally this run from crontab, with an entry like:
#             0 3 * * * sh ~/db_backup
#
# Version : 1.00
# Author  : Morgan Hughes ([EMAIL PROTECTED])
# License : Copyright (C) 2002, Morgan Hughes.  Use freely.


# Account/password/email info
db_list="your_database"
db_user="your_username"
db_pass="your_password"
email="your_email_addy"

# program locations
mysqldump="mysqldump"
dump_opts=""
uuencode="uuencode"
gzip="gzip"
mail="mail"

# Actual code
for db_name in $db_list ; do

        date=`date '+%Y%m%d-%H%M%S'`
        $mysqldump $dump_opts -u $db_user "--password=$db_pass" $db_name | \
        $gzip -c9 | $uuencode "$db_name-$date.sql.gz" | \
        $mail -s "DB backup, $db_name, $date" $email

done

# Ends    : db_backup.sh



  At home I have a script plugged into .procmailrc with an entry like:

# First off, catch inbound automated backups.
:0
* ^Subject: DB backup, kyhm
| ~/bin/catch_backup ~/kyhm.com/backups/db



  The ~/bin/catch_backup script is as follows:

#!/bin/sh
if [ "$1" != "" -a -d "$1" ] ; then
        cd "$1"
else
        cd ~
fi
cat | uudecode



  Hope this is useful...

--
   Morgan Hughes
   C programmer and highly caffeinated mammal.
   [EMAIL PROTECTED]
   ICQ: 79293356



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



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

...seems like Rich is not available yet so let me try :)

"See Kok Boon" <[EMAIL PROTECTED]> wrote:

> hi Rich,
>
> yes think i need more info to the "mysqldump utility". i suppose you mean
> there is in fact this utility?

Well, most probably you'll be able to find it inside your mysql/bin
directory.

Check the manual for more info:

  http://www.mysql.com/doc/en/mysqldump.html

And of course you can google for some related info ;)

  http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=mysqldump

HTH,

- E
--- End Message ---
--- Begin Message ---
thanks Edwin!!

oki... now that i can create the dump, i'll just use lynx from crontab to
send the dump as attachment to my email. thanks!

-----Original Message-----
From: @ Edwin [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 24, 2002 9:24 PM
To: See Kok Boon
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] getting mysql dump using php


Hello,

...seems like Rich is not available yet so let me try :)

"See Kok Boon" <[EMAIL PROTECTED]> wrote:

> hi Rich,
>
> yes think i need more info to the "mysqldump utility". i suppose you mean
> there is in fact this utility?

Well, most probably you'll be able to find it inside your mysql/bin
directory.

Check the manual for more info:

  http://www.mysql.com/doc/en/mysqldump.html

And of course you can google for some related info ;)

  http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=mysqldump

HTH,

- E


--- End Message ---
--- Begin Message ---
Hi all is it possible to stripslahes from this query?



$results = mysql_query("SELECT * FROM $DB_Table_A ORDER BY name ASC LIMIT
$page, $limit");

while ($data = (mysql_fetch_array($results)))
{
//-->< something here would be nice
}


Thanks..........



Regards

R


--- End Message ---
--- Begin Message ---
I can think of no security reason why you would want to allow anyone to 
display output from a command, but wouldnt want them to be able to assign 
that output to a variable. Can someone explain a situation where that would 
be useful? Arent any security concerns addressed by the safe_mode_exec_dir= 
directive? Is there any way to get the safety of safe mode without this 
seemingly backwards rule? [If I was a malicious user with the ability to 
upload a script, I certainly wouldnt be at all hindered by being unable to 
have the script itself parse the output- I'd get a seperate script to do that 
for me and POST the results back to the server's script just as fast.]

{The intent of this message is to find a way to circumvent this idiocy, to be 
noticed by a developer who will go "oops, did we leave that idiocy in?" or to 
be presented with an explanation for what is seemingly, idiocy. }
--- End Message ---
--- Begin Message ---
Hey all

I'm looking to implement the huffman encoding in PHP, but i would like to
ask if it isn't already done ? (why reinventing the wheel)

Thx
Hatem

--- End Message ---
--- Begin Message ---
Hatem Ben wrote:
I'm looking to implement the huffman encoding in PHP, but i would like to
ask if it isn't already done ? (why reinventing the wheel)
You have highjacked someone else's thread. Not very nice of you ....

Please repost and start your own message thread ... highjacked threads rarely get any responses ...

Jc

PS the reason you highjacked the thread is that you used the "reply" button while reading a post and simply deleted the subject. That is not good.

To post a new question use the "new message" or "compose" button of your newsgroup reader. That is good.

--- End Message ---
--- Begin Message ---
Hatem Ben wrote:
I'm looking to implement the huffman encoding in PHP, but i would like to
ask if it isn't already done ? (why reinventing the wheel)
You have highjacked someone else's thread. Not very nice of you ....

Please repost and start your own message thread ... highjacked threads rarely get any responses ...

Jc

PS the reason you highjacked the thread is that you used the "reply" button while reading a post and simply deleted the subject. That is not good.

To post a new question use the "new message" or "compose" button of your newsgroup reader. That is good.

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

"Steven Adams" <[EMAIL PROTECTED]> wrote:

> Hi,
>     I am looking to secure my php install, like the settings in php.ini
etc.
>
> I am using apache 1.3.27 and running latest php.
>
> Is there like a tut or something that can take u thought the php.ini and
> explain ina little more detail?
>
> safe_mode = Off
>
> is that a bad idea or should i leave it on..

I suggest you leave it on. (Never really had any reason myself to turn it
on.)

More info in the manual:

  http://www.php.net/manual/en/features.safe-mode.php

- E
--- End Message ---
--- Begin Message ---
Sorry for the last email (i wasn't looking to highjack any thread :( very sorry guys !)


----- Original Message ----- 
From: "Hatem Ben" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Sunday, November 24, 2002 2:06 PM
Subject: [PHP] Huffman encoding


> Hey all
> 
> I'm looking to implement the huffman encoding in PHP, but i would like to
> ask if it isn't already done ? (why reinventing the wheel)
> 
> Thx
> Hatem
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
can somebody please help me? I cant figure it out.


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

You must build a shared library by configuring php with --with-apxs2.

On Sun, 24 Nov 2002 09:42:40 -0500
[EMAIL PROTECTED] (Tweak2x) wrote:

> can somebody please help me? I cant figure it out.
> 
> 
--- End Message ---
--- Begin Message ---
how do i do that?

"Stephan Seidt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> You must build a shared library by configuring php with --with-apxs2.
>
> On Sun, 24 Nov 2002 09:42:40 -0500
> [EMAIL PROTECTED] (Tweak2x) wrote:
>
> > can somebody please help me? I cant figure it out.
> >
> >


--- End Message ---
--- Begin Message ---
windows, unix ?


On Sun, 24 Nov 2002 10:26:21 -0500
[EMAIL PROTECTED] (Tweak2x) wrote:

> how do i do that?
> 
> "Stephan Seidt" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi,
> >
> > You must build a shared library by configuring php with --with-apxs2.
> >
> > On Sun, 24 Nov 2002 09:42:40 -0500
> > [EMAIL PROTECTED] (Tweak2x) wrote:
> >
> > > can somebody please help me? I cant figure it out.
> > >
> > >
> 
> 
--- End Message ---
--- Begin Message ---
windows xp pro

"Stephan Seidt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> windows, unix ?
>
>
> On Sun, 24 Nov 2002 10:26:21 -0500
> [EMAIL PROTECTED] (Tweak2x) wrote:
>
> > how do i do that?
> >
> > "Stephan Seidt" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Hi,
> > >
> > > You must build a shared library by configuring php with --with-apxs2.
> > >
> > > On Sun, 24 Nov 2002 09:42:40 -0500
> > > [EMAIL PROTECTED] (Tweak2x) wrote:
> > >
> > > > can somebody please help me? I cant figure it out.
> > > >
> > > >
> >
> >


--- End Message ---
--- Begin Message ---
Howdy List,

I know this gets asked alot, but:............

Does anyone have a recommendation for a *good* mailing list management script?
Requirements:
Multiple domain support
PHP 4 
MySQL 

Any thought are appreciated


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

I've been working with php for a while and whenever I
have the chance I give some tutorials/speeches about
it to other developers, specially those with no
experience with web development.

They all find easy but in one point or another start
asking about an IDE with a debugger, variable watch
etc or RAD tools (they come from Visual Basic/Delphi
enviroments).

In the IDE part I know we have some paid tools (such
as Zend) but can't tell anything that could count as
RAD tool.

So, I'd like to know if there are any RAD tools ,
either free or paid that you know.

One thing that I am planing to develop, or enhance if
I found something similar already, is a form
"parser/validator".

Suppose your design department comes with a real nice
html-css-form and you need to validate it, send the
content as email or add in a database.

This tool would read the HTML and prompt you for the
optional/required fields, validation options
(minimum/max length) etc, send via email or add in a
database..

Then would generate the php code to validate and
perform the required actions.

I think there is a classe (from manuel lemos) that
does soemthing similar but also generate the form
itself based on a definition.

What do you thing about it ?

The ideia is to speed up the repetitive/boring stuff
leting the developer focus on special logic - usually
restricted to fewer options.

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
--- End Message ---
--- Begin Message ---
Hi,

   Running Red Hat 7.2, PHP 4.0.6. Is there any way of knowing if a certain
PHP script was run from the command line, shell script or through the
webserver (Apache). May be i could check the user calling the script and
find out but how would i do that ?

thx in advance

gamin



--- End Message ---
--- Begin Message ---
i guess i can use $remote_addr to see if the user has an IP.

But still out of curosity - any way of knowing the user that called the
script ?

gamin.

Gamin" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
>    Running Red Hat 7.2, PHP 4.0.6. Is there any way of knowing if a
certain
> PHP script was run from the command line, shell script or through the
> webserver (Apache). May be i could check the user calling the script and
> find out but how would i do that ?
>
> thx in advance
>
> gamin
>
>
>


--- End Message ---
--- Begin Message ---
Just a little note. Don't use $remote_addr. I would strongly recomend using
$HTTP_SERVER_VARS["REMOTE_ADDR"].


----- Original Message -----
From: "gamin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 24, 2002 1:10 PM
Subject: [PHP] Re: security of stand alone script


> i guess i can use $remote_addr to see if the user has an IP.
>
> But still out of curosity - any way of knowing the user that called the
> script ?
>
> gamin.
>
> Gamin" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi,
> >
> >    Running Red Hat 7.2, PHP 4.0.6. Is there any way of knowing if a
> certain
> > PHP script was run from the command line, shell script or through the
> > webserver (Apache). May be i could check the user calling the script and
> > find out but how would i do that ?
> >
> > thx in advance
> >
> > gamin
> >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

>    Running Red Hat 7.2, PHP 4.0.6. Is there any way of knowing if a
certain
> PHP script was run from the command line, shell script or through the
> webserver (Apache). May be i could check the user calling the script and
> find out but how would i do that ?


There is a difference in the way argc and argv are managed - see manual.

Also (do two phpinfo() runs to check - one under Apache and one from the
command line) depending upon the web server (Apache in our cases) there are
whole sections of the 'standard output' that do not have relevance from the
command line (because there is no web server!), eg SERVER_SOFTWARE and
SERVER_SIGNATURE.

Should you figure out something better than this, please let me know too!

Regards,
=dn

--- End Message ---
--- Begin Message ---
At 19:10 24.11.2002, gamin said:
--------------------[snip]--------------------
>i guess i can use $remote_addr to see if the user has an IP.
>
>But still out of curosity - any way of knowing the user that called the
>script ?
--------------------[snip]-------------------- 

If the script is called via command line, at least these fields in the
$_SERVER array are empty/unset:
    SERVER_NAME
    REMOTE_IP
I don't even know if the $_SERVER array is set at all.

You can disable any PHP script to be run from the command line by setting
the appropriate file permissions (e.g. chown root:apache, chmod 640 *).


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message --- You might solve this by providing different style sheet to on linux running browsers:
if(ereg('Linux',$_SERVER['HTTP_USER_AGENT'])) {
echo '<link REL="StyleSheet" HREF="linux.css" TYPE="text/css">';
} else {
echo '<link REL="StyleSheet" HREF="win.css" TYPE="text/css">';
}


conbud wrote:

Hey. This really isnt a PHP question. but what fonts do you reccomend using
so they look decent on linux. Mainly looking for a good font that will look
nice in MoZilla and Galeon. Almost all the fonts Ive used so far appear
really tiny or really bold and not very good to read.

-Lee





--- End Message ---
--- Begin Message ---
Read the file, addslashes(), and then insert it

Naif Al-Otaibi wrote:

How can I insert a file into a binary field in sql server 2000. Do I need some function in the query like upload or just read the file and insert it.

Thanks,



--- End Message ---
--- Begin Message ---
> Read the file, addslashes(), and then insert it
>
Rather, read the file, don't touch addslashes, then insert it.

AddSLashes is not for binary data...

-Sterling



> Naif Al-Otaibi wrote:
> 
> >How can I insert a file into a binary field in sql server 2000. Do I 
> >need some function in the query like upload or just read the file and 
> >insert it.
> >
> >Thanks,
> >
> > 
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
--- End Message ---
--- Begin Message --- Never heard of that, in fact, addslashes escapes also NUL, so it must be binary,
and BLOB is like TEXT, except for comparison is case sensitive in BLOB.
And what if the file contains malicious code - it might come from remote user's upload

Sterling Hughes wrote:

Read the file, addslashes(), and then insert it


Rather, read the file, don't touch addslashes, then insert it.

AddSLashes is not for binary data...

-Sterling




Naif Al-Otaibi wrote:


How can I insert a file into a binary field in sql server 2000. Do I need some function in the query like upload or just read the file and insert it.

Thanks,




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




--- End Message ---
--- Begin Message ---
--- Marek Kilimajer <[EMAIL PROTECTED]> wrote:

> BLOB is like TEXT

In what way? BLOB is binary large object. Text is ... text. One is
binary, and the other is ASCII. The only similarity I can think of is
that they both represent data. However, the format is completely
different.

Open up a binary file in a text editor, and then do the same with a
regular text file. I think you will notice a significant difference.
Or, consider the representation of 16 in binary versus ASCII:

binary - 10000
ascii - 0011000100110110

As Sterling mentioned, using addslashes() on binary data is a bad
idea. The same can be said for any string operations intended for
ASCII data.

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

I have a few pages on my site that contains dynamical content that must be
"processed" each time the page is loaded. But I'd also want to allow the
users to be able to use the back button of their browser to go back to forms
and that these forms still contain the information they entered (instead of
being cleared).

Can someone give me a hint on how to accomplish this if there's a way to do
it?

Thanks,

Alexandre Soares


--- End Message ---
--- Begin Message ---
Maybe Pear's Cache class could help you..
But I'm not sure, never played around with it in detail.

On Sun, 24 Nov 2002 12:47:08 -0500
[EMAIL PROTECTED] (Alex) wrote:

> Hi,
> 
> I have a few pages on my site that contains dynamical content that must be
> "processed" each time the page is loaded. But I'd also want to allow the
> users to be able to use the back button of their browser to go back to forms
> and that these forms still contain the information they entered (instead of
> being cleared).
> 
> Can someone give me a hint on how to accomplish this if there's a way to do
> it?
> 
> Thanks,
> 
> Alexandre Soares
> 
> 
--- End Message ---
--- Begin Message --- Provide a back_to_the_form link and pass all values, then on the form assign them to the fields.

Alex wrote:

Hi,

I have a few pages on my site that contains dynamical content that must be
"processed" each time the page is loaded. But I'd also want to allow the
users to be able to use the back button of their browser to go back to forms
and that these forms still contain the information they entered (instead of
being cleared).

Can someone give me a hint on how to accomplish this if there's a way to do
it?

Thanks,

Alexandre Soares





--- End Message ---
--- Begin Message ---
Caching is usually managed through a set of headers--for example:

<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
                                                     // always modified
header("Cache-Control: no-store, no-cache, must-revalidate");  //
HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");                          // HTTP/1.0
?>

You can use these in the pages that are dynamic and omit them in those
pages where you want to keep the information.

Cheers,


Marco
------------
php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com

On Sun, 2002-11-24 at 12:47, Alex wrote:
> Hi,
> 
> I have a few pages on my site that contains dynamical content that must be
> "processed" each time the page is loaded. But I'd also want to allow the
> users to be able to use the back button of their browser to go back to forms
> and that these forms still contain the information they entered (instead of
> being cleared).
> 
> Can someone give me a hint on how to accomplish this if there's a way to do
> it?
> 
> Thanks,
> 
> Alexandre Soares
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
At 20:34 24.11.2002, Marco Tabini said:
--------------------[snip]--------------------
>header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
--------------------[snip]-------------------- 

You should avoid this since most modern search engines would throw the site
away because it is expired...


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
Thanks! Just one more question. I also want to replace emoticons, such as
:-), :), or ;-), that are stored in a table. The structure is this: id,
emote, replace. How could I check to see if the text the user typed in
contains any of the emotes in the table then replace them with the correct
replacement? Also, how could I then limit how many are in the post?


> ----- Original Message -----
> From: "Tom Culpepper" <[EMAIL PROTECTED]>
> To: "Stephen" <[EMAIL PROTECTED]>
> Cc: "PHP List" <[EMAIL PROTECTED]>
> Sent: Saturday, November 23, 2002 9:46 PM
> Subject: Re: [PHP] Parse URLs
>
>
> > from the archives of the list
> > http://www.phpbuilder.com/mail/php-windows/2001042/0222.php
> >
> > -tom culpepper
> >
> >
> > Stephen wrote:
> > > They are entering in a whole paragraph or two of text and I want to
> search
> > > the paragraph for URLs then make it a clickable URL and then store it
in
> a
> > > MySQL database.
> > >
> > >
> > > ----- Original Message -----
> > > From: "Tom Culpepper" <[EMAIL PROTECTED]>
> > > To: "Stephen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > > Sent: Saturday, November 23, 2002 9:05 PM
> > > Subject: Re: [PHP] Parse URLs
> > >
> > >
> > >
> > >>not entirely sure what is going on there, but if the user is entering
> > >>the url in a html form.  Then just grab the variable on the next page
> > >>and run this
> > >>
> > >>$url=user $HTTP_GET_VARS["url"]; (or $HTTP_POST_VARS depending on your
> > >>form method)
> > >>$url="<a href=".$url.">".$url."</a>";
> > >>echo $url;
> > >>
> > >>the only way to change it dynamically on the same page would be
> > >
> > > javascript.
> > >
> > >>-tom culpepper
> > >>
> > >>Stephen wrote:
> > >>
> > >>>I have a simple post script and I want to make it so if a user types
in
> > >>>a URL of some sort, to change it to make it clickable. How could I do
> > >>
> > > that?
> > >
> > >>>Thanks,
> > >>>Stephen Craton
> > >>>http://www.melchior.us
> > >>>
> > >>>"Life is a gift from God. Wasting it is like destroying a gift you
got
> > >>>from the person you love most." -- http://www.melchior.us
> > >>>
> > >>
> > >>
> > >>
> > >>--
> > >>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 ---
Hello,

I have PHP v4.2.3 on Windows 2000 Advanced Server with Microsoft SQL Server
v7.0, and a script for domain registration via OnlineNIC.  That script uses
cookies to maintain session information, but it seems it can't store those
cookies on the hard disk so it always asks me to login in every page. I
changed any related options and settings in php.ini (according to my
knowledge of course) but the problem persists. Would someone please help me?

Thanks in advance.
Omid


--- End Message ---
--- Begin Message ---
In the purpose of getting access to mydomain.se/ha/ I will set a cookie:
setcookie ("login", "OK", time()+3600, "/ha/");
It looks like the cookie is set since I get the confirmation text (of course
placed inside the codeblock where the cookie is 'set' (?). Probably it just
confirm that it has found ONE hit in the db on the username/password pair).
But, when I try to access any file in mydomain.se/ha/ it fails and the login
script is loaded again (and a look in 'Temporary Internet Files' tells the
cookie doesn't exist). On the local machine (w2k, apache 2) the same script
works ok


--- End Message ---
--- Begin Message ---
In the purpose of getting access to mydomain.se/ha/ I will set a cookie:
setcookie ("login", "OK", time()+3600, "/ha/");
Not sure if this is the case, but try this instead:

setcookie ("login", "OK", time()+3600, "/ha/","mydomain.se");

--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/

--- End Message ---

Reply via email to