php-general Digest 5 May 2002 18:24:02 -0000 Issue 1327

Topics (messages 96113 through 96165):

Tailing Files
        96113 by: Liam MacKenzie
        96120 by: Miguel Cruz

Re: HTML to mysql - from msql to html
        96114 by: Miguel Cruz

Re: Tailing a log file {!?}
        96115 by: Tom Rogers
        96125 by: Liam MacKenzie
        96128 by: Jason Wong
        96129 by: Liam MacKenzie
        96130 by: Liam MacKenzie
        96131 by: Jason Wong
        96132 by: Liam MacKenzie
        96133 by: Jason Wong
        96134 by: Liam MacKenzie
        96135 by: Tom Rogers
        96136 by: Jason Wong
        96137 by: Liam MacKenzie
        96138 by: Dave Raven
        96146 by: Richard Archer

Re: SSH
        96116 by: Miguel Cruz
        96144 by: Insomniac Admin
        96150 by: Miguel Cruz
        96164 by: Kyle Gibson
        96165 by: Stuart Dallas

Re: Is  --enable-track-vars still needed?
        96117 by: Miguel Cruz
        96143 by: David J Jackson

Re: weird foreach problem when calling date or getdate function, variable does not 
change
        96118 by: Miguel Cruz

Re: PHP compared to JSP
        96119 by: Miguel Cruz

Defining PHP varibles from URL
        96121 by: webmaster.tececo.com
        96122 by: Miguel Cruz
        96126 by: David Freeman
        96140 by: Teemu Pentinsaari
        96149 by: John Holmes
        96151 by: Miguel Cruz

Re: weird foreach problem when calling date or getdate function,
        96123 by: Kyle Gibson
        96124 by: Miguel Cruz

Re: $HTTP_SERVER_VARS
        96127 by: Mike Gohlke
        96154 by: Kyle Gibson

Initializing a db $var and retrieving a required CONSTANT
        96139 by: Dreamriver.com
        96148 by: John Holmes

questions about a self-made mini chat
        96141 by: The_RadiX

Mail server
        96142 by: Diana Castillo
        96145 by: Insomniac Admin
        96152 by: Miguel Cruz

Download queueing
        96147 by: Piotrek Szymañski

replace question
        96153 by: Josh & Valerie McCormack
        96156 by: John Holmes

function sql question
        96155 by: John Fishworld
        96157 by: John Holmes
        96162 by: John Fishworld

Re: global variables
        96158 by: Austin Marshall
        96159 by: Austin Marshall

Re: Php Sessions
        96160 by: Austin Marshall
        96161 by: Austin Marshall

Please, can you help me?
        96163 by: toycat.volny.cz

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
Hi guys,

just a simple question, how would I go about displaying the last 100 lines
of a log file?
I know that on the command line it's:
tail -n 100 access_log

Is there a PHP function to do this?

Cheers,
Liam




--- End Message ---
--- Begin Message ---
On Sat, 4 May 2002, Liam MacKenzie wrote:
> just a simple question, how would I go about displaying the last 100 lines
> of a log file?
> I know that on the command line it's:
> tail -n 100 access_log
> 
> Is there a PHP function to do this?

Not that I know of, but the process is pretty simple. Seek to the end of 
the file, then read chunks backwards, spitting out a line each time you 
see a line break.

miguel

--- End Message ---
--- Begin Message ---
On Sat, 4 May 2002, Mantas Kriauciunas wrote:
>  I have hare a little problem. Well i have in the page <TEXTAREA>
>  thingy and there i wrote text like that(between lines):
> 
>  ----------------------
>  foo bar
> 
>  more foo bar
>  ----------------------
> 
>  now i do msql_query("UPDATE............."); and it sets into the
>  database with just space. and when i take it out from database there
>  is no empty line in the middle.

View the source of the page displaying the retrieved data. If the text 
displays on multiple lines there, then you just need to call nl2br() on 
the string to convert internal line breaks to HTML breaks.

If the text does not show line breaks in the source (or when you use the 
mysql CLI to query), then you need to change the parameters of the 
<TEXTAREA>. Probably <textarea wrap="soft"> but I'm not 100% sure offhand.

miguel

--- End Message ---
--- Begin Message ---
Hi
You need
exec("tail -n 100 access_log",$result);
$result will be an array with the output of the command.
see http://www.php.net/manual/en/ref.exec.php
for more info
Tom



At 01:51 PM 4/05/2002, Liam MacKenzie wrote:
>Hi guys,
>
>just a simple question, how would I go about displaying the last 100 lines
>of a log file?
>I know that on the command line it's:
>tail -n 100 access_log
>
>Is there a PHP function to do this?
>
>Cheers,
>Liam
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
OK, I did this and it does nothing but cause a loop and crash my browser...

<?
exec("tail -n 100 /www/logs/access.log",$result);

for ($i=0; $i<$result; $i++)
{
  echo "$result<BR>";
}
?>

What's the problem with that?

Cheers,
Liam


----- Original Message -----
From: "Tom Rogers" <[EMAIL PROTECTED]>
To: "Liam MacKenzie" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Sunday, May 05, 2002 4:35 PM
Subject: Re: [PHP] Tailing a log file {!?}


Hi
You need
exec("tail -n 100 access_log",$result);
$result will be an array with the output of the command.
see http://www.php.net/manual/en/ref.exec.php
for more info
Tom



