RE: [PHP] creating a mailing list

2004-04-29 Thread Chris W. Parker
chris o'shea mailto:[EMAIL PROTECTED]
on Thursday, April 29, 2004 2:44 AM said:

 Does anybody know the best way of doing a mass mail through php?

i recall a solution being to write a properly formatted email and dump
it into server's outgoing queue allowing the MTA (sendmail, exim,
postfix*) to distribute the emails as it sees fit.


hth,
chris.

* i think these are all MTA's.

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



[PHP] Re: $_SERVER['SERVER_NAME'] in read-only.

2004-04-29 Thread Red Wingate
AFAIK the content of the superglobal variables cannot be changed ( even
though i haven't found this in the docs i can remeber got beaten by PHP
for doing so :-) )
Back to the problem ( if existent ):

If you don't do stuff like '$_SERVER['SERVER_NAME'] = ;' inside your
script you won't run into trouble - I know some ppl like to use such
strange work-arounds ;-)
Otherwise using
define ( 'SERVER_NAME' , $_SERVER['SERVER_NAME'] );
right at startup will usually solve your problem ( as workarounds will
most likely kill other scripts if the SERVER_NAME is diffrent :-))
  -- red

[...]
Hello,

I am using the variable $_SERVER['SERVER_NAME'] inside a function, for 
example:

function check_servname() {
  global $server ;
  if($_SERVER['SERVER_NAME'] != $server) {
 echo NOT OK, NOT GOOD SERVER NAME ;
 exit ;
   }
}
But we can modify the value of $_SERVER['SERVER_NAME'] before calling 
the function check_servname(). And I am looking for a the right server 
name not for a server name which may have been changed before calling 
check_servername:
$_SERVER['SERVER_NAME'] = www.google.com ; //before calling 
check_servname and $_SERVER['SERVER_NAME'] will be www.google.com 
inside the function even the server name is not www.google.com.

Is there any way to get the server name with a variable which would be 
read-only ?

Thanks,
Vincent.


Agreed - constants are the way to do this.  I wanted to mention that the 
$_SERVER variables are meant to hold values generated by your server. Of 
course if you really ARE google then I'm going to feel stupid for even 
mentioning this :)

http://www.php.net/reserved.variables
[...]

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


Re: [PHP] variable-length arguments passed by reference... how?

2004-04-29 Thread Aric Caley
Marek Kilimajer wrote:

But workaround would be to call your function with array():

Thanks, I was afraid that might be the only way.  I guess its possible 
if you write an extension (like mysqli) in C?

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


Re: [PHP] Re: global vars inside includes inside functions?

2004-04-29 Thread Tom Rogers
Hi,

Friday, April 30, 2004, 1:29:12 AM, you wrote:
RW [...]
 ?
 function safeInclude($file) {
RW [...]

RW  foreach ( $GLOBALS AS $k = $v ) {
RW  $$k = $v ;
RW  }

RW [...]
 if(file_exists($file)) {
 include($file);
 } else {
 debug(file $file not found);
 }
 }
 ?
RW [...]

RW (better, as no eval-syntax is required)

RW-- red
That makes local copies only, still no access to the global variable

The other thing to consider is that everything dies at the conclusion of
the function. It may be better to do this via a class construct

-- 
regards,
Tom

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



Re: [PHP] Re: global vars inside includes inside functions?

2004-04-29 Thread Red Wingate
Again ain't no problem anyway

foreach ( $GLOBALS AS $k = $v ) {
$$k = $GLOBALS[$k] ;
}
zap you are done ... again when using a function to include
a file with relying on depts within the file you would most
probably use a registry-pattern or similar to access the required
variables.
  -- red

That makes local copies only, still no access to the global variable

The other thing to consider is that everything dies at the conclusion of
the function. It may be better to do this via a class construct
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Using HTTP_REFERRER to ensure forms posted from server

2004-04-29 Thread Chris Shiflett
--- Terence [EMAIL PROTECTED] wrote:
 To avoid malicious users creating their own forms and posting to my
 site, is it advisable to use the $_SERVER['HTTP_REFERRER'] to ensure
 that posted forms only come from the intended source? Anyone out there
 using this?

Hopefully not. :-)

Referer is just as easy to spoof as the form data you're expecting.

What you're wanting to do is prevent spoofed form submissions, and New
York PHP has a nice resource that I encourage you to read:

http://phundamentals.nyphp.org/PH_spoofed_submission.php

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] variable-length arguments passed by reference... how?

2004-04-29 Thread Tom Rogers
Hi,

Friday, April 30, 2004, 1:40:26 AM, you wrote:
AC I want to create a function similar to the MySqli extensions' 
AC mysqli_stmt_bind_param() function.  I assume that this function takes
AC its arguments passed by reference.  Now, I know how to do variable
AC length argument lists in a function with func_get_arg(s) but how do I
AC tell it that they are to be passed by reference?

Just make them all references, if it was expecting a copy it will just
get a reference to a copy, if it was expecting a reference it will get
one. I do a similar trick in a class loader I use that copes with
variable length argument lists and passing by reference.

A bit like this

$num_args = func_num_args();
$arg_list = func_get_args();
$vars = 'function_to_call(';
for ($i = 0; $i  $num_args; $i++) {
  $vars .= ($i  0)? ',':'';
  $varname = 'variable'.$i;
  $$varname = $arg_list[$i];
  $vars .= \$$varname;
}
$vars .= ');';

//that leaves you with a string you can use eval on
eval($vars);


-- 
regards,
Tom

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



Re: [PHP] Re: $_SERVER['SERVER_NAME'] in read-only.

2004-04-29 Thread John W. Holmes
From: Red Wingate [EMAIL PROTECTED]

 AFAIK the content of the superglobal variables cannot be changed ( even
 though i haven't found this in the docs i can remeber got beaten by PHP
 for doing so :-) )

They can be changed and you can even add to them.

$_SERVER['foo'] = 'bar';

is valid and now it's a superglobal, too. I wouldn't recommend relying on
this, though.

If you talking about the users changing the values of of superglobals then
that's different. Users can't directly set $_SERVER values, for example, but
they can pass values that may influence them. $_SERVER['HTTP_REFERRER']
comes from what the user supplies, for instance, so they are able to
manipulate it. A user would not be able to set $_SERVER['SERVER_NAME'] or
$_SERVER['PHP_SELF'], though. Which ones are safe or not just takes some
research or asking. :)

---John Holmes...

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



