[PHP] Re: PHP list posting confirmation for izod...@gmail.com

2009-05-27 Thread help
Hi,

I am trying to connect to specific server using but I have the below error
messagr. Whta could be the problem?

$fp = fsockopen($ip,$port, $errno, $errstr, $timeout);
 fwrite($fp,$LRG);

 //return  "$errstr ($errno)";

 if (!$fp) {
  echo "$errstr ($errno)"; //"$errstr ($errno)\n";
 }

*A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because
connected host has failed to respond. (10060)*


[PHP] [php] socket connection problem

2009-05-27 Thread help
 Hi,

I am trying to connect to specific server using but I have the below error
messagr. Whta could be the problem?

$fp = fsockopen($ip,$port, $errno, $errstr, $timeout);
 fwrite($fp,$LRG);

 //return  "$errstr ($errno)";

 if (!$fp) {
  echo "$errstr ($errno)"; //"$errstr ($errno)\n";
 }

*A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because
connected host has failed to respond. (10060)*


Re: [PHP] Re: PHP list posting confirmation for izod...@gmail.com

2009-05-27 Thread BeMyCandy.com
I need to establish connection to the server first, send in my login
packet and before reading the server response.

The same error when I also use the below function:

$fp = stream_socket_client("$con:$ip:$port", $errno, $errstr, $timeout);

 if (!$fp) {
 echo "$errstr ($errno)"; //"$errstr ($errno)\n";
 }

On Wed, May 27, 2009 at 9:12 AM, Sherif Gayed  wrote:

> I think you need to use fread not fwrite.
>
> Regards,
>
> Sherif
>
> On Wed, May 27, 2009 at 8:08 PM, help  wrote:
> > Hi,
> >
> > I am trying to connect to specific server using but I have the below
> error
> > messagr. Whta could be the problem?
> >
> > $fp = fsockopen($ip,$port, $errno, $errstr, $timeout);
> >  fwrite($fp,$LRG);
> >
> >  //return  "$errstr ($errno)";
> >
> >  if (!$fp) {
> >  echo "$errstr ($errno)"; //"$errstr ($errno)\n";
> >  }
> >
> > *A connection attempt failed because the connected party did not properly
> > respond after a period of time, or established connection failed because
> > connected host has failed to respond. (10060)*
> >
>



-- 
www.bemycandy.com


[PHP] PHP ping and exec() hangs apache

2009-05-27 Thread Kamil Walas

Hi,

I stuck with strange error. I have following code:


Address doesn't exist. When execute script from command line everything 
works fine. But when I go to the file by Firefox it hangs out and apache 
need to be restart. This is a Virtual Server with PHP Version 
5.2.6-pl222-gentoo. When address exists it works fine. Only problem is 
when it doesn't respond and apache hangs.


I copy file to apache at my local apache and everything works fine. My 
apache is with Version 5.3.0alpha3-dev at windows XP.


At old server with php4 everything works fine.

I suspect that something wrong is with apache configuration but I don't 
know it for sure and couldn't find it.


Thank you,
Kamil Walas

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



Re: [PHP] PHP scalability problem

2009-05-27 Thread Marc Steinert
Have a look at APC. APC is a bytecode cache, that stores bytecode generated of your PHP scripts, so 
that your PHP code don't need be parsed every time the script is invoked.


http://pecl.php.net/package/apc

I was able to increase the performance of my PHP scripts dramatically.

Greetings from Germany

Marc


tRace DOliveira wrote:

What I am trying to achieve is to have the server do less processing. Like I 
said PHP is a server side scripting language and each time a request is made a 
process is spawned and processes are heavy weight as compared to a thread which 
is a light weight process. So I want to take away much processing away from the 
server and have the client do it instead. Because if many requests are made the 
server will eventually go down because it will over the server.I am not trying 
to get away from PHP but I am trying to solve the problem of scalability
Thank you, 
Leonard D'Oliveira



  



--
Synchronize and share your files over the web for free
http://bithub.net/

My Twitter feed
http://twitter.com/MarcSteinert





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



[PHP] getting file location

2009-05-27 Thread Grega Leskovsek
I have made a CMS with editing files. When I display the file name it
shows something like "../subdir/filename.php"
How can I display the actual filename that's on the web: like
http://localhost/subdir/filename.php or even better if it is possible:
http://domainname/subdir/filename.php ?

Thanks in advance, Grega from Slovenia

-- 
When the sun rises I receive and when it sets I forgive ->
http://users.skavt.net/~gleskovs/
All the Love, Grega Leskov'sek

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



[PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-27 Thread HELP!
Hi,
 error:
php_network_getaddresses: getaddrinfo failed: No such host is known

 $fstream = stream_socket_client("$con:$ip:$port", $errno, $errstr,
$timeout);

 if($fstream){
  $br = fwrite($fstream,$login_request_block);
  $str = stream_get_contents($fstream);
  print( "Connection successful: $str ");
 }
 else{
  return  " str: $strwrite:$br $errstr ($errno)";
 }

What could be the error


-- 
www.bemycandy.com


Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-27 Thread Stuart
2009/5/27 HELP! :
> Hi,
>  error:
> php_network_getaddresses: getaddrinfo failed: No such host is known
>
>  $fstream = stream_socket_client("$con:$ip:$port", $errno, $errstr,
> $timeout);
>
>  if($fstream){
>  $br = fwrite($fstream,$login_request_block);
>  $str = stream_get_contents($fstream);
>  print( "Connection successful: $str ");
>  }
>  else{
>  return  " str: $strwrite:$br $errstr ($errno)";
>  }
>
> What could be the error

What's in $con? I'm guessing "tcp" in which case the first parameter
to stream_socket_client is wrong. See the manual for details:
http://php.net/stream_socket_client

In future please consult the manual and double-check that you're
passing valid arguments to the functions you're using before asking on
this list.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-27 Thread HELP!
$port ="xx";
 $ip ="xx";
 $con =$transport = "tcp";

On Wed, May 27, 2009 at 1:24 PM, Stuart  wrote:

> 2009/5/27 HELP! :
>  > Hi,
> >  error:
> > php_network_getaddresses: getaddrinfo failed: No such host is known
> >
> >  $fstream = stream_socket_client("$con:$ip:$port", $errno, $errstr,
> > $timeout);
> >
> >  if($fstream){
> >  $br = fwrite($fstream,$login_request_block);
> >  $str = stream_get_contents($fstream);
> >  print( "Connection successful: $str ");
> >  }
> >  else{
> >  return  " str: $strwrite:$br $errstr ($errno)";
> >  }
> >
> > What could be the error
>
> What's in $con? I'm guessing "tcp" in which case the first parameter
> to stream_socket_client is wrong. See the manual for details:
> http://php.net/stream_socket_client
>
> In future please consult the manual and double-check that you're
> passing valid arguments to the functions you're using before asking on
> this list.
>
> -Stuart
>
> --
> http://stut.net/
>



-- 
www.bemycandy.com


Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-27 Thread Stuart
2009/5/27 HELP! :
> $port ="xx";
>  $ip ="xx";
>  $con =$transport = "tcp";

Which part of "See the manual for details" confused you?

You're passing ...

"$con:$ip:$port"

... which based on the above will translate to ...

"tcp:xx:xx"

... which is invalid. It should be ...

"$con://$ip:$port"

... which will translate to ...

"tcp://xx:xx"

... which is a valid value.

Please, read the damn manual ... carefully!!

-Stuart

-- 
http://stut.net/

> On Wed, May 27, 2009 at 1:24 PM, Stuart  wrote:
>>
>> 2009/5/27 HELP! :
>> > Hi,
>> >  error:
>> > php_network_getaddresses: getaddrinfo failed: No such host is known
>> >
>> >  $fstream = stream_socket_client("$con:$ip:$port", $errno, $errstr,
>> > $timeout);
>> >
>> >  if($fstream){
>> >  $br = fwrite($fstream,$login_request_block);
>> >  $str = stream_get_contents($fstream);
>> >  print( "Connection successful: $str ");
>> >  }
>> >  else{
>> >  return  " str: $strwrite:$br $errstr ($errno)";
>> >  }
>> >
>> > What could be the error
>>
>> What's in $con? I'm guessing "tcp" in which case the first parameter
>> to stream_socket_client is wrong. See the manual for details:
>> http://php.net/stream_socket_client
>>
>> In future please consult the manual and double-check that you're
>> passing valid arguments to the functions you're using before asking on
>> this list.
>>
>> -Stuart
>>
>> --
>> http://stut.net/
>
>
>
> --
> www.bemycandy.com
>

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



Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-27 Thread HELP!
I have made the correction but the error remiins:

$port ="xx";
 $ip ="xx
 $con ="tcp";
 $timeout = 30;




 $fstream = stream_socket_client("$con://$ip:$port", $errno, $errstr,
$timeout);

 if($fstream){
  $str = stream_get_contents($fstream);
  print( "Connection successful: $str ");
 }
 else{
  echo   "Remote: ".$name." str: $strwrite:$br $errstr
($errno)";
 }

On Wed, May 27, 2009 at 1:31 PM, Stuart  wrote:

> 2009/5/27 HELP! :
> > $port ="xx";
> >  $ip ="xx";
> >  $con =$transport = "tcp";
>
> Which part of "See the manual for details" confused you?
>
> You're passing ...
>
>"$con:$ip:$port"
>
> ... which based on the above will translate to ...
>
>"tcp:xx:xx"
>
> ... which is invalid. It should be ...
>
>"$con://$ip:$port"
>
> ... which will translate to ...
>
>"tcp://xx:xx"
>
> ... which is a valid value.
>
> Please, read the damn manual ... carefully!!
>
> -Stuart
>
> --
> http://stut.net/
>
> > On Wed, May 27, 2009 at 1:24 PM, Stuart  wrote:
> >>
> >> 2009/5/27 HELP! :
> >> > Hi,
> >> >  error:
> >> > php_network_getaddresses: getaddrinfo failed: No such host is known
> >> >
> >> >  $fstream = stream_socket_client("$con:$ip:$port", $errno, $errstr,
> >> > $timeout);
> >> >
> >> >  if($fstream){
> >> >  $br = fwrite($fstream,$login_request_block);
> >> >  $str = stream_get_contents($fstream);
> >> >  print( "Connection successful: $str ");
> >> >  }
> >> >  else{
> >> >  return  " str: $strwrite:$br $errstr ($errno)";
> >> >  }
> >> >
> >> > What could be the error
> >>
> >> What's in $con? I'm guessing "tcp" in which case the first parameter
> >> to stream_socket_client is wrong. See the manual for details:
> >> http://php.net/stream_socket_client
> >>
> >> In future please consult the manual and double-check that you're
> >> passing valid arguments to the functions you're using before asking on
> >> this list.
> >>
> >> -Stuart
> >>
> >> --
> >> http://stut.net/
> >
> >
> >
> > --
> > www.bemycandy.com
> >
>



-- 
www.bemycandy.com


Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-27 Thread Stuart
2009/5/27 HELP! :
> I have made the correction but the error remiins:
>
> $port ="xx";
>  $ip ="xx
>  $con ="tcp";
>  $timeout = 30;
>
>
>
>
>  $fstream = stream_socket_client("$con://$ip:$port", $errno, $errstr,
> $timeout);
>
>  if($fstream){
>   $str = stream_get_contents($fstream);
>   print( "Connection successful: $str ");
>  }
>  else{
>   echo   "Remote: ".$name." str: $strwrite:$br $errstr
> ($errno)";
>  }

My guess is that the IP you're trying to connect to is wrong. Can you
telnet to that IP/port combination on a command line?

-Stuart

-- 
http://stut.net/

> On Wed, May 27, 2009 at 1:31 PM, Stuart  wrote:
>>
>> 2009/5/27 HELP! :
>> > $port ="xx";
>> >  $ip ="xx";
>> >  $con =$transport = "tcp";
>>
>> Which part of "See the manual for details" confused you?
>>
>> You're passing ...
>>
>>    "$con:$ip:$port"
>>
>> ... which based on the above will translate to ...
>>
>>    "tcp:xx:xx"
>>
>> ... which is invalid. It should be ...
>>
>>    "$con://$ip:$port"
>>
>> ... which will translate to ...
>>
>>    "tcp://xx:xx"
>>
>> ... which is a valid value.
>>
>> Please, read the damn manual ... carefully!!
>>
>> -Stuart
>>
>> --
>> http://stut.net/
>>
>> > On Wed, May 27, 2009 at 1:24 PM, Stuart  wrote:
>> >>
>> >> 2009/5/27 HELP! :
>> >> > Hi,
>> >> >  error:
>> >> > php_network_getaddresses: getaddrinfo failed: No such host is known
>> >> >
>> >> >  $fstream = stream_socket_client("$con:$ip:$port", $errno, $errstr,
>> >> > $timeout);
>> >> >
>> >> >  if($fstream){
>> >> >  $br = fwrite($fstream,$login_request_block);
>> >> >  $str = stream_get_contents($fstream);
>> >> >  print( "Connection successful: $str ");
>> >> >  }
>> >> >  else{
>> >> >  return  " str: $strwrite:$br $errstr ($errno)";
>> >> >  }
>> >> >
>> >> > What could be the error
>> >>
>> >> What's in $con? I'm guessing "tcp" in which case the first parameter
>> >> to stream_socket_client is wrong. See the manual for details:
>> >> http://php.net/stream_socket_client
>> >>
>> >> In future please consult the manual and double-check that you're
>> >> passing valid arguments to the functions you're using before asking on
>> >> this list.
>> >>
>> >> -Stuart
>> >>
>> >> --
>> >> http://stut.net/
>> >
>> >
>> >
>> > --
>> > www.bemycandy.com
>> >
>
>
>
> --
> www.bemycandy.com
>

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



Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-27 Thread Stuart
2009/5/27 HELP! :
> start> run> cmd>
> telnet ip port
>
> could not connect

In that case your problem is not with PHP. I suggest you talk to your
network administrator.

-Stuart

-- 
http://stut.net/

> On Wed, May 27, 2009 at 1:44 PM, Stuart  wrote:
>>
>> 2009/5/27 HELP! :
>> > I have made the correction but the error remiins:
>> >
>> > $port ="xx";
>> >  $ip ="xx
>> >  $con ="tcp";
>> >  $timeout = 30;
>> >
>> >
>> >
>> >
>> >  $fstream = stream_socket_client("$con://$ip:$port", $errno, $errstr,
>> > $timeout);
>> >
>> >  if($fstream){
>> >   $str = stream_get_contents($fstream);
>> >   print( "Connection successful: $str ");
>> >  }
>> >  else{
>> >   echo   "Remote: ".$name." str: $strwrite:$br $errstr
>> > ($errno)";
>> >  }
>>
>> My guess is that the IP you're trying to connect to is wrong. Can you
>> telnet to that IP/port combination on a command line?
>>
>> -Stuart
>>
>> --
>> http://stut.net/
>>
>> > On Wed, May 27, 2009 at 1:31 PM, Stuart  wrote:
>> >>
>> >> 2009/5/27 HELP! :
>> >> > $port ="xx";
>> >> >  $ip ="xx";
>> >> >  $con =$transport = "tcp";
>> >>
>> >> Which part of "See the manual for details" confused you?
>> >>
>> >> You're passing ...
>> >>
>> >>    "$con:$ip:$port"
>> >>
>> >> ... which based on the above will translate to ...
>> >>
>> >>    "tcp:xx:xx"
>> >>
>> >> ... which is invalid. It should be ...
>> >>
>> >>    "$con://$ip:$port"
>> >>
>> >> ... which will translate to ...
>> >>
>> >>    "tcp://xx:xx"
>> >>
>> >> ... which is a valid value.
>> >>
>> >> Please, read the damn manual ... carefully!!
>> >>
>> >> -Stuart
>> >>
>> >> --
>> >> http://stut.net/
>> >>
>> >> > On Wed, May 27, 2009 at 1:24 PM, Stuart  wrote:
>> >> >>
>> >> >> 2009/5/27 HELP! :
>> >> >> > Hi,
>> >> >> >  error:
>> >> >> > php_network_getaddresses: getaddrinfo failed: No such host is
>> >> >> > known
>> >> >> >
>> >> >> >  $fstream = stream_socket_client("$con:$ip:$port", $errno,
>> >> >> > $errstr,
>> >> >> > $timeout);
>> >> >> >
>> >> >> >  if($fstream){
>> >> >> >  $br = fwrite($fstream,$login_request_block);
>> >> >> >  $str = stream_get_contents($fstream);
>> >> >> >  print( "Connection successful: $str ");
>> >> >> >  }
>> >> >> >  else{
>> >> >> >  return  " str: $strwrite:$br $errstr ($errno)";
>> >> >> >  }
>> >> >> >
>> >> >> > What could be the error
>> >> >>
>> >> >> What's in $con? I'm guessing "tcp" in which case the first parameter
>> >> >> to stream_socket_client is wrong. See the manual for details:
>> >> >> http://php.net/stream_socket_client
>> >> >>
>> >> >> In future please consult the manual and double-check that you're
>> >> >> passing valid arguments to the functions you're using before asking
>> >> >> on
>> >> >> this list.
>> >> >>
>> >> >> -Stuart
>> >> >>
>> >> >> --
>> >> >> http://stut.net/
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > www.bemycandy.com
>> >> >
>> >
>> >
>> >
>> > --
>> > www.bemycandy.com
>> >
>
>
>
> --
> www.bemycandy.com
>

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



Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-27 Thread HELP!
I am using a single pc and i have enable firewall access. Could it be that
the remote server is having trouble

On Wed, May 27, 2009 at 2:02 PM, Stuart  wrote:

> 2009/5/27 HELP! :
> > start> run> cmd>
> > telnet ip port
> >
> > could not connect
>
> In that case your problem is not with PHP. I suggest you talk to your
> network administrator.
>
> -Stuart
>
> --
> http://stut.net/
>
> > On Wed, May 27, 2009 at 1:44 PM, Stuart  wrote:
> >>
> >> 2009/5/27 HELP! :
> >> > I have made the correction but the error remiins:
> >> >
> >> > $port ="xx";
> >> >  $ip ="xx
> >> >  $con ="tcp";
> >> >  $timeout = 30;
> >> >
> >> >
> >> >
> >> >
> >> >  $fstream = stream_socket_client("$con://$ip:$port", $errno, $errstr,
> >> > $timeout);
> >> >
> >> >  if($fstream){
> >> >   $str = stream_get_contents($fstream);
> >> >   print( "Connection successful: $str ");
> >> >  }
> >> >  else{
> >> >   echo   "Remote: ".$name." str: $strwrite:$br $errstr
> >> > ($errno)";
> >> >  }
> >>
> >> My guess is that the IP you're trying to connect to is wrong. Can you
> >> telnet to that IP/port combination on a command line?
> >>
> >> -Stuart
> >>
> >> --
> >> http://stut.net/
> >>
> >> > On Wed, May 27, 2009 at 1:31 PM, Stuart  wrote:
> >> >>
> >> >> 2009/5/27 HELP! :
> >> >> > $port ="xx";
> >> >> >  $ip ="xx";
> >> >> >  $con =$transport = "tcp";
> >> >>
> >> >> Which part of "See the manual for details" confused you?
> >> >>
> >> >> You're passing ...
> >> >>
> >> >>"$con:$ip:$port"
> >> >>
> >> >> ... which based on the above will translate to ...
> >> >>
> >> >>"tcp:xx:xx"
> >> >>
> >> >> ... which is invalid. It should be ...
> >> >>
> >> >>"$con://$ip:$port"
> >> >>
> >> >> ... which will translate to ...
> >> >>
> >> >>"tcp://xx:xx"
> >> >>
> >> >> ... which is a valid value.
> >> >>
> >> >> Please, read the damn manual ... carefully!!
> >> >>
> >> >> -Stuart
> >> >>
> >> >> --
> >> >> http://stut.net/
> >> >>
> >> >> > On Wed, May 27, 2009 at 1:24 PM, Stuart  wrote:
> >> >> >>
> >> >> >> 2009/5/27 HELP! :
> >> >> >> > Hi,
> >> >> >> >  error:
> >> >> >> > php_network_getaddresses: getaddrinfo failed: No such host is
> >> >> >> > known
> >> >> >> >
> >> >> >> >  $fstream = stream_socket_client("$con:$ip:$port", $errno,
> >> >> >> > $errstr,
> >> >> >> > $timeout);
> >> >> >> >
> >> >> >> >  if($fstream){
> >> >> >> >  $br = fwrite($fstream,$login_request_block);
> >> >> >> >  $str = stream_get_contents($fstream);
> >> >> >> >  print( "Connection successful: $str ");
> >> >> >> >  }
> >> >> >> >  else{
> >> >> >> >  return  " str: $strwrite:$br $errstr ($errno)";
> >> >> >> >  }
> >> >> >> >
> >> >> >> > What could be the error
> >> >> >>
> >> >> >> What's in $con? I'm guessing "tcp" in which case the first
> parameter
> >> >> >> to stream_socket_client is wrong. See the manual for details:
> >> >> >> http://php.net/stream_socket_client
> >> >> >>
> >> >> >> In future please consult the manual and double-check that you're
> >> >> >> passing valid arguments to the functions you're using before
> asking
> >> >> >> on
> >> >> >> this list.
> >> >> >>
> >> >> >> -Stuart
> >> >> >>
> >> >> >> --
> >> >> >> http://stut.net/
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > www.bemycandy.com
> >> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > www.bemycandy.com
> >> >
> >
> >
> >
> > --
> > www.bemycandy.com
> >
>



-- 
www.bemycandy.com


Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-27 Thread Stuart
2009/5/27 HELP! :
> I am using a single pc and i have enable firewall access. Could it be that
> the remote server is having trouble

There's like 37 different things it could be, none of which have
anything to do with PHP. You may find someone on this list willing to
help you out, but your better bet would be to find a list more suited
to the problem.

-Stuart

-- 
http://stut.net/

> On Wed, May 27, 2009 at 2:02 PM, Stuart  wrote:
>>
>> 2009/5/27 HELP! :
>> > start> run> cmd>
>> > telnet ip port
>> >
>> > could not connect
>>
>> In that case your problem is not with PHP. I suggest you talk to your
>> network administrator.
>>
>> -Stuart
>>
>> --
>> http://stut.net/
>>
>> > On Wed, May 27, 2009 at 1:44 PM, Stuart  wrote:
>> >>
>> >> 2009/5/27 HELP! :
>> >> > I have made the correction but the error remiins:
>> >> >
>> >> > $port ="xx";
>> >> >  $ip ="xx
>> >> >  $con ="tcp";
>> >> >  $timeout = 30;
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >  $fstream = stream_socket_client("$con://$ip:$port", $errno, $errstr,
>> >> > $timeout);
>> >> >
>> >> >  if($fstream){
>> >> >   $str = stream_get_contents($fstream);
>> >> >   print( "Connection successful: $str ");
>> >> >  }
>> >> >  else{
>> >> >   echo   "Remote: ".$name." str: $strwrite:$br $errstr
>> >> > ($errno)";
>> >> >  }
>> >>
>> >> My guess is that the IP you're trying to connect to is wrong. Can you
>> >> telnet to that IP/port combination on a command line?
>> >>
>> >> -Stuart
>> >>
>> >> --
>> >> http://stut.net/
>> >>
>> >> > On Wed, May 27, 2009 at 1:31 PM, Stuart  wrote:
>> >> >>
>> >> >> 2009/5/27 HELP! :
>> >> >> > $port ="xx";
>> >> >> >  $ip ="xx";
>> >> >> >  $con =$transport = "tcp";
>> >> >>
>> >> >> Which part of "See the manual for details" confused you?
>> >> >>
>> >> >> You're passing ...
>> >> >>
>> >> >>    "$con:$ip:$port"
>> >> >>
>> >> >> ... which based on the above will translate to ...
>> >> >>
>> >> >>    "tcp:xx:xx"
>> >> >>
>> >> >> ... which is invalid. It should be ...
>> >> >>
>> >> >>    "$con://$ip:$port"
>> >> >>
>> >> >> ... which will translate to ...
>> >> >>
>> >> >>    "tcp://xx:xx"
>> >> >>
>> >> >> ... which is a valid value.
>> >> >>
>> >> >> Please, read the damn manual ... carefully!!
>> >> >>
>> >> >> -Stuart
>> >> >>
>> >> >> --
>> >> >> http://stut.net/
>> >> >>
>> >> >> > On Wed, May 27, 2009 at 1:24 PM, Stuart  wrote:
>> >> >> >>
>> >> >> >> 2009/5/27 HELP! :
>> >> >> >> > Hi,
>> >> >> >> >  error:
>> >> >> >> > php_network_getaddresses: getaddrinfo failed: No such host is
>> >> >> >> > known
>> >> >> >> >
>> >> >> >> >  $fstream = stream_socket_client("$con:$ip:$port", $errno,
>> >> >> >> > $errstr,
>> >> >> >> > $timeout);
>> >> >> >> >
>> >> >> >> >  if($fstream){
>> >> >> >> >  $br = fwrite($fstream,$login_request_block);
>> >> >> >> >  $str = stream_get_contents($fstream);
>> >> >> >> >  print( "Connection successful: $str ");
>> >> >> >> >  }
>> >> >> >> >  else{
>> >> >> >> >  return  " str: $strwrite:$br $errstr ($errno)";
>> >> >> >> >  }
>> >> >> >> >
>> >> >> >> > What could be the error
>> >> >> >>
>> >> >> >> What's in $con? I'm guessing "tcp" in which case the first
>> >> >> >> parameter
>> >> >> >> to stream_socket_client is wrong. See the manual for details:
>> >> >> >> http://php.net/stream_socket_client
>> >> >> >>
>> >> >> >> In future please consult the manual and double-check that you're
>> >> >> >> passing valid arguments to the functions you're using before
>> >> >> >> asking
>> >> >> >> on
>> >> >> >> this list.
>> >> >> >>
>> >> >> >> -Stuart
>> >> >> >>
>> >> >> >> --
>> >> >> >> http://stut.net/
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > www.bemycandy.com
>> >> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > www.bemycandy.com
>> >> >
>> >
>> >
>> >
>> > --
>> > www.bemycandy.com
>> >
>
>
>
> --
> www.bemycandy.com
>

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



[PHP] continue working after finishing up with the http client

2009-05-27 Thread Tom Worster
what options are there to do the following:

1. receive request from client (including post data)

2. do some work, update the db, prepare output for client

3. send output and finish up with the client

4. do some more work that might take considerable time, updating the db some
more

it would be convenient and efficient if step 4 took place within the same
process as steps 1-3. but output control seems not to be sufficient:
ob_flush(); flush(); sends the output but leave the client waiting for more.
is there a way to close the connection as though exit; were called but
without quitting the script?

alternatively the script could start another process, copy over whatever
data is needed and disconnect from it. but that has its overheads on the
server.

are the other possibilities?

tia
tom



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



Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-27 Thread Daniel Brown
On Wed, May 27, 2009 at 09:08, Stuart  wrote:
>
> There's like 37 different things it could be, none of which have
> anything to do with PHP. You may find someone on this list willing to
> help you out, but your better bet would be to find a list more suited
> to the problem.

I will help.

Step 1: RTFM [1]
Step 2: STFW [2]
Step 3: Follow the advice Stuart already gave you and speak with a
network tech.
Step 4: Try restarting Apache (if you can), in case the DNS was
changed recently.
Step 5: Re-query the list with more information, if needed, and
don't top-post.
Step 6: If still unresolved, give up. [3]

^1: http://php.net/stream-socket-client
^2: 
http://google.com/search?q=php_network_getaddresses:+getaddrinfo+failed:+No+such+host+is+known
^3: http://asia.cnet.com/i/r/2005/gb/mar/funkey_b1.jpg

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



RE: [PHP] continue working after finishing up with the http client

2009-05-27 Thread bruce
hi tom...

exacly what are you trying to accomplish? is this in a web app? has the user
hit the site, logged in, etc?

can you provide an example of what the sequence of events are that you're
trying to deal with..

thanks


-Original Message-
From: Tom Worster [mailto:f...@thefsb.org]
Sent: Wednesday, May 27, 2009 6:27 AM
To: php-general@lists.php.net
Subject: [PHP] continue working after finishing up with the http client


what options are there to do the following:

1. receive request from client (including post data)

2. do some work, update the db, prepare output for client

3. send output and finish up with the client

4. do some more work that might take considerable time, updating the db some
more

it would be convenient and efficient if step 4 took place within the same
process as steps 1-3. but output control seems not to be sufficient:
ob_flush(); flush(); sends the output but leave the client waiting for more.
is there a way to close the connection as though exit; were called but
without quitting the script?

alternatively the script could start another process, copy over whatever
data is needed and disconnect from it. but that has its overheads on the
server.

are the other possibilities?

tia
tom



--
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



Re: [PHP] PHP scalability problem

2009-05-27 Thread Daniel Brown
On Tue, May 26, 2009 at 23:26, tRace DOliveira  wrote:
> What I am trying to achieve is to have the server do less processing. Like I 
> said PHP is a server side scripting language and each time a request is made 
> a process is spawned and processes are heavy weight as compared to a thread 
> which is a light weight process. So I want to take away much processing away 
> from the server and have the client do it instead. Because if many requests 
> are made the server will eventually go down because it will over the server.I 
> am not trying to get away from PHP but I am trying to solve the problem of 
> scalability

Good God, Leondard, did you just look up every single PHP mailing
list you could find and send the question to all of them at once?
Send questions like this to the General list, and leave it at that
next time.  People will eventually reply, just have patience.

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] continue working after finishing up with the http client

