php-general Digest 4 Feb 2007 13:52:56 -0000 Issue 4607

2007-02-04 Thread php-general-digest-help

php-general Digest 4 Feb 2007 13:52:56 - Issue 4607

Topics (messages 248263 through 248276):

Re: include file identifier
248263 by: Larry Garfield
248264 by: Robert Cummings

Billing client for studying documentation
248265 by: Mike Mannakee
248266 by: Christopher Weldon

Stuffing code into variable
248267 by: Albert Padley
248269 by: Christopher Weldon
248270 by: Albert Padley
248271 by: Paul Novitski
248272 by: Albert Padley
248273 by: Paul Novitski

Re: Matching numbers 1-100
248268 by: bit-bucket

Imprimir cierta cantidad de caracteres
248274 by: Anuack Luna

LDAP constants GSLC_SSL_...
248275 by: Petric Frank

Read file on file system
248276 by: Bagus Nugroho

Administrivia:

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

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

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
On Saturday 03 February 2007 7:27 pm, Eli wrote:
 Robert Cummings wrote:
  Looking at the code above... it would seem you want:
 
  include_once()

 It's not the idea..

 I'm not trying to make that code work, I want to know which exact
 include (of the same file) does what..

Huh?

 Say you got a loop of self-include:
 e.g:
 === a.php
 ?php
 echo \nRunning .__FILE__. (id=X)!\t;
 if ($visited5) {
   echo You are visiting here!;
   $visited++;
   include(__FILE__);
 }
 else {
   echo That's enough! Bye!;
 }
 ?

 In (id=X)!.. what's the X? You may say you can use $visited as an
 identifier, but it's not the point I mean.. I want a global include file
 identifier, that is not dependent on other variables.

realpath(__FILE__) will give you the absolute path on the server of the 
current file, which is unique.  Why you want that for what you're doing I 
have no idea, but it's the only unique identifier I can think of that isn't a 
variable or constant.  (Well, it is a constant, but you get the idea.  I 
suppose.)

The fact that you even want something like that, however, scares me.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson
---End Message---
---BeginMessage---
On Sun, 2007-02-04 at 03:27 +0200, Eli wrote:
 Robert Cummings wrote:
  Looking at the code above... it would seem you want:
  
  include_once()
 It's not the idea..
 
 I'm not trying to make that code work, I want to know which exact 
 include (of the same file) does what..
 
 Say you got a loop of self-include:
 e.g:
 === a.php
 ?php
 echo \nRunning .__FILE__. (id=X)!\t;
 if ($visited5) {
   echo You are visiting here!;
   $visited++;
   include(__FILE__);
 }
 else {
   echo That's enough! Bye!;
 }
 ?
 
 In (id=X)!.. what's the X? You may say you can use $visited as an 
 identifier, but it's not the point I mean.. I want a global include file 
 identifier, that is not dependent on other variables.

Make one...

?php

if( !isset( $GLOBALS['include_counter'][__FILE__] ) )
{
$GLOBALS['include_counter'][__FILE__] = 1;
}
else
{
$GLOBALS['include_counter'][__FILE__]++;
}

echo \nRunning .__FILE__. (id=X)!\t;
if( $GLOBALS['include_counter'][__FILE__]  5 )
{
echo You are visiting here!;
include(__FILE__);
}
else
{
echo That's enough! Bye!;
}

?


The actual counter stuff could be put in a function which could be in an
include file you load so that you do the following at the top:

?php

include( 'someFunctions.php' );
register_include( __FILE__ );

?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'
---End Message---
---BeginMessage---
I have a php project I have been working on for several months.  The 
client's requirements have expanded to include interfacing to an online 
service using xml, which I was familiar with but have never worked with 
prior to this project.  I have spent a good number of hours reading up on 
xml, and learning how to use it to integrate with 

php-general Digest 5 Feb 2007 02:11:52 -0000 Issue 4608

2007-02-04 Thread php-general-digest-help

php-general Digest 5 Feb 2007 02:11:52 - Issue 4608

Topics (messages 248277 through 248296):

Peristent Listen over an HTTP connection
248277 by: chetan rane
248279 by: Stut
248283 by: chetan rane
248285 by: Stut
248286 by: Jiffy Slides Leonard Burton
248287 by: Stut
248289 by: chetan rane
248290 by: Stut
248291 by: Myron Turner
248292 by: Myron Turner

Re: Read file on file system
248278 by: Stut
248280 by: Satyam
248281 by: Bagus Nugroho
248282 by: Stut
248284 by: Stut
248288 by: Satyam

Hello list
248293 by: PHP Fusebox

Sending secure mail
248294 by: Rob
248295 by: Chris

Re: Jabber conection manager
248296 by: Le Phuoc Canh

Administrivia:

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

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

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---

HI all

I have a small issue to be handled here

i want to persistently moniter the HTTP stream from a Client Browser. How do
i accomplish it

--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
[EMAIL PROTECTED]
---End Message---
---BeginMessage---

chetan rane wrote:

I have a small issue to be handled here

i want to persistently moniter the HTTP stream from a Client Browser. 
How do

i accomplish it


I'm not sure what you mean by 'persistently monitor'. If you mean listen 
for incoming connections then you need to look at the socket or stream 
functions. If that is the case then I don't see where the Client 
Browser comes into it.


Please elaborate further on what you are actually trying to accomplish.

-Stut
---End Message---
---BeginMessage---

hi

what i mean is

i want to write a script
where , when ny client requests come i read the stream and then process it

here is the exact steps

when the user first initiates
i create a session and establish a TCP connection
second: when teh user next sends a request i dont create a new TCP
connection but use the existing TCP connection.

On 2/4/07, Stut [EMAIL PROTECTED] wrote:


chetan rane wrote:
 I have a small issue to be handled here

 i want to persistently moniter the HTTP stream from a Client Browser.
 How do
 i accomplish it

I'm not sure what you mean by 'persistently monitor'. If you mean listen
for incoming connections then you need to look at the socket or stream
functions. If that is the case then I don't see where the Client
Browser comes into it.

Please elaborate further on what you are actually trying to accomplish.

-Stut





--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
[EMAIL PROTECTED]
---End Message---
---BeginMessage---

chetan rane wrote:

i want to write a script
where , when ny client requests come i read the stream and then process it

here is the exact steps

when the user first initiates
i create a session and establish a TCP connection
second: when teh user next sends a request i dont create a new TCP 
connection but use the existing TCP connection.


Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?

-Stut
---End Message---
---BeginMessage---

XAJAX or another AJAX library, perhaps?

On 2/4/07, Stut [EMAIL PROTECTED] wrote:

chetan rane wrote:
 i want to write a script
 where , when ny client requests come i read the stream and then process it

 here is the exact steps

 when the user first initiates
 i create a session and establish a TCP connection
 second: when teh user next sends a request i dont create a new TCP
 connection but use the existing TCP connection.

Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?