Re: [PHP] Listing all id's in array

2004-04-29 Thread Torsten Roehr
Alex Hogan [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have asked a lot of questions in the last few weeks, but I do try to
 preface those questions by checking out the php.net online manual first.

 Anyway, here is one way to do it.  There are probably more elegant
 solutions, but I don't know off hand what they are.

 $model  = array();

 $query  = SELECT product_id
 FROM products;
 $result = mysql_query($query) or die(error in query);
 $i  = 0;
 while($row = mysql_fetch_array($result)){
 $model[$i] = $row['product_id'];
 $i++;
 }

I think $i is not needed here. If you add it to the array with $model[] =
... PHP will automatically use and increment an integer for the key.

Regards, Torsten


 print_r($model);




 alex hogan


  -Original Message-
  From: Phpu [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, April 28, 2004 3:01 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Listing all id's in array
 
  I want to list all the product id's af the database in an array, but i
do
  not how.
 
  I have this script but it is not working:
 
  $model = array();
 
  $query = SELECT product_id FROM products;
  $result = mysql_query($query) or die(error in query - $query -
  .mysql_error());
  while (list($product_id) = mysql_fetch_array($result)) {
  $model = $product_id;
  }
 
  echo $model;
 
 
  Plese someone tell me how to do it...
 
  Thanks



 **
 The contents of this e-mail and any files transmitted with it are
 confidential and intended solely for the use of the individual or
 entity to whom it is addressed.  The views stated herein do not
 necessarily represent the view of the company.  If you are not the
 intended recipient of this e-mail you may not copy, forward,
 disclose, or otherwise use it or any part of it in any form
 whatsoever.  If you have received this e-mail in error please
 e-mail the sender.
 **




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



Re: [PHP] variable-length arguments passed by reference... how?

2004-04-29 Thread Jason Barnett
A bit like this

$num_args = func_num_args();
$arg_list = func_get_args();
$vars = 'function_to_call(';
for ($i = 0; $i  $num_args; $i++) {
  $vars .= ($i  0)? ',':'';
  $varname = 'variable'.$i;
  $$varname = $arg_list[$i];
  $vars .= \$$varname;
}
$vars .= ');';
//that leaves you with a string you can use eval on
eval($vars);

I know I'm probably paranoid, but eval() always bugs me.  I think for 
what you want to do you can use call_user_func_array()

$args = func_get_args();
call_user_func_array('function_to_call', $args);
http://www.php.net/manual/en/function.call-user-func-array.php

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


[PHP] Re: Single quotes inside double quoted string (Was: Re: [PHP] Re: Problem with a class... any help will be appreciated.)

2004-04-29 Thread Torsten Roehr
Elliot J. Balanza [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Actually you are right the problem is not in the proccess of writing to
the
 database, the problem is that after writing to the database it wont jump
 to the next function it wont go to login() or any other function for this
 matter.

If $this-login() is not called then this line does not evaluate to true:

if(md5($pass)==$row_revisa['Password']) {

Have you printed out both values to see if they are equal?

Regards, Torsten

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



[PHP] how to verify PHP has been installed with ldap?

2004-04-29 Thread Bing Du
Greetings,

I've installed PHP with ldap.  But I got this error Fatal error: Call to
undefined function: ldap_connect() in /home/me/public_html/test1.php on
line 5.  Why ldap_connect() is undefined?

This is what I did:

==
# ./configure --with-apxs=/usr/local/apache/bin/apxs
--with-config-file-path=/usr/local/apache/php.ini --with-mysql --with-zlib
--with-ldap
# make
# make install
==

It went through without obvious errors.

And this is the PHP script test1.php that generates the above error:


?php
$dn=cn=john smith, ou=Users, ou=eng,dc=iastate, dc=edu;
$password = ok4now;

if (!($ldap = ldap_connect(w2kdc1.eng.some.edu, 389))) {
die (Could not connect to LDAP server);
}
if (!($res = @ldap_bind($ldap, $dn, $password))) {
die (Could not bind to $dn);
}
echo bind fine!;
?


So my question is how to verify PHP has been installed with ldap support?

Thanks in advance for any help,

Bing

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



php-general Digest 29 Apr 2004 20:35:55 -0000 Issue 2734

2004-04-29 Thread php-general-digest-help

php-general Digest 29 Apr 2004 20:35:55 - Issue 2734

Topics (messages 184930 through 184970):

Re: global vars inside includes inside functions?
184930 by: De Greef Sébastien
184953 by: Red Wingate
184962 by: Tom Rogers
184963 by: Red Wingate

web page existance check
184931 by: Decapode Azur
184932 by: Vinod Panicker

creating a mailing list
184933 by: chris o'shea
184935 by: Vinod Panicker
184936 by: Chris Hayes
184959 by: Chris W. Parker

Re: Problem with a class... any help will be appreciated.
184934 by: Marius Dascalu

Single quotes inside double quoted string (Was: Re: [PHP] Re: Problem with a class... 
any help will be appreciated.)
184937 by: John W. Holmes
184942 by: Elliot J. Balanza
184969 by: Torsten Roehr

Changing passwords
184938 by: Jason Barnett
184948 by: Jason Sheets

$_SERVER['SERVER_NAME'] in read-only.
184939 by: Vincent M.
184940 by: Jay Blanchard
184941 by: Jason Barnett
184960 by: Red Wingate
184966 by: John W. Holmes

Re: Nonsense mail
184943 by: Elliot J. Balanza
184952 by: trlists.clayst.com

__toString or not __toString
184944 by: Thomas Björk
184945 by: Thomas Björk
184946 by: Thomas Björk

Re: GD support
184947 by: Marek Kilimajer
184950 by: Anton Krall

Re: php code in a .js file?
184949 by: Craig Donnelly

Re: Fetching XML for parsing
184951 by: Pablo

variable-length arguments passed by reference... how?
184954 by: Aric Caley
184955 by: Aric Caley
184956 by: Marek Kilimajer
184957 by: Jay Blanchard
184958 by: Marek Kilimajer
184961 by: Aric Caley
184965 by: Tom Rogers
184968 by: Jason Barnett

Re: Using HTTP_REFERRER to ensure forms posted from server
184964 by: Chris Shiflett

Re: Listing all id's in array
184967 by: Torsten Roehr

how to verify PHP has been installed with ldap?
184970 by: Bing Du

Administrivia:

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

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

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


--
---BeginMessage---
normally you just put
global $something;
at the begining of your function..
Like this
function safeInclude($file) {
global $something;
 if(file_exists($file)) { include($file);
 } else {
 debug(file $file not found);
 }
 }


Justin French [EMAIL PROTECTED] a écrit dans le message news:
[EMAIL PROTECTED]
 Can someone see a way to achieve what I want?

 I have the following function:

 ?
 function safeInclude($file) {
 if(file_exists($file)) {
 include($file);
 } else {
 debug(file $file not found);
 }
 }
 ?

 When used in this context...

 ?
 $something = 'foo';
 safeInclude('somethingElse.inc');
 ?

 ... somethingElse.inc cannot see the global variable $something.


 So, if an include is wrapped in a function, it would appear that the
 global variables no longer apply to the namespace of the included file.

 Is there anyway I can get around this?

 My only guess is I could add the line global $GLOBALS; to
 safeInclude(), but I have no idea how this affects memory usage or
 anything else.



 ---
 Justin French
 http://indent.com.au
---End Message---
---BeginMessage---
[...]
?
function safeInclude($file) {
[...]

foreach ( $GLOBALS AS $k = $v ) {
$$k = $v ;
}
[...]
if(file_exists($file)) {
include($file);
} else {
debug(file $file not found);
}
}
?
[...]

(better, as no eval-syntax is required)

  -- red
---End Message---
---BeginMessage---
Hi,

Friday, April 30, 2004, 1:29:12 AM, you wrote:
RW [...]
 ?
 function safeInclude($file) {
RW [...]

RW  foreach ( $GLOBALS AS $k = $v ) {
RW  $$k = $v ;
RW  }

RW [...]
 if(file_exists($file)) {
 include($file);
 } else {
 debug(file $file not found);
 }
 }
 ?
RW [...]

RW (better, as no eval-syntax is required)

RW-- red
That makes local copies only, still no access to the global variable

The other thing to consider is that everything dies at the conclusion of
the function. It may be better to do this via a class construct

-- 
regards,
Tom
---End Message---
---BeginMessage---
Again ain't no problem anyway

foreach ( $GLOBALS AS $k = $v ) {
$$k = $GLOBALS[$k] ;
}
zap you are done ... again when using a function to include
a file with relying on depts within the file you would most
probably use a registry-pattern or similar to access the required
variables.
  -- red

That makes local copies only, still no access to the global variable

The other thing to consider is that everything dies at the conclusion of
the function. It may be better to do this via a class construct
---End Message---
---BeginMessage---
Hello,


[PHP] Re: how to verify PHP has been installed with ldap?

2004-04-29 Thread Jason Barnett

So my question is how to verify PHP has been installed with ldap support?

Thanks in advance for any help,

Bing
?php phpinfo() ?

or, more specifically:

?php

$loaded = extension_loaded('ldap');
echo 'The ldap extension is ' . $loaded ? 'loaded' : 'not loaded';
?

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


[PHP] Midgard anyone?

2004-04-29 Thread Adrian Madrid
Has anyone dabbled long enough to figure out Midgard? I've been meaning 
to evaluate the Framework and CMS for a long time and I think I have the 
time now to do it. Nevertheless, I would like to get  a heads up on it 
before jumping in. Any comparisons to other CMSs/Frameworks?

Thanks in advance,

--
Adrian Madrid
http://www.hyperxmedia.com
HyperX Media
45 West 9000 South, Unit 2
Sandy, UT 84020
Office: 801.566.0670

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

Re: [PHP] how to verify PHP has been installed with ldap?

2004-04-29 Thread John W. Holmes
From: Bing Du [EMAIL PROTECTED]

 So my question is how to verify PHP has been installed with ldap support?

?php phpinfo(); ?

And see if there is an ldap section.

---John Holmes...

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



Re: [PHP] php code in a .js file?

2004-04-29 Thread Marek Kilimajer
Craig Donnelly wrote:
Why not just use a .php instead of a .js?

script language=Javascript src=jsscript.php/script

Regards,

Craig
That was what I meant ;)

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


Re: [PHP] how to verify PHP has been installed with ldap?

2004-04-29 Thread Bing Du
I don't see a ldap section in the output of phpinfo().  I need to add a
bit more background information here...

This is not a fresh php install.  I've already installed PHP Version
4.3.4.  But now I want to add ldap support to it.  So I added --with-ldap
option in the configure command.  Then I did make and make install. 
However, phpinfo() still shows the old information.  For instance, Build
Date was Mar 3 2004 11:15:34, Configure Command was the one without
--with-ldap, etc..

I removed config.cache before doing configure/make/make install and also
restarted the apache server, but nothing helped.  Do I need to do anything
on the apache server?

What did I do wrong?

Bing

 From: Bing Du [EMAIL PROTECTED]

 So my question is how to verify PHP has been installed with ldap
 support?

 ?php phpinfo(); ?

 And see if there is an ldap section.

 ---John Holmes...


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



Re: [PHP] Help please.

2004-04-29 Thread Elliot J. Balanza
JUST FOR ALL OF YOU OUTTHERE TO KNOW...

the problem was that site had Frontpage 2002 extensions installed.
Incredibly enough, that was sufficient not to accept the files.

Thanks again to all that answered.

Vamp


Jason Sheets [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 Check the filesystem permissions of the destination folder to make sure
the
 web server user has write access to it.

 What does line 20 of
 d:\inetpub\sites\www.kamasutra.com.mx\web\mbt\includes\photographs.php
 attempt to do.

 With NTFS filesystems you must always remember to set the filesystem
 permissions (just like you have to in Unix).

 Jason

 -Original Message-
 From: Elliot J. Balanza [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 28, 2004 8:03 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Help please.

 Hi, I'm running the same class in two different sites on the same sever
 (apparently under the exact same conditions) yet one server sends me an
 error

 Warning:
 copy(d:/inetpub/sites/www.kamasutra.com.mx/web/fotos/bobl-39409.jpg):
failed
 to open stream: Permission denied in
 d:\inetpub\sites\www.kamasutra.com.mx\web\mbt\includes\photographs.php on
 line 20



 whenever I try to upload an image while the second one does loads it. This
 is driving me crazy, any ideas?

 Help will be appreciated.

 Vamp

 --
 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: Single quotes inside double quoted string (Was: Re: [PHP] Re: Problem with a class... any help will be appreciated.)

2004-04-29 Thread Elliot J. Balanza
Yes actually the same proccess in the first script works.

If i remove the $this-login(); instruction and write the instruction within
the if works also... the only thing not working is the $this-login().
Torsten Roehr [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 Elliot J. Balanza [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Actually you are right the problem is not in the proccess of writing to
 the
  database, the problem is that after writing to the database it wont
jump
  to the next function it wont go to login() or any other function for
this
  matter.

 If $this-login() is not called then this line does not evaluate to true:

 if(md5($pass)==$row_revisa['Password']) {

 Have you printed out both values to see if they are equal?

 Regards, Torsten

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



[PHP] Re: call_user_func possible bug in PHP5Rc1 PHP5RC2, am I crazy?

2004-04-29 Thread Vincent A. Wixer
Curt, Ben,

Thank you for your thoughts.

Actually, [EMAIL PROTECTED] addressed this via bugs at 
http://bugs.php.net/bug.php?id=28189  .

[27 Apr 11:47pm CEST] [EMAIL PROTECTED]
The behavior that's new in PHP 5 isn't the inability to
call a method by call name instead of instance. It's
that if you do so, PHP treats it as a static method
call. When a static method is invoked in PHP 5, you
cannot reference $this because it no longer exists and
was never meaningful in the first place.
In light of this statement and further testing in PHP4, I'm not sure if 
an object was being instantiated or not.  It certainly didn't pipe up 
with an error.

However, my intention was to call call_user_func with the assumption 
that it would instantiate the class with the default constructor and any 
default arguments defined in the method signature of the constructor (in 
 my example, none) and call an the specified instance method because 
... wait for it ... it was defined as an instance method not a static 
method.

What was tripping me up was that neither the PHP4 manual description of 
this function nor Zeev's 3rd Edition of Core PHP5 indicate that any 
method of a class would be called statically even if it was not defined 
in the class as static.  Basically, the change in behavior between PHP4 
and PHP5 was very surprising to me.

IMHO, I believe that such behavior is fundamentally disconnected from
the perpetrated behavior of accepted practices.
ie, if I wanted a method to be called statically, I would have defined 
it statically.

ie, if the method signature of an object defines it as an instance 
method, I kind of expect it to ONLY ever be called or callabe as an 
instance method.

Ben Ramsey wrote:
snip
I would suggest that you read up on object-oriented programming and 
learn a little more about how things work.

You really need to do:

$test = new test_call_user_func();

to create the object.  Then you can use $test to access the methods of 
that object.
Actually, the intention was to allow some tightly coupled delegation via 
SOAP.  I know, tight coupling is asking for it on long term maintainence 
but I really didn't have a say in some of the architecture.

I haven't found an equivalent of Java's Class.forName(String 
Name_of_class_to_be_instantiated), so I thought call_user_func would 
suffice, instantiate a default version of my object, etc etc ...

Anyone else, back me up on this if I'm wrong.
I think that you and Curt are indeed correct about being able to use a 
$this only in an instance.

My issue is that I have not yet found anywhere were this change of 
behavior in PHP5 that [EMAIL PROTECTED] describes is documented.

If someone could point me to where we all could help with the 
documentation, that'd be great.

V

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


Re[2]: [PHP] variable-length arguments passed by reference... how?

2004-04-29 Thread Tom Rogers
Hi,

Friday, April 30, 2004, 3:51:19 AM, you wrote:


JB I know I'm probably paranoid, but eval() always bugs me.  I think for
JB what you want to do you can use call_user_func_array()

JB $args = func_get_args();
JB call_user_func_array('function_to_call', $args);

JB http://www.php.net/manual/en/function.call-user-func-array.php

The only time eval can be a problem is if you use it on client
supplied data otherwise it is no worse than any other function.
How does call_user_func_array() cope with pass by reference ? which is
the op problem.

-- 
regards,
Tom

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



Re: [PHP] Change Permissions in Windows

2004-04-29 Thread Jordi Canals
Stephen Craton wrote:
I don't have a security tab, I don't know why, but it isn't there...

http://www.melchior.us/tabs.gif

Hi Stephen and List,

I don't have an XP Pro at hand now. So, I will tell you how to activate 
the security tab with no exact instructions.

Not having the security tab is the default for XP Pro (Perhaps MS thinks 
Security is not important). To see (and use) it, follow this way:

1. Open any folder, select tools, tools of folder.
2. Go to the Folder View options (Or something like that).
3. There is a box with Advanced Options, there must be one about 
Advanced Rigths (Or something similar) ...
4. This option MUST be checked and you will see the security options on 
any file.

Hope this helps, if not, tell me and I will check on an XP Pro when 
having one near.

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


Re: [PHP] variable-length arguments passed by reference... how?

2004-04-29 Thread Curt Zirzow
* Thus wrote Tom Rogers ([EMAIL PROTECTED]):
 Hi,
 
 Friday, April 30, 2004, 3:51:19 AM, you wrote:
 
 
 JB I know I'm probably paranoid, but eval() always bugs me.  I think for
 JB what you want to do you can use call_user_func_array()
 
 JB $args = func_get_args();
 JB call_user_func_array('function_to_call', $args);
 
 JB http://www.php.net/manual/en/function.call-user-func-array.php
 
 The only time eval can be a problem is if you use it on client
 supplied data otherwise it is no worse than any other function.

It is *very* expensive to use eval, expecially when this has been
said:

  If eval() is the answer, you're almost certainly asking the
  wrong question. -- Rasmus Lerdorf, BDFL of PHP


Here are a couple alternatives:

function argbyref($args) {
$args['arg'] = 'changed';
}
$args['arg'] = 'not changed';
argbyref($args);


function argwitharray($args) {
$args['arg'] = 'changed';
}
$arg = 'not changed';
argwitharray(array('arg' = $arg));


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] Re: call_user_func possible bug in PHP5Rc1 PHP5RC2, am I crazy?

2004-04-29 Thread Jason Barnett
In light of this statement and further testing in PHP4, I'm not sure if 
an object was being instantiated or not.  It certainly didn't pipe up 
with an error.
Unfortunately, no (http://www.php.net/call_user_func):

Object methods may also be invoked statically using this function by 
passing array($objectname, $methodname) to the function parameter.

However, my intention was to call call_user_func with the assumption 
that it would instantiate the class with the default constructor and any 
default arguments defined in the method signature of the constructor (in 
You can do something like this with the Reflection API.

 my example, none) and call an the specified instance method because ... 
wait for it ... it was defined as an instance method not a static method.

What was tripping me up was that neither the PHP4 manual description of 
this function nor Zeev's 3rd Edition of Core PHP5 indicate that any 
method of a class would be called statically even if it was not defined 
in the class as static.  Basically, the change in behavior between PHP4 
and PHP5 was very surprising to me.

IMHO, I believe that such behavior is fundamentally disconnected from
the perpetrated behavior of accepted practices.
ie, if I wanted a method to be called statically, I would have defined 
it statically.

ie, if the method signature of an object defines it as an instance 
method, I kind of expect it to ONLY ever be called or callabe as an 
instance method.

Ben Ramsey wrote:
snip
I would suggest that you read up on object-oriented programming and 
learn a little more about how things work.

You really need to do:

$test = new test_call_user_func();

to create the object.  Then you can use $test to access the methods of 
that object.


Actually, the intention was to allow some tightly coupled delegation via 
SOAP.  I know, tight coupling is asking for it on long term maintainence 
but I really didn't have a say in some of the architecture.

I haven't found an equivalent of Java's Class.forName(String 
I'm not familiar with this Java class, but it appears to be doing 
Reflections.  PHP5 has an actual Reflection_* classes to give you this 
functionality.  I can even send you a small script about the new 
Reflection API if you like.  However, this site should explain 
Reflection_Class:

http://sitten-polizei.de/php/reflection_api/docs/language.reflection.class.reflection_class.html

$class = Reflection_Class('SomeClass');
$method = $class-getMethod('Method');
$args = array($param1, $param2);
$method-invoke($class, $args);

Name_of_class_to_be_instantiated), so I thought call_user_func would 
suffice, instantiate a default version of my object, etc etc ...

Anyone else, back me up on this if I'm wrong.


I think that you and Curt are indeed correct about being able to use a 
$this only in an instance.

My issue is that I have not yet found anywhere were this change of 
behavior in PHP5 that [EMAIL PROTECTED] describes is documented.

If someone could point me to where we all could help with the 
documentation, that'd be great.

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


Re: [PHP] how to verify PHP has been installed with ldap?

2004-04-29 Thread Curt Zirzow
* Thus wrote Bing Du ([EMAIL PROTECTED]):
 I don't see a ldap section in the output of phpinfo().  I need to add a
 bit more background information here...
 
 This is not a fresh php install.  I've already installed PHP Version
 4.3.4.  But now I want to add ldap support to it.  So I added --with-ldap
 option in the configure command.  Then I did make and make install. 
 However, phpinfo() still shows the old information.  For instance, Build
 Date was Mar 3 2004 11:15:34, Configure Command was the one without
 --with-ldap, etc..

This usually means that either you have multiple installation's of
apache and php's make install isn't putting the the module in the
right place.

Or, that your current apache config loads modules from a different
place than apxs told php it should go.

If you issue:
ls -laF `apxs -q LIBEXECDIR`

You should see your libphp5.so there with the latest timestamp. if
not, see if there are some errors issued with the 'make install'
(like are you issuing that as root?)

Also, look in the 'apache' section from phpinfo() and look at the
value for 'Server root', php will usually be loaded relative to
that directory.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] Re: variable-length arguments passed by reference... how?

2004-04-29 Thread Jason Barnett
Aric Caley wrote:

I want to create a function similar to the MySqli extensions' 
mysqli_stmt_bind_param() function.  I assume that this function takes 
its arguments passed by reference.  Now, I know how to do variable 
length argument lists in a function with func_get_arg(s) but how do I 
tell it that they are to be passed by reference?

I'm using PHP5 and I want to stick by the latest recomendations..
There's a much simpler way to do this: just put in the  in the declaration.

?php

error_reporting(E_ALL);

// Receives an array $args like you would get with func_get_args()
function test($args) {
  $args[0] = 'blah';
  $args[1] = 'I am different';
  $args[2] = 'Do you see me in the original?';
}
$total = 10;  // Set to any positive number of arguments
for ($i=0; $i  $total; $i++) {
  $args[$i] = $i;
}
test($args);  // My bad, call_user_func_array passes a copy by default!?
echo 'pre';
print_r($args);
echo '/pre';
?

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


[PHP] Introduction to Reflections: describe.php

2004-04-29 Thread Jason Barnett
I'm getting off the computer, so I figured I'd go ahead and just send 
this to you.  As my subject suggests, this class shows all of the 
Reflections_* classes at work.  One warning though: describe.php cannot 
describe the Reflections API itself, this causes the server to crash.

Enjoy.

Jason

http://sitten-polizei.de/php/reflection_api/docs/language.reflection.class.reflection_method.html


describe.php
Description: application/unknown-content-type-phpfile
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Create Password for EXISTING PDF FILE

2004-04-29 Thread PHP4Web
I want to create password to an existing pdf file
How can I do that with PHP


[PHP] having problems setting up ez publish

2004-04-29 Thread dk
hello folks,
I'm having problems setting up ez publish.
do we have an ez publish guru here?
I'm in need of help with how to implement this system.

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



[PHP] problems with ez publish

2004-04-29 Thread dk
hello folks,
I'm having problems setting up ez publish.
do we have an ez publish guru here?
I'm in need of help with how to implement this system.

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



[PHP] having problems setting up ez publish

2004-04-29 Thread dk
hello folks,
I'm having problems setting up ez publish.
do we have an ez publish guru here?
I'm in need of help with how to implement this system.

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



[PHP] re-keying an array

2004-04-29 Thread Justin French
been RTFMing for about 10 minutes, and can't find the function to 
re-key an array.  In other words, I want an array of items to remain in 
their current order, but have the keys renumbered counting from zero.

yes, I know it can be done with a foreach, but I was hoping for 
something native :)

can anyone point me to the right page in the manual?

---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] having problems setting up ez publish

2004-04-29 Thread Justin French
We heard you the first two times.  Please don't re-post.  If there's a 
ez guru here, they'll respond in their own time.

Of course you could try doing some work yourself first, perhaps 
visiting http://ez.no/community/forum -- a forum dedicated purely to 
EZ, in which I'm sure you'll find a higher ratio of people who can 
help.

Please do your homework before posting a question -- even Googling for 
EZ CMS forum would have got your where you needed to go.

---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] re-keying an array

2004-04-29 Thread Richard Harb
http://www.php.net/manual/en/function.array-values.php ?

Richard


Friday, April 30, 2004, 3:48:06 AM, thus was written:
 been RTFMing for about 10 minutes, and can't find the function to 
 re-key an array.  In other words, I want an array of items to remain in
 their current order, but have the keys renumbered counting from zero.

 yes, I know it can be done with a foreach, but I was hoping for 
 something native :)

 can anyone point me to the right page in the manual?

 ---
 Justin French
 http://indent.com.au

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



Re: [PHP] re-keying an array

2004-04-29 Thread John W. Holmes
Justin French wrote:
been RTFMing for about 10 minutes, and can't find the function to re-key 
an array.  In other words, I want an array of items to remain in their 
current order, but have the keys renumbered counting from zero.

yes, I know it can be done with a foreach, but I was hoping for 
something native :)

can anyone point me to the right page in the manual?
array_values()

$newarray = array_values($old_array);

Although this begs the question of why you'd need to rekey an array...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP] re-keying an array

2004-04-29 Thread Justin French
On 30/04/2004, at 12:06 PM, John W. Holmes wrote:

Although this begs the question of why you'd need to rekey an 
array...
It seemed the easiest way to get the first two elements off the 
beginning of the array after shuffle()ing it, or so I thought -- but 
I'm more than happy to hear of a better way, as always :)

My only requirement is really to end up with an array named $files that 
can be used later on in the template in a foreach loop.

?
shuffle($filenames);// random sort
$filenames = array_values($filenames);  // re-key
for($i=0;$i2;$i++) {
$files[] = path/to/.$filenames[$i];
}
?
... then in the template:

? foreach($files as $file): ?
div ...
...
? include($file); ?
...
/div
? endforeach; ?
Like I said, always happy to see something in a few less lines :)

---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] having problems setting up ez publish

