Re: [PHP] Listing a few words from one sentence ??

2002-11-08 Thread Ernest E Vogelsinger
At 23:29 07.11.2002, conbud said:
[snip]
Say I have a sentence that contains 8 words, how do I get PHP to list just 4
of those 8 words ?
[snip] 

Let's assume your words are delimited by one or more blanks, so you could:

$arwords = split(' ',$sentence);// make an array
$arwords = array_slice($arwords, 0, 4); // return the first 4 entries
echo join(' ', $arwords);   // and show them


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




[PHP] Help w/ 4.2.3 Problem

2002-11-08 Thread Jack Sasportas
I have been running 4.1.2 fine, but decided to compile in the latest 
version 4.2.3.
When I run some existing code that works perfect under 4.1.2, not only 
does the code not run properly, but there are no error messages in the 
error_log ( apache file ).
also in php.ini I  added log_errors = On, and error_log = php_log, but I 
never see any error messages.

Running on RedHat 7.2 with apache_1.3.27, mod_ssl-2.8.12-1.3.27, 
openssl-0.9.6g, php-4.2.3.
( Again this all ran fine with php-4.1.2 ).

Any ideas on where to start ?

Thanks

--
___
Jack Sasportas
Innovative Internet Solutions 
Phone 305.665.2500	
Fax 305.665.2551	
www.innovativeinternet.com
www.web56.net




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



Re: Re[6]: [PHP] Trouble with php-4.2.3, apache-1.3.27, sablotron 0.96

2002-11-08 Thread Evan Nemerson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

IT WORKS!!! Hahah yeah! It may have been a pain in the butt for _me_ to 
install, but it was worth it- this is really cool!

Thanks Tom, I really owe you one.


- -Evan




