RE: [PHP] Uptime script?

2001-05-16 Thread Patrik Wallstrom

On Wed, 16 May 2001, Ben Cairns wrote:

> >I know I've seen one before, and before I go write my own version, does
> >anyone know of a PHP script that echoes the uptime of a server (Linux) in
> >days,hour,minutes, etc?
>
> Does anyone know a script to do this under WinNT?

For Linux it is easy, just read the /proc/uptime file:
$uptimevalues = file("/proc/uptime");

The first value from /proc/uptime is the uptime, the second is the idle
time for the cpu.

NT is harder. I don't know anything about that.

--
 patrik wallstrom |  f o o d f i g h t
 tel: +46-8-6188428   |  s t o c k h o l m
 gsm: +46-708405080   |  - - - - - - - - -


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




Re: [PHP] Hiding URL address

2001-12-27 Thread Patrik Wallstrom

On Thu, 27 Dec 2001, Matias Banzas wrote:

> Hiow can i do 2 hide the real Filename / Url of a file?
> Ive seen it donde in lots of places...
> i need this 2 show some images and hide the real Location of them
> Anyone can help me?

Create a php script that reads the file and feeds it to the user. In that
script you can have some intelligence like referrer-checking, and you
should also give the user a correct mime-type for that file in the
http-header.

--
patrik_wallstrom->foodfight->[EMAIL PROTECTED]>+46-709580442


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




Re: [PHP] PHP 4.1 crypt()

2002-01-08 Thread Patrik Wallstrom

On Tue, 8 Jan 2002, Mike Eheler wrote:

> Is there any way to force PHP 4.1's crypt to generate crypt's with
> 2-letter salts? We've written some apps that do things the hack way --
> if (crypt($pass,substr($pass,0,2)) == $cryptpass) -- and changing all of
> them to work the extended way is a real pain the arse. That includes
> changing all our password generation code to create 2-letter salts.
>
> Any help much appreciated.
>
> In short -- I want crypt() to work like it did in 4.0.6.

This is exactly the reason you should use a specific standard hash
algorithm like MD5 or SHA-1 when encrypting passwords. The PHP crypt()
call uses the system call crypt(), which might vary between different
systems.

Look at the PHP man pages for crypt() and the mcrypt package for more info
on the subject. With mcrypt you can use whatever crypto function you need
for compatibility.

http://www.php.net/manual/en/function.crypt.php
http://www.php.net/manual/en/ref.mcrypt.php

--
patrik_wallstrom->foodfight->[EMAIL PROTECTED]>+46-709580442


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




Re: [PHP] PHP 4.1 crypt()

2002-01-08 Thread Patrik Wallstrom

On Tue, 8 Jan 2002, Mike Eheler wrote:

> It's too late for that. And I don't believe that the system's crypt()
> function just magically changed at exactly the same time we upgraded to
> PHP 4.1

According to the crypt() man page, crypt() can use four methods of
encryption:

  CRYPT_STD_DES - Standard DES-based encryption with a two character salt
  CRYPT_EXT_DES - Extended DES-based encryption with a nine character salt
  CRYPT_MD5 - MD5 encryption with a twelve character salt starting with $1$
  CRYPT_BLOWFISH - Blowfish encryption with a sixteen character salt starting with $2$

You should check which method your crypt() method used before changing
PHP version, and use the mcrypt specific method. You did backup the old
php installation, right?

--
patrik_wallstrom->foodfight->[EMAIL PROTECTED]>+46-709580442


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




Re: [PHP] PHP 4.1 crypt()

2002-01-08 Thread Patrik Wallstrom

On Tue, 8 Jan 2002, Mike Eheler wrote:

> Too late for that, too.. in addition to providing web hosting for
> hundreds of sites, we are also a web development company and have 2
> major websites out there using extended php 4.1 features.
>
> We need STD_DES, and it appears that PHP 4.1 has switched to using MD5
> by default.
>
> Thanks for your help! I'll see what I can do.

If you really really need STD_DES for PHP 4.1, check the source code in
ext/standard/crypt.c and force it to use STD_DES and recompile.

>From crypt.c:

/*
   The capabilities of the crypt() function is determined by the test programs
   run by configure from aclocal.m4.  They will set PHP_STD_DES_CRYPT,
   PHP_EXT_DES_CRYPT, PHP_MD5_CRYPT and PHP_BLOWFISH_CRYPT as appropriate
   for the target platform
*/

--
patrik_wallstrom->foodfight->[EMAIL PROTECTED]>+46-709580442


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




Re: [PHP] Questions about php.ini

2001-11-02 Thread Patrik Wallstrom

On Fri, 2 Nov 2001, jennyw wrote:

> I've signed up with a dedicated Web host that has PHP installed. The weird
> thing is that there is no php.ini anywhere. Is the file optional? Everything
> seems to be behaving okay.
>
> I have several Web sites that I'm setting up. Is it possible to use
> different php.ini files for each Web site? I'm using apache with mod-php. I
> see that PHP will search for php.ini in the working directory first. Does
> this mean that the way to accomplish what I want is to put a php.ini file in
> each directory that has .php files? It would be better if there was a way to
> have a php.ini file affect all files in a site, instead of putting php.ini
> files in all subdirectories of the site where there are .php files.

If you have some documentation for the ISP you are using, that would be a
lead... What exactly do you want to change in your php.ini?