2004-04-29 Thread dk
thanks mate
I have done my homework first of course.
I was posting to find some one who is an expert.

php-general is a newsgroup that covers all issues related to php.
that's my understanding.

if i am wrong, then i'm sorry.
thanks anyway.

Justin French [EMAIL PROTECTED] 
news:[EMAIL PROTECTED]
 We heard you the first two times.  Please don't re-post.  If there's a
 ez guru here, they'll respond in their own time.

 Of course you could try doing some work yourself first, perhaps
 visiting http://ez.no/community/forum -- a forum dedicated purely to
 EZ, in which I'm sure you'll find a higher ratio of people who can
 help.

 Please do your homework before posting a question -- even Googling for
 EZ CMS forum would have got your where you needed to go.

 ---
 Justin French
 http://indent.com.au

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



Re: [PHP] re-keying an array

2004-04-29 Thread John W. Holmes
Justin French wrote:
On 30/04/2004, at 12:06 PM, John W. Holmes wrote:

Although this begs the question of why you'd need to rekey an array...
It seemed the easiest way to get the first two elements off the 
beginning of the array after shuffle()ing it, or so I thought -- but I'm 
more than happy to hear of a better way, as always :)

My only requirement is really to end up with an array named $files that 
can be used later on in the template in a foreach loop.