-Stut

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





--
Leonard Burton, N9URK
http://www.jiffyslides.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]

The prolonged evacuation would have dramatically affected the
survivability of the occupants.
---End Message---
---BeginMessage---

Jiffy Slides Leonard Burton wrote:

XAJAX or another AJAX library, perhaps?


Sorry, I missed a question.

3) Why do you need to use the same TCP connection?

-Stut


On 2/4/07, Stut [EMAIL PROTECTED] wrote:

chetan rane wrote:
 i want to write a script
 where , when ny client requests come i read the stream and then 
process it


 here is the exact steps

 when the user first initiates
 i create a session and establish a TCP connection
 second: when teh user next sends a request i dont create a new TCP
 connection but use the existing TCP connection.

Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?


[PHP] LDAP constants GSLC_SSL_...

2007-02-04 Thread Petric Frank
Hello,

actually i am workinh with the ldap functions of php5.
Reading the docs i found the constants

  GSLC_SSL_NO_AUTH
  GSLC_SSL_ONEWAY_AUTH
  GSLC_SSL_TWOWAY_AUTH

They are simply documented, but i can't find any docs about them. Neither at 
php.net not via google.

So - what they are for and how to use them ?

regards
   Petric

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



[PHP] Read file on file system

2007-02-04 Thread Bagus Nugroho
Hi All,

If I have file on[windows] c:\test.csv.
How I can read the entire contents of this file?

I have try file_get_contents, fgetcsv and etc but didn't work.
May I'm mis-understanding about using those function.

Thanks in advance
Regards,
bn


[PHP] Peristent Listen over an HTTP connection

2007-02-04 Thread chetan rane

HI all

I have a small issue to be handled here

i want to persistently moniter the HTTP stream from a Client Browser. How do
i accomplish it

--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
[EMAIL PROTECTED]


Re: [PHP] Read file on file system

2007-02-04 Thread Stut

Bagus Nugroho wrote:

If I have file on[windows] c:\test.csv.
How I can read the entire contents of this file?

I have try file_get_contents, fgetcsv and etc but didn't work.
May I'm mis-understanding about using those function.


Well, from examining the code you included in your post, and reading the 
output you're seeing, I have determined that... ahh, hang on a second, 
I've started seeing code where no code exists. Is that a bad thing? 
Should I see someone?


-Stut

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



Re: [PHP] Peristent Listen over an HTTP connection

2007-02-04 Thread Stut

chetan rane wrote:

I have a small issue to be handled here

i want to persistently moniter the HTTP stream from a Client Browser. 
How do

i accomplish it


I'm not sure what you mean by 'persistently monitor'. If you mean listen 
for incoming connections then you need to look at the socket or stream 
functions. If that is the case then I don't see where the Client 
Browser comes into it.


Please elaborate further on what you are actually trying to accomplish.

-Stut

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



Re: [PHP] Read file on file system

2007-02-04 Thread Satyam
Have you doubled the backslash to escape it?  Or put it in between single 
quotes?  Either:


c:\\test.csv  or 'c:\test.csv' or even 'c:/test.csv'

Otherwise, a \t in between double quotes will be interpreted as a tab

Satyam