2009-05-27 Thread Tom Worster
On 5/27/09 9:50 AM, "bruce"  wrote:

> exacly what are you trying to accomplish? is this in a web app? has the user
> hit the site, logged in, etc?
> 
> can you provide an example of what the sequence of events are that you're
> trying to deal with..

it is a web app.

let's say for example that we're processing an ajax query. say we can
normally generate and deliver the response to the client quickly but the
speed depends on a cache with a relatively low miss rate.

now, when we get a cache miss, imagine that generating the client response
from scratch takes significantly less time than generating and inserting the
new cache entry corresponding to the query. so we want to send the response
to the client and then process the cache entry.

without getting into whether or not this cache design makes sense, my
question in this example is: what options are there for ending the http
transition and then continuing on to do the cache update work?
 

> -Original Message-
> From: Tom Worster [mailto:f...@thefsb.org]
> Sent: Wednesday, May 27, 2009 6:27 AM
> To: php-general@lists.php.net
> Subject: [PHP] continue working after finishing up with the http client
> 
> 
> what options are there to do the following:
> 
> 1. receive request from client (including post data)
> 
> 2. do some work, update the db, prepare output for client
> 
> 3. send output and finish up with the client
> 
> 4. do some more work that might take considerable time, updating the db some
> more
> 
> it would be convenient and efficient if step 4 took place within the same
> process as steps 1-3. but output control seems not to be sufficient:
> ob_flush(); flush(); sends the output but leave the client waiting for more.
> is there a way to close the connection as though exit; were called but
> without quitting the script?
> 
> alternatively the script could start another process, copy over whatever
> data is needed and disconnect from it. but that has its overheads on the
> server.
> 
> are the other possibilities?



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



[PHP] Facelets for PHP

2009-05-27 Thread David Greenberg
Hi all,
It is very likely that there is already a framework out there somewhere that
does this, and that my searches are just too primitive to find it.  Please
bear with me.

I would like to structure a site where every page is written in pure XHTML.
 In addition to the standard XHTML tag validation, I would like to reference
a tag library that allows custom "components" to be added to a page.  For
instance:

  Input here
  


I would then like to use PHP to translate this into XHTML that can be sent
as an HTTP response.  Moreover, I would like to be able to define custom
components using XHTML pages.  The concept comes from Java Facelets.  The
main point here is that PHP generates a minimal amount of XHTML/JavaScript
for each component, while the pieces are put together by running a PHP
program against a pure XHTML file.

Is there already a framework within PHP to do this, or would it require
custom development?

Certainly the possibly implementations are endless, and something like XSLT
would be a natural step towards one.  I am, however, holding out some hope
that a framework already exists, and that I won't need to worry about this.

Thank you,
David


Re: [PHP] continue working after finishing up with the http client

2009-05-27 Thread David Otton
2009/5/27 Tom Worster :

> without getting into whether or not this cache design makes sense, my
> question in this example is: what options are there for ending the http
> transition and then continuing on to do the cache update work?

You either continue processing then-and-there (exec(), or whatever) or
you put the job in queue to be dealt with at your leisure.

The queue is the better solution if you're concerned about processor
load, as you can prioritise it. The exec() is simpler to implement.

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



Re: [PHP] Facelets for PHP

2009-05-27 Thread David Négrier

Hi David,

I know at least one framework that can do it. It's called Xaja:
 http://www.thecodingmachine.com/ext/xaja/doc/

In fact, it is doing much more than just providing facelets since its main
purpose is to provide reverse ajax features.
It already supports a number of custom tags, and especially, it provides a
wrapping of the ExtJS Javascript library.
You can have a look at the doc here:
 http://www.thecodingmachine.com/ext/xaja/doc/widgets/about_widgets.html

The technique to write additional components still lacks documentation but
if you have a look at the code, it is not that difficult.
And I can provide some help.

I'm sure there must be other frameworks around providing custom tags. Any
one know another one on the list?

Regards,
David.

Disclaimer: I am the main developer of Xaja :)


On Wed, 27 May 2009 10:19:42 -0400, David Greenberg 
wrote:
> Hi all,
> It is very likely that there is already a framework out there somewhere
> that
> does this, and that my searches are just too primitive to find it. 
Please
> bear with me.
> 
> I would like to structure a site where every page is written in pure
XHTML.
>  In addition to the standard XHTML tag validation, I would like to
>  reference
> a tag library that allows custom "components" to be added to a page.  For
> instance:
> 
>   Input here
>   
> 
> 
> I would then like to use PHP to translate this into XHTML that can be
sent
> as an HTTP response.  Moreover, I would like to be able to define custom
> components using XHTML pages.  The concept comes from Java Facelets.  The
> main point here is that PHP generates a minimal amount of
XHTML/JavaScript
> for each component, while the pieces are put together by running a PHP
> program against a pure XHTML file.
> 
> Is there already a framework within PHP to do this, or would it require
> custom development?
> 
> Certainly the possibly implementations are endless, and something like
XSLT
> would be a natural step towards one.  I am, however, holding out some
hope
> that a framework already exists, and that I won't need to worry about
this.
> 
> Thank you,
> David

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



Re: [PHP] PHP scalability problem

2009-05-27 Thread hessiess
> What I am trying to achieve is to have the server do less processing.
> Like I said PHP is a server side scripting language and each time a
> request is made a process is spawned and processes are heavy weight as
> compared to a thread which is a light weight process. So I want to take
> away much processing away from the server and have the client do it
> instead. Because if many requests are made the server will eventually go
> down because it will over the server.I am not trying to get away from
> PHP but I am trying to solve the problem of scalability

You should *NEVER* trust the client with anything remotely important.
A, it creates more of a dependency on the client side software required
to use your application, and B, it has the potential to be a *MASSIVE*
security risk.



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



Re: [PHP] templating engine options

2009-05-27 Thread Andrew Ballard
On Tue, May 26, 2009 at 5:49 PM, Tom Worster  wrote:
> thanks for taking the trouble to write your requirements. it made
> interesting reading.
>
> i've questions on three points below...
>
>
> On 5/25/09 6:44 PM, "Nathan Rixham"  wrote:
>
>> XSL Templates are near perfect, built for the job, and very powerful -
>> but time hasn't favoured them well; and until (if ever) a wide spread
>> adoption happens something else needs to fill the gap.
>
> i don't know xsl well, but from what i read it seems to be about taking data
> from one xml document and putting it into another.

Not really. The most common use may be that, but xsl can convert an
XML document to pretty much any format you want and can even convert
between compatible encodings. (You would lose something to try to
convert from Chinese to Latin1, obviously, but you should be able to
convert from Latin1 to UTF-8 or from UTF-8 to UTF-16 if desired.) It
is even possible to go from XML to PDF. (I haven't tried it, so I
don't know how well it works.)

[snip]
> one thing i wasn't clear about with xsl is whether or not there's any output
> language dependence? could i write a template to produce an sql file, or an
> email in russian?

Exactly. The input XML document and the XSL stylesheet must both be
valid XML, but the output can be just about anything you want.  You
could have an XML table definition and use XSL to translate that
structure into a valid SQL statements using that table in a specific
SQL vendor dialect. Those could be anything as simple as generating
CREATE TABLE statements to build a script to create a database or as
complex as building stored procedures against those tables.

Andrew

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



[PHP] not a shopping cart

2009-05-27 Thread PJ
I am setting up a b2b product site where food professionals can order
unique regional products. For this I have to implement a simple series
of pages that display the products and prices. Using php/mysql/css I
load the products, prices etc. with ease.
I have no use for any shopping carts as that is always encumbered by
huge overhead.
I am wondering what might be the best way to incorporate inputs that can
be dynamically loaded and then calculated and submitted for email
confirmation to client? Perhpas there is some sort of script out there
in freebieLand?
I'd appreciate any suggestions, pointers > or examples.
TIA, Phil

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] not a shopping cart

2009-05-27 Thread Bastien Koert
On Wed, May 27, 2009 at 11:52 AM, PJ  wrote:

> I am setting up a b2b product site where food professionals can order
> unique regional products. For this I have to implement a simple series
> of pages that display the products and prices. Using php/mysql/css I
> load the products, prices etc. with ease.
> I have no use for any shopping carts as that is always encumbered by
> huge overhead.
> I am wondering what might be the best way to incorporate inputs that can
> be dynamically loaded and then calculated and submitted for email
> confirmation to client? Perhpas there is some sort of script out there
> in freebieLand?
> I'd appreciate any suggestions, pointers > or examples.
> TIA, Phil
>
> --
> Hervé Kempf: "Pour sauver la plančte, sortez du capitalisme."
> -
> Phil Jourdan --- p...@ptahhotep.com
>   http://www.ptahhotep.com
>   http://www.chiccantine.com/andypantry.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Get one of the big ones like osCommerce... why redo all the heavy lifting?
-- 