At 01:51 PM 4/05/2002, Liam MacKenzie wrote:
>Hi guys,
>
>just a simple question, how would I go about displaying the last 100 lines
>of a log file?
>I know that on the command line it's:
>tail -n 100 access_log
>
>Is there a PHP function to do this?
>
>Cheers,
>Liam
>
>
>
>
>--
>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 Saturday 04 May 2002 15:32, Liam MacKenzie wrote:
> OK, I did this and it does nothing but cause a loop and crash my browser...
>
> <?
> exec("tail -n 100 /www/logs/access.log",$result);
>
> for ($i=0; $i<$result; $i++)
> {
>   echo "$result<BR>";
> }
> ?>
>
> What's the problem with that?

An infinite loop most likely. Remember, $result is an array. Try:

  foreach ($result as $val) {
    echo "$val<br>";
  }

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

/*
This is National Non-Dairy Creamer Week.
*/
--- End Message ---
--- Begin Message ---
It returns nothing

It's got me stumped



----- Original Message -----
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 05, 2002 5:58 PM
Subject: Re: [PHP] Tailing a log file {!?}


On Saturday 04 May 2002 15:32, Liam MacKenzie wrote:
> OK, I did this and it does nothing but cause a loop and crash my
browser...
>
> <?
> exec("tail -n 100 /www/logs/access.log",$result);
>
> for ($i=0; $i<$result; $i++)
> {
>   echo "$result<BR>";
> }
> ?>
>
> What's the problem with that?

An infinite loop most likely. Remember, $result is an array. Try:

  foreach ($result as $val) {
    echo "$val<br>";
  }

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

/*
This is National Non-Dairy Creamer Week.
*/

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





--- End Message ---
--- Begin Message ---
Sorry, I should have included this in the first email...

Here's my full code.  Page is called like this:
log.php?open=access.log&len=150

=====================================================

<PRE>
<FONT SIZE="2" COLOR="#000000" FACE="Tahoma">
<?
echo "<B>Excecuting:</B> tail -n $len
/www/hosting/domains/lanolot/logs/$open <BR>";
echo "<I>Displaying the last <B>$len</B> lines of
<B>$open</B>...</I><BR><BR><HR><BR>";

exec("tail -n $len /www/hosting/domains/lanolot/logs/$open", $result);

  foreach ($result as $val) {
    echo "$val<br>";
  }

?>
</FONT>
</PRE>

=====================================================


When I call the page, I get the expected at the top:
Excecuting: tail -n 150 /www/hosting/domains/lanolot/logs/error.log
Displaying the last 150 lines of error.log...

But there's nothing underneath it.


Any help would be greatly appreciated.

Cheers,
Liam



----- Original Message -----
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 05, 2002 5:58 PM
Subject: Re: [PHP] Tailing a log file {!?}


On Saturday 04 May 2002 15:32, Liam MacKenzie wrote:
> OK, I did this and it does nothing but cause a loop and crash my
browser...
>
> <?
> exec("tail -n 100 /www/logs/access.log",$result);
>
> for ($i=0; $i<$result; $i++)
> {
>   echo "$result<BR>";
> }
> ?>
>
> What's the problem with that?

An infinite loop most likely. Remember, $result is an array. Try:

  foreach ($result as $val) {
    echo "$val<br>";
  }

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

/*
This is National Non-Dairy Creamer Week.
*/

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





--- End Message ---
--- Begin Message ---
On Saturday 04 May 2002 16:09, Liam MacKenzie wrote:
> Sorry, I should have included this in the first email...

[snip]

> When I call the page, I get the expected at the top:
> Excecuting: tail -n 150 /www/hosting/domains/lanolot/logs/error.log
> Displaying the last 150 lines of error.log...
>
> But there's nothing underneath it.

1) Check that you have permissions to access the file
2) Add a 'return_var' to your exec() call. And check what this contains.

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

/*
DeVries' Dilemma:
        If you hit two keys on the typewriter, the one you don't want
        hits the paper.
*/
--- End Message ---
--- Begin Message ---
$cmd = exec("tail -n $len /www/hosting/domains/lanolot/logs/$open",
$result);

echo "$cmd";

Still returns nothing under the top text.

All log files are chmodded 644 and are owned by the web server.
The paths to the files are correct.

I've run out of ideas  =(

Thanks


----- Original Message -----
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 05, 2002 6:22 PM
Subject: Re: [PHP] Tailing a log file {!?}


On Saturday 04 May 2002 16:09, Liam MacKenzie wrote:
> Sorry, I should have included this in the first email...

[snip]

> When I call the page, I get the expected at the top:
> Excecuting: tail -n 150 /www/hosting/domains/lanolot/logs/error.log
> Displaying the last 150 lines of error.log...
>
> But there's nothing underneath it.

1) Check that you have permissions to access the file
2) Add a 'return_var' to your exec() call. And check what this contains.

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

/*
DeVries' Dilemma:
If you hit two keys on the typewriter, the one you don't want
hits the paper.
*/

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





--- End Message ---
--- Begin Message ---
On Saturday 04 May 2002 16:25, Liam MacKenzie wrote:
> $cmd = exec("tail -n $len /www/hosting/domains/lanolot/logs/$open",
> $result);
>
> echo "$cmd";
>
> Still returns nothing under the top text.
>
> All log files are chmodded 644 and are owned by the web server.
> The paths to the files are correct.

That's not what I meant by 'return_var', check the manual.

> I've run out of ideas  =(

I prefer something simpler than exec(), try:

  $output = `tail -n $len /www/hosting/domains/lanolot/logs/$open`;
  echo $output;

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

/*
This fortune is inoperative.  Please try another.
*/
--- End Message ---
--- Begin Message ---
I have PHP's safe mode enabled, can't use backticks.
And no I can't disable it, I'm hosting a few hundred sites  =)