--
patrik_wallstrom->foodfight->[EMAIL PROTECTED]>+46-706355528


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




Re: [PHP] PHP 4.1 out?

2001-11-28 Thread Patrik Wallstrom

On Wed, 28 Nov 2001, Kurt Lieber wrote:

> > I'll hold off, but people will still try stuff like that. I'm not trying
> > to tell ya what to do, but I've found it best never to put files with
> > release-names in their primary download spots, regardless of how hidden
> > they may seem, until your absolutely positive that will be the release
> > file.
>
> FWIW (not much), I agree with this.  If it looks like a released version and
> talks like a released version, then it probably is a released version, even
> if the announcement hasn't come out.  That may be faulty logic, but it's what
> most folks are likely to assume.

It does, and it also seems that CVS is tagged for 4.1 as well...

--
patrik_wallstrom->foodfight->[EMAIL PROTECTED]>+46-709580442


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




Re: [PHP] Can anyone explain what this does?

2001-07-15 Thread Patrik Wallstrom

On Sun, 15 Jul 2001, Kurt Lieber wrote:

> I'm sure this is a simple one, but I've never seen it before:
>
> $this->file = $file;
>
> I'm specifically confused about the -> operator and what that does.
>
> I looked in the online documentation under operators, but didn't find
> anything.  Ideally, if someone can point me to the location in the
> documentation that talks about this so I can get more info, I'd
> appreciate it.

It is not an operator, it is how you reference objects in php. $this is
the object that you are current using, and you are referencing the
objects variable $file with $this->file. For more on classes and objects,
read here:
http://php.net/manual/en/language.oop.php

--
 patrik wallstrom |  f o o d f i g h t
 tel: +46-8-6188428   |  s t o c k h o l m
 gsm: +46-708405080   |  - - - - - - - - -


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




Re: [PHP] Adding elements to an array

2001-07-17 Thread Patrik Wallstrom

On Tue, 17 Jul 2001, Sharat Hegde wrote:

> Hello,
>
> I have a requirement to add elements to an associate array dynamically based
> on some conditions. I initialize the array with the 1st associate array
> element
>   $MyArray = array('DATETIME' => $DateTime);
>
> How do I add more elements to this associate array. I am using PHP 3 and
> array_merge and other functions for arrays are not supported in PHP3. I am
> trying the following:
>   $MyArray[] = array("BUYVAL" => "1.23");
> but if I try and get the value of $MyArray[BUYVAL], I get nothing.

What you have done here is that you have added an array to your array, but
you wished to have the value added to your array. The $MyArray[] pushes a
new value to the array, in this case another array. You want
$MyArray['BUYVAL'] = 1.23.

More info on arrays from the php docs:
http://php.net/manual/en/language.types.array.php

--
 patrik wallstrom |  f o o d f i g h t
 tel: +46-8-6188428   |  s t o c k h o l m
 gsm: +46-708405080   |  - - - - - - - - -


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




Re: [PHP] Potential bug?

2001-08-04 Thread Patrik Wallstrom

On Sun, 22 Jul 2001, Anthony Lieuallen wrote:

> I've just discovered a weird quirk in PHP.  I'd first like to check if it is
> a known bug/weird feature/something else already known.  I've not yet tested
> it much, except I see it doesn't happen on every script, but either of the
> two results are quite strange to me.
>
> Suituation: file myscript.php exists, directory myscript/ does not.  If I
> browse to http://myhost/myscript.php all is well.  But
> http://myhost/myscript/ does return something, where I expect a '404 not
> found'.  Sometimes it just returns myscript.php.  BUT sometimes it returns
> the PHP source (minus PHP comments).  Aslo,
> http://myhost/myscript/anything/anything/bla.bla.bla returns the same.
>
> I was running PHP 4.0.4pl1 on RedHat Linux 6.2, kernel 2.4.6.  I upgraded to
> PHP 4.0.6 and still see this behavior.
>
> P.S. For the curious I discovered this because a personal site I have uses
> directory/admin.php for site admin, while another site I am developing at
> work uses directory/admin/ and I typed the wrong one at home :)

I haven't seen this with the php source problem, but otherwise this is a
feature of a default installation of apache. Turn off MultiViews for the
directories with this problem (or globally in httpd.conf).

http://httpd.apache.org/docs/mod/mod_negotiation.html

--
 patrik wallstrom |  f o o d f i g h t
 tel: +46-8-6188428   |  s t o c k h o l m
 gsm: +46-709580442   |  - - - - - - - - -


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




[PHP] optimizing mysql with php

2001-02-08 Thread Patrik Wallstrom


What settings should I have if I would like to optimize PHP without
exhausting my MySQL db?

There is the mysql.max_persistent setting, which is on a per process
level. Should I set this low, to 10 perhaps? If it's unlimited, PHP will
just eat up another persistent connection until MySQL is exhausted. If I
lower it, PHP will reuse the old ones.

I have set the MySQL setting to
set-variable= max_connections=255
which should not be succeeded.

MaxSpareServers is 25 in my Apache. Which should result in the 10 setting
for PHP, right? Since 10*25 = 250.

Is this the correct reasoning behind this setting?

Are there any other Apache/PHP-related settings I should think about?

--
 patrik wallstrom |  system design
 tel: +46-8-7298810   |  sonox.com
 gsm: +46-708405080   |  - - - - - - - - -
 fax: +46-859820060   |  a division of new media distribution



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