Bastien

Cat, the other other white meat


RE: [PHP] templating engine options

2009-05-27 Thread Andrea Giammarchi

Moreover, you can transform XML into JSON via specific XSLT
True, I forgot to mention it in my post, XSL just transform, and similar 
structures can use the same XSL so another reason to prefer it over php in the 
html.

Regards

> Date: Wed, 27 May 2009 11:47:56 -0400
> From: aball...@gmail.com
> To: f...@thefsb.org
> CC: nrix...@gmail.com; php-general@lists.php.net
> Subject: Re: [PHP] templating engine options
> 
> On Tue, May 26, 2009 at 5:49 PM, Tom Worster  wrote:
> > thanks for taking the trouble to write your requirements. it made
> > interesting reading.
> >
> > i've questions on three points below...
> >
> >
> > On 5/25/09 6:44 PM, "Nathan Rixham"  wrote:
> >
> >> XSL Templates are near perfect, built for the job, and very powerful -
> >> but time hasn't favoured them well; and until (if ever) a wide spread
> >> adoption happens something else needs to fill the gap.
> >
> > i don't know xsl well, but from what i read it seems to be about taking data
> > from one xml document and putting it into another.
> 
> Not really. The most common use may be that, but xsl can convert an
> XML document to pretty much any format you want and can even convert
> between compatible encodings. (You would lose something to try to
> convert from Chinese to Latin1, obviously, but you should be able to
> convert from Latin1 to UTF-8 or from UTF-8 to UTF-16 if desired.) It
> is even possible to go from XML to PDF. (I haven't tried it, so I
> don't know how well it works.)
> 
> [snip]
> > one thing i wasn't clear about with xsl is whether or not there's any output
> > language dependence? could i write a template to produce an sql file, or an
> > email in russian?
> 
> Exactly. The input XML document and the XSL stylesheet must both be
> valid XML, but the output can be just about anything you want.  You
> could have an XML table definition and use XSL to translate that
> structure into a valid SQL statements using that table in a specific
> SQL vendor dialect. Those could be anything as simple as generating
> CREATE TABLE statements to build a script to create a database or as
> complex as building stored procedures against those tables.
> 
> Andrew
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

[PHP] Confirmation email caught by spam filter

2009-05-27 Thread LAMP

hi,
I use the following code (from php.net) to send confirmation email to 
the person that just created an account:


 $headers ="MIME-Versin: 1.0\n" .
"Content-type: text/plain; charset=ISO-8859-1; 
format=flowed\n" .

"Content-Transfer-Encoding: 8bit\n" .
"Reply-To: Orders \n".
"From: Orders \n" .
"X-Mailer: PHP" . phpversion();
   mail($to, $subject, $body, $headers);



$subject is something like "[MyDomain] Your new account", and $body is 
just few plain text details  about person who created the form.


The same code I use to reset a password: a visitor enters his/her email 
address and the link with session ID is sent to entered email address.


The problem is the confirmation emails and "reset password" emails are 
very often caught  by email filter and finish in Spam/Junk folder, or 
even stopped by ISP. What am I doing wrong, or what to do to improve the 
code?


Also, how can I get bounced emails?

Thanks,

Afan



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



RE: [PHP] continue working after finishing up with the http client

2009-05-27 Thread bruce
hi tom...

if i understand your state diagram/workflow process. your server repsonds to
the client request, with two actions...

 action 1) return data to client relatively fast
 action 2) insert the data into your cache (or whereever) which takes
time...

is this correct?

do you have to somehow use the 'new'/updated cache data in the future
actions with the client...

it might be possible for you to have a setup, where you have an external
cron process, or other continually running process that does the cache
insertions



-Original Message-
From: Tom Worster [mailto:f...@thefsb.org]
Sent: Wednesday, May 27, 2009 7:14 AM
To: bruce; php-general@lists.php.net
Subject: Re: [PHP] continue working after finishing up with the http
client


On 5/27/09 9:50 AM, "bruce"  wrote:

> exacly what are you trying to accomplish? is this in a web app? has the
user
> hit the site, logged in, etc?
>
> can you provide an example of what the sequence of events are that you're
> trying to deal with..

it is a web app.

let's say for example that we're processing an ajax query. say we can
normally generate and deliver the response to the client quickly but the
speed depends on a cache with a relatively low miss rate.

now, when we get a cache miss, imagine that generating the client response
from scratch takes significantly less time than generating and inserting the
new cache entry corresponding to the query. so we want to send the response
to the client and then process the cache entry.

without getting into whether or not this cache design makes sense, my
question in this example is: what options are there for ending the http
transition and then continuing on to do the cache update work?


> -Original Message-
> From: Tom Worster [mailto:f...@thefsb.org]
> Sent: Wednesday, May 27, 2009 6:27 AM
> To: php-general@lists.php.net
> Subject: [PHP] continue working after finishing up with the http client
>
>
> what options are there to do the following:
>
> 1. receive request from client (including post data)
>
> 2. do some work, update the db, prepare output for client
>
> 3. send output and finish up with the client
>
> 4. do some more work that might take considerable time, updating the db
some
> more
>
> it would be convenient and efficient if step 4 took place within the same
> process as steps 1-3. but output control seems not to be sufficient:
> ob_flush(); flush(); sends the output but leave the client waiting for
more.
> is there a way to close the connection as though exit; were called but
> without quitting the script?
>
> alternatively the script could start another process, copy over whatever
> data is needed and disconnect from it. but that has its overheads on the
> server.
>
> are the other possibilities?



--
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



Re: [PHP] Confirmation email caught by spam filter

2009-05-27 Thread Andrew Ballard
On Wed, May 27, 2009 at 12:07 PM, LAMP  wrote:
> hi,
> I use the following code (from php.net) to send confirmation email to the
> person that just created an account:
>
>  $headers =    "MIME-Versin: 1.0\n" .
>                "Content-type: text/plain; charset=ISO-8859-1;
> format=flowed\n" .
>                "Content-Transfer-Encoding: 8bit\n" .
>                "Reply-To: Orders \n".
>                "From: Orders \n" .
>                "X-Mailer: PHP" . phpversion();           mail($to, $subject,
> $body, $headers);
>
>
> $subject is something like "[MyDomain] Your new account", and $body is just
> few plain text details  about person who created the form.
>
> The same code I use to reset a password: a visitor enters his/her email
> address and the link with session ID is sent to entered email address.
>
> The problem is the confirmation emails and "reset password" emails are very
> often caught  by email filter and finish in Spam/Junk folder, or even
> stopped by ISP. What am I doing wrong, or what to do to improve the code?
>
> Also, how can I get bounced emails?
>
> Thanks,
>
> Afan
>
>

What mail program is PHP using? Did you check out the
$additional_parameters (5th parameter) for the mail() function? If
you're using sendmail and the envelope from address is
'nob...@mydomain.com', you can pretty much assume they will get dumped
as SPAM regardless of what you set in the From: header.


Andrew

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



[PHP] Displaying images

2009-05-27 Thread Miller, Terion
I am trying to get an image to display but I get nothing if done like this:

   
Scout Photo:

   


  

If I just echo the field I do get the file name


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



Re: [PHP] Confirmation email caught by spam filter

2009-05-27 Thread LAMP

Andrew Ballard wrote:

On Wed, May 27, 2009 at 12:07 PM, LAMP  wrote:
  

hi,
I use the following code (from php.net) to send confirmation email to the
person that just created an account:

 $headers ="MIME-Versin: 1.0\n" .
   "Content-type: text/plain; charset=ISO-8859-1;
format=flowed\n" .
   "Content-Transfer-Encoding: 8bit\n" .
   "Reply-To: Orders \n".
   "From: Orders \n" .
   "X-Mailer: PHP" . phpversion();   mail($to, $subject,
$body, $headers);


$subject is something like "[MyDomain] Your new account", and $body is just
few plain text details  about person who created the form.

The same code I use to reset a password: a visitor enters his/her email
address and the link with session ID is sent to entered email address.

The problem is the confirmation emails and "reset password" emails are very
often caught  by email filter and finish in Spam/Junk folder, or even
stopped by ISP. What am I doing wrong, or what to do to improve the code?

Also, how can I get bounced emails?

Thanks,

Afan





What mail program is PHP using? Did you check out the
$additional_parameters (5th parameter) for the mail() function? If
you're using sendmail and the envelope from address is
'nob...@mydomain.com', you can pretty much assume they will get dumped
as SPAM regardless of what you set in the From: header.


Andrew
  


right. the "5th element" was www...@... (return-path)
I added on the end of the mail() '-ford...@mydomain.com'

Though, where/how can I setup the get bounced emails? Shouldn't bounced 
email be sent to "return-path"? I just sent few emails with non-existing 
email addresses and didn't get anything back?





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



Re: [PHP] not a shopping cart

2009-05-27 Thread PJ
I was afraid I would get this kind of reaction, but it is not what I
want or need.
As I mentioned, all these shopping carts are overbloated for the kind of
application I am creating.
I do not need all the heavy baggage that come with them. I have looked
at them, played with them some years back even and never liked them.
What I am looking for is something simple that can be used on one page
and that, at the most will give me a final page summarizing the choices
that have been made in several other pages and then totaling and sending
the results to the client. No shopping cart, no frills, no chills, just
a confirmation of the order.
Let's not forget that a b2b client has no time for all the pretty lace
and candy wrap. He/She makes a quick choice, clicks on
submit/do-it/or/confirm button and goes back to whipping his crew (in
the kitchen, I suppose). I rather suspect that I will have to drum this
little thing up by myself.
To explain the procedure for client:
1. Click on navigation choice among categories
2. Pages loaded from db (may be several for each category)
3. Select quantity from input boxes (box is either empty or has number
entered - this is stored somewhere)
4. Do the same for other pages...
5. When finished, click the finish/submit or whatever button. Go back to
work.
6. Back-end tallies the selections adds them enters choices in db and
send confirmation to client and to company to  fill order.
7. Post-back-end is up to the company to fill and deliver. Payment is
taken care of by company processing credit card and then delivering goodies.
That's about as simple as it can get. No shipping complications, no
credit complications. Just click and go.
All the unnecessary overhead is eliminated by first time registration
and credit check with confirmed username and password. Otherwise, baby,
you don't get nothing from this site. Public access and frills are not
on the product pages unless we ever go that way in the future.
Believe me, it works... we've done it before and were years ahead of
everybody...until 9/11... blew us off because they blew away some of our
clients and their clients as we... and then we had someone fresh meat
nerds coding and they rather stumbled over their own heels in the
programming, but that's another story.

Thanks, anyway.

Bastien Koert wrote:
>
>
> On Wed, May 27, 2009 at 11:52 AM, PJ  > wrote:
>
> I am setting up a b2b product site where food professionals can order
> unique regional products. For this I have to implement a simple series
> of pages that display the products and prices. Using php/mysql/css I
> load the products, prices etc. with ease.
> I have no use for any shopping carts as that is always encumbered by
> huge overhead.
> I am wondering what might be the best way to incorporate inputs
> that can
> be dynamically loaded and then calculated and submitted for email
> confirmation to client? Perhpas there is some sort of script out there
> in freebieLand?
> I'd appreciate any suggestions, pointers > or examples.
> TIA, Phil
>
> --
> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> -
> Phil Jourdan --- p...@ptahhotep.com 
>   http://www.ptahhotep.com
>   http://www.chiccantine.com/andypantry.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> Get one of the big ones like osCommerce... why redo all the heavy lifting?
> -- 
>
> Bastien
>
> Cat, the other other white meat


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Confirmation email caught by spam filter

2009-05-27 Thread Per Jessen
LAMP wrote:

> The problem is the confirmation emails and "reset password" emails are
> very often caught  by email filter and finish in Spam/Junk folder, or
> even stopped by ISP. What am I doing wrong, or what to do to improve
> the code?

You need to look at where you are sending the email from, and how that
mailserver is configured.  The email content of a non-spam email is
hardly ever enough to get it classified as spam.

> Also, how can I get bounced emails?

Put in the correct envelope address.  Use the '-r' option.


/Per

-- 
Per Jessen, Zürich (19.3°C)


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



[PHP] Re: Displaying images

2009-05-27 Thread Shawn McKenzie
Miller, Terion wrote:
> I am trying to get an image to display but I get nothing if done like this:
> 
>
> Scout Photo:
> 
>
> 
> 
>   
> 
> If I just echo the field I do get the file name
> 

Does the filename include the path?  Does the image with said filename
actually exist in that path?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Confirmation email caught by spam filter