I looked up "return_var" in the manual and got nothing, had a read of
return() but don't quite understand how that would benefit what's happening.

Could you please give an example?

Thanks!

Liam

----- Original Message -----
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 05, 2002 6:40 PM
Subject: Re: [PHP] Tailing a log file {!?}


On Saturday 04 May 2002 16:25, Liam MacKenzie wrote:
> $cmd = exec("tail -n $len /www/hosting/domains/lanolot/logs/$open",
> $result);
>
> echo "$cmd";
>
> Still returns nothing under the top text.
>
> All log files are chmodded 644 and are owned by the web server.
> The paths to the files are correct.

That's not what I meant by 'return_var', check the manual.

> I've run out of ideas  =(

I prefer something simpler than exec(), try:

  $output = `tail -n $len /www/hosting/domains/lanolot/logs/$open`;
  echo $output;

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

/*
This fortune is inoperative.  Please try another.
*/

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





--- End Message ---
--- Begin Message ---
Hi
The following works for me, give it a try with the correct path.

<?
exec("tail -n 50 /usr/local/apache/logs/access_log",$result);
echo count($result)." results returned. <br>";
if(count($result) > 0){
         foreach($result as $line){
                 echo $line."<br>";
         }
}
?>

Tom


At 06:25 PM 4/05/2002, Liam MacKenzie wrote:
>$cmd = exec("tail -n $len /www/hosting/domains/lanolot/logs/$open",
>$result);
>
>echo "$cmd";
>
>Still returns nothing under the top text.
>
>All log files are chmodded 644 and are owned by the web server.
>The paths to the files are correct.
>
>I've run out of ideas  =(
>
>Thanks
>
>
>----- Original Message -----
>From: "Jason Wong" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Sunday, May 05, 2002 6:22 PM
>Subject: Re: [PHP] Tailing a log file {!?}
>
>
>On Saturday 04 May 2002 16:09, Liam MacKenzie wrote:
> > Sorry, I should have included this in the first email...
>
>[snip]
>
> > When I call the page, I get the expected at the top:
> > Excecuting: tail -n 150 /www/hosting/domains/lanolot/logs/error.log
> > Displaying the last 150 lines of error.log...
> >
> > But there's nothing underneath it.
>
>1) Check that you have permissions to access the file
>2) Add a 'return_var' to your exec() call. And check what this contains.
>
>--
>Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>Open Source Software Systems Integrators
>* Web Design & Hosting * Internet & Intranet Applications Development *
>
>/*
>DeVries' Dilemma:
>If you hit two keys on the typewriter, the one you don't want
>hits the paper.
>*/
>
>--
>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 Saturday 04 May 2002 16:43, Liam MacKenzie wrote:
> I have PHP's safe mode enabled, can't use backticks.
> And no I can't disable it, I'm hosting a few hundred sites  =)
>
> I looked up "return_var" in the manual and got nothing, had a read of
> return() but don't quite understand how that would benefit what's
> happening.
>
> Could you please give an example?

<sigh> ... read the manual entry for exec().

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

/*
Absence is to love what wind is to fire.  It extinguishes the small,
it enkindles the great.
*/
--- End Message ---
--- Begin Message ---
That doesn't work either!
Something's going on here...



----- Original Message -----
From: "Tom Rogers" <[EMAIL PROTECTED]>
To: "Liam MacKenzie" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Sunday, May 05, 2002 6:49 PM
Subject: Re: [PHP] Tailing a log file {!?}


Hi
The following works for me, give it a try with the correct path.

<?
exec("tail -n 50 /usr/local/apache/logs/access_log",$result);
echo count($result)." results returned. <br>";
if(count($result) > 0){
         foreach($result as $line){
                 echo $line."<br>";
         }
}
?>

Tom


At 06:25 PM 4/05/2002, Liam MacKenzie wrote:
>$cmd = exec("tail -n $len /www/hosting/domains/lanolot/logs/$open",
>$result);
>
>echo "$cmd";
>
>Still returns nothing under the top text.
>
>All log files are chmodded 644 and are owned by the web server.
>The paths to the files are correct.
>
>I've run out of ideas  =(
>
>Thanks
>
>
>----- Original Message -----
>From: "Jason Wong" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Sunday, May 05, 2002 6:22 PM
>Subject: Re: [PHP] Tailing a log file {!?}
>
>
>On Saturday 04 May 2002 16:09, Liam MacKenzie wrote:
> > Sorry, I should have included this in the first email...
>
>[snip]
>
> > When I call the page, I get the expected at the top:
> > Excecuting: tail -n 150 /www/hosting/domains/lanolot/logs/error.log
> > Displaying the last 150 lines of error.log...
> >
> > But there's nothing underneath it.
>
>1) Check that you have permissions to access the file
>2) Add a 'return_var' to your exec() call. And check what this contains.
>
>--
>Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>Open Source Software Systems Integrators
>* Web Design & Hosting * Internet & Intranet Applications Development *
>
>/*
>DeVries' Dilemma:
>If you hit two keys on the typewriter, the one you don't want
>hits the paper.
>*/
>
>--
>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


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





--- End Message ---
--- Begin Message ---
check directory rights.

If need be, passwd the user and give it a shell.
then try on the console as the webserver user
to tail the file.

----- Original Message ----- 
From: "Liam MacKenzie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Tom Rogers" <[EMAIL PROTECTED]>
Sent: Saturday, May 04, 2002 11:26 AM
Subject: Re: [PHP] Tailing a log file {!?}