?
shuffle($filenames);// random sort
$filenames = array_values($filenames);// re-key
for($i=0;$i2;$i++) {
$files[] = path/to/.$filenames[$i];
}
?
... then in the template:

? foreach($files as $file): ?
div ...
...
? include($file); ?
...
/div
? endforeach; ?
Like I said, always happy to see something in a few less lines :)
If I'm following what you want to do correctly:

for($i=0;$i2;$i++)
{
  $key = array_rand($filenames);
  $files[] = path/to/.$filenames[$key];
  unset($filenames[$key]);
}
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


[PHP] hello list

2004-04-29 Thread Joseph Ross Lee
Do you guys know of any php based text indexers? similar to lucene?

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



Re: [PHP] re-keying an array

2004-04-29 Thread Curt Zirzow
* Thus wrote Justin French ([EMAIL PROTECTED]):
 On 30/04/2004, at 12:06 PM, John W. Holmes wrote:
 
 Although this begs the question of why you'd need to rekey an 
 array...
 
 It seemed the easiest way to get the first two elements off the 
 beginning of the array after shuffle()ing it, or so I thought -- but 
 I'm more than happy to hear of a better way, as always :)
 
 My only requirement is really to end up with an array named $files that 
 can be used later on in the template in a foreach loop.
 
 ?
 shuffle($filenames);  // random sort
 $filenames = array_values($filenames);// re-key
 for($i=0;$i2;$i++) {
   $files[] = path/to/.$filenames[$i];
   }
 ?