2009-05-27 Thread Bastien Koert
On Wed, May 27, 2009 at 1:44 PM, Per Jessen  wrote:

> LAMP wrote:
>
> > The problem is the confirmation emails and "reset password" emails are
> > very often caught  by email filter and finish in Spam/Junk folder, or
> > even stopped by ISP. What am I doing wrong, or what to do to improve
> > the code?
>
> You need to look at where you are sending the email from, and how that
> mailserver is configured.  The email content of a non-spam email is
> hardly ever enough to get it classified as spam.
>
> > Also, how can I get bounced emails?
>
> Put in the correct envelope address.  Use the '-r' option.
>
>
> /Per
>
> --
> Per Jessen, Zürich (19.3°C)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
This areticle has a nice description of handling bounces

http://forums.theplanet.com/index.php?showtopic=89873&mode=threaded



-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: Displaying images

2009-05-27 Thread Bastien Koert
On Wed, May 27, 2009 at 1:46 PM, Shawn McKenzie wrote:

> Miller, Terion wrote:
> > I am trying to get an image to display but I get nothing if done like
> this:
> >
> >
> > Scout Photo:
> >
> >
> >
> > 
> >
> >
> > If I just echo the field I do get the file name
> >
>
> Does the filename include the path?  Does the image with said filename
> actually exist in that path?
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Is it an image from the db or a path to an image on the filesystem?

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: Displaying images

2009-05-27 Thread Miller, Terion



On 5/27/09 12:49 PM, "Bastien Koert"  wrote:

On Wed, May 27, 2009 at 1:46 PM, Shawn McKenzie wrote:

> Miller, Terion wrote:
> > I am trying to get an image to display but I get nothing if done like
> this:
> >
> >
> > Scout Photo:
> >
> >
> >
> > 
> >
> >
> > If I just echo the field I do get the file name
> >
>
> Does the filename include the path?  Does the image with said filename
> actually exist in that path?
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Is it an image from the db or a path to an image on the filesystem?

--

Bastien

Cat, the other other white meat


Hi Bastien it is an image in the db.
Thanks
Terion

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



Re: [PHP] not a shopping cart

2009-05-27 Thread Bastien Koert
On Wed, May 27, 2009 at 1:39 PM, PJ  wrote:

> I was afraid I would get this kind of reaction, but it is not what I
> want or need.
> As I mentioned, all these shopping carts are overbloated for the kind of
> application I am creating.
> I do not need all the heavy baggage that come with them. I have looked
> at them, played with them some years back even and never liked them.
> What I am looking for is something simple that can be used on one page
> and that, at the most will give me a final page summarizing the choices
> that have been made in several other pages and then totaling and sending
> the results to the client. No shopping cart, no frills, no chills, just
> a confirmation of the order.
> Let's not forget that a b2b client has no time for all the pretty lace
> and candy wrap. He/She makes a quick choice, clicks on
> submit/do-it/or/confirm button and goes back to whipping his crew (in
> the kitchen, I suppose). I rather suspect that I will have to drum this
> little thing up by myself.
> To explain the procedure for client:
> 1. Click on navigation choice among categories
> 2. Pages loaded from db (may be several for each category)
> 3. Select quantity from input boxes (box is either empty or has number
> entered - this is stored somewhere)
> 4. Do the same for other pages...
> 5. When finished, click the finish/submit or whatever button. Go back to
> work.
> 6. Back-end tallies the selections adds them enters choices in db and
> send confirmation to client and to company to  fill order.
> 7. Post-back-end is up to the company to fill and deliver. Payment is
> taken care of by company processing credit card and then delivering
> goodies.
> That's about as simple as it can get. No shipping complications, no
> credit complications. Just click and go.
> All the unnecessary overhead is eliminated by first time registration
> and credit check with confirmed username and password. Otherwise, baby,
> you don't get nothing from this site. Public access and frills are not
> on the product pages unless we ever go that way in the future.
> Believe me, it works... we've done it before and were years ahead of
> everybody...until 9/11... blew us off because they blew away some of our
> clients and their clients as we... and then we had someone fresh meat
> nerds coding and they rather stumbled over their own heels in the
> programming, but that's another story.
>
> Thanks, anyway.
>
> Bastien Koert wrote:
> >
> >
> > On Wed, May 27, 2009 at 11:52 AM, PJ  > > wrote:
> >
> > I am setting up a b2b product site where food professionals can order
> > unique regional products. For this I have to implement a simple
> series
> > of pages that display the products and prices. Using php/mysql/css I
> > load the products, prices etc. with ease.
> > I have no use for any shopping carts as that is always encumbered by
> > huge overhead.
> > I am wondering what might be the best way to incorporate inputs
> > that can
> > be dynamically loaded and then calculated and submitted for email
> > confirmation to client? Perhpas there is some sort of script out
> there
> > in freebieLand?
> > I'd appreciate any suggestions, pointers > or examples.
> > TIA, Phil
> >
> > --
> > Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> > -
> > Phil Jourdan --- p...@ptahhotep.com 
> >   http://www.ptahhotep.com
> >   http://www.chiccantine.com/andypantry.php
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> > Get one of the big ones like osCommerce... why redo all the heavy
> lifting?
> > --
> >
> > Bastien
> >
> > Cat, the other other white meat
>
>
> --
> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> -
> Phil Jourdan --- p...@ptahhotep.com
>   http://www.ptahhotep.com
>   http://www.chiccantine.com/andypantry.php
>
>
PJ, don't get on your high horse...

the first post had very little detail as to what you really wanted, which
you explained much better in the second post. Its the question that is as
important, if not more so than the answer.

I too have coded similar sites and carts, but I found it easier to code my
own...its older code now and not something that would stand well to the test
of time.

If I were to do this again, I would implement an ajax scheme to load the
cart, have a view/edit cart page, a cc processing page and a confirmation of
payment / email confirmation page.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: Displaying images

2009-05-27 Thread Bastien Koert
On Wed, May 27, 2009 at 1:51 PM, Miller, Terion <
tmil...@springfi.gannett.com> wrote:

>
>
>
> On 5/27/09 12:49 PM, "Bastien Koert"  wrote:
>
> On Wed, May 27, 2009 at 1:46 PM, Shawn McKenzie  >wrote:
>
> > Miller, Terion wrote:
> > > I am trying to get an image to display but I get nothing if done like
> > this:
> > >
> > >
> > > Scout Photo:
> > >
> > >
> > >
> > > 
> > >
> > >
> > > If I just echo the field I do get the file name
> > >
> >
> > Does the filename include the path?  Does the image with said filename
> > actually exist in that path?
> >
> > --
> > Thanks!
> > -Shawn
> > http://www.spidean.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> Is it an image from the db or a path to an image on the filesystem?
>
> --
>
> Bastien
>
> Cat, the other other white meat
>
>
> Hi Bastien it is an image in the db.
> Thanks
> Terion
>

You can't display the image that way due to differeing headers in required
for html and images. Change your image code to call a page that specializes
in handling the images and the headers needed by changing to something like
this:

echo "\n";

where the show_image page calls the image out from the db and display it as
below


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: Displaying images

2009-05-27 Thread Shawn McKenzie


Miller, Terion wrote:
>
>
>
> Does the filename include the path?  Does the image with said filename
> actually exist in that path?
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> Hmm guess I am confused because the image is being stored in the db.
> So I thought I could call it like any other field data.
>
> Thanks
> Terion
>
>   
Please reply all.

The img tag is used to tell the browser where the image is located, it
then loads the image.  If you have the binary image data in the DB then
you probably need to have a PHP file with a get var as the img src and
then have that PHP file actually output the image data:




//image.php
header("Content-type: img/jpeg");
$filename = $_GET['filename'];
//do your SQL select and fetch using filename or whatnot to get the
image data, I assume from 'ePhoto'
echo $row['ePhoto'];

Thanks!
-Shawn

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



Re: [PHP] continue working after finishing up with the http client

2009-05-27 Thread Tom Worster
On 5/27/09 12:35 PM, "bruce"  wrote:

> hi tom...
> 
> if i understand your state diagram/workflow process. your server repsonds to
> the client request, with two actions...
> 
>  action 1) return data to client relatively fast
>  action 2) insert the data into your cache (or whereever) which takes
> time...
> 
> is this correct?

sure. but it was just an example of use of such an output and connection
control technique.


> do you have to somehow use the 'new'/updated cache data in the future
> actions with the client...

this was part of the example, yes. but another example could be that you
process a web client's html form request, then send the client its response,
close the client connection and then proceed with a whole bunch of complex
logging of what was done.


> it might be possible for you to have a setup, where you have an external
> cron process, or other continually running process that does the cache
> insertions

yes. this is one of the proposals david otton made, both of which are
reasonable but do not enjoy the convenience or efficiency of doing the "end
work" (e.g. the cache insertion) in the same process and memory space as the
script that did the "front work" (e.g. processed the cache miss and sent the
ajax response). doing the "end work" in a separate process comes with the
overhead of serializing and communicating data to the other process.

i found a web page suggesting that you can get a client to close the
connection if you set ignore_user_abort(), then send Connection: close and
Content-Length: <#octets> headers, then send the response followed by
ob_flush and flush. can't say i'm in love with this.

http://waynepan.com/2007/10/11/how-to-use-ignore_user_abort-to-do-process-ou
t-of-band/




> -Original Message-
> From: Tom Worster [mailto:f...@thefsb.org]
> Sent: Wednesday, May 27, 2009 7:14 AM
> To: bruce; php-general@lists.php.net
> Subject: Re: [PHP] continue working after finishing up with the http
> client
> 
> 
> On 5/27/09 9:50 AM, "bruce"  wrote:
> 
>> exacly what are you trying to accomplish? is this in a web app? has the
> user
>> hit the site, logged in, etc?
>> 
>> can you provide an example of what the sequence of events are that you're
>> trying to deal with..
> 
> it is a web app.
> 
> let's say for example that we're processing an ajax query. say we can
> normally generate and deliver the response to the client quickly but the
> speed depends on a cache with a relatively low miss rate.
> 
> now, when we get a cache miss, imagine that generating the client response
> from scratch takes significantly less time than generating and inserting the
> new cache entry corresponding to the query. so we want to send the response
> to the client and then process the cache entry.
> 
> without getting into whether or not this cache design makes sense, my
> question in this example is: what options are there for ending the http
> transition and then continuing on to do the cache update work?
> 
> 
>> -Original Message-
>> From: Tom Worster [mailto:f...@thefsb.org]
>> Sent: Wednesday, May 27, 2009 6:27 AM
>> To: php-general@lists.php.net
>> Subject: [PHP] continue working after finishing up with the http client
>> 
>> 
>> what options are there to do the following:
>> 
>> 1. receive request from client (including post data)
>> 
>> 2. do some work, update the db, prepare output for client
>> 
>> 3. send output and finish up with the client
>> 
>> 4. do some more work that might take considerable time, updating the db
> some
>> more
>> 
>> it would be convenient and efficient if step 4 took place within the same
>> process as steps 1-3. but output control seems not to be sufficient:
>> ob_flush(); flush(); sends the output but leave the client waiting for
> more.
>> is there a way to close the connection as though exit; were called but
>> without quitting the script?
>> 
>> alternatively the script could start another process, copy over whatever
>> data is needed and disconnect from it. but that has its overheads on the
>> server.
>> 
>> are the other possibilities?
> 
> 
> 
> --
> 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



Re: [PHP] continue working after finishing up with the http client

2009-05-27 Thread Tom Worster
On 5/27/09 10:33 AM, "David Otton"  wrote:

> 2009/5/27 Tom Worster :
> 
>> without getting into whether or not this cache design makes sense, my
>> question in this example is: what options are there for ending the http
>> transition and then continuing on to do the cache update work?
> 
> You either continue processing then-and-there (exec(), or whatever) or
> you put the job in queue to be dealt with at your leisure.
> 
> The queue is the better solution if you're concerned about processor
> load, as you can prioritise it. The exec() is simpler to implement.

in the absence of a tidy way to close the http connection to the client in
mid-php script, i think the queue will be my better bet. if i use mysql to
implement the queue then i'll have some convenient options for handling it. 



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



Re: [PHP] PHP ping and exec() hangs apache