On Thursday 07 November 2002 02:18 am, you wrote:
 Hi,

 Thursday, November 7, 2002, 6:30:17 PM, you wrote:
 EN -BEGIN PGP SIGNED MESSAGE-
 EN Hash: SHA1

 EN Apache fails sanity check. Same with and without the LDFLAGS thing.


 EN  Error Output for sanity check 
 EN cd ..; gcc  -DLINUX=22 -I/usr/src/php-4.2.3 -I/usr/src/php-4.2.3/main
 EN - -I/usr/src/php-4.2.3/main -I/usr/src/php-4.2.3/Zend
 -I/usr/src/php-4.2.3/Zend EN - -I/usr/src/php-4.2.3/TSRM
 -I/usr/src/php-4.2.3/TSRM -I/usr/src/php-4.2.3 EN - -DNO_DL_NEEDED
 `./apaci` -o helpers/dummy helpers/dummy.c EN -
 -Wl,-rpath,/usr/local/lib  -rdynamic -L/usr/local/lib -Lmodules/php4 EN -
 -L../modules/php4 -L../../modules/php4 -lmodphp4   -lsablot -lexpat -lcrypt
 EN - -lresolv -lm -ldl -lnsl  -lresolv -lcrypt   -lm -lcrypt -lexpat EN
 /usr/local/lib/libsablot.so: undefined reference to `operator
 new[](unsigned)' EN /usr/local/lib/libsablot.so: undefined reference to
 `vtable for EN __cxxabiv1::__si_class_type_info'
 EN /usr/local/lib/libsablot.so: undefined reference to `operator
 delete(void*)' EN /usr/local/lib/libsablot.so: undefined reference to
 `__gxx_personality_v0' EN /usr/local/lib/libsablot.so: undefined reference
 to `__cxa_pure_virtual' EN /usr/local/lib/libsablot.so: undefined
 reference to `vtable for EN __cxxabiv1::__class_type_info'
 EN /usr/local/lib/libsablot.so: undefined reference to `operator
 delete[](void*)' EN /usr/local/lib/libsablot.so: undefined reference to
 `vtable for EN __cxxabiv1::__vmi_class_type_info'
 EN /usr/local/lib/libsablot.so: undefined reference to `operator
 new(unsigned)' EN collect2: ld returned 1 exit status
 EN make: *** [dummy] Error 1
 EN = End of Error Report =

 EN On Wednesday 06 November 2002 09:49 pm, Tom Rogers wrote:
  Hi,
 
  Thursday, November 7, 2002, 1:11:43 PM, you wrote:
  EN Same error.
 
 
 
  As a test try compiling statically into apache...That is the way I
  have php at the moment.

 EN -BEGIN PGP SIGNATURE-
 EN Version: GnuPG v1.0.7 (GNU/Linux)

 EN iD8DBQE9yiSn/rncFku1MdIRAgzAAJ98rCLh9jWATOF96Liv3Lwo8SUq2gCbBci3
 EN CngocpcfDF0Oo6+UP5B1Wcc=
 EN =qcnu
 EN -END PGP SIGNATURE-

 looks like you also have to do:

 LDFLAGS=' -lstdc++' ./configure

 for apache as well (although I did not have to do any of this stuff
 except for the patch)

- -- 
Why be born again, when you can just grow up?

- -Unknown
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9y3Gn/rncFku1MdIRAmUTAJ46Vg0ATagguXrJKS8jnskcQDRDkwCgleFY
JxNowBqh+jvtNOLB4mS/HuM=
=zCxO
-END PGP SIGNATURE-


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




Re: [PHP] PHP fopen() bug + solution

2002-11-08 Thread Ernest E Vogelsinger
At 00:51 08.11.2002, Charles Wiltgen said:
[snip]
Example:   while(!file_exists(index.php) { clearstatcache(); }
   while(filesize(index.php  10) { clearstatcache(); }
[snip] 

To be more effective, and to allow the OS to do something else while you're
waiting at the file, your script should sleep for some microseconds... this
will release the time slice your script is occupying and allow other things
to happen, without having the cpu going up to 100%.

while(!file_exists(index.php) { usleep(100); clearstatcache(); }
while(filesize(index.php  10) { usleep(100); clearstatcache(); }

This will sleep  for 0.1 seconds, not really notable. Note that I put the
call to clearstatcache() _after_ the sleep...


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




[PHP] Re: Help w/ 4.2.3 Problem

2002-11-08 Thread Erwin
Jack Sasportas wrote:
 I have been running 4.1.2 fine, but decided to compile in the latest
 version 4.2.3.
 When I run some existing code that works perfect under 4.1.2, not only
 does the code not run properly, but there are no error messages in the
 error_log ( apache file ).
 also in php.ini I  added log_errors = On, and error_log = php_log,
 but I never see any error messages.

 Running on RedHat 7.2 with apache_1.3.27, mod_ssl-2.8.12-1.3.27,
 openssl-0.9.6g, php-4.2.3.
 ( Again this all ran fine with php-4.1.2 ).

 Any ideas on where to start ?

 Thanks

Check the register_globals setting. As from php version 4.2.2, this setting
defaults to Off, while older versions defaults to On.

Grtz Erwin


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




Re: [PHP] WAP resources for PHP

2002-11-08 Thread Ernest E Vogelsinger
At 03:06 08.11.2002, Research and Development said:
[snip]
I need to make a site WAP ready in less than a month. What books or 
internet resources do you recommend for development of WAP in PHP.
[snip] 

Do a Google search for WML - it turns out a couple of very helpful links.
One of the best is http://www.w3schools.com/wap/default.asp, offering a
complete tutorial on WML.

To start with (and I didn't find that at w3schools) it is
_absolutely_necessary_ you tell PHP to transmit the correct content-type
header, by setting the header yourself:

header('Content-type: text/vnd.wap.wml');

Have fun (and post the URL when finished .-) )


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] Weird behaviour with references to objects...

2002-11-08 Thread Ernest E Vogelsinger
At 03:36 08.11.2002, Tim Molendijk said:
[snip]
begin first code snippet 
?php
/* New Container object created. At the same time it sets a Child object in
its $child attribute. (This is indicated by passing TRUE.) */
$testContainer1 = new Container(TRUE);

Ahh - culprit 1:

You said the container is creating a child instance - I assume it's done in
the constructor...

What you're doing here is to create a clone when assigning new()'s result
to $testContainer1. You should rather
$testContainer1 = new Container(TRUE);

Note the ampersand here - if you don't you'll get a clone.

Rule for references:
If your object does something in its constructor, use a reference
assignment for
new class()

Below the code for the classes Container en Child.

begin third code snippet 
?php

class Container
{
var $children;
var $property;

// stuff deleted

function load()
{
$newChild = new Child(1);

Again - make this
$newChild = new Child(1);

function add($child)
{
/* Here a reference of $this (the Container object) is assigned to $child's
$parent attribute. */
$child-parent = $this;
/* Here $child (the newly created Child object) is assigned to the
container's $child property. */
$this-child = $child;
}

But you don't pass $child by reference! Make this
function ($child)

If you don't pass $child as a reference, the line 
$child-parent = $this;
will set the parent value of the clone that's passed as an argument, and
leave the original $child unmodified!

Crosscheck all of your class code (and the code utilizing it) it you're
always passing references. Ref's work like a charm until you mess up at a
single location. Well, having made my way from C/C++ to PHP I'd rather deal
with pointers, but unfortunately PHP doesn't have them. So keep an eye open .-)


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] Graphics question

2002-11-08 Thread Ernest E Vogelsinger
At 05:38 08.11.2002, Mike Mannakee said:
[snip]
Jeez, this is simple.  The browser is caching the image.  There's no real
way to fix that.  There are some headers that may encourage the browser to
not cache, but there is no sure way to control whether the users will have
this setting overridden.

Or, as in a previous thread from yesterday, you could make the image url
look different by using random():

img src=http://your/imageurl.jpg??php echo random()?

You can also search for specifics of the headers that are meant to stop a
browser from caching.

No-cache MIME headers are:
header('Pragma: no-cache');
header('Cache: none');


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] publishing php mysql website on cd-rom

2002-11-08 Thread Krzysztof Dziekiewicz
 My organization has a need to publish some of our web content on a CD-ROM.  I'm in 
search of suggestions on how to publish our dynamic content (php/mysql templates) in 
some sort of runtime
 configuration that would let users browse the site from cd.
 What's involved with this?  Is there such a thing as runtime mySQL?  What would it 
take to serve PHP from a CD?

In my opinion the best is to use something like wget -r in Linux.

-- 
Krzysztof Dziekiewicz


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




[PHP] Cookie error after 4.2.3 upgrade

2002-11-08 Thread Jack Sasportas
I get the following error when using a previously working cookie function:
expects parameter 3 to be long

Code is below... I just don't see the difference then the way the doc uses:
time() - 3600

-vs- the way I did it below...

Thanks !

function f_put_cookie($user_name,$user_email,$account_type,$company_name) {

   global $HTTP_COOKIE_VARS;
   global $s_c_url;

   $l_url = ..$s_c_url;
   $l_cookie_expireN = date('r', time() - 4000 );
   $l_cookie_expire = date('r', time() + 400 );
   $l_cookie_expire2 = date('r', time() + 400*30*12 );

   setcookie(c_user_email,,$l_cookie_expireN);
   
setcookie(c_user_email,$user_email,$l_cookie_expire2,'/',$l_url,0);
   
setcookie(c_user_name,$user_name,$l_cookie_expire,'/',$l_url,0);
   
setcookie(c_account_type,$account_type,$l_cookie_expire,'/',$l_url,0);
   
setcookie(c_company_name,$company_name,$l_cookie_expire,'/',$l_url,0);
   setcookie(c_uas_time, 
GREEN,$l_cookie_expire,'/',$l_url,0);
}



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



Re: [PHP] Help w/ 4.2.3 Problem

2002-11-08 Thread Marco Tabini
Most likely a register_globals settings problem. Try checking the manual
in the php.ini settings page for more info.


Marco

-
php|architect -- The Monthly Magazine For PHP Professionals
Come visit us on the web at http://www.phparch.com!

On Fri, 2002-11-08 at 03:11, Jack Sasportas wrote:
 I have been running 4.1.2 fine, but decided to compile in the latest 
 version 4.2.3.
 When I run some existing code that works perfect under 4.1.2, not only 
 does the code not run properly, but there are no error messages in the 
 error_log ( apache file ).
 also in php.ini I  added log_errors = On, and error_log = php_log, but I 
 never see any error messages.
 
 Running on RedHat 7.2 with apache_1.3.27, mod_ssl-2.8.12-1.3.27, 
 openssl-0.9.6g, php-4.2.3.
 ( Again this all ran fine with php-4.1.2 ).
 
 Any ideas on where to start ?
 
 Thanks
 
 -- 
 ___
 Jack Sasportas
 Innovative Internet Solutions 
 Phone 305.665.2500
 Fax 305.665.2551  
 www.innovativeinternet.com
 www.web56.net
  
 
 
 
 -- 
 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] File locking problem

2002-11-08 Thread Krzysztof Dziekiewicz
 I'm having file locking problems.

 I'm using fopen() to write a file via FTP.  At the end, I'm doing...

 fflush($fp);
 fclose($fp);

 ...and then I include it immediately after.  But many times I only get part
 of what I wrote to the file, which suggests that it wasn't really flushed
 and closed properly.

Do you use include or require. In such situation you should not use
include.




-- 
Krzysztof Dziekiewicz


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




[PHP] Re: Cookie error after 4.2.3 upgrade

2002-11-08 Thread Erwin
Jack Sasportas wrote:
 I get the following error when using a previously working cookie
 function: expects parameter 3 to be long

 Code is below... I just don't see the difference then the way the doc
 uses: time() - 3600

 -vs- the way I did it below...

 Thanks !

 function
 f_put_cookie($user_name,$user_email,$account_type,$company_name) {

 global $HTTP_COOKIE_VARS;
 global $s_c_url;

 $l_url = ..$s_c_url;
 $l_cookie_expireN = date('r', time() - 4000 );
 $l_cookie_expire = date('r', time() + 400 );
 $l_cookie_expire2 = date('r', time() + 400*30*12 );

time() - 3600 returns an integer. The date function returns a string. The
function setcookie expects an integer (or long) as parameter 3. There's your
problem, change your code to:

$l_cookie_expireN = (int) date('r', time() - 4000 );
$l_cookie_expire = (int) date('r', time() + 400 );
$l_cookie_expire2 = (int) date('r', time() + 400*30*12 );

HTH
Erwin


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




Re: [PHP] Convert GIF to JPG with or without GD

2002-11-08 Thread Krzysztof Dziekiewicz
 The GD library bundled with PHP 4.3 can read gif images (but not write them)

And imagejpeg allows to create the jpeg file.



-- 
Krzysztof Dziekiewicz


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




[PHP] XML in PHP on Apache (RH 7.3)

2002-11-08 Thread Pelek
 Hello

its urgent problem!

I need apache server with php supporting XML, i have read the manual and 
some posts how-to compile it

( http://www.php.net/manual/en/ref.xml.php )

i have download sources of expat and doing step-by-step instructions 
given in one of the posts ( *pfreet at trusolutions dot com* 
/16-Aug-1999 05:13 )
i have made expat and configure php with xml and make it , and also Apache.

well it still doesn't work.

Could somebody sent me precise, step by step instruction how to 
configure it and make working?

i'm not sure:
1.where i should place unziped expat files
2.how make file (parameters)

please help!




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



Re: [PHP] Convert GIF to JPG with or without GD

2002-11-08 Thread BAROILLER Pierre-Emmanuel
Yes...

I've tried Image Magic , it's good for my work :)
Now, I can resize/resample/reformat any kind of picture...

thanks for all! :)


Krzysztof Dziekiewicz [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
  The GD library bundled with PHP 4.3 can read gif images (but not write
them)

 And imagejpeg allows to create the jpeg file.



 --
 Krzysztof Dziekiewicz




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




[PHP] Cookies and Sessions

2002-11-08 Thread kevin
Allo,

I seem to have run into a couple of problems with a project I am currently 
working on. First one is that the project has a login feature that tracks the 
user using cookies. The client alas has a desire to have multiple sites and 
have the login to other sites in his group seamless (in as much as he would 
like no additional logging in).

Since the login feature uses cookies this requirement isn't quite 
fulfilled... ok, let me be honest, it ain't filled one little bit!

The one thing I do have in my favour is that all the sites (at the moment 
anyway) have the same SERVER_ADDR. Is there anyway I can set a cookie using 
and IP Address rather than a URL. I have tried this with little success 
(setting the path to ).

As a side note, I would like to be able to use sessions more but I am running 
into some (very) peculiarities. I have a library which starts the session and 
then I regester variables till my heart is content. Trouble comes when I want 
to view them in another page... nada! If I do a 'session_is_registered' on 
the variable it returns true so it seems to have the sessions set up just not 
updating the values.. not sure. Now I can set up small two file proof of 
practice examples but when I integrate into my existing project code I suffer 
from all manner of wierdness .. the most notable being the complete lack of 
persistence.

I know it is a bit of a shot in the dark in as much as I have provided little 
in the way of diagnostic information, but would any of you bright bunnies be 
able to give me some pointers as to what I might want to look into to get 
more of a clue as to what is going on?

Cheers for any assistance

Kevin TheConfused

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




Re: [PHP] Reading unknown number of form variables -? need a hint/help..

2002-11-08 Thread Marek Kilimajer
Its something like:

$res=mysql_query(select item_id, quantity from carts where 
customer_id='$customer_id');
// you might want to join with another table to get item names and 
others you need

while(list($item_id,$quantity)=mysql_fetch_row($res)) {
   echo input name=\quantity[$item_id]\ value=\$quantity\
}
input type=submit

on the next page:

foreach($_POST['quantity'] as $item_id = $quantity) {
   mysql_query(update carts set quantity='$quantity' where 
item_id='$item_id' and customer_id='$customer_id');
}

hope you get the general idea, all information you need (for any item), 
that is item_id and its quantity
will be stored in one input field, then you need to loop the array and 
update rows. You only need to get the
customer_id, best done with sessions

Paul wrote:

Hi All:

I have the following setup:

The page contains multiple rows (something like a shoping cart) that
consist of item_id, item_name, and item_quantity. Item Quantity is a
text box that can be adjusted. I have a button to update all items..( I
am using query and based on item_id I can update database..) The number
of rows varies.

My question is - I really do not know how to get variables and update
multiple items in a database..I think I need to somehow grab them and
place in array perhaps? I am really not sure..I do not want to reinvent
the wheel..can some one give me  hint? Is there a piece of code that I
can look at it and learn from?

Any help would be greatly appreciated

Paul

PS I also would like to place a checkbox (in every row) in the event the
item must be deleted..



 



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




Re: [PHP] sockets

2002-11-08 Thread Marek Kilimajer
This is how sockets work, if you close the process holding the socket, 
the conection is closed.
There is no function reopen_the_old_conection. You are not clear about 
what you are trying to
achive, but maybe you should rethink your design.

Gareth Thomas wrote:

Hi,

I am running 4.3.0pre2 on RH 7.2 and on Windows2k I am trying to implement a
socket based client/server communication program with the server being on
the Linux side and the current test client on windows (although it will be
on Linux eventually). A series of commands is sent by the client side which
consists of 2 PHP pages, the first with some buttons and the second that
sends the button commands to the server using sockets. The problem I am
finding is that it appears PHP closes the socket connection once the second
script has ended and it returns back to the first. Is there anyway of
keeping the socket 'open' or can someone suggest a better way of doing
this...

Thanks in advance

 



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




[PHP] For ... = max($myArray) vs For ... = $max

2002-11-08 Thread Daevid Vincent
Is PHP smart enough to optimize loops?

That is, are these two 'for...loops' equivalent or is one slower than
the other?

$max = max($myArray);
for( $x = 1; $x = $length; $x++ ) {}

 -- OR --

for( $x = 1; $x = max($myArray); $x++ ) {}

My gut instinct tells me since PHP is interpreted, that the top one is
the better way to go, but with the Zend Optimizer, I don't know if PHP
handles them the same way or not?


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




[PHP] problem with memory_limit and php 4.2.3

2002-11-08 Thread Dirk Schmidt
Hi all,

the httpd - Process on my linux-box exits (no segfault)
when executing the following simple script with php 4.2.3.
I don't get the expected error message ( something like 
'Allowed memory size of 512000 bytes exhausted').
=[test Script]===
?
ini_set (memory_limit, 512000);  // 500kB
$aArray = array();

for ($i=0;$i(1024);$i++) {
 for ($j=0;$j1024;$j++) $aArray[$i] .= x;
echo   . sizeof($aArray);
}
?
[end of Script]==

The same script works fine under php4.0.6. What ist going on
here? Is it a problem with my linux box or with php4.2.3?


My configuration: suse Linux 2.4.10-4GB i386
=[php.ini]==
engine = On
short_open_tag = On
asp_tags = Off
precision=  14
y2k_compliance = Off
output_buffering = Off
output_handler =
zlib.output_compression = Off
implicit_flush = Off
allow_call_time_pass_reference = On
safe_mode = Off
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions =
expose_php = On
max_execution_time = 600 ; Maximum execution time of each script, in
seconds
memory_limit = 92M  ; Maximum amount of memory a script may consume
(8MB)
error_reporting  =  E_ALL  ~E_NOTICE
display_errors = On
display_startup_errors = Off
log_errors = On
track_errors = Off
[...some more stuff]
=
=[php configure-line]===
./configure --with-apxs --enable-sockets --enable-memory-limit
--with-mysql --with-xslt-sablot --with-sablot=/usr/local/lib
--with-expat=/usr/local/lib --with-ldap --with-ftp --enable-track-vars
--enable-trans-sid --with-zlib-dir=/usr/lib --with-ming
--with-oci8=/opt/oracle/OraHome1 --enable-xslt
-with-config-file-path=/etc/httpd2

==[ldd output]==
ldd /usr/local/lib/php4/libphp4.so 
/opt/oracle/OraHome1/lib/libclntsh.so.8.0 =
/opt/oracle/OraHome1/lib/libclntsh.so.8.0 (0x40175000)
libdl.so.2 = /lib/libdl.so.2 (0x406f9000)
libpam.so.0 = /lib/libpam.so.0 (0x406fd000)
libsablot.so.0 = /usr/local/lib/libsablot.so.0 (0x40706000)
libexpat.so.0 = /usr/local/lib/libexpat.so.0 (0x407e8000)
libming.so = /usr/local/lib/libming.so (0x4080b000)
libldap.so.1 = /usr/lib/libldap.so.1 (0x4084c000)
liblber.so.1 = /usr/lib/liblber.so.1 (0x40861000)
libz.so.1 = /lib/libz.so.1 (0x40866000)
libcrypt.so.1 = /lib/libcrypt.so.1 (0x40875000)
libresolv.so.2 = /lib/libresolv.so.2 (0x408a2000)
libm.so.6 = /lib/libm.so.6 (0x408b4000)
libnsl.so.1 = /lib/libnsl.so.1 (0x408d6000)
libc.so.6 = /lib/libc.so.6 (0x408ed000)
libwtc8.so = /opt/oracle/OraHome1/lib/libwtc8.so (0x40a13000)
libpthread.so.0 = /lib/libpthread.so.0 (0x40a15000)
libstdc++-libc6.2-2.so.3 = /usr/lib/libstdc++-libc6.2-2.so.3
(0x40a2b000)
/lib/ld-linux.so.2 = /lib/ld-linux.so.2 (0x8000)

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




[PHP] What am I missing with this code?

2002-11-08 Thread John Meyer
for($i=1;$i13;$i++) {
?
lia 
href=categoryresult.php?condition=?=urlencode(where
month(UserDOB)= . $i)??=jdmonthname($i,0)?nbsp;(?=$i?)/a/li
?php
}
?

All it's printing out is November and December, even though the month is
incrementing.


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




RE: [PHP] Most current non-beta version, and bcc

2002-11-08 Thread Ford, Mike [LSS]
 -Original Message-
 From: Rick Widmer [mailto:php3;developersdesk.com]
 Sent: 08 November 2002 04:16
 To: Jill S; [EMAIL PROTECTED]
 Subject: Re: [PHP] Most current non-beta version, and bcc
 
 
 At 02:38 PM 11/7/02 -0600, Jill S wrote:
 so again I'll ask - Are the  4.2.3 downloads at the top of the
 page at: http://www.php.net/downloads/  beta versions or
 non-beta versions?
 
 4.2.3 is currently the latest stable released version of PHP. 
  Yes, that 
 means NOT BETA.
 
 Anything that makes it to the downloads page is stable code.
 
 
 4.3.0 should be out soon, but is not yet considered stable.  
 It has also 
 passed the BETA state and is in its second pre-release final testing.

Nope, I'd still class that as BETA-testing.  Actually, I might even call it
pre-BETA!

When they actually get around to making Release Candidates available (as in
4.3.0RC1), I'd call that real BETA testing.

I wonder how the members of the PHP development group themselves would class
these?

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




RE: [PHP] Quick question

2002-11-08 Thread Ford, Mike [LSS]
 -Original Message-
 From: Martin Towell [mailto:martin.towell;world.net]
 Sent: 08 November 2002 06:23
 
 what is the technical difference between using
 
   else if

Well, technically this starts a new block structure level...

 
 and
 
   elseif

... and this doesn't.

But to all intents and purposes it probably doesn't make any real
difference.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




[PHP] Re: fgetcsv and end of line in values

2002-11-08 Thread achillex
i solved my prob with the latest stable snap. php 4.2.4.

[EMAIL PROTECTED] wrote in news:20021107092154.13278.qmail;pb1.pair.com:

 greetings,
 
 i have problems using fgetcsv to explode a .csv file. some values
 consist of line-breaks. although these values are enclosed by quotes,
 php recognizes the line-break and starts a new dataset.
 
 the script workes fine in my old environment (win2k, apache 1.3.23,
 php 4.1.1), the problem occures in my new environment (win2k, apache
 2.0.43, php 4.3.0). maybe config-params?
 
 i mentioned a new enclusure-attribute in fgetcsv since php 4.3.0. but 
 experimenting with this didn't succeed. i also tried some different 
 syntaxes in the delimiter-attrib of fgetcsv, no success.
 
 does anybody have any suggestion?
 
 thx.
 


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




RE: [PHP] Re: Cookie error after 4.2.3 upgrade

2002-11-08 Thread Ford, Mike [LSS]
 -Original Message-
 From: Erwin [mailto:erwin;isiz.com]
 Sent: 08 November 2002 08:55
 
 Jack Sasportas wrote:
  I get the following error when using a previously working cookie
  function: expects parameter 3 to be long
 
  Code is below... I just don't see the difference then the 
 way the doc
  uses: time() - 3600
 
  -vs- the way I did it below...
 
  Thanks !
 
  function
  f_put_cookie($user_name,$user_email,$account_type,$company_name) {
 
  global $HTTP_COOKIE_VARS;
  global $s_c_url;
 
  $l_url = ..$s_c_url;
  $l_cookie_expireN = date('r', time() - 4000 );
  $l_cookie_expire = date('r', time() + 400 );
  $l_cookie_expire2 = date('r', time() + 400*30*12 );
 
 time() - 3600 returns an integer. The date function returns a 
 string. The
 function setcookie expects an integer (or long) as parameter 
 3. There's your
 problem, change your code to:
 
 $l_cookie_expireN = (int) date('r', time() - 4000 );
 $l_cookie_expire = (int) date('r', time() + 400 );
 $l_cookie_expire2 = (int) date('r', time() + 400*30*12 );

No, that's even worse!!  Try this:

   $l_cookie_expireN = time() - 4000;
   $l_cookie_expire = time() + 400;
   $l_cookie_expire2 = time() + 400*30*12;

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




RE: [PHP] For ... = max($myArray) vs For ... = $max

2002-11-08 Thread Ford, Mike [LSS]
 -Original Message-
 From: Daevid Vincent [mailto:daevid;daevid.com]
 Sent: 08 November 2002 11:13
 
 Is PHP smart enough to optimize loops?
 
 That is, are these two 'for...loops' equivalent or is one slower than
 the other?
 
 $max = max($myArray);
 for( $x = 1; $x = $length; $x++ ) {}
 
  -- OR --
 
 for( $x = 1; $x = max($myArray); $x++ ) {}
 
 My gut instinct tells me since PHP is interpreted, that the top one is
 the better way to go, but with the Zend Optimizer, I don't know if PHP
 handles them the same way or not?

With bare PHP, yes the first one is quicker.  Don't know if the Zend Optimiser changes 
that.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




[PHP] HTTP POST FILE UPLOAD HELP

2002-11-08 Thread @ Darwin

Ok, I have a problem with my file upload. When I upload a file, say $img,
only $img is available and when I echo $img to the screen it gives the full
path of the temporary image supposedly created by PHP. Echoing
$_FILE['img']['tmp_name'], or any of the other $_FILE array elements,
doesn't give anything. There is no array of information for the uploaded
file, possibly because of the following problem I'm having:

Another weird thing is that no temporary file is even created on the server
(I did a system search on the C: drive of the windows box I'm using). Here
is the info from my php.ini file:


---


; File Uploads ;


; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if
not
; specified).
upload_tmp_dir = C:\PHP\tmp_uploads

; Maximum allowed size for uploaded files.
upload_max_filesize = 6M




I even changed the upload_tmp_dir setting to the default and it still didn't
create a temporary file of the image on the server. GD is definately
installed and enabled according to phpinfo() -- although GD has nothing to
do with this. I'm uploading *.jpg/*.jpeg files only. register_globals is on
(I am aware of the risks). So what could be wrong? Is there another setting
in the php.ini file that I need to worry about that is not set by default?
I've pondered and tested this long enough and I'm beyond frustration,
someone please help me with some suggestions to get me through this...

Thanks,
- Darwin


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




Re: [PHP] HTTP POST FILE UPLOAD HELP

2002-11-08 Thread Justin French
Hi,

Simple question first:  There is a perfect working example of file uploads
available on the PHP website in the manual.  Can you get that example to
work?

Justin


on 08/11/02 10:05 PM, @ Darwin ([EMAIL PROTECTED]) wrote:

 
 Ok, I have a problem with my file upload. When I upload a file, say $img,
 only $img is available and when I echo $img to the screen it gives the full
 path of the temporary image supposedly created by PHP. Echoing
 $_FILE['img']['tmp_name'], or any of the other $_FILE array elements,
 doesn't give anything. There is no array of information for the uploaded
 file, possibly because of the following problem I'm having:
 
 Another weird thing is that no temporary file is even created on the server
 (I did a system search on the C: drive of the windows box I'm using). Here
 is the info from my php.ini file:
 
 
 ---
 
 
 ; File Uploads ;
 
 
 ; Whether to allow HTTP file uploads.
 file_uploads = On
 
 ; Temporary directory for HTTP uploaded files (will use system default if
 not
 ; specified).
 upload_tmp_dir = C:\PHP\tmp_uploads
 
 ; Maximum allowed size for uploaded files.
 upload_max_filesize = 6M
 
 
 
 
 I even changed the upload_tmp_dir setting to the default and it still didn't
 create a temporary file of the image on the server. GD is definately
 installed and enabled according to phpinfo() -- although GD has nothing to
 do with this. I'm uploading *.jpg/*.jpeg files only. register_globals is on
 (I am aware of the risks). So what could be wrong? Is there another setting
 in the php.ini file that I need to worry about that is not set by default?
 I've pondered and tested this long enough and I'm beyond frustration,
 someone please help me with some suggestions to get me through this...
 
 Thanks,
 - Darwin
 


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




Re: [PHP] For ... = max($myArray) vs For ... = $max

2002-11-08 Thread Marek Kilimajer
As max($myArray) may potentionaly change, it is evalueted everytime (you 
may do
$myArray[]=$big_number in your loop). So if you know it is not going to 
change, use the first way.

Daevid Vincent wrote:

Is PHP smart enough to optimize loops?

That is, are these two 'for...loops' equivalent or is one slower than
the other?

$max = max($myArray);
for( $x = 1; $x = $length; $x++ ) {}

-- OR --

for( $x = 1; $x = max($myArray); $x++ ) {}

My gut instinct tells me since PHP is interpreted, that the top one is
the better way to go, but with the Zend Optimizer, I don't know if PHP
handles them the same way or not?


 



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




RE: [PHP] What am I missing with this code?

2002-11-08 Thread Ford, Mike [LSS]
 -Original Message-
 From: John Meyer [mailto:johnmeyer_1978;yahoo.com]
 Sent: 08 November 2002 11:45
 
   for($i=1;$i13;$i++) {
   ?
   lia 
 href=categoryresult.php?condition=?=urlencode(where
 month(UserDOB)= . 
 $i)??=jdmonthname($i,0)?nbsp;(?=$i?)/a/li
   ?php
   }
   ?
 
 All it's printing out is November and December, even 
 though the month is
 incrementing.

You don't seem to have grasped what a Julian day number is -- what you're producing 
here is the monthname of 12 consecutive days in IIRC about 4000BC which presumably 
just happen to fall in what would have been November and December had such months 
existed in that year!

This is a case where I really must suggest you RTFM, as there is a perfecxt example of 
what you want to do in the only user note at 
http://www.php.net/manual/en/function.jdmonthname.php

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




Re: [PHP] Re: Cookie error after 4.2.3 upgrade

2002-11-08 Thread Erwin
 change your code to:

 $l_cookie_expireN = (int) date('r', time() - 4000 );
 $l_cookie_expire = (int) date('r', time() + 400 );
 $l_cookie_expire2 = (int) date('r', time() + 400*30*12 );

 No, that's even worse!!  Try this:

$l_cookie_expireN = time() - 4000;
$l_cookie_expire = time() + 400;
$l_cookie_expire2 = time() + 400*30*12;

You're right of course, let's say that it was very early when I wrote that
answer ;-))

Grtz Erwin


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




Re: [PHP] HTTP POST FILE UPLOAD HELP

2002-11-08 Thread Ernest E Vogelsinger
At 13:05 08.11.2002,  Darwin spoke out and said:
[snip]
is the info from my php.ini file:


; Temporary directory for HTTP uploaded files (will use system default if
not
; specified).
upload_tmp_dir = C:\PHP\tmp_uploads
[snip] 

I believe you must escape backslashes in php.ini as well... or simply use
forward slashes.

Try this setting:
upload_tmp_dir = C:/PHP/tmp_uploads

Also, if this is Win2K Server, make sure the ACL's are set correctly.
Usually Apache runs as system, so make sure you're giving the system
user full rights (or at least r/w/d) to this directory.


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] For ... = max($myArray) vs For ... = $max

2002-11-08 Thread Maxim Maletsky
The first one is better, and, besides that - it is the most correct way
- there might be something making the array change while inside the loop
- thus you have to do some extremely high calculations to understand the
array does not change runtime, which makes it useless.

Simply do the elegant programming and you will never have these issues. 


--
Maxim Maletsky
[EMAIL PROTECTED]



Ford, Mike   [LSS] [EMAIL PROTECTED] wrote... :

  -Original Message-
  From: Daevid Vincent [mailto:daevid;daevid.com]
  Sent: 08 November 2002 11:13
  
  Is PHP smart enough to optimize loops?
  
  That is, are these two 'for...loops' equivalent or is one slower than
  the other?
  
  $max = max($myArray);
  for( $x = 1; $x = $length; $x++ ) {}
  
   -- OR --
  
  for( $x = 1; $x = max($myArray); $x++ ) {}
  
  My gut instinct tells me since PHP is interpreted, that the top one is
  the better way to go, but with the Zend Optimizer, I don't know if PHP
  handles them the same way or not?
 
 With bare PHP, yes the first one is quicker.  Don't know if the Zend Optimiser 
changes that.
 
 Cheers!
 
 Mike
 
 -
 Mike Ford,  Electronic Information Services Adviser,
 Learning Support Services, Learning  Information Services,
 JG125, James Graham Building, Leeds Metropolitan University,
 Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
 Email: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 
 
 -- 
 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] Cookies and Sessions

2002-11-08 Thread Maxim Maletsky

kevin [EMAIL PROTECTED] wrote... :

 Allo,
 
 I seem to have run into a couple of problems with a project I am currently 
 working on. First one is that the project has a login feature that tracks the 
 user using cookies. The client alas has a desire to have multiple sites and 
 have the login to other sites in his group seamless (in as much as he would 
 like no additional logging in).

You have very few things to do for solve it. One would be passing
session id within the URL when jumping between the sites to then
evaluate some session data. It is also the reasons large portal sites,
when merging, add subdomains and lose their precious domains because
subdomains can still share the cookies.

 Since the login feature uses cookies this requirement isn't quite 
 fulfilled... ok, let me be honest, it ain't filled one little bit!

And, even if you'd succeed it would be the greatest security risk.

 The one thing I do have in my favour is that all the sites (at the moment 
 anyway) have the same SERVER_ADDR. Is there anyway I can set a cookie using 
 and IP Address rather than a URL. I have tried this with little success 
 (setting the path to ).

Not sure, but I don't think you can - there are loads of sites sharing
the same IPs.

 As a side note, I would like to be able to use sessions more but I am running 
 into some (very) peculiarities. I have a library which starts the session and 
 then I regester variables till my heart is content. Trouble comes when I want 
 to view them in another page... nada! If I do a 'session_is_registered' on 
 the variable it returns true so it seems to have the sessions set up just not 
 updating the values.. not sure. Now I can set up small two file proof of 
 practice examples but when I integrate into my existing project code I suffer 
 from all manner of wierdness .. the most notable being the complete lack of 
 persistence.

You're probably missing something silly. Sessions do work ok.

 I know it is a bit of a shot in the dark in as much as I have provided little 
 in the way of diagnostic information, but would any of you bright bunnies be 
 able to give me some pointers as to what I might want to look into to get 
 more of a clue as to what is going on?

there are some articles on PHP Beginner regarding sessions and security
- www.phpbeginner.com


--
Maxim Maletsky
[EMAIL PROTECTED]



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




Re: [PHP] How to echo the end marker '?'

2002-11-08 Thread Petre Agenbag
I'm just curious.
Why do you want to echo within an echo?
echo 'form action='.$PHP_SELF.'';
will do the trick won't it?
Unless I miss the point, I cannot see why you need to open new php tags
for this?




On Fri, 2002-11-08 at 14:25, Ernest E Vogelsinger wrote:
 At 12:15 08.11.2002, Philipp Bolliger spoke out and said:
 [snip]
 subject's allready my question ! I want to echo something like : form 
 action = \,?php echo $PHP_SELF ? \  so that the action becomes ? 
 echo $PHP_SELF ? !! But I can't figure out how to escape ? so that the 
   interpreter doesn't take it as the end of the script ! Any idea ?
 [snip] 
 
 Try 
 
 echo 'form action=', '', '?', 'php echo $PHP_SELF', '?', '', '';
 
 This should work (untested)
 
 
 -- 
O Ernest E. Vogelsinger 
(\) ICQ #13394035 
 ^ http://www.vogelsinger.at/


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




[PHP] string to array

2002-11-08 Thread Marek Kilimajer
Hi all,

has anyone an elegant (and faster) way of converting 'string' to 
array('s','t','r','i','n','g'), other then
for($i=0; $istrlen($string); $i++) $array[$i]=$string[$i];


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



Re: [PHP] string to array

2002-11-08 Thread Timothy Hitchens (HiTCHO)
Quick and Dirty:

?php

$string = 'hello how are you today';

$new_string = preg_split(/[\s]?/, $string);

print_r($new_string);

?



Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED]


If you need PHP hosting with an experienced
support team 24/7 then email me today.

On Fri, 8 Nov 2002, Marek Kilimajer wrote:

 Hi all,

 has anyone an elegant (and faster) way of converting 'string' to
 array('s','t','r','i','n','g'), other then
 for($i=0; $istrlen($string); $i++) $array[$i]=$string[$i];


 --
 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] string to array

2002-11-08 Thread Tom Rogers
Hi,

Friday, November 8, 2002, 10:43:10 PM, you wrote:
MK Hi all,

MK has anyone an elegant (and faster) way of converting 'string' to 
MK array('s','t','r','i','n','g'), other then
MK for($i=0; $istrlen($string); $i++) $array[$i]=$string[$i];



A string is already an array of chars

$string = 'string';
echo $string[0]; // will echo 's'

-- 
regards,
Tom


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




Re: [PHP] string to array

2002-11-08 Thread Erwin
Tom Rogers wrote:
 Hi,

 Friday, November 8, 2002, 10:43:10 PM, you wrote:
 Hi all,

 has anyone an elegant (and faster) way of converting 'string' to
 array('s','t','r','i','n','g'), other then
 for($i=0; $istrlen($string); $i++) $array[$i]=$string[$i];



 A string is already an array of chars

 $string = 'string';
 echo $string[0]; // will echo 's'

True, but that's different than the array type. Sometimes you'll just need
an array instead of a string.

Try using

$string = explode( '', 'string' );

Grtz Erwin


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




Re: [PHP] string to array

2002-11-08 Thread Timothy Hitchens (HiTCHO)
That won't work.. empty delimiter errors always.. you will have to use
my preg one from earlier...


Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED]


If you need PHP hosting with an experienced
support team 24/7 then email me today.

On Fri, 8 Nov 2002, Erwin wrote:

 Tom Rogers wrote:
  Hi,
 
  Friday, November 8, 2002, 10:43:10 PM, you wrote:
  Hi all,
 
  has anyone an elegant (and faster) way of converting 'string' to
  array('s','t','r','i','n','g'), other then
  for($i=0; $istrlen($string); $i++) $array[$i]=$string[$i];
 
 
 
  A string is already an array of chars
 
  $string = 'string';
  echo $string[0]; // will echo 's'

 True, but that's different than the array type. Sometimes you'll just need
 an array instead of a string.

 Try using

 $string = explode( '', 'string' );

 Grtz Erwin


 --
 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] string to array

2002-11-08 Thread Maxim Maletsky

String IS an array.

Basically, you could do this:

$str = 'The Dummy String';

for($i=0; $istrlen($str); $i++) {
echo $str[$i] . ':';
}

and you sould get the output:

T:h:e: :D:u:m:m:y: :S:t:r:i:n:g:


As of actually converting it you could do that very loop and have an:
$atr_arr[] = $str[$i] in it, or, even more elegantly by using split()
function or ...chunk.. something function(), don't remember right now.

--
Maxim Maletsky
[EMAIL PROTECTED]



Marek Kilimajer [EMAIL PROTECTED] wrote... :

 Hi all,
 
 has anyone an elegant (and faster) way of converting 'string' to 
 array('s','t','r','i','n','g'), other then
 for($i=0; $istrlen($string); $i++) $array[$i]=$string[$i];
 
 
 -- 
 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] Weird behaviour with references to objects...

2002-11-08 Thread Maxim Maletsky
with the reference you simply are re-refering the old internal values of
the class. No, it is not reccomened to do so, unless, of course, you
have a very good reason to.


--
Maxim Maletsky
[EMAIL PROTECTED]



Martin Towell [EMAIL PROTECTED] wrote... :

 I remember reading somewhere (can't remember where though, maybe the php.net
 web site??) that if you use $this in a constructor (or any methods the
 constuctor calls), then you should instantiate the object using new
 otherwise you get a copy of the object that's just been created and not the
 actual new object (if that's not too confusing...)
 
 It's to do with the way the assignment operator works..
 
 -Original Message-
 From: Tim Molendijk [mailto:tawm;wanadoo.nl]
 Sent: Friday, November 08, 2002 4:14 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Weird behaviour with references to objects...
 
 
 Hi all,
 
 First of all, thank you for the suggestions.
 
 Actually I accidently found a solution to the problem... Not that I
 understand it now, I just found a way to cope with it. By changing the first
 line of the first code snippet:
 $testContainer1 = new Container(TRUE);
 into:
 $testContainer1 = new Container(TRUE);
 the problem is gone!
 
 Don't ask me WHY this is the solution. In my Container-add() method I
 assign A REFERENCE of the Container object ($this) to $child-parent so I
 don't see why creating the Container object by reference is useful...
 
 If anyone has additional information on this subject feel free to post!
 
 Thanks everyone!
 Tim.
 
 Mike Mannakee [EMAIL PROTECTED] wrote in message
 news:20021108044622.68446.qmail;pb1.pair.com...
  This sounds like a matter that ought to make it to the programmers who
 code
  PHP itself.  In the meantime can you code around it now that you know the
  bug is there?
 
  Mike
 
 
  Marco Tabini [EMAIL PROTECTED] wrote in message
  news:1036725595.21741.868.camel;localhost.localdomain...
   I'm not sure if my answer is going to be of much help, but I think this
   has to do with the way PHP handles references and copies of objects--it
   uses what I understand is a lazy copy mechanism, and thus the results on
   object manipulations can yield odd results. There was a discussion on a
   similar problem on PHP-DEV a while back--if you search the forums you
   should be able to find it.
  
   Hope this helps...
  
  
   Marco
   -
   php|architect -- The Monthly Magazine For PHP Professionals
   Come visit us on the web at http://www.phparch.com!
  
   On Thu, 2002-11-07 at 21:36, Tim Molendijk wrote:
First of all I would like to say that I know this is a lot of text but
 I
would be very pleased if you take a little time to read it
 nevertheless.
  The
situation described below is not complicated at all...
=
   
Hello all,
   
I'm dealing with this really weird problem which occurs when dealing
  with
references within objects pointing to other objects. I'm trying to
 find
  out
what it is now for a few days and I still don't get it. I minimised
 the
  code
around the problem and it's weirder than ever. I would really
 appreciate
  it
when you could take a look... I'm pretty experienced at PHP but
 perhaps
  you
know something that I don't know.
   
We have two different classes: Container and Child. Container objects
contain a Child object in its $child property. A Child object has a
  $parent
property, which contains a *reference* to the Container object by
 which
  it
is held.
So $containerObject should be the *same* as
  $containerObject-child-parent.
To test this Container objects have a $property property. When
 changing
  this
property the difference between one object and identical/cloned
 objects
becomes visible.
   
Now take a look at the following code. The indented text is code, the
  rest
are comments. The code for the class Container and class Child are
 also
included. Please scroll down or take a look at the attached file.
   
begin first code snippet 
?php
   
/* New Container object created. At the same time it sets a Child
 object
  in
its $child attribute. (This is indicated by passing TRUE.) */
$testContainer1 = new Container(TRUE);
/* The Container object is created, the Child object is set and its
reference to the Container object is set. Now it prints
$testContainer1-property and $testContainer-child-parent-property.
  These
should have an identical value because they should be from the same
  object
(not cloned/identical, but the same).
This is the result:
property = 'state 1'
child-parent-property = 'state 1'
So this is as expected, no problem... yet. */
$testContainer1-printState();
   
/* Now $testContainer1's $property property is changed into another
  value.
/*

Re: [PHP] string to array

2002-11-08 Thread Maxim Maletsky

Erwin [EMAIL PROTECTED] wrote... :

  A string is already an array of chars
 
  $string = 'string';
  echo $string[0]; // will echo 's'
 
 True, but that's different than the array type. Sometimes you'll just need
 an array instead of a string.
 
 Try using
 
 $string = explode( '', 'string' );

I think this will fail. There is a function just for that, don't
remember right now what it was.


--
Maxim Maletsky
[EMAIL PROTECTED]


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




Re: [PHP] string to array

2002-11-08 Thread @ Edwin
Hello,


Maxim Maletsky [EMAIL PROTECTED] wrote:


[snip]
 As of actually converting it you could do that very loop and have an:
 $atr_arr[] = $str[$i] in it, or, even more elegantly by using split()
 function or ...chunk.. something function(), don't remember right now.
[/snip]

Perhaps, this would remind you...  :)

?php
  $str = 'string';
  $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
  print_r($chars);
?

That was from the manual:
  http://www.php.net/manual/en/function.preg-split.php

- E

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




Re: [PHP] string to array

2002-11-08 Thread Erwin
 $string = explode( '', 'string' );

Timothy Hitchens wrote:
 That won't work.. empty delimiter errors always..

Your right, I didn't know.

 you will have to use
 my preg one from earlier...

But your preg thingy will only split at spaces, so that'll have to change to

?
$string = 'test';
preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY);
?

in this case, right?

Grtz Erwin


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




Re: [PHP] How to echo the end marker '?'

2002-11-08 Thread @ Edwin
Hello,
(B
(B"Petre Agenbag" [EMAIL PROTECTED] wrote:
(B I'm just curious.
(B
(BMe, too. :)
(B
(B Why do you want to echo within an echo?
(B echo 'form action="'.$PHP_SELF.'"';
(B will do the trick won't it?
(B
(BTrue.
(B
(B Unless I miss the point, I cannot see why you need to open new php tags
(B for this?
(B
(BBut, if there's a special reason...
(B
(B  echo $PHP_SELF ? !! But I can't figure out how to escape ? so that
(Bthe
(Binterpreter doesn't take it as the end of the script ! Any idea ?
(B
(BWell, we can use lt; instead of  and gt; instead of  , etc...
(B
(B- E
(B
(B...[snip]...
(B
(B-- 
(BPHP General Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] string to array

2002-11-08 Thread Marek Kilimajer
This is working great, thank you.
Timothy's expression output one empty element at the start and the end, 
but otherwise worked ( and
I don't know why :-(

Erwin wrote:

$string = explode( '', 'string' );
 


Timothy Hitchens wrote:
 

That won't work.. empty delimiter errors always..
   


Your right, I didn't know.

 

you will have to use
my preg one from earlier...
   


But your preg thingy will only split at spaces, so that'll have to change to

?
$string = 'test';
preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY);
?

in this case, right?

Grtz Erwin


 



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




Re: [PHP] string to array

2002-11-08 Thread Maxim Maletsky
Guys, not to confuse you, but I think there is a more elegant way doing
it that. I had the same issue once long ago (2-3 years ago?) and had put
it up on the mailing lists too.

Gotta remember what it was and for what project then find the code in my
libraries. I really think i accomplished it without preg_split()...


--
Maxim Maletsky
[EMAIL PROTECTED]



@ Edwin [EMAIL PROTECTED] wrote... :

 Hello,
 
 
 Maxim Maletsky [EMAIL PROTECTED] wrote:
 
 
 [snip]
  As of actually converting it you could do that very loop and have an:
  $atr_arr[] = $str[$i] in it, or, even more elegantly by using split()
  function or ...chunk.. something function(), don't remember right now.
 [/snip]
 
 Perhaps, this would remind you...  :)
 
 ?php
   $str = 'string';
   $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
   print_r($chars);
 ?
 
 That was from the manual:
   http://www.php.net/manual/en/function.preg-split.php
 
 - E
 
 -- 
 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] Convince teh boss

2002-11-08 Thread @ Edwin
Very interesting! Thanks! I'm sure the list will be very useful. ;)

BTW, perhaps you can add apple.com to your list. (Apache, Linux--should be
BSD...)

- E

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




[PHP] Unable to execute c++ .exe file from php

2002-11-08 Thread Ladan Pickering
I am unable to execute my c++ program from within PHP when it runs as a
cgi in Apache. 
I am able to run:

$cmd=dir c:\abc
system ($cmd, $errCode);

and see the content of the directory, but I don't seem to
be able to run a simple hello.exe (c++) file.

$cmd = c:\abc\hello.exe;
system ($cmd, $errCode);

The errCode always comes back with 128. What does 128 mean?
 
Here is some info on my setup.
OS: Windows XP
Server: Apache 2.0.43 (win32)
PHP 4.2.3
I am running PHP as a CGI

I am able to execute my c++ program (hello.exe) from this .php file 
just fine if I use the PHP cli.
 
I appreciate any help.


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




[PHP] Wildcard search

2002-11-08 Thread Mako Shark

I've tried doing a search for this problem on the web, but haven't found anything, nor 
have I found any solution on the php.net documentation.

 

Does anyone know if it's possible to do a file search with a wildcard character? I 
need to find if there are any HTML files in a certain directory, but 
file_exists(htmls/*.html) doesn't seem to work when tested. Neither do similar 
applications of readdir(). Is there another way to do this, or do I have to do a 
readdir() and read the filename of every file until I find an HTML or until all files 
have been read.



-
Do you Yahoo!?
U2 on LAUNCH - Exclusive medley  videos from Greatest Hits CD


Re: [PHP] Wildcard search

2002-11-08 Thread Marco Tabini
How about:

$a = explode (' ', shell_exec (ls $foldername/*.html));

This should return an array that contains the name of all the *.html
files in the folder $foldername, if any.

Hope this helps.

Cheers,


Marco


-
php|architect -- The Monthly Magazine For PHP Professionals
Come visit us on the web at http://www.phparch.com!

On Fri, 2002-11-08 at 09:34, Mako Shark wrote:
 
 I've tried doing a search for this problem on the web, but haven't found anything, 
nor have I found any solution on the php.net documentation.
 
  
 
 Does anyone know if it's possible to do a file search with a wildcard character? I 
need to find if there are any HTML files in a certain directory, but 
file_exists(htmls/*.html) doesn't seem to work when tested. Neither do similar 
applications of readdir(). Is there another way to do this, or do I have to do a 
readdir() and read the filename of every file until I find an HTML or until all files 
have been read.
 
 
 
 -
 Do you Yahoo!?
 U2 on LAUNCH - Exclusive medley  videos from Greatest Hits CD



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




Re: [PHP] ob_gzhandler

2002-11-08 Thread Serge Paquin
I get no output at all.

All DoCache does is write $buffer to a file then return $buffer since I use
this for some other serverside caching to save on database hits.

I have other areas that I call ob_start(ob_gzhandler) and that works fine
but when I call in via DoCache it breaks.

I much prefer your idea of mod_deflate.  I will look into that since I
believe that belongs in apache rather than a PHP program also.

I am still curious why it doesn't work though.

Here is my True DoCache function:

function docache ($buffer) {
$fp=fopen(cachefilename(), w);
if($fp)
fputs($fp,$buffer);

return ob_gzhandler($buffer);
}

cachefilename() simply returns an MD5 of the requested URI.

This will return a blank webpage in IE and Mozilla.  When I take out
ob_gzhandler it then works fine.

Thanks,
Serge.

- Original Message -
From: Ernest E Vogelsinger [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 08, 2002 4:00 AM
Subject: Re: [PHP] ob_gzhandler


 At 07:45 08.11.2002, Serge Paquin said:
 [snip]
 Hello,
 
 Is their anyway to use ob_gzhandler along with another callback?
I've
 tried the following which does not work:
 
 function DoCache($buffer) {
 /* Do a bunch of stuff */
 return ob_gzhandler($buffer);
 }
 
 ob_start(DoCache);

 What do you mean by does not work? Does it output nothing, or can't
you
 see any compressed data?

 1) output is empty
 Must be an error in your DoCache() function - check the buffer you're
 passing to ob_gzhandler() by writing it to a file (you can't echo it
here...)

 2) you don't see compressed output
 2.a) That's how it is designed. ob_gzhandler checks the request headers to
 see if the browser supports any of the compressed formats (gzip, deflate),
 and if it doesn't find it then it simply does nothing.
 2.b) PHP needs to be compiled using --with-zlib to provide ob_gzhandler
 support. You don't get any error if you don't have zlib configured. Check
 phpinfo() to see if zlib support is available.


 Personal hint:
 If you're using the url_rewriter.tags and have session cookies disabled,
 ob_gzhandler will break this. The reason is that PHP parses the
 _very_final_ output to mangle the session identifier to any (local) url;
in
 case this _very_final_ output is compressed ir can't find any link and
 can't merge the session identifier.

 I personally believe it's better to have compression be done at the web
 server (refer to http://httpd.apache.org/docs-2.0/mod/mod_deflate.html).
 It's more general then, after all...


 --
O Ernest E. Vogelsinger
(\)ICQ #13394035
 ^ http://www.vogelsinger.at/



 --
 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] Unable to execute c++ .exe file from php

2002-11-08 Thread Marek Kilimajer
escape your backslashes:

$cmd = c:\\abc\\hello.exe;



Ladan Pickering wrote:


I am unable to execute my c++ program from within PHP when it runs as a
cgi in Apache. 
I am able to run:

$cmd=dir c:\abc
system ($cmd, $errCode);

and see the content of the directory, but I don't seem to
be able to run a simple hello.exe (c++) file.

$cmd = c:\abc\hello.exe;
system ($cmd, $errCode);

The errCode always comes back with 128. What does 128 mean?

Here is some info on my setup.
OS: Windows XP
Server: Apache 2.0.43 (win32)
PHP 4.2.3
I am running PHP as a CGI

I am able to execute my c++ program (hello.exe) from this .php file 
just fine if I use the PHP cli.

I appreciate any help.


 



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




Re: [PHP] Unable to execute c++ .exe file from php

2002-11-08 Thread Ernest E Vogelsinger
At 15:30 08.11.2002, Ladan Pickering spoke out and said:
[snip]
I am unable to execute my c++ program from within PHP when it runs as a
cgi in Apache. 
I am able to run:

$cmd=dir c:\abc
system ($cmd, $errCode);

and see the content of the directory, but I don't seem to
be able to run a simple hello.exe (c++) file.

$cmd = c:\abc\hello.exe;
system ($cmd, $errCode);
[snip] 

I think you need to either escape the backslash (like c:\\abc\\hello.exe),
or simply use forward slashes (as c:/abc/hello.exe).


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



RE: [PHP] Wildcard search

2002-11-08 Thread Mark Charette
 -Original Message-
 From: Mako Shark [mailto:phpman2000;yahoo.com]
 do I have to do a
 readdir() and read the filename of every file until I find an
 HTML or until all files have been read.

This is what the shell expression supplied by Marco Tabini actually does;
doing it in PHP (readdir(), etc.) eliminates the exec of the shell process
and is faster (readdir() is a thin veneer on the readdir system call) and
the problem of portability if you want to use this on both Unix and Windows.


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




Re: [PHP] ob_gzhandler

2002-11-08 Thread Serge Paquin
I just realized that mod_deflate is for Apache 2.  I am still on the
Apache 1.3 tree so I don't beleive I can take advantage.

- Original Message -
From: Ernest E Vogelsinger [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 08, 2002 4:00 AM
Subject: Re: [PHP] ob_gzhandler


 At 07:45 08.11.2002, Serge Paquin said:
 [snip]
 Hello,
 
 Is their anyway to use ob_gzhandler along with another callback?
I've
 tried the following which does not work:
 
 function DoCache($buffer) {
 /* Do a bunch of stuff */
 return ob_gzhandler($buffer);
 }
 
 ob_start(DoCache);

 What do you mean by does not work? Does it output nothing, or can't
you
 see any compressed data?

 1) output is empty
 Must be an error in your DoCache() function - check the buffer you're
 passing to ob_gzhandler() by writing it to a file (you can't echo it
here...)

 2) you don't see compressed output
 2.a) That's how it is designed. ob_gzhandler checks the request headers to
 see if the browser supports any of the compressed formats (gzip, deflate),
 and if it doesn't find it then it simply does nothing.
 2.b) PHP needs to be compiled using --with-zlib to provide ob_gzhandler
 support. You don't get any error if you don't have zlib configured. Check
 phpinfo() to see if zlib support is available.


 Personal hint:
 If you're using the url_rewriter.tags and have session cookies disabled,
 ob_gzhandler will break this. The reason is that PHP parses the
 _very_final_ output to mangle the session identifier to any (local) url;
in
 case this _very_final_ output is compressed ir can't find any link and
 can't merge the session identifier.

 I personally believe it's better to have compression be done at the web
 server (refer to http://httpd.apache.org/docs-2.0/mod/mod_deflate.html).
 It's more general then, after all...


 --
O Ernest E. Vogelsinger
(\)ICQ #13394035
 ^ http://www.vogelsinger.at/



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

2002-11-08 Thread Ernest E Vogelsinger
At 15:48 08.11.2002, Serge Paquin spoke out and said:
[snip]
I get no output at all.

All DoCache does is write $buffer to a file then return $buffer since I use
this for some other serverside caching to save on database hits.

I have other areas that I call ob_start(ob_gzhandler) and that works fine
but when I call in via DoCache it breaks.

I much prefer your idea of mod_deflate.  I will look into that since I
believe that belongs in apache rather than a PHP program also.

I am still curious why it doesn't work though.

Here is my True DoCache function:

function docache ($buffer) {
$fp=fopen(cachefilename(), w);
if($fp)
fputs($fp,$buffer);

return ob_gzhandler($buffer);
}

cachefilename() simply returns an MD5 of the requested URI.

This will return a blank webpage in IE and Mozilla.  When I take out
ob_gzhandler it then works fine.
[snip] 

It seems to me your ob_gzhandler is broken... anyway, since PHP 4.0.3 the
output callback function has a second parameter called mode, even if you
don't do anythiong with it you should pass it on:

function docache ($buffer, $mode) {
   $fp=fopen(cachefilename(), w);
   if($fp)
   fputs($fp,$buffer);

   return ob_gzhandler($buffer, $mode);
}

But I doubt this would change anything here... ob_gzhandler _should_ return
some value. You have some output in the file do you?



-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] ob_gzhandler

2002-11-08 Thread Serge Paquin
Yes their is always output.

Also the way my system works if it finds a current cache file then it just does 
readfile and no database connection.

On that output I use ob_start(ob_gzhandler) and it outputs compressed without an 
error so it seems that ob_gzhandler is working fine that's the part that gets me.

Serge.

On Fri, 08 Nov 2002 15:58:12 +0100
Ernest E Vogelsinger [EMAIL PROTECTED] wrote:

 At 15:48 08.11.2002, Serge Paquin spoke out and said:
 [snip]
 I get no output at all.
 
 All DoCache does is write $buffer to a file then return $buffer since I use
 this for some other serverside caching to save on database hits.
 
 I have other areas that I call ob_start(ob_gzhandler) and that works fine
 but when I call in via DoCache it breaks.
 
 I much prefer your idea of mod_deflate.  I will look into that since I
 believe that belongs in apache rather than a PHP program also.
 
 I am still curious why it doesn't work though.
 
 Here is my True DoCache function:
 
 function docache ($buffer) {
 $fp=fopen(cachefilename(), w);
 if($fp)
 fputs($fp,$buffer);
 
 return ob_gzhandler($buffer);
 }
 
 cachefilename() simply returns an MD5 of the requested URI.
 
 This will return a blank webpage in IE and Mozilla.  When I take out
 ob_gzhandler it then works fine.
 [snip] 
 
 It seems to me your ob_gzhandler is broken... anyway, since PHP 4.0.3 the
 output callback function has a second parameter called mode, even if you
 don't do anythiong with it you should pass it on:
 
 function docache ($buffer, $mode) {
$fp=fopen(cachefilename(), w);
if($fp)
fputs($fp,$buffer);
 
return ob_gzhandler($buffer, $mode);
 }
 
 But I doubt this would change anything here... ob_gzhandler _should_ return
 some value. You have some output in the file do you?
 
 
 
 -- 
O Ernest E. Vogelsinger 
(\) ICQ #13394035 
 ^ http://www.vogelsinger.at/
 

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




Re: [PHP] ob_gzhandler

2002-11-08 Thread Ernest E Vogelsinger
At 16:08 08.11.2002, Serge Paquin spoke out and said:
[snip]
Yes their is always output.

Also the way my system works if it finds a current cache file then it just 
does readfile and no database connection.

On that output I use ob_start(ob_gzhandler) and it outputs compressed 
without an error so it seems that ob_gzhandler is working fine that's the 
part that gets me.
[snip] 

Hmm - one glitch comes to my mind - maybe you need to close the buffer file
before passing the buffer to ob_gzhandler?

function docache ($buffer, $mode) { 
$fp=fopen(cachefilename(), w); 
if($fp) {
fputs($fp,$buffer);
fclose($fp);
}
return ob_gzhandler($buffer, $mode); 
}

But I believe the problem must be somewhere in the outer logic - the
callback you showed doesn't do any discrimination if it has a cache file or
not. Check here, I'd suggest...


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



[PHP] How to echo the end marker '?'

2002-11-08 Thread Philipp Bolliger
Hi everyone,

subject's allready my question ! I want to echo something like : form 
action = \,?php echo $PHP_SELF ? \  so that the action becomes ? 
echo $PHP_SELF ? !! But I can't figure out how to escape ? so that the 
 interpreter doesn't take it as the end of the script ! Any idea ?

cheers, phibo


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



Re: [PHP] How to echo the end marker '?'

2002-11-08 Thread Ernest E Vogelsinger
At 12:15 08.11.2002, Philipp Bolliger spoke out and said:
[snip]
subject's allready my question ! I want to echo something like : form 
action = \,?php echo $PHP_SELF ? \  so that the action becomes ? 
echo $PHP_SELF ? !! But I can't figure out how to escape ? so that the 
  interpreter doesn't take it as the end of the script ! Any idea ?
[snip] 

Try 

echo 'form action=', '', '?', 'php echo $PHP_SELF', '?', '', '';

This should work (untested)


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



[PHP] Other Notice problem...

2002-11-08 Thread R B
This is not the same question i asked yesterday.

When i set error_reporting  =  E_ALL and display_errors = On in my php.ini, 
i get the next message:

Notice: Undefined variable: varname in .

How can i fix this problem without setting error_reporting  =  E_ALL  
~E_NOTICE and/or display_errors = Off, or what way do you think is the best 
to resolve this problem?

Thanks,

RB



_
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.microsoft.com/es


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



Re: [PHP] Other Notice problem...

2002-11-08 Thread Marco Tabini
This usually means that you're using a variable without having
initialized it. For example

$a = $b + 1;

will give you that warning if no value is assigned to $b prior to this
line. It's PHP's way of telling you that you might be doing something
wrong.

Perhaps if you post some of your code we can help better?


Marco

-
php|architect -- The Monthly Magazine For PHP Professionals
Come visit us on the web at http://www.phparch.com!

On Fri, 2002-11-08 at 10:31, R B wrote:
 This is not the same question i asked yesterday.
 
 When i set error_reporting  =  E_ALL and display_errors = On in my php.ini, 
 i get the next message:
 
 Notice: Undefined variable: varname in .
 
 How can i fix this problem without setting error_reporting  =  E_ALL  
 ~E_NOTICE and/or display_errors = Off, or what way do you think is the best 
 to resolve this problem?
 
 Thanks,
 
 RB
 
 
 
 _
 Charla con tus amigos en línea mediante MSN Messenger: 
 http://messenger.microsoft.com/es
 
 
 -- 
 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] Other Notice problem...

2002-11-08 Thread Ernest E Vogelsinger
At 16:31 08.11.2002, R B spoke out and said:
[snip]
This is not the same question i asked yesterday.

When i set error_reporting  =  E_ALL and display_errors = On in my php.ini, 
i get the next message:

Notice: Undefined variable: varname in .

How can i fix this problem without setting error_reporting  =  E_ALL  
~E_NOTICE and/or display_errors = Off, or what way do you think is the best 
to resolve this problem?
[snip] 

But it's the same answer ;-)
If you want to be completely warning-and-notice-free, you need to define
the variable before accessing it:

// this will give a notice
echo $undefined_var;

// and this won't
$define_var = 'some data, or simply put null here';
echo $defined_var;

The same holds true for array indices:

$test_array = array('One', 'Two', 'Three');

// this will give a notice
echo $test_array[3];

// and this won't
echo $test_array[2];

// and this won't as well
if (array_key_exists(3))
echo $test_array[3];

Get the idea? IMHO it's complete overkill with PHP to predefine variables
since they're auto-initialized with NULL when used first. These notices are
only for the development cycle, to aid us in spotting a problem where you
expect some data to be there, but it aint because the variable name has
been mistyped...


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] Weird behaviour with references to objects...

2002-11-08 Thread Tim Molendijk
Ernest E Vogelsinger [EMAIL PROTECTED] wrote in message
news:5.1.1.6.2.20021108092657.02befe20;mail.vogelsinger.at...
 At 03:36 08.11.2002, Tim Molendijk said:
 [snip]

 Ahh - culprit 1:

 You said the container is creating a child instance - I assume it's done
in
 the constructor...

 What you're doing here is to create a clone when assigning new()'s result
 to $testContainer1. You should rather
 $testContainer1 = new Container(TRUE);

 Note the ampersand here - if you don't you'll get a clone.

 Rule for references:
 If your object does something in its constructor, use a reference
 assignment for
 new class()


Ernest,

Before your post I accidently found out a solution:
$testContainer1 = new Container(TRUE) instead of $testContainer1 = new
Container(TRUE);

When I found this out I didn't understand WHY this was the solution...

Thanks to your comments I DO understand why... I suddenly see every jigsaw
piece fall in place :D

The difference between the first code snippet (that with $testContainer1)
and the second code snippet (that with $testContainer2) is that in code
snippet 2 the Container object is already constructed and assigned to
$testContainer2 when loading it. Then when it is loaded $this (in add())
refers to the object in $testContainer2 so no problem occurs.
But in code snippet 1 the Container object loads itself before it is
assigned to $testContainer1. During this process $this (in add()) refers to
the object that is being created. And now the core is: the object that is
being created is *not* the same object as the one that is assigned to
$testContainer1!! So the references to the created object will not refer to
$testContainer1!! That's it!!! I completely understand... Thanks a lot
Ernest!


 Again - make this
 $newChild = new Child(1);


 But you don't pass $child by reference! Make this
 function ($child)

 If you don't pass $child as a reference, the line
 $child-parent = $this;
 will set the parent value of the clone that's passed as an argument, and
 leave the original $child unmodified!


This is not true in my case, because instead of doing:
function add($child) { ... }
I do:
function add($child) { ... }
and then call it with:
$this-add($child);

This has the same result... As far as I know I doesn't matter whether you
put an ampersand before the variable in your function definition or your in
your function call.

 Crosscheck all of your class code (and the code utilizing it) it you're
 always passing references. Ref's work like a charm until you mess up at a
 single location. Well, having made my way from C/C++ to PHP I'd rather
deal
 with pointers, but unfortunately PHP doesn't have them. So keep an eye
open .-)


The problem is solved and I completely understand why now. This last thing
is thanks to you Ernest.

Regards,
Tim


 --
O Ernest E. Vogelsinger
(\)ICQ #13394035
 ^ http://www.vogelsinger.at/





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




Re: [PHP] File locking problem

2002-11-08 Thread Charles Wiltgen
Krzysztof Dziekiewicz wrote...

 Do you use include or require. In such situation you should not use
 include.

I tried require() too, but it made no difference.  I later learned that if
you fopen(), write some stuff, fflush() and ffclose(), that doesn't mean the
file is complete (or that it even exists).

This has to be a PHP bug, which I'd be happy to file if someone more
experienced could confirm that it isn't stupid user error.

For a workaround, after I fflush() and fclose() I while() until the file
exists, and then while() until it's larger than 10 bytes.  I should while()
until it's the size of the data I've written, but this method has been
reliable so far.

-- 
Charles Wiltgen

   Well, once again my friend, we find that science is a two-headed beast.
One head is nice, it gives us aspirin and other modern conveniences...
but the other head of science is bad!  Oh beware the other head of
science...it bites! -- The Tick





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




Re: [PHP] Weird behaviour with references to objects...

2002-11-08 Thread Ernest E Vogelsinger
At 16:48 08.11.2002, Tim Molendijk spoke out and said:
[snip]
The problem is solved and I completely understand why now. This last thing
is thanks to you Ernest.
[snip] 

Glad it works - you're very welcome :)


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] Weird behaviour with references to objects...

2002-11-08 Thread Ernest E Vogelsinger
One more:

At 16:48 08.11.2002, Tim Molendijk spoke out and said:
[snip]

This is not true in my case, because instead of doing:
function add($child) { ... }
I do:
function add($child) { ... }
and then call it with:
$this-add($child);

This has the same result... As far as I know I doesn't matter whether you
put an ampersand before the variable in your function definition or your in
your function call.
[snip] 

True for now, but this is officially deprecated. Functions or methods
accepting a reference are required to be prototyped that way - this helps
you not to forget to pass by reference. You really should modify your
functions using reference parameters when declaring them, if you're using
references...


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] PHP fopen() bug + solution

2002-11-08 Thread Charles Wiltgen
Ernest,

 To be more effective, and to allow the OS to do something else while you're
 waiting at the file, your script should sleep for some microseconds...

An excellent suggestion, thanks very much!   :^)

-- Charles Wiltgen


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




Re: [PHP] File locking problem

2002-11-08 Thread Ernest E Vogelsinger
At 16:50 08.11.2002, Charles Wiltgen spoke out and said:
[snip]
I tried require() too, but it made no difference.  I later learned that if
you fopen(), write some stuff, fflush() and ffclose(), that doesn't mean the
file is complete (or that it even exists).

This has to be a PHP bug, which I'd be happy to file if someone more
experienced could confirm that it isn't stupid user error.
[snip] 

I don't believe it has something to do with PHP, much more with the FTP
server you're accessing... This might delay the actual flushing for what
reason ever. I don't believe PHP buffers files differently if they are
accessed using an fopen url wrapper.


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] For ... = max($myArray) vs For ... = $max

2002-11-08 Thread Kjartan Mannes
Friday, November 8, 2002, 12:13:01 PM, Daevid Vincent wrote:
 $max = max($myArray);
 for( $x = 1; $x = $length; $x++ ) {}

  -- OR --

 for( $x = 1; $x = max($myArray); $x++ ) {}

 My gut instinct tells me since PHP is interpreted, that the top one is
 the better way to go, but with the Zend Optimizer, I don't know if PHP
 handles them the same way or not?

The first one is faster, but it depends on the site of the array and how
often you call the loop. I prefer doing it like this though:

 for($x = 1, $max = count($myArray); $x = $max; $x++ ) {}

For some good optimization (and other) tips check out:
  http://phplens.com/lens/php-book/optimizing-debugging-php.php
  http://www.lerdorf.com/tips.pdf

-- 
Kjartan [EMAIL PROTECTED] (http://natrak.net/)
:: Silence is one great art of conversation.


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




Re: [PHP] Weird behaviour with references to objects...

2002-11-08 Thread Tim Molendijk

Ernest E Vogelsinger [EMAIL PROTECTED] wrote in message
news:5.1.1.6.2.20021108165218.03238948;mail.vogelsinger.at...
 One more:

 True for now, but this is officially deprecated. Functions or methods
 accepting a reference are required to be prototyped that way - this
helps
 you not to forget to pass by reference. You really should modify your
 functions using reference parameters when declaring them, if you're using
 references...


Yes I know it is poor programming habits to do like I did... But I have a
reason for it. I have quite a lot methods that accept objects *optional*. So
f.e.:
---
class Product
{
var $language;
function Product($language = FALSE)
{
$this-language = $language;
}
}
---
Now to make this possible it becomes impossible to do what you suggest:
function Product($language = FALSE)
is not allowed. And in my application this optional arguments functionality
is very important. So I have preferred this over the decent habit.


 --
O Ernest E. Vogelsinger
(\) ICQ #13394035
 ^ http://www.vogelsinger.at/




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




Re: [PHP] Other Notice problem...

2002-11-08 Thread R B
My code is:

?php
 some code.
 
 

 if ($status == ADD) {

   some code ...
   ...
   ...
 }
?
The message is: Notice: Undefined variable: status in 

I'm going to explain how my script work.
I have an php page (addProduct.php) with an input form. I have 2 buttons 
(add and cancel) and a hidden control with name=status. If i press the add 
button, the page submit the form data to the same page (form 
action=addProduct.php) with status hidden control name set to ADD, so the 
if statement its true only if i press the add button.
I see the message when i call the page to add the data not when i submit the 
data.

How can i fix the problem? or there is another best way to do this?



From: Marco Tabini [EMAIL PROTECTED]
To: R B [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: [PHP] Other Notice problem...
Date: 08 Nov 2002 10:25:46 -0500

This usually means that you're using a variable without having
initialized it. For example

$a = $b + 1;

will give you that warning if no value is assigned to $b prior to this
line. It's PHP's way of telling you that you might be doing something
wrong.

Perhaps if you post some of your code we can help better?


Marco

-
php|architect -- The Monthly Magazine For PHP Professionals
Come visit us on the web at http://www.phparch.com!

On Fri, 2002-11-08 at 10:31, R B wrote:
 This is not the same question i asked yesterday.

 When i set error_reporting  =  E_ALL and display_errors = On in my 
php.ini,
 i get the next message:

 Notice: Undefined variable: varname in .

 How can i fix this problem without setting error_reporting  =  E_ALL 
 ~E_NOTICE and/or display_errors = Off, or what way do you think is the 
best
 to resolve this problem?

 Thanks,

 RB



 _
 Charla con tus amigos en línea mediante MSN Messenger:
 http://messenger.microsoft.com/es


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



_
MSN. Más Útil Cada Día http://www.msn.es/intmap/


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




Re: [PHP] Weird behaviour with references to objects...

2002-11-08 Thread Ernest E Vogelsinger
At 17:04 08.11.2002, Tim Molendijk spoke out and said:
[snip]
Yes I know it is poor programming habits to do like I did... But I have a
reason for it. I have quite a lot methods that accept objects *optional*. So
f.e.:
---
class Product
{
var $language;
function Product($language = FALSE)
{
$this-language = $language;
}
}
---
Now to make this possible it becomes impossible to do what you suggest:
function Product($language = FALSE)
is not allowed. And in my application this optional arguments functionality
is very important. So I have preferred this over the decent habit.
[snip] 

You might always simply omit the parameter when calling the function
(you'll get a notice about that if enabled). You just cannot pass constants:

function Product($language)
{
   ...
}

// ok, but gives a notice
Product();

// will fail
Product('ger');

If you keep your code like it is be warned that it may break with a future
version of PHP.


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] Other Notice problem...

2002-11-08 Thread Marco Tabini
Try

if (isset ($status)  $status == 'ADD')

instead... this should take care of the error--IF you're sure that the
fact that the $status variable is not set at that point is ok.


Marco

-
php|architect -- The Monthly Magazine For PHP Professionals
Come visit us on the web at http://www.phparch.com!

On Fri, 2002-11-08 at 11:04, R B wrote:
 My code is:
 
 ?php
   some code.
   
   
 
   if ($status == ADD) {
 
 some code ...
 ...
 ...
   }
 ?
 The message is: Notice: Undefined variable: status in 
 
 I'm going to explain how my script work.
 I have an php page (addProduct.php) with an input form. I have 2 buttons 
 (add and cancel) and a hidden control with name=status. If i press the add 
 button, the page submit the form data to the same page (form 
 action=addProduct.php) with status hidden control name set to ADD, so the 
 if statement its true only if i press the add button.
 I see the message when i call the page to add the data not when i submit the 
 data.
 
 How can i fix the problem? or there is another best way to do this?
 
 
 
 From: Marco Tabini [EMAIL PROTECTED]
 To: R B [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 Subject: Re: [PHP] Other Notice problem...
 Date: 08 Nov 2002 10:25:46 -0500
 
 This usually means that you're using a variable without having
 initialized it. For example
 
 $a = $b + 1;
 
 will give you that warning if no value is assigned to $b prior to this
 line. It's PHP's way of telling you that you might be doing something
 wrong.
 
 Perhaps if you post some of your code we can help better?
 
 
 Marco
 
 -
 php|architect -- The Monthly Magazine For PHP Professionals
 Come visit us on the web at http://www.phparch.com!
 
 On Fri, 2002-11-08 at 10:31, R B wrote:
   This is not the same question i asked yesterday.
  
   When i set error_reporting  =  E_ALL and display_errors = On in my 
 php.ini,
   i get the next message:
  
   Notice: Undefined variable: varname in .
  
   How can i fix this problem without setting error_reporting  =  E_ALL 
   ~E_NOTICE and/or display_errors = Off, or what way do you think is the 
 best
   to resolve this problem?
  
   Thanks,
  
   RB
  
  
  
   _
   Charla con tus amigos en línea mediante MSN Messenger:
   http://messenger.microsoft.com/es
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
 _
 MSN. Más Útil Cada Día http://www.msn.es/intmap/
 



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




Re: [PHP] Other Notice problem...

2002-11-08 Thread Ernest E Vogelsinger
At 17:04 08.11.2002, R B spoke out and said:
[snip]
I'm going to explain how my script work.
I have an php page (addProduct.php) with an input form. I have 2 buttons 
(add and cancel) and a hidden control with name=status. If i press the add 
button, the page submit the form data to the same page (form 
action=addProduct.php) with status hidden control name set to ADD, so the 
if statement its true only if i press the add button.
I see the message when i call the page to add the data not when i submit the 
data.
[snip] 

Ahhh your $status variable should be a form variable? Well, as pointed
out many times the last days, register_globals is OFF by default since PHP
v.4.something. Either turn register_globals on in your PHP.ini (bad and
deprecated, read the security bulletins), or you refer to the _POST array:

if ($_POST['status'] == ADD)

if the data is not set (the status control empty), you'll still get a
notice about an undefined array index, so you might

if (array_key_exists('status', $_POST)) {
switch ($_POST['status']) {
case 'ADD':
break;
default:
echo 'Unsupported status!';
}
}
else echo 'No status sent!';



-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] Wildcard search

2002-11-08 Thread Mako Shark

$a = explode (' ', shell_exec (ls $foldername/*.html));

 

Didn't know of shell_exec() until now. It works, though. Thanks!

Is there any reason why it wouldn't work? If I changed servers, say, and there were 
some ports blocked and etc. etc., is there a risk that I should know?





-
Do you Yahoo!?
U2 on LAUNCH - Exclusive medley  videos from Greatest Hits CD


Re: [PHP] Wildcard search

2002-11-08 Thread Marco Tabini
Well, as a general rule, it won't work if you're not using a UNIX o/s or
if PHP has been set up with safe mode on, or if you don't have the right
permission to see that folder. That's probably a non-inclusive list, but
there should be ways around each of these problems (depending on the
degree of control you have over the server).


Marco

-
php|architect -- The Monthly Magazine For PHP Professionals
Come visit us on the web at http://www.phparch.com!


 On Fri, 2002-11-08 at 11:14, Mako Shark wrote:
 
 $a = explode (' ', shell_exec (ls $foldername/*.html));
 
  
 
 Didn't know of shell_exec() until now. It works, though. Thanks!
 
 Is there any reason why it wouldn't work? If I changed servers, say, and there were 
some ports blocked and etc. etc., is there a risk that I should know?
 
 
 
 
 
 -
 Do you Yahoo!?
 U2 on LAUNCH - Exclusive medley  videos from Greatest Hits CD



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




[PHP] registering object in session - Object to string notice error?

2002-11-08 Thread Paul

I have a simple object/class:

Class MainData {
Var items =array();

...some other functions but nothing to initialize it
}

in a code when I do :

$somevar= new MainData();
session_register($somevar);

I get notice type of error:
Notice: Object to string conversion in C...\page_vip.php on line 27

How can I avoid this? It does not stop code and it is not a fatal error
but perhaps I am missing something

Paul



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




Re: [PHP] Other Notice problem...

2002-11-08 Thread R B
The array_key_exists or isset is a good solution.
About your comment, i have the register_globals=on.
I have 2 questions:

1.- What's the relation to have register_globals=off with this notice 
message?

2.- I read the security comment about register_globals=on in the php.ini, 
but i set to on because if i set to off, i can't pass GET variables to other 
page. how can you pass GET variables to other page without setting 
register_globals=on?



From: Ernest E Vogelsinger [EMAIL PROTECTED]
To: R B [EMAIL PROTECTED]
CC: [EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: Re: [PHP] Other Notice problem...
Date: Fri, 08 Nov 2002 17:14:30 +0100

At 17:04 08.11.2002, R B spoke out and said:
[snip]
I'm going to explain how my script work.
I have an php page (addProduct.php) with an input form. I have 2 buttons
(add and cancel) and a hidden control with name=status. If i press the 
add
button, the page submit the form data to the same page (form
action=addProduct.php) with status hidden control name set to ADD, so 
the
if statement its true only if i press the add button.
I see the message when i call the page to add the data not when i submit 
the
data.
[snip]

Ahhh your $status variable should be a form variable? Well, as pointed
out many times the last days, register_globals is OFF by default since PHP
v.4.something. Either turn register_globals on in your PHP.ini (bad and
deprecated, read the security bulletins), or you refer to the _POST array:

if ($_POST['status'] == ADD)

if the data is not set (the status control empty), you'll still get a
notice about an undefined array index, so you might

if (array_key_exists('status', $_POST)) {
switch ($_POST['status']) {
case 'ADD':
break;
default:
echo 'Unsupported status!';
}
}
else echo 'No status sent!';



--
   O Ernest E. Vogelsinger
   (\) ICQ #13394035
^ http://www.vogelsinger.at/


_
MSN. Más Útil Cada Día http://www.msn.es/intmap/


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




Re: [PHP] Other Notice problem...

2002-11-08 Thread Ernest E Vogelsinger
At 17:27 08.11.2002, R B spoke out and said:
[snip]
The array_key_exists or isset is a good solution.
About your comment, i have the register_globals=on.
I have 2 questions:

1.- What's the relation to have register_globals=off with this notice 
message?

If register_globals is OFF, $status will simply not be set by PHP. You can
always access it as $_POST['status'] or $_REQUEST['status'].

2.- I read the security comment about register_globals=on in the php.ini, 
but i set to on because if i set to off, i can't pass GET variables to other 
page. how can you pass GET variables to other page without setting 
register_globals=on?

What do you mean by pass it on to other page? I'm afraid I don't get you.
What are you trying to accomplish?


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



[PHP] php/html debug

2002-11-08 Thread Anna Gyor
Hi,

is there any software on the market with I can test my html/php based web
portal? I mean for example the data flow between html forms and php
files/scripts. For Example a login form on html site and a check with an
other php site and I want begin the test on the html site and check weather
the right values goes to the php script.

Thanks!



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




Re: [PHP] Weird behaviour with references to objects...

2002-11-08 Thread Tim Molendijk

Ernest E Vogelsinger [EMAIL PROTECTED] wrote in message
news:5.1.1.6.2.20021108170633.00b8cb60;mail.vogelsinger.at...

 You might always simply omit the parameter when calling the function
 (you'll get a notice about that if enabled). You just cannot pass
constants:

 function Product($language)
 {
...
 }

 // ok, but gives a notice
 Product();

 // will fail
 Product('ger');


ok well that's an idea indeed... i'll think about it.

 If you keep your code like it is be warned that it may break with a future
 version of PHP.


why do you think it won't be supported by future versions? all i do is
passing an object by reference. because in this case this function always
should accept its argument as a reference and therefore is bad programming
habit does not mean the php construction is bad or weird!?!


 --
O Ernest E. Vogelsinger
(\) ICQ #13394035
 ^ http://www.vogelsinger.at/




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




Re: [PHP] Other Notice problem...

2002-11-08 Thread R B
About your comment 1:

if i have register_globals=on, why $status is not be set by PHP?

About your comment 2:

if i have 2 pages: p01.php and p02.php,
with p01.php code:
...
...
a href=p02.php?pp=2link/a
...
...

and p02.php code:
...
...
echo $pp;
...
...

If i have register_globals=off, then when i click the link, in p02.php page, 
the echo command display nothing.
If i have register_globals=on, then the echo command displays the value buy 
this way is deprecated.
How can i run the script without problems having register_globals=off?

Thanks,

RB




From: Ernest E Vogelsinger [EMAIL PROTECTED]
To: R B [EMAIL PROTECTED]
CC: [EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: Re: [PHP] Other Notice problem...
Date: Fri, 08 Nov 2002 17:31:25 +0100

At 17:27 08.11.2002, R B spoke out and said:
[snip]
The array_key_exists or isset is a good solution.
About your comment, i have the register_globals=on.
I have 2 questions:

1.- What's the relation to have register_globals=off with this notice
message?

If register_globals is OFF, $status will simply not be set by PHP. You can
always access it as $_POST['status'] or $_REQUEST['status'].

2.- I read the security comment about register_globals=on in the php.ini,
but i set to on because if i set to off, i can't pass GET variables to 
other
page. how can you pass GET variables to other page without setting
register_globals=on?

What do you mean by pass it on to other page? I'm afraid I don't get you.
What are you trying to accomplish?


--
   O Ernest E. Vogelsinger
   (\) ICQ #13394035
^ http://www.vogelsinger.at/


_
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.microsoft.com/es


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



[PHP] problem compiling php

2002-11-08 Thread dk1eng
hi there again,
here's the problem:
I compiled apache using --enable-modules=so
What do i need to do now in order to compile and install php on my machine?
Furthermore, how do i add mysql support to apache? Is there a 
--with-mysql switch?
Kind regards,
dimitris


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



Re: [PHP] Other Notice problem...

2002-11-08 Thread Stuart
On Friday, Nov 8, 2002, at 16:44 Europe/London, R B wrote:

if i have 2 pages: p01.php and p02.php,
with p01.php code:
...
...
a href=p02.php?pp=2link/a
...
...

and p02.php code:
...
...
echo $pp;
...
...

If i have register_globals=off, then when i click the link, in p02.php 
page, the echo command display nothing.
If i have register_globals=on, then the echo command displays the 
value buy this way is deprecated.
How can i run the script without problems having register_globals=off?

p02.php code:
...
...
echo $_GET['pp'];
...
...

--
Stuart


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




Re: [PHP] Other Notice problem...

2002-11-08 Thread R B
And without using the $_GET[] array.




From: Stuart [EMAIL PROTECTED]
To: R B [EMAIL PROTECTED]
CC: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [PHP] Other Notice problem...
Date: Fri, 8 Nov 2002 16:52:50 +

On Friday, Nov 8, 2002, at 16:44 Europe/London, R B wrote:

if i have 2 pages: p01.php and p02.php,
with p01.php code:
...
...
a href=p02.php?pp=2link/a
...
...

and p02.php code:
...
...
echo $pp;
...
...

If i have register_globals=off, then when i click the link, in p02.php 
page, the echo command display nothing.
If i have register_globals=on, then the echo command displays the value 
buy this way is deprecated.
How can i run the script without problems having register_globals=off?

p02.php code:
...
...
echo $_GET['pp'];
...
...

--
Stuart



_
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.microsoft.com/es


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



Re: [PHP] Weird behaviour with references to objects...

2002-11-08 Thread Ernest E Vogelsinger
At 17:32 08.11.2002, Tim Molendijk spoke out and said:
[snip]
why do you think it won't be supported by future versions? all i do is
passing an object by reference. because in this case this function always
should accept its argument as a reference and therefore is bad programming
habit does not mean the php construction is bad or weird!?!
[snip] 

This is clearly said in your PHP.ini file:

; Whether to enable the ability to force arguments to be passed by reference
; at function call time.  This method is deprecated and is likely to be
; unsupported in future versions of PHP/Zend.  The encouraged method of
; specifying which arguments should be passed by reference is in the function
; declaration.  You're encouraged to try and turn this option Off and make
; sure your scripts work properly with it in order to ensure they will work
; with future versions of the language (you will receive a warning each time
; you use this feature, and the argument will be passed by value instead of by
; reference).
allow_call_time_pass_reference = On

...god has spoken :)

I'd rather have the abilty to pass A reference like foo($a) and have the
opportunity to choose at runtime if I want to use a reference here or not,
but it's how they say...


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] Other Notice problem...

2002-11-08 Thread Stuart
On Friday, Nov 8, 2002, at 16:56 Europe/London, R B wrote:

And without using the $_GET[] array.


Why don't you want to use the $_GET array? If you really don't want to 
use it you can use the extract function but if you're going to do that 
you might as well have register_globals on.

--
Stuart

p02.php code:
...
...
echo $_GET['pp'];
...
...

--
Stuart



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




[PHP] ftp file exists

2002-11-08 Thread Fifield, Mike
How do you check if a file exists a remote ftp site. 




Re: [PHP] problem compiling php

2002-11-08 Thread Jason Wong
On Saturday 09 November 2002 00:52, dk1eng wrote:
 hi there again,
 here's the problem:
 I compiled apache using --enable-modules=so
 What do i need to do now in order to compile and install php on my machine?

The manual says it all. Basically:

./configure --with-apxs=/usr/local/apache/bin/apxs \  
  --with-config-file-path=/usr/local/apache/conf ...

If you want a more comprehensive set of installation instructions have a look 
at the LAMP guide, google for lamp install php apache mysql, it's a bit 
old but the stuff there should still be relevant.

 Furthermore, how do i add mysql support to apache? Is there a
 --with-mysql switch?

You probably want to add mysql support to PHP rather than apache.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Our policy is, when in doubt, do the right thing.
-- Roy L. Ash, ex-president, Litton Industries
*/


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




Re: [PHP] problem compiling php

2002-11-08 Thread .: B i g D o g :.
i would always make sure you check the manuals for the information
first...

http://www.php.net/manual/en/install.apache.php

On Fri, 2002-11-08 at 16:52, dk1eng wrote:
 hi there again,
 here's the problem:
 I compiled apache using --enable-modules=so
 What do i need to do now in order to compile and install php on my machine?
 Furthermore, how do i add mysql support to apache? Is there a 
 --with-mysql switch?
 Kind regards,
 dimitris
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
.: B i g D o g :.



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




Re: [PHP] ftp file exists

2002-11-08 Thread Marco Tabini
Try 

$f = fopen ('ftp://server/filename', 'r');

if $f is null, the file doesn't exist. Otherwise, it exists and you have
to fclose ($f). FTP support has to be compiled into your version of PHP
for this to work.


Marco

-
php|architect -- The Monthly Magazine For PHP Professionals
Come visit us on the web at http://www.phparch.com!



On Fri, 2002-11-08 at 12:01, Fifield, Mike wrote:
 How do you check if a file exists a remote ftp site. 
 



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




Re: [PHP] Other Notice problem...

2002-11-08 Thread Ernest E Vogelsinger
At 17:44 08.11.2002, R B spoke out and said:
[snip]
About your comment 1:

if i have register_globals=on, why $status is not be set by PHP?

well _then_ we have 2 possibilities:
1) your form input field isn't named status but rather Status or
STATUS - take care of the case here, PHP is case sensitive with variables
and associative indices.
2) Your form simply submits _nothing_ in this field - check your JavaScript
(perhaps it is disabled?)

About your comment 2:

if i have 2 pages: p01.php and p02.php,
with p01.php code:
...
a href=p02.php?pp=2link/a
...

and p02.php code:
...
echo $pp;

If i have register_globals=off, then when i click the link, in p02.php page, 
the echo command display nothing.
If i have register_globals=on, then the echo command displays the value buy 
this way is deprecated.
How can i run the script without problems having register_globals=off?

?php
$parms = null;
foreach ($_GET as $p=$v) {
   if ($parms) $parms .= '';
   $parms .= $p=.urlencode($v);
}
?
...
a href=p02.php??php=$parms?

This will do what you want (untested, but should work)


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] php/html debug

2002-11-08 Thread .: B i g D o g :.
I have used nusphere PHPEd and it works okay...but i do not know what
you are really trying to do here...


On Fri, 2002-11-08 at 16:31, Anna Gyor wrote:
 Hi,
 
 is there any software on the market with I can test my html/php based web
 portal? I mean for example the data flow between html forms and php
 files/scripts. For Example a login form on html site and a check with an
 other php site and I want begin the test on the html site and check weather
 the right values goes to the php script.
 
 Thanks!
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
-- 
.: B i g D o g :.



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




Re: [PHP] Other Notice problem...

2002-11-08 Thread Jason Wong
On Saturday 09 November 2002 00:52, Stuart wrote:
  How can i run the script without problems having register_globals=off?

 p02.php code:
 ...
 ...
 echo $_GET['pp'];
 ...
 ...

Yes. And try reading the manual, or the archives.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
While money can't buy happiness, it certainly lets you choose your own
form of misery.
*/


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




Re: [PHP] Other Notice problem...

2002-11-08 Thread Jason Wong
On Saturday 09 November 2002 00:56, R B wrote:
 And without using the $_GET[] array.

Probably by using black magic instead -- or maybe use $_REQUEST, but I don't 
think you want to use that either :)

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Auribus teneo lupum.
[I hold a wolf by the ears.]
[Boy, it *sounds* good.  But what does it *mean*?]
*/


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




Re: [PHP] ftp file exists

2002-11-08 Thread Jule Slootbeek
if there's no function to check (which i can;t find real quick) do 
soething like this:

if (!ftp_mdtm($conn_id, $file) {
	echo File doesn't exist;
} else {
	echo File exist;
}

On Friday, Nov 8, 2002, at 12:01 US/Eastern, Fifield, Mike wrote:

How do you check if a file exists a remote ftp site.



Jule Slootbeek
[EMAIL PROTECTED]


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




  1   2   3   >