php-general Digest 3 Sep 2005 11:01:21 -0000 Issue 3661

Topics (messages 221787 through 221805):

socket_read() trouble with PHP_BINARY_READ
        221787 by: M. Sokolewicz
        221793 by: Tom Rogers
        221800 by: M. Sokolewicz
        221803 by: Gustav Wiberg

problem with the session and global variable
        221788 by: Tomás Rodriguez Orta
        221790 by: Gustav Wiberg

FreeBSD php{4,5} w/ LDAP + SSL/TLS ldap_start_tls()
        221789 by: Brian A. Seklecki
        221791 by: Rasmus Lerdorf

SoundEx in swedish?
        221792 by: Gustav Wiberg
        221794 by: Warren Vail

Create password for .htaccess file
        221795 by: virtualsoftware.gmail.com
        221796 by: viraj

Generating images on the fly, linking via symlink?
        221797 by: Dan Trainor

Distinguishing between multiple browser windows for the same php session
        221798 by: Chris Stenton
        221801 by: Gustav Wiberg
        221802 by: Jasper Bryant-Greene
        221804 by: Gustav Wiberg
        221805 by: Chris Stenton

apache (root) + php4
        221799 by: Michelle Konzack

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
hello,

I'm writing a socket approach to send email directly via an SMTP server (since some hosts block sendmail trough php due to abuse). Now, I have the code, attached below: I have cut it down slightly so it would still be readable though. I'm very sure that none of the stuff I removed actually matters in the problem though (mostly error chechking, logging, debug stuff, etc).

Ok, back to the problem. If I reread my log, I see the following "output":
S: 220 server -- Server ESMTP (iPlanet Messaging Server 5.2)
C: HELO ip
S:
C: MAIL FROM: <[EMAIL PROTECTED]>
S: 250 server OK, server2 [ip].
C: RCPT TO: <[EMAIL PROTECTED]>
S:
C: RSET

Now, obviously, the server sends something back (I checked, manually, using telnet). So, I figured that the socket_read(socket, size, PHP_NORMAL_READ) was causing the problem. So I switched over to PHP_BINARY_READ to make sure I didn't miss anything (because it broke off eg. midways). So... after I changed that, I suddenly started getting these errors: Warning: socket_read() unable to read from socket [11]: Resource temporarily unavailable in /home/me/scripts/mail.php on line 27

This goes for each attempt to read (even the first). I'm stumped... and really don't know how to proceed now...

Does anyone have any clues?
very appreciated,

- Tul

P.S. see attached, code:
<?php
class socket_SMTP {
        var $socket                     = null;
        
        function connect($host, $port, $user, $pass) {
                $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
                if ($this->socket < 0) {
exit("socket_create() failed: reason: " . socket_strerror($this->socket) . "\n");
                }
        
                $res = socket_connect($this->socket, gethostbyname($host), 
$port);
                if(false === $res) {
                        echo 'No connection';
                        return false;
                }
                socket_set_nonblock($this->socket);
                $this->get();
                $this->send('HELO '.'my-servers-ip-addy-goes-here');
                $this->get();        // ignore res
        }
        
        function send($cmd) {
                socket_write($this->connection, $cmd."\r\n", 
strlen($cmd."\r\n"));
        }
        
        function get() {
                $ret = socket_read($this->connection, 1024, PHP_BINARY_READ);
                return $ret;
        }
        
        function sendMessage($from, $to, $message, $headers) {
                $headers = $this->safeData($headers);
                $message = $this->safeData($message);
                
                $this->send('MAIL FROM: <'.$from.'>');
                $this->send('RCPT TO: <'.$to.'>');
                $this->send('DATA');
                $this->send($headers);
                $this->send('');     // CRLF to distinguish between headers and 
message
                $this->send($message);
                $this->send('.');
                
                // sent message
                return true;
        }
        
        function disconnect() {
                $this->send('QUIT');
                socket_close($this->socket);
        }
}
$mail = new socket_SMTP();
$mail->connect('mail.server.com', '25', 'username', 'password');
$mail->sendMessage('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', 'Test message', 'Subject: whatever-test-mail'."\r\n");
$mail->disconnect();
?>

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

Saturday, September 3, 2005, 9:19:11 AM, you wrote:
MS> hello,