- Original Message - 
From: Bagus Nugroho [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Sunday, February 04, 2007 2:47 PM
Subject: [PHP] Read file on file system


Hi All,

If I have file on[windows] c:\test.csv.
How I can read the entire contents of this file?

I have try file_get_contents, fgetcsv and etc but didn't work.
May I'm mis-understanding about using those function.

Thanks in advance
Regards,
bn

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



RE: [PHP] Read file on file system

2007-02-04 Thread Bagus Nugroho
in simple like this

$filename = d:\\test.csv;
$openfile = fopen($filename,'r');
$readfile = fread($openfile,filesize($filename);

echo $readfile


or like this
.

echo file_get_contents($openfile);

.
echo fgetcsv($openfile);



Thxs and rgds
bn



-Original Message-
From: Stut [mailto:[EMAIL PROTECTED]
Sent: Sun 04-Feb-2007 21:14
To: Bagus Nugroho
Cc: php-general@lists.php.net
Subject: Re: [PHP] Read file on file system
 
Bagus Nugroho wrote:
 If I have file on[windows] c:\test.csv.
 How I can read the entire contents of this file?
 
 I have try file_get_contents, fgetcsv and etc but didn't work.
 May I'm mis-understanding about using those function.

Well, from examining the code you included in your post, and reading the 
output you're seeing, I have determined that... ahh, hang on a second, 
I've started seeing code where no code exists. Is that a bad thing? 
Should I see someone?

-Stut





Re: [PHP] Read file on file system

2007-02-04 Thread Stut

Bagus Nugroho wrote:

in simple like this

$filename = d:\\test.csv;
$openfile = fopen($filename,'r');
$readfile = fread($openfile,filesize($filename);

echo $readfile


or like this
.

echo file_get_contents($openfile);

.
echo fgetcsv($openfile);


Try this...

?php
$filenane = d:\\test.csv
if (file_exists($filename))
echo file_get_contents($filename);
else
echo 'File not found';
?

...and nothing else. Do you get any errors? Are errors turned on in php.ini?

-Stut

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



Re: [PHP] Peristent Listen over an HTTP connection

2007-02-04 Thread chetan rane

hi

what i mean is

i want to write a script
where , when ny client requests come i read the stream and then process it

here is the exact steps

when the user first initiates
i create a session and establish a TCP connection
second: when teh user next sends a request i dont create a new TCP
connection but use the existing TCP connection.

On 2/4/07, Stut [EMAIL PROTECTED] wrote:


chetan rane wrote:
 I have a small issue to be handled here

 i want to persistently moniter the HTTP stream from a Client Browser.
 How do
 i accomplish it

I'm not sure what you mean by 'persistently monitor'. If you mean listen
for incoming connections then you need to look at the socket or stream
functions. If that is the case then I don't see where the Client
Browser comes into it.

Please elaborate further on what you are actually trying to accomplish.

-Stut





--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
[EMAIL PROTECTED]


Re: [PHP] Read file on file system

2007-02-04 Thread Stut

Stut wrote:

$filenane = d:\\test.csv


Oops...

$filename = d:\\test.csv;

-Stut

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



Re: [PHP] Peristent Listen over an HTTP connection

2007-02-04 Thread Stut

chetan rane wrote:

i want to write a script
where , when ny client requests come i read the stream and then process it

here is the exact steps

when the user first initiates
i create a session and establish a TCP connection
second: when teh user next sends a request i dont create a new TCP 
connection but use the existing TCP connection.


Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?

-Stut

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



Re: [PHP] Peristent Listen over an HTTP connection

2007-02-04 Thread Jiffy Slides Leonard Burton

XAJAX or another AJAX library, perhaps?

On 2/4/07, Stut [EMAIL PROTECTED] wrote:

chetan rane wrote:
 i want to write a script
 where , when ny client requests come i read the stream and then process it

 here is the exact steps

 when the user first initiates
 i create a session and establish a TCP connection
 second: when teh user next sends a request i dont create a new TCP
 connection but use the existing TCP connection.

Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?

-Stut

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





--
Leonard Burton, N9URK
http://www.jiffyslides.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]

The prolonged evacuation would have dramatically affected the
survivability of the occupants.

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



Re: [PHP] Peristent Listen over an HTTP connection

2007-02-04 Thread Stut

Jiffy Slides Leonard Burton wrote:

XAJAX or another AJAX library, perhaps?


Sorry, I missed a question.

3) Why do you need to use the same TCP connection?

-Stut


On 2/4/07, Stut [EMAIL PROTECTED] wrote:

chetan rane wrote:
 i want to write a script
 where , when ny client requests come i read the stream and then 
process it


 here is the exact steps

 when the user first initiates
 i create a session and establish a TCP connection
 second: when teh user next sends a request i dont create a new TCP
 connection but use the existing TCP connection.

Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?

-Stut

--
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] Read file on file system

2007-02-04 Thread Satyam
file_get_contents takes a file name as an argument, not an opened file 
handle.



- Original Message - 
From: Bagus Nugroho [EMAIL PROTECTED]

To: Stut [EMAIL PROTECTED]; php-general@lists.php.net
Sent: Sunday, February 04, 2007 3:45 PM
Subject: RE: [PHP] Read file on file system


in simple like this

$filename = d:\\test.csv;
$openfile = fopen($filename,'r');
$readfile = fread($openfile,filesize($filename);

echo $readfile


or like this
.

echo file_get_contents($openfile);

.
echo fgetcsv($openfile);



Thxs and rgds
bn



-Original Message-
From: Stut [mailto:[EMAIL PROTECTED]
Sent: Sun 04-Feb-2007 21:14
To: Bagus Nugroho
Cc: php-general@lists.php.net
Subject: Re: [PHP] Read file on file system

Bagus Nugroho wrote:

If I have file on[windows] c:\test.csv.
How I can read the entire contents of this file?

I have try file_get_contents, fgetcsv and etc but didn't work.
May I'm mis-understanding about using those function.


Well, from examining the code you included in your post, and reading the
output you're seeing, I have determined that... ahh, hang on a second,
I've started seeing code where no code exists. Is that a bad thing?
Should I see someone?

-Stut

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



Re: [PHP] Peristent Listen over an HTTP connection

2007-02-04 Thread chetan rane

same TCP creation,

because i i am bindiing that stream to the Server.

i am actually creating a component.

a component which resides in between a client and server

i accept HTTP requests from a client and relay the same uysing a TCP
connection to the SERVER.
and vice versa

i think this makes it clear.

On 2/4/07, Stut [EMAIL PROTECTED] wrote:


chetan rane wrote:
 i want to write a script
 where , when ny client requests come i read the stream and then process
it

 here is the exact steps

 when the user first initiates
 i create a session and establish a TCP connection
 second: when teh user next sends a request i dont create a new TCP
 connection but use the existing TCP connection.

Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?

-Stut





--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
[EMAIL PROTECTED]


Re: [PHP] Peristent Listen over an HTTP connection

2007-02-04 Thread Stut

chetan rane wrote:

same TCP creation,

because i i am bindiing that stream to the Server.

i am actually creating a component.

a component which resides in between a client and server

i accept HTTP requests from a client and relay the same uysing a TCP 
connection to the SERVER.

and vice versa

i think this makes it clear.


OK, so you're basically making a server app. I suggest you start here: 
http://php.net/stream-socket-server


-Stut

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



Re: [PHP] Peristent Listen over an HTTP connection

2007-02-04 Thread Myron Turner

chetan rane wrote:

same TCP creation,

because i i am bindiing that stream to the Server.

i am actually creating a component.

a component which resides in between a client and server

i accept HTTP requests from a client and relay the same uysing a TCP
connection to the SERVER.
and vice versa

i think this makes it clear.
I think what you want to look for is how to write a socket server.  
You'll find a lot about this via google.  A socket server lets you  
open  up a persistent port for listening with a process that runs 
continually in the background and then allows you to spawn off multiple 
sockets as they come in, like a web server or ftp or ssh.  My guess is 
that there's a fair amount of complexity here that you'll have to 
investigate.  For instance, you'll have to preempt port 80, the standard 
port on which httpd listens, forward the http request to your web server 
on a local port, retrieve the response and pass it back to the client.  
And presumably you'll have to be doing this for multiple clients.
I think someone on this list suggested using AJAX.  That would be much 
simpler.  If you had to have data persistence, for instance, you could 
store data in temporary files on the server or in temporary database 
entries, or you could simply pass data back and forth using POST.  The 
script which handles the AJAX requests would be the component that 
resides on the server.



_
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

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



Re: [PHP] Peristent Listen over an HTTP connection

2007-02-04 Thread Myron Turner

chetan rane wrote:

same TCP creation,

because i i am bindiing that stream to the Server.

i am actually creating a component.

a component which resides in between a client and server

i accept HTTP requests from a client and relay the same uysing a TCP
connection to the SERVER.
and vice versa

i think this makes it clear.

On 2/4/07, Stut [EMAIL PROTECTED] wrote:


chetan rane wrote:
 i want to write a script
 where , when ny client requests come i read the stream and then process
it

 here is the exact steps

 when the user first initiates
 i create a session and establish a TCP connection
 second: when teh user next sends a request i dont create a new TCP
 connection but use the existing TCP connection.

Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?

-Stut






As a follow-up to my previous, try this:
   http://www.devshed.com/c/a/PHP/Socket-Programming-With-PHP/

It needs IE (as opposed to Firefox).

--

_
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

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



[PHP] Hello list

2007-02-04 Thread PHP Fusebox

I've tried subscribing 3 times now.
This is a test.

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



[PHP] Sending secure mail

2007-02-04 Thread Rob

I need to send a large number of emails (not spam!) through an external
SMTP server that requires TLS and a username/password. I have some
control over the SMTP server but very little over the web server where
the scripts reside. How do I connect with TLS, authenticate and send the
mail?

I had problems with mail() originally (one of the reasons why we now
have a dedicated mail server) and I had to connect to the SMTP server by
hand with sockets and go through the SMTP steps by hand. I can connect
to the new server with following code.

$sock = fsockopen( 'smtp.eg.com', 25, $errNo, $errStr );

However, when I send the rcpt to: line, I'm told I don't have access
to the relay - i.e. I need to log in. This is where my knowledge of SMTP
reaches it's limit but I've read about the auth login command,
however, it says it needs to be run over an encrypted connection, i.e.
TLS. I can't disable this on the server, other services need TLS to be
on the SMTP server.

I've tried changing smtp.example.com to tls://smtp.example.com but
it then fails to connect at all ($errNo is 115, $errStr is Operation
now in progress). If I connect and send starttls, I don't get any more
data from the server and I've no idea what it's waiting for, be it a
public key or whatever. FWIW, the email server's certificate is a dodgy,
home made one which throws up a security error when tested with a mail
client, but once accepted it is fine.

Is there an easier way to do this? If not, how do I get the connection
so I can get to and rcpt to: line and beyond?

Thanks,
Rob

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



Re: [PHP] Sending secure mail

2007-02-04 Thread Chris

Rob wrote:

I need to send a large number of emails (not spam!) through an external
SMTP server that requires TLS and a username/password. I have some
control over the SMTP server but very little over the web server where
the scripts reside. How do I connect with TLS, authenticate and send the
mail?

I had problems with mail() originally (one of the reasons why we now
have a dedicated mail server) and I had to connect to the SMTP server by
hand with sockets and go through the SMTP steps by hand. I can connect
to the new server with following code.

$sock = fsockopen( 'smtp.eg.com', 25, $errNo, $errStr );

However, when I send the rcpt to: line, I'm told I don't have access
to the relay - i.e. I need to log in. This is where my knowledge of SMTP
reaches it's limit but I've read about the auth login command,
however, it says it needs to be run over an encrypted connection, i.e.
TLS. I can't disable this on the server, other services need TLS to be
on the SMTP server.

I've tried changing smtp.example.com to tls://smtp.example.com but
it then fails to connect at all ($errNo is 115, $errStr is Operation
now in progress). If I connect and send starttls, I don't get any more
data from the server and I've no idea what it's waiting for, be it a
public key or whatever. FWIW, the email server's certificate is a dodgy,
home made one which throws up a security error when tested with a mail
client, but once accepted it is fine.

Is there an easier way to do this? If not, how do I get the connection
so I can get to and rcpt to: line and beyond?


My first suggestion, instead of writing this from scratch, use phpmailer 
(http://phpmailer.sf.net). It supports smtp authentication etc, see 
included docs and also http://phpmailer.sourceforge.net/docs/


If that's not an option for whatever reason, follow what that does with 
authentication and implement it in your own script.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



RE: [PHP] Jabber conection manager

2007-02-04 Thread Le Phuoc Canh
It seem that you want to develop a webchat :), today there is a lot library
about Jabber protocol, but all in JAVA language, if you want you can use
library of jivesoftware to develop. I use Wildfire for IM server, and Claros
for webchat in servlet. You can try it for develop Jabber connection manage.
Best Regard.

-Original Message-
From: chetan rane [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 03, 2007 10:07 PM
To: php-general@lists.php.net
Subject: [PHP] Jabber conection manager

HI all

i want to develop a Jabber connection manage its role will be

1. accept HTTp request from the Client
2. establish connection with a jabber server using TCp 3. and later start
the instant mechanism between them

has any one worked on this please let me know how to do it


--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
 [EMAIL PROTECTED]


[PHP] PHP book reviewers wanted

2007-02-04 Thread Manuel Lemos
Hello,

Short version: the PHPClasses site is looking for reviewers of books of
interest of the PHP users.

Authors and publishers want to send me the books but nowadays I do not
have the time to review most of them, if any.

The candidates that are picked to review the available books will get
free review copies.

Just send a private message to info at phpclasses.org if you are interested.

Demonstrating good English writing skills and having published good book
reviews in the past gets me preference.

If you have read interesting books, you can submit a review already here
(you need  to be a site subscriber of course):

http://www.phpclasses.org/contribute.html

If you have questions or comments, please read the longer version first:

http://www.phpclasses.org/blog/post/60-User-submitted-book-reviews-and-package-required-PHP-versions.html

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Re: Sending secure mail

2007-02-04 Thread Manuel Lemos
Hello,

on 02/04/2007 10:22 PM Rob said the following:
 I need to send a large number of emails (not spam!) through an external
 SMTP server that requires TLS and a username/password. I have some
 control over the SMTP server but very little over the web server where
 the scripts reside. How do I connect with TLS, authenticate and send the
 mail?
 
 I had problems with mail() originally (one of the reasons why we now
 have a dedicated mail server) and I had to connect to the SMTP server by
 hand with sockets and go through the SMTP steps by hand. I can connect
 to the new server with following code.
 
 $sock = fsockopen( 'smtp.eg.com', 25, $errNo, $errStr );
 
 However, when I send the rcpt to: line, I'm told I don't have access
 to the relay - i.e. I need to log in. This is where my knowledge of SMTP
 reaches it's limit but I've read about the auth login command,
 however, it says it needs to be run over an encrypted connection, i.e.
 TLS. I can't disable this on the server, other services need TLS to be
 on the SMTP server.
 
 I've tried changing smtp.example.com to tls://smtp.example.com but
 it then fails to connect at all ($errNo is 115, $errStr is Operation
 now in progress). If I connect and send starttls, I don't get any more
 data from the server and I've no idea what it's waiting for, be it a
 public key or whatever. FWIW, the email server's certificate is a dodgy,
 home made one which throws up a security error when tested with a mail
 client, but once accepted it is fine.
 
 Is there an easier way to do this? If not, how do I get the connection
 so I can get to and rcpt to: line and beyond?

You may want to take a look at this popular SMTP client class. It
supports TLS. The example demonstrates how to send message via Gmail,
which requires TLS.

http://www.phpclasses.org/smtpclass

Anyway, I recommend that you use that class in conjunction with this
other for composing and sending RFC compliant MIME message. It helps
avoid problems that make message get trapped in spam filters:

http://www.phpclasses.org/mimemessage

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] Jabber conection manager

2007-02-04 Thread Ray Hauge

Le Phuoc Canh wrote:

It seem that you want to develop a webchat :), today there is a lot library
about Jabber protocol, but all in JAVA language, if you want you can use
library of jivesoftware to develop. I use Wildfire for IM server, and Claros
for webchat in servlet. You can try it for develop Jabber connection manage.
Best Regard.

-Original Message-
From: chetan rane [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 03, 2007 10:07 PM

To: php-general@lists.php.net
Subject: [PHP] Jabber conection manager

HI all

i want to develop a Jabber connection manage its role will be

1. accept HTTp request from the Client
2. establish connection with a jabber server using TCp 3. and later start
the instant mechanism between them

has any one worked on this please let me know how to do it


--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
 [EMAIL PROTECTED]



I've used http://cjphp.netflint.net/ for a project at work before.  It 
was a great simple way to just interface with a jabber server.  I didn't 
need to do anything fancy at the time though.  You could probably use 
that source as a base if you wanted.  It's GPL.



--
Ray Hauge
Primate Applications

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



[PHP] Re: php code to upload a url correctly

2007-02-04 Thread Manuel Lemos
Hello,

on 01/26/2007 12:10 PM Corden James (RW3) CMMC Manchester said the
following:
 I have a form in which users submit a url. I am having problems as some
 people submit the url in the format http://www.blah.blah.org
 http://www.blah.blah.org/  while others submit in the format
 www.blah.blah.org http://www.blah.blah.org/  I have designed the form
 so that it seems fairly obvious (to me anyway) not to include the
 http:// but people are still doing it (presumably because they are
 copying and pasting from a browser). My form processing script is
 designed to add http:// to the submitted url and place the modified url
 in a database for future use. As you can imagine sometimes I end up with
 urls such as http://http://www.blah.blah.org
 http://http:/www.blah.blah.org  in my database. Hence I need a more
 rigorous form processing script that is capable of first checking if the
 url includes http:// and then processes accordingly. Can anyone point me
 in the right direction for such a script?

I use a solution for that a lot of times that consists on using regular
expressions to fill eventually missing characters in the URL.

I use a popular forms generation and validation class that allows me to
replace string patterns. It works on client side with Javascript and
also on server side with the class itself. When using this class, you do
not need to know any Javascript. Just define how you want to replace the
string value patterns.

Here you may find a live example form that demonstrates that:

http://www.meta-language.net/forms-examples.html?example=test_form

See the test_form.php example form script to see how it works in action.

http://www.phpclasses.org/formsgeneration

Oh, here you may find a tutorial video that explains all the features
demonstrated by that example:

http://www.phpclasses.org/browse/package/1/video/1/section/example-form.html

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] How can I know if a browser is cookies enables?

2007-02-04 Thread Mauricio Muriel

Hello.

How can I know if a web browser is cookies enables?

Regards

Mauricio M.


[PHP] REST, SOAP or XML-RPC?

2007-02-04 Thread Paul Scott

I am developing a webservice like module for our framework that will
enable downloads of module code into the framework modules from a remote
server.

Basically what this should do is:

1. User requests a list of available stable modules from server
2. User clicks on install from the returned list
3. Client code will download a tgz/zip module and plonk it in the users
modules directory (taken care of)
4. Framework then unzips/untars it and installs (taken care of)

My question here is...

For the server/client code, I am thinking around REST (much the same way
as the PEAR channel server works). Is this the wisest choice? Should I
rather go with FTP or a mail request or something? If I go for FTP, that
will require the PHP FTP extension, how common is that in shared hosting
environments? 

The file size of a typical  module is around 100k, and we must take into
account that this is in/for bandwidth starved Africa. Is REST/SOAP
robust enough to do that?

Any help would be greatly appreciated!

--Paul



All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Who uses PHP

2007-02-04 Thread Craige Leeder

As has been said: It all depends on the developer. A skilled developer
is not restrained by how secure the particular language is. A
skilled developer will know the pitfalls of that language, and be able
to avoid them.

With php as an example, you have register_globals. Now,
register_globals is NOT a bad thing. However, due to incompetent
coders, it is one of the easiest exploits in many php applications. A
skilled developer is able to work unconditional of weather
register_globals is on on his/her server.

- Craige

On 2/3/07, Christopher Weldon [EMAIL PROTECTED] wrote:

 Well, if you do not know the answer to my particular question, I'm
 curious how might you respond to someone who says:

   PHP has to many security issues and should not be used with a
 user authentication system.
   We should use XXX.

 I think security mainly depends on the programmer and not on the
 language he uses...

 greets
 Zoltán Németh

I totally agree.



 You are not allowed to say 'Well, you're wrong. PHP is as secure as
 anything else.' without explaining why.
 Or, would you agree with the statement? Is there an 'XXX' that should
 be used instead of PHP?


Of course not. As Zoltan stated above, security is dependent upon the
programmer and not the language. But, if you aren't familiar with why
PHP is considered so insecure its a result of people who can't/
don't know how to properly program PHP applications. PHP is an easy
programming language to learn quickly and hit the ground running.
These people (typically) don't care to check to make sure writing
something like:

mysql_query('SELECT * FROM admins WHERE username = '.$_GET
['username'].' and password = '.$_GET['password'].'');

is safe and secure. This is one of the bigger issues I've seen on
some PHP applications. As you will (or perhaps already have read) on
Chris S.'s site that a big thing to do in PHP apps is FIEO (Filter
Input Escape Output). Applications written in this manner are
insecure; PHP isn't what's insecure.

However, with my limited Computer Science training, FIEO is something
that should be done in any application under any programming language
- for security's sake.

So, rather than consider the difference in security of a programming
language versus another, you should be asking the question What does
PHP offer me that XXX doesn't?. Alternatively, if the person on the
other end is still too concerned about security, then you should be
considering How much easier is it for me to program secure
applications in PHP than XXX? If you do it right from the start,
you'll find that PHP does not make it difficult to write secure apps.

 Given the limited number of options for maintaining state
 information, I would be hard pressed to see how any language could be
 inherently more security or why one could not write PHP code which
 implemented the same techniques as 'XXX'.

 (No, I do not know what 'XXX' might be.)


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



--
Christopher Weldon
President  CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
(866) 813-4603 x605

--
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] REST, SOAP or XML-RPC?