Yeah, the array_values is unnecessary:

// this will resort the way the items are ordered
shuffle($filenames);// random sort

Normally a simple foreach loop would work but since you're grabbing
the first two, a slice of the array will work:

foreach(array_slice($filenames, 0, 2) as $filename) {
  $files[] = path/to/ . $filelname;
}


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] re-keying an array

2004-04-29 Thread Curt Zirzow
* Thus wrote John W. Holmes ([EMAIL PROTECTED]):
 Justin French wrote:
 On 30/04/2004, at 12:06 PM, John W. Holmes wrote:
 
 
 Like I said, always happy to see something in a few less lines :)
 
 If I'm following what you want to do correctly:
 
 for($i=0;$i2;$i++)
 {
   $key = array_rand($filenames);

heh.. there are almost to many array_* functions :)



Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] how to verify PHP has been installed with ldap?

2004-04-29 Thread Evan Nemerson
Or... did you restart apache after running your make install? If not, that 
might be a good idea... `/path/to/apachectl restart`


On Thursday 29 April 2004 04:00 pm, Curt Zirzow wrote:
 * Thus wrote Bing Du ([EMAIL PROTECTED]):
  I don't see a ldap section in the output of phpinfo().  I need to add a
  bit more background information here...
 
  This is not a fresh php install.  I've already installed PHP Version
  4.3.4.  But now I want to add ldap support to it.  So I added --with-ldap
  option in the configure command.  Then I did make and make install.
  However, phpinfo() still shows the old information.  For instance, Build
  Date was Mar 3 2004 11:15:34, Configure Command was the one without
  --with-ldap, etc..

 This usually means that either you have multiple installation's of
 apache and php's make install isn't putting the the module in the
 right place.

 Or, that your current apache config loads modules from a different
 place than apxs told php it should go.

 If you issue:
 ls -laF `apxs -q LIBEXECDIR`

 You should see your libphp5.so there with the latest timestamp. if
 not, see if there are some errors issued with the 'make install'
 (like are you issuing that as root?)

 Also, look in the 'apache' section from phpinfo() and look at the
 value for 'Server root', php will usually be loaded relative to
 that directory.


 Curt
 --
 I used to think I was indecisive, but now I'm not so sure.