> That doesn't work either!
> Something's going on here...
> 
> 
> 
> ----- Original Message -----
> From: "Tom Rogers" <[EMAIL PROTECTED]>
> To: "Liam MacKenzie" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Sunday, May 05, 2002 6:49 PM
> Subject: Re: [PHP] Tailing a log file {!?}
> 
> 
> Hi
> The following works for me, give it a try with the correct path.
> 
> <?
> exec("tail -n 50 /usr/local/apache/logs/access_log",$result);
> echo count($result)." results returned. <br>";
> if(count($result) > 0){
>          foreach($result as $line){
>                  echo $line."<br>";
>          }
> }
> ?>
> 
> Tom
> 
> 
> At 06:25 PM 4/05/2002, Liam MacKenzie wrote:
> >$cmd = exec("tail -n $len /www/hosting/domains/lanolot/logs/$open",
> >$result);
> >
> >echo "$cmd";
> >
> >Still returns nothing under the top text.
> >
> >All log files are chmodded 644 and are owned by the web server.
> >The paths to the files are correct.
> >
> >I've run out of ideas  =(
> >
> >Thanks
> >
> >
> >----- Original Message -----
> >From: "Jason Wong" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Sunday, May 05, 2002 6:22 PM
> >Subject: Re: [PHP] Tailing a log file {!?}
> >
> >
> >On Saturday 04 May 2002 16:09, Liam MacKenzie wrote:
> > > Sorry, I should have included this in the first email...
> >
> >[snip]
> >
> > > When I call the page, I get the expected at the top:
> > > Excecuting: tail -n 150 /www/hosting/domains/lanolot/logs/error.log
> > > Displaying the last 150 lines of error.log...
> > >
> > > But there's nothing underneath it.
> >
> >1) Check that you have permissions to access the file
> >2) Add a 'return_var' to your exec() call. And check what this contains.
> >
> >--
> >Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> >Open Source Software Systems Integrators
> >* Web Design & Hosting * Internet & Intranet Applications Development *
> >
> >/*
> >DeVries' Dilemma:
> >If you hit two keys on the typewriter, the one you don't want
> >hits the paper.
> >*/
> >
> >--
> >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
> 
> 
> --
> 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 ---
At 7:26 PM +1000 4/5/02, Liam MacKenzie wrote:
>That doesn't work either!
>Something's going on here...

Are you fully aware of the implications of safe mode?

Who owns the file you're trying to read?
Who owns the PHP script being executed?
What errors are you getting from the script?
What errors show up in the server logs?

 ...R.
--- End Message ---
--- Begin Message ---
On Sun, 5 May 2002, Insomniac Admin wrote:
> You could use "popen" to open a ssh process and wait to be asked for the
> password etc... Remember to check the RSA key pattern.

My experience, at least with recent SSH versions, is that they try very 
hard to verify stdin is an actual pty before accepting a password from it. 
This is specifically to stop people from storing passwords in cleartext. 
However, you can do wonderful things with key pairs. Read all about 
ssh-keygen.

We have servers that need to do things on other servers. We store the
private keys in 0400 files owned by root, create root-owned shell scripts 
to ssh into the remote servers and execute specific commands, and allow 
the web server to run those with sudo. Not perfect, but reasonably secure 
as long as nobody r00ts the web server.

miguel

--- End Message ---
--- Begin Message ---
Wouldn't that be like very insecure? I wouldn't need to root the server
in order to use that connection!

Example Scenario:

I generate a key pair from server local to server remote, and place the
auth key in a 0400 moded file owned by root, but accessable by "nobody"
(as this is the uid I will be sshing out as). Multiple people have
access to write php scripts on this server.

Now *anyone* who is able to execute commands as "nobody" can (very very
easily) get from server local to server remote without the need for a
password to be entered.

Fair enough that they would need to know the address of server remote,
and that they would never get the password - but they wouldn't need one
either.

Just my PoV on security... You could always try investigating SSH
wrappers.

- Dan

-----Original Message-----
From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
Sent: 05 May 2002 07:44
To: [EMAIL PROTECTED]
Subject: Re: [PHP] RE: SSH


On Sun, 5 May 2002, Insomniac Admin wrote:
> You could use "popen" to open a ssh process and wait to be asked for 
> the password etc... Remember to check the RSA key pattern.

My experience, at least with recent SSH versions, is that they try very 
hard to verify stdin is an actual pty before accepting a password from
it. 
This is specifically to stop people from storing passwords in cleartext.

However, you can do wonderful things with key pairs. Read all about 
ssh-keygen.

We have servers that need to do things on other servers. We store the
private keys in 0400 files owned by root, create root-owned shell
scripts 
to ssh into the remote servers and execute specific commands, and allow 
the web server to run those with sudo. Not perfect, but reasonably
secure 
as long as nobody r00ts the web server.

miguel


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


--- End Message ---
--- Begin Message ---
Well, as described below, the key is read by a root-owned, sudo-gated
shell script which executes a specific remote command. And of course the
arguments, if any, are strictly sanitized by the shell script. So the
worst someone could do is cause the premature execution of that remote
command.

Also, I rarely if ever work on servers shared with untrusted users, which
changes the security situation somewhat. People in that situation are
going to have it much harder. But if PHP's in safe mode, they can use a
similar scheme but provide access to their individual user ID rather than
'nobody'.

miguel