2007-02-04 Thread Richard Lynch
On Sun, February 4, 2007 10:38 pm, Paul Scott wrote:
 I am developing a webservice like module for our framework that will
 enable downloads of module code into the framework modules from a
 remote
 server.

 Basically what this should do is:

 1. User requests a list of available stable modules from server

I'd go for RSS for this bit, personally.

 2. User clicks on install from the returned list

Presumably one can choose to install only some of the options.

Of course, now you're into the wonderful land of module
dependencies...  Good luck!

 3. Client code will download a tgz/zip module and plonk it in the
 users
 modules directory (taken care of)

 4. Framework then unzips/untars it and installs (taken care of)

 My question here is...

 For the server/client code, I am thinking around REST (much the same
 way
 as the PEAR channel server works). Is this the wisest choice?

REST should be fine.

You should perhaps design it modularly enough that swapping in SOAP or
RPC would not be too difficult.

 Should I
 rather go with FTP or a mail request or something? If I go for FTP,
 that
 will require the PHP FTP extension, how common is that in shared
 hosting
 environments?

I don't think you'll need FTP in PHP...

Your client code can just download with fopen/fread, same as it
already is doing the tar.gz files...

You're more likely to be bitten by hosts turning off allow_url_fopen
though.

 The file size of a typical  module is around 100k, and we must take
 into
 account that this is in/for bandwidth starved Africa. Is REST/SOAP
 robust enough to do that?

