[PHP] str_replace problem

2004-10-20 Thread Chris Ditty
Hi all.  I'm trying to do a little code snippets page for a site I am
working on.  I figured it would be simple enough.  I would do a
str_replace and replace the various html codes with the ascii
eqivulant.  Unfortunately, it is not working as expected.  Can anyone
help with this?

This is what I am using.
$snippetCode = str_replace(\n, br, $snippet['snippetCode']);
$snippetCode = str_replace(, gt;, $snippetCode);
$snippetCode = str_replace(, lt;, $snippetCode);
$snippetCode = str_replace(, amp;, $snippetCode);

This is what is in $snippet['snippetCode'].
?pre? print_r($ArrayName); ?/pre?

This is what is showing on the web page.
?lt;gt;prelt;gt;? print_r($ArrayName); ?lt;gt;/prelt;gt;?

If anyone can help, it would be appreciated.  Also, if you have a
quick and dirty code colorer, I would appreciate that.

Thanks
Chris

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



[PHP] File Copy

2004-10-20 Thread Aidal
Hi NG.

I'm experiencing some problems when trying to copy a file from one location
to another on the web server.

example:

dir1/subdir1/some_image_name.jpg  --  dir2/subdir2/some_new_image_name.jpg

When I do this the file permissions changes and I'm no longer the owner of
the file. I tried to use chmod('the_new_file', 0777); but it doesn't work,
because chmod() wont let me change the permissions since I'm not the owner
of this new file.

The server runs on some kind of UNIX based system...

Any help or suggestions would be much appreciated, thanks.

/Aidal

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



Re: [PHP] str_replace problem

2004-10-20 Thread Silvio Porcellana
Chris Ditty wrote:
Hi all.  I'm trying to do a little code snippets page for a site I am
working on.  I figured it would be simple enough.  I would do a
str_replace and replace the various html codes with the ascii
eqivulant.  Unfortunately, it is not working as expected.  Can anyone
help with this?
What is that you are actually expecting?
This is what I am using.
$snippetCode = str_replace(\n, br, $snippet['snippetCode']);
nl2br() [http://php.libero.it/manual/en/function.nl2br.php]
$snippetCode = str_replace(, gt;, $snippetCode);
$snippetCode = str_replace(, lt;, $snippetCode);
$snippetCode = str_replace(, amp;, $snippetCode);
This is what is in $snippet['snippetCode'].
?pre? print_r($ArrayName); ?/pre?
This is what is showing on the web page.
?lt;gt;prelt;gt;? print_r($ArrayName); ?lt;gt;/prelt;gt;?
This is what you are asking PHP to do.
Actually - to achieve this - it would be better to use the 'htmlspecialchars()' function 
[http://php.libero.it/manual/en/function.htmlspecialchars.php]

Anyway, probably I didn't understand what you want from your code...
Cheers!
Silvio Porcellana
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] File Copy

2004-10-20 Thread Silvio Porcellana
Aidal wrote:
Hi NG.
I'm experiencing some problems when trying to copy a file from one location
to another on the web server.
example:
dir1/subdir1/some_image_name.jpg  --  dir2/subdir2/some_new_image_name.jpg
When I do this the file permissions changes and I'm no longer the owner of
the file. I tried to use chmod('the_new_file', 0777); but it doesn't work,
because chmod() wont let me change the permissions since I'm not the owner
of this new file.
The owner should now be the user the Web server is running as.
To change file ownerships you need to use the PHP FTP functions.
Check out these pages: http://php.libero.it/manual/en/ref.ftp.php
HTH, cheers!
Silvio Porcellana
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] File Copy

2004-10-20 Thread Aidal
ftp_chmod() is part of PHP 5 and I'm working with PHP 4.3.1.

I tried the ftp_raw('CHMOD 777 filename.jpg'); doesn't work either though :(