-- 
Evan Nemerson
[EMAIL PROTECTED]
http://coeusgroup.com/en

--
To think is to differ.

-Clarence Darrow

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



Re: [PHP] re-keying an array

2004-04-29 Thread Justin French
On 30/04/2004, at 1:47 PM, Curt Zirzow wrote:

foreach(array_slice($filenames, 0, 2) as $filename) {
  $files[] = path/to/ . $filelname;
}
Ahh array_slice() is EXACTLY what I was looking for :)

---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] making changes on arrays

2004-04-29 Thread Katie Marquez
I'm practicing from a beginning PHP book regarding
arrays and the PHP manual, so please no one flame me
that I didn't try to research before posting.  I'm
thinking that what I want to do requires me to use the
function array_walk or a foreach loop, but I'm not so
sure so maybe someone help here can help.

I want to have an array, perform an action on the
values in the array, and have those actions
permanently affect the values in the array.  Here's
something I've written to test it out how I thought it
could be done:

?php
$array = ('zero\0', 'one\1', 'two\2', 'three\3');
// look at array before changes
print_r($array);
// maybe use foreach or array_walk next?
foreach ($array as $value)
{
 stripslashes($value);
}
// look at array after changes
print_r($array);
?

I'm guessing by now someone can see my error, but I
don't know enough programming to spot it.  What I
thought would happen is my values would have the
backslash removed in the second print_r().  What I
would want is for any changes made in the array
(meaning my values) to be permanent in the array
afterwards.  If I can accomplish the code above, I
figure I can create my own functions to affect changes
on values or at least better understand what I'm
looking at in other people's examples/comments at the
online PHP manual.