I believe REST is the most light-weight bandwidth of the REST/SOAP/RPC
crowd...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] How can I know if a browser is cookies enables?

2007-02-04 Thread Richard Lynch
On Sun, February 4, 2007 10:36 pm, Mauricio Muriel wrote:
 How can I know if a web browser is cookies enables?

Send them ONE cookie and see if you get it back on the next page.

Actually, just use session_start() and see if it works or not is even
easier.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Sending secure mail

2007-02-04 Thread Richard Lynch
I suspect that there are pre-built PHP classes out there that can
handle TLS SMTP...

Google for them and search usual places like PEAR, PHPClasses.org etc.

On Sun, February 4, 2007 6:22 pm, Rob wrote:
 I need to send a large number of emails (not spam!) through an
 external
 SMTP server that requires TLS and a username/password. I have some
 control over the SMTP server but very little over the web server where
 the scripts reside. How do I connect with TLS, authenticate and send
 the
 mail?

 I had problems with mail() originally (one of the reasons why we now
 have a dedicated mail server) and I had to connect to the SMTP server
 by
 hand with sockets and go through the SMTP steps by hand. I can connect
 to the new server with following code.

 $sock = fsockopen( 'smtp.eg.com', 25, $errNo, $errStr );

 However, when I send the rcpt to: line, I'm told I don't have access
 to the relay - i.e. I need to log in. This is where my knowledge of
 SMTP
 reaches it's limit but I've read about the auth login command,
 however, it says it needs to be run over an encrypted connection, i.e.
 TLS. I can't disable this on the server, other services need TLS to be
 on the SMTP server.

 I've tried changing smtp.example.com to tls://smtp.example.com but
 it then fails to connect at all ($errNo is 115, $errStr is
 Operation
 now in progress). If I connect and send starttls, I don't get any
 more
 data from the server and I've no idea what it's waiting for, be it a
 public key or whatever. FWIW, the email server's certificate is a
 dodgy,
 home made one which throws up a security error when tested with a mail
 client, but once accepted it is fine.

 Is there an easier way to do this? If not, how do I get the connection
 so I can get to and rcpt to: line and beyond?

 Thanks,
 Rob

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] PHP5 Commercial Development