Silvio Porcellana [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Aidal wrote:
  Hi NG.
 
  I'm experiencing some problems when trying to copy a file from one
location
  to another on the web server.
 
  example:
 
  dir1/subdir1/some_image_name.jpg  --
dir2/subdir2/some_new_image_name.jpg
 
  When I do this the file permissions changes and I'm no longer the owner
of
  the file. I tried to use chmod('the_new_file', 0777); but it doesn't
work,
  because chmod() wont let me change the permissions since I'm not the
owner
  of this new file.
 
 The owner should now be the user the Web server is running as.
 To change file ownerships you need to use the PHP FTP functions.
 Check out these pages: http://php.libero.it/manual/en/ref.ftp.php

 HTH, cheers!
 Silvio Porcellana

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



Re: [PHP] File Copy

2004-10-20 Thread M. Sokolewicz
how about setting the correct umask. Or else su'ing to the correct user 
before moving it.

Aidal wrote:
ftp_chmod() is part of PHP 5 and I'm working with PHP 4.3.1.
I tried the ftp_raw('CHMOD 777 filename.jpg'); doesn't work either though :(
Silvio Porcellana [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Aidal wrote:
Hi NG.
I'm experiencing some problems when trying to copy a file from one
location
to another on the web server.
example:
dir1/subdir1/some_image_name.jpg  --
dir2/subdir2/some_new_image_name.jpg
When I do this the file permissions changes and I'm no longer the owner
of
the file. I tried to use chmod('the_new_file', 0777); but it doesn't
work,
because chmod() wont let me change the permissions since I'm not the
owner
of this new file.
The owner should now be the user the Web server is running as.
To change file ownerships you need to use the PHP FTP functions.
Check out these pages: http://php.libero.it/manual/en/ref.ftp.php
HTH, cheers!
Silvio Porcellana
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] File Copy

2004-10-20 Thread Aidal
ERR, I meant I tried ftp_exec(), ftp_raw() is a PHP 5 function too...

Aidal [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 ftp_chmod() is part of PHP 5 and I'm working with PHP 4.3.1.

 I tried the ftp_raw('CHMOD 777 filename.jpg'); doesn't work either though
:(

 Silvio Porcellana [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Aidal wrote:
   Hi NG.
  
   I'm experiencing some problems when trying to copy a file from one
 location
   to another on the web server.
  
   example:
  
   dir1/subdir1/some_image_name.jpg  --
 dir2/subdir2/some_new_image_name.jpg
  
   When I do this the file permissions changes and I'm no longer the
owner
 of
   the file. I tried to use chmod('the_new_file', 0777); but it doesn't
 work,
   because chmod() wont let me change the permissions since I'm not the
 owner
   of this new file.
  
  The owner should now be the user the Web server is running as.
  To change file ownerships you need to use the PHP FTP functions.
  Check out these pages: http://php.libero.it/manual/en/ref.ftp.php
 
  HTH, cheers!
  Silvio Porcellana

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



Re: [PHP] File Copy

2004-10-20 Thread Chris Dowell
Aidal
Could you post the relevant parts of your code so we have a little 
context to work in?

You say you're copying a file from one location to another on the same 
server. If this is the case you are very unlikely to be in need of the 
ftp family of functions, which are only valid for use over an 
established ftp connection.

I suspect that the file is indeed now owned by the webserver
has it changed from aidal:somegroup to nobody:nogroup or something like 
that?

Post us some code and the answers you get will probably be more useful
Cheers
Chris
Aidal wrote:
ftp_chmod() is part of PHP 5 and I'm working with PHP 4.3.1.
I tried the ftp_raw('CHMOD 777 filename.jpg'); doesn't work either though :(
Silvio Porcellana [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Aidal wrote:
Hi NG.
I'm experiencing some problems when trying to copy a file from one
location
to another on the web server.
example:
dir1/subdir1/some_image_name.jpg  --
dir2/subdir2/some_new_image_name.jpg
When I do this the file permissions changes and I'm no longer the owner
of
the file. I tried to use chmod('the_new_file', 0777); but it doesn't
work,
because chmod() wont let me change the permissions since I'm not the
owner
of this new file.
The owner should now be the user the Web server is running as.
To change file ownerships you need to use the PHP FTP functions.
Check out these pages: http://php.libero.it/manual/en/ref.ftp.php
HTH, cheers!
Silvio Porcellana

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


Re: [PHP] File Copy

2004-10-20 Thread Silvio Porcellana
Chris Dowell wrote:
Aidal
Could you post the relevant parts of your code so we have a little 
context to work in?

You say you're copying a file from one location to another on the same 
server. If this is the case you are very unlikely to be in need of the 
ftp family of functions, which are only valid for use over an 
established ftp connection.

You can indeed establish an FTP connection to your local server - provided it has an FTP 
server running.
The files are actually copied by Apache (or whatever Web server he's using), so this is 
why the server becomes the owner.

I suspect that the file is indeed now owned by the webserver
has it changed from aidal:somegroup to nobody:nogroup or something like 
that?

I guess this is the problem Aidal is experiencing.
In order to maintain file ownserships, what he can do (since he doesn't have PHP 5) is 
copy the file with 'ftp_fput()' [http://php.libero.it/manual/en/function.ftp-fput.php].
That is, he opens the files he wants to copy and PUTs it via this function. Since he is 
logged in - using 'ftp_connect()' and 'ftp_login()' - the files will be owned by the user 
he used to login.

My .2 euros...
Cheers,
Silvio Porcellana
snip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] CPU usage @5% during 2 minutes

2004-10-20 Thread Marek Kilimajer
Janke Dvid wrote:
2004-10-20, sze keltezssel 00:19-kor Ed Lazor ezt rta:
How any rows are you pulling from the database?  
aprrox. 12.000 but there are only around 50-100 new rows at a maximum
within a day, and there were almost as many before the 
problem appeared.
You're creating a form with over 12,000 options in a select statement?

Unfortunately yes. This is a serial code from a paper form. Because they
want to be able to select each form individually from on page there is
no other way.
(maybe I should implement an archivating function)
What if you try wget to fetch the page? Is the script still running slow?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] str_replace problem

2004-10-20 Thread Robin Vickery
On Wed, 20 Oct 2004 01:02:12 -0500, Chris Ditty [EMAIL PROTECTED] wrote:
 Hi all.  I'm trying to do a little code snippets page for a site I am
 working on.  I figured it would be simple enough.  I would do a
 str_replace and replace the various html codes with the ascii
 eqivulant.  Unfortunately, it is not working as expected.  Can anyone
 help with this?
 
 This is what I am using.
 $snippetCode = str_replace(\n, br, $snippet['snippetCode']);
 $snippetCode = str_replace(, gt;, $snippetCode);
 $snippetCode = str_replace(, lt;, $snippetCode);
 $snippetCode = str_replace(, amp;, $snippetCode);
 
 This is what is in $snippet['snippetCode'].
 ?pre? print_r($ArrayName); ?/pre?
 
 This is what is showing on the web page.
 ?lt;gt;prelt;gt;? print_r($ArrayName); ?lt;gt;/prelt;gt;?

Ok, first off there are builtin functions to do this kind of thing:

  http://www.php.net/htmlspecialchars 
  http://www.php.net/nl2br

Secondly, think about what your code is doing, and the order that it's
doing the replacements.

The first thing you're doing is replacing the newlines with br tags.

The second and third things you're doing will disable all the tags
including the br tags you've just inserted, by replacing '' with
lt; and ' with gt html entities;

The fourth thing you're doing is disabling the html entities by
replacing '' with amp; including the entities you've just inserted
as steps two and three.

  -robin

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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-20 Thread Janke Dávid
2004-10-20, sze keltezssel 00:19-kor Ed Lazor ezt rta:
  How any rows are you pulling from the database?  
  aprrox. 12.000 but there are only around 50-100 new rows at a
maximum
  within a day, and there were almost as many before the 
  problem appeared.
 
 You're creating a form with over 12,000 options in a select statement?

Unfortunately yes. This is a serial code from a paper form. Because they
want to be able to select each form individually from on page there is
no other way.
(maybe I should implement an archivating function)


 Have you tried to increase the amount of memory available to this
script?

Yes.
I have set it to 64M, but it didn't seem to work.
It is strange, that now I have set it to -1 (according to the php doc
this is the value for unlimited memory access). Now it is faster. But by
now I can't say how fast it really is. The customer will say it
tomorrow.

Thanks very much for the help by now

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



[PHP] 1st day of the Week

2004-10-20 Thread Shaun
Hi,

I am trying to use the strtotime function to get dates for the first and 
last days of a given week:

?php
 echo date(Y-m-d, strtotime(last monday, 
strtotime(2004-10-18))).'br';
 echo date(Y-m-d, strtotime(sunday, strtotime(2004-10-18)));
?

Using the code above works fine until the date input is a Monday then it 
outputs the date of the previous Monday. Does anyone know of another way?

Thanks for your help 

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



Re: [PHP] Mixing classes

2004-10-20 Thread Tomi Kaistila
Great!
Really, if your purpose was to be helpful, you failed miserably.
The helpful part would have been that you would've actually hinted as 
into _how_ it was possible.

I'm not looking for ready solutions or ready scripts, but with messages 
like these you really only waste other peoples' time.

M. Sokolewicz wrote:
Would it be possible to create a member variable to a class on the 
fly,  without specifically creating it when you write the class? 
Something  like this:
possible.
Or could it even be possible to do this outside of a class? So that I  
yes, that is possible.

--
developer  programmer
me tomi kaistila
home http://www.datamike.org
gnupg 0xFA63E4C7
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] 1st day of the Week

2004-10-20 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



 -Original Message-
 From: Shaun [mailto:[EMAIL PROTECTED] 
 Sent: 20 October 2004 11:35
 
 I am trying to use the strtotime function to get dates for 
 the first and 
 last days of a given week:
 
 ?php
  echo date(Y-m-d, strtotime(last monday, 
 strtotime(2004-10-18))).'br';
  echo date(Y-m-d, strtotime(sunday, strtotime(2004-10-18))); ?
 
 Using the code above works fine until the date input is a 
 Monday then it 
 outputs the date of the previous Monday. Does anyone know of 
 another way?

I believe my solution to this went something along the lines of 

strtotime(-6 days monday, );

It's quite a while since I last used this, so I might not have it quite
right, but this should set you on the road.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, 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] change server unix-win

2004-10-20 Thread Patrick Fehr
Hi
I have a serious problem:
The client want's to emigrate the webhosting from a unix server to a windows
server. Now my biggest problem are the path's.
Is there a way to fast convert all the /root-style directories into the
windows standard \  ??
Thanks for your consideration, I have the strong feeling that this is much
work coming.

-- 
Patrick Fehr
Swiss Federal Institute Of Technology

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



Re: [PHP] change server unix-win

2004-10-20 Thread Robert Cummings
On Wed, 2004-10-20 at 07:17, Patrick Fehr wrote:
 Hi
 I have a serious problem:
 The client want's to emigrate the webhosting from a unix server to a windows
 server. Now my biggest problem are the path's.
 Is there a way to fast convert all the /root-style directories into the
 windows standard \  ??
 Thanks for your consideration, I have the strong feeling that this is much
 work coming.

Conversion of / to \ is done for you by PHP. The only thing you might
need to consider is the drive on which PHP is installed.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] File Copy

2004-10-20 Thread Dusty Bin
Aidal,
	presumably, your server had the write to copy the file, otherwise the 
copy would have failed.  Is the only problem that you don't have the 
correct permissions on the copied file??  if so check out
http://www.php.net/manual/en/function.umask.php.  If you set the umask 
before you copy, you should have the correct permissions.

Best regards. . . Dusty
Silvio Porcellana wrote:
Chris Dowell wrote:
Aidal
Could you post the relevant parts of your code so we have a little 
context to work in?

You say you're copying a file from one location to another on the same 
server. If this is the case you are very unlikely to be in need of the 
ftp family of functions, which are only valid for use over an 
established ftp connection.

You can indeed establish an FTP connection to your local server - 
provided it has an FTP server running.
The files are actually copied by Apache (or whatever Web server he's 
using), so this is why the server becomes the owner.

I suspect that the file is indeed now owned by the webserver
has it changed from aidal:somegroup to nobody:nogroup or something 
like that?

I guess this is the problem Aidal is experiencing.
In order to maintain file ownserships, what he can do (since he doesn't 
have PHP 5) is copy the file with 'ftp_fput()' 
[http://php.libero.it/manual/en/function.ftp-fput.php].
That is, he opens the files he wants to copy and PUTs it via this 
function. Since he is logged in - using 'ftp_connect()' and 
'ftp_login()' - the files will be owned by the user he used to login.

My .2 euros...
Cheers,
Silvio Porcellana
snip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: File Copy

2004-10-20 Thread Dusty Bin
Aidal,
	I assume that you are using your server to copy the file, and since the 
copy apparently suceeds, your server must have read access to the source 
file.  Check out
http://www.php.net/manual/en/function.umask.php.  If you set the 
correct umask prior to your copy, your copied file should end up with 
the correct permissions.  Even if it doesn't, you should be able to 
chmod correctly.  Be careful with the mask, it is set up with negative 
logic.  If you have access to an *nix system, try a man umask for more 
information.

Hope this helps. . . Dusty
Aidal wrote:
Hi NG.
I'm experiencing some problems when trying to copy a file from one location
to another on the web server.
example:
dir1/subdir1/some_image_name.jpg  --  dir2/subdir2/some_new_image_name.jpg
When I do this the file permissions changes and I'm no longer the owner of
the file. I tried to use chmod('the_new_file', 0777); but it doesn't work,
because chmod() wont let me change the permissions since I'm not the owner
of this new file.
The server runs on some kind of UNIX based system...
Any help or suggestions would be much appreciated, thanks.
/Aidal
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
After some back and forth posts here I had finally
thought my array issue was over, but!

To review I have 30 form elements on a page
10 are skill[]
10 are sky[]
10 are slu[]

I pass them as session variables 

$_SESSION['skills'] = $_POST['skill'];
$_SESSION['skys'] = $_POST['sky'];
$_SESSION['slus'] = $_POST['slu'];

Then when everyting is passed into a database
transaction:

$skills = $_SESSION['skills'];
$skys = $_SESSION['skys'];
$slus = $_SESSION['slus'];

foreach($_SESSION['skills'] as $key = $skill)
{
$query = INSERT INTO Profiles_skills (ProfileID,
SkilCerts, NumYear, Lused) 
VALUES ($LID, '$skill',
{$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
//$result = mysql_query($query);

Here is the problem: 

Using
(((isset($_POST[skill[]]))?$_POST[skill[]]:) .
,true,true,true,true,,false,1);

I can't seem to differentiate between the the elements
because they are all labeled skill[]
So basically validation isn't doing anything .

I'm thinking of finding a better way to validate , or
if i change the elements to skill[1], skill[2] , what
would that do to my iteration loop ?

Thank you,
Stuart

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



[PHP] Re: File Copy

2004-10-20 Thread Dusty Bin
Aidal,
	since you are using the server to copy the file, and the copy succeeds, 
the server obviously has at least read access to the source.
You just can't get the permissions right.  Check out: 
http://www.php.net/manual/en/function.umask.php.  If you have access 
to your server or another *nix machine also check out man umask.  If 
you set your umask before the copy, your file should be copied with the 
right permissions.  If you set the umask after the copy, you should be 
able to chmod.  Be careful how you set the umask, it's not as straight 
forward as is seems.

Hope this helps. . . Dusty
Aidal wrote:
Hi NG.
I'm experiencing some problems when trying to copy a file from one location
to another on the web server.
example:
dir1/subdir1/some_image_name.jpg  --  dir2/subdir2/some_new_image_name.jpg
When I do this the file permissions changes and I'm no longer the owner of
the file. I tried to use chmod('the_new_file', 0777); but it doesn't work,
because chmod() wont let me change the permissions since I'm not the owner
of this new file.
The server runs on some kind of UNIX based system...
Any help or suggestions would be much appreciated, thanks.
/Aidal
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] CPU usage @5% during 2 minutes

2004-10-20 Thread Janke Dávid
HLP!

This becomes more and more strange. Aftar I was really happy, that the
code runs fast again, the customer sent an e-mail that is still slow.
So I logged in into his network and everything was ok for me, but when
they tried to use the program, I still saw (using top), that the CPU
usage is still @5% (highest value).
So I began to use the debug log of apache, and see what happened (LOOK
AT THE LAST NUMBER, WHICH SHOWS HOW LONG THE SCRIPT RUN):

In this case I was using it from the localhost:
10.36.0.5 - - [20/Oct/2004:14:27:25 +0200] GET
/form.php?op=reprint_form_sel HTTP/1.1 200 1478211 - Links (0.99;
Linux 2.6.8-1-686 i686; 80x24) 17970 3

In this case I was using it from another host in the network (actually
the proxy):
10.36.0.2 - - [20/Oct/2004:14:23:33 +0200] GET
/bizerba/form.php?op=select_form HTTP/1.0 200 1473492 -
Lynx/2.8.5rel.1 libwww-FM/2.14
SSL-MM/1.4.1 GNUTLS/0.8.12 17969 7

In this case the some other client was using it from the network:
10.36.0.2 - - [20/Oct/2004:14:33:23 +0200] GET
/bizerba/form.php?op=select_form HTTP/1.0 200 1473492 - Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.1) 17970 36

No, it is not the network, which is slow!

Is it possible, that all clients (except me) are accessing it throug a
proxy and some proxy settings were changed, so the webserver is running
slower? (of course this wouldn't excplain the fact, the the code ran
slower on other machines too).

David

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



RE: [PHP] Validation problem with array.

2004-10-20 Thread Graham Cossey
Not sure I really know where you have the problem, but I am assuming you are
trying to construct the INSERT statement within your foreach loop.

If so, why use $_POST[skill[]] when you have $skill which is that current
element being iterated?
Did you read the foreach doc?
http://uk2.php.net/manual/en/control-structures.foreach.php

HTH
Graham


 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 20 October 2004 13:35
 To: [EMAIL PROTECTED]
 Subject: [PHP] Validation problem with array.


 After some back and forth posts here I had finally
 thought my array issue was over, but!

 To review I have 30 form elements on a page
 10 are skill[]
 10 are sky[]
 10 are slu[]

 I pass them as session variables

 $_SESSION['skills'] = $_POST['skill'];
 $_SESSION['skys'] = $_POST['sky'];
 $_SESSION['slus'] = $_POST['slu'];

 Then when everyting is passed into a database
 transaction:

 $skills = $_SESSION['skills'];
 $skys = $_SESSION['skys'];
 $slus = $_SESSION['slus'];

 foreach($_SESSION['skills'] as $key = $skill)
 {
 $query = INSERT INTO Profiles_skills (ProfileID,
 SkilCerts, NumYear, Lused)
 VALUES ($LID, '$skill',
 {$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
 //$result = mysql_query($query);

 Here is the problem:

 Using
 (((isset($_POST[skill[]]))?$_POST[skill[]]:) .
 ,true,true,true,true,,false,1);

 I can't seem to differentiate between the the elements
 because they are all labeled skill[]
 So basically validation isn't doing anything .

 I'm thinking of finding a better way to validate , or
 if i change the elements to skill[1], skill[2] , what
 would that do to my iteration loop ?

 Thank you,
 Stuart

 --
 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] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
My problem is not related to the insert or iteration.
It's related to the validaton of those elements:
skill[]
skill[]
etc.

Clearer ?

Stuart
--- Graham Cossey [EMAIL PROTECTED] wrote:

 Not sure I really know where you have the problem,
 but I am assuming you are
 trying to construct the INSERT statement within your
 foreach loop.
 
 If so, why use $_POST[skill[]] when you have
 $skill which is that current
 element being iterated?
 Did you read the foreach doc?

http://uk2.php.net/manual/en/control-structures.foreach.php
 
 HTH
 Graham
 
 
  -Original Message-
  From: Stuart Felenstein
 [mailto:[EMAIL PROTECTED]
  Sent: 20 October 2004 13:35
  To: [EMAIL PROTECTED]
  Subject: [PHP] Validation problem with array.
 
 
  After some back and forth posts here I had finally
  thought my array issue was over, but!
 
  To review I have 30 form elements on a page
  10 are skill[]
  10 are sky[]
  10 are slu[]
 
  I pass them as session variables
 
  $_SESSION['skills'] = $_POST['skill'];
  $_SESSION['skys'] = $_POST['sky'];
  $_SESSION['slus'] = $_POST['slu'];
 
  Then when everyting is passed into a database
  transaction:
 
  $skills = $_SESSION['skills'];
  $skys = $_SESSION['skys'];
  $slus = $_SESSION['slus'];
 
  foreach($_SESSION['skills'] as $key = $skill)
  {
  $query = INSERT INTO Profiles_skills (ProfileID,
  SkilCerts, NumYear, Lused)
  VALUES ($LID, '$skill',
 

{$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
  //$result = mysql_query($query);
 
  Here is the problem:
 
  Using
  (((isset($_POST[skill[]]))?$_POST[skill[]]:)
 .
  ,true,true,true,true,,false,1);
 
  I can't seem to differentiate between the the
 elements
  because they are all labeled skill[]
  So basically validation isn't doing anything .
 
  I'm thinking of finding a better way to validate ,
 or
  if i change the elements to skill[1], skill[2] ,
 what
  would that do to my iteration loop ?
 
  Thank you,
  Stuart
 
  --
  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] permission for file creating script

2004-10-20 Thread John Nichel
Padi wrote:
Q: Why can't userX in groupY write on a file with chmod 0664 and chown
userY:groupY?
Summary: I use php 4.3.9 on an apache webserver
I always got permission errors, when scripts tried to use mkdir() and the
kind.
So I chowned all files and folders to apache:apache and made my standard
user on that box also member of that group(I did that with kusers in kde),
all files now were on chmod 0664 and all directories on 0775.
But my user didn't have write permission, this doesn't go into my head.
Is Apache running as apache:apache?  Check your httpd.conf file.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Validation problem with array.

2004-10-20 Thread Graham Cossey
Maybe you would like to post your validation code then.

I (we) do not know where the line:

(((isset($_POST[skill[]]))?$_POST[skill[]]:).,true,true,true,true,
,false,1);

is being called.

Have you thought about using an iteration as you have when constructing the
INSERT statement?
Have you considered placing validation within the iteration you have when
constructing the INSERT statement?

If you do a print_r($skills) you will see that although in the form they are
named skill[] when passed to your script they will be skill[0], skill[1],
skill[2]...

Also, this line :

foreach($_SESSION['skills'] as $key = $skill)

could read

foreach($skills as $key = $skill)

as you have the line:

$skills = $_SESSION['skills'];

Same for skys and slus.

Graham

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 20 October 2004 14:06
 To: Graham Cossey; [EMAIL PROTECTED]
 Subject: RE: [PHP] Validation problem with array.


 My problem is not related to the insert or iteration.
 It's related to the validaton of those elements:
 skill[]
 skill[]
 etc.

 Clearer ?

 Stuart
 --- Graham Cossey [EMAIL PROTECTED] wrote:

  Not sure I really know where you have the problem,
  but I am assuming you are
  trying to construct the INSERT statement within your
  foreach loop.
 
  If so, why use $_POST[skill[]] when you have
  $skill which is that current
  element being iterated?
  Did you read the foreach doc?
 
 http://uk2.php.net/manual/en/control-structures.foreach.php
 
  HTH
  Graham
 
 
   -Original Message-
   From: Stuart Felenstein
  [mailto:[EMAIL PROTECTED]
   Sent: 20 October 2004 13:35
   To: [EMAIL PROTECTED]
   Subject: [PHP] Validation problem with array.
  
  
   After some back and forth posts here I had finally
   thought my array issue was over, but!
  
   To review I have 30 form elements on a page
   10 are skill[]
   10 are sky[]
   10 are slu[]
  
   I pass them as session variables
  
   $_SESSION['skills'] = $_POST['skill'];
   $_SESSION['skys'] = $_POST['sky'];
   $_SESSION['slus'] = $_POST['slu'];
  
   Then when everyting is passed into a database
   transaction:
  
   $skills = $_SESSION['skills'];
   $skys = $_SESSION['skys'];
   $slus = $_SESSION['slus'];
  
   foreach($_SESSION['skills'] as $key = $skill)
   {
   $query = INSERT INTO Profiles_skills (ProfileID,
   SkilCerts, NumYear, Lused)
   VALUES ($LID, '$skill',
  
 
 {$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
   //$result = mysql_query($query);
  
   Here is the problem:
  
   Using
   (((isset($_POST[skill[]]))?$_POST[skill[]]:)
  .
   ,true,true,true,true,,false,1);
  
   I can't seem to differentiate between the the
  elements
   because they are all labeled skill[]
   So basically validation isn't doing anything .
  
   I'm thinking of finding a better way to validate ,
  or
   if i change the elements to skill[1], skill[2] ,
  what
   would that do to my iteration loop ?
  
   Thank you,
   Stuart
  
   --
   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] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
Believe it or not I had just thought of doing a
foreach with the validation.

I'll see how it goes.

Stuart
--- Graham Cossey [EMAIL PROTECTED] wrote:

 Maybe you would like to post your validation code
 then.
 
 I (we) do not know where the line:
 

(((isset($_POST[skill[]]))?$_POST[skill[]]:).,true,true,true,true,
 ,false,1);
 
 is being called.
 
 Have you thought about using an iteration as you
 have when constructing the
 INSERT statement?
 Have you considered placing validation within the
 iteration you have when
 constructing the INSERT statement?
 
 If you do a print_r($skills) you will see that
 although in the form they are
 named skill[] when passed to your script they will
 be skill[0], skill[1],
 skill[2]...
 
 Also, this line :
 
 foreach($_SESSION['skills'] as $key = $skill)
 
 could read
 
 foreach($skills as $key = $skill)
 
 as you have the line:
 
 $skills = $_SESSION['skills'];
 
 Same for skys and slus.
 
 Graham
 
  -Original Message-
  From: Stuart Felenstein
 [mailto:[EMAIL PROTECTED]
  Sent: 20 October 2004 14:06
  To: Graham Cossey; [EMAIL PROTECTED]
  Subject: RE: [PHP] Validation problem with array.
 
 
  My problem is not related to the insert or
 iteration.
  It's related to the validaton of those elements:
  skill[]
  skill[]
  etc.
 
  Clearer ?
 
  Stuart
  --- Graham Cossey [EMAIL PROTECTED] wrote:
 
   Not sure I really know where you have the
 problem,
   but I am assuming you are
   trying to construct the INSERT statement within
 your
   foreach loop.
  
   If so, why use $_POST[skill[]] when you have
   $skill which is that current
   element being iterated?
   Did you read the foreach doc?
  
 

http://uk2.php.net/manual/en/control-structures.foreach.php
  
   HTH
   Graham
  
  
-Original Message-
From: Stuart Felenstein
   [mailto:[EMAIL PROTECTED]
Sent: 20 October 2004 13:35
To: [EMAIL PROTECTED]
Subject: [PHP] Validation problem with array.
   
   
After some back and forth posts here I had
 finally
thought my array issue was over, but!
   
To review I have 30 form elements on a page
10 are skill[]
10 are sky[]
10 are slu[]
   
I pass them as session variables
   
$_SESSION['skills'] = $_POST['skill'];
$_SESSION['skys'] = $_POST['sky'];
$_SESSION['slus'] = $_POST['slu'];
   
Then when everyting is passed into a database
transaction:
   
$skills = $_SESSION['skills'];
$skys = $_SESSION['skys'];
$slus = $_SESSION['slus'];
   
foreach($_SESSION['skills'] as $key = $skill)
{
$query = INSERT INTO Profiles_skills
 (ProfileID,
SkilCerts, NumYear, Lused)
VALUES ($LID, '$skill',
   
  
 

{$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
//$result = mysql_query($query);
   
Here is the problem:
   
Using
   
 (((isset($_POST[skill[]]))?$_POST[skill[]]:)
   .
,true,true,true,true,,false,1);
   
I can't seem to differentiate between the the
   elements
because they are all labeled skill[]
So basically validation isn't doing anything .
   
I'm thinking of finding a better way to
 validate ,
   or
if i change the elements to skill[1], skill[2]
 ,
   what
would that do to my iteration loop ?
   
Thank you,
Stuart
   
--
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] Validation problem with array.

2004-10-20 Thread Brent Baisley
I think I might know what you are trying to do. You want to have a 
name associated with the skill (or skys or slus). You can use an 
associative array to name your array elements. In your form, you can 
change the array to be something like this:
skills[cooking]
skills[flying]
skills[walking]
...

Notice there are no quotes around the skill names. Now each array 
element has an array key that is a name. The computer doesn't really 
care, but it makes it easier for you to read your code. And you now 
have name/value pairs. You can process the array like this:

$skillNames = array_keys($skills);
foreach($skillNames as $skill) {
echo 'Skill: '.$skill.'  Value: '.$skills[$skill].' br /';
}
Of course, instead of echoing you would do your validation or 
substitution.

On Oct 20, 2004, at 8:35 AM, Stuart Felenstein wrote:
After some back and forth posts here I had finally
thought my array issue was over, but!
To review I have 30 form elements on a page
10 are skill[]
10 are sky[]
10 are slu[]
I pass them as session variables
$_SESSION['skills'] = $_POST['skill'];
$_SESSION['skys'] = $_POST['sky'];
$_SESSION['slus'] = $_POST['slu'];
Then when everyting is passed into a database
transaction:
$skills = $_SESSION['skills'];
$skys = $_SESSION['skys'];
$slus = $_SESSION['slus'];
foreach($_SESSION['skills'] as $key = $skill)
{
$query = INSERT INTO Profiles_skills (ProfileID,
SkilCerts, NumYear, Lused)
VALUES ($LID, '$skill',
{$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
//$result = mysql_query($query);
Here is the problem:
Using
(((isset($_POST[skill[]]))?$_POST[skill[]]:) .
,true,true,true,true,,false,1);
I can't seem to differentiate between the the elements
because they are all labeled skill[]
So basically validation isn't doing anything .
I'm thinking of finding a better way to validate , or
if i change the elements to skill[1], skill[2] , what
would that do to my iteration loop ?
Thank you,
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
Brent, 
Thank you , I can't do an associative because it part
of a user input form.  The values will be dependent on
the users.  I'm going to try and give each form
element a index number skill[0], skill[1] since the
foreach loop is doing that anyway.

The reason I haven't posted the validation is because
it's part of a class, so what exists in the page is
only part of the code. 

Stuart


--- Brent Baisley [EMAIL PROTECTED] wrote:

 I think I might know what you are trying to do. You
 want to have a 
 name associated with the skill (or skys or slus).
 You can use an 
 associative array to name your array elements. In
 your form, you can 
 change the array to be something like this:
 skills[cooking]
 skills[flying]
 skills[walking]
 ...
 
 Notice there are no quotes around the skill names.
 Now each array 
 element has an array key that is a name. The
 computer doesn't really 
 care, but it makes it easier for you to read your
 code. And you now 
 have name/value pairs. You can process the array
 like this:
 
 $skillNames   = array_keys($skills);
 foreach($skillNames as $skill) {
   echo 'Skill: '.$skill.'  Value: '.$skills[$skill].'
 br /';
 }
 
 Of course, instead of echoing you would do your
 validation or 
 substitution.
 
 On Oct 20, 2004, at 8:35 AM, Stuart Felenstein
 wrote:
 
  After some back and forth posts here I had finally
  thought my array issue was over, but!
 
  To review I have 30 form elements on a page
  10 are skill[]
  10 are sky[]
  10 are slu[]
 
  I pass them as session variables
 
  $_SESSION['skills'] = $_POST['skill'];
  $_SESSION['skys'] = $_POST['sky'];
  $_SESSION['slus'] = $_POST['slu'];
 
  Then when everyting is passed into a database
  transaction:
 
  $skills = $_SESSION['skills'];
  $skys = $_SESSION['skys'];
  $slus = $_SESSION['slus'];
 
  foreach($_SESSION['skills'] as $key = $skill)
  {
  $query = INSERT INTO Profiles_skills (ProfileID,
  SkilCerts, NumYear, Lused)
  VALUES ($LID, '$skill',
 

{$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
  //$result = mysql_query($query);
 
  Here is the problem:
 
  Using
  (((isset($_POST[skill[]]))?$_POST[skill[]]:)
 .
  ,true,true,true,true,,false,1);
 
  I can't seem to differentiate between the the
 elements
  because they are all labeled skill[]
  So basically validation isn't doing anything .
 
  I'm thinking of finding a better way to validate ,
 or
  if i change the elements to skill[1], skill[2] ,
 what
  would that do to my iteration loop ?
 
  Thank you,
  Stuart
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit:
 http://www.php.net/unsub.php
 
 
 -- 
 Brent Baisley
 Systems Architect
 Landover Associates, Inc.
 Search  Advisory Services for Advanced Technology
 Environments
 p: 212.759.6400/800.759.0577
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



[PHP] relative paths with require

2004-10-20 Thread Joey Morwick
Hello, I'm experiencing a problem with PHP4.  On the server where our code
used to reside, the relative path used in an include started from the
directory in which the file containing the require statement resided.  On
our new server, the relative paths seem to start from where the first php
script in the chain of require's resides.  

An example would be three files in two directories as follows:

/test/index.php
/test/a/a.php
/test/b/b.php

index.php:  
require(a/a.php);

a.php:
require(../b/b.php);

On our old server, this would be fine, as the path searched in a.php would
start in /test/a.  On the new server, if you start processing index.php,
you will get a file not found error in a.php since it's starting from the
path /test.

I've tried every config option I can think of and am nearly ready to try to
hack in a workaround.  Does anyone know how this could be configured?

Thanks,

-- 
~Joey Morwick

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



Re: [PHP] Mixing classes

2004-10-20 Thread Greg Donald
On Wed, 20 Oct 2004 13:41:16 +0300, Tomi Kaistila
[EMAIL PROTECTED] wrote:
 Really, if your purpose was to be helpful, you failed miserably.
 The helpful part would have been that you would've actually hinted as
 into _how_ it was possible.
 
 I'm not looking for ready solutions or ready scripts, but with messages
 like these you really only waste other peoples' time.

Did you search the mailing list archives already?

http://marc.theaimsgroup.com/?l=php-generalm=109509393613288w=2



-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Automatic Form processor

2004-10-20 Thread Dan Joseph
 As Dan has already said, something like this is what you need:
 
  foreach ( $_POST as $key = $value )
  {
 if ( substr( $key, 0, 4 ) == quest )
echo $value: $key\n;
  }
 
 HOWEVER, this leaves your script wide open to security issues, because
 you're placing all the power in the HTML form, rather than on the
 sever-side PHP script.

Well, you're right.  I was vague on my solution.  The proper way would
be to validate all your form data to combat XSS, SQL Injections,
JavaScript attacks, etc.  There could be a lot of reprocussions to not
doing so.  After that, then build your e-mail our web page output.

-Dan Joseph

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



Re: [PHP] relative paths with require

2004-10-20 Thread Greg Donald
On Wed, 20 Oct 2004 09:30:20 -0400, Joey Morwick
[EMAIL PROTECTED] wrote:
 Hello, I'm experiencing a problem with PHP4.  On the server where our code
 used to reside, the relative path used in an include started from the
 directory in which the file containing the require statement resided.  On
 our new server, the relative paths seem to start from where the first php
 script in the chain of require's resides.

Did you check the open_basedir setting?  That will make php act as you
described.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Validation problem with array.

2004-10-20 Thread Brent Baisley
I thought you were using checkboxes based on your true/false. So the 
user is actually typing in skills?

Not sure where you are going with skill[0], skill[1]. You are creating 
an associative array when you do that. In and input form, skill[0] and 
skill[a] are actually no different, aside from the name you are using 
for that element.

On Oct 20, 2004, at 9:41 AM, Stuart Felenstein wrote:
Brent,
Thank you , I can't do an associative because it part
of a user input form.  The values will be dependent on
the users.  I'm going to try and give each form
element a index number skill[0], skill[1] since the
foreach loop is doing that anyway.
The reason I haven't posted the validation is because
it's part of a class, so what exists in the page is
only part of the code.
Stuart
--- Brent Baisley [EMAIL PROTECTED] wrote:
I think I might know what you are trying to do. You
want to have a
name associated with the skill (or skys or slus).
You can use an
associative array to name your array elements. In
your form, you can
change the array to be something like this:
skills[cooking]
skills[flying]
skills[walking]
...
Notice there are no quotes around the skill names.
Now each array
element has an array key that is a name. The
computer doesn't really
care, but it makes it easier for you to read your
code. And you now
have name/value pairs. You can process the array
like this:
$skillNames = array_keys($skills);
foreach($skillNames as $skill) {
echo 'Skill: '.$skill.'  Value: '.$skills[$skill].'
br /';
}
Of course, instead of echoing you would do your
validation or
substitution.
On Oct 20, 2004, at 8:35 AM, Stuart Felenstein
wrote:
After some back and forth posts here I had finally
thought my array issue was over, but!
To review I have 30 form elements on a page
10 are skill[]
10 are sky[]
10 are slu[]
I pass them as session variables
$_SESSION['skills'] = $_POST['skill'];
$_SESSION['skys'] = $_POST['sky'];
$_SESSION['slus'] = $_POST['slu'];
Then when everyting is passed into a database
transaction:
$skills = $_SESSION['skills'];
$skys = $_SESSION['skys'];
$slus = $_SESSION['slus'];
foreach($_SESSION['skills'] as $key = $skill)
{
$query = INSERT INTO Profiles_skills (ProfileID,
SkilCerts, NumYear, Lused)
VALUES ($LID, '$skill',

{$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
//$result = mysql_query($query);
Here is the problem:
Using
(((isset($_POST[skill[]]))?$_POST[skill[]]:)
.
,true,true,true,true,,false,1);
I can't seem to differentiate between the the
elements
because they are all labeled skill[]
So basically validation isn't doing anything .
I'm thinking of finding a better way to validate ,
or
if i change the elements to skill[1], skill[2] ,
what
would that do to my iteration loop ?
Thank you,
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology
Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
Yes I just found that out :).
Back to the drawing board!.

Stuart
--- Brent Baisley [EMAIL PROTECTED] wrote:

 I thought you were using checkboxes based on your
 true/false. So the 
 user is actually typing in skills?
 
 Not sure where you are going with skill[0],
 skill[1]. You are creating 
 an associative array when you do that. In and input
 form, skill[0] and 
 skill[a] are actually no different, aside from the
 name you are using 
 for that element.
 
 
 On Oct 20, 2004, at 9:41 AM, Stuart Felenstein
 wrote:
 
  Brent,
  Thank you , I can't do an associative because it
 part
  of a user input form.  The values will be
 dependent on
  the users.  I'm going to try and give each form
  element a index number skill[0], skill[1] since
 the
  foreach loop is doing that anyway.
 
  The reason I haven't posted the validation is
 because
  it's part of a class, so what exists in the page
 is
  only part of the code.
 
  Stuart
 
 
  --- Brent Baisley [EMAIL PROTECTED] wrote:
 
  I think I might know what you are trying to do.
 You
  want to have a
  name associated with the skill (or skys or
 slus).
  You can use an
  associative array to name your array elements.
 In
  your form, you can
  change the array to be something like this:
  skills[cooking]
  skills[flying]
  skills[walking]
  ...
 
  Notice there are no quotes around the skill
 names.
  Now each array
  element has an array key that is a name. The
  computer doesn't really
  care, but it makes it easier for you to read your
  code. And you now
  have name/value pairs. You can process the array
  like this:
 
  $skillNames= array_keys($skills);
  foreach($skillNames as $skill) {
 echo 'Skill: '.$skill.'  Value:
 '.$skills[$skill].'
  br /';
  }
 
  Of course, instead of echoing you would do your
  validation or
  substitution.
 
  On Oct 20, 2004, at 8:35 AM, Stuart Felenstein
  wrote:
 
  After some back and forth posts here I had
 finally
  thought my array issue was over, but!
 
  To review I have 30 form elements on a page
  10 are skill[]
  10 are sky[]
  10 are slu[]
 
  I pass them as session variables
 
  $_SESSION['skills'] = $_POST['skill'];
  $_SESSION['skys'] = $_POST['sky'];
  $_SESSION['slus'] = $_POST['slu'];
 
  Then when everyting is passed into a database
  transaction:
 
  $skills = $_SESSION['skills'];
  $skys = $_SESSION['skys'];
  $slus = $_SESSION['slus'];
 
  foreach($_SESSION['skills'] as $key = $skill)
  {
  $query = INSERT INTO Profiles_skills
 (ProfileID,
  SkilCerts, NumYear, Lused)
  VALUES ($LID, '$skill',
 
 
 

{$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
  //$result = mysql_query($query);
 
  Here is the problem:
 
  Using
 
 (((isset($_POST[skill[]]))?$_POST[skill[]]:)
  .
  ,true,true,true,true,,false,1);
 
  I can't seem to differentiate between the the
  elements
  because they are all labeled skill[]
  So basically validation isn't doing anything .
 
  I'm thinking of finding a better way to validate
 ,
  or
  if i change the elements to skill[1], skill[2] ,
  what
  would that do to my iteration loop ?
 
  Thank you,
  Stuart
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit:
  http://www.php.net/unsub.php
 
 
  -- 
  Brent Baisley
  Systems Architect
  Landover Associates, Inc.
  Search  Advisory Services for Advanced
 Technology
  Environments
  p: 212.759.6400/800.759.0577
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit:
 http://www.php.net/unsub.php
 
 
 
 
 -- 
 Brent Baisley
 Systems Architect
 Landover Associates, Inc.
 Search  Advisory Services for Advanced Technology
 Environments
 p: 212.759.6400/800.759.0577
 
 

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



Re: [PHP] CPU usage @5% during 2 minutes SOLVED

2004-10-20 Thread Janke Dávid
Hi all!

After 2 weeks of sleepless nights and visiting the customer three times
(once on saturday) the problem is solved.

The thing was:
The new, 20 year old administrator guy set all clients to use the local
network via the proxy. And the proxy wasn't able to handle the approx.
1,5MB huge web pages.

So after ensuring me two weeks ago, that their local network is perfect
they'll get a nice little bill.

Thank at all.

David

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



Re: [PHP] change server unix-win

2004-10-20 Thread Greg Donald
On Wed, 20 Oct 2004 13:17:08 +0200, Patrick Fehr [EMAIL PROTECTED] wrote:
 I have a serious problem:
 The client want's to emigrate the webhosting from a unix server to a windows
 server. Now my biggest problem are the path's.
 Is there a way to fast convert all the /root-style directories into the
 windows standard \  ??
 Thanks for your consideration, I have the strong feeling that this is much
 work coming.

A small sed script would easily handle this conversion.  I doubt you
have any of those on windows so I'd do the conversion before moving.

for file in *.php; do
cp $file $file.tmp
sed -e s/\///g $file.tmp $file
rm $file.tmp
done

Remember on windows you will be dealing with backslashes instead of
forward slashes, and you have to escape the backslashes with
backslashes.

$path = '/usr/local/blah';

will be something like:

$path = 'c:\\inetpub\\www';


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Nesting level too deep - recursive dependency?

2004-10-20 Thread Curt Zirzow
* Thus wrote Francisco M. Marzoa Alonso:
 This code:
 
 ?php
 
 class TestClass {
 public $myself;
 
 function __construct () {
 $this-myself = $this;
 }
 }
 
 $TestObj = new TestClass ();
 
 if ( $TestObj-myself == $TestObj ) {
 echo They are same.\n;
 }

Since comparing objects is comparing all the attributes: first php
compares the $myself attrib for both objects:

  $TestObj-myself-myself == $TestObj-myself

In order to see if those two myself's compare php needs to compare
all of those attributes:

  $TestObj-myself-myself-myself == $TestObj-myself-myself

...And so on...

PHP Detected this and threw and error.

Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] str_replace problem

2004-10-20 Thread Philip Thompson
On Oct 20, 2004, at 1:02 AM, Chris Ditty wrote:
Hi all.  I'm trying to do a little code snippets page for a site I am
working on.  I figured it would be simple enough.  I would do a
str_replace and replace the various html codes with the ascii
eqivulant.  Unfortunately, it is not working as expected.  Can anyone
help with this?
This is what I am using.
$snippetCode = str_replace(\n, br, $snippet['snippetCode']);
$snippetCode = str_replace(, gt;, $snippetCode);
 is actually less than
$snippetCode = str_replace(, lt;, $snippetCode);
and  is greater than. Don't know if this makes a difference to you.
$snippetCode = str_replace(, amp;, $snippetCode);
This is what is in $snippet['snippetCode'].
?pre? print_r($ArrayName); ?/pre?
This is what is showing on the web page.
?lt;gt;prelt;gt;? print_r($ArrayName); ?lt;gt;/prelt;gt;?
If anyone can help, it would be appreciated.  Also, if you have a
quick and dirty code colorer, I would appreciate that.
Thanks
Chris
Like the others have said, consider using htmlspecialchars().
Have fun!
~Philip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] CPU usage @5% during 2 minutes

2004-10-20 Thread Greg Donald
On Wed, 20 Oct 2004 14:59:01 +0200, Janke Dávid [EMAIL PROTECTED] wrote:
 HLP!

In my experience the most common network slowdown issues involve
overloaded isp DNS servers.  I'd do a few nslookups and see how
responsive their nameservers are.  You can easily add 4-5 seconds to a
php script's execution time with a bad nameserver.  Then you add a
proxy server in there as you described and things will only get worse.

You might want to see if there's any packet loss with a ping test too.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] CPU usage @5% during 2 minutes SOLVED

2004-10-20 Thread Matt M.
 The thing was:
 The new, 20 year old administrator guy set all clients to use the local
 network via the proxy. And the proxy wasn't able to handle the approx.
 1,5MB huge web pages.


good that the problem is solved.

Not sure if you know or not but you could probably cut the size of the
page down using mod_gzip, mod_deflate, or maybe
http://us2.php.net/ob_gzhandler

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



Re: [PHP] change server unix-win

2004-10-20 Thread Francisco M. Marzoa Alonso
Just a point: this will be a problem if they have some forward slashes 
that are not specifying file paths, i.e. URLs in the code like 
http://www.whereveryouwant.com/ will be substituted by 
http:\\www.whereveryouwant.com\


Greg Donald wrote:
On Wed, 20 Oct 2004 13:17:08 +0200, Patrick Fehr [EMAIL PROTECTED] wrote:
 

I have a serious problem:
The client want's to emigrate the webhosting from a unix server to a windows
server. Now my biggest problem are the path's.
Is there a way to fast convert all the /root-style directories into the
windows standard \  ??
Thanks for your consideration, I have the strong feeling that this is much
work coming.
   

A small sed script would easily handle this conversion.  I doubt you
have any of those on windows so I'd do the conversion before moving.
for file in *.php; do
cp $file $file.tmp
sed -e s/\///g $file.tmp $file
rm $file.tmp
done
Remember on windows you will be dealing with backslashes instead of
forward slashes, and you have to escape the backslashes with
backslashes.
$path = '/usr/local/blah';
will be something like:
$path = 'c:\\inetpub\\www';
 

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


Re: [PHP] Mixing classes

2004-10-20 Thread Bruno B B Magalhães
Hi Tomy,
I did the same thing!
I´ve used a class called framework to encapsulate everything... here is 
what looks like:

framework.inc.php
?php
/**
* Project: BBBM Framework
* File: framework.inc.php
*
* @desc Main Framework Include
* @link http://www.bbbm.com.br/
* @copyright 2004 Bruno B B Magalhaes
* @author Bruno B B Magalhaes [EMAIL PROTECTED]
* @package BBBM Framework
* @version 0.5-dev
*/
session_start();
/**
* Include Core Classes
*/
require_once(FRAMEWORK_DIR.'core/framework.class.php');
require_once(FRAMEWORK_DIR.'core/preferences.class.php');
require_once(FRAMEWORK_DIR.'core/languages.class.php');
require_once(FRAMEWORK_DIR.'core/database.class.php');
require_once(FRAMEWORK_DIR.'core/authentication.class.php');
require_once(FRAMEWORK_DIR.'core/input.class.php');
require_once(FRAMEWORK_DIR.'smarty/smarty.class.php');
require_once(FRAMEWORK_DIR.'core/output.class.php');
require_once(FRAMEWORK_DIR.'core/modules.class.php');
require_once(FRAMEWORK_DIR.'core/validation.class.php');
require_once(FRAMEWORK_DIR.'core/filters.class.php');
/**
* Include Shared Classes
*/
include_once(FRAMEWORK_DIR.'shared/categories.class.php');
?
framework.class.php
?php
/**
* Project: BBBM Framework
* File: framework.class.php
*
* @desc Main Framework Class
* @link http://www.bbbm.com.br/
* @copyright 2004 Bruno B B Magalhaes
* @author Bruno B B Magalhaes [EMAIL PROTECTED]
* @package BBBM Framework
* @version 0.5-dev
*/
class framework
{
	var $preferences;
	var $database;
	var $authentication;
	var $input;
	var $output;
	var $modules;
	var $validation;
	var $filters;
	var $languages;
	
	var $controller;
	
	/**
	* PHP 4 Constructor
	*/
	function framework()
	{
		$this-preferences = new preferences();// Preferences Layer
		$this-languages = new languages();	// Language Layer
		$this-database = new database($this-preferences);		// Database Layer
		$this-input = new input();		// Input Layer		
		$this-modules = new modules($this-database);			// Modules Layer
		$this-authentication = new authentication($this-database);	// 
Authentication Layer
		$this-output = new output($this-preferences,$this-languages);	// 
Ouput Layer
		$this-validation = new validation();	// Validation functions
		$this-filters = new filters();		// Filters Functions
	}
	
	function is_valid_controller($contoller='')
	{
		if($contoller != '')
		{
			$contoller = addslashes(strip_tags($contoller));
			$this-database-build_table(array('controllers'));
			
			$query = 'SELECT
	controllerStatus
FROM
	'.$this-database-table['controllers'].'
WHERE
	controllerPath=\''.$contoller.'\'
';
			
			$this-database-query($query);
			
			if($this-database-num_rows()  0)
			{
$this-database-fetch_array();

if($this-database-row['controllerStatus']  0)
{
	$this-controller = $contoller;
	return true;
}
else
{
	$this-controller = false;
	return false;
}
			}
			else
			{
$this-controller = false;
return false;
			}
		}
		else
		{
			return false;
		}
	}
}
?

Regards,
Bruno B B Magalhães
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] relative paths with require

2004-10-20 Thread Joey Morwick
Greg Donald wrote:

 Did you check the open_basedir setting?  That will make php act as you
 described.

We don't have open_basedir set, but our problem is slightly different.  If
you were to execute only a.php in my previous example, there would be no
error since the current directory would be /test/a.  The problem is, if you
execute index.php and then when index.php requires a.php, a.php will be
executed with /test as the current directory instead of /test/a.  We have
access to the /test directory.  If you change the link in a.php to
b/b.php instead of ../b/b.php, it will work when you execute index.php,
but not when you execute a.php by itself.  

-- 
~Joey Morwick

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



Re: [PHP] Mixing classes

2004-10-20 Thread Bruno B B Magalhães
Hi Tomy,
I did the same thing!
I´ve used a class called framework to encapsulate everything... here is 
what looks like:

framework.inc.php
?php
/**
* Project: BBBM Framework
* File: framework.inc.php
*
* @desc Main Framework Include
* @link http://www.bbbm.com.br/
* @copyright 2004 Bruno B B Magalhaes
* @author Bruno B B Magalhaes [EMAIL PROTECTED]
* @package BBBM Framework
* @version 0.5-dev
*/
session_start();
/**
* Include Core Classes
*/
require_once(FRAMEWORK_DIR.'core/framework.class.php');
require_once(FRAMEWORK_DIR.'core/preferences.class.php');
require_once(FRAMEWORK_DIR.'core/languages.class.php');
require_once(FRAMEWORK_DIR.'core/database.class.php');
require_once(FRAMEWORK_DIR.'core/authentication.class.php');
require_once(FRAMEWORK_DIR.'core/input.class.php');
require_once(FRAMEWORK_DIR.'smarty/smarty.class.php');
require_once(FRAMEWORK_DIR.'core/output.class.php');
require_once(FRAMEWORK_DIR.'core/modules.class.php');
require_once(FRAMEWORK_DIR.'core/validation.class.php');
require_once(FRAMEWORK_DIR.'core/filters.class.php');
/**
* Include Shared Classes
*/
include_once(FRAMEWORK_DIR.'shared/categories.class.php');
?
framework.class.php
?php
/**
* Project: BBBM Framework
* File: framework.class.php
*
* @desc Main Framework Class
* @link http://www.bbbm.com.br/
* @copyright 2004 Bruno B B Magalhaes
* @author Bruno B B Magalhaes [EMAIL PROTECTED]
* @package BBBM Framework
* @version 0.5-dev
*/
class framework
{
	var $preferences;
	var $database;
	var $authentication;
	var $input;
	var $output;
	var $modules;
	var $validation;
	var $filters;
	var $languages;
	
	var $controller;
	
	/**
	* PHP 4 Constructor
	*/
	function framework()
	{
		$this-preferences = new preferences();// Preferences Layer
		$this-languages = new languages();	// Language Layer
		$this-database = new database($this-preferences);		// Database Layer
		$this-input = new input();		// Input Layer		
		$this-modules = new modules($this-database);			// Modules Layer
		$this-authentication = new authentication($this-database);	// 
Authentication Layer
		$this-output = new output($this-preferences,$this-languages);	// 
Ouput Layer
		$this-validation = new validation();	// Validation functions
		$this-filters = new filters();		// Filters Functions
	}
	
	function is_valid_controller($contoller='')
	{
		if($contoller != '')
		{
			$contoller = addslashes(strip_tags($contoller));
			$this-database-build_table(array('controllers'));
			
			$query = 'SELECT
	controllerStatus
FROM
	'.$this-database-table['controllers'].'
WHERE
	controllerPath=\''.$contoller.'\'
';
			
			$this-database-query($query);
			
			if($this-database-num_rows()  0)
			{
$this-database-fetch_array();

if($this-database-row['controllerStatus']  0)
{
	$this-controller = $contoller;
	return true;
}
else
{
	$this-controller = false;
	return false;
}
			}
			else
			{
$this-controller = false;
return false;
			}
		}
		else
		{
			return false;
		}
	}
}
?

Regards,
Bruno B B Magalhães
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] wrapper

2004-10-20 Thread Stanislav Kuhn
Hi everybody,

i'm trying open url by fopen or file_get_content but always receive error
message
failed to open stream: no suitable wrapper could be found
i know only about one php variable has to be set allow_url_fopen = On and it
is.
I run it on two different servers on first it works there is php 4.3.9 and
on second server it doesn't there is php 4.3.4 and configuration looks to me
same.
Does somebody know about any other (se)things?

tnx.
S.

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



[PHP] remote file existance when protected by a .htaccess

2004-10-20 Thread Mag
Hi,
I have a form where the user specifies a remote image
so it can be made into a thumb, before that I am
trying to make sure the image exists using this code:

$chk_gallery = @fopen ($remote_image, r);
if (!$chk_gallery) 
{echo font color=redbERROR:/b/fontbrUnable
to fetch the remote image;exit;}
fclose($chk_gallery);

which works great except I have been getting some 403
access denied errors for some sites, checking I see
that they are protected by a htaccess file (that
checks the referrer) so i tried putting 

header('referer: domain')

where domain is the parse_url['host'] of $remote_file
but that too has failed...


Any ideas?

Thanks,
Mag



=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] fopen by URL is disabled, is there another way of reading a remote webpage?

2004-10-20 Thread Chuck Barnett
Hi, my new server has fopen by url disabled.  My ISP doesn't want to turn it
on.  So is there a way to do an equivilant function some other way?  I need
to read a remote webpage and manipulate it.

Thanks,
Chuck

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



Re: [PHP] fopen by URL is disabled, is there another way of reading a remote webpage?

2004-10-20 Thread Greg Donald
On Wed, 20 Oct 2004 10:46:34 -0500, Chuck Barnett
[EMAIL PROTECTED] wrote:
 Hi, my new server has fopen by url disabled.  My ISP doesn't want to turn it
 on.  So is there a way to do an equivilant function some other way?  I need
 to read a remote webpage and manipulate it.

#!/usr/bin/php
?php
`wget http://yahoo.com`
?


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] remote file existance when protected by a .htaccess

2004-10-20 Thread Matt M.
 which works great except I have been getting some 403
 access denied errors for some sites, checking I see
 that they are protected by a htaccess file (that
 checks the referrer) so i tried putting
 
 header('referer: domain')
 
 where domain is the parse_url['host'] of $remote_file
 but that too has failed...
 
 Any ideas?


might want to try http://pear.php.net/package/HTTP_Client

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



RE: [PHP] fputcsv() error message

2004-10-20 Thread Pablo Gosse
[snip]
Fatal error: Call to undefined function: fputcsv() in
/home/webdev/sites/tracking_site/scripts/report.php on line 19

Is there something that I am missing?  The code that I had entered in:
[/snip]

http://ca.php.net/fputcsv

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



[PHP] Regexp help

2004-10-20 Thread Chris Boget
What would the regex look like to accept *any* character
for a value but the total length of the value can be no greater
than 50 characters.  The regex I am trying to use is as follows

^[\d\D\w\W\s\S.]{0,50}$

but it doesn't appear to be working...
Any ideas?

thnx,
Chris

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



[PHP] parsing a string

2004-10-20 Thread Dan McCullough
Hey everyone
 
Having a bit of trouble with something.
 
I have a string which has known patterns.
 
$stringCampusBob (Williams)~\toms more crap)~\blah blah 
blah)~\;
 
What I am looking for is 
 
Location which is Campus
  Location Name which is Bob (Williams)
 
Help?
 


-
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

[PHP] Re: parsing a string

2004-10-20 Thread Greg Beaver
Dan McCullough wrote:
Hey everyone
 
Having a bit of trouble with something.
 
I have a string which has known patterns.
 
$stringCampusBob (Williams)~\toms more crap)~\blah blah blah)~\;
 
What I am looking for is 
 
Location which is Campus
  Location Name which is Bob (Williams)
$x = explode('~', $string);
list($location, $name) = explode('', $x[0]);
Make sure that for each \ in the string, you use \\ (that's why there 
are 10 in my example.  If you have 5 \ you need 5 \\)

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


RE: [PHP] fputcsv() error message

2004-10-20 Thread Steven
Yes, I know.  That is the exact page where I got the code from. If you
notice I copied and pasted what is on that page in my previous email.

--
fputcsv
(no version information, might be only in CVS)

fputcsv --  Format line as CSV and write to file pointer 
Description
int fputcsv ( resource handle, array fields [, string delimiter [,
string enclosure]])


fputcsv() formats a line (passed as a fields array) as CSV and write it
to the specified file handle. Returns the length of the written string,
or FALSE on failure. 

The optional delimiter parameter sets the field delimiter (one character
only). Defaults as a comma: ,. 

The optional enclosure parameter sets the field enclosure (one character
only) and defaults to a double quotation mark: . 

Example 1. fputcsv() example

?php

$list = array (
   'aaa,bbb,ccc,',
   '123,456,789',
   'aaa,bbb'
);

$fp = fopen('file.csv', 'w');

foreach ($list as $line) {
   fputcsv($fp, split(',', $line));
}

fclose($fp);
?  
 


Note: If you are having problems with PHP not recognizing the line
endings when reading files either on or created by a Macintosh computer,
you might want to enable the auto_detect_line_endings run-time
configuration option.

See also fgetcsv(). 




 add a note User Contributed Notes
fputcsv 
There are no user contributed notes for this page.

fpassthru fputs 
 
  Last updated: Wed, 20 Oct 2004
--

Giving me the link to the page with no explanation as to why you gave me
the link to the page does not help in the slightest.  I cannot decipher
the meaning on the page other than:

(no version information, might be only in CVS)

means that the manual is useless.

I'll figure it out by myself.

Steven Altsman 

-Original Message-
From: Pablo Gosse [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 19, 2004 12:40 PM
To: Steven; [EMAIL PROTECTED]
Subject: RE: [PHP] fputcsv() error message

[snip]
Fatal error: Call to undefined function: fputcsv() in
/home/webdev/sites/tracking_site/scripts/report.php on line 19

Is there something that I am missing?  The code that I had entered in:
[/snip]

http://ca.php.net/fputcsv

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

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



[PHP] Re: parsing a string

2004-10-20 Thread M. Sokolewicz
Not sure what you want exactly, but here's a way using regexps to 
retrieve the strings seperatly:
?php
$string = 'CampusBob (Williams)~\toms more 
crap)~\blah blah blah)~\';
preg_match('#([^|]*)[|]+([^|]*)~[\]+([^\]*)~[\]+([^\]*)~[\]+#Ui', 
$string, $res);
$campus = $res[1];
$bob = $res[2];
$crap = $res[3];
$blah = $res[4];
?
Now, if you wanted the positions... then something like this would work:

?php
$string = 'CampusBob (Williams)~\toms more 
crap)~\blah blah blah)~\';
preg_match('#([^|]*)[|]+([^|]*)~[\]+([^\]*)~[\]+([^\]*)~[\]+#Ui', 
$string, $res);

$campus = strpos($string, $res[1]);
$bob = strpos($string, $res[2]);
$crap = strpos($string, $res[3]);
$blah = strpos($string, $res[4]);
?
Dan McCullough wrote:
Hey everyone
 
Having a bit of trouble with something.
 
I have a string which has known patterns.
 
$stringCampusBob (Williams)~\toms more crap)~\blah blah blah)~\;
 
What I am looking for is 
 
Location which is Campus
  Location Name which is Bob (Williams)
 
Help?
 


-
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP on Windows

2004-10-20 Thread Jonathan Haddad
So I'm setting up a website that needs to run on a windows server.  
There are file uploads.  What do I need to do to make the directory 
writable?  I'm sure it's very obvious but when the time comes to do it 
it has to happen immediately.

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


Re: [PHP] fputcsv() error message

2004-10-20 Thread Greg Donald
On Wed, 20 Oct 2004 11:54:24 -0500, Steven [EMAIL PROTECTED] wrote:
 Yes, I know.  That is the exact page where I got the code from. If you
 notice I copied and pasted what is on that page in my previous email.

(no version information, might be only in CVS)

The function is obviously still in CVS as I posted yesterday.  Your
version of PHP simply doesn't have it.  Checkout a CVS version of PHP
and build it, or live without the function.  It's not that hard to
understand.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] PHP on Windows

2004-10-20 Thread Greg Donald
On Wed, 20 Oct 2004 12:59:40 -0400, Jonathan Haddad
[EMAIL PROTECTED] wrote:
 So I'm setting up a website that needs to run on a windows server.
 There are file uploads.  What do I need to do to make the directory
 writable?  I'm sure it's very obvious but when the time comes to do it
 it has to happen immediately.

Right-click on the folder icon, and uncheck the read-only box.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



RE: [PHP] PHP on Windows

2004-10-20 Thread Jay Blanchard
[snip]
So I'm setting up a website that needs to run on a windows server.  
There are file uploads.  What do I need to do to make the directory 
writable?  I'm sure it's very obvious but when the time comes to do it 
it has to happen immediately.
[/snip]

http://forums.devshed.com/archive/t-152240

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



[PHP] url

2004-10-20 Thread Dan McCullough
I have this old script I wrote 2-3 years back.  I gets arguments from the url.  
index.php?area=blah
 
The client moved the code to another server and some odd happened.  Nothing seems to 
be parsing from the URL anymore.
 
The top code is 
 
? if (!isset($area)) { ?
HTML
 
THis code no longer seems to work and I am racking my brain trying to figure out what.



Theres no such thing as a problem unless the servers are on fire!


-
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

Re: [PHP] PHP on Windows

2004-10-20 Thread bbonkosk
http://www.google.com/search?hl=enq=Windows+directories+writable

- Original Message -
From: Jonathan Haddad [EMAIL PROTECTED]
Date: Wednesday, October 20, 2004 12:59 pm
Subject: [PHP] PHP on Windows

 So I'm setting up a website that needs to run on a windows server. 
 
 There are file uploads.  What do I need to do to make the 
 directory 
 writable?  I'm sure it's very obvious but when the time comes to 
 do it 
 it has to happen immediately.
 
 Thanks,
 Jon
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP] PHP on Windows

2004-10-20 Thread Jonel Rienton
Hi, you might also wanna give the identity/username php is running under and
give it ntfs write permission to the directory. It should be on the
Properties of the directory and Security Tab.

Regards,
Jonel


On 10/20/04 12:02 PM, Greg Donald [EMAIL PROTECTED] wrote:

 On Wed, 20 Oct 2004 12:59:40 -0400, Jonathan Haddad
 [EMAIL PROTECTED] wrote:
 So I'm setting up a website that needs to run on a windows server.
 There are file uploads.  What do I need to do to make the directory
 writable?  I'm sure it's very obvious but when the time comes to do it
 it has to happen immediately.
 
 Right-click on the folder icon, and uncheck the read-only box.
 

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



Re: [PHP] url

2004-10-20 Thread John Nichel
Dan McCullough wrote:
I have this old script I wrote 2-3 years back.  I gets arguments from the url.  index.php?area=blah
 
The client moved the code to another server and some odd happened.  Nothing seems to be parsing from the URL anymore.
 
The top code is 
 
? if (!isset($area)) { ?
HTML
 
THis code no longer seems to work and I am racking my brain trying to figure out what.
register_globals
Search the archives and/or manual for it.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] url

2004-10-20 Thread Neal Carmine
register_globals is most likely turned off on the new server (as it should
be). do a phpinfo() to see. 

Or change the code to  ? if (!isset($_GET['area'])) { ? to use the super
global arrays.

neal

-Original Message-
From: Dan McCullough [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 20, 2004 11:08 AM
To: PHP General List
Subject: [PHP] url

I have this old script I wrote 2-3 years back.  I gets arguments from the
url.  index.php?area=blah
 
The client moved the code to another server and some odd happened.  Nothing
seems to be parsing from the URL anymore.
 
The top code is 
 
? if (!isset($area)) { ?
HTML
 
THis code no longer seems to work and I am racking my brain trying to figure
out what.



Theres no such thing as a problem unless the servers are on fire!


-
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

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



Re: [PHP] url

2004-10-20 Thread Greg Donald
On Wed, 20 Oct 2004 10:07:38 -0700 (PDT), Dan McCullough
[EMAIL PROTECTED] wrote:
 I have this old script I wrote 2-3 years back.  I gets arguments from the url.  
 index.php?area=blah
 
 The client moved the code to another server and some odd happened.  Nothing seems to 
 be parsing from the URL anymore.
 
 The top code is
 
 ? if (!isset($area)) { ?
 HTML
 
 THis code no longer seems to work and I am racking my brain trying to figure out 
 what.

register_globals is probably off.

You can fix this with an .htaccess file if the web server is apache:

php_flag register_globals on

or you can fix the code:

if(isset($_GET['area']))


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] fopen by URL is disabled, is there another way of reading a remote webpage?

2004-10-20 Thread Jennifer Goodie
-- Original message from Chuck Barnett : -- 

 Hi, my new server has fopen by url disabled. My ISP doesn't want to turn it 
 on. So is there a way to do an equivilant function some other way? I need 
 to read a remote webpage and manipulate it. 
 
 Thanks, 
 Chuck 

You could use sockets. Here's an example from the archives
http://marc.theaimsgroup.com/?l=php-generalm=105052005332001w=2

The example is sending a POST, but you can easily change it to a GET.

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



Re: [PHP] url

2004-10-20 Thread Mike Smith
My guess is your client has the latest version of PHP (4.2.0) whiile
the old server had an older version (pre 4.2.0).

register_globals = off in the php.ini
http://us2.php.net/manual/en/ini.sect.data-handling.php#ini.register-globals

Change
? if (!isset($area)) { ?
to
? if (!isset($_GET['area'])) { ?


On Wed, 20 Oct 2004 10:07:38 -0700 (PDT), Dan McCullough
[EMAIL PROTECTED] wrote:
 I have this old script I wrote 2-3 years back.  I gets arguments from the url.  
 index.php?area=blah
 
 The client moved the code to another server and some odd happened.  Nothing seems to 
 be parsing from the URL anymore.
 
 The top code is
 
 ? if (!isset($area)) { ?
 HTML
 
 THis code no longer seems to work and I am racking my brain trying to figure out 
 what.
 
 
 Theres no such thing as a problem unless the servers are on fire!
 
 -
 Do you Yahoo!?
 vote.yahoo.com - Register online to vote today!


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



Re: [PHP] url

2004-10-20 Thread Janet Valade
Dan McCullough wrote:
I have this old script I wrote 2-3 years back.  I gets arguments from the url.  index.php?area=blah
 
The client moved the code to another server and some odd happened.  Nothing seems to be parsing from the URL anymore.
 
The top code is 
 
? if (!isset($area)) { ?
HTML
 
THis code no longer seems to work and I am racking my brain trying to figure out what.
It probably has to do with settings in php.ini. The new server probably 
has register_globals = off. The old one probably had it set to on.

Try $_GET['area'] instead of $area.
Janet


Theres no such thing as a problem unless the servers are on fire!

-
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

--
Janet Valade -- janet.valade.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] fopen by URL is disabled, is there another way of readi ng a remote webpage?

2004-10-20 Thread Vail, Warren
CURL?

http://www.php.net/manual/en/ref.curl.php

Warren Vail
 


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 20, 2004 10:25 AM
To: Chuck Barnett
Cc: PHP General List
Subject: Re: [PHP] fopen by URL is disabled, is there another way of reading
a remote webpage?


-- Original message from Chuck Barnett : -- 

 Hi, my new server has fopen by url disabled. My ISP doesn't want to 
 turn it
 on. So is there a way to do an equivilant function some other way? I need 
 to read a remote webpage and manipulate it. 
 
 Thanks,
 Chuck 

You could use sockets. Here's an example from the archives
http://marc.theaimsgroup.com/?l=php-generalm=105052005332001w=2

The example is sending a POST, but you can easily change it to a GET.

-- 
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] Mixing classes

2004-10-20 Thread Tomi Kaistila
Hi all!
I finally got what I was after, after numerous tips and suggestion. 
Thank you for your patience. Special thanks to Bruno Magalhães, Thomas 
Goyne, and Davy Obdam.

Thanks again :-)
--
developer  programmer
me tomi kaistila
home http://www.datamike.org
gnupg 0xFA63E4C7
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: parsing a string

2004-10-20 Thread Dan McCullough
I knew I shouldnt have abreviated the string.
here is the string sorry I kinda flubbed on the last string
LocationCampus~\\n-\nNameBob 
Williams~\\n-\nAddress123 Main St~\\n-\n...
 
the ... is a very long list.
 
how does this change the preg_match

M. Sokolewicz [EMAIL PROTECTED] wrote:
Not sure what you want exactly, but here's a way using regexps to 
retrieve the strings seperatly:
$string = 'CampusBob (Williams)~\toms more 
crap)~\blah blah blah)~\';
preg_match('#([^|]*)[|]+([^|]*)~[\]+([^\]*)~[\]+([^\]*)~[\]+#Ui', 
$string, $res);
$campus = $res[1];
$bob = $res[2];
$crap = $res[3];
$blah = $res[4];
?
Now, if you wanted the positions... then something like this would work:

$string = 'CampusBob (Williams)~\toms more 
crap)~\blah blah blah)~\';
preg_match('#([^|]*)[|]+([^|]*)~[\]+([^\]*)~[\]+([^\]*)~[\]+#Ui', 
$string, $res);

$campus = strpos($string, $res[1]);
$bob = strpos($string, $res[2]);
$crap = strpos($string, $res[3]);
$blah = strpos($string, $res[4]);
?

Dan McCullough wrote:
 Hey everyone
 
 Having a bit of trouble with something.
 
 I have a string which has known patterns.
 
 $stringCampusBob (Williams)~\toms more crap)~\blah blah 
 blah)~\;
 
 What I am looking for is 
 
 Location which is Campus
 Location Name which is Bob (Williams)
 
 Help?
 
 
 
 -
 Do you Yahoo!?
 vote.yahoo.com - Register online to vote today!

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




Theres no such thing as a problem unless the servers are on fire!


-
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.

[PHP] heredoc syntax

2004-10-20 Thread Adil
anyone know why heredoc syntax might not work with php5/apache installed.  I
can't get even the simplest strings in heredoc syntax to work and I've tried
just cutting and pasting other peoples stuff in that syntax as well, and
still no luck

thx.
Adil.

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



Re: [PHP] Regexp help

2004-10-20 Thread John Holmes
 From: Chris Boget [EMAIL PROTECTED]
 Subject: [PHP] Regexp help
 
 What would the regex look like to accept *any* character
 for a value but the total length of the value can be no greater
 than 50 characters.  The regex I am trying to use is as follows
 
 ^[\d\D\w\W\s\S.]{0,50}$
 
 but it doesn't appear to be working...
 Any ideas?

Well, strlen() would be more appropriate than a regular expression to check for the 
length of a string. 

Wouldn't /^.{0,50}$/ work, though?

---John Holmes...

(back to Cisco training... ;)

UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html

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



[PHP] Re: heredoc syntax

2004-10-20 Thread M. Sokolewicz
Adil wrote:
anyone know why heredoc syntax might not work with php5/apache installed.  I
can't get even the simplest strings in heredoc syntax to work and I've tried
just cutting and pasting other peoples stuff in that syntax as well, and
still no luck
thx.
Adil.
works fine here... using a 5.0.2-CVS from a few days ago
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Problem with php 4/5, segmentation fault

2004-10-20 Thread robert mena
Hi,

I have a Linux Fedora Core2 system with apache 2.0.51 and php
installed. Recently I 've noticed that some pages stopped working.

Those pages while accessed does not output anything.

After some tests I noticed that the page comes back to live if I
remove the mysql_pconnect call.

I've tried to upgrade php (to 4.3.9 and even 5.0.2).  The mysqlclient
tool can connect with no problem.

The test script is

?php

error_reporting(E_ALL) ;
echo HI ;

if(mysql_pconnect(databasehost,user,pass))
{
echo OK ;
}
else
{
echo NOT OK ;
}

?

If I access via http nothing appears.  If I use the cli version I can connect.

Regular html and php without db access work ok.

I've even tryed to downgrade or reinstall apache to 2.0.50 or back to 2.0.51.

Any ideas ?

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



Re: [PHP] heredoc syntax

2004-10-20 Thread Janet Valade
Adil wrote:
anyone know why heredoc syntax might not work with php5/apache installed.  I
can't get even the simplest strings in heredoc syntax to work and I've tried
just cutting and pasting other peoples stuff in that syntax as well, and
still no luck
thx.
Adil.
Heredoc syntax is pretty rigid and it's easy to have it wrong invisibly.
$varname = END
Text of string
END;
The first END must be at the end of the line, nothing after it, not even 
a blank space. The last END must be at the beginning of the line, not 
before it, not even a blank space.

Janet

--
Janet Valade -- janet.valade.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Best way to allow a user to indicate formatting to be displayed but stored.

2004-10-20 Thread GH
I guess this means I do not have pear... right?


Warning: main(): open_basedir restriction in effect.
File(/usr/share/pear/PEAR.php) is not within the allowed path(s):
(/var/www/garyhotko.com) in /var/www/garyhotko.com/html/Test/test.php
on line 2

Warning: main(PEAR.php): failed to open stream: Operation not
permitted in /var/www/garyhotko.com/html/Test/test.php on line 2

Warning: main(): open_basedir restriction in effect.
File(/usr/share/pear/PEAR.php) is not within the allowed path(s):
(/var/www/garyhotko.com) in /var/www/garyhotko.com/html/Test/test.php
on line 2

Warning: main(PEAR.php): failed to open stream: Operation not
permitted in /var/www/garyhotko.com/html/Test/test.php on line 2

Fatal error: main(): Failed opening required 'PEAR.php'
(include_path='.:/usr/share/pear') in
/var/www/garyhotko.com/html/Test/test.php on line 2


On Thu, 30 Sep 2004 18:17:05 +0200, Marek Kilimajer [EMAIL PROTECTED] wrote:
 GH wrote:
  Thank you all for the information... however at a second look I
  realized that I failed to better describe my needs...
 
  My current plan is to have a series of articles and information stored
  in my database...
 
  The table will have a ID, Title, Author, Image, Content, Date/Time
 
  What I would like to have is say someone needs to do a sub heading...
  I would like to have it automatically be the same subheading format
  for all of the content... in addition to the formatting...
 
 The answer is CSS.
 
 
  Also... I saw one refer to PEAR, since I am on a shared server is
  there a way to test if pear is available... (never worked with it and
  am still new to PHP sorry)
 
 ?php
 require('PEAR.php');
 ?
 
 If that does not give you error, PEAR is installed. Not necessarily all
 packages.


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



Re: [PHP] Re: Best way to allow a user to indicate formatting to be displayed but stored.

2004-10-20 Thread Greg Donald
On Wed, 20 Oct 2004 15:01:56 -0400, GH [EMAIL PROTECTED] wrote:
 I guess this means I do not have pear... right?

You can download the PEAR files and put them most anywhere.  They
don't have to be in the standard location.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Re: Best way to allow a user to indicate formatting to be displayed but stored.

2004-10-20 Thread Marek Kilimajer
GH wrote:
I guess this means I do not have pear... right?
This rather means the server is not configured right. Ask your hosting 
company to include /usr/share/pear/ in open_basedir, I don't see any 
reason they shouln't. If they won't anyway install pear in your own 
webspace and set include_path to contain the pear directory.

Warning: main(): open_basedir restriction in effect.
File(/usr/share/pear/PEAR.php) is not within the allowed path(s):
(/var/www/garyhotko.com) in /var/www/garyhotko.com/html/Test/test.php
on line 2
Warning: main(PEAR.php): failed to open stream: Operation not
permitted in /var/www/garyhotko.com/html/Test/test.php on line 2
Warning: main(): open_basedir restriction in effect.
File(/usr/share/pear/PEAR.php) is not within the allowed path(s):
(/var/www/garyhotko.com) in /var/www/garyhotko.com/html/Test/test.php
on line 2
Warning: main(PEAR.php): failed to open stream: Operation not
permitted in /var/www/garyhotko.com/html/Test/test.php on line 2
Fatal error: main(): Failed opening required 'PEAR.php'
(include_path='.:/usr/share/pear') in
/var/www/garyhotko.com/html/Test/test.php on line 2
On Thu, 30 Sep 2004 18:17:05 +0200, Marek Kilimajer [EMAIL PROTECTED] wrote:
GH wrote:
Thank you all for the information... however at a second look I
realized that I failed to better describe my needs...
My current plan is to have a series of articles and information stored
in my database...
The table will have a ID, Title, Author, Image, Content, Date/Time
What I would like to have is say someone needs to do a sub heading...
I would like to have it automatically be the same subheading format
for all of the content... in addition to the formatting...
The answer is CSS.

Also... I saw one refer to PEAR, since I am on a shared server is
there a way to test if pear is available... (never worked with it and
am still new to PHP sorry)
?php
require('PEAR.php');
?
If that does not give you error, PEAR is installed. Not necessarily all
packages.

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


Re: [PHP] Re: parsing a string

2004-10-20 Thread Dan McCullough
I tried the print_r on $res.  The preg_match does the first set fine.
So I get:
 
Campus
Bob (Williams)
 
the second one starts 
-
Address123 Main St
-
CityOxford
 
 
and so on
[EMAIL PROTECTED] wrote:
preg_match('#([^|]*)[|]+([^|]*)~[\\]+(([^\\]*)~[\\]+)+#Ui', $string, $res);
use print_r on the $res to check for the results (I'm not 100% sure if
they'll come out in $res[2], $res[3], $res[4], etc. or in $res[4][0],
$res[4][1], etc.


 I knew I shouldnt have abreviated the string.
 here is the string sorry I kinda flubbed on the last string
 LocationCampus~\\n-\nNameBob
 Williams~\\n-\nAddress123 Main
 St~\\n-\n...

 the ... is a very long list.

 how does this change the preg_match

 M. Sokolewicz wrote:
 Not sure what you want exactly, but here's a way using regexps to
 retrieve the strings seperatly:
 $string = 'CampusBob (Williams)~\toms more
 crap)~\blah blah blah)~\';
 preg_match('#([^|]*)[|]+([^|]*)~[\]+([^\]*)~[\]+([^\]*)~[\]+#Ui',
 $string, $res);
 $campus = $res[1];
 $bob = $res[2];
 $crap = $res[3];
 $blah = $res[4];
 ?
 Now, if you wanted the positions... then something like this would work:

 $string = 'CampusBob (Williams)~\toms more
 crap)~\blah blah blah)~\';
 preg_match('#([^|]*)[|]+([^|]*)~[\]+([^\]*)~[\]+([^\]*)~[\]+#Ui',
 $string, $res);

 $campus = strpos($string, $res[1]);
 $bob = strpos($string, $res[2]);
 $crap = strpos($string, $res[3]);
 $blah = strpos($string, $res[4]);
 ?

 Dan McCullough wrote:
 Hey everyone

 Having a bit of trouble with something.

 I have a string which has known patterns.

 $stringCampusBob (Williams)~\toms more
 crap)~\blah blah blah)~\;

 What I am looking for is

 Location which is Campus
 Location Name which is Bob (Williams)

 Help?



 -
 Do you Yahoo!?
 vote.yahoo.com - Register online to vote today!

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



 
 Theres no such thing as a problem unless the servers are on fire!


 -
 Do you Yahoo!?
 Yahoo! Mail - Helps protect you from nasty viruses.




Theres no such thing as a problem unless the servers are on fire!


-
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.

[PHP] Send variable in include()

2004-10-20 Thread Pete
I'm trying to send a variable an include that is recieve from another page:

- navi.php-
a href =\'http://www.example.com/view.php?offset=0\;Test/a

- view.php -
I recieve $offset with avalue of 0 nicely, echo ($offset); will show a 
value.
Now a do this:
include 'http://www.example.com/guestbook.php?option=viewoffset=$offset';

- guestbook.php -
$offset gets value $offset instead of 0
$option has correct value, view

How do I write my include so it works?
Would appriciate som help.

Regards,

Pete

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



Re: [PHP] str_replace problem

2004-10-20 Thread Chris Ditty
Thanks all for the tips.  Was able to get it working like I wanted.

Chris

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



Re: [PHP] heredoc syntax

2004-10-20 Thread Matthew Weier O'Phinney
* Janet Valade [EMAIL PROTECTED]:
 Adil wrote:

 anyone know why heredoc syntax might not work with php5/apache installed.  I
 can't get even the simplest strings in heredoc syntax to work and I've tried
 just cutting and pasting other peoples stuff in that syntax as well, and
 still no luck

 Heredoc syntax is pretty rigid and it's easy to have it wrong invisibly.
^
That's the key -- whitespace is invisible to the naked eye typically.

 $varname = END
 Text of string
 END;

 The first END must be at the end of the line, nothing after it, not even 
 a blank space. The last END must be at the beginning of the line, not 
 before it, not even a blank space.

And don't forget that the last END must be followed by a semi-colon
ONLY, no other characters on that line... ;-)

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] Send variable in include()

2004-10-20 Thread John Nichel
Pete wrote:
I'm trying to send a variable an include that is recieve from another page:
- navi.php-
a href =\'http://www.example.com/view.php?offset=0\;Test/a
- view.php -
I recieve $offset with avalue of 0 nicely, echo ($offset); will show a 
value.
Now a do this:
include 'http://www.example.com/guestbook.php?option=viewoffset=$offset';
Variables do not get parsed inside single quotes.  Either quote your 
include statement with double quotes, or break out of the single quotes 
and append the variable.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: heredoc syntax

2004-10-20 Thread Matthew Weier O'Phinney
* Adil [EMAIL PROTECTED]:
 anyone know why heredoc syntax might not work with php5/apache installed.  I
 can't get even the simplest strings in heredoc syntax to work and I've tried
 just cutting and pasting other peoples stuff in that syntax as well, and
 still no luck

I use heredocs pretty extensively for SQL, and have had no problems with
it in PHP5. Are you sure you're forming the heredoc correctly --
regarding whitespace and punctuation? For reference:

http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] Re: heredoc syntax

2004-10-20 Thread Rory Browne
What OS are you using? On windows, you may have problems with the \r\n
newline system. I read somewhere that the heredoc syntax requires the
use of unix-style \n's

Are you getting any error messages. If it didn't work you should get a
syntax error. If so what was it?


On Wed, 20 Oct 2004 20:46:54 +0200, M. Sokolewicz [EMAIL PROTECTED] wrote:
 Adil wrote:
 
  anyone know why heredoc syntax might not work with php5/apache installed.  I
  can't get even the simplest strings in heredoc syntax to work and I've tried
  just cutting and pasting other peoples stuff in that syntax as well, and
  still no luck
 
  thx.
  Adil.
 works fine here... using a 5.0.2-CVS from a few days ago
 
 
 
 --
 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] Mac OS X and Editor

2004-10-20 Thread Brent Baisley
BBEdit, of course. I use it for just about all my coding, not just php. 
Not free, but a free fully functional demo is available. I forget if 
the demo is a certain number of launches or a time limit.
I have looked into Zend Studio and Eclipse, but they are a bit slow on 
a laptop.

On Oct 20, 2004, at 4:12 PM, Jonel Rienton wrote:
Hi guys, I just like to ask those using Macs here as to what editor 
and/or
IDE they are using for writing PHP codes.

Thanks and regards to all.
Jonel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Mac OS X and Editor

2004-10-20 Thread James McGlinn
Hi Jonel,
Hi guys, I just like to ask those using Macs here as to what editor 
and/or
IDE they are using for writing PHP codes.
I'm using Zend Studio (ZDE) - it works as well as any I've tried.  It's 
significantly faster than Eclipse too (on a G4 PowerBook 1.33Ghz/512MB 
RAM).

James McGlinn
Project Manager
BCom, BSc, Zend Certified Engineer (PHP)
Servers.co.nz Ltd
68 Shortland St, Auckland	PO Box 3688 Shortland St, Auckland, New 
Zealand
Phone: 0800 4 SERVERS	Fax: +64 9 358 5187

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


[PHP] Announce:ASPA 1.1

2004-10-20 Thread Anakreon
Hello.
I'd like to announce the release of version 1.1 of ASPA.
ASPA is an ASP to PHP translator. It uses syntax and schematic analysis 
in order to produce PHP code of equivalent functionality with the original
ASP code. It supports both JS and VB script.

For more info see:http://storm.cs.unipi.gr/~anakreon/aspa.html
Anakreon. 

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


RE: [PHP] Mac OS X and Editor

2004-10-20 Thread Michael Sims
Jonel Rienton wrote:
 Hi guys, I just like to ask those using Macs here as to what editor
 and/or IDE they are using for writing PHP codes.

I don't personally use Mac OS X, but let me throw in a recommendation for jEdit
(www.jedit.org).  It's Java based, hence cross-platform, and extremely powerful.  I
use it on Windows and couldn't live without it.  I have installed it on my friend's
iMac long enough to see that it works, but not long enough to know of any
platform-specific issues and/or gotchas.

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



Re: [PHP] Mac OS X and Editor

2004-10-20 Thread Larry E . Ullman
Hi guys, I just like to ask those using Macs here as to what editor 
and/or
IDE they are using for writing PHP codes.
BBEdit is generally consider to be one of the best (note: I said one 
of the best, not best, so let's not start about how emacs, vi, and 
vim are better) text editors available on any platform. It's very easy 
to use yet powerful (supports grep, works with Xcode, has command line 
tools, etc). The new version 8 ties into Apache, letting you test PHP 
scripts in the application. It's a text editor, not an IDE, though. 
There are PHP- and SQL-specific libraries built in so that it 
recognizes function names and such.

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


[PHP] Re: Mac OS X and Editor

2004-10-20 Thread Daniel Schierbeck
Jonel Rienton wrote:
Hi guys, I just like to ask those using Macs here as to what editor and/or
IDE they are using for writing PHP codes.
Thanks and regards to all.
Jonel
I use the Eclipse IDE (www.eclipse.org) with phpEclipse 
(www.phpeclipse.org) or Xored Trustudio (www.xored.com) on Windows (hey, 
I'm poor), but the Eclipse IDE is cross-platform (so are the plugins as 
far is I know.)

--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com): 
http://www.spreadfirefox.com/?q=user/registerr=6584

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


Re: [PHP] Mac OS X and Editor

2004-10-20 Thread Daniel Schierbeck
James McGlinn wrote:
I'm using Zend Studio (ZDE) - it works as well as any I've tried.  It's 
significantly faster than Eclipse too (on a G4 PowerBook 1.33Ghz/512MB 
RAM).
Hmm, maybe (have you tried out Eclipse 3.0?), but I still find the 
interface of Eclipse superior to Zend Studio's (that's just plain ugly 
and confusing) - plus, it's free! And open-source! Yay!