2009-05-27 Thread Ashley Sheridan
On Wed, 2009-05-27 at 10:25 +0200, Kamil Walas wrote:
> Hi,
> 
> I stuck with strange error. I have following code:
>   echo 'BEFORE';
>  echo exec("ping -c1 -w1 1.1.25.38");
>  echo 'AFTER';
> ?>
> 
> Address doesn't exist. When execute script from command line everything 
> works fine. But when I go to the file by Firefox it hangs out and apache 
> need to be restart. This is a Virtual Server with PHP Version 
> 5.2.6-pl222-gentoo. When address exists it works fine. Only problem is 
> when it doesn't respond and apache hangs.
> 
> I copy file to apache at my local apache and everything works fine. My 
> apache is with Version 5.3.0alpha3-dev at windows XP.
> 
> At old server with php4 everything works fine.
> 
> I suspect that something wrong is with apache configuration but I don't 
> know it for sure and couldn't find it.
> 
> Thank you,
> Kamil Walas
> 
Are you sure it's crashed and is not just waiting for a reply from the
remote server. How long do you leave it running before you assume it's
crashed? I see it's set for a 1millisecond wait response, but what is
the -c1 flag, as I'm not familiar with all the flags of a Windows ping,
and a quick Google didn't reveal it.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Confirmation email caught by spam filter

2009-05-27 Thread Tom Worster
On 5/27/09 12:07 PM, "LAMP"  wrote:

> The problem is the confirmation emails and "reset password" emails are
> very often caught  by email filter and finish in Spam/Junk folder, or
> even stopped by ISP. What am I doing wrong, or what to do to improve the
> code?

i've run into this. among many factors that can be involved, the sending
smtp server needs to be in address block that isn't black listed anywhere,
e.g. don't try sending from a comcast address.

also, you server needs to handle greylisting.

it may help to set an spf record.

in one instance i ended up using a well known mail hosting provider and
sending the mail to their smtp server with authenticated smtp over ssl,
which can be done quite easily with pear mail. i.e. pay the hosting company
to worry about getting the emails through.



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



Re: [PHP] getting file location

2009-05-27 Thread Ashley Sheridan
On Wed, 2009-05-27 at 13:03 +0200, Grega Leskovsek wrote:
> I have made a CMS with editing files. When I display the file name it
> shows something like "../subdir/filename.php"
> How can I display the actual filename that's on the web: like
> http://localhost/subdir/filename.php or even better if it is possible:
> http://domainname/subdir/filename.php ?
> 
> Thanks in advance, Grega from Slovenia
> 
> -- 
> When the sun rises I receive and when it sets I forgive ->
> http://users.skavt.net/~gleskovs/
> All the Love, Grega Leskov'sek
> 
I assume the file in question is not the one actually running the
script?

You could trim the periods from the filename string, and then attach the
domain prefix:

$prefix = 'http://domainname.com/';
$full_url = $prefix . trim($filename, '.');

Also, a word of warning. You shouldn't really let *anybody* edit a page
in such a way that they can insert their own PHP into a page. It's a
security risk, and should really be avoided if you can at all help it,
even if only for a single user. If you must let them enter simple PHP,
have you thought instead of having them enter something else (like
template-style commands) that can be checked and interpreted by your PHP
code, e.g. they enter this:

%%navbar%% 

and it's replaced by your navbar code. That way, anything your code does
not recognise, is not able to cause any gaping security holes on your
server.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Confirmation email caught by spam filter

2009-05-27 Thread Ashley Sheridan
On Wed, 2009-05-27 at 14:41 -0400, Tom Worster wrote:
> On 5/27/09 12:07 PM, "LAMP"  wrote:
> 
> > The problem is the confirmation emails and "reset password" emails are
> > very often caught  by email filter and finish in Spam/Junk folder, or
> > even stopped by ISP. What am I doing wrong, or what to do to improve the
> > code?
> 
> i've run into this. among many factors that can be involved, the sending
> smtp server needs to be in address block that isn't black listed anywhere,
> e.g. don't try sending from a comcast address.
> 
> also, you server needs to handle greylisting.
> 
> it may help to set an spf record.
> 
> in one instance i ended up using a well known mail hosting provider and
> sending the mail to their smtp server with authenticated smtp over ssl,
> which can be done quite easily with pear mail. i.e. pay the hosting company
> to worry about getting the emails through.
> 
> 
> 
I've also seen this happen where the address that the mail was sent from
is different from the MX record for the domain the email says it is sent
from. The only way round this is to have the MX and A records point to
the same server.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: Displaying images

2009-05-27 Thread Ashley Sheridan
On Wed, 2009-05-27 at 14:03 -0400, Bastien Koert wrote:
> On Wed, May 27, 2009 at 1:51 PM, Miller, Terion <
> tmil...@springfi.gannett.com> wrote:
> 
> >
> >
> >
> > On 5/27/09 12:49 PM, "Bastien Koert"  wrote:
> >
> > On Wed, May 27, 2009 at 1:46 PM, Shawn McKenzie  > >wrote:
> >
> > > Miller, Terion wrote:
> > > > I am trying to get an image to display but I get nothing if done like
> > > this:
> > > >
> > > >
> > > > Scout Photo:
> > > >
> > > >
> > > >
> > > > 
> > > >
> > > >
> > > > If I just echo the field I do get the file name
> > > >
> > >
> > > Does the filename include the path?  Does the image with said filename
> > > actually exist in that path?
> > >
> > > --
> > > Thanks!
> > > -Shawn
> > > http://www.spidean.com
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > Is it an image from the db or a path to an image on the filesystem?
> >
> > --
> >
> > Bastien
> >
> > Cat, the other other white meat
> >
> >
> > Hi Bastien it is an image in the db.
> > Thanks
> > Terion
> >
> 
> You can't display the image that way due to differeing headers in required
> for html and images. Change your image code to call a page that specializes
> in handling the images and the headers needed by changing to something like
> this:
> 
> echo "\n";
> 
> where the show_image page calls the image out from the db and display it as
> below
> 
>  require("conn.php");
> //check to see if the id is passed
> if(isset($_GET['id'])) {
> $id=$_GET['id'];
> 
> //query the database to get the image and the filetype
> $query = "select bin_data, filetype from binary_data where id=$id";
> 
> $result = mysql_query($query);
> $row = mysql_fetch_array($result);
>   {
>$data = $row['bin_data'];
>$type = $row['filetype'];
>   }
>   if ($type=="pjpeg") $type = "jpeg";   //handle the ms jpeg alternate
> format
>   Header( "Content-type: $type");
>   echo $data;
> }
> ?>
That's only true if the image is stored in the database as a BLOB or
somesuch. If the database is just storing the filename of the image,
then it may just need the correct directory path prefix. Go into your
browser, right-click and check to see what path and filename the browser
expects to find the image file. My guess is it's not the same as where
the image actually is, and you need to add the path before opening the
http://domain) or a relative one, and relative paths can include the ../
directory if you need to move up the directory tree.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] not a shopping cart

2009-05-27 Thread Shawn McKenzie
PJ wrote:
> I was afraid I would get this kind of reaction, but it is not what I
> want or need.
> As I mentioned, all these shopping carts are overbloated for the kind of
> application I am creating.
> I do not need all the heavy baggage that come with them. I have looked
> at them, played with them some years back even and never liked them.
> What I am looking for is something simple that can be used on one page
> and that, at the most will give me a final page summarizing the choices
> that have been made in several other pages and then totaling and sending
> the results to the client. No shopping cart, no frills, no chills, just
> a confirmation of the order.
> Let's not forget that a b2b client has no time for all the pretty lace
> and candy wrap. He/She makes a quick choice, clicks on
> submit/do-it/or/confirm button and goes back to whipping his crew (in
> the kitchen, I suppose). I rather suspect that I will have to drum this
> little thing up by myself.
> To explain the procedure for client:
> 1. Click on navigation choice among categories
> 2. Pages loaded from db (may be several for each category)
> 3. Select quantity from input boxes (box is either empty or has number
> entered - this is stored somewhere)
> 4. Do the same for other pages...
> 5. When finished, click the finish/submit or whatever button. Go back to
> work.
> 6. Back-end tallies the selections adds them enters choices in db and
> send confirmation to client and to company to  fill order.
> 7. Post-back-end is up to the company to fill and deliver. Payment is
> taken care of by company processing credit card and then delivering goodies.
> That's about as simple as it can get. No shipping complications, no
> credit complications. Just click and go.
> All the unnecessary overhead is eliminated by first time registration
> and credit check with confirmed username and password. Otherwise, baby,
> you don't get nothing from this site. Public access and frills are not
> on the product pages unless we ever go that way in the future.
> Believe me, it works... we've done it before and were years ahead of
> everybody...until 9/11... blew us off because they blew away some of our
> clients and their clients as we... and then we had someone fresh meat
> nerds coding and they rather stumbled over their own heels in the
> programming, but that's another story.
> 
> Thanks, anyway.
> 
> Bastien Koert wrote:
>>
>> On Wed, May 27, 2009 at 11:52 AM, PJ > > wrote:
>>
>> I am setting up a b2b product site where food professionals can order
>> unique regional products. For this I have to implement a simple series
>> of pages that display the products and prices. Using php/mysql/css I
>> load the products, prices etc. with ease.
>> I have no use for any shopping carts as that is always encumbered by
>> huge overhead.
>> I am wondering what might be the best way to incorporate inputs
>> that can
>> be dynamically loaded and then calculated and submitted for email
>> confirmation to client? Perhpas there is some sort of script out there
>> in freebieLand?
>> I'd appreciate any suggestions, pointers > or examples.
>> TIA, Phil
>>
>> --
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com 
>>   http://www.ptahhotep.com
>>   http://www.chiccantine.com/andypantry.php
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>> Get one of the big ones like osCommerce... why redo all the heavy lifting?
>> -- 
>>
>> Bastien
>>
>> Cat, the other other white meat
> 
> 

Since this is a system where people won't actually pay you, and you
aren't fulfilling the orders, it should be fairly simple.  The carts
that I have seen are normally more bloated as you have stated, though
there are some that are just a "cart" where you select products. These
normally include the shipping, tax, and then payment logic for
paypal/google, etc. though.  I haven't used any, but this looked cool:
http://www.dragdropcart.com/ but it's $30.  And here is the first
tutorial I found on a search:
http://www.devarticles.com/c/a/MySQL/Building-A-Persistent-Shopping-Cart-With-PHP-and-MySQL/

Based on many of your other posts, you've already done everything that
is needed here with the possible exception of the email.  Here is the
basics of the user interface, however you need to think about the admin
interface to add products, etc.

1. login user/start session
2. query db for categories and list them
3. when user clicks on a category, query db and list all products in
that category
4. each product has a text field where the name is the product id and
the value is the quantity that is entered by the user
5. when the user clicks submit, you add the post vars to the se

[PHP] Re: continue working after finishing up with the http client

2009-05-27 Thread Carsten Wiedmann
Tom Worster schrieb:
> what options are there to do the following:
> 
> 1. receive request from client (including post data)
> 
> 2. do some work, update the db, prepare output for client
> 
> 3. send output and finish up with the client
> 
> 4. do some more work that might take considerable time, updating the db some
> more

| 

Regards,
Carsten


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



Re: [PHP] Re: Displaying images

2009-05-27 Thread Bastien Koert
On Wed, May 27, 2009 at 3:05 PM, Ashley Sheridan
wrote:

> On Wed, 2009-05-27 at 14:03 -0400, Bastien Koert wrote:
> > On Wed, May 27, 2009 at 1:51 PM, Miller, Terion <
> > tmil...@springfi.gannett.com> wrote:
> >
> > >
> > >
> > >
> > > On 5/27/09 12:49 PM, "Bastien Koert"  wrote:
> > >
> > > On Wed, May 27, 2009 at 1:46 PM, Shawn McKenzie  > > >wrote:
> > >
> > > > Miller, Terion wrote:
> > > > > I am trying to get an image to display but I get nothing if done
> like
> > > > this:
> > > > >
> > > > >
> > > > > Scout Photo:
> > > > >
> > > > >
> > > > >
> > > > > 
> > > > >
> > > > >
> > > > > If I just echo the field I do get the file name
> > > > >
> > > >
> > > > Does the filename include the path?  Does the image with said
> filename
> > > > actually exist in that path?
> > > >
> > > > --
> > > > Thanks!
> > > > -Shawn
> > > > http://www.spidean.com
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > > Is it an image from the db or a path to an image on the filesystem?
> > >
> > > --
> > >
> > > Bastien
> > >
> > > Cat, the other other white meat
> > >
> > >
> > > Hi Bastien it is an image in the db.
> > > Thanks
> > > Terion
> > >
> >
> > You can't display the image that way due to differeing headers in
> required
> > for html and images. Change your image code to call a page that
> specializes
> > in handling the images and the headers needed by changing to something
> like
> > this:
> >
> > echo "\n";
> >
> > where the show_image page calls the image out from the db and display it
> as
> > below
> >
> >  > require("conn.php");
> > //check to see if the id is passed
> > if(isset($_GET['id'])) {
> > $id=$_GET['id'];
> >
> > //query the database to get the image and the filetype
> > $query = "select bin_data, filetype from binary_data where id=$id";
> >
> > $result = mysql_query($query);
> > $row = mysql_fetch_array($result);
> >   {
> >$data = $row['bin_data'];
> >$type = $row['filetype'];
> >   }
> >   if ($type=="pjpeg") $type = "jpeg";   //handle the ms jpeg
> alternate
> > format
> >   Header( "Content-type: $type");
> >   echo $data;
> > }
> > ?>
> That's only true if the image is stored in the database as a BLOB or
> somesuch. If the database is just storing the filename of the image,
> then it may just need the correct directory path prefix. Go into your
> browser, right-click and check to see what path and filename the browser
> expects to find the image file. My guess is it's not the same as where
> the image actually is, and you need to add the path before opening the
>  http://domain) or a relative one, and relative paths can include the ../
> directory if you need to move up the directory tree.
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
Terion stated it was in the db

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: Displaying images