2007-02-04 Thread Craige Leeder

Eric,

PHP is fine for commercial environments. Many people are just afraid
of it due to the fact it is known to break some poorly written PHP 4
scripts, and the fact that many people don't think it's new features
are necessary. It is perfectly fine to use it in a commercial
environment however.

- Craige

On 2/2/07, Richard Lynch [EMAIL PROTECTED] wrote:

On Thu, February 1, 2007 5:13 pm, Eric Gorr wrote:
 I haven't tracked this particular issue, but I know when PHP5 was
 first released is wasn't recommended in a commercial/production
 environment. However, a lot of time has passed and we're at v5.2
 now...have things changed? Have GoogleYahoo, for example, moved to
 PHP5? Or is PHP4 still the recommendation for such environments?

Do you need XML processing or SOAP?

What are your performance requirements?

Are there features in Apache 2 that you need?

Are you using only PHP extensions that are known to be [probably]
thread safe?

You've grossly under-documented your needs, to the point that nobody
can answer your question very well.

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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




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



[PHP] Re: REST, SOAP or XML-RPC?

2007-02-04 Thread Gregory Beaver
Paul Scott wrote:
 I am developing a webservice like module for our framework that will
 enable downloads of module code into the framework modules from a remote
 server.
 
 Basically what this should do is:
 
 1. User requests a list of available stable modules from server
 2. User clicks on install from the returned list
 3. Client code will download a tgz/zip module and plonk it in the users
 modules directory (taken care of)
 4. Framework then unzips/untars it and installs (taken care of)
 
 My question here is...
 
 For the server/client code, I am thinking around REST (much the same way
 as the PEAR channel server works). Is this the wisest choice? Should I
 rather go with FTP or a mail request or something? If I go for FTP, that
 will require the PHP FTP extension, how common is that in shared hosting
 environments? 
 
 The file size of a typical  module is around 100k, and we must take into
 account that this is in/for bandwidth starved Africa. Is REST/SOAP
 robust enough to do that?
 
 Any help would be greatly appreciated!

Hi Paul,

Why not use PEAR itself?  The last chapter of my book
(http://www.packtpub.com/book/PEAR-installer) is a step-by-step tutorial
on designing just such a module that would allow downloads of module
code from a remote server.  It also includes all the code, which is
publicly and freely available from the pear.chiaraquartet.net channel
(package MyBlog).  The code is a useful example of embedding the PEAR
installer and of designing customized REST, but it might be tricky to
understand the design methodology without the prose of the book.

The question of how to do what you describe is something I have thought
about a LOT because of the requirements of the PEAR Installer.  One of
the specific design choices in PEAR 1.4.0 and newer was to make it easy
to embed PEAR to act as a plugin module.

The chapter in question also examines other successful attempts to
design remote plugin repositories including Serendipity's Spartacus and
Seagull's use of the PEAR Installer to show other ways of implementing a
plugin manager.  One thing I found very interesting was that even though
Spartacus is extremely lightweight, it was easy to design a much more
sophisticated plugin manager using PEAR with the same number of lines of
code.

You need not use PEAR's actual installation process unless you find it
convenient (I do - file transactions are a must-have if you want to be
able to recover from botched downloads and so on).

In any case, do check out the solution in the book, I'm sure it will
solve the problem you describe quite elegantly.

Good luck,
Greg

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



Re: [PHP] Stuffing code into variable

2007-02-04 Thread Richard Lynch
On Sat, February 3, 2007 9:09 pm, Albert Padley wrote:
 It's late and I've been at this a long time today so I throw myself
 on the mercy of the list.

 I have an echo statement that I use in conjunction with a MySQL query.

 echo tr\ntd class=\tabletext\ . $row['time'] . /td\ntd
 class=\tabletext\ . $row['field'] . /td\ntd class=\tabletext
 \ . $row['division'] . /td\n;

 This works perfectly fine. However, I will be using the same code
 numerous times on the page and wanted to stuff it all into a
 variable. At this point I can't remember the proper syntax and
 quoting to get this right. Any takers?

If you just want all that in a variable, you can do:

$variable = tr\n...;

Presumably, however, when you use that same thing again, you want the
variables to be substituted in with their current values.

AFAIK, there's no good/easy way to do that, except for using 'eval' --
And you almost for sure don't want to do that for something this
simple.

You could, however, quickly write a print_row function that you
could call from anywhere in the script, and that would probably be the
best solution.

The fact that you need to use this same bit over and over in your page
makes me wonder if you aren't doing something fundamentally wrong in
the first place...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Read file on file system

2007-02-04 Thread Richard Lynch
On Sun, February 4, 2007 7:47 am, Bagus Nugroho wrote:
 If I have file on[windows] c:\test.csv.
 How I can read the entire contents of this file?

 I have try file_get_contents, fgetcsv and etc but didn't work.
 May I'm mis-understanding about using those function.

Define didn't work

Because all of them should have been fine...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Billing client for studying documentation

2007-02-04 Thread Richard Lynch
On Sat, February 3, 2007 8:09 pm, Mike Mannakee wrote:
 I have a php project I have been working on for several months.  The
 client's requirements have expanded to include interfacing to an
 online
 service using xml, which I was familiar with but have never worked
 with
 prior to this project.  I have spent a good number of hours reading up
 on
 xml, and learning how to use it to integrate with this online service.
  I
 have also spent hours poring over hundreds of pages of documentation
 for the
 online service itself.

 My question is this - should I be billing the client for this time?
 It is
 needed to properly work with this framework, but it is not programming
 time
 in itself.  Googling the topic has been useless.

You should probably discuss it with the client...

Actually, you should have discussed it before you started researching.
:-v

That said, you can probably safely invoice for a few hours of XML
research, but it shouldn't be big enough to be more than a line item
in the whole project invoice.

On the plus side, acquiring knowledge is always expensive, and almost
always worth the expense. :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] include file identifier