MS> I'm writing a socket approach to send email directly via an SMTP server
MS> (since some hosts block sendmail trough php due to abuse). Now, I have
MS> the code, attached below:
MS> I have cut it down slightly so it would still be readable though. I'm
MS> very sure that none of the stuff I removed actually matters in the
MS> problem though (mostly error chechking, logging, debug stuff, etc).

MS> Ok, back to the problem. If I reread my log, I see the following "output":
MS> S: 220 server -- Server ESMTP (iPlanet Messaging Server 5.2)
MS> C: HELO ip
MS> S:
MS> C: MAIL FROM: <[EMAIL PROTECTED]>
MS> S: 250 server OK, server2 [ip].
MS> C: RCPT TO: <[EMAIL PROTECTED]>
MS> S:
MS> C: RSET

MS> Now, obviously, the server sends something back (I checked, manually,
MS> using telnet). So, I figured that the socket_read(socket, size, 
MS> PHP_NORMAL_READ) was causing the problem. So I switched over to 
MS> PHP_BINARY_READ to make sure I didn't miss anything (because it broke
MS> off eg. midways). So... after I changed that, I suddenly started getting
MS> these errors:
MS> Warning: socket_read() unable to read from socket [11]: Resource 
MS> temporarily unavailable in /home/me/scripts/mail.php on line 27

MS> This goes for each attempt to read (even the first). I'm stumped... and
MS> really don't know how to proceed now...

MS> Does anyone have any clues?
MS> very appreciated,

Because of this line the function returns straight away.

MS>             socket_set_nonblock($this->socket);

You have to catch the 'not ready' error something like this:
(The error code was under windows)

function get(){
  $ret = '';
  while(1){
    $sbuf = @socket_read($this->connection, 1024, PHP_BINARY_READ);
    if(false === $sbuf){
      $error = socket_last_error($this->connection);
      if($error != 10035){
        echo "msgsock read() failed: reason: " .$error.' '. socket_strerror 
(socket_last_error($this->connection)) . "\n";
        return;//socket not happy
      }
    }else{
      $buf_read = strlen($sbuf);
      if($buf_read === 0) break; // end of text
      $ret .= $sbuf;
    }
  }
  return $ret;
}





-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
hello,

thank you for the help, but I've tried your code, and it returns the exact same thing :( the error #11 temporarily unavailable. If I remove non-blocking, or change the error to ignore to 11 (10035 in your code example) it simply "hangs" doing nothing *at all*...

I'm stumped; really.. thank you for trying though :)

- tul
Tom Rogers wrote:
Hi,

Saturday, September 3, 2005, 9:19:11 AM, you wrote:
MS> hello,

MS> I'm writing a socket approach to send email directly via an SMTP server
MS> (since some hosts block sendmail trough php due to abuse). Now, I have
MS> the code, attached below:
MS> I have cut it down slightly so it would still be readable though. I'm
MS> very sure that none of the stuff I removed actually matters in the
MS> problem though (mostly error chechking, logging, debug stuff, etc).

MS> Ok, back to the problem. If I reread my log, I see the following "output":
MS> S: 220 server -- Server ESMTP (iPlanet Messaging Server 5.2)
MS> C: HELO ip
MS> S:
MS> C: MAIL FROM: <[EMAIL PROTECTED]>
MS> S: 250 server OK, server2 [ip].
MS> C: RCPT TO: <[EMAIL PROTECTED]>
MS> S:
MS> C: RSET

MS> Now, obviously, the server sends something back (I checked, manually,
MS> using telnet). So, I figured that the socket_read(socket, size, MS> PHP_NORMAL_READ) was causing the problem. So I switched over to MS> PHP_BINARY_READ to make sure I didn't miss anything (because it broke
MS> off eg. midways). So... after I changed that, I suddenly started getting
MS> these errors:
MS> Warning: socket_read() unable to read from socket [11]: Resource MS> temporarily unavailable in /home/me/scripts/mail.php on line 27

MS> This goes for each attempt to read (even the first). I'm stumped... and
MS> really don't know how to proceed now...

MS> Does anyone have any clues?
MS> very appreciated,

Because of this line the function returns straight away.

MS>          socket_set_nonblock($this->socket);

You have to catch the 'not ready' error something like this:
(The error code was under windows)