--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com): 
http://www.spreadfirefox.com/?q=user/registerr=6584

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


Re: [PHP] remote file existance when protected by a .htaccess

2004-10-20 Thread Matt M.
 Nope, no PEAR allowedany other options?

curl, Is that available to you?

http://us2.php.net/curl

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



Re: [PHP] remote file existance when protected by a .htaccess

2004-10-20 Thread Mag

  which works great except I have been getting some
 403
  access denied errors for some sites, checking I
 see
  that they are protected by a htaccess file (that
  checks the referrer) so i tried putting
  
  header('referer: domain')
  
  where domain is the parse_url['host'] of
 $remote_file
  but that too has failed...
  
  Any ideas?
 
 
 might want to try
 http://pear.php.net/package/HTTP_Client

Nope, no PEAR allowedany other options?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] remote file existance when protected by a .htaccess

2004-10-20 Thread Robby Russell
On Wed, 2004-10-20 at 09:53 -0700, Mag wrote:
   which works great except I have been getting some
  403
   access denied errors for some sites, checking I
  see
   that they are protected by a htaccess file (that
   checks the referrer) so i tried putting
   
   header('referer: domain')
   
   where domain is the parse_url['host'] of
  $remote_file
   but that too has failed...
   
   Any ideas?
  
  
  might want to try
  http://pear.php.net/package/HTTP_Client
 
 Nope, no PEAR allowedany other options?