Thank you in advance.

Katie




__
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

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



[PHP] Maintaining State Remotely

2004-04-29 Thread php chucker
I'm writing some code to login into my favorite sport site to get stats. I
get logged in ok with the post request showing my username and password, the
response screens welcomes me by name.  However when I send a second request
immediately after the successful login, I'm being told I need to login.  I
thought perhaps it might be cookies, so I tried setting the cookies to the
values previously set on the first attempt, but no luck.

Any ideas?

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



Re: [PHP] making changes on arrays

2004-04-29 Thread Travis Low
Hi Katie,

The foreach construct operates on copies of the array values.  I usually just 
stick to C-like syntax:

for( $i = 0; $i  count( $array ); $i++ )
{
$array[$i] = doSomething( $array[$i] );
}
cheers,

Travis

Katie Marquez wrote:
I'm practicing from a beginning PHP book regarding
arrays and the PHP manual, so please no one flame me
that I didn't try to research before posting.  I'm
thinking that what I want to do requires me to use the
function array_walk or a foreach loop, but I'm not so
sure so maybe someone help here can help.
I want to have an array, perform an action on the
values in the array, and have those actions
permanently affect the values in the array.  Here's
something I've written to test it out how I thought it
could be done:
?php
$array = ('zero\0', 'one\1', 'two\2', 'three\3');
// look at array before changes
print_r($array);
// maybe use foreach or array_walk next?
foreach ($array as $value)
{
 stripslashes($value);
}
// look at array after changes
print_r($array);
?
I'm guessing by now someone can see my error, but I
don't know enough programming to spot it.  What I
thought would happen is my values would have the
backslash removed in the second print_r().  What I
would want is for any changes made in the array
(meaning my values) to be permanent in the array
afterwards.  If I can accomplish the code above, I
figure I can create my own functions to affect changes
on values or at least better understand what I'm
looking at in other people's examples/comments at the
online PHP manual.
Thank you in advance.

Katie

	
		
__
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

--
Travis Low
mailto:[EMAIL PROTECTED]
http://www.dawnstar.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] about ssl socket programming

2004-04-29 Thread Seunghyun. Cho
Hi,

I am running qmail+vpopmail+courier-imap on gentoo box with ssl.
And now making the password change script in php.
I used to use this code in my previous server.
?php

$socket=fsockopen(ssl://localhost, 993, $errno, $errstr, 30);

if(!$socket) {
 echo $errstr ($errno)br /\n;
} else {
 echo okbr;
 fwrite($socket, $_POST[email_address]\r\n);
 echo fread($socket, 1024);
 echo brbr---brbr;
 fwrite($socket, PASS $_POST[password]\r\n);
 echo fread($socket, 1024);
 $checkpassword=substr($line,0,1);
 if ($checkpassword=='+')
 {
   echo bPassword changed/b ;
   system(sudo /pathtovpop/vpopmail/bin/./vpasswd 
'$_POST[email_address]' '$_POST[new_password]');
   echo bra href=/horde/impmain page/a;
 } else {
   echo INVALID LOGIN;
 }
 fclose($socket);
}
?

When I run this script, I've got this error:

* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE 
THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=PLAIN ACL 
ACL2=UNION] Courier-IMAP ready. Copyright 1998-2004 Double Precision, 
Inc. See COPYING for distribution information. USER NO Error in IMAP 
command received by server.

PASS NO Error in IMAP command received by server.

INVALID LOGIN
-
How can I implement this?

help~

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


Re: [PHP] making changes on arrays

2004-04-29 Thread Richard Harb
Hi,

that's something I tripped over myself when I started out :)

foreach takes one element after another from the array and copies it
into that new variable - in your case $value ...

you can modify it all you want - the value 'still' being in the array
will not be affected.

you could operate directly one the value in the array with:

// calculate the number of items in the array before starting the
// loop - will be faster the larger the array
$arCount = count($array);
for ($i = 0; $i  $arCount; ++$i) {
stripslashes($array[$i]);
}

although, on second thought I don't think that stripslashes will do
what you want it to, because it's designed to get rid of slashes
before special characters like the songle quote (I think, but try it
for yourself).

So, if you want your array to change from
  $array = ('zero\0', 'one\1', 'two\2', 'three\3');
to
  $array = ('zero0', 'one1', 'two2', 'three3');

(as I understood) then I'd recommend using str_replace.
That one also has the advantage of taking arrays as arguments so you
can save the whole for / foreach

$array = str_replace('\'', '', $array);

Richard