function get(){
  $ret = '';
  while(1){
    $sbuf = @socket_read($this->connection, 1024, PHP_BINARY_READ);
    if(false === $sbuf){
      $error = socket_last_error($this->connection);
      if($error != 10035){
        echo "msgsock read() failed: reason: " .$error.' '. socket_strerror 
(socket_last_error($this->connection)) . "\n";
        return;//socket not happy
      }
    }else{
      $buf_read = strlen($sbuf);
      if($buf_read === 0) break; // end of text
      $ret .= $sbuf;
    }
  }
  return $ret;
}






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

Can't it be anything with filepermissions? Just a clue...

/G
@varupiraten.se

----- Original Message ----- From: "M. Sokolewicz" <[EMAIL PROTECTED]>
To: <php-general@lists.php.net>; "Tom Rogers" <[EMAIL PROTECTED]>
Sent: Saturday, September 03, 2005 10:49 AM
Subject: Re: [PHP] socket_read() trouble with PHP_BINARY_READ


hello,

thank you for the help, but I've tried your code, and it returns the exact same thing :( the error #11 temporarily unavailable. If I remove non-blocking, or change the error to ignore to 11 (10035 in your code example) it simply "hangs" doing nothing *at all*...

I'm stumped; really.. thank you for trying though :)

- tul
Tom Rogers wrote:
Hi,

Saturday, September 3, 2005, 9:19:11 AM, you wrote:
MS> hello,

MS> I'm writing a socket approach to send email directly via an SMTP server MS> (since some hosts block sendmail trough php due to abuse). Now, I have
MS> the code, attached below:
MS> I have cut it down slightly so it would still be readable though. I'm
MS> very sure that none of the stuff I removed actually matters in the
MS> problem though (mostly error chechking, logging, debug stuff, etc).

MS> Ok, back to the problem. If I reread my log, I see the following "output":
MS> S: 220 server -- Server ESMTP (iPlanet Messaging Server 5.2)
MS> C: HELO ip
MS> S:
MS> C: MAIL FROM: <[EMAIL PROTECTED]>
MS> S: 250 server OK, server2 [ip].
MS> C: RCPT TO: <[EMAIL PROTECTED]>
MS> S:
MS> C: RSET

MS> Now, obviously, the server sends something back (I checked, manually,
MS> using telnet). So, I figured that the socket_read(socket, size, MS> PHP_NORMAL_READ) was causing the problem. So I switched over to MS> PHP_BINARY_READ to make sure I didn't miss anything (because it broke MS> off eg. midways). So... after I changed that, I suddenly started getting
MS> these errors:
MS> Warning: socket_read() unable to read from socket [11]: Resource MS> temporarily unavailable in /home/me/scripts/mail.php on line 27

MS> This goes for each attempt to read (even the first). I'm stumped... and
MS> really don't know how to proceed now...

MS> Does anyone have any clues?
MS> very appreciated,

Because of this line the function returns straight away.

MS> socket_set_nonblock($this->socket);

You have to catch the 'not ready' error something like this:
(The error code was under windows)

function get(){
  $ret = '';
  while(1){
    $sbuf = @socket_read($this->connection, 1024, PHP_BINARY_READ);
    if(false === $sbuf){
      $error = socket_last_error($this->connection);
      if($error != 10035){
echo "msgsock read() failed: reason: " .$error.' '. socket_strerror (socket_last_error($this->connection)) . "\n";
        return;//socket not happy
      }
    }else{
      $buf_read = strlen($sbuf);
      if($buf_read === 0) break; // end of text
      $ret .= $sbuf;
    }
  }
  return $ret;
}






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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/89 - Release Date: 2005-09-02



--- End Message ---
--- Begin Message ---
Hello people.

I have an problem very very complicate for me.
I have some template in my web sitie, and a car buy, I want to show to the user 
what count of the books have in your car buy,
but when I enter a new page in the other tampletae the variable take 1, why?
In ache page I write the following line 
session_start()

and the template I write 
if (isset($_SESSION['listprod'])) { $c=$_SESSION['i'];
  echo $c." "."books in your car buy";

some bidy can help me?

best regards TOMAS




-------------------------------------------------------------------------
Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
en el dominio de correo angerona.cult.cu  y no se encontro ninguna coincidencia.

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

I don't quite understand what you're trying to do here. Please send more code, then I might be able to help you... :-)

/G
@varupiraten.se

----- Original Message ----- From: "Tomás Rodriguez Orta" <[EMAIL PROTECTED]>
To: <php-general@lists.php.net>
Sent: Saturday, September 03, 2005 4:46 AM
Subject: [PHP] problem with the session and global variable