2009-05-27 Thread Ashley Sheridan
On Wed, 2009-05-27 at 15:14 -0400, Bastien Koert wrote:
> On Wed, May 27, 2009 at 3:05 PM, Ashley Sheridan
> wrote:
> 
> > On Wed, 2009-05-27 at 14:03 -0400, Bastien Koert wrote:
> > > On Wed, May 27, 2009 at 1:51 PM, Miller, Terion <
> > > tmil...@springfi.gannett.com> wrote:
> > >
> > > >
> > > >
> > > >
> > > > On 5/27/09 12:49 PM, "Bastien Koert"  wrote:
> > > >
> > > > On Wed, May 27, 2009 at 1:46 PM, Shawn McKenzie  > > > >wrote:
> > > >
> > > > > Miller, Terion wrote:
> > > > > > I am trying to get an image to display but I get nothing if done
> > like
> > > > > this:
> > > > > >
> > > > > >
> > > > > > Scout Photo:
> > > > > >
> > > > > >
> > > > > >
> > > > > > 
> > > > > >
> > > > > >
> > > > > > If I just echo the field I do get the file name
> > > > > >
> > > > >
> > > > > Does the filename include the path?  Does the image with said
> > filename
> > > > > actually exist in that path?
> > > > >
> > > > > --
> > > > > Thanks!
> > > > > -Shawn
> > > > > http://www.spidean.com
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > >
> > > > Is it an image from the db or a path to an image on the filesystem?
> > > >
> > > > --
> > > >
> > > > Bastien
> > > >
> > > > Cat, the other other white meat
> > > >
> > > >
> > > > Hi Bastien it is an image in the db.
> > > > Thanks
> > > > Terion
> > > >
> > >
> > > You can't display the image that way due to differeing headers in
> > required
> > > for html and images. Change your image code to call a page that
> > specializes
> > > in handling the images and the headers needed by changing to something
> > like
> > > this:
> > >
> > > echo "\n";
> > >
> > > where the show_image page calls the image out from the db and display it
> > as
> > > below
> > >
> > >  > > require("conn.php");
> > > //check to see if the id is passed
> > > if(isset($_GET['id'])) {
> > > $id=$_GET['id'];
> > >
> > > //query the database to get the image and the filetype
> > > $query = "select bin_data, filetype from binary_data where id=$id";
> > >
> > > $result = mysql_query($query);
> > > $row = mysql_fetch_array($result);
> > >   {
> > >$data = $row['bin_data'];
> > >$type = $row['filetype'];
> > >   }
> > >   if ($type=="pjpeg") $type = "jpeg";   //handle the ms jpeg
> > alternate
> > > format
> > >   Header( "Content-type: $type");
> > >   echo $data;
> > > }
> > > ?>
> > That's only true if the image is stored in the database as a BLOB or
> > somesuch. If the database is just storing the filename of the image,
> > then it may just need the correct directory path prefix. Go into your
> > browser, right-click and check to see what path and filename the browser
> > expects to find the image file. My guess is it's not the same as where
> > the image actually is, and you need to add the path before opening the
> >  > http://domain) or a relative one, and relative paths can include the ../
> > directory if you need to move up the directory tree.
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> Terion stated it was in the db
> 
The thread didn't follow on properly, my email client wasn't able to
join t by thread so I didn't see his message until after I'd replied,
sorry!


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Displaying images

2009-05-27 Thread Michael A. Peters

Miller, Terion wrote:

I am trying to get an image to display but I get nothing if done like this:

   
Scout Photo:

   


  


If I just echo the field I do get the file name





Do you get the just the file name or the full path to the image on the 
server?


If, say, the image is at /images/jamboree/whatever.jpg but 
$row['ePhoto'] only produces whatever.jpg, try:




   Scout Photo:
   



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



Re: [PHP] not a shopping cart

2009-05-27 Thread PJ
Bastien Koert wrote:
>
>
> On Wed, May 27, 2009 at 1:39 PM, PJ  > wrote:
>
> I was afraid I would get this kind of reaction, but it is not what I
> want or need.
> As I mentioned, all these shopping carts are overbloated for the
> kind of
> application I am creating.
> I do not need all the heavy baggage that come with them. I have looked
> at them, played with them some years back even and never liked them.
> What I am looking for is something simple that can be used on one page
> and that, at the most will give me a final page summarizing the
> choices
> that have been made in several other pages and then totaling and
> sending
> the results to the client. No shopping cart, no frills, no chills,
> just
> a confirmation of the order.
> Let's not forget that a b2b client has no time for all the pretty lace
> and candy wrap. He/She makes a quick choice, clicks on
> submit/do-it/or/confirm button and goes back to whipping his crew (in
> the kitchen, I suppose). I rather suspect that I will have to drum
> this
> little thing up by myself.
> To explain the procedure for client:
> 1. Click on navigation choice among categories
> 2. Pages loaded from db (may be several for each category)
> 3. Select quantity from input boxes (box is either empty or has number
> entered - this is stored somewhere)
> 4. Do the same for other pages...
> 5. When finished, click the finish/submit or whatever button. Go
> back to
> work.
> 6. Back-end tallies the selections adds them enters choices in db and
> send confirmation to client and to company to  fill order.
> 7. Post-back-end is up to the company to fill and deliver. Payment is
> taken care of by company processing credit card and then
> delivering goodies.
> That's about as simple as it can get. No shipping complications, no
> credit complications. Just click and go.
> All the unnecessary overhead is eliminated by first time registration
> and credit check with confirmed username and password. Otherwise,
> baby,
> you don't get nothing from this site. Public access and frills are not
> on the product pages unless we ever go that way in the future.
> Believe me, it works... we've done it before and were years ahead of
> everybody...until 9/11... blew us off because they blew away some
> of our
> clients and their clients as we... and then we had someone fresh meat
> nerds coding and they rather stumbled over their own heels in the
> programming, but that's another story.
>
> Thanks, anyway.
>
> Bastien Koert wrote:
> >
> >
> > On Wed, May 27, 2009 at 11:52 AM, PJ  
> >  >> wrote:
> >
> > I am setting up a b2b product site where food professionals
> can order
> > unique regional products. For this I have to implement a
> simple series
> > of pages that display the products and prices. Using
> php/mysql/css I
> > load the products, prices etc. with ease.
> > I have no use for any shopping carts as that is always
> encumbered by
> > huge overhead.
> > I am wondering what might be the best way to incorporate inputs
> > that can
> > be dynamically loaded and then calculated and submitted for
> email
> > confirmation to client? Perhpas there is some sort of script
> out there
> > in freebieLand?
> > I'd appreciate any suggestions, pointers > or examples.
> > TIA, Phil
> >
> > --
> > Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> > -
> > Phil Jourdan --- p...@ptahhotep.com 
> >
> >   http://www.ptahhotep.com
> >   http://www.chiccantine.com/andypantry.php
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> > Get one of the big ones like osCommerce... why redo all the
> heavy lifting?
> > --
> >
> > Bastien
> >
> > Cat, the other other white meat
>
>
> --
> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> -
> Phil Jourdan --- p...@ptahhotep.com 
>   http://www.ptahhotep.com
>   http://www.chiccantine.com/andypantry.php
>
>
> PJ, don't get on your high horse...
you should see my horse - I'll send you a small gif ;-)
>
> the first post had very little detail as to what you really wanted,
> which you explained much bet

Re: [PHP] not a shopping cart

2009-05-27 Thread PJ
Shawn McKenzie wrote:
> PJ wrote:
>   
>> I was afraid I would get this kind of reaction, but it is not what I
>> want or need.
>> As I mentioned, all these shopping carts are overbloated for the kind of
>> application I am creating.
>> I do not need all the heavy baggage that come with them. I have looked
>> at them, played with them some years back even and never liked them.
>> What I am looking for is something simple that can be used on one page
>> and that, at the most will give me a final page summarizing the choices
>> that have been made in several other pages and then totaling and sending
>> the results to the client. No shopping cart, no frills, no chills, just
>> a confirmation of the order.
>> Let's not forget that a b2b client has no time for all the pretty lace
>> and candy wrap. He/She makes a quick choice, clicks on
>> submit/do-it/or/confirm button and goes back to whipping his crew (in
>> the kitchen, I suppose). I rather suspect that I will have to drum this
>> little thing up by myself.
>> To explain the procedure for client:
>> 1. Click on navigation choice among categories
>> 2. Pages loaded from db (may be several for each category)
>> 3. Select quantity from input boxes (box is either empty or has number
>> entered - this is stored somewhere)
>> 4. Do the same for other pages...
>> 5. When finished, click the finish/submit or whatever button. Go back to
>> work.
>> 6. Back-end tallies the selections adds them enters choices in db and
>> send confirmation to client and to company to  fill order.
>> 7. Post-back-end is up to the company to fill and deliver. Payment is
>> taken care of by company processing credit card and then delivering goodies.
>> That's about as simple as it can get. No shipping complications, no
>> credit complications. Just click and go.
>> All the unnecessary overhead is eliminated by first time registration
>> and credit check with confirmed username and password. Otherwise, baby,
>> you don't get nothing from this site. Public access and frills are not
>> on the product pages unless we ever go that way in the future.
>> Believe me, it works... we've done it before and were years ahead of
>> everybody...until 9/11... blew us off because they blew away some of our
>> clients and their clients as we... and then we had someone fresh meat
>> nerds coding and they rather stumbled over their own heels in the
>> programming, but that's another story.
>>
>> Thanks, anyway.
>>
>> Bastien Koert wrote:
>> 
>>> On Wed, May 27, 2009 at 11:52 AM, PJ >> > wrote:
>>>
>>> I am setting up a b2b product site where food professionals can order
>>> unique regional products. For this I have to implement a simple series
>>> of pages that display the products and prices. Using php/mysql/css I
>>> load the products, prices etc. with ease.
>>> I have no use for any shopping carts as that is always encumbered by
>>> huge overhead.
>>> I am wondering what might be the best way to incorporate inputs
>>> that can
>>> be dynamically loaded and then calculated and submitted for email
>>> confirmation to client? Perhpas there is some sort of script out there
>>> in freebieLand?
>>> I'd appreciate any suggestions, pointers > or examples.
>>> TIA, Phil
>>>
>>> --
>>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>>> -
>>> Phil Jourdan --- p...@ptahhotep.com 
>>>   http://www.ptahhotep.com
>>>   http://www.chiccantine.com/andypantry.php
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>
>>> Get one of the big ones like osCommerce... why redo all the heavy lifting?
>>> -- 
>>>
>>> Bastien
>>>
>>> Cat, the other other white meat
>>>   
>> 
>
> Since this is a system where people won't actually pay you, and you
> aren't fulfilling the orders, it should be fairly simple.  The carts
> that I have seen are normally more bloated as you have stated, though
> there are some that are just a "cart" where you select products. These
> normally include the shipping, tax, and then payment logic for
> paypal/google, etc. though.  I haven't used any, but this looked cool:
> http://www.dragdropcart.com/ but it's $30.  And here is the first
> tutorial I found on a search:
> http://www.devarticles.com/c/a/MySQL/Building-A-Persistent-Shopping-Cart-With-PHP-and-MySQL/
>
> Based on many of your other posts, you've already done everything that
> is needed here with the possible exception of the email.  Here is the
> basics of the user interface, however you need to think about the admin
> interface to add products, etc.
>
> 1. login user/start session
> 2. query db for categories and list them
> 3. when user clicks on a category, query db and list all products in
> that category
> 4. each product has a t

Re: [PHP] Re: Displaying images

2009-05-27 Thread Miller, Terion


Thanks for the suggestions everyone, I have this now, but still no image 
showing up

It is stored as a blob in the database.

on the output page I am calling it like this:



Then on the image.php page I have this:





This page isn't working and if I try to browse this page it wants to open it 
with an editor, it won't view in the browser.

What am I doing wrong? Is it the code or the data?

Thanks
Terion

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



Re: [PHP] Re: Displaying images

2009-05-27 Thread Shawn McKenzie
Miller, Terion wrote:
> 
> Thanks for the suggestions everyone, I have this now, but still no image 
> showing up
> 
> It is stored as a blob in the database.
> 
> on the output page I am calling it like this:
> 
> 