2007-02-04 Thread Richard Lynch
On Sat, February 3, 2007 7:05 pm, Eli wrote:
 Does any included file in PHP have a unique identifier? (like a stack
 of
 includes identifier).

Down in the guts of PHP source, there may be some kind of file handler
which is unique...

But nothing I'm aware of exposes this to ?php ? code in any way,
other than http://php.net/include_once

 If the files names are different, then __FILE__ can be used as an
 identifier. But if a file was included by itself, then __FILE__ is the
 same, tho there are 2 different includes of the same file.

 Example:
 === a.php
 ?php
 echo \nRunning .__FILE__. (id=X)!\t;
 if (!$visited) {
   echo You are visiting here!;
   $visited = true;
   include(__FILE__);
 }
 else {
   echo You have been already visiting here! (Bye);
 }
 ?

 -thanks, Eli

If you want to avoid the overhead of include_once, it's a pretty
common practice (borrowed from C .h files) to do:

if (!defined('FILENAME')){

define('FILENAME', 1);
//rest of code here

}

It is entirely up to YOU to make sure FILENAME is unique for your
application/project...  Which can become problematic when integrating
large packages.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Pop up window in PHP code

2007-02-04 Thread Richard Lynch
PHP neither supports nor fails to support JS.

PHP just spits out something for the browser.

Use View Source in the browser and see what you've done.

Fix the PHP until you get what you want in the View Source to make
the JS work.

On Sat, February 3, 2007 2:44 pm, Chris Carter wrote:

 I am trying to open a Java script pop up widow from within the php
 code. Not
 able to get it done, the error I think is in the use of  '' .. I
 mean
 double and/or single quote. Do not know how to place those. Please
 advice.
 The code is below:

 echo 
 tr
 td$shopname /td
 td$category /td
 td$subcategory /td
 td$level /td
 td javascript:poptastic( Details /td
 /tr;
 $i++;

 The Javascript code is:

 script language=javascript
 var newwindow;
 function poptastic(url)
 {
   
 newwindow=window.open(url,'name','height=490,width=900,left=150,top=175');
   if (window.focus) {newwindow.focus()}
 }
 /script

 The javascript code works perfect with other pages and within HTML,
 its just
 that the PHP is not supporting the quotes and double quotes. I have
 even
 tried rsquo rdquo and all.

 Thanks in advance
 --
 View this message in context:
 http://www.nabble.com/Pop-up-window-in-PHP-code-tf3167481.html#a8786668
 Sent from the PHP - General mailing list archive at Nabble.com.

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Regex Mixtake

2007-02-04 Thread Richard Lynch
On Sat, February 3, 2007 12:58 pm, Manolet Gmail wrote:
 anyway, PCRE is better that ereg?

Yes!

Faster, easier, more flexible, and better documented.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Re: REST, SOAP or XML-RPC?

2007-02-04 Thread Paul Scott

On Sun, 2007-02-04 at 23:00 -0600, Gregory Beaver wrote:
 Why not use PEAR itself?  The last chapter of my book
 (http://www.packtpub.com/book/PEAR-installer) is a step-by-step tutorial
 on designing just such a module that would allow downloads of module
 code from a remote server.  It also includes all the code, which is
 publicly and freely available from the pear.chiaraquartet.net channel
 (package MyBlog).  The code is a useful example of embedding the PEAR
 installer and of designing customized REST, but it might be tricky to
 understand the design methodology without the prose of the book.

Greg,

Thanks. I have actually already set up a PEAR channel server a year (or
more) back when the channel server code was first released. I never
really got round to playing with it much, but now seems as good a time
as any! ;)

My vision was to actually package the entire framework and all modules
as packages on that server, but at the time, I was really busy, and
didn't really look into it as hard as I should have...My main concern
was that some of our users/partners were struggling with installing PEAR
as it was, and our framework is basically glue that holds *most* of the
PEAR packages together and then some on top of that.

If there is a more elegant way of integrating the PEAR installer etc
into the framework, as a plugin module, you would have answered my
prayers!

I will take a look at your book as well. Is there somewhere I can buy it
from as well? We are soft funded GPL project, and as such we have a huge
budget for literature that we hardly use. I would like to support PEAR
and its developers in other ways too (not just patches, bug reports and
testing...)

I will hack around with the code a while and see what I can come up
with. I don't really want to spend so much time on this that it becomes
a mission, and I _know_ that PEAR works elegantly...

Thanks again for your input. I will let you know what happens.

--Paul



All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] REST, SOAP or XML-RPC?

2007-02-04 Thread Paul Scott

On Sun, 2007-02-04 at 23:00 -0600, Richard Lynch wrote:
 Presumably one can choose to install only some of the options.
 
 Of course, now you're into the wonderful land of module
 dependencies...  Good luck!
 

Module dependencies are sorted out by the framework already. We have
modelled our dependency issues around debian's aptitude, although in
text/php...

 REST should be fine.
 
 You should perhaps design it modularly enough that swapping in SOAP or
 RPC would not be too difficult.
 

Yes, I think that that would probably be wise. Most of our code is
designed in this way anyway, like we have 3 different WYSIWYG editor
choices as well...

 I don't think you'll need FTP in PHP...
 
 Your client code can just download with fopen/fread, same as it
 already is doing the tar.gz files...
 
 You're more likely to be bitten by hosts turning off allow_url_fopen
 though.

Oh yeah, forgot about that one!

 I believe REST is the most light-weight bandwidth of the REST/SOAP/RPC
 crowd...

I believe so too. I am taking a look at hacking around with the PEAR
channel server code.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Matching numbers 1-100