No PEAR allowed?

Why not? You can include the libraries in your own paths...

-Robby


-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


Re: [PHP] remote file existance when protected by a .htaccess

2004-10-20 Thread Matt M.
  Nope, no PEAR allowedany other options?

also 

http://us2.php.net/fsockopen

check the user comments for setting referer

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



[PHP] Mac OS X and Editor

2004-10-20 Thread Jonel Rienton
Hi guys, I just like to ask those using Macs here as to what editor and/or
IDE they are using for writing PHP codes.

Thanks and regards to all.

Jonel

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



[PHP] Moving uploaded image tmp file problem

2004-10-20 Thread Dave Grant
Hello, I wonder if someone has ran into a problem similar to or related to 
this before.

I have a rather large form that, among other things, allows the user to 
upload 2 images, one small, the other slighly larger.  They upload just 
fine, they show up in the $_FILES array, and I do error checking on them 
which seems to pass.

Then I move them with the following code:

$thumbPath = $GLOBALS[dvdimgpath].$_POST[gameId]._thumb.jpg;
$fullPath = $GLOBALS[dvdimgpath].$_POST[gameId]._full.jpg;
if ($DEBUG) echo Thumb image uploaded to .$thumbPath.br /\n;
if (!move_uploaded_file($_FILES[thumbImage][tmp_name], $thumbPath)) {
echo Image file could not moved to the images dir.  Please try 
again;
}
if ($DEBUG) echo Full image uploaded to .$fullPath.br /\n;
if (!move_uploaded_file($_FILES[fullImage][tmp_name], $fullPath)) {
echo Image file could not moved to the images dir.  Please try 
again;
}

The images are not there when I go to look for them in the destination 
directory.  Any suggestions or ideas?  Thanks. 

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



  1   2   >