I was assuming that ePhoto was the actual binary data?  If so then you
need something else here like id or something.  I just used filename as
an example.  If ePhoto is actually the filename then you are OK here,
but not below.

> 
> Then on the image.php page I have this:
> 
>  include("inc/dbconn_open.php");
> error_reporting(E_ALL);
> 
> //image.php
> header("Content-type: img/jpeg");
> $filename = $_GET['filename'];
> 
> $sql = "SELECT ePhoto from eagleProjects WHERE $filename= ePhoto";

Ummm...  This can't work.  What is ePhoto???  The data or the filename?

> $result=mysql_query($sql);
> $row = mysql_fetch_assoc ($result);
> 
> 
> 
> ?>
> 
> 
> 
> This page isn't working and if I try to browse this page it wants to open it 
> with an editor, it won't view in the browser.
> 
> What am I doing wrong? Is it the code or the data?
> 
> Thanks
> Terion


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Re: Displaying images

2009-05-27 Thread Shawn McKenzie
Shawn McKenzie wrote:
> Miller, Terion wrote:
>> Thanks for the suggestions everyone, I have this now, but still no image 
>> showing up
>>
>> It is stored as a blob in the database.
>>
>> on the output page I am calling it like this:
>>
>> 
> 
> I was assuming that ePhoto was the actual binary data?  If so then you
> need something else here like id or something.  I just used filename as
> an example.  If ePhoto is actually the filename then you are OK here,
> but not below.
> 
>> Then on the image.php page I have this:
>>
>> > include("inc/dbconn_open.php");
>> error_reporting(E_ALL);
>>
>> //image.php
>> header("Content-type: img/jpeg");
>> $filename = $_GET['filename'];
>>
>> $sql = "SELECT ePhoto from eagleProjects WHERE $filename= ePhoto";
> 
> Ummm...  This can't work.  What is ePhoto???  The data or the filename?
> 
>> $result=mysql_query($sql);
>> $row = mysql_fetch_assoc ($result);
>>
>>
>>
>> ?>
>>
>> 
>>
>> This page isn't working and if I try to browse this page it wants to open it 
>> with an editor, it won't view in the browser.
>>
>> What am I doing wrong? Is it the code or the data?
>>
>> Thanks
>> Terion
> 
> 

I don't know what your fields are, but if ePhoto is the BLOB, and you
have an id field, then try this (assuming that you have selected id in
your query and it is an integer):



//image.php
$id = (int)$_GET['id'];
$sql = "SELECT ePhoto from eagleProjects WHERE id=$id";

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Why does PHP have such a pain in the a$$ configuration file?

2009-05-27 Thread b

hessi...@hessiess.com wrote:

Something that seriously annoys me about PHP is the fact that it has
a configuration file which can *completely* change the behaviour of
the language.


Perhaps you're not at all clear on the purpose of a configuration file.

> I am seriously considering moving to a different language because of 
this.


I guess you could look for a language that has a parser with 0 
configuration options. Sounds like a bundle of fun.


Meanwhile, why don't you consider a) moving to a new host; or, b) 
setting up your own server so you can ~shudder~ *configure* it however 
you like.



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



Re: [PHP] Comparing strings (revisited)

2009-05-27 Thread Clancy
On Mon, 25 May 2009 02:11:24 -0400, pa...@quillandmouse.com (Paul M Foster) 
wrote:

.
>
>This is why I originated a thread along these lines some time ago.  I
>sympathize with your pain, being a C programmer as well. Apparently, PHP
>plays fast and loose with types when doing == comparisons. And empty()
>has a really wild way of determining if something is "empty" (an integer
>0 is "empty"?). Which is why I originally asked if strcmp() was the
>preferred method of comparison for the list members.
>
>In any case, strcmp() does what you want and is the safest way to
>compare strings, which is what PHP passes around a lot (data comes out
>of databases as strings, comes back from forms as strings, etc.). And
>since most of the syntax and library functions of PHP are based on C
>paradigms, I'm guessing that the PHP strcmp() function is a thin veneer
>over the actual C function.

Thanks, Paul. 

I have done some more experimenting, and have a better handle on what is going 
on now, so
I don't think I will fall into any unexpected holes (apart from  by being 
careless!)

If you enter a value directly (eg. $a[0] = 000a; ) it tries to convert the 
input to a
number, and rejects any input it cannot convert (such as 000a). However if the 
value is
quoted it is stored internally as a string.

If the data is stored as elements of a string, and is exploded into an array no 
attempt is
made to interpret them, and they are stored as strings in their original form. 
They appear
to retain this form, but if they are compared with some other value the two 
values are
adjusted until they are of the same type, and then they are compared.  The 
results often
seem absurd at first glance. For example 000A < 2 < 10, but A > . I think 
the reason
for this is that if the values can be treated as numbers they are compared 
directly, but
otherwise the one with less characters is right padded with spaces, and then 
there are
compared as strings. Thus '000A' < '2   ', and 'A   ' > ''.

If the values are compared as strings (using strcmp or SORT_STRING) the results 
are
entirely logical if all the strings are of the same length. If the strings are 
of
different lengths the shorter one is again right padded (probably with spaces) 
and then
the two are compared.

These points are illustrated in the following test programs.

 Test 1. Values entered directly ';
$i = 0; $n = count ($a);
while ($i < $n)
{
echo ' $a['.$i.']: '.$a[$i].' = ';
$j = 0; while ($j < $n)
{
if (($i != $j) && ($a[$i] == $a[$j])) { echo $a[$j].', 
'; }
++$j;
}
++$i; echo '';
}

// Test two data:   
$ss = 2000;20e2;2.e3;2.E3;2.000e3;4000/2;4.0e3/2.0;20E2;;000A;A000;2;0010;
A;10;20;21';
$a = explode (';',$ss);

echo ' Test 2. Values exploded into array ';
$i = 0; $n = count ($a);
while ($i < $n)
{
echo ' $a['.$i.']: '.$a[$i].' = ';
$j = 0; while ($j < $n)
{
if (($i != $j) && ($a[$i] == $a[$j])) { echo $a[$j].', 
'; }
++$j;
}
++$i; echo '';
}

// Test 3.
$b = $a;
sort ($b, SORT_STRING);
sort ($a);
echo '   Sort normal.';
$i = 0; while ($i < $n)
{
echo '$a['.$i.'] = '.$a[$i].'';
++$i;
}

echo '   Sort string.';
$i = 0; while ($i < $n)
{
echo '$b['.$i.'] = '.$b[$i].'';
++$i;
}
?>
Results:

Test 1. Values entered directly. All values are converted to the simplest form 
on input.
 
$a[0]: 2000 = 2000, 2000, 2000, 2000, 2000, 2000, 20E2, 
$a[1]: 2000 = 2000, 2000, 2000, 2000, 2000, 2000, 20E2, 
$a[2]: 2000 = 2000, 2000, 2000, 2000, 2000, 2000, 20E2, 
$a[3]: 2000 = 2000, 2000, 2000, 2000, 2000, 2000, 20E2, 
$a[4]: 2000 = 2000, 2000, 2000, 2000, 2000, 2000, 20E2, 
$a[5]: 2000 = 2000, 2000, 2000, 2000, 2000, 2000, 20E2, 
$a[6]: 2000 = 2000, 2000, 2000, 2000, 2000, 2000, 20E2, 
$a[7]: 20E2 = 2000, 2000, 2000, 2000, 2000, 2000, 2000, 
$a[8]:  = , 
$a[9]:  = , 
$a[10]: 000A = 
 
Test 2. Values exploded into array. Values are preserved as strings until 
compared. 
 
$a[0]: 2000 = 20e2, 2.e3, 2.E3, 2.000e3, 20E2, 
$a[1]: 20e2 = 2000, 2.e3, 2.E3, 2.000e3, 20E2, 
$a[2]: 2.e3 = 2000, 20e2, 2.E3, 2.000e3, 20E2, 
$a[3]: 2.E3 = 2000, 20e2, 2.e3, 2.000e3, 20E2, 
$a[4]: 2.000e3 = 2000, 20e2, 2.e3, 2.E3, 20E2, 
$a[5]: 4000/2 = 
$a[6]: 4.0e3/2.0 = 
$a[7]: 20E2 = 2000, 20e2, 2.e3, 2.E3, 2.000e3, 
$a[8]:  = 
$a[9]: 000A = 
$a[10]: A000 = 
$a[11]: 2 = 
$a[12]: 0010 = 10, 
$a[13]: A = 
$a[14]: 10 = 0010, 
$a[15]: 20 = 
$a[16]: 21 = 
 
Test 3. Sort normal.
$a[0] = 000A
$a[1] = 2
$a[2] 

[PHP] PDO -> Nested selects allowed?

2009-05-27 Thread Stephen
For my photography website, I have a photo gallery, and the user first 
sees a list of categories. They can click down to see thumbnails, and 
again to see individual photographs.


I want to enhance this to, with the category listing, show the first 
thumbnail.


I have a category table, a photo table and the photos and thumbnails are 
files.


The photo table has a category_id column and a filename column.

Now, I Googled a bit, and it is not clear that

i) Select the categories
ii) Loop through the result set
iii) Within the loop select the filename will work

Does the select within the loop clobber the result set of the category 
selection?


I saw suggestions to fetch the entire result set into a PHP array, or to use

|$dbh->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);

The queries I have created are:

$categoryquery = 'SELECT c.category_id, c.category_name, 
c.category_description,
 COUNT(photo_id) FROM gallery_category as c LEFT JOIN 
gallery_photos
 as p ON p.photo_category = c.category_id GROUP BY 
c.category_id

 ORDER BY c.category_order';
$catthumbquery = 'SELECT photo_filename FROM gallery_photos WHERE 
photo_category=:cid

 ORDER BY photo_order LIMIT 1';

and the PHP code I have drafted is:

try {
   $stmt = $dbh->prepare($categoryquery);
   $stmt->execute();
   while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
 $id  = $row['category_id'];
 $name= $row['category_name'];
 $description = $row['category_description'];
 $count   = $row['COUNT(photo_id)'];

 $stmt2 = $dbh->prepare($catthumbquery);
 $stmt2->bindParam(':cid', $id, PDO::PARAM_STR);
 $stmt2->execute();

 $result_array[] = "\t\t\n" .
   "\t\t\t" .
   $name . " ($count)\n\t\t\n \t\tclass=\"categorydescription\">" .

   "\n\t\t\t$description\n\t\t";
   }
 }
 catch (PDOException $e) {
   echo "Building category list failed: " . $e->getMessage();
 }

Thanks to those who can help!
Stephen
|

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



Re: [PHP] Why does PHP have such a pain in the a$$ configuration file?

2009-05-27 Thread Michael A. Peters

b wrote:
 b) 
setting up your own server so you can ~shudder~ *configure* it however 
you like.





linode offers xen virtual machines at a very affordable rate that give 
you complete control.


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



Re: [PHP] Confirmation email caught by spam filter

2009-05-27 Thread Per Jessen
Ashley Sheridan wrote:

> I've also seen this happen where the address that the mail was sent
> from is different from the MX record for the domain the email says it
> is sent from. The only way round this is to have the MX and A records
> point to the same server.

It's not a real problem - lots of companies have different inbound and
outbound servers. 


/Per

-- 
Per Jessen, Zürich (14.2°C)


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



[PHP] spawning a process that uses pipes - doesn't terminate when webpage download is canceled

2009-05-27 Thread Flint Million
so here's the scenario..

I have a site that uses php with a database to offer sound files to
users using streaming methods.

the request page has options, allowing the user to modify the sound
file in various ways, before having it sent to them

Here's the problem:

The method i'm using to feed the data to the user is to run the source
file through various piped commands, with the resulting audio being
dumped to stdout, and then using passthru in php to get that data to
the enduser.

here's an example, for serving an MP3 with its pitch/speed changed by sox:

passthru("lame --quiet --decode \"" . $in_file . "\" - | " .
 "sox -V -S -t wav - -t wav - speed " . $speed_factor . " | " .
 "lame --quiet " . $lame_params . " - -");

This works just fine, except the problem is if the end user aborts the
transfer (e.g. stops playback in the media player, cancels download of
the mp3, whatever) then it leaves behind both the sox process and the
decoder LAMe process along with the sh that's running them. the only
process that exits is the final encoding lame process. If the sound
file runs to completion, everythign exits properly.

But this obviously means enough "cancelling" of downloads means the
server ends up with a huge batch of stuck processes! And I even tried
simply killing the 'host' sh process, and the lame and sox processes
remain anyway. The only way I've been able to deal with this is
manually killing the lame and sox processes directly.

is there any way I can make this work, such so that if the user
cancels the transfer, all relavent processes are killed rather than
just the single process that's feeding output into php?

-FM

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