2007-02-04 Thread Richard Lynch
On Sat, February 3, 2007 11:09 am, Wikus Moller wrote:
 I want to know if anyone can help me with my code which matches a
 number to a range e.g. 1-15 and echoes an image if the number is in
 the range.

 The code would use the if statement and check if a variable for
 example 5  matches the range like 4-10 and if it does it echoes a
 certain image.

 Anyone know which function I should use and what regex I should use?

This sounds a heck of a lot like a homework assignment...

Oh well.

?php
$input = '42';
$number = (int) $input; //make sure it's a number
if ($number = 1 and $number = 15) echo an image;

This will be problematic if you need to detect '0', since 'a' turns
into '0' in the typecast.  In that case, you'd want
http://php.net/pcre


-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Help with matching numbers 0-100

2007-02-04 Thread Richard Lynch
On Sat, February 3, 2007 10:55 am, Chilling Lounge Admin wrote:
 I need help with matching a variable. The variable would be e.g. 0-15
 , 16-30 etc. and when the variable is equal to a certain range, it
 would echo an image.

 Does anyone know what function I should use? preg_match?

 The code would be something like

 if(preg_match([16-30],$variable))
 {
 echo image;
 }

 but the above code doesn't work. How do I fix it?

Deja Vu!

?php
if (!preg_match('/^[0-9]+$/', $input)){
  die(invalid input\n);
}
$input = (int) $input;
switch (true){
  case $input  0: die(invalid input\n); break;
  case $input = 15: echo image 1 to 15\n; break;
  case $input = 30: echo image 16 to 30\n; break;
  default: die(invalid input\n); break;
}
?

If this is homework, you'd better go hire a tutor NOW, because it
ain't gonna get any easier than this...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] is there socket.so file?

2007-02-04 Thread Richard Lynch
On Sat, February 3, 2007 10:18 am, Yeni Setiawan wrote:
 Hi there,
 I'm currently writing an IRC bot using php (CLI) and get a little
 problem.

 For windows version, I need to enable socket extension (socket.dll)
 and
 my bot will be able to connect to an IRC server.

 But in linux version, it's unable to connect. So I wonder if there's a
 
 socket.so or something else
 to activate socket extension.

 And the question is, do I need socket extension in Linux?

The answer is Yes but the rest of the answer depends on your version
of PHP more than anything else...

http://php.net/sockets

lays that out rather nicely, actually.

Did you do *any* research at all on this?...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Executing scripts from a table

2007-02-04 Thread Richard Lynch
On Sat, February 3, 2007 9:32 am, Ken Kixmoeller -- reply to
[EMAIL PROTECTED] wrote:

 On Feb 2, 2007, at 6:59 PM, Richard Lynch wrote:

 Putting PHP source into MySQL is the WRONG way to go for security
 and
 efficiency...

 Thank you, Richard -- I appreciate your advice.

 Here is a qualifier: I'm not putting any core code into tables, just
 code which generates page content. The access rights to that page
 content, as well as security code and application objects are not
 there. That code is off of the web path, called by functions. No SQL
 is in tables. So maybe I shouldn't have said security.

 With that in mind -- I would really appreciate it if would help me
 understand your comment or point me to a resource which will. I have
 read a bunch of stuff on security, but no resources led me to believe
 that I was on a wrong path, though none of them followed the path I
 am on. It isn't too late for me to change.

The problem is that now instead of needing to protect your PHP files
from arbitrary code execution attacks, you need to protect your PHP
files *and* your database content, so you've just doubled the number
of potential holes, roughly speaking.

It doesn't matter if YOU put core code into your DB or not -- If
somebody manages to break into your DB, they can put whatever code
they want, and you're just going to execute it blindly.

In terms of performance, running a query to get some PHP snippet and
then using eval on it is probably not going to hold up under any kind
of load...  Or maybe it will -- Seems like eval should be expensive,
but perhaps I'm just remembering what it cost in Lisp...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Jabber conection manager

2007-02-04 Thread Richard Lynch
On Sat, February 3, 2007 9:07 am, chetan rane wrote:
 i want to develop a Jabber connection manage its role will be

 1. accept HTTp request from the Client
 2. establish connection with a jabber server using TCp
 3. and later start the instant mechanism between them

 has any one worked on this please let me know how to do it

Is it just me, or did you ask a question last week where the answer was:
http://php.net/sockets

And earlier today you asked a question where the answer is:
http://php.net/sockets

And, now, this question, whose answer is:
http://php.net/sockets

After that, have you read:
http://php.net/sockets

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Graphs

2007-02-04 Thread Richard Lynch
On Sat, February 3, 2007 1:53 am, frank wrote:
 yes it does a great job, almost every parameter even for the legend
 can be
 influenced by its methods and properties. i say jp graph is the best

In my limited experience, I was able to influence every parameter,
but not get the dang thing to show up where I wanted it. :-)

The relationship between what I typed and what showed up was never
quite what I expected...

When I had put in more time dinking around with it and failing than it
would have taken to just hand-code it in GD, I gave up.

YMMV
NAIAA
IANAL

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Sending secure mail

2007-02-04 Thread Ligaya A. Turmelle
IIRC the PEAR::Mail_Mime class also can handle it 

Respectfully,
Ligaya Turmelle
Systems Analyst
Guamcell Communications
Phone: (671)689-2377 
-Original Message-
From: Rob [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 05, 2007 10:23 AM
To: php-general@lists.php.net
Subject: [PHP] Sending secure mail

I need to send a large number of emails (not spam!) through an external
SMTP server that requires TLS and a username/password. I have some
control over the SMTP server but very little over the web server where
the scripts reside. How do I connect with TLS, authenticate and send the
mail?

I had problems with mail() originally (one of the reasons why we now
have a dedicated mail server) and I had to connect to the SMTP server by
hand with sockets and go through the SMTP steps by hand. I can connect
to the new server with following code.

$sock = fsockopen( 'smtp.eg.com', 25, $errNo, $errStr );

However, when I send the rcpt to: line, I'm told I don't have access
to the relay - i.e. I need to log in. This is where my knowledge of SMTP
reaches it's limit but I've read about the auth login command,
however, it says it needs to be run over an encrypted connection, i.e.
TLS. I can't disable this on the server, other services need TLS to be
on the SMTP server.

I've tried changing smtp.example.com to tls://smtp.example.com but
it then fails to connect at all ($errNo is 115, $errStr is Operation
now in progress). If I connect and send starttls, I don't get any more
data from the server and I've no idea what it's waiting for, be it a
public key or whatever. FWIW, the email server's certificate is a dodgy,
home made one which throws up a security error when tested with a mail
client, but once accepted it is fine.

Is there an easier way to do this? If not, how do I get the connection
so I can get to and rcpt to: line and beyond?

Thanks,
Rob

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