On Sun, 5 May 2002, Insomniac Admin wrote:
> Wouldn't that be like very insecure? I wouldn't need to root the server
> in order to use that connection!
> 
> Example Scenario:
> 
> I generate a key pair from server local to server remote, and place the
> auth key in a 0400 moded file owned by root, but accessable by "nobody"
> (as this is the uid I will be sshing out as). Multiple people have
> access to write php scripts on this server.
> 
> Now *anyone* who is able to execute commands as "nobody" can (very very
> easily) get from server local to server remote without the need for a
> password to be entered.
> 
> Fair enough that they would need to know the address of server remote,
> and that they would never get the password - but they wouldn't need one
> either.
> 
> Just my PoV on security... You could always try investigating SSH
> wrappers.
> 
> - Dan
> 
> -----Original Message-----
> From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
> Sent: 05 May 2002 07:44
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] RE: SSH
> 
> 
> On Sun, 5 May 2002, Insomniac Admin wrote:
> > You could use "popen" to open a ssh process and wait to be asked for 
> > the password etc... Remember to check the RSA key pattern.
> 
> My experience, at least with recent SSH versions, is that they try very 
> hard to verify stdin is an actual pty before accepting a password from
> it. 
> This is specifically to stop people from storing passwords in cleartext.
> 
> However, you can do wonderful things with key pairs. Read all about 
> ssh-keygen.
> 
> We have servers that need to do things on other servers. We store the
> private keys in 0400 files owned by root, create root-owned shell
> scripts 
> to ssh into the remote servers and execute specific commands, and allow 
> the web server to run those with sudo. Not perfect, but reasonably
> secure 
> as long as nobody r00ts the web server.
> 
> miguel
> 
> 
> 

--- End Message ---
--- Begin Message ---
I've tried this,


------------
$cmd = `ftpwho`;
echo $cmd;

and/or

$cmd = shell_exec("ftpwho");
echo $cmd;
------------



But I get this error:

Warning: Cannot execute using backquotes in safe mode in test.php on line 2



-Kyle

--- End Message ---
--- Begin Message ---
On 5 May 2002 at 14:12, Kyle Gibson wrote:
> Warning: Cannot execute using backquotes in safe mode in test.php on
> line 2

Your ISP has safe mode turned on which means you cannot use backquotes. Read all 
about it at http://www.php.net/manual/en/features.safe-mode.php.

-- 
Stuart
--- End Message ---
--- Begin Message ---
On Sat, 4 May 2002, David Jackson wrote:
> Is I still recommended that config be run with the --enable-track-vars flag?
> Or has this been deprieciated? Recently? Does the chagnes to global vars 
> come in to play here?

I believe that has had no effect (i.e., they were always enabled) for a 
while now. In any case, no need these days.

miguel

--- End Message ---
--- Begin Message ---
Miguel Cruz wrote:
> On Sat, 4 May 2002, David Jackson wrote:
> 
>>Is I still recommended that config be run with the --enable-track-vars flag?
>>Or has this been deprieciated? Recently? Does the chagnes to global vars 
>>come in to play here?
> 
> 
> I believe that has had no effect (i.e., they were always enabled) for a 
> while now. In any case, no need these days.
> 
> miguel
> 

Migual --
Thanks for the clarification.

David

--- End Message ---
--- Begin Message ---
On Sat, 4 May 2002, Zachary Buckholz wrote:
>                 $time = getdate($array[0]);
> print "$time[hours]:$time[minutes]:$time[seconds] = $chk_status = $resp_sec
>
> 20020504160503         <-- Notice how this date/time value is updated
> properly each loop
> 20:14:7 = 200 = 2         <-- Notice how this value always remains the same?
> 20020504160702
> 20:14:7 = 200 = 1

Those numbers don't look like timestamps to me (as they can't be larger 
than about 4294967296). What they look like is the result of some imp or 
perhaps even a gremlin breaking into your code and smooshing together 
yearmonthdayhourminutesecond, then trying to PRETEND it's a timestamp.

Go back and read the date/time chapter of the PHP manual a little more 
closely.

miguel

--- End Message ---
--- Begin Message ---
On Sat, 4 May 2002, Pag wrote:
>> Does PHP compile : NO
>> Does the user loading same page for 2nd time gets better response : YES 
>> it can if caching is provided
> 
> On a side not..isnt caching a bit like going against why PHP was built
> in the first place? I mean, information may get a bit out of date if we
> get a page on the cache instead of getting it "fresh" from the server.

Sometimes the developer knows how stale information can get before it 
needs to be refreshed. An awful lot of pages fetched with GET args are 
just straight-up retrievals from mostly-static databases, and can be 
cached with impunity.

Also, there are other types of caching. On a multi-use machine that is 
busy with other stuff but not getting a lot of web traffic, httpd may have 
been paged out. And the PHP source file will be cached by the filesystem 
for a while after being read, saving subsequent repeat visits the delay of 
a disk operation.

miguel

--- End Message ---
--- Begin Message ---
I can't seem to define a varible from the url entered into a browser.
 
I wish to use the following code or something like it.

<script language="php">

$file = "";
//the above is defined from the url

include "$file";

</script>

It could be what I was typing in the url bar.

file.php?file=foobar.inc

 

Thanks,

JJ Harrison
[EMAIL PROTECTED]
www.tececo.com

--- End Message ---
--- Begin Message ---
On Sun, 5 May 2002 [EMAIL PROTECTED] wrote:
> I can't seem to define a varible from the url entered into a browser.
> 
> I wish to use the following code or something like it.
> <script language="php">
> 
> $file = "";
> //the above is defined from the url
> include "$file";
> </script>
> 
> It could be what I was typing in the url bar.
> 
> file.php?file=foobar.inc

1) Try include $_GET['file'];

2) Let me know where your server is so I can go to

   http://your.server/file.php?file=/etc/passwd

miguel

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

-----Original Message-----
<script language="php">
$file = "";
//the above is defined from the url
include "$file";
</script>
It could be what I was typing in the url bar.
file.php?file=foobar.inc
-----Original Message-----