Friday, April 30, 2004, 6:01:30 AM, thus was written:
 I'm practicing from a beginning PHP book regarding
 arrays and the PHP manual, so please no one flame me
 that I didn't try to research before posting.  I'm
 thinking that what I want to do requires me to use the
 function array_walk or a foreach loop, but I'm not so
 sure so maybe someone help here can help.

 I want to have an array, perform an action on the
 values in the array, and have those actions
 permanently affect the values in the array.  Here's
 something I've written to test it out how I thought it
 could be done:

 ?php
 $array = ('zero\0', 'one\1', 'two\2', 'three\3');
 // look at array before changes
 print_r($array);
 // maybe use foreach or array_walk next?
 foreach ($array as $value)
 {
  stripslashes($value);
 }
 // look at array after changes
 print_r($array);
?

 I'm guessing by now someone can see my error, but I
 don't know enough programming to spot it.  What I
 thought would happen is my values would have the
 backslash removed in the second print_r().  What I
 would want is for any changes made in the array
 (meaning my values) to be permanent in the array
 afterwards.  If I can accomplish the code above, I
 figure I can create my own functions to affect changes
 on values or at least better understand what I'm
 looking at in other people's examples/comments at the
 online PHP manual.

 Thank you in advance.

 Katie




 __
 Do you Yahoo!?
 Win a $20,000 Career Makeover at Yahoo! HotJobs  
 http://hotjobs.sweepstakes.yahoo.com/careermakeover 

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



Re: [PHP] making changes on arrays (SOLVED)

2004-04-29 Thread Katie Marquez
Very cool, Travis!  Thank you for answering so
quickly!  You guys work fast around here :)

Katie

--- Travis Low [EMAIL PROTECTED] wrote:
 Hi Katie,
 
 The foreach construct operates on copies of the
 array values.  I usually just 
 stick to C-like syntax:
 
 for( $i = 0; $i  count( $array ); $i++ )
 {
  $array[$i] = doSomething( $array[$i] );
 }
 
 cheers,
 
 Travis
 





__
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

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



Re: [PHP] making changes on arrays

2004-04-29 Thread Curt Zirzow
* Thus wrote Katie Marquez ([EMAIL PROTECTED]):
 I want to have an array, perform an action on the
 values in the array, and have those actions
 permanently affect the values in the array.  Here's
 something I've written to test it out how I thought it
 could be done:
 
 ?php
 $array = ('zero\0', 'one\1', 'two\2', 'three\3');
 // look at array before changes
 print_r($array);
 // maybe use foreach or array_walk next?
 foreach ($array as $value)
 {
  stripslashes($value);
 
  
  First: Most php functions always return a modified version of the
  variable instead of modifying them directly. So in order to
  actually keep the changes:
  
$value = stripslashes($value);


  Second: 
  If you are using php 5 you can do something like, note the way
  $value is referenced with :

foreach($array as $value) {
  $value = stripslashes($value);
}


  php 4's foreach always works on a copy so you have to access the
  array directly:

foreach($array as $index = $value) {
  $array[$index] = $value;
}

 

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Re: global vars inside includes inside functions?

2004-04-29 Thread Red Wingate
Pattern are always done using OOP, but phppatterns that is one of the best
sources on this topic i could think of :-)

 -- red

[]
 Red, can you provide any more info or resources on a registry-pattern?

 I've found this:
 http://www.phppatterns.com/index.php/article/articleview/75/1/1/ , but
 I'm not really looking to get into OOP just yet :)
[...]

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



[PHP] word to pdf via web server ??

2004-04-29 Thread john doe
hello, does any know how to conver microsoft word document to pdf via on the 
server using php language?? i try to implementing the feature that allow 
user to upload microsoft word document to the web server, after the upload, 
it automatic covert to pdf file ??? any one done that ?

thanks
john 

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



[PHP] text indexers

2004-04-29 Thread Joseph Ross Lee
hello! anybody here who knows text based indexers? e.g. lucene(java based)

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



Re: [PHP] Maintaining State Remotely

2004-04-29 Thread Curt Zirzow
* Thus wrote php chucker ([EMAIL PROTECTED]):
 I'm writing some code to login into my favorite sport site to get stats. I
 get logged in ok with the post request showing my username and password, the
 response screens welcomes me by name.  However when I send a second request
 immediately after the successful login, I'm being told I need to login.  I
 thought perhaps it might be cookies, so I tried setting the cookies to the
 values previously set on the first attempt, but no luck.


It could be that your missing a cookie. The website might be
sending a cookie when you request the login page.

Or you might not be sending the value back to them properly. It's
really hard to say without observing the whole login process and
observing  how they handle your session accross they website visit.

Liveheaders and firebird could help out in finding out what they're
sending and when.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] making changes on arrays (SOLVED)

2004-04-29 Thread RoyD

cheap webhosting only 8.25 U$ dollar  a month for 400 MB and bandwith 5 GB
transfer

and  only 10 U$ dollar a month for 600 MB and bandwith 10 GB transfer

OUR DATA CENTER : http://www.duoservers.com/?r=dejavu91/

and conctac email me at : [EMAIL PROTECTED] and yahoo messeger :
roy_daniel91

---
Roy Daniel , ST
---
IT Software and Support Engineer
PT BERCA COMPUTEL
Email : [EMAIL PROTECTED]


 Yahoo Messenger ID:  roy_daniel91
[EMAIL PROTECTED]
[EMAIL PROTECTED]
phone: +62-8161192832

IT Webhosting  Domain Register Solution - murah meriah
support: linux, windows ,php, ASP,ASP.NET ,   OUR SERVER 
http://Webhostingmurah.com/servergue.html -  in USA,


http://webhostingmurah.com/newdatacenter/ - in England

















   
  
Katie Marquez  
  
katie_marquez2004@   To: Travis Low [EMAIL PROTECTED], 
php  
yahoo.com [EMAIL PROTECTED] 
  
  cc:  
  
04/30/2004 11:46 AM   Subject: Re: [PHP] making changes on 
arrays
   (SOLVED)
  
   
  




Very cool, Travis!  Thank you for answering so
quickly!  You guys work fast around here :)

Katie

--- Travis Low [EMAIL PROTECTED] wrote:
 Hi Katie,

 The foreach construct operates on copies of the
 array values.  I usually just
 stick to C-like syntax:

 for( $i = 0; $i  count( $array ); $i++ )
 {
  $array[$i] = doSomething( $array[$i] );
 }

 cheers,

 Travis






__
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover

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




THIS E-MAIL IS CERTIFIED VIRUS FREE BY SYMANTEC ANTIVIRUS

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