Hello people.

I have an problem very very complicate for me.
I have some template in my web sitie, and a car buy, I want to show to the user what count of the books have in your car buy,
but when I enter a new page in the other tampletae the variable take 1, why?
In ache page I write the following line
session_start()

and the template I write
if (isset($_SESSION['listprod'])) { $c=$_SESSION['i'];
 echo $c." "."books in your car buy";

some bidy can help me?

best regards TOMAS




-------------------------------------------------------------------------
Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
en el dominio de correo angerona.cult.cu y no se encontro ninguna coincidencia.


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


No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/88 - Release Date: 2005-09-01

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

All:

Firstly, sorry if this is the wrong list. There are thousands of forums and PHP5 related MLs, but nothing FBSD specific.

Second, I wouldn't post if this wasn't happening on two completely different FBSD boxes.

For whatever reason, the php4 and php5 from FreeBSD ports refuses to properly configure SSL/TLS support for the LDAP module.

This breaks the TLS/SSL functionality in net/phpldapadmin and sysutils/ldap-account-manager (CC'ing maintainers)

I've got two current i386/RELENG_5_3 boxes. Both with Apache apache-2.0.54_2 and openldap-client-2.2.27.

The ldap client binaries are linked to SSL fine and can talk both ldaps:// and Start_TLS over ldap://. That's out of the question.

One with php4-4.4.0, one with php5-5.0.3_2 (see below). Both have the LDAP and SSL php extension modules installed:

$ egrep -i "ldap|ssl" /usr/local/etc/php/extensions.ini
extension=openssl.so
extension=ldap.so

The php4 box's ldap module is linked to OpenSSL:

# ldd /usr/local/lib/php/20020429/ldap.so
/usr/local/lib/php/20020429/ldap.so:
        libldap-2.2.so.7 => /usr/local/lib/libldap-2.2.so.7 (0x28174000)
        liblber-2.2.so.7 => /usr/local/lib/liblber-2.2.so.7 (0x281a7000)
        libcrypto.so.3 => /lib/libcrypto.so.3 (0x281b4000)
        libssl.so.3 => /usr/lib/libssl.so.3 (0x282c8000)

The php5 box is as well:

$ ldd /usr/local/lib/php/20041030/ldap.so
/usr/local/lib/php/20041030/ldap.so:
        libldap-2.2.so.7 => /usr/local/lib/libldap-2.2.so.7 (0x28173000)
        liblber-2.2.so.7 => /usr/local/lib/liblber-2.2.so.7 (0x281a6000)
        libcrypto.so.3 => /lib/libcrypto.so.3 (0x281b3000)
        libssl.so.3 => /usr/lib/libssl.so.3 (0x282c7000)


The problem is that ldap_start_tls() is an unregistered/invalid function.


When i run the functions.php at http://www.sitepoint.com/article/php-command-line-2

ldap_start_tls() isn't listed on either machine (see below). The only reference to the problem I've been able to find is a PR:

http://www.freebsd.org/cgi/query-pr.cgi?pr=72275

.....but this only relates to PHP4. I don't know why *GRRR*, but this PR was closed without a fix ever being commited or any remarks! Anyway, I tried the proposed solution on the PHP4 machine. I removed the OpenSSL shared extension, export WITH_OPENSSL=true, recompiled php4 CLI/MOD with SSL static. Removed the SSL module from extensions.ini. Same problem.

The only possible localized problem I can see is my my predecessor placed:

PHP_EXT_INC=openssl

in php.conf.  I've tried rebuilding with and without that to no avail.

Anyway, I'm going to start looking into this tonight. Any thoughts would be appreciated. I'll open a PR when I track down the problem.

TIA,

~BAS

# pkg_info |grep -i php
libmcrypt-2.5.7_1   Multi-cipher cryptographic library (used in PHP)
pear-XML_RPC-1.4.0  PHP implementation of the XML-RPC protocol
php4-4.4.0          PHP Scripting Language (Apache Module and CLI)
php4-ctype-4.4.0    The ctype shared extension for php
php4-dba-4.4.0      The dba shared extension for php
php4-extensions-1.0 A "meta-port" to install PHP extensions
php4-gettext-4.4.0  The gettext shared extension for php
php4-ldap-4.4.0     The ldap shared extension for php
php4-mcrypt-4.4.0   The mcrypt shared extension for php
php4-mysql-4.4.0    The mysql shared extension for php
php4-openssl-4.4.0  The openssl shared extension for php
php4-overload-4.4.0 The overload shared extension for php
php4-pcre-4.4.0     The pcre shared extension for php
php4-pear-4.4.0     PEAR framework for PHP
php4-pgsql-4.4.0    The pgsql shared extension for php
php4-posix-4.4.0    The posix shared extension for php
php4-session-4.4.0  The session shared extension for php
php4-tokenizer-4.4.0 The tokenizer shared extension for php
php4-xml-4.4.0      The xml shared extension for php
php4-zlib-4.4.0     The zlib shared extension for php
phpldapadmin-0.9.7.a6,1 A set of PHP-scripts to administer LDAP servers


$ pkg_info |grep -i php5
php5-5.0.4_1        PHP Scripting Language (Apache Module and CLI)
php5-bz2-5.0.3_2    The bz2 shared extension for php
php5-calendar-5.0.3_2 The calendar shared extension for php
php5-ctype-5.0.3_2  The ctype shared extension for php
php5-curl-5.0.4_2   The curl shared extension for php
php5-dom-5.0.3_2    The dom shared extension for php
php5-exif-5.0.3_2   The exif shared extension for php
php5-extensions-1.0 A "meta-port" to install PHP extensions
php5-ftp-5.0.3_2    The ftp shared extension for php
php5-gd-5.0.3_2     The gd shared extension for php
php5-gettext-5.0.3_2 The gettext shared extension for php
php5-iconv-5.0.3_2  The iconv shared extension for php
php5-imap-5.0.3_2   The imap shared extension for php
php5-ldap-5.0.4_2   The ldap shared extension for php
php5-mcrypt-5.0.3_2 The mcrypt shared extension for php
php5-mhash-5.0.3_2  The mhash shared extension for php
php5-mysql-5.0.3_2  The mysql shared extension for php
php5-odbc-5.0.4_2   The odbc shared extension for php
php5-openssl-5.0.3_2 The openssl shared extension for php
php5-pcre-5.0.3_2   The pcre shared extension for php
php5-pear-5.0.3_2   PEAR framework for PHP
php5-pgsql-5.0.3_2  The pgsql shared extension for php
php5-posix-5.0.3_2  The posix shared extension for php
php5-session-5.0.3_2 The session shared extension for php
php5-simplexml-5.0.3_2 The simplexml shared extension for php
php5-soap-5.0.3_2   The soap shared extension for php
php5-sqlite-5.0.3_2 The sqlite shared extension for php
php5-sysvmsg-5.0.3_2 The sysvmsg shared extension for php
php5-sysvsem-5.0.3_2 The sysvsem shared extension for php
php5-sysvshm-5.0.3_2 The sysvshm shared extension for php
php5-tokenizer-5.0.3_2 The tokenizer shared extension for php
php5-xml-5.0.3_2    The xml shared extension for php
php5-zlib-5.0.3_2   The zlib shared extension for php

php4box# php public_html/functions.php -e ldap
ldap_connect
ldap_close
ldap_bind
ldap_unbind
ldap_read
ldap_list
ldap_search
ldap_free_result
ldap_count_entries
ldap_first_entry
ldap_next_entry
ldap_get_entries
ldap_first_attribute
ldap_next_attribute
ldap_get_attributes
ldap_get_values
ldap_get_values_len
ldap_get_dn
ldap_explode_dn
ldap_dn2ufn
ldap_add
ldap_delete
ldap_modify
ldap_mod_add
ldap_mod_replace
ldap_mod_del
ldap_errno
ldap_err2str
ldap_error
ldap_compare
ldap_sort
ldap_rename
ldap_get_option
ldap_set_option
ldap_first_reference
ldap_next_reference
ldap_set_rebind_proc


php5 box$ php functions.php -e ldap        ldap_connect
ldap_close
ldap_bind
ldap_unbind
ldap_read
ldap_list
ldap_search
ldap_free_result
ldap_count_entries
ldap_first_entry
ldap_next_entry
ldap_get_entries
ldap_first_attribute
ldap_next_attribute
ldap_get_attributes
ldap_get_values
ldap_get_values_len
ldap_get_dn
ldap_explode_dn
ldap_dn2ufn
ldap_add
ldap_delete
ldap_modify
ldap_mod_add
ldap_mod_replace
ldap_mod_del
ldap_errno
ldap_err2str
ldap_error
ldap_compare
ldap_sort
ldap_get_option
ldap_set_option
ldap_parse_result
ldap_first_reference
ldap_next_reference
ldap_rename
ldap_set_rebind_proc

--
~ TIA,

Brian A. Seklecki
Collaborative Fusion, Inc.
[EMAIL PROTECTED]
412-422-3463 x 4018
1710 Murray Avenue, Suite 320
Pittsburgh, PA 15217

l8*
        -lava

x.25 - minix - bitnet - plan9 - 110 bps - ASR 33 - base8

--- End Message ---
--- Begin Message ---
Brian A. Seklecki wrote:
> Firstly, sorry if this is the wrong list.  There are thousands of forums
> and PHP5 related MLs, but nothing FBSD specific.
> 
> Second, I wouldn't post if this wasn't happening on two completely
> different FBSD boxes.
> 
> For whatever reason, the php4 and php5 from FreeBSD ports refuses to
> properly configure SSL/TLS support for the LDAP module.

Can't you just build from the PHP tarball instead?  Seems like a messed
up port to me.  I use FreeBSD all day, every day and haven't seen this
problem.  But I also don't use the ports.

-Rasmus

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

Soundex works with diffrent kind of pronounciation... but does it work with Swedish language?
Anyone have experience of this???

/G
@varupiraten.se

--- End Message ---
--- Begin Message ---
My understanding is that soundex was developed by several mathemeticians
at MIT in the 1950's.  The idea was to create a way for similar sounding
family names to be grouped together reguardless of how they might be
spelled, and since english was the language their world spoke, the
algorithm tends to work best with names found in the northeastern United
States.  I believe there are different variants on the algorithm, but
they should produce the same binary number for names that sound the
same.  i.e. Smith and Smythe should produce the same number, or if not
numbers very close to one another.  I would expect poor results with the
Swedish language, perhaps if the mathemeticians had come from Minnesota.
I have personally seen it produce very bad results from Oriental and
Italian names.

> -----Original Message-----
> From: Gustav Wiberg [mailto:[EMAIL PROTECTED] 
> Sent: Friday, September 02, 2005 10:43 PM
> To: PHP General
> Subject: [PHP] SoundEx in swedish?
> 
> 
> Hi there!
> 
> Soundex works with diffrent kind of pronounciation... but 
> does it work with 
> Swedish language?
> Anyone have experience of this???
> 
> /G
> @varupiraten.se
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

--- End Message ---
--- Begin Message ---
Hi,
I have an htaccess file and I want to create users and password with a php 
script. The problem is that I've used md5 encryp for the password and is not 
working. How to create the password from a php script.

Thanks in advance for your help

--- End Message ---
--- Begin Message ---
On 9/3/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi,
> I have an htaccess file and I want to create users and password with a php 
> script. The problem is that I've used md5 encryp for the password and is not 
> working. How to create the password from a php script.

this is a good starting point..
http://www.webmasterworld.com/forum92/3274.htm

happy .htaccesing

~viraj.

> 
> Thanks in advance for your help
>

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

This is a question that could depend on a completely different (yet, relayed) subject, so I'm sending this email to both php-general@ and [EMAIL PROTECTED] I thank you in advance for your understanding.

I am currently generating some images on the fly using some of PHP's image generation and rendering functions. I'm having loads of success, and like the results that I see.

What I'd like this script to do is, to create symlinks to the origional image, and then when the script is done running, the symlinks are deleted. Basically trying to make it so that the origional image is not known to the client or browser.

So I'm taking, say, image1.jpg.  I'm creating a symlink via:

$linkname = md5(rand());

or something similar. I'd then like to return $linkname to the client or browser. Then, when the browser has completed rendering the page to the client or browser, the symlink is then deleted.

What I'm curious as to right now is if I do this, the client will see the link to $linkname via HTML's "img src=" specification. What happens if this is sent to the client or browser, and the symlink is deleted immediately after the name is sent to the client or browser? Would the web server (in this case, Apache) cache the image in memory until the client has downloaded said image, and then delete it from memory when the page is done rendering or being sent? Will PHP totally disregard the web server's request to "hold" the image, and render nothing to the browser? This is something I'm confused about.

Thanks!
-dant

--- End Message ---
--- Begin Message ---
I need a way of setting the session_vars specific to a users browser window
for the case of the user having multiple windows open for the same php
session. Is this possible in php?

I know you can pickup the window id via "self" in JavaScript but I can't see
how you can link this back to the server side session vars. I can't find a
PHP var that has this information.

Thanks

Chris

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

<?php echo $_SELF;?>  ?

/G
@varupiraten.se

----- Original Message ----- From: "Chris Stenton" <[EMAIL PROTECTED]>
To: <php-general@lists.php.net>
Sent: Saturday, September 03, 2005 10:01 AM
Subject: [PHP] Distinguishing between multiple browser windows for the same php session


I need a way of setting the session_vars specific to a users browser window
for the case of the user having multiple windows open for the same php
session. Is this possible in php?

I know you can pickup the window id via "self" in JavaScript but I can't see
how you can link this back to the server side session vars. I can't find a
PHP var that has this information.

Thanks

Chris

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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/89 - Release Date: 2005-09-02



--- End Message ---
--- Begin Message ---
Gustav Wiberg wrote:
<?php echo $_SELF;?>  ?

Please don't top-post [1].

This will not work. $_SELF isn't even a defined variable, unless you defined it yourself.

PHP works on the server, *before* anything is sent on the client, so it has no way to know client-side things like what browser window you are in.

You could place the value in a hidden form field with JS and then post back to the server, but something tells me you may be approaching the problem in the wrong way. Without more details I can't suggest alternatives, though.

[1] http://en.wikipedia.org/wiki/Top-posting

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

--- End Message ---
--- Begin Message --- Ok! I didn't know that was wrong to "top-post"... I think I know what it is now! :-)

/G
@varupiraten.se

----- Original Message ----- From: "Jasper Bryant-Greene" <[EMAIL PROTECTED]>
To: <php-general@lists.php.net>
Sent: Saturday, September 03, 2005 11:48 AM
Subject: Re: [PHP] Distinguishing between multiple browser windows for thesame php session


Gustav Wiberg wrote:
<?php echo $_SELF;?>  ?

Please don't top-post [1].

This will not work. $_SELF isn't even a defined variable, unless you defined it yourself.

PHP works on the server, *before* anything is sent on the client, so it has no way to know client-side things like what browser window you are in.

You could place the value in a hidden form field with JS and then post back to the server, but something tells me you may be approaching the problem in the wrong way. Without more details I can't suggest alternatives, though.

[1] http://en.wikipedia.org/wiki/Top-posting

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/89 - Release Date: 2005-09-02



--- End Message ---
--- Begin Message ---
> Gustav Wiberg wrote:
>> <?php echo $_SELF;?>  ?
>
> Please don't top-post [1].
>
> This will not work. $_SELF isn't even a defined variable, unless you 
> defined it yourself.
>
> PHP works on the server, *before* anything is sent on the client, so it 
> has no way to know client-side things like what browser window you are in.
>
> You could place the value in a hidden form field with JS and then post 
> back to the server, but something tells me you may be approaching the 
> problem in the wrong way. Without more details I can't suggest 
> alternatives, though.

My problem is that I have a database system where I have a form to define a
search  pattern of the database
which gets placed in session_vars. The user then can use a whole bunch of
php pages to work with this search criteria.

My problem is that if the user does "file new window" in the browser s/he
can then define a new search pattern which
would change the session_vars behind the back of the other window and cause
havoc on that window. I really don't want to
put the search criteria as part of the URI between all these pages and use
GET to pull the data off as the user
could fiddle with the line and again cause problems. It probably would be
nice to be able to stop "file new window"
from working but I have not found a way of doing this.

Chris

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

for an half hour I was at a new customer and they run apache 1.3 as
root on am IntranetServer because they need to admin there Fileserver
via php.

Now some problems:

1)  They use exec("mcrypt ....") to generate UNIX passwords for
    /etc/shadow and I like to know, how I can create suitable md5
    passwords for it from php.

2)  I like to run apache as www-data and not as root.  How I must
    setup php/apache that I can do root-stuff because I need to run

    exec("useradd -c $WA_COMMENT         -d $WA_HOME_DIR      \
                  -e $WA_EXPIRE_DATE     -f $WA_INACTIVE_TIME \
                  -g $WA_INITIAL_GROUP   -G $WA_GROUPS        \
                  -m -k $WA_SKELETON_DIR -s $WA_SHELL         \
                  -u $WA_UID -p $WA_PASS_MCRYPT $WA_LOGIN")

Thanks and nice wekend
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---

Reply via email to