Hmm, so you define $file in your url as "foobar.inc" and then, in the
page itself you take change $file to be "".

At least, that's how I'd read it.  I'd suggest, it's not an overly good
idea to include a file like this as someone else has already mentioned.

In any event, your fix would have to be something like this:

<script language="php">

If (!isset($file) || empty($file))
{
  $file = "some file";
}
Include "$file" ;

</script>

That way you're only going to over-write the contents of $file if it's
already either unset or empty.

CYA, Dave


--- End Message ---
--- Begin Message ---
> > It could be what I was typing in the url bar.
> >
> > file.php?file=foobar.inc
>
> 1) Try include $_GET['file'];
>
> 2) Let me know where your server is so I can go to
>
>    http://your.server/file.php?file=/etc/passwd
>
> miguel

You might want to use .php file extension and /include/ directory to prevent
Miquel stealing your pressious passwords :))
<snip>
  file.php?file=inc.foobar.php
 -------------------------
  include("include/$file");
</snip>

Just a thought :)))


Teemu




--- End Message ---
--- Begin Message ---
> <snip>
>   file.php?file=inc.foobar.php
>  -------------------------
>   include("include/$file");
> </snip>

That doesn't fix anything...

file.php?file=../../../etc/passwd

Just a matter of a few tries to see how many directories you have to go
up...

---John Holmes...

--- End Message ---
--- Begin Message ---
On Sun, 5 May 2002, Teemu Pentinsaari wrote:
>>> It could be what I was typing in the url bar.
>>>
>>> file.php?file=foobar.inc
>>
>> 1) Try include $_GET['file'];
>>
>> 2) Let me know where your server is so I can go to
>>
>>    http://your.server/file.php?file=/etc/passwd
> 
> You might want to use .php file extension and /include/ directory to prevent
> Miquel stealing your pressious passwords :))

http://your.server/file.php?file=../../../etc/passwd%00

miguel

--- End Message ---
--- Begin Message ---
> Those numbers don't look like timestamps to me (as they can't be larger 
> than about 4294967296). What they look like is the result of some imp or 
> perhaps even a gremlin breaking into your code and smooshing together 
> yearmonthdayhourminutesecond, then trying to PRETEND it's a timestamp.
> 
> Go back and read the date/time chapter of the PHP manual a little more 
> closely.
> 
> miguel


They look like MYSQL timestamps to me.

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

The MySQL timestamp format is NOT the same as the PHP timestamp format
(otherwise known as the Unix timestamp format).

MySQL uses a YYYYMMDDHHMMSS format whereas PHP uses a SSSSSSSSSSSS format.

MySQL timestamp: 20020207164744
PHP (Unix) timestamp: 1013096864



-Kyle



--- End Message ---
--- Begin Message ---
On Sun, 5 May 2002, Kyle Gibson wrote:
>> Those numbers don't look like timestamps to me (as they can't be larger 
>> than about 4294967296). What they look like is the result of some imp or 
>> perhaps even a gremlin breaking into your code and smooshing together 
>> yearmonthdayhourminutesecond, then trying to PRETEND it's a timestamp.
> 
> They look like MYSQL timestamps to me.

I've always thought of MySQL as a lovable little imp.

miguel

--- End Message ---
--- Begin Message ---
Kyle,
Here's a quote I found on Usenet:
http://groups.google.com/groups?selm=aec2ace8.0204180402.4c562696%40posting.google.com&output=gplain

--- paste ---
I think I found out what this HTTP_WEFERER is all about...

I was working on a perl script having this problem. Some PCs (Client)
running that script returned a HTTP_WEFERER (my PC for example) and
some a correct HTTP_REFERER!

Changing OS, Provider, Browser... had no effect.

My last guess, was to turn off my Firewall (*Norton* Personal Firewall)
and after that my PC returned a correct HTTP_REFERER!

Seems to be the solution....
--- end paste ---


Hope this helps,
Mike...

Kyle Gibson wrote:

> Whoops. It wont show unless you come from somewhere else...
>
>
> Go here and click the link:
>
> http://www.plaguenet.com/wreferer.php
>
>
> Thanks,
>
>
> Kyle Gibson
>
>
>


--- End Message ---
--- Begin Message ---
> My last guess, was to turn off my Firewall (*Norton* Personal Firewall)
> and after that my PC returned a correct HTTP_REFERER!


Exactly what I did. Funky, huh?


Thanks,

Kyle Gibson

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

Hi Folks,
Two questions:

1) Initializing a db $var
What's the best way to code $dbvar, which is coming from a database query, given the 
new superglobals:

$data = mysql_fetch_array();
$dbvar = stripslashes($data['someFieldName']);

Is there a newer or better way to initialize $dbvar?


2) retrieving a required CONSTANT
If a CONSTANT is defined on foo.php and called with a require_once("foo.php") on 
another page called bar.php, then CONSTANT is not global and is not called with the 
new supernotation, but rather same as before:

$someVar = CONSTANT;

... correct?

richard.


--- End Message ---
--- Begin Message ---
Neither of those change. You don't have to use stripslashes() on
incoming DB data, unless magic_quotes_runtime is ON in php.ini.

---John Holmes...

> -----Original Message-----
> From: Dreamriver.com [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, May 05, 2002 2:33 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: [PHP] Initializing a db $var and retrieving a required
CONSTANT
> 
> 
> Hi Folks,
> Two questions:
> 
> 1) Initializing a db $var
> What's the best way to code $dbvar, which is coming from a database
query,
> given the new superglobals:
> 
> $data = mysql_fetch_array();
> $dbvar = stripslashes($data['someFieldName']);
> 
> Is there a newer or better way to initialize $dbvar?
> 
> 
> 2) retrieving a required CONSTANT
> If a CONSTANT is defined on foo.php and called with a
> require_once("foo.php") on another page called bar.php, then CONSTANT
is
> not global and is not called with the new supernotation, but rather
same
> as before:
> 
> $someVar = CONSTANT;
> 
> ... correct?
> 
> richard.
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Try telling the frame (text one) to "go to" a location. instead of just
refreshing..


It may just work... :) I think that annoying click only occurs on
"refresh/reload" not actually going there..




:::::::::::::::::::::::::::::::::::::::::::
:  Julien Bonastre [The-Spectrum.org CEO]
:  A.K.A. The_RadiX
:  [EMAIL PROTECTED]
:  ABN: 64 235 749 494
:  QUT Student :: 04475739
:::::::::::::::::::::::::::::::::::::::::::
----- Original Message -----
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 05, 2002 12:18 AM
Subject: Re: [PHP] questions about a self-made mini chat


> On Saturday 04 May 2002 21:23, Duncan wrote:
> > Hi there,
> >
> > i have some questions to solve some problems, i recently encountered
with
> > my self made mini chat script.
> >
> > Ok, i use the meta-refresh in the main chat-messages frame to update the
> > frame every few seconds. In windows OS, you always get that "click"
sounds
> > whenever it refreshes the frame. Is there any way to stop this?
>
> That's an IE problem. Use Opera or Netscape if you don't want the click or
> see if there's an option in IE to disable the click.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> You can do very well in speculation where land or anything to do with dirt
> is concerned.
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Does anyone know of a free mail server to install on a  linux server that
works better than fmail?


--- End Message ---
--- Begin Message ---
Qmail : www.lifewithqmail.org / www.qmail.org / http://cr.yp.to/qmail/

-----Original Message-----
From: Diana Castillo [mailto:[EMAIL PROTECTED]] 
Sent: 05 May 2002 12:17
To: [EMAIL PROTECTED]
Subject: [PHP] Mail server


Does anyone know of a free mail server to install on a  linux server
that works better than fmail?



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


--- End Message ---
--- Begin Message ---
On Sun, 5 May 2002, Diana Castillo wrote:
> Does anyone know of a free mail server to install on a  linux server that
> works better than fmail?

Never heard of fmail, but qmail works a treat. Used by yahoo mail, etc. 
Fast and secure.

The place to talk about this stuff is the comp.mail.* newsgroup hierarchy.

miguel

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

I'm writing a download queueing script, and it works quite well, except
for one thing: I'm unable to determine the amount of data actually transfered to the 
client.

The script sends a portion of a file (eg. 10 kb) and waits for a second, this
way achieving a transfer rate of 10 kb/s. The problem is that the client doesn't
necessarily have to receive the data as soon as the script sends it, because of
server buffering. Is there a way to determine how much data is still in the server's 
buffer?
Or maybe it is possible to determine if all the data outputted by the script has been
sent to the client?

I'm using PHP under Apache.

Regards,
Peter Szymański ([EMAIL PROTECTED])
--- End Message ---
--- Begin Message ---
I'm iterating through a CSV file pulling in rows as arrays with fgetcsv 
and I'd like to search for patterns made up of the first two array items 
of each row with a space between them in a text file, and make them into 
links. I can't figure out how to do this, could someone help?

Josh

--- End Message ---
--- Begin Message ---
Are you having trouble pulling the data out of the file, or creating the
link? Do you want a link created for every row? What is the makeup of
the file? Is array[0] the URL, and array[1] the desription? If it's just
the link you need, that's easy...

echo "<a href='" . $array[0] . "'>" . $array[1] . "</a>";

---John Holmes...

> -----Original Message-----
> From: Josh & Valerie McCormack [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, May 05, 2002 8:23 AM
> To: PHP-General
> Subject: [PHP] replace question
> 
> I'm iterating through a CSV file pulling in rows as arrays with
fgetcsv
> and I'd like to search for patterns made up of the first two array
items
> of each row with a space between them in a text file, and make them
into
> links. I can't figure out how to do this, could someone help?
> 
> Josh
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
I've got a small function which checks city name with post codes
And because this needs to be checked in several scripts I want to have it in
my common functions file
and include it !
  require ("common_funtions.inc");

and then use it
if (!check_city_from_plz($t_zipcode)){
echo  "<TR><TD colspan=\"2\"><B><I>Your city does not exist with the
plz!</I></B><BR></TD></TR>
";
}

It doesn't work though, I'm sure it something simple but can someone please
point me in the right direction !

This is the function itself

function check_city_from_plz($str) {
connect and select database
$city_query = "select distinct t_city_name,t_city_id_city from
t_city,t_zipcodecity where
(t_city_id_city = t_zipcodecity_id_city) and (t_zipcodecity_zipcode like
'$str')";

$city_result = mysql_db_query(DBWEB, $city_query);
if ($city_result) {
        while ($q = mysql_fetch_array($city_result)) {
            $city_id = $q["t_city_id_city"];
            $cityname = $q["t_city_name"];

if ($cityname !="") {
   return 1;
   return $city_id;
   return $cityname;
   } else {
   return 0;
   }

   } // close if
   } // close while
   } //  close function

Thanks in advance !



--- End Message ---
--- Begin Message ---
>    return 1;
>    return $city_id;
>    return $cityname;

You can't return 3 values...try returning an array, instead.

$ret[0] = $city_id;
$ret[1] = $cityname;
return $ret;

or...

$ret["City_ID"] = $city_id;
$ret["CityName"] = $cityname;
return $ret;

---John Holmes...

--- End Message ---
--- Begin Message ---
duh !
yeah that makes sense !
but it doesn't work !
I've no idea why but it refuses to give any information back !

I've managed to get round this by now no loger declaring it a function
but just actually requiring it where i need it

require ("get_city_1.inc");
print_r(array_values ($city));

I've also chopped the return part
and just return the values

 $city[0] = $city_id;
 $city_name[1] = $city_name;

Strange


> >    return 1;
> >    return $city_id;
> >    return $cityname;
>
> You can't return 3 values...try returning an array, instead.
>
> $ret[0] = $city_id;
> $ret[1] = $cityname;
> return $ret;
>
> or...
>
> $ret["City_ID"] = $city_id;
> $ret["CityName"] = $cityname;
> return $ret;
>
> ---John Holmes...
>
>


--- End Message ---
--- Begin Message ---
Jule wrote:
> Hey,
> i'm just wondering if there is another way to write global variables to a 
> global.php, now i just the whole fopen etc script, where i open a file and 
> write the sctring $number_right = [whatever number it is] to the file, but is 
> there a different way to write it to the file with one simple command?
> 
> i could use cookies, but i prefer a simpler way.
> 
> thanks
> 
> Jule

At want point did you stop and think that it would be *easier* to write 
information to a file?  You could use cookies and should use cookies if 
your looking for a simpler way, sessions as well.

If you don't mind information not being around the next time the user 
returns (after closing his/her browser) you could write to the always 
global always available $_SESSION array. For example 
$_SESSION['foo']="bar"; and $_SESSION['bar']="foo";  It's not writing to 
a file, but is one simple command and the information you store will 
follow them anywhere within your site.

If you want save the information you could just as easily use $_COOKIES. 
  But would require that you use the setcookie command.

--- End Message ---
--- Begin Message ---
Jule wrote:
> Hey,
> i'm just wondering if there is another way to write global variables to a 
> global.php, now i just the whole fopen etc script, where i open a file and 
> write the sctring $number_right = [whatever number it is] to the file, but is 
> there a different way to write it to the file with one simple command?
> 
> i could use cookies, but i prefer a simpler way.
> 
> thanks
> 
> Jule

At want point did you stop and think that it would be *easier* to write 
information to a file?  You could use cookies and should use cookies if 
your looking for a simpler way, sessions as well.

If you don't mind information not being around the next time the user 
returns (after closing his/her browser) you could write to the always 
global always available $_SESSION array. For example 
$_SESSION['foo']="bar"; and $_SESSION['bar']="foo";  It's not writing to 
a file, but is one simple command and the information you store will 
follow them anywhere within your site.

If you want save the information you could just as easily use $_COOKIES. 
  But would require that you use the setcookie command.

--- End Message ---
--- Begin Message ---
Daniel SvanbäCk wrote:
> Hi
> 
> I have a problem. I can't send the session_id to the next page. It worked
> before (when I had an old version of php, now I have 4.2.0). It can send the
> session_id() if it's a link, but not a header(). If it is a header I have to
> do this:
> 
> define('MYSID', session_name().'='.session_id());
> header('Location: ../index.php?'.zOLSID);
> 
> Do I have to add this to every header()? Or is there a easyier way. I have
> global variables = on.
> 
> //Daniel
> 
> 

Straight from the manual at http://www.php.net/manual/en/ref.session.php

PHP is capable of doing this transparently when compiled with 
--enable-trans-sid. If you enable this option, relative URIs will be 
changed to contain the session id automatically. Alternatively, you can 
use the constant SID which is defined, if the client did not send the 
appropriate cookie. SID is either of the form session_name=session_id or 
is an empty string.

You probably didn't have --enable-trans-sid when you configured/compiled PHP

--- End Message ---
--- Begin Message ---
Daniel SvanbäCk wrote:
> Hi
> 
> I have a problem. I can't send the session_id to the next page. It worked
> before (when I had an old version of php, now I have 4.2.0). It can send the
> session_id() if it's a link, but not a header(). If it is a header I have to
> do this:
> 
> define('MYSID', session_name().'='.session_id());
> header('Location: ../index.php?'.zOLSID);
> 
> Do I have to add this to every header()? Or is there a easyier way. I have
> global variables = on.
> 
> //Daniel
> 
> 

Straight from the manual at http://www.php.net/manual/en/ref.session.php

PHP is capable of doing this transparently when compiled with 
--enable-trans-sid. If you enable this option, relative URIs will be 
changed to contain the session id automatically. Alternatively, you can 
use the constant SID which is defined, if the client did not send the 
appropriate cookie. SID is either of the form session_name=session_id or 
is an empty string.

You probably didn't have --enable-trans-sid when you configured/compiled PHP

--- End Message ---
--- Begin Message ---
Hello!
I have a big problem and cannot find the answer anywhere, so please,
help me if you can. When I use fwrite() function on webserver, it
sometimes happens, that more then one user accesses the file and the
result is, that the file is corrupted or truncated. A good example of
this problem is webpage access counter. I know, that I can use MySQL
to count accesses, but on some servers I can't. When I have this
counter as a file on my server and read/write into it, there's only a
question of time, when it corrupts itself. Please, can you help me to
solve this problem? I think, that the easiest solution should be to
prevent more that one user to write to that file, but I have no idea,
how to do this. Or is there any other way to prevent that files from
their corruption? I'll be very happy, if you help me with this
problem.
Thank you in advance.
Miloslav Dornak
--- End Message ---

Reply via email to